Your IP : 18.218.131.11
(function(){var e=null;var n="";var t="";var r="";var o="bx-voximplant-at";BX.namespace("BX.Voximplant");var i=function(){var e=BX.message("voximplantSdkUrl");return new Promise(function(n,t){var r=setTimeout(function(){var e={name:"NetworkingTimeout",code:"NETWORK_ERROR",message:"Could not load VoxImplant SDK"};t(e)},5e3);BX.loadScript(e,function(){clearTimeout(r);if("VoxImplant"in window){n()}else{var e={name:"NetworkingError",code:"NETWORK_ERROR",message:"VoxImplant SDK not found"};t(e)}})})};var a=function(n){return new Promise(function(t,r){if(e.alreadyInitialized){return t()}e.init(n).then(t).catch(r)})};var u=function(){return new Promise(function(n,t){if(e.connected()){return n()}e.connect().then(n).catch(t)})};var c=function(){return new Promise(function(r,o){var i;f().then(function(e){i=e;return s(i)}).then(function(a){if(a){return r()}m(i).then(v).then(function(r){return e.loginWithOneTimeKey(n+"@"+t,r)}).then(function(e){if(e.tokens){l(e.tokens)}r(e)}).catch(o)}).catch(o)})};var s=function(n){return new Promise(function(t,r){if(!BX.localStorage){return t(false)}var i=BX.localStorage.get(o);if(!i){return t(false)}e.loginWithToken(n.login+"@"+n.server,i).then(function(e){l(e.tokens);t(true)},function(e){BX.localStorage.remove(o);t(false)})})};var l=function(e){if(!BX.localStorage){return}BX.localStorage.set(o,e.accessToken,e.accessExpire)};var f=function(){return new Promise(function(e,o){if(BX.type.isNotEmptyString(n)){return e({login:n,server:t})}else if(BX.message("voximplantLogin")){n=BX.message("voximplantLogin");t=BX.message("voximplantServer");return e({login:n,server:t})}else{r.callMethod("voximplant.authorization.get").then(function(r){var i=r.data();if(BX.type.isNotEmptyString(i.LOGIN)&&BX.type.isNotEmptyString(i.SERVER)){n=i.LOGIN;t=i.SERVER;e({login:n,server:t})}else{var a={name:"AuthResult",code:"LOGIN_EMPTY",message:"Could not get voximplant login for user"};o(a)}}).catch(function(e){o(e)})}})};var m=function(n){return new Promise(function(t,r){var o=function(n){e.removeEventListener(VoxImplant.Events.AuthResult,o);if(n.code==302&&n.key){t(n.key)}else{r(n)}};e.addEventListener(VoxImplant.Events.AuthResult,o);e.requestOneTimeLoginKey(n.login+"@"+n.server)})};var v=function(e){return new Promise(function(n,t){r.callMethod("voximplant.authorization.signOneTimeKey",{KEY:e}).then(function(e){var t=e.data();if(t.HASH){n(t.HASH)}}).catch(function(e){t(e)})})};BX.Voximplant.getClient=function(n){n=BX.type.isPlainObject(n)?n:{};var t=new BX.Promise;r=n.restClient||BX.rest;if(e&&e.getClientState()==="LOGGED_IN"){t.resolve(e);return t}i().then(function(){e=VoxImplant.getInstance();var t={micRequired:false,progressTone:false,experiments:{preventRendering:true}};if(n.debug===true){t.showDebugInfo=true;t.showWarnings=true;t.prettyPrint=true}if(BX.type.isPlainObject(n.apiParameters)){t=BX.util.objectMerge(t,n.apiParameters)}return t}).then(function(e){return a(e)}).then(u).then(c).then(function(n){t.resolve(e)}).catch(function(e){console.error(e);if(e.name==="AuthResult"){r.callMethod("voximplant.authorization.onError")}t.reject(e)});return t}})();
//# sourceMappingURL=client.map.js