(function(){$.extend(u8.Crm.PhoneLauncherProxy.prototype,{_subscribeDiagnostics:function(){this._registerDiagnosticsProcedure("GetPhoneDllVersions","_onProcedureGetPhoneDllVersions");this._registerDiagnosticsProcedure("SendGenericRequest","_onSendGenericRequest");this._registerDiagnosticsProcedure("GetAcceleratorKeys","_onGetAcceleratorKeys");this._registerDiagnosticsProcedure("CallInfoWeb","_onCallInfoWeb");this._subscribeToDiagnosticsEvent("MakeCall","_onProviderMakeCall");this._subscribeToDiagnosticsEvent("InitPhone","_onProviderInitPhone");this._subscribeToDiagnosticsEvent("IsHotKey","_onIsHotKey");this._subscribeToDiagnosticsEvent("GetOriginalNumber","_onGetOriginalNumber");this._subscribeToDiagnosticsEvent("Clicked","_onClicked");this._subscribeToDiagnosticsEvent("TextChanged","_onTextChanged");this._subscribeToDiagnosticsEvent("SelectionChanged","_onSelectionChanged");this._subscribeToDiagnosticsEvent("SetState","_onSetStateDiag");this._subscribeToDiagnosticsEvent("ScrollChanged","_onScrollChanged");this._subscribeToDiagnosticsEvent("SetCheck","_onSetCheck")},_registerDiagnosticsProcedure:function(e,t){var n=this;var i=this.diagnosticsApi+"webcall."+e;var s=function(e,i){return n[t](e,i)};this._registeredProceduresMap[i]=s;u8.services.launcher.registerProcedure(i,s)},_unregisterDiagnosticsProcedures:function(){for(var e in this._registeredProceduresMap){u8.services.launcher.unregisterProcedure(e)}},_subscribeToDiagnosticsEvent:function(e,t){var n=this;e=this.diagnosticsApi+e;var i=this._eventHandlersMap[e];if(i){u8.services.launcher.unsubscribe(e,i)}var s=function(e,i){n[t](n,i)};this._eventHandlersMap[e]=s;u8.services.launcher.subscribe(e,s)},_onDiagnosticsEvent:function(e){var t=e&&JSON.parse(e);u8.log.info("phone","Diagnostics event "+t.eventId+" received.")},_onProviderMakeCall:function(e,t){this.scheduler.handleMethodCall("makeCall",t);this._callDiagnosticsMethod("MakeCallCompleted",{token:t.token,Success:true})},_onProviderInitPhone:function(e,t){this.scheduler.handleMethodCall("InitPhone",t);this._callDiagnosticsMethod("InitPhoneCompleted",{token:t.token,success:true,result:"[]"})},_onIsHotKey:function(e,t){this.scheduler.handleMethodCall("isHotKey",t);return true},_onGetOriginalNumber:function(e,t){this.scheduler.handleMethodCall("getOriginalNumber",t);var n=this.getPhoneItemByType("StandardTextFieldNumber");diagnostics.getOriginalNumberCompleted(eventArgs.token,true,n.text)},_onClicked:function(e,t){if("id"in t){t.id=""+t.id}this.scheduler.handleMethodCall("click",t)},_onTextChanged:function(e,t){if("id"in t){t.id=""+t.id}this.scheduler.handleMethodCall("setText",t)},_onSelectionChanged:function(e,t){if("id"in t){t.id=""+t.id}this.scheduler.handleMethodCall("setSelection",t)},_onSetStateDiag:function(e,t){if("id"in t){t.id=""+t.id}this.scheduler.handleMethodCall("setState",t)},_onIsNumberAvailable:function(e,t){this.scheduler.handleMethodCall("isNumberAvailable",t);var n=this.getPhoneItemByType("StandardTextFieldNumber");diagnostics.isNumberAvailableCompleted(eventArgs.token,true,!!n.text)},_onScrollChanged:function(e,t){},_onSetCheck:function(e,t){},_onProcedureGetPhoneDllVersions:function(e,t){return"1.0"},_onSendGenericRequest:function(e,t){this.scheduler.handleMethodCall("sendGenericRequest",t);return 1},_onGetAcceleratorKeys:function(e,t){this.scheduler.handleMethodCall("getAcceleratorKeys",t);return""},_onCallInfoWeb:function(e,t){this.scheduler.handleMethodCall("callInfo",t);return true}})})();