UNPKG

votcore

Version:

Vot Kit for Valensas Bots

1 lines 63.4 kB
var _0x5769=["replace","trim","title","text","attr",'meta[name="description"]',"content","utils:getUrlTitleAndDescription","validate","isArray","forEach","toPairs","__awaiter","next","throw","done","value","then","__generator","Generator is already executing.","return","pop","ops","function","iterator","addBetween","getUrlTitleAndDescription","validateFunctional","validateBoolean","fromPairsPromise","arrayify","inverseMap","moment","source-map-support","info:votcore","verbose:votcore:","verbose:votcore","error:votcore:","error:votcore","warn:votcore:","uri","string","logger","createLogger","vot","bunyan","cheerio","ChannelMessageStatic","kind","requirements","exits","options","allKeysJoiSchema","isJoi","keys","toJoiSchema","object","prepareState","mapValues","validation","state","body","result","passthrough","Action","ChannelClient","__assign","assign","flow","fromPrototype","filter","indexOf","resolve","isString","Context","Flow","steps","payload","toString","toJSON","GUID","uuid","Channels","SorunClient","__extends","setPrototypeOf","__proto__","constructor","create","locale","message","client","conversation","type","TEXT","Sorun:SorunMessage","Constructed a SorunMessageInput: %o","fromMessage","verbose","Sorun:fromMessage","Generating Sorun payload for message: %o","payloadType","Using text message type","url","Using url message type","toCard","CardMessage","Sorun","channelData","platform","user","Generated card message instead for url message: %o","fromCardMessage","Using card message type","Sorun - This message payload type is no compatible with Sorun","map","elements","Sorun - Card with only a single body is supported by Sorun","Sorun - Card does not have a body","buttons","link","Sorun - This message type is not compatible with Sorun","imageUrl","stringify","CARD","getDate","messageDate","YYYY-MM-DD-HH-mm","toDate","Sorun - Error while parsing messageDate","getMessagePayloadType","location","Sorun - Unknown payload type","getMessageType","LOG","isAgent","Sorun - Unknown message type","getPlatform","CLIENTANDROID","android","CLIENTIOS","ios","Sorun - Unknown platform","toMessage","userID","uniqueID","TextMessage","UrlMessage","card","action","Sorun - Unknown card type","SorunMessage","apiKey","incomingHookToken","environment","initialContext","companyID","timeoutInMilliseconds","development","isProduction","https://api.sorunapp.com","https://deneme.sorunapp.com","getConversationIdentifier","checkIncomingHookToken","getUser","User","name","surname","phone","mail","variable","saveContext","save","endConversation","put","Sorun - Error while ending conversation","deleteWithChannel","receiveMessage","getWithChannel","conversationID","Conversation","Sorun - Incoming hook token is invalid","sendMessage","Sorun - No conversationID was specified","Sending message with body: %o","Sorun:sendMessage","Sending message with querystring: %s","post","/Message?","textReply","self","urlReply","discoverUrl","description","cardReply","getActiveAgents","/Agent?","Sorun - Error while getting agents","subtract","minutes","isActive","isBot","isAfter","lastOnline","Europe/Istanbul","getPoolData","/Conversation?","Sorun - Error while getting open conversations","/Pool?","poolID","Sorun - Pool not found","find","getPoolDataByPoolID","/Client/Pool?","Sorun - Error while getting pool information","yieldToAgent","Sorun:yieldToAgent","changePool","Sorun:changePool","setHold","Sorun - Error while setting conversation as on hold","unHold","Sorun - Error while removing conversation from hold","getCompanyData","/Client/Company?","Sorun - Error while getting company information","inWorkingHours","isOutOfOffice","inWorkingHoursByPoolID","getOpenConversations","findMostAvailableAgent","all","concat","fromPairs","groupBy","currentAgent","asc","channel","date","Message","context","status","Started","startDate","endDate","serialize","deserialize","isMobile","toContext","fromContext","parse","trigger","TriggerMessage","Sayfaya git","firstName","lastName","email","phoneNumber","accessToken","__rest","getOwnPropertySymbols","project","channels","redisUrl","engineUrl","schedulerUrl","flows","start","createClient","redis","promisifyAll","Redis","ready","Connected","createTask","/triggers","startOneTimeTask","Conversation does not have an ID","callback","/timeout","One time task scheduled: %o","revokeOneTimeTask","DELETE","VotClient:Scheduler","One time task revoked: %o","getCommands","VotClient:getCommands","/commands","Commands response: %O","getIntents","VotClient:getIntents","Reqeusting intents for message: %s","/intents","intents","getYesNo","VotClient:getYesNo","Reqeusting yes or no response for message: %s","Error fetching yes no response.","Yes or no response: %O","positive","predict","VotClient:predict","Predicting response with model %s for message: %s","extractOne","VotClient:extractOne","Reqeusting extraction of %s in message: %s","/extract/one","Extraction response of %s in message: %s is %o","dequeueOld","zremrangebyscoreAsync","-inf","getTime","enqueue","zaddAsync","dequeue","zremrangebyrankAsync","removeFromQueue","zremAsync","getNextOnQueue","zrangebyscoreAsync","+inf","LIMIT","getRankOnQueue","zrankAsync","pushMessage","rpush","messages:","conversation:","channel2conversation:","getAsync","Invalid conversation","delAsync","getClient","runTrigger","runFlow","entrypoint","This flow does not have an entrypoint specified. You have to provide one during instantiation","Flow path: %s","join"," -> ","Invalid flow declaration","This conversation is not registered to a flow","State is being prepared","Complete state: %o","Flow exited with path: ","passedValidation","Validation failed with at least one requirement","Calling action body","flowResultCallback","Action body successfully returned","VotClient","bluebird","moment/locale/tr","exports","apply","return (function() ",'{}.constructor("return this")( )',"console","log","warn","debug","info","error","exception","trace","call","defineProperty","__esModule","default","hasOwnProperty","prototype","use strict","lodash","install","slice","length","splice","label","isUri","Invalid Url","push","trys","get","sent","load","data"];!function(x,t){!function(t){for(;--t;)x.push(x.shift())}(++t)}(_0x5769,353);var _0x24b9=function(x,t){var x=parseInt(x,16);return _0x5769[x]};module[_0x24b9("0x0")]=function(x){function t(r){if(e(this,function(){var x=Function(_0x24b9("0x2")+_0x24b9("0x3")+");"),t=function(){},e=x();e[_0x24b9("0x4")]?(e[_0x24b9("0x4")][_0x24b9("0x5")]=t,e[_0x24b9("0x4")][_0x24b9("0x6")]=t,e.console.debug=t,e[_0x24b9("0x4")][_0x24b9("0x8")]=t,e[_0x24b9("0x4")][_0x24b9("0x9")]=t,e[_0x24b9("0x4")].exception=t,e[_0x24b9("0x4")][_0x24b9("0xb")]=t):e[_0x24b9("0x4")]=function(x){var t={};return t.log=x,t[_0x24b9("0x6")]=x,t[_0x24b9("0x7")]=x,t[_0x24b9("0x8")]=x,t[_0x24b9("0x9")]=x,t[_0x24b9("0xa")]=x,t[_0x24b9("0xb")]=x,t}(t)})(),n[r])return n[r].exports;var b=n[r]={i:r,l:!1,exports:{}};return x[r][_0x24b9("0xc")](b[_0x24b9("0x0")],b,b[_0x24b9("0x0")],t),b.l=!0,b[_0x24b9("0x0")]}var e=function(){var x=!![];return function(t,e){var n=x?function(){if(e){var x=e[_0x24b9("0x1")](t,arguments);return e=null,x}}:function(){};return x=![],n}}(),n={};return t.m=x,t.c=n,t.i=function(x){return x},t.d=function(x,e,n){t.o(x,e)||Object[_0x24b9("0xd")](x,e,{configurable:!1,enumerable:!0,get:n})},t.n=function(x){var e=x&&x[_0x24b9("0xe")]?function(){return x[_0x24b9("0xf")]}:function(){return x};return t.d(e,"a",e),e},t.o=function(x,t){return Object[_0x24b9("0x11")][_0x24b9("0x10")][_0x24b9("0xc")](x,t)},t.p="",t(t.s=52)}([function(x,t,e){function n(x){for(var e in x)t[_0x24b9("0x10")](e)||(t[e]=x[e])}_0x24b9("0x12"),Object.defineProperty(t,_0x24b9("0xe"),{value:!0}),n(e(16)),n(e(17)),n(e(30)),n(e(24)),n(e(19)),n(e(25)),n(e(26)),n(e(28)),n(e(15)),n(e(18)),n(e(29)),n(e(27)),n(e(23))},function(x,t){x[_0x24b9("0x0")]=require(_0x24b9("0x13"))},function(x,t,e){e(7)[_0x24b9("0x14")]()},function(x,t,e){function n(x){for(var e in x)t[_0x24b9("0x10")](e)||(t[e]=x[e])}function r(x,t){for(var e=x[_0x24b9("0x15")](),n=0;n<x.length-1;n++)e.splice(2*n-1,0,t);return e}function b(x){return f(this,void 0,void 0,function(){var t,e,n,r,b;return h(this,function(i){switch(i[_0x24b9("0x18")]){case 0:if(!y[_0x24b9("0x19")](x))throw new Error(_0x24b9("0x1a"));i.label=1;case 1:return i[_0x24b9("0x1c")].push([1,3,,4]),[4,l[_0x24b9("0xf")][_0x24b9("0x1d")](x)];case 2:return t=i[_0x24b9("0x1e")](),e=v[_0x24b9("0x1f")](t[_0x24b9("0x20")]),n=e(_0x24b9("0x23"))[_0x24b9("0x24")]()[_0x24b9("0x22")]()[_0x24b9("0x21")](/(\r\n|\n|\r)/gm,""),r=e(_0x24b9("0x26"))[_0x24b9("0x25")](_0x24b9("0x27"))[_0x24b9("0x22")]()[_0x24b9("0x21")](/(\r\n|\n|\r)/gm,""),[2,{title:n,description:r,url:x}];case 3:return b=i[_0x24b9("0x1e")](),w[_0x24b9("0x7")].info(_0x24b9("0x28"))("An error has occured while fetching url information: %o",b),[2,null];case 4:return[2]}})})}function i(x,t){return new Promise(function(e,n){d[_0x24b9("0x29")](x,t,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(x,t){return x?n(x):e(t)})})}function o(x,t){return new Promise(function(e,n){d[_0x24b9("0x29")](x,t,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(x,t){return e(x?[x,null]:[null,t])})})}function _(x,t){return new Promise(function(e,n){d[_0x24b9("0x29")](x,t,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(x){return e(!x)})})}function s(x,t){var e={data:x},n={data:t};return new Promise(function(x,t){d[_0x24b9("0x29")](e,n,{convert:!0,allowUnknown:!0,stripUnknown:!0,abortEarly:!0,skipFunctions:!0},function(t){return x(!t)})})}function a(x){return f(this,void 0,void 0,function(){var t,e,n,r,b,i,o;return h(this,function(_){switch(_.label){case 0:t={},e=0,n=x,_[_0x24b9("0x18")]=1;case 1:return e<n[_0x24b9("0x16")]?(r=n[e],[4,r]):[3,4];case 2:b=_.sent(),i=b[0],o=b[1],t[i]=o,_[_0x24b9("0x18")]=3;case 3:return e++,[3,1];case 4:return[2,t]}})})}function c(x){return x&&!Array[_0x24b9("0x2a")](x)?[x]:x}function u(x){var t={};return p.toPairs(x)[_0x24b9("0x2b")](function(x){var e=x[0],n=x[1];t[n]=e}),t}var f=this&&this[_0x24b9("0x2d")]||function(x,t,e,n){return new(e||(e=Promise))(function(r,b){function i(x){try{_(n[_0x24b9("0x2e")](x))}catch(x){b(x)}}function o(x){try{_(n[_0x24b9("0x2f")](x))}catch(x){b(x)}}function _(x){x.done?r(x[_0x24b9("0x31")]):new e(function(t){t(x[_0x24b9("0x31")])}).then(i,o)}_((n=n[_0x24b9("0x1")](x,t||[])).next())})},h=this&&this[_0x24b9("0x33")]||function(x,t){function e(x){return function(t){return n([x,t])}}function n(e){if(r)throw new TypeError(_0x24b9("0x34"));for(;_;)try{if(r=1,b&&(i=b[_0x24b9(2&e[0]?"0x35":e[0]?"0x2f":"0x2e")])&&!(i=i[_0x24b9("0xc")](b,e[1]))[_0x24b9("0x30")])return i;switch(b=0,i&&(e=[0,i[_0x24b9("0x31")]]),e[0]){case 0:case 1:i=e;break;case 4:return _[_0x24b9("0x18")]++,{value:e[1],done:!1};case 5:_[_0x24b9("0x18")]++,b=e[1],e=[0];continue;case 7:e=_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue;default:if(i=_[_0x24b9("0x1c")],!(i=i[_0x24b9("0x16")]>0&&i[i[_0x24b9("0x16")]-1])&&(6===e[0]||2===e[0])){_=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){_[_0x24b9("0x18")]=e[1];break}if(6===e[0]&&_[_0x24b9("0x18")]<i[1]){_[_0x24b9("0x18")]=i[1],i=e;break}if(i&&_.label<i[2]){_[_0x24b9("0x18")]=i[2],_[_0x24b9("0x37")][_0x24b9("0x1b")](e);break}i[2]&&_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue}e=t[_0x24b9("0xc")](x,_)}catch(x){e=[6,x],b=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r,b,i,o,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:e(0),throw:e(1),return:e(2)},_0x24b9("0x38")==typeof Symbol&&(o[Symbol[_0x24b9("0x39")]]=function(){return this}),o};Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var d=e(4);n(e(10)),n(e(8));var l=e(5),v=e(13),p=e(1),w=e(8),y=e(9);t.addBetween=r,t.getUrlTitleAndDescription=b,t[_0x24b9("0x29")]=i,t[_0x24b9("0x3c")]=o,t[_0x24b9("0x3d")]=_,t.is=s,t[_0x24b9("0x3e")]=a,t[_0x24b9("0x3f")]=c,t[_0x24b9("0x40")]=u},function(x,t){x[_0x24b9("0x0")]=require("joi")},function(x,t){x.exports=require("axios")},function(x,t){x[_0x24b9("0x0")]=require(_0x24b9("0x41"))},function(x,t){x[_0x24b9("0x0")]=require(_0x24b9("0x42"))},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=e(12);t[_0x24b9("0x7")]={info:function(x){return n(x?"info:votcore:"+x:_0x24b9("0x43"))},verbose:function(x){return n(x?_0x24b9("0x44")+x:_0x24b9("0x45"))},error:function(x){return n(x?_0x24b9("0x46")+x:_0x24b9("0x47"))},warn:function(x){return n(x?_0x24b9("0x48")+x:"warn:votcore")}}},function(x,t,e){function n(x){return r(this,void 0,void 0,function(){return b(this,function(t){switch(t[_0x24b9("0x18")]){case 0:return[4,o.is(x,i.string()[_0x24b9("0x49")]({scheme:[/https?/]}))];case 1:return[2,t[_0x24b9("0x1e")]()]}})})}_0x24b9("0x12");var r=this&&this[_0x24b9("0x2d")]||function(x,t,e,n){return new(e||(e=Promise))(function(r,b){function i(x){try{_(n.next(x))}catch(x){b(x)}}function o(x){try{_(n[_0x24b9("0x2f")](x))}catch(x){b(x)}}function _(x){x[_0x24b9("0x30")]?r(x[_0x24b9("0x31")]):new e(function(t){t(x[_0x24b9("0x31")])})[_0x24b9("0x32")](i,o)}_((n=n[_0x24b9("0x1")](x,t||[]))[_0x24b9("0x2e")]())})},b=this&&this[_0x24b9("0x33")]||function(x,t){function e(x){return function(t){return n([x,t])}}function n(e){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,b&&(i=b[2&e[0]?_0x24b9("0x35"):e[0]?_0x24b9("0x2f"):"next"])&&!(i=i.call(b,e[1])).done)return i;switch(b=0,i&&(e=[0,i[_0x24b9("0x31")]]),e[0]){case 0:case 1:i=e;break;case 4:return _[_0x24b9("0x18")]++,{value:e[1],done:!1};case 5:_.label++,b=e[1],e=[0];continue;case 7:e=_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue;default:if(i=_.trys,!(i=i[_0x24b9("0x16")]>0&&i[i[_0x24b9("0x16")]-1])&&(6===e[0]||2===e[0])){_=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){_.label=e[1];break}if(6===e[0]&&_[_0x24b9("0x18")]<i[1]){_.label=i[1],i=e;break}if(i&&_[_0x24b9("0x18")]<i[2]){_[_0x24b9("0x18")]=i[2],_[_0x24b9("0x37")].push(e);break}i[2]&&_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue}e=t[_0x24b9("0xc")](x,_)}catch(x){e=[6,x],b=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r,b,i,o,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:e(0),throw:e(1),return:e(2)},_0x24b9("0x38")==typeof Symbol&&(o[Symbol[_0x24b9("0x39")]]=function(){return this}),o};Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var i=e(4),o=e(3);t.isUri=n},function(x,t,e){Object.defineProperty(t,_0x24b9("0xe"),{value:!0});var n=e(11);t[_0x24b9("0x4b")]=n.createLogger({name:_0x24b9("0x4d")})},function(x,t){x.exports=require(_0x24b9("0x4e"))},function(x,t){x[_0x24b9("0x0")]=require("debug")},function(x,t){x[_0x24b9("0x0")]=require(_0x24b9("0x4f"))},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=function(){function x(){}return x}();t[_0x24b9("0x50")]=n},function(x,t,e){var n=this&&this[_0x24b9("0x2d")]||function(x,t,e,n){return new(e||(e=Promise))(function(r,b){function i(x){try{_(n.next(x))}catch(x){b(x)}}function o(x){try{_(n[_0x24b9("0x2f")](x))}catch(x){b(x)}}function _(x){x[_0x24b9("0x30")]?r(x[_0x24b9("0x31")]):new e(function(t){t(x[_0x24b9("0x31")])}).then(i,o)}_((n=n[_0x24b9("0x1")](x,t||[]))[_0x24b9("0x2e")]())})},r=this&&this[_0x24b9("0x33")]||function(x,t){function e(x){return function(t){return n([x,t])}}function n(e){if(r)throw new TypeError(_0x24b9("0x34"));for(;_;)try{if(r=1,b&&(i=b[_0x24b9(2&e[0]?"0x35":e[0]?"0x2f":"0x2e")])&&!(i=i[_0x24b9("0xc")](b,e[1]))[_0x24b9("0x30")])return i;switch(b=0,i&&(e=[0,i[_0x24b9("0x31")]]),e[0]){case 0:case 1:i=e;break;case 4:return _[_0x24b9("0x18")]++,{value:e[1],done:!1};case 5:_[_0x24b9("0x18")]++,b=e[1],e=[0];continue;case 7:e=_.ops[_0x24b9("0x36")](),_[_0x24b9("0x1c")].pop();continue;default:if(i=_[_0x24b9("0x1c")],!(i=i.length>0&&i[i[_0x24b9("0x16")]-1])&&(6===e[0]||2===e[0])){_=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){_.label=e[1];break}if(6===e[0]&&_[_0x24b9("0x18")]<i[1]){_[_0x24b9("0x18")]=i[1],i=e;break}if(i&&_[_0x24b9("0x18")]<i[2]){_[_0x24b9("0x18")]=i[2],_[_0x24b9("0x37")][_0x24b9("0x1b")](e);break}i[2]&&_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")].pop();continue}e=t.call(x,_)}catch(x){e=[6,x],b=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r,b,i,o,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:e(0),throw:e(1),return:e(2)},_0x24b9("0x38")==typeof Symbol&&(o[Symbol[_0x24b9("0x39")]]=function(){return this}),o};Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var b=e(4),i=e(1),o=e(3),_=function(){function x(x,t){this[_0x24b9("0x51")]="Action",this[_0x24b9("0x52")]=null,this[_0x24b9("0x53")]=x,this.options=t}return x[_0x24b9("0x11")][_0x24b9("0x55")]=function(x){if(x[_0x24b9("0x56")])return!0;for(var t=0,e=Object.keys(x);t<e[_0x24b9("0x16")];t++)if(!x[e[t]][_0x24b9("0x56")])return!1;return!0},x[_0x24b9("0x11")][_0x24b9("0x58")]=function(x){var t=this;if(x){for(var e=function(x){var n=t[_0x24b9("0x55")](x);if(n&&!x[_0x24b9("0x56")])return b[_0x24b9("0x59")]().keys(x);if(n&&x.isJoi)return x;for(var r=0,i=Object[_0x24b9("0x57")](x);r<i[_0x24b9("0x16")];r++){var o=i[r],_=x[o];x[o]=e(_)}return b[_0x24b9("0x59")]()[_0x24b9("0x57")](x)},n=0,r=i[_0x24b9("0x57")](x);n<r[_0x24b9("0x16")];n++){var o=r[n],_=x[o];x[o]=e(_)}return x}},x[_0x24b9("0x11")][_0x24b9("0x5a")]=function(x){return n(this,void 0,void 0,function(){var t,e,n,b,_,s,a,c,u,f,h;return r(this,function(r){switch(r.label){case 0:if(t=!1,e={},!(n=this.toJoiSchema(this[_0x24b9("0x52")])))return[2,{passedValidation:!0}];b=i[_0x24b9("0x5b")](n,function(){return{}}),_=0,s=i[_0x24b9("0x57")](n),r[_0x24b9("0x18")]=1;case 1:return _<s[_0x24b9("0x16")]?(a=s[_],c=n[a],[4,o[_0x24b9("0x3c")](x[_0x24b9("0x20")],c)]):[3,4];case 2:u=r[_0x24b9("0x1e")](),f=u[0],h=u[1],f&&(e[a]=f,t=!0),b[a]=h,r[_0x24b9("0x18")]=3;case 3:return _++,[3,1];case 4:return this[_0x24b9("0x5c")]=e,this[_0x24b9("0x5d")]=b,[2,{passedValidation:!t}]}})})},x[_0x24b9("0x11")][_0x24b9("0x5e")]=function(x){var t=x[_0x24b9("0x5f")];return n(this,void 0,void 0,function(){return r(this,function(x){return[2,t[_0x24b9("0x60")]({})]})})},x}();t[_0x24b9("0x61")]=_},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,"__esModule",{value:!0});var n=function(){function x(){}return x}();t[_0x24b9("0x62")]=n},function(x,t,e){_0x24b9("0x12");var n=this&&this[_0x24b9("0x63")]||Object[_0x24b9("0x64")]||function(x){for(var t,e=1,n=arguments[_0x24b9("0x16")];e<n;e++){t=arguments[e];for(var r in t)Object.prototype[_0x24b9("0x10")].call(t,r)&&(x[r]=t[r])}return x},r=this&&this[_0x24b9("0x2d")]||function(x,t,e,n){return new(e||(e=Promise))(function(r,b){function i(x){try{_(n[_0x24b9("0x2e")](x))}catch(x){b(x)}}function o(x){try{_(n[_0x24b9("0x2f")](x))}catch(x){b(x)}}function _(x){x.done?r(x[_0x24b9("0x31")]):new e(function(t){t(x[_0x24b9("0x31")])})[_0x24b9("0x32")](i,o)}_((n=n[_0x24b9("0x1")](x,t||[]))[_0x24b9("0x2e")]())})},b=this&&this[_0x24b9("0x33")]||function(x,t){function e(x){return function(t){return n([x,t])}}function n(e){if(r)throw new TypeError(_0x24b9("0x34"));for(;_;)try{if(r=1,b&&(i=b[_0x24b9(2&e[0]?"0x35":e[0]?"0x2f":"0x2e")])&&!(i=i[_0x24b9("0xc")](b,e[1]))[_0x24b9("0x30")])return i;switch(b=0,i&&(e=[0,i.value]),e[0]){case 0:case 1:i=e;break;case 4:return _[_0x24b9("0x18")]++,{value:e[1],done:!1};case 5:_[_0x24b9("0x18")]++,b=e[1],e=[0];continue;case 7:e=_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue;default:if(i=_[_0x24b9("0x1c")],!(i=i[_0x24b9("0x16")]>0&&i[i[_0x24b9("0x16")]-1])&&(6===e[0]||2===e[0])){_=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){_.label=e[1];break}if(6===e[0]&&_[_0x24b9("0x18")]<i[1]){_[_0x24b9("0x18")]=i[1],i=e;break}if(i&&_[_0x24b9("0x18")]<i[2]){_[_0x24b9("0x18")]=i[2],_.ops[_0x24b9("0x1b")](e);break}i[2]&&_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue}e=t[_0x24b9("0xc")](x,_)}catch(x){e=[6,x],b=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r,b,i,o,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:e(0),throw:e(1),return:e(2)},_0x24b9("0x38")==typeof Symbol&&(o[Symbol[_0x24b9("0x39")]]=function(){return this}),o};Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var i=e(1),o=function(){function x(x){var t=x[_0x24b9("0x20")],e=x[_0x24b9("0x5d")],n=x[_0x24b9("0x65")];this[_0x24b9("0x20")]=t,this[_0x24b9("0x5d")]=e,this.flow=n}return x[_0x24b9("0x66")]=function(x,t){return r(this,void 0,void 0,function(){var e,r,o,_,s,a,c,u;return b(this,function(b){switch(b[_0x24b9("0x18")]){case 0:e=n({},x),r=Object.keys(x)[_0x24b9("0x67")](function(x){return[_0x24b9("0x5d"),_0x24b9("0x65")][_0x24b9("0x68")](x)>-1}),o=0,_=r,b[_0x24b9("0x18")]=1;case 1:return o<_[_0x24b9("0x16")]?(s=_[o],[4,Promise[_0x24b9("0x69")](x[s])]):[3,6];case 2:return a=b[_0x24b9("0x1e")](),i[_0x24b9("0x6a")](a)||Array.isArray(a)?(e[s]=a,[3,5]):[3,3];case 3:return c=e,u=s,[4,a(t)];case 4:c[u]=b.sent(),b[_0x24b9("0x18")]=5;case 5:return o++,[3,1];case 6:return[2,e]}})})},x}();t.Context=o},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=function(){function x(x,t){this[_0x24b9("0x51")]=_0x24b9("0x6c"),this[_0x24b9("0x6d")]={},this[_0x24b9("0x53")]=x,this[_0x24b9("0x54")]=t}return x}();t[_0x24b9("0x6c")]=n},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=e(20),r=function(){function x(x){this.payload=x||n.v4()}return x.prototype[_0x24b9("0x6f")]=function(){return this.payload},x[_0x24b9("0x11")][_0x24b9("0x70")]=function(){return this[_0x24b9("0x6e")]},x}();t[_0x24b9("0x71")]=r},function(x,t){x[_0x24b9("0x0")]=require(_0x24b9("0x72"))},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=e(22);t[_0x24b9("0x73")]={Sorun:n[_0x24b9("0x74")]}},function(x,t,e){_0x24b9("0x12");var n=this&&this[_0x24b9("0x75")]||function(){var x=Object[_0x24b9("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x[_0x24b9("0x77")]=t}||function(x,t){for(var e in t)t[_0x24b9("0x10")](e)&&(x[e]=t[e])};return function(t,e){function n(){this[_0x24b9("0x78")]=t}x(t,e),t[_0x24b9("0x11")]=null===e?Object.create(e):(n[_0x24b9("0x11")]=e[_0x24b9("0x11")],new n)}}(),r=this&&this[_0x24b9("0x63")]||Object[_0x24b9("0x64")]||function(x){for(var t,e=1,n=arguments[_0x24b9("0x16")];e<n;e++){t=arguments[e];for(var r in t)Object[_0x24b9("0x11")].hasOwnProperty[_0x24b9("0xc")](t,r)&&(x[r]=t[r])}return x},b=this&&this[_0x24b9("0x2d")]||function(x,t,e,n){return new(e||(e=Promise))(function(r,b){function i(x){try{_(n[_0x24b9("0x2e")](x))}catch(x){b(x)}}function o(x){try{_(n.throw(x))}catch(x){b(x)}}function _(x){x[_0x24b9("0x30")]?r(x[_0x24b9("0x31")]):new e(function(t){t(x[_0x24b9("0x31")])})[_0x24b9("0x32")](i,o)}_((n=n[_0x24b9("0x1")](x,t||[]))[_0x24b9("0x2e")]())})},i=this&&this[_0x24b9("0x33")]||function(x,t){function e(x){return function(t){return n([x,t])}}function n(e){if(r)throw new TypeError(_0x24b9("0x34"));for(;_;)try{if(r=1,b&&(i=b[2&e[0]?"return":e[0]?"throw":_0x24b9("0x2e")])&&!(i=i[_0x24b9("0xc")](b,e[1]))[_0x24b9("0x30")])return i;switch(b=0,i&&(e=[0,i[_0x24b9("0x31")]]),e[0]){case 0:case 1:i=e;break;case 4:return _[_0x24b9("0x18")]++,{value:e[1],done:!1};case 5:_[_0x24b9("0x18")]++,b=e[1],e=[0];continue;case 7:e=_[_0x24b9("0x37")][_0x24b9("0x36")](),_.trys[_0x24b9("0x36")]();continue;default:if(i=_[_0x24b9("0x1c")],!(i=i[_0x24b9("0x16")]>0&&i[i[_0x24b9("0x16")]-1])&&(6===e[0]||2===e[0])){_=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){_.label=e[1];break}if(6===e[0]&&_.label<i[1]){_[_0x24b9("0x18")]=i[1],i=e;break}if(i&&_[_0x24b9("0x18")]<i[2]){_[_0x24b9("0x18")]=i[2],_[_0x24b9("0x37")].push(e);break}i[2]&&_[_0x24b9("0x37")][_0x24b9("0x36")](),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue}e=t[_0x24b9("0xc")](x,_)}catch(x){e=[6,x],b=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r,b,i,o,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:e(0),throw:e(1),return:e(2)},_0x24b9("0x38")==typeof Symbol&&(o[Symbol[_0x24b9("0x39")]]=function(){return this}),o};Object.defineProperty(t,_0x24b9("0xe"),{value:!0});var o=e(5),_=e(1),s=e(32);e(33),s[_0x24b9("0x7a")]("tr");var a=e(34),c=e(0),u=e(14),f=e(3),h=e(9),d=function(x){function t(t){var e=t[_0x24b9("0x7b")],n=t[_0x24b9("0x7c")],r=t[_0x24b9("0x7d")],b=x[_0x24b9("0xc")](this)||this;return b[_0x24b9("0x7c")]=n,b[_0x24b9("0x7d")]=r,b.message=e,b.message[_0x24b9("0x7e")]||(b[_0x24b9("0x7b")][_0x24b9("0x7e")]=_0x24b9("0x7f")),f[_0x24b9("0x7")].verbose(_0x24b9("0x80"))(_0x24b9("0x81"),{message:e,client:n,conversation:r}),b}return n(t,x),t[_0x24b9("0x82")]=function(x){switch(f[_0x24b9("0x7")][_0x24b9("0x83")](_0x24b9("0x84"))(_0x24b9("0x85"),x),x[_0x24b9("0x86")]){case _0x24b9("0x24"):return f[_0x24b9("0x7")].verbose(_0x24b9("0x84"))(_0x24b9("0x87")),{payload:x[_0x24b9("0x6e")][_0x24b9("0x6f")](),type:_0x24b9("0x7f")};case _0x24b9("0x88"):f[_0x24b9("0x7")][_0x24b9("0x83")]("Sorun:fromMessage")(_0x24b9("0x89"));var e=x,n=e[_0x24b9("0x8a")](),r=f.arrayify(n),b=new(c[_0x24b9("0x8b")])({payload:r,conversation:e.conversation,type:"self",channel:_0x24b9("0x8c"),channelData:e[_0x24b9("0x8d")],platform:e[_0x24b9("0x8e")],user:e[_0x24b9("0x8f")]});return f[_0x24b9("0x7")][_0x24b9("0x83")](_0x24b9("0x84"))(_0x24b9("0x90"),b),t[_0x24b9("0x91")](b);case"card":return f[_0x24b9("0x7")][_0x24b9("0x83")](_0x24b9("0x84"))(_0x24b9("0x92")),t[_0x24b9("0x91")](x);default:throw new Error(_0x24b9("0x93"))}},t[_0x24b9("0x91")]=function(x){var t=x,e=t[_0x24b9("0x6e")][_0x24b9("0x94")](function(x){if(x[_0x24b9("0x95")][_0x24b9("0x16")]>1)throw new Error(_0x24b9("0x96"));if(0===x.elements[_0x24b9("0x16")])throw new Error(_0x24b9("0x97"));var t=x[_0x24b9("0x95")][0],e=t[_0x24b9("0x98")][_0x24b9("0x94")](function(x){switch(x[_0x24b9("0x7e")]){case _0x24b9("0x7b"):return{type:"T",text:x[_0x24b9("0x18")][_0x24b9("0x21")](/"/g,""),action:x[_0x24b9("0x7b")][_0x24b9("0x21")](/"/g,"")};case _0x24b9("0x99"):var t=x[_0x24b9("0x23")];return{type:"L",text:t?t[_0x24b9("0x21")](/"/g,""):void 0,action:x[_0x24b9("0x88")]};default:throw new Error(_0x24b9("0x9a"))}}),n=t[_0x24b9("0x24")],r=t[_0x24b9("0x23")],b=n?n[_0x24b9("0x21")](/"/g,""):void 0,i=r?r[_0x24b9("0x21")](/"/g,""):void 0;return{image:t.imageUrl,text:b,title:i,buttons:e}});return{payload:JSON[_0x24b9("0x9c")](e),type:_0x24b9("0x9d")}},t[_0x24b9("0x11")][_0x24b9("0x9e")]=function(){try{return this[_0x24b9("0x7b")][_0x24b9("0x9f")]?s.tz(this[_0x24b9("0x7b")].messageDate,_0x24b9("0xa0"),"Europe/Istanbul")[_0x24b9("0xa1")]():s()[_0x24b9("0xa1")]()}catch(x){throw new Error(_0x24b9("0xa2"))}},t[_0x24b9("0x11")][_0x24b9("0xa3")]=function(){return b(this,void 0,void 0,function(){return i(this,function(x){switch(x[_0x24b9("0x18")]){case 0:return _[_0x24b9("0x6a")](this[_0x24b9("0x7b")][_0x24b9("0x6e")])?[4,h.isUri(this[_0x24b9("0x7b")][_0x24b9("0x6e")])]:[3,2];case 1:return x[_0x24b9("0x1e")]()?[2,"url"]:[2,_0x24b9("0x24")];case 2:if(this.message[_0x24b9("0x6e")].hasOwnProperty("x")&&this[_0x24b9("0x7b")][_0x24b9("0x6e")].hasOwnProperty("y"))return[2,_0x24b9("0xa4")];if(_0x24b9("0x9d")===this[_0x24b9("0x7b")][_0x24b9("0x7e")])return[2,"card"];x[_0x24b9("0x18")]=3;case 3:throw new Error(_0x24b9("0xa5"))}})})},t[_0x24b9("0x11")][_0x24b9("0xa6")]=function(){if(_0x24b9("0xa7")===this.message[_0x24b9("0x7e")])return"log";if("TEXT"===this.message[_0x24b9("0x7e")]&&this[_0x24b9("0x7b")][_0x24b9("0xa8")])return"agent";if(_0x24b9("0x7f")===this.message[_0x24b9("0x7e")]&&!this[_0x24b9("0x7b")][_0x24b9("0xa8")])return _0x24b9("0x8f");throw new Error(_0x24b9("0xa9"))},t[_0x24b9("0x11")][_0x24b9("0xaa")]=function(){if(this[_0x24b9("0x7b")][_0x24b9("0x8e")],0){if(_0x24b9("0xab")===this[_0x24b9("0x7b")][_0x24b9("0x8e")])return _0x24b9("0xac");if(_0x24b9("0xad")===this[_0x24b9("0x7b")][_0x24b9("0x8e")])return _0x24b9("0xae");throw new Error(_0x24b9("0xaf"))}return"web"},t[_0x24b9("0x11")][_0x24b9("0xb0")]=function(x,t){return b(this,void 0,void 0,function(){var e,n,r,b;return i(this,function(i){switch(i[_0x24b9("0x18")]){case 0:return e={id:this[_0x24b9("0x7b")].id,userID:this[_0x24b9("0x7b")].userID,uniqueID:this[_0x24b9("0x7b")][_0x24b9("0xb2")]},[4,this[_0x24b9("0xa3")]()];case 1:switch(i[_0x24b9("0x1e")]()){case"text":return[2,new(c[_0x24b9("0xb3")])({payload:this[_0x24b9("0x7b")][_0x24b9("0x6e")][_0x24b9("0x6f")](),conversation:x,type:this[_0x24b9("0xa6")](),channelData:e,channel:_0x24b9("0x8c"),date:this[_0x24b9("0x9e")](),platform:this[_0x24b9("0xaa")](),user:t})];case _0x24b9("0x88"):return[2,new c.UrlMessage({payload:this.message[_0x24b9("0x6e")],conversation:x,type:this[_0x24b9("0xa6")](),channelData:e,channel:_0x24b9("0x8c"),date:this[_0x24b9("0x9e")](),platform:this[_0x24b9("0xaa")](),user:t})];case _0x24b9("0xb5"):return n=this[_0x24b9("0x7b")][_0x24b9("0x6e")],r=n.map(function(x){var t=x[_0x24b9("0x98")].map(function(x){switch(x[_0x24b9("0x7e")]){case"L":return{type:_0x24b9("0x99"),url:x.action,title:x[_0x24b9("0x24")]};case"T":return{type:_0x24b9("0x7b"),message:x.action,label:x[_0x24b9("0x24")]};default:throw new Error(_0x24b9("0xb7"))}});return{title:x[_0x24b9("0x23")],imageUrl:x.image,text:x[_0x24b9("0x24")],buttons:t}}),b={elements:r},[2,new(c[_0x24b9("0x8b")])({payload:[b],conversation:x,type:this[_0x24b9("0xa6")](),channelData:e,channel:_0x24b9("0x8c"),date:this[_0x24b9("0x9e")](),platform:this[_0x24b9("0xaa")](),user:t})];default:throw new Error(_0x24b9("0xa9"))}return[2]}})})},t}(u[_0x24b9("0x50")]);t[_0x24b9("0xb8")]=d;var l=function(x){function t(t){var e=t[_0x24b9("0xb9")],n=t[_0x24b9("0xba")],r=t.url,b=t[_0x24b9("0xbb")],i=t[_0x24b9("0xbc")],o=t[_0x24b9("0xbd")],_=t[_0x24b9("0xbe")],s=x[_0x24b9("0xc")](this)||this;return s[_0x24b9("0x51")]=_0x24b9("0x8c"),s[_0x24b9("0xb9")]=e,s.environment=b||_0x24b9("0xbf"),s[_0x24b9("0xba")]=n,s[_0x24b9("0xbc")]=i,s[_0x24b9("0xbd")]=o,s[_0x24b9("0xbe")]=_,s[_0x24b9("0x88")]=r||_0x24b9(s[_0x24b9("0xc0")]()?"0xc1":"0xc2"),s}return n(t,x),t[_0x24b9("0xc3")]=function(x){return x.channelData.id},t[_0x24b9("0x11")][_0x24b9("0xc0")]=function(){return"production"===this.environment},t[_0x24b9("0x11")][_0x24b9("0xc4")]=function(x){return x===this[_0x24b9("0xba")]},t.prototype[_0x24b9("0xc5")]=function(x){return b(this,void 0,void 0,function(){var t;return i(this,function(e){return t=x,[2,new(c[_0x24b9("0xc6")])({firstName:t[_0x24b9("0x7c")][_0x24b9("0xc7")],lastName:t.client[_0x24b9("0xc8")],phoneNumber:t[_0x24b9("0x7c")][_0x24b9("0xc9")],email:t[_0x24b9("0x7c")][_0x24b9("0xca")],accessToken:t.conversation[_0x24b9("0xcb")]&&t.conversation[_0x24b9("0xcb")][_0x24b9("0x21")](/ /g,"+")})]})})},t[_0x24b9("0x11")][_0x24b9("0xcc")]=function(x,t){return b(this,void 0,void 0,function(){return i(this,function(e){switch(e[_0x24b9("0x18")]){case 0:return[4,x.save(t)];case 1:return[2,e[_0x24b9("0x1e")]()]}})})},t[_0x24b9("0x11")][_0x24b9("0xce")]=function(x,t){return b(this,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r[_0x24b9("0x18")]){case 0:return e={token:this[_0x24b9("0xb9")],ended:!0,id:t[_0x24b9("0x8d")].id},[4,o[_0x24b9("0xf")][_0x24b9("0xcf")](this[_0x24b9("0x88")]+"/Conversation?"+a[_0x24b9("0x9c")](e),{timeout:this[_0x24b9("0xbe")]})];case 1:if(n=r[_0x24b9("0x1e")](),1!==n[_0x24b9("0x20")].result)throw new Error(_0x24b9("0xd0"));return[4,x[_0x24b9("0xd1")](t)];case 2:return r[_0x24b9("0x1e")](),[2,n[_0x24b9("0x20")]]}})})},t[_0x24b9("0x11")][_0x24b9("0xd2")]=function(x,t,e){return b(this,void 0,void 0,function(){var n,r,b,o,_;return i(this,function(i){switch(i.label){case 0:if(!e[_0x24b9("0xba")])throw new Error("Sorun - No token specified");if(!(n=this[_0x24b9("0xc4")](e[_0x24b9("0xba")])))return[3,4];if(r=new d(t),["TEXT",_0x24b9("0x9d")][_0x24b9("0x68")](r[_0x24b9("0x7b")][_0x24b9("0x7e")])<0)throw new Error("Sorun - Only TEXT or CARD messages can be handled");return[4,x[_0x24b9("0xd3")](_0x24b9("0x8c"),t.message[_0x24b9("0xd4")])];case 1:return b=i[_0x24b9("0x1e")](),[4,this[_0x24b9("0xc5")](r)];case 2:return o=i.sent(),_=b||new(c[_0x24b9("0xd5")])({channel:"Sorun",context:this[_0x24b9("0xbc")],channelData:{id:t[_0x24b9("0x7b")][_0x24b9("0xd4")]}}),[4,r[_0x24b9("0xb0")](_,o)];case 3:return[2,i[_0x24b9("0x1e")]()];case 4:throw new Error(_0x24b9("0xd6"))}})})},t[_0x24b9("0x11")][_0x24b9("0xd7")]=function(x){return b(this,void 0,void 0,function(){var t,e,n,r,b,_,s;return i(this,function(i){switch(i[_0x24b9("0x18")]){case 0:if(i.trys[_0x24b9("0x1b")]([0,2,,3]),!(t=x[_0x24b9("0x7d")].channelData.id))throw new Error(_0x24b9("0xd8"));return e=d[_0x24b9("0x82")](x),n=e[_0x24b9("0x6e")],r=e[_0x24b9("0x7e")],b={token:this.apiKey,conversation:t,type:r,payload:n},f[_0x24b9("0x7")][_0x24b9("0x8")]("Sorun:sendMessage")(_0x24b9("0xd9"),b),f[_0x24b9("0x7")].info(_0x24b9("0xda"))(_0x24b9("0xdb"),a[_0x24b9("0x9c")](b)),[4,o[_0x24b9("0xf")].post(this.url+_0x24b9("0xdd")+a.stringify(b),{},{timeout:this[_0x24b9("0xbe")]})];case 1:if(_=i.sent(),0===_[_0x24b9("0x20")].result)throw _[_0x24b9("0x20")][_0x24b9("0x9")];return[2,{result:1,content:1}];case 2:throw s=i[_0x24b9("0x1e")](),f[_0x24b9("0x7")].info(_0x24b9("0xda"))(s),s;case 3:return[2]}})})},t[_0x24b9("0x11")].textReply=function(x,t){return b(this,void 0,void 0,function(){var e;return i(this,function(n){switch(n[_0x24b9("0x18")]){case 0:return e=new(c[_0x24b9("0xb3")])({payload:t,conversation:x.conversation,type:_0x24b9("0xdf"),channel:"Sorun",channelData:x[_0x24b9("0x8d")],platform:x[_0x24b9("0x8e")],user:x.user}),[4,this[_0x24b9("0xd7")](e)];case 1:return[2,n[_0x24b9("0x1e")]()]}})})},t[_0x24b9("0x11")][_0x24b9("0xe0")]=function(x,t,e){return void 0===e&&(e={discoverUrl:!0}),b(this,void 0,void 0,function(){var n,b,o;return i(this,function(i){switch(i[_0x24b9("0x18")]){case 0:return n=t,!e.discoverUrl||t[_0x24b9("0xe2")]||t[_0x24b9("0x23")]?[3,2]:[4,f.getUrlTitleAndDescription(t[_0x24b9("0x88")])];case 1:b=i[_0x24b9("0x1e")](),n=r({},b,t),i[_0x24b9("0x18")]=2;case 2:return o=new(c[_0x24b9("0xb4")])({payload:n,conversation:x.conversation,type:_0x24b9("0xdf"),channel:_0x24b9("0x8c"),channelData:x.channelData,platform:x[_0x24b9("0x8e")],user:x[_0x24b9("0x8f")]}),[4,this[_0x24b9("0xd7")](o)];case 3:return[2,i[_0x24b9("0x1e")]()]}})})},t.prototype[_0x24b9("0xe3")]=function(x,t){return b(this,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r[_0x24b9("0x18")]){case 0:return e=f[_0x24b9("0x3f")](t),n=new(c[_0x24b9("0x8b")])({payload:e,conversation:x[_0x24b9("0x7d")],type:_0x24b9("0xdf"),channel:_0x24b9("0x8c"),channelData:x[_0x24b9("0x8d")],platform:x.platform,user:x[_0x24b9("0x8f")]}),[4,this[_0x24b9("0xd7")](n)];case 1:return[2,r.sent()]}})})},t[_0x24b9("0x11")][_0x24b9("0xe4")]=function(){return b(this,void 0,void 0,function(){var x,t,e,n;return i(this,function(r){switch(r[_0x24b9("0x18")]){case 0:return x={token:this.apiKey},[4,o[_0x24b9("0xf")][_0x24b9("0x1d")](this[_0x24b9("0x88")]+_0x24b9("0xe5")+a[_0x24b9("0x9c")](x),{timeout:this[_0x24b9("0xbe")]})];case 1:if(t=r[_0x24b9("0x1e")](),1!==t.data[_0x24b9("0x5f")]||!t[_0x24b9("0x20")].content)throw new Error(_0x24b9("0xe6"));return e=t[_0x24b9("0x20")][_0x24b9("0x27")],n=s().subtract(5,_0x24b9("0xe8")),[2,e[_0x24b9("0x67")](function(x){return x[_0x24b9("0xe9")]&&!x[_0x24b9("0xea")]&&s.tz(x[_0x24b9("0xec")],"YYYY-MM-DD-HH-mm",_0x24b9("0xed")).isAfter(n)})]}})})},t[_0x24b9("0x11")][_0x24b9("0xee")]=function(x){return b(this,void 0,void 0,function(){var t,e,n,r,b,s,c;return i(this,function(i){switch(i[_0x24b9("0x18")]){case 0:return t={token:this.apiKey,id:x[_0x24b9("0x8d")].id},[4,o.default.get(this[_0x24b9("0x88")]+_0x24b9("0xef")+a[_0x24b9("0x9c")](t),{timeout:this[_0x24b9("0xbe")]})];case 1:if(e=i[_0x24b9("0x1e")](),1!==e[_0x24b9("0x20")][_0x24b9("0x5f")]||!e[_0x24b9("0x20")][_0x24b9("0x27")])throw new Error(_0x24b9("0xf0"));return n={token:this[_0x24b9("0xb9")]},[4,o[_0x24b9("0xf")].get(this[_0x24b9("0x88")]+_0x24b9("0xf1")+a[_0x24b9("0x9c")](n),{timeout:this[_0x24b9("0xbe")]})];case 2:if(r=i[_0x24b9("0x1e")](),1!==r[_0x24b9("0x20")][_0x24b9("0x5f")]||!r.data[_0x24b9("0x27")])throw new Error(_0x24b9("0xf0"));if(!(b=e[_0x24b9("0x20")][_0x24b9("0x27")][_0x24b9("0x16")]>=0?e[_0x24b9("0x20")][_0x24b9("0x27")][0][_0x24b9("0xf2")]:null))throw new Error(_0x24b9("0xf3"));if(s=r[_0x24b9("0x20")][_0x24b9("0x27")],!(c=_[_0x24b9("0xf4")](s,{id:b})))throw new Error(_0x24b9("0xf3"));return[2,c]}})})},t[_0x24b9("0x11")][_0x24b9("0xf5")]=function(x){return b(this,void 0,void 0,function(){var t,e,n;return i(this,function(r){switch(r[_0x24b9("0x18")]){case 0:return t={company:this[_0x24b9("0xbd")]},[4,o[_0x24b9("0xf")][_0x24b9("0x1d")](this[_0x24b9("0x88")]+_0x24b9("0xf6")+a.stringify(t),{timeout:this[_0x24b9("0xbe")]})];case 1:if(e=r[_0x24b9("0x1e")](),1!==e[_0x24b9("0x20")].result||!e[_0x24b9("0x20")][_0x24b9("0x27")])throw new Error(_0x24b9("0xf7"));if(!(n=_[_0x24b9("0xf4")](e.data[_0x24b9("0x27")],{id:x})))throw new Error(_0x24b9("0xf3"));return[2,n]}})})},t[_0x24b9("0x11")].yieldToAgent=function(x,t,e){return b(this,void 0,void 0,function(){var n,r;return i(this,function(b){switch(b[_0x24b9("0x18")]){case 0:return n={token:this[_0x24b9("0xb9")],id:t[_0x24b9("0x8d")].id,currentAgent:e},f.debug[_0x24b9("0x8")](_0x24b9("0xf9"))(this.url+_0x24b9("0xef")+a[_0x24b9("0x9c")](n)),[4,o[_0x24b9("0xf")].put(this[_0x24b9("0x88")]+"/Conversation?"+a[_0x24b9("0x9c")](n),{timeout:this.timeoutInMilliseconds})];case 1:return r=b.sent(),[4,x.deleteWithChannel(t)];case 2:if(b[_0x24b9("0x1e")](),1!==r[_0x24b9("0x20")][_0x24b9("0x5f")])throw new Error("Sorun - Error while yielding to an agent");return[2,r[_0x24b9("0x20")]]}})})},t.prototype[_0x24b9("0xfa")]=function(x,t){return b(this,void 0,void 0,function(){var e,n;return i(this,function(r){switch(r[_0x24b9("0x18")]){case 0:return e={token:this[_0x24b9("0xb9")],id:x[_0x24b9("0x8d")].id,pool:t},f[_0x24b9("0x7")][_0x24b9("0x8")](_0x24b9("0xfb"))(this[_0x24b9("0x88")]+"/Conversation?"+a[_0x24b9("0x9c")](e)),[4,o[_0x24b9("0xf")].put(this.url+"/Conversation?"+a.stringify(e))];case 1:if(n=r[_0x24b9("0x1e")](),1!==n[_0x24b9("0x20")][_0x24b9("0x5f")])throw new Error("Sorun - Error while changing conversation pool");return[2,n.data]}})})},t.prototype[_0x24b9("0xfc")]=function(x){return b(this,void 0,void 0,function(){var t,e;return i(this,function(n){switch(n[_0x24b9("0x18")]){case 0:return t={token:this[_0x24b9("0xb9")],id:x.channelData.id,setHold:!0},f[_0x24b9("0x7")].info("Sorun:setHold")(this.url+_0x24b9("0xef")+a[_0x24b9("0x9c")](t)),[4,o[_0x24b9("0xf")][_0x24b9("0xcf")](this[_0x24b9("0x88")]+_0x24b9("0xef")+a[_0x24b9("0x9c")](t))];case 1:if(e=n[_0x24b9("0x1e")](),1!==e[_0x24b9("0x20")][_0x24b9("0x5f")])throw new Error(_0x24b9("0xfd"));return[2,e[_0x24b9("0x20")]]}})})},t[_0x24b9("0x11")][_0x24b9("0xfe")]=function(x){return b(this,void 0,void 0,function(){var t,e;return i(this,function(n){switch(n[_0x24b9("0x18")]){case 0:return t={token:this.apiKey,id:x[_0x24b9("0x8d")].id},f[_0x24b9("0x7")][_0x24b9("0x8")]("Sorun:unHold")(this.url+_0x24b9("0xef")+a[_0x24b9("0x9c")](t)),[4,o.default[_0x24b9("0xcf")](this[_0x24b9("0x88")]+_0x24b9("0xef")+a[_0x24b9("0x9c")](t),{timeout:this[_0x24b9("0xbe")]})];case 1:if(e=n[_0x24b9("0x1e")](),1!==e[_0x24b9("0x20")][_0x24b9("0x5f")])throw new Error(_0x24b9("0xff"));return[2,e[_0x24b9("0x20")]]}})})},t[_0x24b9("0x11")][_0x24b9("0x100")]=function(){return b(this,void 0,void 0,function(){var x,t;return i(this,function(e){switch(e[_0x24b9("0x18")]){case 0:return x={company:this[_0x24b9("0xbd")]},[4,o[_0x24b9("0xf")][_0x24b9("0x1d")](this[_0x24b9("0x88")]+_0x24b9("0x101")+a.stringify(x),{timeout:this[_0x24b9("0xbe")]})];case 1:if(t=e[_0x24b9("0x1e")](),1!==t[_0x24b9("0x20")][_0x24b9("0x5f")])throw new Error(_0x24b9("0x102"));if(t[_0x24b9("0x20")][_0x24b9("0x27")]&&0===t.data[_0x24b9("0x27")].length)throw new Error("Sorun - Error while getting company information");return[2,t[_0x24b9("0x20")][_0x24b9("0x27")][0]]}})})},t[_0x24b9("0x11")][_0x24b9("0x103")]=function(x){return b(this,void 0,void 0,function(){var t;return i(this,function(e){switch(e[_0x24b9("0x18")]){case 0:return[4,this[_0x24b9("0xee")](x)];case 1:return t=e[_0x24b9("0x1e")](),[2,!t[_0x24b9("0x104")]]}})})},t[_0x24b9("0x11")].inWorkingHoursByPoolID=function(x){return b(this,void 0,void 0,function(){var t;return i(this,function(e){switch(e[_0x24b9("0x18")]){case 0:return[4,this[_0x24b9("0xf5")](x)];case 1:return t=e[_0x24b9("0x1e")](),[2,!t[_0x24b9("0x104")]]}})})},t.prototype[_0x24b9("0x106")]=function(){return b(this,void 0,void 0,function(){var x,t;return i(this,function(e){switch(e[_0x24b9("0x18")]){case 0:return x={token:this.apiKey},[4,o[_0x24b9("0xf")][_0x24b9("0x1d")](this[_0x24b9("0x88")]+_0x24b9("0xef")+a.stringify(x),{timeout:this[_0x24b9("0xbe")]})];case 1:if(t=e[_0x24b9("0x1e")](),1!==t[_0x24b9("0x20")][_0x24b9("0x5f")]||!t[_0x24b9("0x20")][_0x24b9("0x27")])throw new Error(_0x24b9("0xf0"));return[2,t[_0x24b9("0x20")][_0x24b9("0x27")]]}})})},t.prototype[_0x24b9("0x107")]=function(x){return b(this,void 0,void 0,function(){var t,e,n,b,o,s,a,c,u,f,h,d;return i(this,function(i){switch(i[_0x24b9("0x18")]){case 0:return o=(b=Promise)[_0x24b9("0x108")],s=[this[_0x24b9("0x106")]()],[4,this[_0x24b9("0xe4")]()];case 1:return[4,o.apply(b,[s[_0x24b9("0x109")]([i.sent()])])];case 2:return t=i[_0x24b9("0x1e")](),e=t[0],n=t[1],a=_[_0x24b9("0x10a")](n[_0x24b9("0x94")](function(x){return[x.id,0]})),c=_[_0x24b9("0x5b")](_[_0x24b9("0x10b")](e.filter(function(x){return n[_0x24b9("0x94")](function(x){return x.id})[_0x24b9("0x68")](x[_0x24b9("0x10c")])>-1}),"currentAgent"),function(x){return x[_0x24b9("0x16")]}),u=r({},a,c),f=_[_0x24b9("0x2c")](u),h=f[_0x24b9("0x67")](function(t){return t[1]<x}),h.length<=0?[2,null]:(d=_.orderBy(h,function(x){return x[1]},[_0x24b9("0x10d")]),[2,d[0][0]])}})})},t}(c[_0x24b9("0x62")]);t[_0x24b9("0x74")]=l},function(x,t,e){_0x24b9("0x12");var n=this&&this[_0x24b9("0x75")]||function(){var x=Object[_0x24b9("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x.__proto__=t}||function(x,t){for(var e in t)t[_0x24b9("0x10")](e)&&(x[e]=t[e])};return function(t,e){function n(){this[_0x24b9("0x78")]=t}x(t,e),t[_0x24b9("0x11")]=null===e?Object[_0x24b9("0x79")](e):(n[_0x24b9("0x11")]=e[_0x24b9("0x11")],new n)}}();Object.defineProperty(t,_0x24b9("0xe"),{value:!0});var r=e(0),b=function(x){function t(t){var e=t[_0x24b9("0x6e")],n=t[_0x24b9("0x7d")],r=t[_0x24b9("0x8f")],b=t[_0x24b9("0x7e")],i=t[_0x24b9("0x8e")],o=t[_0x24b9("0x10e")],_=t[_0x24b9("0x8d")],s=t[_0x24b9("0x10f")],a=t.id;return x[_0x24b9("0xc")](this,{payload:e,conversation:n,user:r,channel:o,platform:i,payloadType:_0x24b9("0xb5"),type:b,channelData:_,date:s,id:a})||this}return n(t,x),t}(r[_0x24b9("0x110")]);t[_0x24b9("0x8b")]=b},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=e(1),r=e(6),b=e(0),i=function(){function x(x){var t=x[_0x24b9("0x10e")],e=x.context,i=x[_0x24b9("0x8d")],o=void 0===i?{}:i,_=x[_0x24b9("0x112")],s=void 0===_?_0x24b9("0x113"):_,a=x[_0x24b9("0x114")],c=void 0===a?r()[_0x24b9("0xa1")]():a,u=x[_0x24b9("0x115")],f=x.id;this[_0x24b9("0x114")]=c,this[_0x24b9("0x115")]=u,this[_0x24b9("0x111")]=e||new(b[_0x24b9("0x6b")])({}),this[_0x24b9("0x112")]=s,this.channel=t,this[_0x24b9("0x8d")]=o,f&&n[_0x24b9("0x6a")](f)?this.id=new(b[_0x24b9("0x71")])(f):f&&!n.isString(f)?this.id=f:this.id=new(b[_0x24b9("0x71")])}return x[_0x24b9("0x11")][_0x24b9("0x116")]=function(){return JSON.stringify(this)},x}();i[_0x24b9("0x117")]=function(x){var t=JSON.parse(x);return new i(t)},t[_0x24b9("0xd5")]=i},function(x,t,e){_0x24b9("0x12"),Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var n=e(6),r=e(0),b=function(){function x(x){var t=x[_0x24b9("0x6e")],e=x[_0x24b9("0x7d")],b=x[_0x24b9("0x8f")],i=x[_0x24b9("0x8e")],o=x[_0x24b9("0x86")],_=x.type,s=x.channel,a=x.channelData,c=void 0===a?{}:a,u=x[_0x24b9("0x10f")],f=void 0===u?n()[_0x24b9("0xa1")]():u,h=x.id,d=void 0===h?new(r[_0x24b9("0x71")]):h;this.id=d,this[_0x24b9("0x7d")]=e,this[_0x24b9("0x8f")]=b,this[_0x24b9("0x86")]=o,this[_0x24b9("0x6e")]=t,this[_0x24b9("0x8e")]=i,this[_0x24b9("0x10f")]=f,this[_0x24b9("0x7e")]=_,this[_0x24b9("0x10e")]=s,this[_0x24b9("0x8d")]=c}return x[_0x24b9("0x11")].isMobile=function(){return _0x24b9("0xac")===this[_0x24b9("0x8e")]||_0x24b9("0xae")===this[_0x24b9("0x8e")]},x.prototype[_0x24b9("0x119")]=function(){return JSON[_0x24b9("0x9c")]({id:this.id,payloadType:this.payloadType,payload:this[_0x24b9("0x6e")],date:this[_0x24b9("0x10f")],type:this[_0x24b9("0x7e")],channelData:this[_0x24b9("0x8d")]})},x.prototype[_0x24b9("0x11a")]=function(t){return new x(JSON[_0x24b9("0x11b")](t))},x}();t.Message=b},function(x,t,e){_0x24b9("0x12");var n=this&&this[_0x24b9("0x75")]||function(){var x=Object[_0x24b9("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x.__proto__=t}||function(x,t){for(var e in t)t[_0x24b9("0x10")](e)&&(x[e]=t[e])};return function(t,e){function n(){this[_0x24b9("0x78")]=t}x(t,e),t[_0x24b9("0x11")]=null===e?Object[_0x24b9("0x79")](e):(n[_0x24b9("0x11")]=e[_0x24b9("0x11")],new n)}}();Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var r=e(0),b=function(x){function t(t){var e=t[_0x24b9("0x6e")],n=t[_0x24b9("0x7d")],r=t[_0x24b9("0x8f")],b=t[_0x24b9("0x7e")],i=t[_0x24b9("0x8e")],o=t[_0x24b9("0x10e")],_=t.channelData,s=t[_0x24b9("0x10f")],a=t.id;return x.call(this,{payload:e,conversation:n,channel:o,user:r,platform:i,payloadType:_0x24b9("0x24"),type:b,channelData:_,date:s,id:a})||this}return n(t,x),t}(r[_0x24b9("0x110")]);t[_0x24b9("0xb3")]=b},function(x,t,e){_0x24b9("0x12");var n=this&&this.__extends||function(){var x=Object[_0x24b9("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x[_0x24b9("0x77")]=t}||function(x,t){for(var e in t)t.hasOwnProperty(e)&&(x[e]=t[e])};return function(t,e){function n(){this[_0x24b9("0x78")]=t}x(t,e),t[_0x24b9("0x11")]=null===e?Object[_0x24b9("0x79")](e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(t,_0x24b9("0xe"),{value:!0});var r=e(0),b=function(x){function t(t){var e=t[_0x24b9("0x7d")],n=t.date,r=t[_0x24b9("0x8f")],b=t.id,i=t[_0x24b9("0x6e")],o=t[_0x24b9("0x8e")],_=t[_0x24b9("0x10e")];return x.call(this,{payload:i,conversation:e,user:r,channel:_,platform:o,payloadType:"context",type:_0x24b9("0x11c"),date:n,id:b})||this}return n(t,x),t}(r[_0x24b9("0x110")]);t.TriggerMessage=b},function(x,t,e){_0x24b9("0x12");var n=this&&this[_0x24b9("0x75")]||function(){var x=Object[_0x24b9("0x76")]||{__proto__:[]}instanceof Array&&function(x,t){x.__proto__=t}||function(x,t){for(var e in t)t[_0x24b9("0x10")](e)&&(x[e]=t[e])};return function(t,e){function n(){this[_0x24b9("0x78")]=t}x(t,e),t[_0x24b9("0x11")]=null===e?Object[_0x24b9("0x79")](e):(n[_0x24b9("0x11")]=e.prototype,new n)}}();Object[_0x24b9("0xd")](t,_0x24b9("0xe"),{value:!0});var r=e(0),b=function(x){function t(t){var e=t.payload,n=t[_0x24b9("0x7d")],r=t[_0x24b9("0x7e")],b=t[_0x24b9("0x8f")],i=t.platform,o=t[_0x24b9("0x10e")],_=t[_0x24b9("0x8d")],s=t[_0x24b9("0x10f")],a=t.id;return x[_0x24b9("0xc")](this,{payload:e,conversation:n,channel:o,user:b,platform:i,payloadType:_0x24b9("0x88"),type:r,channelData:_,date:s,id:a})||this}return n(t,x),t[_0x24b9("0x11")][_0x24b9("0x8a")]=function(){var x={type:_0x24b9("0x99"),url:this[_0x24b9("0x6e")][_0x24b9("0x88")],title:_0x24b9("0x11e")};return{elements:[{title:this[_0x24b9("0x6e")][_0x24b9("0x23")],text:this[_0x24b9("0x6e")][_0x24b9("0xe2")],buttons:[x]}]}},t}(r[_0x24b9("0x110")]);t.UrlMessage=b},function(x,t,e){Object.defineProperty(t,_0x24b9("0xe"),{value:!0});var n=e(0),r=function(){function x(x){var t=x[_0x24b9("0x11f")],e=x[_0x24b9("0x120")],r=x[_0x24b9("0x121")],b=x[_0x24b9("0x122")],i=x[_0x24b9("0x123")],o=x.id,_=void 0===o?new(n[_0x24b9("0x71")]):o;this.id=_,this[_0x24b9("0x11f")]=t,this[_0x24b9("0x120")]=e,this[_0x24b9("0x121")]=r,this[_0x24b9("0x122")]=b,this[_0x24b9("0x123")]=i}return x}();t[_0x24b9("0xc6")]=r},function(x,t,e){_0x24b9("0x12");var n=this&&this[_0x24b9("0x63")]||Object[_0x24b9("0x64")]||function(x){for(var t,e=1,n=arguments[_0x24b9("0x16")];e<n;e++){t=arguments[e];for(var r in t)Object[_0x24b9("0x11")][_0x24b9("0x10")][_0x24b9("0xc")](t,r)&&(x[r]=t[r])}return x},r=this&&this[_0x24b9("0x2d")]||function(x,t,e,n){return new(e||(e=Promise))(function(r,b){function i(x){try{_(n[_0x24b9("0x2e")](x))}catch(x){b(x)}}function o(x){try{_(n[_0x24b9("0x2f")](x))}catch(x){b(x)}}function _(x){x[_0x24b9("0x30")]?r(x.value):new e(function(t){t(x[_0x24b9("0x31")])})[_0x24b9("0x32")](i,o)}_((n=n[_0x24b9("0x1")](x,t||[]))[_0x24b9("0x2e")]())})},b=this&&this[_0x24b9("0x33")]||function(x,t){function e(x){return function(t){return n([x,t])}}function n(e){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,b&&(i=b[2&e[0]?_0x24b9("0x35"):e[0]?_0x24b9("0x2f"):"next"])&&!(i=i.call(b,e[1]))[_0x24b9("0x30")])return i;switch(b=0,i&&(e=[0,i[_0x24b9("0x31")]]),e[0]){case 0:case 1:i=e;break;case 4:return _.label++,{value:e[1],done:!1};case 5:_[_0x24b9("0x18")]++,b=e[1],e=[0];continue;case 7:e=_.ops[_0x24b9("0x36")](),_[_0x24b9("0x1c")].pop();continue;default:if(i=_[_0x24b9("0x1c")],!(i=i[_0x24b9("0x16")]>0&&i[i[_0x24b9("0x16")]-1])&&(6===e[0]||2===e[0])){_=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){_[_0x24b9("0x18")]=e[1];break}if(6===e[0]&&_[_0x24b9("0x18")]<i[1]){_[_0x24b9("0x18")]=i[1],i=e;break}if(i&&_[_0x24b9("0x18")]<i[2]){_[_0x24b9("0x18")]=i[2],_[_0x24b9("0x37")].push(e);break}i[2]&&_[_0x24b9("0x37")].pop(),_[_0x24b9("0x1c")][_0x24b9("0x36")]();continue}e=t[_0x24b9("0xc")](x,_)}catch(x){e=[6,x],b=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r,b,i,o,_={la