/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/iotile-device@0.0.2/dist/iotile-device.umd.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.iotileDevice={})}(this,(function(e){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function r(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function o(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function i(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r((function(t){t(e.value)})).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function a(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var s=function(){function e(e,t){this.className=e,this.$log=t.get("$log"),this.$injector=t}return e.prototype.log_debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this.$log).debug.apply(t,["["+this.className+"] "+e].concat(r))},e.prototype.log_warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this.$log).warn.apply(t,["["+this.className+"] "+e].concat(r))},e.prototype.log_error=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this.$log).error.apply(t,["["+this.className+"] "+e].concat(r))},e.prototype.log_info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this.$log).info.apply(t,["["+this.className+"] "+e].concat(r))},e}(),c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function u(e,t){function r(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function l(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r((function(t){t(e.value)})).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function h(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var f,p,g=function(e,t){this.name=e,this.message=t},d=function(e){function t(t){return e.call(this,"ArgumentError",t)||this}return u(t,e),t}(g),v=function(e){function t(t){return e.call(this,"InvalidOperationError",t)||this}return u(t,e),t}(g),y=(function(e){function t(t){return e.call(this,"UnknownError",t)||this}u(t,e)}(g),function(e){function t(t){return e.call(this,"InsufficientSpaceError",t)||this}return u(t,e),t}(g)),m=function(e){function t(t){return e.call(this,"UnknownKeyError",t)||this}return u(t,e),t}(g),_=(function(e){function t(t,r){return e.call(this,"UnknownFileSystemError","Unknown filesystem error: "+t+" path: "+r,t)||this}u(t,e)}(function(){function e(e,t,r){this.name=e,this.message=t,this.code=r}return e.NOT_FOUND_ERR=1,e.SECURITY_ERR=2,e.ABORT_ERR=3,e.NOT_READABLE_ERR=4,e.ENCODING_ERR=5,e.NO_MODIFICATION_ALLOWED_ERR=6,e.INVALID_STATE_ERR=7,e.SYNTAX_ERR=8,e.INVALID_MODIFICATION_ERR=9,e.QUOTA_EXCEEDED_ERR=10,e.TYPE_MISMATCH_ERR=11,e.PATH_EXISTS_ERR=12,e}()),function(e,t){this.name=e,this.message=t}),w=(function(e){function t(t){return e.call(this,"DataCorruptedError",t)||this}u(t,e)}(_),function(e){function t(t){return e.call(this,"DataStaleError",t)||this}u(t,e)}(_),function(e){function t(t){return e.call(this,"CorruptDeviceError",t)||this}u(t,e)}(_),function(){function e(){}return e.prototype.finishOne=function(){},e.prototype.startOne=function(e,t){return null},e.prototype.setTotal=function(e){},e.prototype.addMessage=function(e,t,r){void 0===r&&(r=!1)},e.prototype.fatalError=function(e){},e.prototype.updateDescription=function(e){},Object.defineProperty(e.prototype,"hasErrors",{get:function(){return!1},enumerable:!0,configurable:!0}),e}()),b=function(e){function t(t){var r=e.call(this)||this;return r.manager=t,r}return u(t,e),t.prototype.finishOne=function(){this.manager.finishTask()},t.prototype.startOne=function(e,t){return this.manager.startTask(e,t)},t.prototype.updateDescription=function(e){this.manager.subTaskDescription=e,this.manager.updateScope()},t.prototype.setTotal=function(e){this.manager.totalTasks=e},t.prototype.addMessage=function(e,t,r){void 0===r&&(r=!1),this.manager.addMessage(e,t,r)},t.prototype.fatalError=function(e){this.manager.fatalError(e)},Object.defineProperty(t.prototype,"hasErrors",{get:function(){return this.manager.hasErrors},enumerable:!0,configurable:!0}),t}(w),S=function(e){function t(t){var r=e.call(this)||this;return r.manager=t,r}return u(t,e),t.prototype.finishOne=function(){this.manager.updateSubtask()},t.prototype.startOne=function(e,t){return this.manager.subSubTaskDescription=e,new w},t.prototype.setTotal=function(e){this.manager.subTaskTotal=e},t.prototype.addMessage=function(e,t,r){void 0===r&&(r=!1),this.manager.addMessage(e,t,r)},t.prototype.fatalError=function(e){this.manager.fatalError(e)},t.prototype.updateDescription=function(e){this.manager.subSubTaskDescription=e,this.manager.updateScope()},t}(w);!function(e){e[e.Info=0]="Info",e[e.Warn=1]="Warn",e[e.Error=2]="Error",e[e.Success=3]="Success"}(f||(f={})),function(e){e.Info="info",e.Warn="warn",e.Error="error",e.Success="success"}(p||(p={}));var C=function(){function e(e,t){this.message=t,this.severity=e}return Object.defineProperty(e.prototype,"iconClass",{get:function(){switch(this.severity){case f.Info:return"ion-information-circled positive";case f.Warn:return"ion-alert-circled energized";case f.Error:return"ion-minus-circled assertive";case f.Success:return"ion-checkmark-circled balanced"}},enumerable:!0,configurable:!0}),e}(),L=(function(){function e(e,t){this.totalTasks=e,this.finishedTasks=0,this.subTaskDescription=null,this.subSubTaskDescription=null,this.subTaskTotal=0,this.subTaskFinished=0,this.subTaskInProgress=!1,this.messages=[],this.errorState=!1,this.scope=t}e.prototype.clear=function(){this.finishedTasks=0,this.subTaskDescription=null,this.subTaskTotal=0,this.subTaskFinished=0,this.subTaskInProgress=!1,this.priorityMessage=void 0,this.messages=[],this.errorState=!1},e.prototype.getNotifier=function(){return new b(this)},e.prototype.startTask=function(e,t){return this.errorState?null:(this.subTaskTotal=t,this.subTaskFinished=0,this.subTaskDescription=e,this.subTaskInProgress=!0,this.updateScope(),new S(this))},e.prototype.finishTask=function(){this.errorState||(this.subTaskInProgress&&(this.subTaskInProgress=!1,this.subTaskTotal=0,this.subSubTaskDescription=null),this.finishedTasks<this.totalTasks&&(this.finishedTasks+=1),this.updateScope())},e.prototype.addMessage=function(e,t,r){void 0===r&&(r=!1),r?this.priorityMessage=new C(e,t):this.messages.push(new C(e,t))},e.prototype.fatalError=function(e){this.subTaskInProgress=!1,this.finishedTasks=this.totalTasks,this.errorState=!0,this.addMessage(f.Error,e),this.updateScope()},e.prototype.updateSubtask=function(){this.errorState||(this.subTaskFinished<this.subTaskTotal&&(this.subTaskFinished+=1,this.subTaskInProgress=!0),this.updateScope())},Object.defineProperty(e.prototype,"hasErrors",{get:function(){for(var e=0,t=this.messages;e<t.length;e++){if(t[e].severity===f.Error)return!0}return!1},enumerable:!0,configurable:!0}),e.prototype.updateScope=function(){this.scope&&this.scope.$applyAsync()}}(),function(e){function t(t,r,n,o){void 0===o&&(o={manualInitCleanup:!1});var i=e.call(this,t,r)||this;i.$scope=n,i.$ionicPopup=r.get("$ionicPopup"),i.$ionicHistory=r.get("$ionicHistory"),i.$ionicLoading=r.get("$ionicLoading"),i.$ionicModal=r.get("$ionicModal"),i.$cordovaInAppBrowser=r.get("$cordovaInAppBrowser"),i.net=r.get("NetService"),i.error=null,i.currentModal=null;var a,s,c=i;(i.initialized=null,!1===o.manualInitCleanup)&&(i.initialized=new Promise((function(e,t){a=e,s=t})),n.$on("$ionicView.beforeEnter",(function(e){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:c.error=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,c.initialize()];case 2:return t.sent(),a(),[3,4];case 3:return e=t.sent(),s(e),[3,4];case 4:return[2]}}))}))})),n.$on("$ionicView.beforeLeave",(function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,c.cleanup()];case 1:return e.sent(),[2]}}))}))})));return i}return u(t,e),t.prototype.showLoading=function(e,t){return void 0===t&&(t=!1),this.showLoadingEx({template:e,hideOnStateChange:t})},t.prototype.showLoadingEx=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(r){return t=this,[2,new Promise((function(r,n){t.$ionicLoading.show(e).then((function(){r()})).catch((function(e){return r()}))}))]}))}))},t.prototype.hideLoading=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){return e=this,[2,new Promise((function(t,r){e.$ionicLoading.hide().then((function(){t()})).catch((function(e){return t()}))}))]}))}))},t.prototype.showIsolatedModal=function(e){return l(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return this.currentModal=e,[4,e.show()];case 1:return t.sent(),[2]}}))}))},t.prototype.hideIsolatedModal=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:if(null===this.currentModal)throw new v("Hiding modal when there is no modal shown.");return[4,this.currentModal.hide()];case 1:return e.sent(),[2]}}))}))},t.prototype.openExternal=function(e){var t={location:"yes",clearcache:"yes",toolbar:"yes"},r=this;return new Promise((function(n,o){r.$cordovaInAppBrowser.open(e,"_blank",t).then((function(){n()})).catch((function(e){o(e)}))}))},t.prototype.showModal=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(r){return t=this,[2,new Promise((function(r,n){t.$ionicModal.fromTemplateUrl(e,{scope:t.$scope,animation:"slide-in-up"}).then((function(e){t.currentModal=e,e.show().then((function(){r()}))}))}))]}))}))},t.prototype.hideModal=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){if(null===this.currentModal)throw new v("Hiding modal when there is no modal shown.");return e=this,[2,new Promise((function(t,r){e.currentModal.hide().then((function(){e.currentModal.remove(),e.currentModal=null,t()}))}))]}))}))},t.prototype.setError=function(e){this.error=e,this.$scope.$$phase||this.$scope.$apply()},t.prototype.isOnline=function(){return this.net.isOnline()},t.prototype.initialize=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t.prototype.cleanup=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t.prototype.leaveFromError=function(e,t){return l(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.hideLoading()];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.hideModal()];case 3:return r.sent(),[3,5];case 4:return r.sent(),[3,5];case 5:return t||(t="Fatal Error"),[4,this.alert(t,e)];case 6:return r.sent(),this.$ionicHistory.goBack(),[2]}}))}))},t.prototype.confirm=function(e,t,r){return void 0===r&&(r=p.Info),l(this,void 0,void 0,(function(){var n;return h(this,(function(o){return n=this,[2,new Promise((function(o,i){n.$ionicPopup.confirm({title:e,template:t,cssClass:r+"-popup",buttons:[{text:"Cancel",type:"button-assertive",onTap:function(e){return!1}},{text:"Okay",type:"button-balanced",onTap:function(e){return!0}}]}).then((function(e){o(e)}))}))]}))}))},t.prototype.alert=function(e,t,r){return void 0===r&&(r=p.Info),l(this,void 0,void 0,(function(){var n;return h(this,(function(o){return n=this,[2,new Promise((function(o,i){n.$ionicPopup.alert({title:e,cssClass:r+"-popup",template:t}).then((function(){o()}))}))]}))}))},t}(s)),R=function(e){function t(t,r,n){var o=e.call(this,t,r,n,{manualInitCleanup:!0})||this,i=o;return o.initialized=new Promise((function(e,t){i.resolve=e,i.reject=t})),o}return u(t,e),t.prototype.$onInit=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.initialize()];case 1:return t.sent(),this.resolve&&this.resolve(),[3,3];case 2:return e=t.sent(),this.log_error("Unable to initialize component; "+e),this.reject&&this.reject(),[3,3];case 3:return[2]}}))}))},t.prototype.$onDestroy=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return this.cleanup(),[2]}))}))},t.prototype.initialize=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t.prototype.cleanup=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t}(L),E=function(e){function t(t,r,n){var o=e.call(this,t,r,n,{manualInitCleanup:!0})||this;return o.modal=null,o}return u(t,e),t.prototype.initialize=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t.prototype.cleanup=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t.prototype.hide=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){return this.modal?(e=this,[2,new Promise((function(t,r){e.modal.hide().then(t)}))]):(this.log_error("Custom modal improperly constructed with no modal member"),[2])}))}))},t.prototype.remove=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){return this.modal?(e=this,[2,new Promise((function(t,r){e.modal.remove().then(t)}))]):(this.log_error("Custom modal improperly constructed with no modal member"),[2])}))}))},t}(L),B=function(e){function t(t,r,n,o){var i=this,a=n.get("$rootScope").$new();if((i=e.call(this,t,n,a,{manualInitCleanup:!0})||this).modal=null,i.customController=null,i.templateURL=r,i.options=o,null!=o.customController){var s=n.get("$controller");if(i.customController=s(o.customController,{$scope:a}),!(i.customController instanceof E))throw i.log_error("Attempted to create a modal with a custom controller that did not inherit from CustomModalBase",o.customController),new d("Invalid controller type specified: "+o.customController);a.vm=i.customController}else a.vm=i;i.initialized=i.createModal();var c=i;return a.$on("modal.removed",(function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return null==c.customController?[3,2]:[4,c.customController.cleanup()];case 1:return e.sent(),[3,4];case 2:return[4,c.cleanup()];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))})),i}return u(t,e),t.prototype.createModal=function(){return l(this,void 0,void 0,(function(){var e,t=this;return h(this,(function(r){return e=this,[2,new Promise((function(r,n){e.$ionicModal.fromTemplateUrl(t.templateURL,{scope:t.$scope,animation:t.options.animation,backdropClickToClose:t.options.backdropClickToClose,hardwareBackButtonClose:t.options.hardwareBackButtonClose}).then((function(t){e.modal=t,e.customController&&(e.customController.modal=t),r()})).catch((function(e){n(e)}))}))]}))}))},t.prototype.show=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return[4,this.initialized];case 1:return t.sent(),e=this,this.modal.isShown()?(this.log_error("Show called multiple times"),[2]):[2,new Promise((function(t,r){e.modal.show().then((function(){return l(this,void 0,void 0,(function(){var n;return h(this,(function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),null==e.customController?[3,2]:[4,e.customController.initialize()];case 1:return o.sent(),[3,4];case 2:return[4,e.initialize()];case 3:o.sent(),o.label=4;case 4:return t(),[3,6];case 5:return n=o.sent(),r(n),[3,6];case 6:return[2]}}))}))}))}))]}}))}))},t.prototype.hide=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return[4,this.initialized];case 1:return t.sent(),e=this,[2,new Promise((function(t,r){e.modal.hide().then(t)}))]}}))}))},t.prototype.remove=function(){return l(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return[4,this.initialized];case 1:return t.sent(),e=this,[2,new Promise((function(t,r){e.modal.remove().then(t)}))]}}))}))},t}(L);(function(e){function t(t,r,n){var o=e.call(this,r,n,t,{animation:"slide-in-up",backdropClickToClose:!1,hardwareBackButtonClose:!1})||this;return o.deferredReject=null,o.deferredResolve=null,o.args=null,o}u(t,e),t.prototype.launch=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(r){switch(r.label){case 0:return this.args=e,[4,this.show()];case 1:return r.sent(),t=this,this.promise=new Promise((function(e,r){t.deferredResolve=e,t.deferredReject=r})),[2]}}))}))},t.prototype.wait=function(){return null==this.promise?Promise.reject(new d("You must call show before calling wait")):this.promise},t.prototype.run=function(e){return l(this,void 0,void 0,(function(){var t;return h(this,(function(r){switch(r.label){case 0:return[4,this.launch(e)];case 1:return r.sent(),[4,this.wait()];case 2:return t=r.sent(),this.remove(),[2,t]}}))}))},t.prototype.closeWithData=function(e){if(!this.deferredResolve)throw new d("closeWithData called on data modal before run had return");this.deferredResolve(e)},t.prototype.closeWithError=function(e){if(!this.deferredReject)throw new d("closeWithError called on data modal before run had return");this.deferredReject(e)}})(B),function(e){function t(t,r,n){return e.call(this,t,r,n)||this}u(t,e),t.prototype.initialize=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))},t.prototype.cleanup=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))}}(R),function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.initialized=null,n}u(t,e),t.prototype.beginInitialization=function(){this.initialized=this.initialize()},t.prototype.initialize=function(){return l(this,void 0,void 0,(function(){return h(this,(function(e){return[2]}))}))}}(s);function k(e){return new Promise((function(t){setTimeout((function(){t()}),e)}))}function P(e){for(var t=Number(e).toString(16);t.length<16;)t="0"+t;return"d--"+(t=t.toLowerCase()).substr(0,4)+"-"+t.substr(4,4)+"-"+t.substr(8,4)+"-"+t.substr(12,4)}function A(e){var t={"buffered node":0,"unbuffered node":1,constant:2,input:3,counter:4,output:5},r=0,n=e.split(" ");"system"===n[0]&&(r=1,n=n.slice(1));var o=n.slice(0,n.length-1).join(" "),i=parseInt(n[n.length-1]);if(!(o in t))throw new d("Unknown stream name: "+o);return t[o]<<12|r<<11|i}function I(e){var t,r=[],n=0;for(t=0;t<e.length;++t)if(e[t]>="0"&&e[t]<="9")n*=10,n+=parseInt(e[t]);else{switch(e[t]){case"B":if(0!==n)throw new d("Invalid count in format code that does not take a count: count = "+n);r.push({count:0,code:"B",size:1});break;case"H":if(0!==n)throw new d("Invalid count in format code that does not take a count: count = "+n);r.push({count:0,code:"H",size:2});break;case"L":if(0!==n)throw new d("Invalid count in format code that does not take a count: count = "+n);r.push({count:0,code:"L",size:4});break;case"l":if(0!==n)throw new d("Invalid count in format code that does not take a count: count = "+n);r.push({count:0,code:"l",size:4});break;case"s":if(0===n)throw new d("Invalid count in string that should be prefixed with a count: count = "+n);r.push({count:n,code:"s",size:n});break;default:throw new d("Unknown format code in expectedBufferSize: "+e[t])}n=0}if(0!=n)throw new d("Format code ended in a number: "+e);return r}function O(e,t,r){if(e.length===r)return e;if(e.length>r)throw new d("String passed to padString is longer than the desired length: string = "+e);for(;e.length<r;)e+=t;return e}function x(e){var t,r=0,n=I(e);for(t=0;t<n.length;++t)r+=n[t].size;return r}function T(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=I(e),o=x(e);if(arguments.length!==n.length+1)throw new d("packArrayBuffer called with the wrong number of arguments for the format string");for(var i=new ArrayBuffer(o),a=new DataView(i),s=0,c=0;c<n.length;++c){var u=n[c],l=arguments[c+1];switch(u.code){case"B":if(!(arguments[c+1]<=255&&arguments[c+1]>=0))throw new d("Value must be a valid unsigned 8 bit integer");a.setUint8(s,arguments[c+1]),s+=1;break;case"H":if(!(arguments[c+1]<=65535&&arguments[c+1]>=0))throw new d("Value must be a valid unsigned 16 bit integer");a.setUint16(s,arguments[c+1],!0),s+=2;break;case"L":if(!(arguments[c+1]<=4294967295&&arguments[c+1]>=0))throw new d("Value must be a valid unsigned 32 bit integer");a.setUint32(s,arguments[c+1],!0),s+=4;break;case"l":if(!(arguments[c+1]<=2147483647&&arguments[c+1]>=-2147483648))throw new d("Value must be a valid signed 32 bit integer");a.setInt32(s,arguments[c+1],!0),s+=4;break;case"s":l=O(l,"\0",u.size);for(var h=0;h<u.size;++h)a.setUint8(s++,l.charCodeAt(h));break;default:throw new d("Unknown format code in packArrayBuffer: "+e[c])}}return i}function D(e,t){var r,n=x(e),o=I(e);if(n!==t.byteLength)throw new d("unpackArrayBuffer called on buffer with invalid size");var i,a=new DataView(t),s=[],c=0;for(r=0;r<o.length;++r){var u=o[r],l=void 0;switch(u.code){case"B":i=a.getUint8(c),c+=1;break;case"H":i=a.getUint16(c,!0),c+=2;break;case"L":i=a.getUint32(c,!0),c+=4;break;case"l":i=a.getInt32(c,!0),c+=4;break;case"s":l=new Uint8Array(t.slice(c,c+u.size)),i=String.fromCharCode.apply(null,l),c+=u.size;break;default:throw new d("Unknown format code in packArrayBuffer: "+e[r])}s.push(i)}return s}function F(e,t,r,n,o){var i=new Uint8Array(t,r,o),a=new Uint8Array(e,0);if(n+o>e.byteLength)throw new y("Attempting to copy an ArrayBuffer without enough space in destination");a.set(i,n)}function M(e){for(var t=window.atob(e),r=t.length,n=new ArrayBuffer(r),o=new Uint8Array(n),i=0;i<r;i++)o[i]=t.charCodeAt(i);return n}"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function H(e,t){return e(t={exports:{}},t.exports),t.exports}var N,j=H((function(e,t){var r;e.exports=(r=r||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},o=n.lib={},i=o.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=o.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var a=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=a<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],o=function(t){var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},i=0;i<t;i+=4){var s=o(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new a.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new a.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new a.init(r,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,s=o/(4*i),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,u=e.min(4*c,o);if(c){for(var l=0;l<c;l+=i)this._doProcessBlock(n,l);var h=n.splice(0,c);r.sigBytes-=u}return new a.init(h,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=h.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math),r)})),z=(H((function(e,t){var r;e.exports=(r=j,function(e){var t=r,n=t.lib,o=n.Base,i=n.WordArray,a=t.x64={};a.Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=o.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:8*t.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return i.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),r)})),H((function(e,t){var r;e.exports=(r=j,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init,n=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],o=0;o<r;o++)n[o>>>2]|=e[o]<<24-o%4*8;t.call(this,n,r)}else t.apply(this,arguments)};n.prototype=e}}(),r.lib.WordArray)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.WordArray,n=e.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var i=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=o(t[i>>>2]>>>16-i%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=o(e.charCodeAt(i)<<16-i%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var o=[],i=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2,c=n[e.charCodeAt(a)]>>>6-a%4*2;o[i>>>2]|=(s|c)<<24-i%4*8,i++}return t.create(o,i)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<r;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<r;s++)o.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<r.length;i++)o[r.charCodeAt(i)]=i}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)})),H((function(e,t){var r;e.exports=(r=j,function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],g=e[t+3],d=e[t+4],v=e[t+5],y=e[t+6],m=e[t+7],_=e[t+8],w=e[t+9],b=e[t+10],S=e[t+11],C=e[t+12],L=e[t+13],R=e[t+14],E=e[t+15],B=i[0],k=i[1],P=i[2],A=i[3];B=u(B,k,P,A,a,7,s[0]),A=u(A,B,k,P,c,12,s[1]),P=u(P,A,B,k,p,17,s[2]),k=u(k,P,A,B,g,22,s[3]),B=u(B,k,P,A,d,7,s[4]),A=u(A,B,k,P,v,12,s[5]),P=u(P,A,B,k,y,17,s[6]),k=u(k,P,A,B,m,22,s[7]),B=u(B,k,P,A,_,7,s[8]),A=u(A,B,k,P,w,12,s[9]),P=u(P,A,B,k,b,17,s[10]),k=u(k,P,A,B,S,22,s[11]),B=u(B,k,P,A,C,7,s[12]),A=u(A,B,k,P,L,12,s[13]),P=u(P,A,B,k,R,17,s[14]),B=l(B,k=u(k,P,A,B,E,22,s[15]),P,A,c,5,s[16]),A=l(A,B,k,P,y,9,s[17]),P=l(P,A,B,k,S,14,s[18]),k=l(k,P,A,B,a,20,s[19]),B=l(B,k,P,A,v,5,s[20]),A=l(A,B,k,P,b,9,s[21]),P=l(P,A,B,k,E,14,s[22]),k=l(k,P,A,B,d,20,s[23]),B=l(B,k,P,A,w,5,s[24]),A=l(A,B,k,P,R,9,s[25]),P=l(P,A,B,k,g,14,s[26]),k=l(k,P,A,B,_,20,s[27]),B=l(B,k,P,A,L,5,s[28]),A=l(A,B,k,P,p,9,s[29]),P=l(P,A,B,k,m,14,s[30]),B=h(B,k=l(k,P,A,B,C,20,s[31]),P,A,v,4,s[32]),A=h(A,B,k,P,_,11,s[33]),P=h(P,A,B,k,S,16,s[34]),k=h(k,P,A,B,R,23,s[35]),B=h(B,k,P,A,c,4,s[36]),A=h(A,B,k,P,d,11,s[37]),P=h(P,A,B,k,m,16,s[38]),k=h(k,P,A,B,b,23,s[39]),B=h(B,k,P,A,L,4,s[40]),A=h(A,B,k,P,a,11,s[41]),P=h(P,A,B,k,g,16,s[42]),k=h(k,P,A,B,y,23,s[43]),B=h(B,k,P,A,w,4,s[44]),A=h(A,B,k,P,C,11,s[45]),P=h(P,A,B,k,E,16,s[46]),B=f(B,k=h(k,P,A,B,p,23,s[47]),P,A,a,6,s[48]),A=f(A,B,k,P,m,10,s[49]),P=f(P,A,B,k,R,15,s[50]),k=f(k,P,A,B,v,21,s[51]),B=f(B,k,P,A,C,6,s[52]),A=f(A,B,k,P,g,10,s[53]),P=f(P,A,B,k,b,15,s[54]),k=f(k,P,A,B,c,21,s[55]),B=f(B,k,P,A,_,6,s[56]),A=f(A,B,k,P,E,10,s[57]),P=f(P,A,B,k,y,15,s[58]),k=f(k,P,A,B,L,21,s[59]),B=f(B,k,P,A,d,6,s[60]),A=f(A,B,k,P,S,10,s[61]),P=f(P,A,B,k,p,15,s[62]),k=f(k,P,A,B,w,21,s[63]),i[0]=i[0]+B|0,i[1]=i[1]+k|0,i[2]=i[2]+P|0,i[3]=i[3]+A|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;r[o>>>5]|=128<<24-o%32;var i=e.floor(n/4294967296),a=n;r[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),r[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,o,i,a){var s=e+(t&r|~t&n)+o+a;return(s<<i|s>>>32-i)+t}function l(e,t,r,n,o,i,a){var s=e+(t&n|r&~n)+o+a;return(s<<i|s>>>32-i)+t}function h(e,t,r,n,o,i,a){var s=e+(t^r^n)+o+a;return(s<<i|s>>>32-i)+t}function f(e,t,r,n,o,i,a){var s=e+(r^(t|~n))+o+a;return(s<<i|s>>>32-i)+t}t.MD5=i._createHelper(c),t.HmacMD5=i._createHmacHelper(c)}(Math),r.MD5)})),H((function(e,t){var r,n,o,i,a,s,c,u;e.exports=(n=(r=u=j).lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],c=a.SHA1=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],c=r[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}var h=(n<<5|n>>>27)+c+s[u];h+=u<20?1518500249+(o&i|~o&a):u<40?1859775393+(o^i^a):u<60?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,c=a,a=i,i=o<<30|o>>>2,o=n,n=h}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=i._createHelper(c),r.HmacSHA1=i._createHmacHelper(c),u.SHA1)})),H((function(e,t){var r;e.exports=(r=j,function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(s[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var u=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],h=r[6],f=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var g=u[p-15],d=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,v=u[p-2],y=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=d+u[p-7]+y+u[p-16]}var m=n&o^n&i^o&i,_=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&h)+c[p]+u[p];f=h,h=l,l=s,s=a+w|0,a=i,i=o,o=n,n=w+(_+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+h|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),r.SHA256)})),H((function(e,t){var r,n,o,i,a,s;e.exports=(n=(r=s=j).lib.WordArray,o=r.algo,i=o.SHA256,a=o.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=i._createHelper(a),r.HmacSHA224=i._createHmacHelper(a),s.SHA224)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.Hasher,n=e.x64,o=n.Word,i=n.WordArray,a=e.algo;function s(){return o.create.apply(o,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var l=a.SHA512=t.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],h=r[6],f=r[7],p=n.high,g=n.low,d=o.high,v=o.low,y=i.high,m=i.low,_=a.high,w=a.low,b=s.high,S=s.low,C=l.high,L=l.low,R=h.high,E=h.low,B=f.high,k=f.low,P=p,A=g,I=d,O=v,x=y,T=m,D=_,F=w,M=b,H=S,N=C,j=L,z=R,U=E,W=B,G=k,V=0;V<80;V++){var $=u[V];if(V<16)var K=$.high=0|e[t+2*V],q=$.low=0|e[t+2*V+1];else{var Y=u[V-15],X=Y.high,J=Y.low,Z=(X>>>1|J<<31)^(X>>>8|J<<24)^X>>>7,Q=(J>>>1|X<<31)^(J>>>8|X<<24)^(J>>>7|X<<25),ee=u[V-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ie=u[V-7],ae=ie.high,se=ie.low,ce=u[V-16],ue=ce.high,le=ce.low;K=(K=(K=Z+ae+((q=Q+se)>>>0<Q>>>0?1:0))+ne+((q+=oe)>>>0<oe>>>0?1:0))+ue+((q+=le)>>>0<le>>>0?1:0),$.high=K,$.low=q}var he,fe=M&N^~M&z,pe=H&j^~H&U,ge=P&I^P&x^I&x,de=A&O^A&T^O&T,ve=(P>>>28|A<<4)^(P<<30|A>>>2)^(P<<25|A>>>7),ye=(A>>>28|P<<4)^(A<<30|P>>>2)^(A<<25|P>>>7),me=(M>>>14|H<<18)^(M>>>18|H<<14)^(M<<23|H>>>9),_e=(H>>>14|M<<18)^(H>>>18|M<<14)^(H<<23|M>>>9),we=c[V],be=we.high,Se=we.low,Ce=W+me+((he=G+_e)>>>0<G>>>0?1:0),Le=ye+de;W=z,G=U,z=N,U=j,N=M,j=H,M=D+(Ce=(Ce=(Ce=Ce+fe+((he+=pe)>>>0<pe>>>0?1:0))+be+((he+=Se)>>>0<Se>>>0?1:0))+K+((he+=q)>>>0<q>>>0?1:0))+((H=F+he|0)>>>0<F>>>0?1:0)|0,D=x,F=T,x=I,T=O,I=P,O=A,P=Ce+(ve+ge+(Le>>>0<ye>>>0?1:0))+((A=he+Le|0)>>>0<he>>>0?1:0)|0}g=n.low=g+A,n.high=p+P+(g>>>0<A>>>0?1:0),v=o.low=v+O,o.high=d+I+(v>>>0<O>>>0?1:0),m=i.low=m+T,i.high=y+x+(m>>>0<T>>>0?1:0),w=a.low=w+F,a.high=_+D+(w>>>0<F>>>0?1:0),S=s.low=S+H,s.high=b+M+(S>>>0<H>>>0?1:0),L=l.low=L+j,l.high=C+N+(L>>>0<j>>>0?1:0),E=h.low=E+U,h.high=R+z+(E>>>0<U>>>0?1:0),k=f.low=k+G,f.high=B+W+(k>>>0<G>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),r.SHA512)})),H((function(e,t){var r,n,o,i,a,s,c,u;e.exports=(n=(r=u=j).x64,o=n.Word,i=n.WordArray,a=r.algo,s=a.SHA512,c=a.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(c),r.HmacSHA384=s._createHmacHelper(c),u.SHA384)})),H((function(e,t){var r;e.exports=(r=j,function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,a=t.x64.Word,s=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,i=0;i<24;i++){for(var s=0,h=0,f=0;f<7;f++){if(1&o){var p=(1<<f)-1;p<32?h^=1<<p:s^=1<<p-32}128&o?o=o<<1^113:o<<=1}l[i]=a.create(s,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=a.create()}();var f=s.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var i=e[t+2*o],a=e[t+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[o]).high^=a,k.low^=i}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,g=0,d=0;d<5;d++)p^=(k=r[f+5*d]).high,g^=k.low;var v=h[f];v.high=p,v.low=g}for(f=0;f<5;f++){var y=h[(f+4)%5],m=h[(f+1)%5],_=m.high,w=m.low;for(p=y.high^(_<<1|w>>>31),g=y.low^(w<<1|_>>>31),d=0;d<5;d++)(k=r[f+5*d]).high^=p,k.low^=g}for(var b=1;b<25;b++){var S=(k=r[b]).high,C=k.low,L=c[b];L<32?(p=S<<L|C>>>32-L,g=C<<L|S>>>32-L):(p=C<<L-32|S>>>64-L,g=S<<L-32|C>>>64-L);var R=h[u[b]];R.high=p,R.low=g}var E=h[0],B=r[0];for(E.high=B.high,E.low=B.low,f=0;f<5;f++)for(d=0;d<5;d++){var k=r[b=f+5*d],P=h[b],A=h[(f+1)%5+5*d],I=h[(f+2)%5+5*d];k.high=P.high^~A.high&I.high,k.low=P.low^~A.low&I.low}k=r[0];var O=l[s];k.high^=O.high,k.low^=O.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],l=0;l<c;l++){var h=a[l],f=h.high,p=h.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(f)}return new o.init(u,s)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=i._createHelper(f),t.HmacSHA3=i._createHmacHelper(f)}(Math),r.SHA3)})),H((function(e,t){var r;e.exports=(r=j,
/** @preserve
	(c) 2012 by Cédric Mesnil. All rights reserved.

	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
	*/
function(){var e=r,t=e.lib,n=t.WordArray,o=t.Hasher,i=e.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=i.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,f,_,w,b,S,C,L,R,E,B,k=this._hash.words,P=l.words,A=h.words,I=a.words,O=s.words,x=c.words,T=u.words;for(S=i=k[0],C=f=k[1],L=_=k[2],R=w=k[3],E=b=k[4],r=0;r<80;r+=1)B=i+e[t+I[r]]|0,B+=r<16?p(f,_,w)+P[0]:r<32?g(f,_,w)+P[1]:r<48?d(f,_,w)+P[2]:r<64?v(f,_,w)+P[3]:y(f,_,w)+P[4],B=(B=m(B|=0,x[r]))+b|0,i=b,b=w,w=m(_,10),_=f,f=B,B=S+e[t+O[r]]|0,B+=r<16?y(C,L,R)+A[0]:r<32?v(C,L,R)+A[1]:r<48?d(C,L,R)+A[2]:r<64?g(C,L,R)+A[3]:p(C,L,R)+A[4],B=(B=m(B|=0,T[r]))+E|0,S=E,E=R,R=m(L,10),L=C,C=B;B=k[1]+_+R|0,k[1]=k[2]+w+E|0,k[2]=k[3]+b+S|0,k[3]=k[4]+i+C|0,k[4]=k[0]+f+L|0,k[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,a=0;a<5;a++){var s=i[a];i[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function g(e,t,r){return e&t|~e&r}function d(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function m(e,t){return e<<t|e>>>32-t}e.RIPEMD160=o._createHelper(f),e.HmacRIPEMD160=o._createHmacHelper(f)}(Math),r.RIPEMD160)})),H((function(e,t){var r,n,o;e.exports=(n=(r=j).lib.Base,o=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,c=a.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;i.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))})),H((function(e,t){var r,n,o,i,a,s,c,u,l;e.exports=(n=(r=l=j).lib,o=n.Base,i=n.WordArray,a=r.algo,s=a.SHA1,c=a.HMAC,u=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=c.create(r.hasher,e),o=i.create(),a=i.create([1]),s=o.words,u=a.words,l=r.keySize,h=r.iterations;s.length<l;){var f=n.update(t).finalize(a);n.reset();for(var p=f.words,g=p.length,d=f,v=1;v<h;v++){d=n.finalize(d),n.reset();for(var y=d.words,m=0;m<g;m++)p[m]^=y[m]}o.concat(f),u[0]++}return o.sigBytes=4*l,o}}),r.PBKDF2=function(e,t,r){return u.create(r).compute(e,t)},l.PBKDF2)})),H((function(e,t){var r,n,o,i,a,s,c,u;e.exports=(n=(r=u=j).lib,o=n.Base,i=n.WordArray,a=r.algo,s=a.MD5,c=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),o=i.create(),a=o.words,s=r.keySize,c=r.iterations;a.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var l=1;l<c;l++)u=n.finalize(u),n.reset();o.concat(u)}return o.sigBytes=4*s,o}}),r.EvpKDF=function(e,t,r){return c.create(r).compute(e,t)},u.EvpKDF)})),H((function(e,t){var r;e.exports=void((r=j).lib.Cipher||function(e){var t=r,n=t.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=t.enc,c=(s.Utf8,s.Base64),u=t.algo.EvpKDF,l=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?_:y}return function(t){return{encrypt:function(r,n,o){return e(n).encrypt(t,r,n,o)},decrypt:function(r,n,o){return e(n).decrypt(t,r,n,o)}}}}()}),h=(n.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),t.mode={}),f=n.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=h.CBC=function(){var t=f.extend();function r(t,r,n){var o=this._iv;if(o){var i=o;this._iv=e}else i=this._prevBlock;for(var a=0;a<n;a++)t[r+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);n.decryptBlock(e,t),r.call(this,e,t,o),this._prevBlock=i}}),t}(),g=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,o=n<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(o);var c=i.create(a,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},d=(n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:g}),reset:function(){l.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4}),n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),v=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=i.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(c)},parse:function(e){var t=c.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=i.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return d.create({ciphertext:t,salt:n})}},y=n.SerializableCipher=o.extend({cfg:o.extend({format:v}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),i=o.finalize(t),a=o.cfg;return d.create({ciphertext:i,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(t.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=i.random(8));var o=u.create({keySize:t+r}).compute(e,n),a=i.create(o.words.slice(t),4*r);return o.sigBytes=4*t,d.create({key:o,iv:a,salt:n})}},_=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:m}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=o.iv;var i=y.encrypt.call(this,e,t,o.key,n);return i.mixIn(o),i},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=o.iv,y.decrypt.call(this,e,t,o.key,n)}})}())})),H((function(e,t){var r;e.exports=((r=j).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,n){var o=this._iv;if(o){var i=o.slice(0);this._iv=void 0}else i=this._prevBlock;n.encryptBlock(i,0);for(var a=0;a<r;a++)e[t+a]^=i[a]}return e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,o=n.blockSize;t.call(this,e,r,o,n),this._prevBlock=e.slice(r,r+o)}}),e.Decryptor=e.extend({processBlock:function(e,r){var n=this._cipher,o=n.blockSize,i=e.slice(r,r+o);t.call(this,e,r,o,n),this._prevBlock=i}}),e}(),r.mode.CFB)})),H((function(e,t){var r,n,o;e.exports=((o=j).mode.CTR=(r=o.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var a=i.slice(0);r.encryptBlock(a,0),i[n-1]=i[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=a[s]}}),r.Decryptor=n,r),o.mode.CTR)})),H((function(e,t){var r;e.exports=(
/** @preserve
	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
	 * derived from CryptoJS.mode.CTR
	 * Jan Hruby jhruby.web@gmail.com
	 */
(r=j).mode.CTRGladman=function(){var e=r.lib.BlockCipherMode.extend();function t(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var o=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c<o;c++)e[t+c]^=s[c]}});return e.Decryptor=o,e}(),r.mode.CTRGladman)})),H((function(e,t){var r,n,o;e.exports=((o=j).mode.OFB=(r=o.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(i,0);for(var a=0;a<n;a++)e[t+a]^=i[a]}}),r.Decryptor=n,r),o.mode.OFB)})),H((function(e,t){var r,n;e.exports=((n=j).mode.ECB=((r=n.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),r.Decryptor=r.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),r),n.mode.ECB)})),H((function(e,t){var r;e.exports=((r=j).pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,i=r+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),H((function(e,t){var r;e.exports=((r=j).pad.Iso10126={pad:function(e,t){var n=4*t,o=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(o-1)).concat(r.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),H((function(e,t){var r;e.exports=((r=j).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),H((function(e,t){var r;e.exports=((r=j).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},r.pad.ZeroPadding)})),H((function(e,t){var r;e.exports=((r=j).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),H((function(e,t){var r,n,o,i;e.exports=(n=(r=i=j).lib.CipherParams,o=r.enc.Hex,r.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return n.create({ciphertext:t})}},i.format.Hex)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,o=[],i=[],a=[],s=[],c=[],u=[],l=[],h=[],f=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var g=n^n<<1^n<<2^n<<3^n<<4;g=g>>>8^255&g^99,o[r]=g,i[g]=r;var d=e[r],v=e[d],y=e[v],m=257*e[g]^16843008*g;a[r]=m<<24|m>>>8,s[r]=m<<16|m>>>16,c[r]=m<<8|m>>>24,u[r]=m,m=16843009*y^65537*v^257*d^16843008*r,l[g]=m<<24|m>>>8,h[g]=m<<16|m>>>16,f[g]=m<<8|m>>>24,p[g]=m,r?(r=d^e[e[e[y^d]]],n^=e[e[n]]):r=n=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],d=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],a=0;a<n;a++)if(a<r)i[a]=t[a];else{var s=i[a-1];a%r?r>6&&a%r==4&&(s=o[s>>>24]<<24|o[s>>>16&255]<<16|o[s>>>8&255]<<8|o[255&s]):(s=o[(s=s<<8|s>>>24)>>>24]<<24|o[s>>>16&255]<<16|o[s>>>8&255]<<8|o[255&s],s^=g[a/r|0]<<24),i[a]=i[a-r]^s}for(var c=this._invKeySchedule=[],u=0;u<n;u++)a=n-u,s=u%4?i[a]:i[a-4],c[u]=u<4||a<=4?s:l[o[s>>>24]]^h[o[s>>>16&255]]^f[o[s>>>8&255]]^p[o[255&s]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,h,f,p,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,i,a,s){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],h=e[t+2]^r[2],f=e[t+3]^r[3],p=4,g=1;g<c;g++){var d=n[u>>>24]^o[l>>>16&255]^i[h>>>8&255]^a[255&f]^r[p++],v=n[l>>>24]^o[h>>>16&255]^i[f>>>8&255]^a[255&u]^r[p++],y=n[h>>>24]^o[f>>>16&255]^i[u>>>8&255]^a[255&l]^r[p++],m=n[f>>>24]^o[u>>>16&255]^i[l>>>8&255]^a[255&h]^r[p++];u=d,l=v,h=y,f=m}d=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^r[p++],v=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&u])^r[p++],y=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^r[p++],m=(s[f>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],e[t]=d,e[t+1]=v,e[t+2]=y,e[t+3]=m},keySize:8});e.AES=t._createHelper(d)}(),r.AES)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib,n=t.WordArray,o=t.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=i.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=a[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var u=o[i]=[],l=c[i];for(r=0;r<24;r++)u[r/6|0]|=t[(s[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(s[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],i=this._lBlock,a=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((a^o[c])&l[c])>>>0];this._lBlock=a,this._rBlock=i^s}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function p(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=o._createHelper(h);var g=i.TripleDES=o.extend({_doReset:function(){var e=this._key.words;this._des1=h.createEncryptor(n.create(e.slice(0,2))),this._des2=h.createEncryptor(n.create(e.slice(2,4))),this._des3=h.createEncryptor(n.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=o._createHelper(g)}(),r.TripleDES)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var i=0;o<256;o++){var a=o%r,s=t[a>>>2]>>>24-a%4*8&255;i=(i+n[o]+s)%256;var c=n[o];n[o]=n[i],n[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}e.RC4=t._createHelper(o);var a=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],i=[],a=[],s=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var i=t.words,a=i[0],s=i[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(o[0]^=u,o[1]^=h,o[2]^=l,o[3]^=f,o[4]^=u,o[5]^=h,o[6]^=l,o[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(s)}(),r.Rabbit)})),H((function(e,t){var r;e.exports=(r=j,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],i=[],a=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var i=t.words,a=i[0],s=i[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(n[0]^=u,n[1]^=h,n[2]^=l,n[3]^=f,n[4]^=u,n[5]^=h,n[6]^=l,n[7]^=f,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(s)}(),r.RabbitLegacy)})),H((function(e,t){e.exports=j}))),U=z.lib,W=z.SHA256,G=z.enc,V=function(){function e(){}return e.prototype.calculateSignature=function(e){var t=U.WordArray.create(e);return M(W(t).toString(G.Base64))},e.prototype.compareSignatures=function(e,t){for(var r=new Uint8Array(e),n=new Uint8Array(t),o=0;o<r.byteLength;++o)if(r[o]!=n[o])return!1;return!0},e}(),$=(function(){function e(){this._set=!1;var e=this;this.event=new Promise((function(t,r){e.resolve=t}))}e.prototype.wait=function(){return this.event},e.prototype.set=function(){this._set=!0,this.resolve&&this.resolve()},Object.defineProperty(e.prototype,"isSet",{get:function(){return this._set},enumerable:!0,configurable:!0})}(),function(){function e(){this._queue=[],this._pending=!1}return e.prototype.acquire=function(){var e=this,t=new Promise((function(t,r){e._queue.push(t)}));return this._pending||this.dispatch(),t},e.prototype.dispatch=function(){if(this._queue.length>0){var e=this._queue.shift(),t=this;this._pending=!0,e&&e((function(){t.dispatch()}))}else this._pending=!1},e}());(N=e.RPCProtocolError||(e.RPCProtocolError={}))[N.CommandNotFound=2]="CommandNotFound";var K,q,Y,X=function(e){function t(t,r,n){var o=this,i="Error sending RPC to Tile "+t+" with ID "+r+", code was "+n;return(o=e.call(this,"RPCError",i)||this).address=t,o.rpcID=r,o.errorCode=n,o}return r(t,e),t}(g),J=function(e){function t(t,r){return e.call(this,t,r)||this}return r(t,e),t}(g),Z=function(e){function t(t){return e.call(this,"ReportParsingStoppedError",t)||this}return r(t,e),t}(J),Q=function(e){function t(t){return e.call(this,"StreamingTimeoutError",t)||this}return r(t,e),t}(J),ee=function(e){function t(t){return e.call(this,"ReportParsingError",t)||this}return r(t,e),t}(J),te=function(e){function t(t){return e.call(this,"RingBufferEmptyError",t)||this}return r(t,e),t}(J),re=function(e){function t(t,r){return e.call(this,t,r)||this}return r(t,e),t}(g),ne=function(e){function t(t){return e.call(this,"ConnectionError",t)||this}return r(t,e),t}(re),oe=function(e){function t(t){var r=e.call(this,"ConnectionCancelledError",t.reason)||this;return r.info=t,r}return r(t,e),t}(re),ie=function(e){function t(t){var r=e.call(this,"ConnectionFailedError","Connection attempt failed.  This occassionally happens, please try connecting again.")||this;return r.rawError=t,r}return r(t,e),t}(re),ae=function(e){function t(t){return e.call(this,"WriteError",t)||this}return r(t,e),t}(re),se=function(e){function t(t){return e.call(this,"BluetoothDisabledError",t)||this}return r(t,e),t}(re),ce=function(e){function t(t,r,n){var o=e.call(this,"OperationAtInvalidTimeError",t)||this;return o.state=r,o.userMessage=n||"",o}return r(t,e),t}(re),ue=function(e){function t(t){return e.call(this,"ScriptSentAtInvalidTime",t)||this}return r(t,e),t}(re),le=function(e){function t(t){return e.call(this,"InvalidAdvertisingData",t)||this}return r(t,e),t}(re),he=function(){function e(e,t,r,n,o){this._stream=e,this._value=t,this._raw_timestamp=r,this._time=new Date(n.valueOf()+1e3*r),this._id=void 0!==o?o:0}return Object.defineProperty(e.prototype,"timestamp",{get:function(){return this._raw_timestamp},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stream",{get:function(){return this._stream},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this._time},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"variable",{get:function(){return function(e,t){for(var r=Number(e).toString(16);r.length<t;)r="0"+r;return r.toLowerCase()}(this.stream,4)},enumerable:!0,configurable:!0}),e}(),fe=function(){},pe=function(e){function t(t,r,n){var o=e.call(this)||this;return o._uuid=t,o._reading=n,o._sentTimestamp=r,o}return r(t,e),t.prototype.decodeUsingFormat=function(e){if("<l"==e){var t;t=D("l",T("L",this._reading.value))[0],this._reading=new he(this._reading.stream,t,this._reading.timestamp,this._reading.time,this._reading.id)}},Object.defineProperty(t.prototype,"deviceID",{get:function(){return this._uuid},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reading",{get:function(){return this._reading},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sentTimestamp",{get:function(){return this._sentTimestamp},enumerable:!0,configurable:!0}),t}(fe);(K=e.SignedReportSelectors||(e.SignedReportSelectors={}))[K.UserOutputs=22527]="UserOutputs",K[K.SystemOutputs=24575]="SystemOutputs",K[K.CombinedOutputs=55295]="CombinedOutputs",(q=e.SignatureFlags||(e.SignatureFlags={}))[q.HashOnly=0]="HashOnly",q[q.SignedUserKey=1]="SignedUserKey",q[q.SignedDeviceKey=2]="SignedDeviceKey",(Y=e.SignatureStatus||(e.SignatureStatus={}))[Y.Valid=0]="Valid",Y[Y.Invalid=1]="Invalid",Y[Y.Unknown=2]="Unknown";var ge,de,ve=function(t){function n(e,r,n,o,i){var a=t.call(this)||this;if(a._uuid=e,a._readings=n,a._rawData=o,a._streamer=r,a._receivedTime=i,0==n.length)a._lowestID=0,a._highestID=0;else{a._lowestID=n[0].id,a._highestID=n[0].id;for(var s=1;s<n.length;++s){var c=n[s].id;c<a._lowestID&&(a._lowestID=c),c>a._highestID&&(a._highestID=c)}}return a._header=a.extractHeader(),a._valid=a.validateSignature(),a}return r(n,t),Object.defineProperty(n.prototype,"deviceID",{get:function(){return this._uuid},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"readings",{get:function(){return this._readings},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"validity",{get:function(){return this._valid},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rawData",{get:function(){return this._rawData},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"streamer",{get:function(){return this._streamer},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"receivedTime",{get:function(){return this._receivedTime},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"readingIDRange",{get:function(){return[this._lowestID,this._highestID]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"header",{get:function(){return this._header},enumerable:!0,configurable:!0}),n.prototype.extractHeader=function(){var e=this._rawData;if(e.byteLength<20)throw new d("Invalid report that was not long enough to contain a valid header");var t=D("BBHLLLBBH",e.slice(0,20));return{format:t[0],lengthLow:t[1],lengthHigh:t[2],uuid:t[3],reportID:t[4],sentTime:t[5],signatureFlags:t[6],streamer:t[7],selector:t[8]}},n.prototype.validateSignature=function(){var t=new V;if(this._header.signatureFlags!=e.SignatureFlags.HashOnly)return e.SignatureStatus.Unknown;var r=this._rawData.slice(0,this._rawData.byteLength-16),n=this._rawData.slice(this._rawData.byteLength-16),o=t.calculateSignature(r);return t.compareSignatures(n,o)?e.SignatureStatus.Valid:e.SignatureStatus.Invalid},n}(fe);(ge=e.MatchBy||(e.MatchBy={}))[ge.MatchBySlot=1]="MatchBySlot",ge[ge.MatchController=2]="MatchController",ge[ge.MatchByName=3]="MatchByName",(de=e.RemoteBridgeState||(e.RemoteBridgeState={}))[de.Idle=0]="Idle",de[de.WaitingForScript=1]="WaitingForScript",de[de.ReceivingScript=2]="ReceivingScript",de[de.ReceivedCompleteScript=3]="ReceivedCompleteScript",de[de.ValidatedScript=4]="ValidatedScript",de[de.ExecutingScript=5]="ExecutingScript";var ye,me,_e,we,be,Se=function(){function e(e){this.adapter=e}return e.prototype.beginScript=function(){return this.adapter.errorHandlingRPC(8,8448,"","L",[],10)},e.prototype.endScript=function(){return this.adapter.errorHandlingRPC(8,8450,"","L",[],2)},e.prototype.triggerScript=function(){return this.adapter.errorHandlingRPC(8,8451,"","L",[],2)},e.prototype.resetScript=function(){return this.adapter.errorHandlingRPC(8,8453,"","L",[],20)},e.prototype.queryStatus=function(){return i(this,void 0,void 0,(function(){var e,t,r;return a(this,(function(n){switch(n.label){case 0:return[4,this.adapter.typedRPC(8,8452,"","LL",[],2)];case 1:return e=n.sent(),t=e[0],r=e[1],[2,{state:t,lastError:r}]}}))}))},e}(),Ce=function(){function t(e){this.adapter=e,this.configLock=new $}return t.prototype.setConfigVariable=function(e,t,r,n){return i(this,void 0,void 0,(function(){var o;return a(this,(function(i){switch(i.label){case 0:return[4,this.configLock.acquire()];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,9,10]),[4,this.getConfigDatabaseInfo(r)];case 3:return i.sent()?[3,5]:[4,this.compactConfigDatabase()];case 4:i.sent(),i.label=5;case 5:return[4,this.startEntry(t,e)];case 6:if(i.sent())throw new Error("Failed to start Config entry");return[4,this.pushData(r,n)];case 7:return i.sent(),[4,this.finishEntry()];case 8:return i.sent(),[3,10];case 9:return o(),[7];case 10:return[2]}}))}))},t.prototype.startEntry=function(t,r){return i(this,void 0,void 0,(function(){var n,o;return a(this,(function(i){switch(i.label){case 0:if("controller"==r)n=T("HBBBBBBBB",t,0,0,0,0,0,0,0,e.MatchBy.MatchController);else{if(!r.includes("slot"))throw new d("Only controller and numbered slot targets are supported");if(!(+(o=r.split(" ")[1])>=0&&+o<=255))throw new d("Slot number must be between 0 and 255");n=T("HBBBBBBBB",t,o,0,0,0,0,0,0,e.MatchBy.MatchBySlot)}return[4,this.adapter.rpc(8,10759,n,5)];case 1:return[2,D("L",i.sent())[0]]}}))}))},t.prototype.pushData=function(e,t){return i(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return[4,this.adapter.errorHandlingRPC(8,10760,e,"L",[t],5)];case 1:return r.sent(),[2]}}))}))},t.prototype.finishEntry=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.adapter.errorHandlingRPC(8,10761,"","L",[],5)];case 1:return e.sent(),[2]}}))}))},t.prototype.compactConfigDatabase=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.adapter.errorHandlingRPC(8,10767,"","L",[],5)];case 1:return e.sent(),[2]}}))}))},t.prototype.getConfigDatabaseInfo=function(e){return i(this,void 0,void 0,(function(){var t,r,n;return a(this,(function(o){switch(o.label){case 0:return[4,this.adapter.typedRPC(8,10768,"","LHHHHHBB",[],5)];case 1:return t=o.sent(),r=t[0],n=t[1],t[2],t[3],t[4],t[5],[2,n+{B:1,b:1,H:2,h:2,L:4,l:4}[e]<r]}}))}))},t}(),Le=function(){function t(e,t){this.advertisement=t,this.deviceID=t.deviceID,this.adapter=e,this.slug=P(this.deviceID),this.connectionID=t.connectionID,this.downloadLock=new $}return t.prototype.acknowledgeStreamerRPC=function(e,t,r){return i(this,void 0,void 0,(function(){var n,o,i,s;return a(this,(function(a){switch(a.label){case 0:return n=T("HHL",e,r?1:0,t),[4,this.adapter.rpc(8,8207,n,2)];case 1:if(o=a.sent(),i=D("L",o),s=i[0],!r&&2147713054===s)return[2];if(0!=s)throw new X(8,8207,s);return[2]}}))}))},t.prototype.queryStreamerRPC=function(e){return i(this,void 0,void 0,(function(){var t;return a(this,(function(r){switch(r.label){case 0:return[4,this.adapter.typedRPC(8,8202,"H","LLLLBBBB",[e],2)];case 1:return t=r.sent(),[2,{lastAttemptTime:t[0],lastSuccessTime:t[1],lastError:t[2],highestAck:t[3],lastStatus:t[4],backoffNumber:t[5],commStatus:t[6]}]}}))}))},t.prototype.tileVersionRPC=function(e){return i(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(i){switch(i.label){case 0:return[4,this.adapter.typedRPC(e,4,"","H6sBBBB",[],2)];case 1:return t=i.sent(),r=t[2],n=t[3],o=t[4],[2,r+"."+n+"."+o]}}))}))},t.prototype.controllerVersionRPC=function(){return this.tileVersionRPC(8)},t.prototype.controllerHWVersionRPC=function(){return i(this,void 0,void 0,(function(){var t;return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.adapter.typedRPC(8,2,"","10s",[],2)];case 1:return[2,r.sent()[0].replace(/[\0]+$/g,"")];case 2:if((t=r.sent())instanceof X&&t.errorCode==e.RPCProtocolError.CommandNotFound)return[2,""];throw t;case 3:return[2]}}))}))},t.prototype.highestUniqueIDRPC=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.adapter.errorHandlingRPC(8,8209,"","LL",[],2)];case 1:return[2,e.sent()[0]]}}))}))},t.prototype.graphInput=function(e,t){return i(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return"string"==typeof e&&(e=A(e)),[4,this.adapter.errorHandlingRPC(8,8196,"LH","L",[t,e],1)];case 1:return r.sent(),[2]}}))}))},t.prototype.clearAllReadings=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.adapter.errorHandlingRPC(8,8204,"","L",[],2)];case 1:return e.sent(),[2]}}))}))},t.prototype.triggerStreamer=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.adapter.typedRPC(8,8208,"H","L",[e],1)];case 1:return[2,t.sent()[0]]}}))}))},t.prototype.remoteBridge=function(){return new Se(this.adapter)},t.prototype.config=function(){return new Ce(this.adapter)},t.prototype.downloadStream=function(e,t){return i(this,void 0,void 0,(function(){var r,n,o,i,s,c,u,l,h,f,p,g,v,y,m;return a(this,(function(a){switch(a.label){case 0:return[4,this.downloadLock.acquire()];case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,,8,9]),n=A(e),[4,this.adapter.errorHandlingRPC(8,8200,"H","LLLL",[n],3)];case 3:if(o=a.sent(),i=o[0],s=o[1],c=o[2],u=new Date,l=[],h=void 0,i)throw new d("Error starting stream download: "+i);t&&(h=t.startOne("Downloading "+s+" readings",s)),f=0,a.label=4;case 4:return f<s?[4,this.adapter.errorHandlingRPC(8,8201,"","LLL",[],1)]:[3,7];case 5:p=a.sent(),g=p[0],v=p[1],y=new Date(u.valueOf()-1e3*c),m=new he(n,v,g,y),l.push(m),h&&h.finishOne(),a.label=6;case 6:return f++,[3,4];case 7:return[2,l];case 8:return r(),[7];case 9:return[2]}}))}))},t.prototype.inspectVirtualStream=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return"string"==typeof e&&(e=A(e)),[4,this.adapter.errorHandlingRPC(8,8203,"H","LL",[e])];case 1:return[2,t.sent()[0]]}}))}))},t.prototype.queryBLEConnectionInfo=function(){return i(this,void 0,void 0,(function(){var e,t,r,n,o;return a(this,(function(i){switch(i.label){case 0:return[4,this.adapter.errorHandlingRPC(8,32768,"","LHHHHHH",[],1)];case 1:return e=i.sent(),t=e[0],r=e[1],n=e[2],o=e[3],e[4],[2,{intervalMS:1.25*t,preferredMinMS:1.25*n,preferredMaxMS:1.25*o,timeoutMS:10*r}]}}))}))},t.prototype.updateBLEParams=function(e,t,r){return i(this,void 0,void 0,(function(){var n,o,i;return a(this,(function(a){switch(a.label){case 0:if(n=Math.floor(e/1.25),o=Math.floor(t/1.25),i=Math.floor(r/10),e<7.5||t<e)throw new d("Invalid interval given ["+e+", "+t+"], must be min >= 7.5 ms, max >= min");if(r<100)throw new d("Invalid connection timeout given ("+r+" ms), must be >= 100 ms.");return[4,this.adapter.errorHandlingRPC(8,32769,"HHHH","L",[n,o,i,0],1)];case 1:return[2,a.sent()[0]]}}))}))},t}();!function(e){e[e.SendHeader=0]="SendHeader",e[e.ReceiveHeader=1]="ReceiveHeader",e[e.SendPayload=2]="SendPayload",e[e.ReceivePayload=3]="ReceivePayload",e[e.Streaming=4]="Streaming",e[e.HighspeedData=5]="HighspeedData",e[e.Tracing=6]="Tracing"}(ye||(ye={})),(me=e.AdapterEvent||(e.AdapterEvent={}))[me.ScanStarted=0]="ScanStarted",me[me.ScanFinished=1]="ScanFinished",me[me.Connected=2]="Connected",me[me.ConnectionStarted=3]="ConnectionStarted",me[me.ConnectionFinished=4]="ConnectionFinished",me[me.Disconnected=5]="Disconnected",me[me.UnrecoverableRPCError=6]="UnrecoverableRPCError",me[me.RawRealtimeReading=7]="RawRealtimeReading",me[me.RawRobustReport=8]="RawRobustReport",me[me.RobustReportStarted=9]="RobustReportStarted",me[me.RobustReportStalled=10]="RobustReportStalled",me[me.RobustReportProgress=11]="RobustReportProgress",me[me.RobustReportFinished=12]="RobustReportFinished",me[me.UnrecoverableStreamingError=13]="UnrecoverableStreamingError",me[me.StreamingInterrupted=14]="StreamingInterrupted",function(e){e[e.TileBusy=0]="TileBusy",e[e.TileNotFound=1]="TileNotFound",e[e.CommandNotFound=2]="CommandNotFound",e[e.UnknownError=3]="UnknownError"}(_e||(_e={})),(we=e.AdapterState||(e.AdapterState={}))[we.Idle=0]="Idle",we[we.Scanning=1]="Scanning",we[we.Connecting=2]="Connecting",we[we.Connected=3]="Connected",we[we.Disconnecting=4]="Disconnecting",(be=e.Platform||(e.Platform={}))[be.IOS=0]="IOS",be[be.Android=1]="Android",be[be.Web=2]="Web";var Re=function(){function t(e,t){this.companyId=e,this._platform=t}return t.prototype.processAdvertisement=function(t,r,n){return this._platform===e.Platform.IOS?this.processIOSAdvertisement(t,r,n):(this._platform,e.Platform.Android,this.processAndroidAdvertisement(t,r,n))},t.prototype.platform=function(){return this._platform},t.prototype.processAndroidAdvertisement=function(e,t,r){if(31!=r.byteLength&&62!=r.byteLength)throw new le("Advertisement has the wrong length: "+r.byteLength+" bytes");var n=new DataView(r,0,31),o=n.getUint16(23,!0);if(o!=this.companyId)throw new le("Advertisement has an invalid company ID: "+o);var i=n.getUint32(25,!0),a=n.getUint16(29,!0);return{batteryVoltage:0,deviceID:i,flags:this.parseFlags(a),connectionID:e,rssi:t,slug:P(i)}},t.prototype.processIOSAdvertisement=function(e,t,r){if(!r||!r.kCBAdvDataManufacturerData)throw new le("No manufacturing data in IOS device advertisement");var n=new DataView(r.kCBAdvDataManufacturerData);if(8!=n.byteLength&&24!=n.byteLength)throw new le("IOS advertising data had the wrong manufacturing data length: "+n.byteLength);var o=n.getUint16(0,!0);if(o!=this.companyId)throw new le("Advertisement has an invalid company ID: "+o);var i=n.getUint32(2,!0),a=n.getUint16(6,!0);return{batteryVoltage:0,deviceID:i,flags:this.parseFlags(a),connectionID:e,rssi:t,slug:P(i)}},t.prototype.parseFlags=function(e){return{hasData:!!(1&e),lowVoltage:!!(2&e),otherConnected:!!(4&e),robustReports:!!(8&e),fastWrites:!!(16&e)}},t}(),Ee="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Be(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ke(e,t){return e(t={exports:{}},t.exports),t.exports}var Pe=ke((function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error",e[e.Fatal=5]="Fatal"}(t.LogLevel||(t.LogLevel={})),function(e){e.fromString=function(t){if(null==t)throw new Error("Argument must be set");switch(t.toLowerCase()){case"trace":return e.Trace;case"debug":return e.Debug;case"info":return e.Info;case"warn":return e.Warn;case"error":return e.Error;case"fatal":return e.Fatal;default:throw new Error("Unsupported value for conversion: "+t)}}}(t.LogLevel||(t.LogLevel={})),function(e){e[e.Console=0]="Console",e[e.MessageBuffer=1]="MessageBuffer",e[e.Custom=2]="Custom"}(t.LoggerType||(t.LoggerType={})),function(e){e[e.Default=0]="Default",e[e.YearMonthDayTime=1]="YearMonthDayTime",e[e.YearDayMonthWithFullTime=2]="YearDayMonthWithFullTime",e[e.YearDayMonthTime=3]="YearDayMonthTime"}(t.DateFormatEnum||(t.DateFormatEnum={})),function(e){e.fromString=function(t){if(null==t)throw new Error("Argument must be set");switch(t.toLowerCase()){case"default":return e.Default;case"yearmonthdayTime":return e.YearMonthDayTime;case"yeardaymonthwithfulltime":return e.YearDayMonthWithFullTime;case"yeardaymonthtime":return e.YearDayMonthTime;default:throw new Error("Unsupported value for conversion: "+t)}}}(r=t.DateFormatEnum||(t.DateFormatEnum={}));var n=function(){function e(e,t){void 0===e&&(e=r.Default),void 0===t&&(t="-"),this._formatEnum=e,this._dateSeparator=t}return Object.defineProperty(e.prototype,"formatEnum",{get:function(){return this._formatEnum},set:function(e){this._formatEnum=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateSeparator",{get:function(){return this._dateSeparator},set:function(e){this._dateSeparator=e},enumerable:!0,configurable:!0}),e.prototype.copy=function(){return new e(this._formatEnum,this._dateSeparator)},e}();t.DateFormat=n;var o=function(){function e(e,t,r){void 0===e&&(e=new n),void 0===t&&(t=!0),void 0===r&&(r=!0),this._showTimeStamp=!0,this._showLoggerName=!0,this._dateFormat=e,this._showTimeStamp=t,this._showLoggerName=r}return Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this._dateFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showTimeStamp",{get:function(){return this._showTimeStamp},set:function(e){this._showTimeStamp=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showLoggerName",{get:function(){return this._showLoggerName},set:function(e){this._showLoggerName=e},enumerable:!0,configurable:!0}),e}();t.LogFormat=o;var i=function(){function e(e,t,r){void 0===e&&(e=new n),void 0===t&&(t=!0),void 0===r&&(r=!0),this._dateFormat=e,this._showTimeStamp=t,this._showCategoryName=r}return Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this._dateFormat},set:function(e){this._dateFormat=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showTimeStamp",{get:function(){return this._showTimeStamp},set:function(e){this._showTimeStamp=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showCategoryName",{get:function(){return this._showCategoryName},set:function(e){this._showCategoryName=e},enumerable:!0,configurable:!0}),e.prototype.copy=function(){return new e(this._dateFormat.copy(),this._showTimeStamp,this._showCategoryName)},e}();t.CategoryLogFormat=i}));Be(Pe);Pe.LogLevel,Pe.LoggerType,Pe.DateFormatEnum,Pe.DateFormat,Pe.LogFormat,Pe.CategoryLogFormat;var Ae=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._previous=null,this._next=null,this._value=e}return Object.defineProperty(e.prototype,"previous",{get:function(){return this._previous},set:function(e){this._previous=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},set:function(e){this._next=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),e}(),n=function(){function e(){this.head=null,this.size=0}return e.prototype.addHead=function(e){if(!this.createHeadIfNeeded(e)){if(null==this.head)throw new Error("This should never happen, list implementation broken");var t=this.head.next,n=new r(e);null!=t&&(t.previous=n,n.next=t),this.head=n}this.size++},e.prototype.addTail=function(e){if(!this.createHeadIfNeeded(e)){var t=this.getTailNode();if(null==t)throw new Error("List implementation broken");var n=new r(e);t.next=n,n.previous=t}this.size++},e.prototype.clear=function(){this.head=null,this.size=0},e.prototype.getHead=function(){return null!=this.head?this.head.value:null},e.prototype.removeHead=function(){if(null!=this.head){var e=this.head,t=e.value;return this.head=e.next,this.size--,t}return null},e.prototype.getTail=function(){var e=this.getTailNode();return null!=e?e.value:null},e.prototype.removeTail=function(){var e=this.getTailNode();if(null!=e){if(e===this.head)this.head=null;else{var t=e.previous;if(null==t)throw new Error("List implementation is broken");t.next=null}return this.size--,e.value}return null},e.prototype.getSize=function(){return this.size},e.prototype.filter=function(e){var t=function(e,r,n){e(r.value)&&n.push(r.value);var o=r.next;null!=o&&t(e,o,n)},r=[],n=this.head;return null!=n&&t(e,n,r),r},e.prototype.createHeadIfNeeded=function(e){return null==this.head&&(this.head=new r(e),!0)},e.prototype.getTailNode=function(){if(null==this.head)return null;for(var e=this.head;null!=e.next;)e=e.next;return e},e}();t.LinkedList=n;var o=function(){function e(){this.array={}}return e.prototype.put=function(e,t){this.array[e]=t},e.prototype.get=function(e){return this.array[e]},e.prototype.exists=function(e){return void 0!==this.array[e]},e.prototype.remove=function(e){var t=this.array[e];return void 0!==t&&delete this.array[e],t},e.prototype.keys=function(){var e=[];for(var t in this.array)this.array.hasOwnProperty(t)&&e.push(t);return e},e.prototype.values=function(){var e=[];for(var t in this.array)this.array.hasOwnProperty(t)&&e.push(this.get(t));return e},e.prototype.size=function(){return this.keys().length},e.prototype.isEmpty=function(){return 0===this.size()},e.prototype.clear=function(){this.array={}},e.prototype.forEach=function(e){var t=0;for(var r in this.array){if(this.array.hasOwnProperty(r))e(r,this.array[r],t),t++}},e.prototype.forEachValue=function(e){var t=0;for(var r in this.array){if(this.array.hasOwnProperty(r))e(this.array[r],t),t++}},e}();t.SimpleMap=o;var i=function(){function e(e,t){this._x=e,this._y=t}return Object.defineProperty(e.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e},enumerable:!0,configurable:!0}),e}();t.TuplePair=i;var a=function(){function e(){this.data=[]}return e.prototype.append=function(e){if(void 0===e||null==e)throw new Error("String must be set, cannot append null or undefined");return this.data.push(e),this},e.prototype.appendLine=function(e){return this.data.push(e+"\n"),this},e.prototype.isEmpty=function(){return 0===this.data.length},e.prototype.clear=function(){this.data=[]},e.prototype.toString=function(e){return void 0===e&&(e=""),this.data.join(e)},e}();t.StringBuilder=a}));Be(Ae);Ae.LinkedList,Ae.SimpleMap,Ae.TuplePair,Ae.StringBuilder;var Ie=ke((function(e,t){var r;r=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e,t,r,n,o,i){void 0!==e&&this.setFunctionName(e),void 0!==t&&this.setArgs(t),void 0!==r&&this.setFileName(r),void 0!==n&&this.setLineNumber(n),void 0!==o&&this.setColumnNumber(o),void 0!==i&&this.setSource(i)}return t.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(e){this.functionName=String(e)},getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getFileName:function(){return this.fileName},setFileName:function(e){this.fileName=String(e)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(t){if(!e(t))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(t)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(t){if(!e(t))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(t)},getSource:function(){return this.source},setSource:function(e){this.source=String(e)},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(e(this.getLineNumber())?":"+this.getLineNumber():"")+(e(this.getColumnNumber())?":"+this.getColumnNumber():"")}},t},e.exports=r()})),Oe=ke((function(e,t){var r;r=function(e){var t=/(^|@)\S+\:\d+/,r=/^\s*at .*(\S+\:\d+|\(native\))/m,n=/^(eval@)?(\[native code\])?$/;function o(e,t,r){if("function"==typeof Array.prototype.map)return e.map(t,r);for(var n=new Array(e.length),o=0;o<e.length;o++)n[o]=t.call(r,e[o]);return n}function i(e,t,r){if("function"==typeof Array.prototype.filter)return e.filter(t,r);for(var n=[],o=0;o<e.length;o++)t.call(r,e[o])&&n.push(e[o]);return n}return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(e.replace(/[\(\)]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return o(i(t.stack.split("\n"),(function(e){return!!e.match(r)}),this),(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),n=this.extractLocation(r.pop()),o=r.join(" ")||void 0,i=function(e,t){if("function"==typeof Array.prototype.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1}(["eval","<anonymous>"],n[0])>-1?void 0:n[0];return new e(o,void 0,i,n[1],n[2],t)}),this)},parseFFOrSafari:function(t){return o(i(t.stack.split("\n"),(function(e){return!e.match(n)}),this),(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e(t);var r=t.split("@"),n=this.extractLocation(r.pop()),o=r.join("@")||void 0;return new e(o,void 0,n[0],n[1],n[2],t)}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split("\n"),o=[],i=2,a=n.length;i<a;i+=2){var s=r.exec(n[i]);s&&o.push(new e(void 0,void 0,s[2],s[1],void 0,n[i]))}return o},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split("\n"),o=[],i=0,a=n.length;i<a;i+=2){var s=r.exec(n[i]);s&&o.push(new e(s[3]||void 0,void 0,s[2],s[1],void 0,n[i]))}return o},parseOpera11:function(r){return o(i(r.stack.split("\n"),(function(e){return!!e.match(t)&&!e.match(/^Error created at/)}),this),(function(t){var r,n=t.split("@"),o=this.extractLocation(n.pop()),i=n.shift()||"",a=i.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;i.match(/\(([^\)]*)\)/)&&(r=i.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e(a,s,o[0],o[1],o[2],t)}),this)}}},e.exports=r(Ie)})),xe=ke((function(e,t){var r;r=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var n=["isConstructor","isEval","isNative","isToplevel"],o=["columnNumber","lineNumber"],i=["fileName","functionName","source"],a=n.concat(o,i,["args"]);function s(e){if(e instanceof Object)for(var r=0;r<a.length;r++)e.hasOwnProperty(a[r])&&void 0!==e[a[r]]&&this["set"+t(a[r])](e[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(e(this.getLineNumber())?":"+this.getLineNumber():"")+(e(this.getColumnNumber())?":"+this.getColumnNumber():"")}};for(var c=0;c<n.length;c++)s.prototype["get"+t(n[c])]=r(n[c]),s.prototype["set"+t(n[c])]=function(e){return function(t){this[e]=Boolean(t)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+t(o[u])]=r(o[u]),s.prototype["set"+t(o[u])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(o[u]);for(var l=0;l<i.length;l++)s.prototype["get"+t(i[l])]=r(i[l]),s.prototype["set"+t(i[l])]=function(e){return function(t){this[e]=String(t)}}(i[l]);return s},e.exports=r()})),Te=ke((function(e,t){var r;r=function(e){return{backtrace:function(t){var r=[],n=10;"object"==typeof t&&"number"==typeof t.maxStackSize&&(n=t.maxStackSize);for(var o=arguments.callee;o&&r.length<n;){for(var i=new Array(o.arguments.length),a=0;a<i.length;++a)i[a]=o.arguments[a];/function(?:\s+([\w$]+))+\s*\(/.test(o.toString())?r.push(new e({functionName:RegExp.$1||void 0,args:i})):r.push(new e({args:i}));try{o=o.caller}catch(e){break}}return r}}},e.exports=r(xe)})),De=ke((function(e,t){t.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,n=/^data:.+\,.+$/;function o(e){var t=e.match(r);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function a(e){var r=e,n=o(e);if(n){if(!n.path)return e;r=n.path}for(var a,s=t.isAbsolute(r),c=r.split(/\/+/),u=0,l=c.length-1;l>=0;l--)"."===(a=c[l])?c.splice(l,1):".."===a?u++:u>0&&(""===a?(c.splice(l+1,u),u=0):(c.splice(l,2),u--));return""===(r=c.join("/"))&&(r=s?"/":"."),n?(n.path=r,i(n)):r}t.urlParse=o,t.urlGenerate=i,t.normalize=a,t.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var r=o(t),s=o(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),i(r);if(r||t.match(n))return t;if(s&&!s.host&&!s.path)return s.host=t,i(s);var c="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=c,i(s)):c},t.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(r)},t.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(n<0)return t;if((e=e.slice(0,n)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)};var s=!("__proto__"in Object.create(null));function c(e){return e}function u(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function l(e,t){return e===t?0:e>t?1:-1}t.toSetString=s?c:function(e){return u(e)?"$"+e:e},t.fromSetString=s?c:function(e){return u(e)?e.slice(1):e},t.compareByOriginalPositions=function(e,t,r){var n=e.source-t.source;return 0!==n||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)||r||0!==(n=e.generatedColumn-t.generatedColumn)||0!==(n=e.generatedLine-t.generatedLine)?n:e.name-t.name},t.compareByGeneratedPositionsDeflated=function(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n||0!==(n=e.generatedColumn-t.generatedColumn)||r||0!==(n=e.source-t.source)||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)?n:e.name-t.name},t.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=l(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:l(e.name,t.name)}})),Fe=(De.getArg,De.urlParse,De.urlGenerate,De.normalize,De.join,De.isAbsolute,De.relative,De.toSetString,De.fromSetString,De.compareByOriginalPositions,De.compareByGeneratedPositionsDeflated,De.compareByGeneratedPositionsInflated,ke((function(e,t){function r(e,n,o,i,a,s){var c=Math.floor((n-e)/2)+e,u=a(o,i[c],!0);return 0===u?c:u>0?n-c>1?r(c,n,o,i,a,s):s==t.LEAST_UPPER_BOUND?n<i.length?n:-1:c:c-e>1?r(e,c,o,i,a,s):s==t.LEAST_UPPER_BOUND?c:e<0?-1:e}t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2,t.search=function(e,n,o,i){if(0===n.length)return-1;var a=r(-1,n.length,e,n,o,i||t.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===o(n[a],n[a-1],!0);)--a;return a}}))),Me=(Fe.GREATEST_LOWER_BOUND,Fe.LEAST_UPPER_BOUND,Fe.search,Object.prototype.hasOwnProperty);function He(){this._array=[],this._set=Object.create(null)}He.fromArray=function(e,t){for(var r=new He,n=0,o=e.length;n<o;n++)r.add(e[n],t);return r},He.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},He.prototype.add=function(e,t){var r=De.toSetString(e),n=Me.call(this._set,r),o=this._array.length;n&&!t||this._array.push(e),n||(this._set[r]=o)},He.prototype.has=function(e){var t=De.toSetString(e);return Me.call(this._set,t)},He.prototype.indexOf=function(e){var t=De.toSetString(e);if(Me.call(this._set,t))return this._set[t];throw new Error('"'+e+'" is not in the set.')},He.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},He.prototype.toArray=function(){return this._array.slice()};var Ne={ArraySet:He},je=("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1});var ze=function(e,t,r){var n,o,i,a,s=e.length,c=0,u=0;do{if(t>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=je(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(32&o),c+=(o&=31)<<u,u+=5}while(n);r.value=(a=(i=c)>>1,1&~i?a:-a),r.rest=t};function Ue(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function We(e,t,r,n){if(r<n){var o=r-1;Ue(e,(c=r,u=n,Math.round(c+Math.random()*(u-c))),n);for(var i=e[n],a=r;a<n;a++)t(e[a],i)<=0&&Ue(e,o+=1,a);Ue(e,o+1,a);var s=o+1;We(e,t,r,s-1),We(e,t,s+1,n)}var c,u}var Ge=Ne.ArraySet,Ve=function(e,t){We(e,t,0,e.length-1)};function $e(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new Je(t):new qe(t)}$e.fromSourceMap=function(e){return qe.fromSourceMap(e)},$e.prototype._version=3,$e.prototype.__generatedMappings=null,Object.defineProperty($e.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),$e.prototype.__originalMappings=null,Object.defineProperty($e.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),$e.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return";"===r||","===r},$e.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},$e.GENERATED_ORDER=1,$e.ORIGINAL_ORDER=2,$e.GREATEST_LOWER_BOUND=1,$e.LEAST_UPPER_BOUND=2,$e.prototype.eachMapping=function(e,t,r){var n,o=t||null;switch(r||$e.GENERATED_ORDER){case $e.GENERATED_ORDER:n=this._generatedMappings;break;case $e.ORIGINAL_ORDER:n=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var i=this.sourceRoot;n.map((function(e){var t=null===e.source?null:this._sources.at(e.source);return null!=t&&null!=i&&(t=De.join(i,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}}),this).forEach(e,o)},$e.prototype.allGeneratedPositionsFor=function(e){var t=De.getArg(e,"line"),r={source:De.getArg(e,"source"),originalLine:t,originalColumn:De.getArg(e,"column",0)};if(null!=this.sourceRoot&&(r.source=De.relative(this.sourceRoot,r.source)),!this._sources.has(r.source))return[];r.source=this._sources.indexOf(r.source);var n=[],o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",De.compareByOriginalPositions,Fe.LEAST_UPPER_BOUND);if(o>=0){var i=this._originalMappings[o];if(void 0===e.column)for(var a=i.originalLine;i&&i.originalLine===a;)n.push({line:De.getArg(i,"generatedLine",null),column:De.getArg(i,"generatedColumn",null),lastColumn:De.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var s=i.originalColumn;i&&i.originalLine===t&&i.originalColumn==s;)n.push({line:De.getArg(i,"generatedLine",null),column:De.getArg(i,"generatedColumn",null),lastColumn:De.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return n};var Ke=$e;function qe(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=De.getArg(t,"version"),n=De.getArg(t,"sources"),o=De.getArg(t,"names",[]),i=De.getArg(t,"sourceRoot",null),a=De.getArg(t,"sourcesContent",null),s=De.getArg(t,"mappings"),c=De.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(String).map(De.normalize).map((function(e){return i&&De.isAbsolute(i)&&De.isAbsolute(e)?De.relative(i,e):e})),this._names=Ge.fromArray(o.map(String),!0),this._sources=Ge.fromArray(n,!0),this.sourceRoot=i,this.sourcesContent=a,this._mappings=s,this.file=c}function Ye(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}qe.prototype=Object.create($e.prototype),qe.prototype.consumer=$e,qe.fromSourceMap=function(e){var t=Object.create(qe.prototype),r=t._names=Ge.fromArray(e._names.toArray(),!0),n=t._sources=Ge.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var o=e._mappings.toArray().slice(),i=t.__generatedMappings=[],a=t.__originalMappings=[],s=0,c=o.length;s<c;s++){var u=o[s],l=new Ye;l.generatedLine=u.generatedLine,l.generatedColumn=u.generatedColumn,u.source&&(l.source=n.indexOf(u.source),l.originalLine=u.originalLine,l.originalColumn=u.originalColumn,u.name&&(l.name=r.indexOf(u.name)),a.push(l)),i.push(l)}return Ve(t.__originalMappings,De.compareByOriginalPositions),t},qe.prototype._version=3,Object.defineProperty(qe.prototype,"sources",{get:function(){return this._sources.toArray().map((function(e){return null!=this.sourceRoot?De.join(this.sourceRoot,e):e}),this)}}),qe.prototype._parseMappings=function(e,t){for(var r,n,o,i,a,s=1,c=0,u=0,l=0,h=0,f=0,p=e.length,g=0,d={},v={},y=[],m=[];g<p;)if(";"===e.charAt(g))s++,g++,c=0;else if(","===e.charAt(g))g++;else{for((r=new Ye).generatedLine=s,i=g;i<p&&!this._charIsMappingSeparator(e,i);i++);if(o=d[n=e.slice(g,i)])g+=n.length;else{for(o=[];g<i;)ze(e,g,v),a=v.value,g=v.rest,o.push(a);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");d[n]=o}r.generatedColumn=c+o[0],c=r.generatedColumn,o.length>1&&(r.source=h+o[1],h+=o[1],r.originalLine=u+o[2],u=r.originalLine,r.originalLine+=1,r.originalColumn=l+o[3],l=r.originalColumn,o.length>4&&(r.name=f+o[4],f+=o[4])),m.push(r),"number"==typeof r.originalLine&&y.push(r)}Ve(m,De.compareByGeneratedPositionsDeflated),this.__generatedMappings=m,Ve(y,De.compareByOriginalPositions),this.__originalMappings=y},qe.prototype._findMapping=function(e,t,r,n,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return Fe.search(e,t,o,i)},qe.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},qe.prototype.originalPositionFor=function(e){var t={generatedLine:De.getArg(e,"line"),generatedColumn:De.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",De.compareByGeneratedPositionsDeflated,De.getArg(e,"bias",$e.GREATEST_LOWER_BOUND));if(r>=0){var n=this._generatedMappings[r];if(n.generatedLine===t.generatedLine){var o=De.getArg(n,"source",null);null!==o&&(o=this._sources.at(o),null!=this.sourceRoot&&(o=De.join(this.sourceRoot,o)));var i=De.getArg(n,"name",null);return null!==i&&(i=this._names.at(i)),{source:o,line:De.getArg(n,"originalLine",null),column:De.getArg(n,"originalColumn",null),name:i}}}return{source:null,line:null,column:null,name:null}},qe.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))},qe.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=De.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=De.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},qe.prototype.generatedPositionFor=function(e){var t=De.getArg(e,"source");if(null!=this.sourceRoot&&(t=De.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var r={source:t=this._sources.indexOf(t),originalLine:De.getArg(e,"line"),originalColumn:De.getArg(e,"column")},n=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",De.compareByOriginalPositions,De.getArg(e,"bias",$e.GREATEST_LOWER_BOUND));if(n>=0){var o=this._originalMappings[n];if(o.source===r.source)return{line:De.getArg(o,"generatedLine",null),column:De.getArg(o,"generatedColumn",null),lastColumn:De.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};var Xe=qe;function Je(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=De.getArg(t,"version"),n=De.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new Ge,this._names=new Ge;var o={line:-1,column:0};this._sections=n.map((function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=De.getArg(e,"offset"),r=De.getArg(t,"line"),n=De.getArg(t,"column");if(r<o.line||r===o.line&&n<o.column)throw new Error("Section offsets must be ordered and non-overlapping.");return o=t,{generatedOffset:{generatedLine:r+1,generatedColumn:n+1},consumer:new $e(De.getArg(e,"map"))}}))}Je.prototype=Object.create($e.prototype),Je.prototype.constructor=$e,Je.prototype._version=3,Object.defineProperty(Je.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),Je.prototype.originalPositionFor=function(e){var t={generatedLine:De.getArg(e,"line"),generatedColumn:De.getArg(e,"column")},r=Fe.search(t,this._sections,(function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;return r||e.generatedColumn-t.generatedOffset.generatedColumn})),n=this._sections[r];return n?n.consumer.originalPositionFor({line:t.generatedLine-(n.generatedOffset.generatedLine-1),column:t.generatedColumn-(n.generatedOffset.generatedLine===t.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},Je.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))},Je.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r].consumer.sourceContentFor(e,!0);if(n)return n}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},Je.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(-1!==r.consumer.sources.indexOf(De.getArg(e,"source"))){var n=r.consumer.generatedPositionFor(e);if(n)return{line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},Je.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],o=n.consumer._generatedMappings,i=0;i<o.length;i++){var a=o[i],s=n.consumer._sources.at(a.source);null!==n.consumer.sourceRoot&&(s=De.join(n.consumer.sourceRoot,s)),this._sources.add(s),s=this._sources.indexOf(s);var c=n.consumer._names.at(a.name);this._names.add(c),c=this._names.indexOf(c);var u={source:s,generatedLine:a.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:a.generatedColumn+(n.generatedOffset.generatedLine===a.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:a.originalLine,originalColumn:a.originalColumn,name:c};this.__generatedMappings.push(u),"number"==typeof u.originalLine&&this.__originalMappings.push(u)}Ve(this.__generatedMappings,De.compareByGeneratedPositionsDeflated),Ve(this.__originalMappings,De.compareByOriginalPositions)};var Ze={SourceMapConsumer:Ke,BasicSourceMapConsumer:Xe,IndexedSourceMapConsumer:Je},Qe=ke((function(e,t){var r;r=function(e,t){function r(e){return new Promise((function(t,r){var n=new XMLHttpRequest;n.open("get",e),n.onerror=r,n.onreadystatechange=function(){4===n.readyState&&(n.status>=200&&n.status<300?t(n.responseText):r(new Error("HTTP status: "+n.status+" retrieving "+e)))},n.send()}))}function n(e){if("undefined"!=typeof window&&window.atob)return window.atob(e);throw new Error("You must supply a polyfill for window.atob in this environment")}function o(e){if("object"!=typeof e)throw new TypeError("Given StackFrame is not an object");if("string"!=typeof e.fileName)throw new TypeError("Given file name is not a String");if("number"!=typeof e.lineNumber||e.lineNumber%1!=0||e.lineNumber<1)throw new TypeError("Given line number must be a positive integer");if("number"!=typeof e.columnNumber||e.columnNumber%1!=0||e.columnNumber<0)throw new TypeError("Given column number must be a non-negative integer");return!0}return function i(a){if(!(this instanceof i))return new i(a);a=a||{},this.sourceCache=a.sourceCache||{},this.ajax=a.ajax||r,this._atob=a.atob||n,this._get=function(e){return new Promise(function(t,r){var n="data:"===e.substr(0,5);if(this.sourceCache[e])t(this.sourceCache[e]);else if(a.offline&&!n)r(new Error("Cannot make network requests in offline mode"));else if(n){var o=e.match(/^data:application\/json;([\w=:"-]+;)*base64,/);if(o){var i=o[0].length,s=e.substr(i),c=this._atob(s);this.sourceCache[e]=c,t(c)}else r(new Error("The encoding of the inline sourcemap is not supported"))}else{var u=this.ajax(e,{method:"get"});this.sourceCache[e]=u,u.then(t,r)}}.bind(this))},this.pinpoint=function(e){return new Promise(function(t,r){this.getMappedLocation(e).then(function(e){function r(){t(e)}this.findFunctionName(e).then(t,r).catch(r)}.bind(this),r)}.bind(this))},this.findFunctionName=function(e){return new Promise(function(r,n){o(e),this._get(e.fileName).then((function(n){var o=e.lineNumber,i=e.columnNumber,a=function(e,t){for(var r,n=/function\s+([^(]*?)\s*\(([^)]*)\)/,o=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/,i=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/,a=e.split("\n"),s="",c=Math.min(t,20),u=0;u<c;++u){var l=a[t-u-1],h=l.indexOf("//");if(h>=0&&(l=l.substr(0,h)),l){if(s=l+s,(r=o.exec(s))&&r[1])return r[1];if((r=n.exec(s))&&r[1])return r[1];if((r=i.exec(s))&&r[1])return r[1]}}}(n,o);r(a?new t(a,e.args,e.fileName,o,i):e)}),n).catch(n)}.bind(this))},this.getMappedLocation=function(r){return new Promise(function(n,i){!function(){if("function"!=typeof Object.defineProperty||"function"!=typeof Object.create)throw new Error("Unable to consume source maps in older browsers")}(),o(r);var a=this.sourceCache,s=r.fileName;this._get(s).then(function(o){var c=function(e){var t=/\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/.exec(e);if(t&&t[1])return t[1];throw new Error("sourceMappingURL not found")}(o),u="data:"===c.substr(0,5),l=s.substring(0,s.lastIndexOf("/")+1);"/"===c[0]||u||/^https?:\/\/|^\/\//i.test(c)||(c=l+c),this._get(c).then((function(o){"string"==typeof o&&(o=function(e){if("undefined"!=typeof JSON&&JSON.parse)return JSON.parse(e);throw new Error("You must supply a polyfill for JSON.parse in this environment")}(o.replace(/^\)\]\}'/,""))),void 0===o.sourceRoot&&(o.sourceRoot=l),function(r,n,o){return new Promise((function(i,a){var s=new e.SourceMapConsumer(n),c=s.originalPositionFor({line:r.lineNumber,column:r.columnNumber});if(c.source){var u=s.sourceContentFor(c.source);u&&(o[c.source]=u),i(new t(c.name||r.functionName,r.args,c.source,c.line,c.column))}else a(new Error("Could not get original source for given stackframe and source map"))}))}(r,o,a).then(n).catch((function(){n(r)}))}),i).catch(i)}.bind(this),i).catch(i)}.bind(this))}}},e.exports=r(Ze,Ie)})),et=ke((function(e,t){var r;r=function(e,t,r){var n={filter:function(e){return-1===(e.functionName||"").indexOf("StackTrace$$")&&-1===(e.functionName||"").indexOf("ErrorStackParser$$")&&-1===(e.functionName||"").indexOf("StackTraceGPS$$")&&-1===(e.functionName||"").indexOf("StackGenerator$$")},sourceCache:{}},o=function(){try{throw new Error}catch(e){return e}};function i(e,t){var r={};return[e,t].forEach((function(e){for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r})),r}function a(e){return e.stack||e["opera#sourceloc"]}function s(e,t){return"function"==typeof t?e.filter(t):e}return{get:function(e){var t=o();return a(t)?this.fromError(t,e):this.generateArtificially(e)},getSync:function(r){r=i(n,r);var c=o();return s(a(c)?e.parse(c):t.backtrace(r),r.filter)},fromError:function(t,o){o=i(n,o);var a=new r(o);return new Promise(function(r){var n=s(e.parse(t),o.filter);r(Promise.all(n.map((function(e){return new Promise((function(t){function r(){t(e)}a.pinpoint(e).then(t,r).catch(r)}))}))))}.bind(this))},generateArtificially:function(e){e=i(n,e);var r=t.backtrace(e);return"function"==typeof e.filter&&(r=r.filter(e.filter)),Promise.resolve(r)},instrument:function(e,t,r,n){if("function"!=typeof e)throw new Error("Cannot instrument non-function object");if("function"==typeof e.__stacktraceOriginalFn)return e;var o=function(){try{return this.get().then(t,r).catch(r),e.apply(n||this,arguments)}catch(e){throw a(e)&&this.fromError(e).then(t,r).catch(r),e}}.bind(this);return o.__stacktraceOriginalFn=e,o},deinstrument:function(e){if("function"!=typeof e)throw new Error("Cannot de-instrument non-function object");return"function"==typeof e.__stacktraceOriginalFn?e.__stacktraceOriginalFn:e},report:function(e,t,r){return new Promise((function(n,o){var i=new XMLHttpRequest;i.onerror=o,i.onreadystatechange=function(){4===i.readyState&&(i.status>=200&&i.status<400?n(i.responseText):o(new Error("POST to "+t+" failed with status: "+i.status)))},i.open("post",t),i.setRequestHeader("Content-Type","application/json");var a={stack:e};void 0!==r&&(a.message=r),i.send(JSON.stringify(a))}))}}},e.exports=r(Oe,Te,Qe)})),tt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.renderDate=function(e,t){var r=function(e,t,r){var n=t-e.length;if(n>0){for(var o="",i=0;i<n;i++)o+=r;return o+=e}return e},n=function(e){return r(e.getFullYear().toString(),4,"0")},o=function(e){return r((e.getMonth()+1).toString(),2,"0")},i=function(e){return r(e.getDate().toString(),2,"0")},a=function(e){return r(e.getHours().toString(),2,"0")},s=function(e){return r(e.getMinutes().toString(),2,"0")},c=function(e){return r(e.getSeconds().toString(),2,"0")},u=function(e){return r(e.getMilliseconds().toString(),3,"0")},l=t.dateSeparator,h="";switch(t.formatEnum){case Pe.DateFormatEnum.Default:h=n(e)+l+o(e)+l+i(e)+" "+a(e)+":"+s(e)+":"+c(e)+","+u(e);break;case Pe.DateFormatEnum.YearMonthDayTime:h=n(e)+l+o(e)+l+i(e)+" "+a(e)+":"+s(e)+":"+c(e);break;case Pe.DateFormatEnum.YearDayMonthWithFullTime:h=n(e)+l+i(e)+l+o(e)+" "+a(e)+":"+s(e)+":"+c(e)+","+u(e);break;case Pe.DateFormatEnum.YearDayMonthTime:h=n(e)+l+i(e)+l+o(e)+" "+a(e)+":"+s(e)+":"+c(e);break;default:throw new Error("Unsupported date format enum: "+t.formatEnum)}return h},e.renderDefaultMessage=function(t,r){var n="",o=t.logFormat;o.showTimeStamp&&(n+=e.renderDate(t.date,o.dateFormat)+" "),n+=Pe.LogLevel[t.level].toUpperCase(),t.isResolvedErrorMessage&&(n+=" (resolved)"),n+=" ",o.showCategoryName&&(n+="[",t.categories.forEach((function(e,t){t>0&&(n+=", "),n+=e.name})),n+="]");var i="",a="",s=t.message;if("string"==typeof s)i=s;else{var c=s;i=c.msg,c.data&&(a=" [data]: "+(c.ds?c.ds(c.data):JSON.stringify(c.data)))}return n+=" "+i+a,r&&null!==t.errorAsStack&&(n+="\n"+t.errorAsStack),n},e.renderDefaultLog4jMessage=function(t,r){var n=t.logGroupRule.logFormat,o="";n.showTimeStamp&&(o+=e.renderDate(t.date,n.dateFormat)+" "),o+=Pe.LogLevel[t.level].toUpperCase()+" ",n.showLoggerName&&(o+="["+t.loggerName+"]");var i="",a="";if("string"==typeof t.message)i=t.message;else{var s=t.message;i=s.msg,s.data&&(a=" [data]: "+(s.ds?s.ds(s.data):JSON.stringify(s.data)))}return o+=" "+i+a,r&&null!==t.errorAsStack&&(o+="\n"+t.errorAsStack),o},e.renderError=function(e){var t=e.name+": "+e.message+"\n@";return new Promise((function(r){et.fromError(e,{offline:!0}).then((function(e){var n=e.map((function(e){return e.toString()})).join("\n  ");r(t+="\n"+n)})).catch((function(){t="Unexpected error object was passed in. ";try{t+="Could not resolve it, stringified object: "+JSON.stringify(e)}catch(e){t+="Could not resolve it or stringify it."}r(t)}))}))},e}();t.MessageFormatUtils=r}));Be(tt);tt.MessageFormatUtils;var rt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n,o,i,a,s){this._errorAsStack=null,this._error=null,this._loggerName=e,this._message=t,this._errorAsStack=r,this._error=n,this._logGroupRule=o,this._date=i,this._level=a,this._ready=s}return Object.defineProperty(e.prototype,"loggerName",{get:function(){return this._loggerName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},set:function(e){this._message=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorAsStack",{get:function(){return this._errorAsStack},set:function(e){this._errorAsStack=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},set:function(e){this._error=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logGroupRule",{get:function(){return this._logGroupRule},set:function(e){this._logGroupRule=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"date",{get:function(){return this._date},set:function(e){this._date=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this._level},set:function(e){this._level=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMessageLogData",{get:function(){return"string"!=typeof this._message},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ready",{get:function(){return this._ready},set:function(e){this._ready=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"messageAsString",{get:function(){return"string"==typeof this._message?this._message:this._message.msg},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logData",{get:function(){var e=null;return"string"!=typeof this._message&&(e=this.message),e},enumerable:!0,configurable:!0}),e}(),n=function(){function e(e,t){this._allMessages=new Ae.LinkedList,this._open=!0,this._name=e,this._logGroupRuntimeSettings=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.trace=function(e,t){void 0===t&&(t=null),this._log(Pe.LogLevel.Trace,e,t)},e.prototype.debug=function(e,t){void 0===t&&(t=null),this._log(Pe.LogLevel.Debug,e,t)},e.prototype.info=function(e,t){void 0===t&&(t=null),this._log(Pe.LogLevel.Info,e,t)},e.prototype.warn=function(e,t){void 0===t&&(t=null),this._log(Pe.LogLevel.Warn,e,t)},e.prototype.error=function(e,t){void 0===t&&(t=null),this._log(Pe.LogLevel.Error,e,t)},e.prototype.fatal=function(e,t){void 0===t&&(t=null),this._log(Pe.LogLevel.Fatal,e,t)},e.prototype.isTraceEnabled=function(){return this._logGroupRuntimeSettings.level===Pe.LogLevel.Trace},e.prototype.isDebugEnabled=function(){return this._logGroupRuntimeSettings.level<=Pe.LogLevel.Debug},e.prototype.isInfoEnabled=function(){return this._logGroupRuntimeSettings.level<=Pe.LogLevel.Info},e.prototype.isWarnEnabled=function(){return this._logGroupRuntimeSettings.level<=Pe.LogLevel.Warn},e.prototype.isErrorEnabled=function(){return this._logGroupRuntimeSettings.level<=Pe.LogLevel.Error},e.prototype.isFatalEnabled=function(){return this._logGroupRuntimeSettings.level<=Pe.LogLevel.Fatal},e.prototype.getLogLevel=function(){return this._logGroupRuntimeSettings.level},e.prototype.isOpen=function(){return this._open},e.prototype.close=function(){this._open=!1,this._allMessages.clear()},e.prototype.createDefaultLogMessage=function(e){return tt.MessageFormatUtils.renderDefaultLog4jMessage(e,!0)},e.prototype._getMessageFormatter=function(){return this._logGroupRuntimeSettings.formatterLogMessage},e.prototype._log=function(e,t,r){if(void 0===r&&(r=null),this._open&&this._logGroupRuntimeSettings.level<=e){this._allMessages.addTail(this.createMessage(e,(function(){return"function"==typeof t?t():t}),(function(){return"function"==typeof r?r():r}),new Date)),this.processMessages()}},e.prototype.createMessage=function(e,t,n,o){var i=this,a=n();if(null!==a){var s=new r(this._name,t(),null,a,this._logGroupRuntimeSettings.logGroupRule,o,e,!1);return tt.MessageFormatUtils.renderError(a).then((function(e){s.errorAsStack=e,s.ready=!0,i.processMessages()})).catch((function(){s.errorAsStack="<UNKNOWN> unable to get stack.",s.ready=!0,i.processMessages()})),s}return new r(this._name,t(),null,a,this._logGroupRuntimeSettings.logGroupRule,o,e,!0)},e.prototype.processMessages=function(){var e=this._allMessages;if(e.getSize()>0)do{var t=e.getHead();if(null!=t){if(!t.ready)break;e.removeHead(),null!==t.message&&this.doLog(t)}}while(e.getSize()>0)},e}();t.AbstractLogger=n}));Be(rt);rt.AbstractLogger;var nt=ke((function(e,t){var r=Ee&&Ee.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t,r){return e.call(this,t,r)||this}return r(t,e),t.prototype.doLog=function(e){if(void 0===console)throw new Error("Console is not defined, cannot log msg: "+e.message);var t=!1,r=e.level,n=this._getMessageFormatter(),o=void 0;switch(o=null===n?this.createDefaultLogMessage(e):n(e),r){case Pe.LogLevel.Trace:case Pe.LogLevel.Debug:break;case Pe.LogLevel.Info:console.info&&(console.info(o),t=!0);break;case Pe.LogLevel.Warn:console.warn&&(console.warn(o),t=!0);break;case Pe.LogLevel.Error:case Pe.LogLevel.Fatal:console.error&&(console.error(o),t=!0);break;default:throw new Error("Log level not supported: "+r)}t||console.log(o)},t}(rt.AbstractLogger);t.ConsoleLoggerImpl=n}));Be(nt);nt.ConsoleLoggerImpl;var ot=ke((function(e,t){var r=Ee&&Ee.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.messages=[],n}return r(t,e),t.prototype.close=function(){this.messages=[],e.prototype.close.call(this)},t.prototype.getMessages=function(){return this.messages},t.prototype.toString=function(){return this.messages.map((function(e){return e})).join("\n")},t.prototype.doLog=function(e){var t,r=this._getMessageFormatter();t=null===r?this.createDefaultLogMessage(e):r(e),this.messages.push(t)},t}(rt.AbstractLogger);t.MessageBufferLoggerImpl=n}));Be(ot);ot.MessageBufferLoggerImpl;var it=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._formatterLogMessage=null,this._logGroupRule=e,this._level=e.level,this._loggerType=e.loggerType,this._logFormat=new Pe.LogFormat(new Pe.DateFormat(e.logFormat.dateFormat.formatEnum,e.logFormat.dateFormat.dateSeparator),e.logFormat.showTimeStamp,e.logFormat.showLoggerName),this._callBackLogger=e.callBackLogger,this._formatterLogMessage=e.formatterLogMessage}return Object.defineProperty(e.prototype,"logGroupRule",{get:function(){return this._logGroupRule},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this._level},set:function(e){this._level=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loggerType",{get:function(){return this._loggerType},set:function(e){this._loggerType=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logFormat",{get:function(){return this._logFormat},set:function(e){this._logFormat=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"callBackLogger",{get:function(){return this._callBackLogger},set:function(e){this._callBackLogger=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatterLogMessage",{get:function(){return this._formatterLogMessage},set:function(e){this._formatterLogMessage=e},enumerable:!0,configurable:!0}),e}();t.LogGroupRuntimeSettings=r}));Be(it);it.LogGroupRuntimeSettings;var at=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){this._loggers=new Ae.SimpleMap,this._logGroupRuntimeSettingsIndexed=[],this._loggerToLogGroupSettings=new Ae.SimpleMap,this._name=e,this.configure(t)}return e.prototype.configure=function(e){this._options=e,this.closeLoggers(),this._loggerToLogGroupSettings.clear(),this._logGroupRuntimeSettingsIndexed=[];for(var t=this._options.logGroupRules,r=0;r<t.length;r++)this._logGroupRuntimeSettingsIndexed.push(new it.LogGroupRuntimeSettings(t[r]))},e.prototype.getLogger=function(e){if(!this._options.enabled)throw new Error("LoggerFactory is not enabled, please check your options passed in");var t=this._loggers.get(e);return void 0!==t||(t=this.loadLogger(e),this._loggers.put(e,t)),t},e.prototype.isEnabled=function(){return this._options.enabled},e.prototype.closeLoggers=function(){this._loggers.forEachValue((function(e){e instanceof rt.AbstractLogger&&e.close()})),this._loggers.clear()},e.prototype.getName=function(){return this._name},e.prototype.getLogGroupRuntimeSettingsByIndex=function(e){return e>=0&&e<this._logGroupRuntimeSettingsIndexed.length?this._logGroupRuntimeSettingsIndexed[e]:null},e.prototype.getLogGroupRuntimeSettingsByLoggerName=function(e){var t=this._loggerToLogGroupSettings.get(e);return void 0===t?null:t},e.prototype.getLogGroupRuntimeSettings=function(){return this._logGroupRuntimeSettingsIndexed.slice(0)},e.prototype.loadLogger=function(e){for(var t=this._options.logGroupRules,r=0;r<t.length;r++){var n=t[r];if(n.regExp.test(e)){var o=this._logGroupRuntimeSettingsIndexed[r],i=void 0;switch(n.loggerType){case Pe.LoggerType.Console:i=new nt.ConsoleLoggerImpl(e,o);break;case Pe.LoggerType.MessageBuffer:i=new ot.MessageBufferLoggerImpl(e,o);break;case Pe.LoggerType.Custom:if(null==n.callBackLogger)throw new Error("Cannot create a custom logger, custom callback is null");i=n.callBackLogger(e,o);break;default:throw new Error("Cannot create a Logger for LoggerType: "+n.loggerType)}return this._loggerToLogGroupSettings.put(e,o),i}}throw new Error("Failed to find a match to create a Logger for: "+e)},e}();t.LoggerFactoryImpl=r}));Be(at);at.LoggerFactoryImpl;var st=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n,o,i,a){this._resolvedErrorMessage=!1,this._errorAsStack=null,this._message=e,this._error=t,this._categories=r,this._date=n,this._level=o,this._logFormat=i,this._ready=a}return Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"categories",{get:function(){return this._categories},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"date",{get:function(){return this._date},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this._level},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logFormat",{get:function(){return this._logFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMessageLogData",{get:function(){return"string"!=typeof this._message},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"messageAsString",{get:function(){return"string"==typeof this._message?this._message:this._message.msg},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logData",{get:function(){var e=null;return"string"!=typeof this._message&&(e=this.message),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isResolvedErrorMessage",{get:function(){return this._resolvedErrorMessage},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorAsStack",{get:function(){return this._errorAsStack},set:function(e){this._errorAsStack=e},enumerable:!0,configurable:!0}),e.prototype.isReady=function(){return this._ready},e.prototype.setReady=function(e){this._ready=e},Object.defineProperty(e.prototype,"resolvedErrorMessage",{get:function(){return this._resolvedErrorMessage},set:function(e){this._resolvedErrorMessage=e},enumerable:!0,configurable:!0}),e}(),n=function(){function e(e,t){this.allMessages=new Ae.LinkedList,this.rootCategory=e,this.runtimeSettings=t}return e.prototype.trace=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._log.apply(this,[Pe.LogLevel.Trace,e,null,!1].concat(t))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._log.apply(this,[Pe.LogLevel.Debug,e,null,!1].concat(t))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._log.apply(this,[Pe.LogLevel.Info,e,null,!1].concat(t))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._log.apply(this,[Pe.LogLevel.Warn,e,null,!1].concat(t))},e.prototype.error=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this._log.apply(this,[Pe.LogLevel.Error,e,t,!1].concat(r))},e.prototype.fatal=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this._log.apply(this,[Pe.LogLevel.Fatal,e,t,!1].concat(r))},e.prototype.resolved=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this._log.apply(this,[Pe.LogLevel.Error,e,t,!0].concat(r))},e.prototype.log=function(e,t,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];this._log.apply(this,[e,t,r,!1].concat(n))},e.prototype.getRootCategory=function(){return this.rootCategory},e.prototype.createDefaultLogMessage=function(e){return tt.MessageFormatUtils.renderDefaultMessage(e,!0)},e.prototype._getMessageFormatter=function(){var e=this.runtimeSettings.getCategorySettings(this.rootCategory);if(null===e)throw new Error("Did not find CategorySettings for rootCategory: "+this.rootCategory.name);return e.formatterLogMessage},e.prototype._log=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=!1);for(var o=[],i=4;i<arguments.length;i++)o[i-4]=arguments[i];this._logInternal.apply(this,[e,function(){return"function"==typeof t?t():t},function(){return"function"==typeof r?r():r},n].concat(o))},e.prototype._logInternal=function(e,t,n,o){for(var i=this,a=[],s=4;s<arguments.length;s++)a[s-4]=arguments[s];var c=[this.rootCategory];void 0!==a&&a.length>0&&(c=c.concat(a.filter((function(e){return e!==i.rootCategory}))));for(var u=function(a){var s=c[a];if(null===s)throw new Error("Cannot have a null element within categories, at index="+a);var u=l.runtimeSettings.getCategorySettings(s);if(null===u)throw new Error("Category with path: "+s.getCategoryPath()+" is not registered with this logger, maybe you registered it with a different root logger?");if(u.logLevel<=e){var h=null!==n?n():null;if(null===h){var f=new r(t(),h,c,new Date,e,u.logFormat,!0);f.resolvedErrorMessage=o,l.allMessages.addTail(f),l.processMessages()}else{var p=new r(t(),h,c,new Date,e,u.logFormat,!1);p.resolvedErrorMessage=o,l.allMessages.addTail(p),tt.MessageFormatUtils.renderError(h).then((function(e){p.errorAsStack=e,p.setReady(!0),i.processMessages()})).catch((function(){p.errorAsStack="<UNKNOWN> unable to get stack.",p.setReady(!0),i.processMessages()}))}return"break"}},l=this,h=0;h<c.length;h++){if("break"===u(h))break}},e.prototype.processMessages=function(){var e=this.allMessages;if(e.getSize()>0)do{var t=e.getHead();if(null!=t){if(!t.isReady())break;e.removeHead(),this.doLog(t)}}while(e.getSize()>0)},e}();t.AbstractCategoryLogger=n}));Be(st);st.AbstractCategoryLogger;var ct=ke((function(e,t){var r=Ee&&Ee.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t,r){return e.call(this,t,r)||this}return r(t,e),t.prototype.doLog=function(e){if(void 0===console)throw new Error("Console is not defined, cannot log msg: "+e.messageAsString);var t=this._getMessageFormatter(),r=void 0;r=null===t?this.createDefaultLogMessage(e):t(e);var n=!1;switch(e.level){case Pe.LogLevel.Trace:case Pe.LogLevel.Debug:break;case Pe.LogLevel.Info:console.info&&(console.info(r),n=!0);break;case Pe.LogLevel.Warn:console.warn&&(console.warn(r),n=!0);break;case Pe.LogLevel.Error:case Pe.LogLevel.Fatal:console.error&&(console.error(r),n=!0);break;default:throw new Error("Unsupported level: "+e.level)}n||console.log(r)},t}(st.AbstractCategoryLogger);t.CategoryConsoleLoggerImpl=n}));Be(ct);ct.CategoryConsoleLoggerImpl;var ut=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this._delegate=e}return Object.defineProperty(e.prototype,"delegate",{get:function(){return this._delegate},set:function(e){this._delegate=e},enumerable:!0,configurable:!0}),e.prototype.trace=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this._delegate).trace.apply(t,[e].concat(r))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this._delegate).debug.apply(t,[e].concat(r))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this._delegate).info.apply(t,[e].concat(r))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this._delegate).warn.apply(t,[e].concat(r))},e.prototype.error=function(e,t){for(var r,n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];(r=this._delegate).error.apply(r,[e,t].concat(n))},e.prototype.fatal=function(e,t){for(var r,n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];(r=this._delegate).fatal.apply(r,[e,t].concat(n))},e.prototype.resolved=function(e,t){for(var r,n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];(r=this._delegate).resolved.apply(r,[e,t].concat(n))},e.prototype.log=function(e,t,r){for(var n,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];(n=this._delegate).log.apply(n,[e,t,r].concat(o))},e}();t.CategoryDelegateLoggerImpl=r}));Be(ut);ut.CategoryDelegateLoggerImpl;var lt=ke((function(e,t){var r=Ee&&Ee.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t,r){return e.call(this,t,r)||this}return r(t,e),t.prototype.doLog=function(e){"undefined"!=typeof window?dt.ExtensionHelper.sendCategoryLogMessage(e):console.log("window is not available, you must be running in a browser for this. Dropped message.")},t}(st.AbstractCategoryLogger);t.CategoryExtensionLoggerImpl=n}));Be(lt);lt.CategoryExtensionLoggerImpl;var ht=ke((function(e,t){var r=Ee&&Ee.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messages=[],t}return r(t,e),t.prototype.getMessages=function(){return this.messages},t.prototype.toString=function(){return this.messages.map((function(e){return e})).join("\n")},t.prototype.doLog=function(e){var t,r=this._getMessageFormatter();t=null===r?this.createDefaultLogMessage(e):r(e),this.messages.push(t)},t}(st.AbstractCategoryLogger);t.CategoryMessageBufferLoggerImpl=n}));Be(ht);ht.CategoryMessageBufferLoggerImpl;var ft=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n,o,i){void 0===t&&(t=Pe.LogLevel.Error),void 0===r&&(r=Pe.LoggerType.Console),void 0===n&&(n=new Pe.CategoryLogFormat),void 0===o&&(o=null),void 0===i&&(i=null),this._formatterLogMessage=null,this._category=e,this._logLevel=t,this._loggerType=r,this._logFormat=n,this._callBackLogger=o,this._formatterLogMessage=i}return Object.defineProperty(e.prototype,"category",{get:function(){return this._category},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){this._logLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loggerType",{get:function(){return this._loggerType},set:function(e){this._loggerType=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logFormat",{get:function(){return this._logFormat},set:function(e){this._logFormat=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"callBackLogger",{get:function(){return this._callBackLogger},set:function(e){this._callBackLogger=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatterLogMessage",{get:function(){return this._formatterLogMessage},set:function(e){this._formatterLogMessage=e},enumerable:!0,configurable:!0}),e}();t.CategoryRuntimeSettings=r}));Be(ft);ft.CategoryRuntimeSettings;var pt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n){if(void 0===e&&(e=Pe.LogLevel.Error),void 0===t&&(t=Pe.LoggerType.Console),void 0===r&&(r=new Pe.CategoryLogFormat),void 0===n&&(n=null),this._formatterLogMessage=null,this._logLevel=e,this._loggerType=t,this._logFormat=r,this._callBackLogger=n,this._loggerType===Pe.LoggerType.Custom&&null===this.callBackLogger)throw new Error("If you specify loggerType to be Custom, you must provide the callBackLogger argument")}return Object.defineProperty(e.prototype,"logLevel",{get:function(){return this._logLevel},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loggerType",{get:function(){return this._loggerType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logFormat",{get:function(){return this._logFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"callBackLogger",{get:function(){return this._callBackLogger},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatterLogMessage",{get:function(){return this._formatterLogMessage},set:function(e){if(null!==e&&this._loggerType===Pe.LoggerType.Custom)throw new Error("You cannot specify a formatter for log messages if your loggerType is Custom");this._formatterLogMessage=e},enumerable:!0,configurable:!0}),e.prototype.copy=function(){var t=new e(this.logLevel,this.loggerType,this.logFormat.copy(),this.callBackLogger);return t.formatterLogMessage=this.formatterLogMessage,t},e}();t.CategoryConfiguration=r}));Be(pt);pt.CategoryConfiguration;var gt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._defaultConfig=new pt.CategoryConfiguration,this._mapState=new Ae.SimpleMap,dt.ExtensionHelper.register()}return e.getInstance=function(){return null===e._INSTANCE&&(e._INSTANCE=new e),e._INSTANCE},e.prototype.getLogger=function(e){return this.createOrGetCategoryState(e).logger},e.prototype.clear=function(){this._mapState.clear(),this.setDefaultConfiguration(new pt.CategoryConfiguration)},e.prototype.getCategorySettings=function(e){return this.createOrGetCategoryState(e).currentRuntimeSettings},e.prototype.getOriginalCategorySettings=function(e){return this.createOrGetCategoryState(e).originalRuntimeSettings},e.prototype.setDefaultConfiguration=function(e,t){void 0===t&&(t=!0),this._defaultConfig=e,t&&this._mapState.forEachValue((function(t){t.updateSettings(e)}))},e.prototype.setConfigurationCategory=function(e,t,r){var n=this;void 0===r&&(r=!1),this.createOrGetCategoryState(t).updateSettings(e),r&&t.children.forEach((function(t){n.setConfigurationCategory(e,t,r)}))},e.prototype.registerCategory=function(t){if(null==t)throw new Error("Category CANNOT be null/undefined");if(this._mapState.exists(e.getCategoryKey(t)))throw new Error("Cannot add this root category with name: "+t.name+", it already exists (same name in hierarchy).");this.createOrGetCategoryState(t)},e.prototype.enableExtensionIntegration=function(){var e=this;this._mapState.forEachValue((function(t){return t.enableForExtension(e)}))},e.prototype.getRootCategories=function(){return this._mapState.values().filter((function(e){return null==e.category.parent})).map((function(e){return e.category}))},e.prototype.getCategoryById=function(e){var t=this._mapState.values().filter((function(t){return t.category.id===e})).map((function(e){return e.category}));return 1===t.length?t[0]:null},e.prototype.createOrGetCategoryState=function(t){var r=e.getCategoryKey(t),n=this._mapState.get(r);if(void 0!==n)return n;var o=this.createState(t);return this._mapState.put(r,o),o},e.prototype.createState=function(e){var t=this;return new n(e,(function(){return t._defaultConfig}),(function(e){return t.createLogger(e)}))},e.prototype.createLogger=function(e){switch(this._defaultConfig.loggerType){case Pe.LoggerType.Console:return new ct.CategoryConsoleLoggerImpl(e,this);case Pe.LoggerType.MessageBuffer:return new ht.CategoryMessageBufferLoggerImpl(e,this);case Pe.LoggerType.Custom:if(null===this._defaultConfig.callBackLogger)throw new Error("Cannot create custom logger, custom callback is null");return this._defaultConfig.callBackLogger(e,this);default:throw new Error("Cannot create a Logger for LoggerType: "+this._defaultConfig.loggerType)}},e.getCategoryKey=function(e){return e.getCategoryPath()},e._INSTANCE=null,e}();t.CategoryServiceImpl=r;var n=function(){function e(e,t,r){this._category=e,this._lazyState=new o(e,t,r)}return Object.defineProperty(e.prototype,"category",{get:function(){return this._category},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logger",{get:function(){return this._lazyState.getLogger()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"originalRuntimeSettings",{get:function(){return this._lazyState.getOriginalRuntimeSettings()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentRuntimeSettings",{get:function(){return this._lazyState.getCurrentRuntimeSettings()},enumerable:!0,configurable:!0}),e.prototype.enableForExtension=function(e){this._lazyState.enableForExtension(e)},e.prototype.updateSettings=function(e){this._lazyState.updateSettings(e)},e}(),o=function(){function e(e,t,r){this._category=e,this._defaultConfig=t,this._createLogger=r}return e.prototype.isLoaded=function(){return void 0!==this._logger},e.prototype.getLogger=function(){return this.loadLoggerOnDemand(),this._delegateLogger},e.prototype.getOriginalRuntimeSettings=function(){return this.loadLoggerOnDemand(),this._originalRuntimeSettings},e.prototype.getCurrentRuntimeSettings=function(){return this.loadLoggerOnDemand(),this._currentRuntimeSettings},e.prototype.enableForExtension=function(e){this.loadLoggerOnDemand(),this._wrappedLogger instanceof lt.CategoryExtensionLoggerImpl||(console.log("Reconfiguring logger for extension for category: "+this._category.name),this._wrappedLogger=new lt.CategoryExtensionLoggerImpl(this._category,e),this._delegateLogger.delegate=this._wrappedLogger)},e.prototype.updateSettings=function(e){this.isLoaded()?(this._currentRuntimeSettings.logLevel=e.logLevel,this._currentRuntimeSettings.loggerType=e.loggerType,this._currentRuntimeSettings.logFormat=e.logFormat,this._currentRuntimeSettings.callBackLogger=e.callBackLogger,this._currentRuntimeSettings.formatterLogMessage=e.formatterLogMessage,this._logger=this._createLogger(this._category),this._wrappedLogger instanceof lt.CategoryExtensionLoggerImpl||(this._wrappedLogger=this._logger),this._delegateLogger.delegate=this._wrappedLogger):this._defaultConfig=function(){return e}},e.prototype.loadLoggerOnDemand=function(){this.isLoaded()||(this._logger=this._createLogger(this._category),this._wrappedLogger=this._logger,this._delegateLogger=new ut.CategoryDelegateLoggerImpl(this._wrappedLogger),this._originalRuntimeSettings=this.initNewSettings(),this._currentRuntimeSettings=this.initNewSettings())},e.prototype.initNewSettings=function(){var e=this._defaultConfig().copy();return new ft.CategoryRuntimeSettings(this._category,e.logLevel,e.loggerType,e.logFormat,e.callBackLogger,e.formatterLogMessage)},e}()}));Be(gt);gt.CategoryServiceImpl;var dt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.register=function(){if(!e.registered){e.registered=!0;var t=function(t){var r=t.data;null!==r&&e.processMessageFromExtension(r)};"undefined"!=typeof window&&(window.removeEventListener("message",t),window.addEventListener("message",t))}},e.processMessageFromExtension=function(t){if(e.registered&&"tsl-extension"===t.from){var r=t.data;switch(r.type){case"register":e.enableExtensionIntegration();break;case"request-change-loglevel":var n=r.value,o=e.applyLogLevel(n.categoryId,n.logLevel,n.recursive);o.length>0&&e.sendCategoriesRuntimeUpdateMessage(o);break;default:console.log("Unknown command to process message from extension, command was: "+r.type)}}},e.sendCategoryLogMessage=function(t){if(e.registered){var r={data:{type:"log-message",value:{categories:t.categories.map((function(e){return e.id})),errorAsStack:t.errorAsStack,formattedMessage:tt.MessageFormatUtils.renderDefaultMessage(t,!1),logLevel:Pe.LogLevel[t.level].toString(),message:t.messageAsString,resolvedErrorMessage:t.isResolvedErrorMessage}},from:"tsl-logging"};e.sendMessage(r)}},e.sendCategoriesRuntimeUpdateMessage=function(t){if(e.registered){var r=gt.CategoryServiceImpl.getInstance(),n={categories:Array()};t.forEach((function(e){var t=r.getCategorySettings(e);null!=t&&n.categories.push({id:e.id,logLevel:Pe.LogLevel[t.logLevel].toString()})}));var o={data:{type:"categories-rt-update",value:n},from:"tsl-logging"};e.sendMessage(o)}},e.sendRootCategoriesToExtension=function(){if(e.registered){var t={data:{type:"root-categories-tree",value:gt.CategoryServiceImpl.getInstance().getRootCategories().map((function(t){return e.getCategoryAsJSON(t)}))},from:"tsl-logging"};e.sendMessage(t)}},e.getCategoryAsJSON=function(t){return{children:t.children.map((function(t){return e.getCategoryAsJSON(t)})),id:t.id,logLevel:Pe.LogLevel[t.logLevel].toString(),name:t.name,parentId:null!=t.parent?t.parent.id:null}},e.applyLogLevel=function(t,r,n){var o=[],i=gt.CategoryServiceImpl.getInstance().getCategoryById(t);return null!=i?e._applyLogLevelRecursive(i,Pe.LogLevel.fromString(r),n,o):console.log("Could not change log level, failed to find category with id: "+t),o},e._applyLogLevelRecursive=function(t,r,n,o){var i=gt.CategoryServiceImpl.getInstance().getCategorySettings(t);null!=i&&(i.logLevel=r,o.push(t),n&&t.children.forEach((function(t){e._applyLogLevelRecursive(t,r,n,o)})))},e.getAllCategories=function(){var e=[],t=function(e,r){r.push(e),e.children.forEach((function(e){t(e,r)}))};return gt.CategoryServiceImpl.getInstance().getRootCategories().forEach((function(r){t(r,e)})),e},e.sendMessage=function(t){e.registered&&"undefined"!=typeof window&&window.postMessage(t,"*")},e.enableExtensionIntegration=function(){if(e.registered){gt.CategoryServiceImpl.getInstance().enableExtensionIntegration(),e.sendRootCategoriesToExtension();var t=e.getAllCategories();e.sendCategoriesRuntimeUpdateMessage(t)}},e.registered=!1,e}();t.ExtensionHelper=r}));Be(dt);dt.ExtensionHelper;var vt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,r,n,o){void 0===r&&(r=new Pe.LogFormat),void 0===n&&(n=Pe.LoggerType.Console),void 0===o&&(o=null),this._formatterLogMessage=null,this._regExp=e,this._level=t,this._logFormat=r,this._loggerType=n,this._callBackLogger=o}return Object.defineProperty(e.prototype,"regExp",{get:function(){return this._regExp},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this._level},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loggerType",{get:function(){return this._loggerType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logFormat",{get:function(){return this._logFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"callBackLogger",{get:function(){return this._callBackLogger},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"formatterLogMessage",{get:function(){return this._formatterLogMessage},set:function(e){if(null!==e&&this._loggerType===Pe.LoggerType.Custom)throw new Error("You cannot specify a formatter for log messages if your loggerType is Custom");this._formatterLogMessage=e},enumerable:!0,configurable:!0}),e}();t.LogGroupRule=r}));Be(vt);vt.LogGroupRule;var yt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._logGroupRules=[],this._enabled=!0}return e.prototype.addLogGroupRule=function(e){return this._logGroupRules.push(e),this},e.prototype.setEnabled=function(e){return this._enabled=e,this},Object.defineProperty(e.prototype,"logGroupRules",{get:function(){return this._logGroupRules},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),e}();t.LoggerFactoryOptions=r}));Be(yt);yt.LoggerFactoryOptions;var mt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this._nameCounter=1,this._mapFactories=new Ae.SimpleMap,dt.ExtensionHelper.register()}return e.getInstance=function(){return null===e._INSTANCE&&(e._INSTANCE=new e),e._INSTANCE},e.prototype.createLoggerFactory=function(e){void 0===e&&(e=null);var t="LoggerFactory"+this._nameCounter++;return this.createNamedLoggerFactory(t,e)},e.prototype.createNamedLoggerFactory=function(t,r){if(void 0===r&&(r=null),this._mapFactories.exists(t))throw new Error("LoggerFactory with name "+t+" already exists.");var n;return n=null!==r?new at.LoggerFactoryImpl(t,r):new at.LoggerFactoryImpl(t,e.createDefaultOptions()),this._mapFactories.put(t,n),n},e.prototype.closeLoggers=function(){this._mapFactories.values().forEach((function(e){e.closeLoggers()})),this._mapFactories.clear(),this._nameCounter=1},e.prototype.getRuntimeSettingsForLoggerFactories=function(){var e=[];return this._mapFactories.forEachValue((function(t){return e.push(t)})),e},e.prototype.getLogGroupSettings=function(e,t){var r=this._mapFactories.get(e);return void 0===r?null:r.getLogGroupRuntimeSettingsByIndex(t)},e.prototype.getLoggerFactoryRuntimeSettingsByName=function(e){var t=this._mapFactories.get(e);return void 0===t?null:t},e.createDefaultOptions=function(){return(new yt.LoggerFactoryOptions).addLogGroupRule(new vt.LogGroupRule(new RegExp(".+"),Pe.LogLevel.Info))},e._INSTANCE=null,e}(),n=function(){function e(){}return e.createLoggerFactory=function(t){return void 0===t&&(t=null),e.INSTANCE_SERVICE.createLoggerFactory(t)},e.createNamedLoggerFactory=function(t,r){if(void 0===r&&(r=null),t===e.DEFAULT_LOGGER_FACTORY_NAME)throw new Error("LoggerFactory name: "+e.DEFAULT_LOGGER_FACTORY_NAME+" is reserved and cannot be used.");return e.INSTANCE_SERVICE.createNamedLoggerFactory(t,r)},e.closeLoggers=function(){return e.INSTANCE_SERVICE.closeLoggers()},e.getRuntimeSettings=function(){return e.INSTANCE_SERVICE},Object.defineProperty(e,"DEFAULT",{get:function(){return e.getDefault()},enumerable:!0,configurable:!0}),e.getDefault=function(){return null===e.DEFAULT_LOGGER_FACTORY&&(e.DEFAULT_LOGGER_FACTORY=e.DEFAULT_LOGGER_FACTORY=e.INSTANCE_SERVICE.createNamedLoggerFactory(e.DEFAULT_LOGGER_FACTORY_NAME,(new yt.LoggerFactoryOptions).addLogGroupRule(new vt.LogGroupRule(new RegExp(".+"),Pe.LogLevel.Error)))),e.DEFAULT_LOGGER_FACTORY},e.DEFAULT_LOGGER_FACTORY_NAME="DEFAULT",e.INSTANCE_SERVICE=r.getInstance(),e.DEFAULT_LOGGER_FACTORY=null,e}();t.LFService=n}));Be(mt);mt.LFService;var _t=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.help=function(){console.log(e._help)},e.prototype.listFactories=function(){var t=e._getRuntimeSettingsLoggerFactories(),r=new Ae.StringBuilder;r.appendLine("Registered LoggerFactories (index / name)");for(var n=0;n<t.length;n++){var o=t[n];r.append("  "+n).append(": "+o.getName()+"\n")}console.log(r.toString())},e.prototype.showSettings=function(t){void 0===t&&(t="all");var r=[];if("all"===t){var n=0;e._getRuntimeSettingsLoggerFactories().forEach((function(e){r.push(new Ae.TuplePair(n++,e))}))}else{var o=e._getRuntimeSettingsLoggerFactories();if(!(t>=0&&t<o.length))throw new Error("Requested number: "+t+" was not found.");r.push(new Ae.TuplePair(t,o[t]))}for(var i=0,a=r;i<a.length;i++){var s=a[i];console.log("  LoggerFactory: "+s.y.getName()+" (id="+s.x+")");for(var c=s.y.getLogGroupRuntimeSettings(),u=0;u<c.length;u++){var l=c[u];console.log("     LogGroup: (id="+u+")"),console.log("       RegExp: "+l.logGroupRule.regExp.source),console.log("       Level: "+Pe.LogLevel[l.level].toString()),console.log("       LoggerType: "+Pe.LoggerType[l.loggerType].toString())}}},e.prototype.reset=function(t){void 0===t&&(t="all");var r=e._getRuntimeSettingsLoggerFactories(),o=[];"all"===t?o=r:t>=0&&t<r.length&&o.push(r[t]),o.forEach((function(e){console.log("Reset all settings for factory "+t),new n(e).reset()}))},e.prototype.getLoggerFactoryControl=function(t){var r=e._getRuntimeSettingsLoggerFactories();if(t>=0&&t<r.length)return new n(r[t]);throw new Error("idFactory is invalid (less than 0) or non existing id.")},e._getRuntimeSettingsLoggerFactories=function(){return e._getSettings().getRuntimeSettingsForLoggerFactories()},e._getSettings=function(){return mt.LFService.getRuntimeSettings()},e._help='\n  help(): void\n    ** Shows this help.\n\n  listFactories(): void\n    ** List all registered LoggerFactories with associated log groups with respective ids (ids can be used to target a factory and/or group).\n\n  showSettings(idFactory: number | "all"): void\n    ** Show log group settings for idFactory (use listFactories to find id for a LoggerFactory). If idFactory is "all" shows all factories.\n\n  getLoggerFactoryControl(idFactory: number): LoggerFactoryControl\n    ** Return LoggerFactoryControl when found for given idFactory or throws Error if invalid or null, get the id by using listFactories()\n\n  reset(idFactory: number | "all"): void\n    ** Resets given factory or all factories back to original values.\n',e}();t.LoggerControlImpl=r;var n=function(){function e(e){this._settings=e}return e.prototype.help=function(){console.log(e._help)},e.prototype.example=function(){console.log(e._example)},e.prototype.showSettings=function(e){void 0===e&&(e="all");var t=new Ae.StringBuilder,r=this._settings.getLogGroupRuntimeSettings();t.appendLine("Registered LogGroups (index / expression)");for(var n=0;n<r.length;n++){var o=r[n];t.appendLine("  "+n+": "+o.logGroupRule.regExp.source+", logLevel="+Pe.LogLevel[o.level].toString()+", showTimestamp="+o.logFormat.showTimeStamp+", showLoggerName="+o.logFormat.showLoggerName+", format="+Pe.DateFormatEnum[o.logFormat.dateFormat.formatEnum].toString())}console.log(t.toString())},e.prototype.change=function(e){var t=this._getLogGroupRunTimeSettingsFor(e.group),r=null,n=null,o=null,i=null,a=null,s=function(e){null!==a&&(a+=", "),null===a?a=e:a+=e};"string"==typeof e.logLevel&&(r=Pe.LogLevel.fromString(e.logLevel),s("logLevel="+e.logLevel)),"string"==typeof e.logFormat&&(n=Pe.DateFormatEnum.fromString(e.logFormat),s("logFormat="+e.logFormat)),"boolean"==typeof e.showLoggerName&&(o=e.showLoggerName,s("showLoggerName="+e.showLoggerName)),"boolean"==typeof e.showTimestamp&&(i=e.showTimestamp,s("showTimestamp="+e.showTimestamp)),t.forEach((function(e){null!==r&&(e.level=r),null!==n&&(e.logFormat.dateFormat.formatEnum=n),null!==i&&(e.logFormat.showTimeStamp=i),null!==o&&(e.logFormat.showLoggerName=o)})),console.log("Applied changes: "+a+" to log groups '"+e.group+"'.")},e.prototype.reset=function(e){void 0===e&&(e="all");for(var t=0,r=this._getLogGroupRunTimeSettingsFor(e);t<r.length;t++){var n=r[t];n.level=n.logGroupRule.level,n.logFormat.showTimeStamp=n.logGroupRule.logFormat.showTimeStamp,n.logFormat.showLoggerName=n.logGroupRule.logFormat.showLoggerName,n.logFormat.dateFormat.formatEnum=n.logGroupRule.logFormat.dateFormat.formatEnum}console.log("Reset all settings for group "+e)},e.prototype._getLogGroupRunTimeSettingsFor=function(e){var t=[];return"all"===e?t=this._settings.getLogGroupRuntimeSettings():(this._checkIndex(e),t.push(this._settings.getLogGroupRuntimeSettings()[e])),t},e.prototype._checkIndex=function(e){if(e<0||e>=this._settings.getLogGroupRuntimeSettings().length)throw new Error("Invalid index, use listLogGroups to find out a valid one.")},e._help='\n  help(): void\n    ** Shows this help.\n\n  example(): void\n    ** Shows an example of usage.\n\n  showSettings(id: number | "all"): void\n    ** Prints settings for given group id, "all" for all group.\n\n  change(settings: LogGroupControlSettings): void\n    ** Changes the current settings for one or all log groups.\n    **\n       LogGroupControlSettings, properties of object:\n         group: number | "all"\n           ** Apply to specific group, or "all".\n           ** Required\n\n         logLevel: "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace" | undefined\n           ** Set log level, undefined will not change the setting.\n           ** Optional\n\n         logFormat: "Default" | "YearMonthDayTime" | "YearDayMonthWithFullTime" | "YearDayMonthTime" | undefined\n           ** Set the log format, undefined will not change the setting.\n           ** Optional\n\n         showTimestamp: boolean | undefined\n           ** Whether to show timestamp, undefined will not change the setting.\n           ** Optional\n\n         showLoggerName: boolean | undefined\n           ** Whether to show the logger name, undefined will not change the setting.\n           ** Optional\n\n  reset(id: number | "all"): void\n    ** Resets everything to original values, for one specific or for all groups.\n\n  help():\n    ** Shows this help.\n',e._example='\n  Examples:\n    change({group: "all", logLevel: "Info"})\n      ** Change loglevel to Info for all groups.\n\n    change({group: 1, recursive:false, logLevel: "Warn"})\n      ** Change logLevel for group 1 to Warn.\n\n    change({group: "all", logLevel: "Debug", logFormat: "YearDayMonthTime", showTimestamp:false, showLoggerName:false})\n      ** Change loglevel to Debug for all groups, apply format, do not show timestamp and logger names.\n',e}()}));Be(_t);_t.LoggerControlImpl;var wt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.help=function(){console.log(e._help)},e.prototype.example=function(){console.log(e._example)},e.prototype.showSettings=function(t){void 0===t&&(t="all");var r=new Ae.StringBuilder,n=e._getCategoryService();e._getCategories(t).forEach((function(t){e._processCategory(n,t,r,0)})),console.log(r.toString())},e.prototype.change=function(t){var r=e._getCategoryService(),n=e._getCategories(t.category),o=null,i=null,a=null,s=null,c=null,u=function(e){null!==c&&(c+=", "),null===c?c=e:c+=e};u("recursive="+t.recursive),"string"==typeof t.logLevel&&(o=Pe.LogLevel.fromString(t.logLevel),u("logLevel="+t.logLevel)),"string"==typeof t.logFormat&&(i=Pe.DateFormatEnum.fromString(t.logFormat),u("logFormat="+t.logFormat)),"boolean"==typeof t.showCategoryName&&(a=t.showCategoryName,u("showCategoryName="+t.showCategoryName)),"boolean"==typeof t.showTimestamp&&(s=t.showTimestamp,u("showTimestamp="+t.showTimestamp));var l=function(e){var t=r.getCategorySettings(e);null!==t&&(null!==o&&(t.logLevel=o),null!==i&&(t.logFormat.dateFormat.formatEnum=i),null!==s&&(t.logFormat.showTimeStamp=s),null!==a&&(t.logFormat.showCategoryName=a))};n.forEach((function(r){return e._applyToCategory(r,t.recursive,l)})),console.log("Applied changes: "+c+" to categories '"+t.category+"'.")},e.prototype.reset=function(t){void 0===t&&(t="all");var r=e._getCategoryService(),n=e._getCategories(t),o=function(e){var t=r.getCategorySettings(e),n=r.getOriginalCategorySettings(e);null!==t&&null!==n&&(t.logLevel=n.logLevel,t.logFormat.dateFormat.formatEnum=n.logFormat.dateFormat.formatEnum,t.logFormat.showTimeStamp=n.logFormat.showTimeStamp,t.logFormat.showCategoryName=n.logFormat.showCategoryName)};n.forEach((function(t){return e._applyToCategory(t,!0,o)})),console.log("Applied reset to category: "+t+".")},e._processCategory=function(t,r,n,o){var i=t.getCategorySettings(r);if(null!==i){if(n.append("  "+r.id+": "),o>0)for(var a=0;a<o;a++)n.append("  ");n.append(r.name+" ("+Pe.LogLevel[i.logLevel].toString()+"@"+Pe.LoggerType[i.loggerType].toString()+")\n"),r.children.length>0&&r.children.forEach((function(r){e._processCategory(t,r,n,o+1)}))}},e._applyToCategory=function(t,r,n){n(t),r&&t.children.forEach((function(t){e._applyToCategory(t,r,n)}))},e._getCategoryService=function(){return gt.CategoryServiceImpl.getInstance()},e._getCategories=function(t){var r=e._getCategoryService(),n=[];if("all"===t)n=r.getRootCategories();else{var o=r.getCategoryById(t);if(null===o)throw new Error("Failed to find category with id "+t);n.push(o)}return n},e._help='\n  help(): void\n    ** Shows this help.\n\n  example(): void\n    ** Shows an example on how to use this.\n\n  showSettings(id: number | "all" = "all"): void\n    ** Shows settings for a specific category, or for all. The id of categories can be found by calling this method without parameter.\n\n  change(settings: CategoryServiceControlSettings): void\n    ** Changes the current settings for one or all categories.\n    **\n       CategoryServiceControlSettings, properties of object:\n         category: number | "all"\n           ** Apply to specific category, or "all".\n           ** Required\n\n         recursive: boolean\n           ** Apply to child categories (true) or not.\n           ** Required\n\n         logLevel: "Fatal" | "Error" | "Warn" | "Info" | "Debug" | "Trace" | undefined\n           ** Set log level, undefined will not change the setting.\n           ** Optional\n\n         logFormat: "Default" | "YearMonthDayTime" | "YearDayMonthWithFullTime" | "YearDayMonthTime" | undefined\n           ** Set the log format, undefined will not change the setting.\n           ** Optional\n\n         showTimestamp: boolean | undefined\n           ** Whether to show timestamp, undefined will not change the setting.\n           ** Optional\n\n         showCategoryName: boolean | undefined\n           ** Whether to show the category name, undefined will not change the setting.\n           ** Optional\n\n   reset(id: number | "all"): void\n     ** Resets everything to original values, for one specific or for all categories.\n',e._example='\n  Examples:\n    change({category: "all", recursive:true, logLevel: "Info"})\n      ** Change loglevel to Info for all categories, apply to child categories as well.\n\n    change({category: 1, recursive:false, logLevel: "Warn"})\n      ** Change logLevel for category 1, do not recurse.\n\n    change({category: "all", recursive:true, logLevel: "Debug", logFormat: "YearDayMonthTime", showTimestamp:false, showCategoryName:false})\n      ** Change loglevel to Debug for all categories, apply format, do not show timestamp and category names - recursively to child categories.\n\n',e}();t.CategoryServiceControlImpl=r}));Be(wt);wt.CategoryServiceControlImpl;var bt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,r){if(void 0===r&&(r=null),this._children=[],this._logLevel=Pe.LogLevel.Error,-1!==t.indexOf("#"))throw new Error("Cannot use # in a name of a Category");this._id=e.nextId(),this._name=t,this._parent=r,null!==this._parent&&this._parent._children.push(this),gt.CategoryServiceImpl.getInstance().registerCategory(this)}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logLevel",{get:function(){return this._logLevel},enumerable:!0,configurable:!0}),e.prototype.trace=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.loadCategoryLogger(),(t=this._logger).trace.apply(t,[e].concat(r))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.loadCategoryLogger(),(t=this._logger).debug.apply(t,[e].concat(r))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.loadCategoryLogger(),(t=this._logger).info.apply(t,[e].concat(r))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.loadCategoryLogger(),(t=this._logger).warn.apply(t,[e].concat(r))},e.prototype.error=function(e,t){for(var r,n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];this.loadCategoryLogger(),(r=this._logger).error.apply(r,[e,t].concat(n))},e.prototype.fatal=function(e,t){for(var r,n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];this.loadCategoryLogger(),(r=this._logger).fatal.apply(r,[e,t].concat(n))},e.prototype.resolved=function(e,t){for(var r,n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];this.loadCategoryLogger(),(r=this._logger).resolved.apply(r,[e,t].concat(n))},e.prototype.log=function(e,t,r){for(var n,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];this.loadCategoryLogger(),(n=this._logger).log.apply(n,[e,t,r].concat(o))},e.prototype.getCategoryPath=function(){for(var e=this.name,t=this.parent;null!=t;)e=t.name+"#"+e,t=t.parent;return e},Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),e.prototype.loadCategoryLogger=function(){if(this._logger||(this._logger=gt.CategoryServiceImpl.getInstance().getLogger(this)),void 0===this._logger||null===this._logger)throw new Error("Failed to load a logger for category (should not happen): "+this.name)},e.nextId=function(){return e.currentId++},e.currentId=1,e}();t.Category=r}));Be(bt);bt.Category;var St=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.getLogger=function(e){return gt.CategoryServiceImpl.getInstance().getLogger(e)},e.clear=function(){return gt.CategoryServiceImpl.getInstance().clear()},e.setDefaultConfiguration=function(e,t){void 0===t&&(t=!0),gt.CategoryServiceImpl.getInstance().setDefaultConfiguration(e,t)},e.setConfigurationCategory=function(e,t,r){void 0===r&&(r=!1),gt.CategoryServiceImpl.getInstance().setConfigurationCategory(e,t,r)},e}();t.CategoryServiceFactory=r}));Be(St);St.CategoryServiceFactory;var Ct=ke((function(e,t){var r=Ee&&Ee.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._value=e}return e.prototype.getValue=function(){return this._value},e.prototype.toString=function(){var e=this.getValue();return null!=e?e.toString():"null"},e}(),o=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t}(n),i=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t}(n),a=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t.prototype.toString=function(){var e=this.getValue();return null!=e?JSON.stringify(e.toString()):"null"},t}(n),s=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t}(n),c=function(e){function t(t){return e.call(this,t)||this}return r(t,e),t.prototype.toString=function(){var e=this.getValue();return null!=e?e.toString():"null"},t}(n),u=function(e){function t(){return e.call(this,null)||this}return r(t,e),t.prototype.toString=function(){return"null"},t}(n),l=function(){function e(){}return e.toJSONType=function(e){if(null===e)return new u;if("string"==typeof e)return new a(e);if("number"==typeof e)return new i(e);if("boolean"==typeof e)return new o(e);if(e instanceof h)return new s(e);throw new Error("Type not supported for value: "+e)},e}(),h=function(){function e(){this.values=new Ae.SimpleMap}return e.prototype.addBoolean=function(t,r){return this.checkName(t),e.checkValue(r),this.values.put(t,new o(r)),this},e.prototype.addNumber=function(t,r){return this.checkName(t),e.checkValue(r),this.values.put(t,new i(r)),this},e.prototype.addString=function(t,r){return this.checkName(t),e.checkValue(r),this.values.put(t,new a(r)),this},e.prototype.addNull=function(e){return this.checkName(e),this.values.put(e,new u),this},e.prototype.addArray=function(t,r){if(this.checkName(t),e.checkValue(r),null==r)throw new Error("Cannot add array as null");return this.values.put(t,new c(r)),this},e.prototype.addObject=function(t,r){if(this.checkName(t),e.checkValue(r),null==r)throw new Error("Cannot add object as null");return this.values.put(t,new s(r)),this},e.prototype.toString=function(e){var t=this;void 0===e&&(e=!1);var r=!1,n=new Ae.StringBuilder;return n.append("{"),this.values.keys().forEach((function(e){var o=t.values.get(e);null!=o&&(r&&n.append(","),n.append('"').append(e).append('":').append(o.toString()),r=!0)})),n.append("}"),n.toString()},e.prototype.checkName=function(e){if(null==e||void 0===e)throw new Error("Name is null or undefined");if(this.values.exists(e))throw new Error("Name "+e+" is already present for this object")},e.checkValue=function(e){if(void 0===e)throw new Error("Value is undefined")},e}();t.JSONObject=h;var f=function(){function e(){this.objects=[]}return e.prototype.add=function(e){if(void 0===e)throw new Error("Object is not allowed to be undefined");return this.objects.push(l.toJSONType(e)),this},e.prototype.toString=function(e){void 0===e&&(e=!1);var t=new Ae.StringBuilder;return t.append("["),this.objects.forEach((function(e,r){r>0&&t.append(","),t.append(e.toString())})),t.append("]"),t.toString()},e}();t.JSONArray=f;var p=function(){function e(){}return e.categoryToJSON=function(t,r){var n=new f;e._categoryToJSON(t,n,r);var o=new h;return o.addArray("categories",n),o},e._categoryToJSON=function(t,r,n){var o=new h;o.addNumber("id",t.id),o.addString("name",t.name),o.addString("logLevel",Pe.LogLevel[t.logLevel].toString()),null!=t.parent?o.addNumber("parent",t.parent.id):o.addNull("parent"),r.add(o),n&&t.children.forEach((function(t){e._categoryToJSON(t,r,n)}))},e}();t.JSONHelper=p}));Be(Ct);Ct.JSONObject,Ct.JSONArray,Ct.JSONHelper;var Lt=ke((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionHelper=dt.ExtensionHelper,t.AbstractCategoryLogger=st.AbstractCategoryLogger,t.CategoryConsoleLoggerImpl=ct.CategoryConsoleLoggerImpl,t.CategoryDelegateLoggerImpl=ut.CategoryDelegateLoggerImpl,t.Category=bt.Category,t.CategoryRuntimeSettings=ft.CategoryRuntimeSettings,t.CategoryConfiguration=pt.CategoryConfiguration,t.CategoryMessageBufferLoggerImpl=ht.CategoryMessageBufferLoggerImpl,t.CategoryServiceFactory=St.CategoryServiceFactory,t.LoggerFactoryOptions=yt.LoggerFactoryOptions,t.LogGroupRule=vt.LogGroupRule,t.LFService=mt.LFService,t.AbstractLogger=rt.AbstractLogger,t.ConsoleLoggerImpl=nt.ConsoleLoggerImpl,t.MessageBufferLoggerImpl=ot.MessageBufferLoggerImpl,t.CategoryLogFormat=Pe.CategoryLogFormat,t.DateFormat=Pe.DateFormat,t.DateFormatEnum=Pe.DateFormatEnum,t.LogFormat=Pe.LogFormat,t.LoggerType=Pe.LoggerType,t.LogLevel=Pe.LogLevel,t.SimpleMap=Ae.SimpleMap,t.LinkedList=Ae.LinkedList,function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(Ct),t.MessageFormatUtils=tt.MessageFormatUtils,t.help=function(){console.log("help()\n   ** Shows this help\n\n getLogControl(): LoggerControl\n   ** Returns LoggerControl Object, use to dynamically change loglevels for log4j logging.\n   ** Call .help() on LoggerControl object for available options.\n\n getCategoryControl(): CategoryServiceControl\n   ** Returns CategoryServiceControl Object, use to dynamically change loglevels for category logging.\n   ** Call .help() on CategoryServiceControl object for available options.\n")},t.getLogControl=function(){return new _t.LoggerControlImpl},t.getCategoryControl=function(){return new wt.CategoryServiceControlImpl}}));Be(Lt);Lt.ExtensionHelper,Lt.AbstractCategoryLogger,Lt.CategoryConsoleLoggerImpl,Lt.CategoryDelegateLoggerImpl;var Rt=Lt.Category,Et=(Lt.CategoryRuntimeSettings,Lt.CategoryConfiguration),Bt=(Lt.CategoryMessageBufferLoggerImpl,Lt.CategoryServiceFactory),kt=(Lt.LoggerFactoryOptions,Lt.LogGroupRule,Lt.LFService,Lt.AbstractLogger,Lt.ConsoleLoggerImpl,Lt.MessageBufferLoggerImpl,Lt.CategoryLogFormat,Lt.DateFormat,Lt.DateFormatEnum,Lt.LogFormat,Lt.LoggerType,Lt.LogLevel);Lt.SimpleMap,Lt.LinkedList,Lt.MessageFormatUtils,Lt.help,Lt.getLogControl,Lt.getCategoryControl;Bt.setDefaultConfiguration(new Et(kt.Info));var Pt,At=new Rt("iotile.device"),It=new Rt("IOTileAdapter",At),Ot=new Rt("BLEOptimizer",At),xt=new Rt("MockBLE",At);(Pt=e.RPCError||(e.RPCError={}))[Pt.OK=0]="OK",Pt[Pt.UnexpectedRPCTimeout=1]="UnexpectedRPCTimeout",Pt[Pt.ErrorWritingRPC=2]="ErrorWritingRPC",Pt[Pt.IncorrectReceivedLength=3]="IncorrectReceivedLength",Pt[Pt.ResponseReceivedAtInvalidTime=4]="ResponseReceivedAtInvalidTime",Pt[Pt.BluetoothErrorWritingRPC=5]="BluetoothErrorWritingRPC",Pt[Pt.StoppedFromPreviousErrors=6]="StoppedFromPreviousErrors";var Tt,Dt=function(){function t(){this.removeReceiveHeaderHandler=null,this.removeReceivePayloadHandler=null,this.channel=null,this.rpcQueue=[],this.processing=!1,this.currentRPC=void 0,this.stoppedFromErrors=!1,this.lastError=null}return t.prototype.open=function(t){return i(this,void 0,void 0,(function(){var r,n,o;return a(this,(function(i){switch(i.label){case 0:return this.channel=t,this.rpcQueue=[],this.processing=!1,this.stoppedFromErrors=!1,this.lastError=e.RPCError.OK,r=this,n=this,[4,this.channel.subscribe(ye.ReceiveHeader,(function(e){r.receiveHeader(e)}))];case 1:return n.removeReceiveHeaderHandler=i.sent(),o=this,[4,this.channel.subscribe(ye.ReceivePayload,(function(e){r.receivePayload(e)}))];case 2:return o.removeReceivePayloadHandler=i.sent(),[2]}}))}))},t.prototype.rpc=function(t,r,n,o){return i(this,void 0,void 0,(function(){var i,s;return a(this,(function(a){if(i={rpcID:r,address:t,payload:n,timeoutHandler:null,timeout:o||1,internalTimeout:15,success:function(e){},failure:function(e){},headerReceived:!1,expectedPayloadLength:0},this.stoppedFromErrors)throw new X(t,r,e.RPCError.StoppedFromPreviousErrors);return s=new Promise((function(e,t){i.success=e,i.failure=t})),this.rpcQueue.push(i),this.processing||this.processOne(),[2,s]}))}))},t.prototype.close=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return null===this.removeReceiveHeaderHandler?[3,2]:[4,this.removeReceiveHeaderHandler()];case 1:e.sent(),this.removeReceiveHeaderHandler=null,e.label=2;case 2:return null===this.removeReceivePayloadHandler?[3,4]:[4,this.removeReceivePayloadHandler()];case 3:e.sent(),this.removeReceivePayloadHandler=null,e.label=4;case 4:return[2]}}))}))},t.prototype.receiveHeader=function(t){if(!this.stoppedFromErrors)if(null!==this.currentRPC&&void 0!==this.currentRPC)if(t.byteLength<4)this.fatalRPCError(e.RPCError.IncorrectReceivedLength);else{var r=D("BBBB",t.slice(0,4)),n=r[0],o=63&n,i=!!(64&n),a=!!(128&n),s=r[3];this.currentRPC.headerReceived=!0,this.currentRPC.expectedPayloadLength=s;var c=!1;i&&0==o?a||(this.currentRPC.success(new ArrayBuffer(0)),c=!0):(this.currentRPC.failure(new X(this.currentRPC.address,this.currentRPC.rpcID,n)),c=!0),c&&this.finishRPC()}else this.fatalRPCError(e.RPCError.ResponseReceivedAtInvalidTime)},t.prototype.finishRPC=function(){this.currentRPC&&null!==this.currentRPC.timeoutHandler&&(clearTimeout(this.currentRPC.timeoutHandler),this.currentRPC.timeoutHandler=null),this.currentRPC=void 0,this.processing=!1;var e=this;setTimeout((function(){e.processOne()}),0)},t.prototype.receivePayload=function(t){if(!this.stoppedFromErrors)if(void 0!==this.currentRPC&&this.currentRPC.headerReceived)if(t.byteLength<this.currentRPC.expectedPayloadLength)this.fatalRPCError(e.RPCError.IncorrectReceivedLength);else{var r=t.slice(0,this.currentRPC.expectedPayloadLength);this.currentRPC.success(r),this.finishRPC()}else this.fatalRPCError(e.RPCError.ResponseReceivedAtInvalidTime)},t.prototype.fatalRPCError=function(t){for(this.stoppedFromErrors=!0,this.lastError=t,this.processing=!1,void 0!==this.currentRPC&&(this.currentRPC.failure(new X(this.currentRPC.address,this.currentRPC.rpcID,t)),null!==this.currentRPC.timeoutHandler&&clearTimeout(this.currentRPC.timeoutHandler),this.currentRPC=void 0);this.rpcQueue.length>0;){var r=this.rpcQueue.shift();r&&r.failure(new X(r.address,r.rpcID,e.RPCError.StoppedFromPreviousErrors))}this.channel&&this.channel.notify(e.AdapterEvent.UnrecoverableRPCError,new X(0,0,t))},t.prototype.processOne=function(){return i(this,void 0,void 0,(function(){var t,r,n,o,i,s;return a(this,(function(a){switch(a.label){case 0:if(this.stoppedFromErrors)return[2];if(!0===this.processing)return[2];if(0===this.rpcQueue.length)return[2];if(this.processing=!0,this.currentRPC=this.rpcQueue.shift(),!this.currentRPC||!this.channel)return[3,6];t=T("BBHB",this.currentRPC.payload.byteLength,0,this.currentRPC.rpcID,this.currentRPC.address),r=this,this.currentRPC.timeoutHandler=setTimeout((function(){r.fatalRPCError(e.RPCError.UnexpectedRPCTimeout)}),1e3*this.currentRPC.internalTimeout),a.label=1;case 1:return a.trys.push([1,5,,6]),n=this.currentRPC,o=Date.now(),this.currentRPC.payload.byteLength>0?[4,this.channel.write(ye.SendPayload,this.currentRPC.payload)]:[3,3];case 2:a.sent(),a.label=3;case 3:return[4,this.channel.write(ye.SendHeader,t)];case 4:return a.sent(),i=Date.now(),(s=(i-o)/1e3)>n.timeout&&At.error("Timeout in RPC "+n.rpcID+" on tile "+n.address+". Expected to take "+n.timeout+" s; took "+s+" s",Error),[3,6];case 5:return a.sent(),this.fatalRPCError(e.RPCError.BluetoothErrorWritingRPC),[3,6];case 6:return[2]}}))}))},t}(),Ft=function(){function t(){}return t.prototype.open=function(e,t){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.channel=t,this.device=e,[2]}))}))},t.prototype.send=function(t,r){return i(this,void 0,void 0,(function(){var n,o,i,s,c;return a(this,(function(a){switch(a.label){case 0:return this.channel&&this.device?(r.setTotal(Math.ceil(t.byteLength/20)+1),r.startOne("Preparing for firmware update",1),[4,(n=this.device.remoteBridge()).queryStatus()]):[3,13];case 1:return(o=a.sent()).state!=e.RemoteBridgeState.ReceivedCompleteScript?[3,4]:[4,k(2e3)];case 2:return a.sent(),[4,n.queryStatus()];case 3:a.sent(),a.label=4;case 4:if(o.state==e.RemoteBridgeState.ValidatedScript||o.state==e.RemoteBridgeState.ExecutingScript)throw new ue("Script sent while remote bridge was processing another script");return o.state!=e.RemoteBridgeState.ReceivedCompleteScript?[3,6]:(r.updateDescription("Clearing previous script"),[4,n.resetScript()]);case 5:a.sent(),a.label=6;case 6:return[4,n.beginScript()];case 7:a.sent(),r.finishOne(),i=new Mt(t.byteLength),s=0,a.label=8;case 8:return s<t.byteLength?(c=t.slice(s,s+20),i.update(s),r.startOne(i.estimateRemaining()+" remaining",1),[4,this.channel.write(ye.HighspeedData,c)]):[3,11];case 9:a.sent(),r.finishOne(),a.label=10;case 10:return s+=20,[3,8];case 11:return[4,n.endScript()];case 12:a.sent(),a.label=13;case 13:return[2]}}))}))},t.prototype.close=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){return[2]}))}))},t}(),Mt=function(){function e(e){this.totalSize=e,this.start=(new Date).getTime(),this.updateCount=0,this.finished=0,this.invSpeed=0}return e.prototype.update=function(e){if(0!==e){var t=(new Date).getTime();this.invSpeed=(t-this.start)/e,this.updateCount+=1,this.finished=e}},e.prototype.estimateRemaining=function(){if(this.updateCount<e.SETTLING_UPDATES)return"Estimating time";var t=this.invSpeed*(this.totalSize-this.finished)/1e3,r=Math.floor(t/60),n=t-60*r;return r.toFixed(0)+" min "+n.toFixed(0)+" sec"},e.SETTLING_UPDATES=100,e}(),Ht=function(){function e(e,t){void 0===t&&(t=!1),this.ringBuffer=new ArrayBuffer(e),this._offset=0,this._count=0,this._initialSize=e,this._autoexpand=t}return Object.defineProperty(e.prototype,"offset",{get:function(){return this._offset},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!0,configurable:!0}),e.prototype.push=function(e){var t=e.byteLength;if(t+this._count>this.ringBuffer.byteLength){if(!this._autoexpand)throw new y("Ring buffer would overflow");for(var r=this.ringBuffer,n=r.byteLength-this._offset,o=this._count-n,i=2*r.byteLength;i<t+this._count;)i*=2;this.ringBuffer=new ArrayBuffer(i),0==this._count||(this._count<=n?F(this.ringBuffer,r,this._offset,0,this._count):(F(this.ringBuffer,r,this._offset,0,n),F(this.ringBuffer,r,0,n,o))),this._offset=0}if(this.endPointer+t>=this.ringBuffer.byteLength){o=t-(n=this.ringBuffer.byteLength-this.endPointer);n>0&&F(this.ringBuffer,e,0,this.endPointer,n),F(this.ringBuffer,e,n,0,o)}else F(this.ringBuffer,e,0,this.endPointer,t);this._count+=t},Object.defineProperty(e.prototype,"endPointer",{get:function(){return(this._offset+this._count)%this.ringBuffer.byteLength},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this._offset=0,this._count=0,this.ringBuffer.byteLength!=this._initialSize&&(this.ringBuffer=new ArrayBuffer(this._initialSize))},e.prototype.peek=function(e){if(this._count<e)throw new te("ring buffer did not have enough data for peek");var t=this._count,r=this._offset,n=this.pop(e);return this._count=t,this._offset=r,n},e.prototype.peekAs=function(e){var t=x(e);return D(e,this.peek(t))},e.prototype.pop=function(e){if(this._count<e)throw new te("ring buffer did not have enough data for pop");var t=new ArrayBuffer(e);if(this._offset+e>this.ringBuffer.byteLength){var r=this.ringBuffer.byteLength-this._offset,n=e-r;F(t,this.ringBuffer,this._offset,0,r),F(t,this.ringBuffer,0,r,n)}else F(t,this.ringBuffer,this._offset,0,e);return this._count-=e,this._offset=(this._offset+e)%this.ringBuffer.byteLength,t},e.prototype.popAs=function(e){var t=x(e);return D(e,this.pop(t))},e}();(Tt=e.ReceiveStatus||(e.ReceiveStatus={}))[Tt.Idle=0]="Idle",Tt[Tt.InProgress=1]="InProgress";var Nt,jt=function(e,t,r){this.name=e,this.finishedPercentage=t,this.reportIndex=r},zt=function(e){function t(t,r){var n=e.call(this,"ReportStartedEvent",0,r)||this;return n.totalSize=t,n}return r(t,e),t}(jt),Ut=function(e){function t(t,r){return e.call(this,"ReportStalledEvent",t,r)||this}return r(t,e),t}(jt),Wt=function(e){function t(t,r){return e.call(this,"ReportProgressEvent",t,r)||this}return r(t,e),t}(jt),Gt=function(e){function t(t){return e.call(this,"ReportFinishedEvent",100,t)||this}return r(t,e),t}(jt),Vt=function(){function t(t,r){void 0===r&&(r=!1),this.ringBuffer=new Ht(t,r),this.broken=!1,this._receiveState=e.ReceiveStatus.Idle,this._inProgressReceived=0,this._inProgressTotal=0,this._lastProgressReport=0,this._lastEvent=null,this._lastUpdateTime=null,this._reportsReceived=0,this._receivedTime=null,this._lastUpdateTime=null,this._progressReportInterval=5}return Object.defineProperty(t.prototype,"state",{get:function(){return this._receiveState},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inProgressReceived",{get:function(){return this._inProgressReceived},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inProgressTotal",{get:function(){return this._inProgressTotal},enumerable:!0,configurable:!0}),t.prototype.stop=function(){this.broken=!0,this._receiveState==e.ReceiveStatus.InProgress&&this.updateStatus(!1,0,0)},t.prototype.pushData=function(e){if(this.broken)throw new Z("attempting to push data to a stopped report parser");return this.ringBuffer.push(e),this.tryParseReports()},t.prototype.reset=function(){this.ringBuffer.reset(),this.broken=!1,this._receiveState=e.ReceiveStatus.Idle,this._inProgressReceived=0,this._inProgressTotal=0,this._lastProgressReport=0,this._lastEvent=null,this._lastUpdateTime=null,this._reportsReceived=0},t.prototype.popLastEvent=function(){var e=this._lastEvent;return this._receivedTime&&this._lastUpdateTime&&this._lastEvent&&this._lastUpdateTime.getSeconds()+1<(new Date).getSeconds()?this._lastEvent=new Ut(this._lastEvent.finishedPercentage,this._lastEvent.reportIndex):this._lastEvent=null,e},t.prototype.tryParseReports=function(){if(this.broken)throw new Z("attempting to parse reports with a stopped parser");var e=[];try{for(;;){var t=this.tryParseReport();e.push(t)}}catch(e){if("RingBufferEmptyError"!=e.name)throw this.broken=!0,new ee(e.message)}return e},t.prototype.tryParseReport=function(){var e=this.ringBuffer.peekAs("B")[0];switch(e){case 0:return this.tryParseIndividualReport();case 1:return this.tryParseListReport();default:throw new ee("Unknown report format received: "+e)}},t.prototype.tryParseIndividualReport=function(){var e=this.ringBuffer.popAs("BBHLLLL"),t=(e[0],e[2]),r=e[3],n=e[4],o=e[5],i=e[6],a=new Date,s=new Date(a.valueOf()-1e3*n),c=new he(t,i,o,s);return new pe(r,n,c)},t.prototype.tryParseListReport=function(){var e=this.ringBuffer.peekAs("BBHLLLBBH"),t=(e[0],e[1]|e[2]<<8),r=e[3],n=(e[4],e[5]),o=(e[6],e[7]);e[8];t>this.ringBuffer.count&&this.updateStatus(!0,t,this.ringBuffer.count),null==this._receivedTime&&(this._receivedTime=new Date);var i=this.ringBuffer.pop(t),a=new Date(this._receivedTime.valueOf()-1e3*n);this.updateStatus(!1,0,0);for(var s=i.slice(20,t-24),c=[],u=0;u<s.byteLength;u+=16){var l=D("HHLLL",s.slice(u,u+16)),h=l[0],f=l[2],p=l[3],g=l[4],d=new he(h,g,p,a,f);c.push(d)}var v=new ve(r,o,c,i,this._receivedTime);return this._reportsReceived+=1,this._receivedTime=null,v},t.prototype.updateStatus=function(t,r,n){if(t&&this._receiveState!=e.ReceiveStatus.InProgress&&n<r)this._lastEvent=new zt(r,this._reportsReceived);else if(t||this._receiveState!=e.ReceiveStatus.InProgress)if(t&&this._inProgressReceived!=n){var o=this._lastProgressReport/this._inProgressTotal*100,i=n/this._inProgressTotal*100,a=Math.floor(o/this._progressReportInterval),s=Math.floor(i/this._progressReportInterval);s!=a&&(this._lastEvent=new Wt(s*this._progressReportInterval,this._reportsReceived),this._lastProgressReport=n)}else t&&(this._receiveState,e.ReceiveStatus.InProgress);else this._lastEvent=new Gt(this._reportsReceived);this._lastUpdateTime=new Date,t?(this._receiveState=e.ReceiveStatus.InProgress,this._inProgressTotal=r,this._inProgressReceived=n):(this._receiveState=e.ReceiveStatus.Idle,this._inProgressTotal=0,this._inProgressReceived=0,this._lastProgressReport=0)},t}(),$t=function(){function t(e,t){void 0===t&&(t=!1),this.removeStreamingHandler=null,this.reportParser=new Vt(e,t)}return t.prototype.open=function(e){return i(this,void 0,void 0,(function(){var t,r;return a(this,(function(n){switch(n.label){case 0:return this.channel=e,this.reportParser.reset(),t=this,r=this,[4,this.channel.subscribe(ye.Streaming,(function(e){t.receiveStreamingData(e)}))];case 1:return r.removeStreamingHandler=n.sent(),[2]}}))}))},t.prototype.close=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return null===this.removeStreamingHandler?[3,2]:[4,this.removeStreamingHandler()];case 1:e.sent(),this.removeStreamingHandler=null,this.reportParser.reset(),e.label=2;case 2:return[2]}}))}))},t.prototype.stop=function(){this.reportParser.stop()},t.prototype.receiveStreamingData=function(t){if(this.channel)try{var r=this.reportParser.pushData(t),n=this.reportParser.popLastEvent();if(null!==n)switch(n.name){case"ReportStartedEvent":this.channel.notify(e.AdapterEvent.RobustReportStarted,n);break;case"ReportStalledEvent":this.channel.notify(e.AdapterEvent.RobustReportStalled,n);break;case"ReportProgressEvent":this.channel.notify(e.AdapterEvent.RobustReportProgress,n);break;case"ReportFinishedEvent":this.channel.notify(e.AdapterEvent.RobustReportFinished,n)}for(var o=0;o<r.length;++o){var i=r[o];"IndividualReport"===i.constructor.name?this.channel.notify(e.AdapterEvent.RawRealtimeReading,i):"SignedListReport"===i.constructor.name?this.channel.notify(e.AdapterEvent.RawRobustReport,i):console.warn("Unknown report type received from ReportParser, ignoring it.  Type: "+i.constructor.name)}}catch(t){"ReportParsingError"===t.name||"InsufficientSpaceError"===t.name?this.channel.notify(e.AdapterEvent.UnrecoverableStreamingError,t):t.name}},t}(),Kt=function(){function t(){this.removeTracingHandler=null,this.receivedData=new Ht(128,!0),this.resolveWaiter=null,this.rejectWaiter=null,this.waiterTimer=null,this.waitLength=0,this.waiterTimeout=1e3,this.channel=void 0}return t.prototype.open=function(e){return i(this,void 0,void 0,(function(){var t,r=this;return a(this,(function(n){switch(n.label){case 0:return this.channel=e,this.clearWaiter(),this.clearData(),t=this,[4,this.channel.subscribe(ye.Tracing,(function(e){r.receiveTracingData(e)}))];case 1:return t.removeTracingHandler=n.sent(),[2]}}))}))},t.prototype.close=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return null===this.removeTracingHandler?[3,2]:[4,this.removeTracingHandler()];case 1:e.sent(),this.removeTracingHandler=null,e.label=2;case 2:return null!=this.rejectWaiter&&this.rejectWaiter(new ne("Tracing interface was closed.")),this.clearWaiter(),this.clearData(),[2]}}))}))},t.prototype.receiveTracingData=function(e){this.receivedData.push(e),null!=this.resolveWaiter&&this.waitLength&&this.receivedData.count>=this.waitLength?(this.resolveWaiter(this.receivedData.pop(this.waitLength)),this.clearWaiter()):null!=this.resolveWaiter&&this.startWatchdogTimer()},t.prototype.startWatchdogTimer=function(){var e=this;null!=this.rejectWaiter&&(null!=this.waiterTimer&&clearTimeout(this.waiterTimer),this.waiterTimer=window.setTimeout((function(){null!=e.rejectWaiter&&(e.rejectWaiter(new Q("Timeout waiting for tracing data.")),e.clearWaiter())}),this.waiterTimeout))},t.prototype.clearWaiter=function(){this.rejectWaiter=null,this.resolveWaiter=null,null!=this.waiterTimer&&clearTimeout(this.waiterTimer),this.waiterTimer=null,this.waitLength=null},t.prototype.waitForData=function(t,r){var n=this;if(void 0===r&&(r=1e3),null!=this.resolveWaiter)throw new ce("You can only have one waiter waiting for tracing data at a time.",e.AdapterState.Connected,"Internal Tracing Error.");return new Promise((function(e,o){t<=n.receivedData.count?e(n.receivedData.pop(t)):(n.waitLength=t,n.resolveWaiter=e,n.rejectWaiter=o,n.waiterTimeout=r,n.startWatchdogTimer())}))},t.prototype.clearData=function(){this.receivedData.reset()},t}(),qt=((Nt={})[e.Platform.IOS]={steps:[{preupdateWait:180,update:{minInterval:15,maxInterval:15,timeout:1e3}}]},Nt[e.Platform.Android]={steps:[{preupdateWait:300,update:{minInterval:7.5,maxInterval:10,timeout:1e3}},{preupdateWait:0,update:{minInterval:7.5,maxInterval:15,timeout:1e3}},{preupdateWait:0,update:{minInterval:7.5,maxInterval:30,timeout:1e3}}]},Nt),Yt=function(){function e(e){this.platform=e,this.attempt=0}return e.prototype.optimizeConnection=function(e,t,r){return void 0===r&&(r=4),i(this,void 0,void 0,(function(){var t,r,n,o,i,s,c;return a(this,(function(a){switch(a.label){case 0:if(this.attempt=0,!(this.platform in qt))return Ot.warn("Unknown platform '"+this.platform+"' in optimizeConnection, not optimizing"),[2,null];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e.queryBLEConnectionInfo()];case 2:return t=a.sent(),[3,4];case 3:return a.sent(),Ot.info("Not optimizing BLE connection on old device that does not support the required RPCs."),[2,null];case 4:if((r=qt[this.platform]).steps.length>0&&t.intervalMS<=r.steps[0].update.maxInterval)return Ot.info("No optimization required, default interval: "+t.intervalMS+" ms"),[2,null];Ot.info("Running "+this.platform+" strategy, starting interval: "+t.intervalMS+" ms"),a.label=5;case 5:a.trys.push([5,18,,19]),n=0,o=r.steps,a.label=6;case 6:return n<o.length?(i=o[n]).preupdateWait>0?[4,k(i.preupdateWait)]:[3,8]:[3,17];case 7:a.sent(),a.label=8;case 8:return Ot.debug("Attempting to set interval ["+i.update.minInterval+", "+i.update.maxInterval+"], attempt: "+this.attempt),[4,e.updateBLEParams(i.update.minInterval,i.update.maxInterval,i.update.timeout)];case 9:return s=a.sent(),this.attempt+=1,[4,k(300)];case 10:return a.sent(),s&&17==s.errorCode?(Ot.error("BLE stack busy, trying step again. Interval ["+i.update.minInterval+", "+i.update.maxInterval+"], attempt: "+this.attempt,Error),[4,k(300)]):[3,13];case 11:return a.sent(),[4,e.updateBLEParams(i.update.minInterval,i.update.maxInterval,i.update.timeout)];case 12:return a.sent(),this.attempt+=1,[3,14];case 13:if(s)return Ot.error("Unexpected error optimizing BLE connection",s),[2,null];a.label=14;case 14:return[4,e.queryBLEConnectionInfo()];case 15:if((t=a.sent()).intervalMS<=i.update.maxInterval)return Ot.info("Successfully optimized BLE connection interval to "+t.intervalMS+" ms"),[2,null];a.label=16;case 16:return n++,[3,6];case 17:return[3,19];case 18:return c=a.sent(),Ot.error("Unexpected error optimizing BLE connection "+c,Error),[2,null];case 19:return Ot.warn("Unable to achieve target BLE interval range, final interval: "+t.intervalMS+" ms"),[2,null]}}))}))},e}(),Xt=function(){},Jt=function(e){this.message=e},Zt=function(e){function t(t,r){var n=e.call(this,"Cannot find RPC (address: "+t+" and id: "+r+")")||this;return n.address=t,n.rpcID=r,n}return r(t,e),t}(Jt),Qt=function(e){function t(t,r,n,o){var i=e.call(this,"Attempted to call RPC (address: "+t+", id: "+r+") with incompatible arguments, expected "+n)||this;return i.address=t,i.rpcID=r,i.expectedFormat=n,i.args=o,i}return r(t,e),t}(Jt),er=function(e){function t(t,r,n,o){var i=e.call(this,"RPC implementation (address: "+t+", id: "+r+") returned an incompatible response, expected "+n)||this;return i.address=t,i.rpcID=r,i.expectedFormat=n,i.response=o,i}return r(t,e),t}(Jt),tr=function(){function e(e,t){this.rssi=-50,this.device=e,this.subscriptions={},this.rpcs={},this.connected=t,this.advertising=this.buildAdvertising(e.iotileID,3.8),this.id=e.iotileID,this.payload=new ArrayBuffer(0)}return e.prototype.buildAdvertising=function(e,t){var r=new Uint8Array(62);return r[0]=2,r[1]=1,r[2]=6,r[3]=17,r[4]=6,r[5]=99,r[6]=15,r[7]=246,r[8]=15,r[9]=44,r[10]=19,r[11]=17,r[12]=230,r[13]=186,r[14]=83,r[15]=247,r[16]=63,r[17]=0,r[18]=32,r[19]=0,r[20]=0,r[21]=9,r[22]=255,r[23]=192,r[24]=3,r[25]=255&e,r[26]=e>>8&255,r[27]=e>>16&255,r[28]=e>>24&255,r[29]=0,r[30]=0,this.connected&&(r[29]|=4),r[31]=30,r[32]=255,r[33]=192,r[34]=3,r[35]=Math.floor(256*(t-Math.floor(t))),r[36]=Math.floor(t),r.buffer},e.prototype.unsubscribe=function(e,t,r,n){e in this.subscriptions||n("Unknown service ID: "+e),t in this.subscriptions[e]||n("Unknown characteristic ID: "+t),"2005"===t&&this.device.controller&&this.device.controller.disableStreaming(),delete this.subscriptions[e][t],r()},e.prototype.subscribe=function(e,t,r,n){e in this.subscriptions||(this.subscriptions[e]={}),t in this.subscriptions[e]||(this.subscriptions[e][t]=[]),this.subscriptions[e][t].push({success:r,failure:n}),"2005"===t&&this.device.controller&&this.device.controller.enableStreaming(r)},e.prototype.disconnect=function(e){this.device.controller&&this.device.controller.disableStreaming(),this.subscriptions={},setTimeout(e,0)},e.prototype.notify=function(e,t){if("00002000-3FF7-53BA-E611-132C0FF60F63"in this.subscriptions){var r=this.subscriptions["00002000-3FF7-53BA-E611-132C0FF60F63"];t in r&&setTimeout((function(){for(var n=0;n<r[t].length;++n)r[t][n].success(e)}),0)}},e.prototype.write=function(e,t,r,n,o){"00002000-3FF7-53BA-E611-132C0FF60F63"===e?(n(),"2004"===t?this.payload=r:"2003"===t&&this.rpc(r,this.payload)):o("Unknown service in ble write"+e)},e.prototype.rpc=function(e,t){return i(this,void 0,void 0,(function(){var r,n,o,i,s,c,u;return a(this,(function(a){switch(a.label){case 0:r=new DataView(e),n={address:r.getUint8(4),length:r.getUint8(0),sender:r.getUint8(1),command:r.getUint16(2,!0)},t.slice(0,n.length),o=255,i=new ArrayBuffer(0),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.device.rpc(n.address,n.command,t)];case 2:return i=a.sent(),o=64,i.byteLength>0&&(o|=128),[3,4];case 3:if(!((s=a.sent())instanceof Zt))throw s;return o=1,[3,4];case 4:return c=new ArrayBuffer(4),(u=new DataView(c)).setUint8(0,o),u.setUint8(3,i.byteLength),this.notify(c,"2001"),i.byteLength>0&&this.notify(i,"2002"),[2]}}))}))},e}();function rr(e,t,r){return function(n,o,i){n[o].rpcData={argFormat:t,respFormat:r,rpcID:e}}}var nr=function(){function e(e){this.rpcTable={},this.address=e,this.findRPCHandlers(this)}return e.prototype.addRPC=function(e,t,r,n,o,i){var a={argFormat:r,respFormat:n,handler:o,thisObject:i};if(e in this.rpcTable||(this.rpcTable[e]={}),t in this.rpcTable[e])throw new d("Attempted to add the same RPC ID twice, address: "+e+", rpcID: "+t);this.rpcTable[e][t]=a},e.prototype.rpc=function(e,t,r){return i(this,void 0,void 0,(function(){var n,o,i;return a(this,(function(a){switch(a.label){case 0:if(!(e in this.rpcTable)||!(t in this.rpcTable[e]))throw new Zt(e,t);return n=this.rpcTable[e][t],o=[],null!=r&&n.argFormat.length>0&&(o=D(n.argFormat,r)),(i=n.handler.apply(n.thisObject,o))instanceof Promise?[4,i]:[3,2];case 1:i=a.sent(),a.label=2;case 2:return[2,T.apply(void 0,[n.respFormat].concat(i))]}}))}))},e.prototype.hasRPC=function(e,t){return e in this.rpcTable&&t in this.rpcTable[e]},e.prototype.findRPCHandlers=function(e){for(var t=e,r=[];null!=t;){var n=Object.getOwnPropertyNames(t);r=r.concat(n),t=Object.getPrototypeOf(t)}for(var o=0,i=r;o<i.length;o++){var a=this[i[o]];if(null!=a&&null!=a.rpcData){var s=a.rpcData.address;if(null==s){if(null==this.address)throw new d("Attempted to add an RPC without an address in a context with no default address");s=this.address}this.addRPC(s,a.rpcData.rpcID,a.rpcData.argFormat,a.rpcData.respFormat,a,e)}}},e}(),or=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.name=r,o.firmwareVersion=n,o}return r(t,e),t.prototype.tile_status=function(){return[65535,this.name,1,0,0,0]},n([rr(4,"","H6sBBBB"),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Object)],t.prototype,"tile_status",null),t}(nr),ir=function(e){function t(t,r){var n=e.call(this)||this;n.tiles=r,n.iotileID=t;for(var o=0,i=r;o<i.length;o++){var a=i[o];8==a.address&&(n.controller=a)}return n}return r(t,e),t.prototype.rpc=function(t,r,n){return i(this,void 0,void 0,(function(){var o,i,s;return a(this,(function(a){switch(a.label){case 0:if(this.hasRPC(t,r))return[2,e.prototype.rpc.call(this,t,r,n)];o=0,i=this.tiles,a.label=1;case 1:return o<i.length?(s=i[o]).hasRPC(t,r)?[4,s.rpc(t,r,n)]:[3,3]:[3,4];case 2:return[2,a.sent()];case 3:return o++,[3,1];case 4:throw new Zt(t,r)}}))}))},t}(nr);function ar(e,t){return e<<16|t}var sr=ke((function(e,t){var r;e.exports=(r=r||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},o=n.lib={},i=o.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=o.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var a=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=a<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],o=function(t){var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},i=0;i<t;i+=4){var s=o(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new a.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new a.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new a.init(r,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},h=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,s=o/(4*i),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,u=e.min(4*c,o);if(c){for(var l=0;l<c;l+=i)this._doProcessBlock(n,l);var h=n.splice(0,c);r.sigBytes-=u}return new a.init(h,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=h.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math),r)})),cr=(ke((function(e,t){var r;e.exports=(r=sr,function(e){var t=r,n=t.lib,o=n.Base,i=n.WordArray,a=t.x64={};a.Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=o.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:8*t.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return i.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}})}(),r)})),ke((function(e,t){var r;e.exports=(r=sr,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init,n=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],o=0;o<r;o++)n[o>>>2]|=e[o]<<24-o%4*8;t.call(this,n,r)}else t.apply(this,arguments)};n.prototype=e}}(),r.lib.WordArray)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.WordArray,n=e.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var i=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var a=o(t[i>>>2]>>>16-i%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i<r;i++)n[i>>>1]|=o(e.charCodeAt(i)<<16-i%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var o=[],i=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2,c=n[e.charCodeAt(a)]>>>6-a%4*2;o[i>>>2]|=(s|c)<<24-i%4*8,i++}return t.create(o,i)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<r;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<r;s++)o.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<r.length;i++)o[r.charCodeAt(i)]=i}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)})),ke((function(e,t){var r;e.exports=(r=sr,function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],g=e[t+3],d=e[t+4],v=e[t+5],y=e[t+6],m=e[t+7],_=e[t+8],w=e[t+9],b=e[t+10],S=e[t+11],C=e[t+12],L=e[t+13],R=e[t+14],E=e[t+15],B=i[0],k=i[1],P=i[2],A=i[3];B=u(B,k,P,A,a,7,s[0]),A=u(A,B,k,P,c,12,s[1]),P=u(P,A,B,k,p,17,s[2]),k=u(k,P,A,B,g,22,s[3]),B=u(B,k,P,A,d,7,s[4]),A=u(A,B,k,P,v,12,s[5]),P=u(P,A,B,k,y,17,s[6]),k=u(k,P,A,B,m,22,s[7]),B=u(B,k,P,A,_,7,s[8]),A=u(A,B,k,P,w,12,s[9]),P=u(P,A,B,k,b,17,s[10]),k=u(k,P,A,B,S,22,s[11]),B=u(B,k,P,A,C,7,s[12]),A=u(A,B,k,P,L,12,s[13]),P=u(P,A,B,k,R,17,s[14]),B=l(B,k=u(k,P,A,B,E,22,s[15]),P,A,c,5,s[16]),A=l(A,B,k,P,y,9,s[17]),P=l(P,A,B,k,S,14,s[18]),k=l(k,P,A,B,a,20,s[19]),B=l(B,k,P,A,v,5,s[20]),A=l(A,B,k,P,b,9,s[21]),P=l(P,A,B,k,E,14,s[22]),k=l(k,P,A,B,d,20,s[23]),B=l(B,k,P,A,w,5,s[24]),A=l(A,B,k,P,R,9,s[25]),P=l(P,A,B,k,g,14,s[26]),k=l(k,P,A,B,_,20,s[27]),B=l(B,k,P,A,L,5,s[28]),A=l(A,B,k,P,p,9,s[29]),P=l(P,A,B,k,m,14,s[30]),B=h(B,k=l(k,P,A,B,C,20,s[31]),P,A,v,4,s[32]),A=h(A,B,k,P,_,11,s[33]),P=h(P,A,B,k,S,16,s[34]),k=h(k,P,A,B,R,23,s[35]),B=h(B,k,P,A,c,4,s[36]),A=h(A,B,k,P,d,11,s[37]),P=h(P,A,B,k,m,16,s[38]),k=h(k,P,A,B,b,23,s[39]),B=h(B,k,P,A,L,4,s[40]),A=h(A,B,k,P,a,11,s[41]),P=h(P,A,B,k,g,16,s[42]),k=h(k,P,A,B,y,23,s[43]),B=h(B,k,P,A,w,4,s[44]),A=h(A,B,k,P,C,11,s[45]),P=h(P,A,B,k,E,16,s[46]),B=f(B,k=h(k,P,A,B,p,23,s[47]),P,A,a,6,s[48]),A=f(A,B,k,P,m,10,s[49]),P=f(P,A,B,k,R,15,s[50]),k=f(k,P,A,B,v,21,s[51]),B=f(B,k,P,A,C,6,s[52]),A=f(A,B,k,P,g,10,s[53]),P=f(P,A,B,k,b,15,s[54]),k=f(k,P,A,B,c,21,s[55]),B=f(B,k,P,A,_,6,s[56]),A=f(A,B,k,P,E,10,s[57]),P=f(P,A,B,k,y,15,s[58]),k=f(k,P,A,B,L,21,s[59]),B=f(B,k,P,A,d,6,s[60]),A=f(A,B,k,P,S,10,s[61]),P=f(P,A,B,k,p,15,s[62]),k=f(k,P,A,B,w,21,s[63]),i[0]=i[0]+B|0,i[1]=i[1]+k|0,i[2]=i[2]+P|0,i[3]=i[3]+A|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;r[o>>>5]|=128<<24-o%32;var i=e.floor(n/4294967296),a=n;r[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),r[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,o,i,a){var s=e+(t&r|~t&n)+o+a;return(s<<i|s>>>32-i)+t}function l(e,t,r,n,o,i,a){var s=e+(t&n|r&~n)+o+a;return(s<<i|s>>>32-i)+t}function h(e,t,r,n,o,i,a){var s=e+(t^r^n)+o+a;return(s<<i|s>>>32-i)+t}function f(e,t,r,n,o,i,a){var s=e+(r^(t|~n))+o+a;return(s<<i|s>>>32-i)+t}t.MD5=i._createHelper(c),t.HmacMD5=i._createHmacHelper(c)}(Math),r.MD5)})),ke((function(e,t){var r,n,o,i,a,s,c,u;e.exports=(n=(r=u=sr).lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],c=a.SHA1=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],c=r[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}var h=(n<<5|n>>>27)+c+s[u];h+=u<20?1518500249+(o&i|~o&a):u<40?1859775393+(o^i^a):u<60?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,c=a,a=i,i=o<<30|o>>>2,o=n,n=h}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=i._createHelper(c),r.HmacSHA1=i._createHmacHelper(c),u.SHA1)})),ke((function(e,t){var r;e.exports=(r=sr,function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,a=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(s[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var u=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],h=r[6],f=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var g=u[p-15],d=(g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3,v=u[p-2],y=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=d+u[p-7]+y+u[p-16]}var m=n&o^n&i^o&i,_=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&h)+c[p]+u[p];f=h,h=l,l=s,s=a+w|0,a=i,i=o,o=n,n=w+(_+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+h|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),r.SHA256)})),ke((function(e,t){var r,n,o,i,a,s;e.exports=(n=(r=s=sr).lib.WordArray,o=r.algo,i=o.SHA256,a=o.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=i._createHelper(a),r.HmacSHA224=i._createHmacHelper(a),s.SHA224)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.Hasher,n=e.x64,o=n.Word,i=n.WordArray,a=e.algo;function s(){return o.create.apply(o,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var l=a.SHA512=t.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],s=r[4],l=r[5],h=r[6],f=r[7],p=n.high,g=n.low,d=o.high,v=o.low,y=i.high,m=i.low,_=a.high,w=a.low,b=s.high,S=s.low,C=l.high,L=l.low,R=h.high,E=h.low,B=f.high,k=f.low,P=p,A=g,I=d,O=v,x=y,T=m,D=_,F=w,M=b,H=S,N=C,j=L,z=R,U=E,W=B,G=k,V=0;V<80;V++){var $=u[V];if(V<16)var K=$.high=0|e[t+2*V],q=$.low=0|e[t+2*V+1];else{var Y=u[V-15],X=Y.high,J=Y.low,Z=(X>>>1|J<<31)^(X>>>8|J<<24)^X>>>7,Q=(J>>>1|X<<31)^(J>>>8|X<<24)^(J>>>7|X<<25),ee=u[V-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ie=u[V-7],ae=ie.high,se=ie.low,ce=u[V-16],ue=ce.high,le=ce.low;K=(K=(K=Z+ae+((q=Q+se)>>>0<Q>>>0?1:0))+ne+((q+=oe)>>>0<oe>>>0?1:0))+ue+((q+=le)>>>0<le>>>0?1:0),$.high=K,$.low=q}var he,fe=M&N^~M&z,pe=H&j^~H&U,ge=P&I^P&x^I&x,de=A&O^A&T^O&T,ve=(P>>>28|A<<4)^(P<<30|A>>>2)^(P<<25|A>>>7),ye=(A>>>28|P<<4)^(A<<30|P>>>2)^(A<<25|P>>>7),me=(M>>>14|H<<18)^(M>>>18|H<<14)^(M<<23|H>>>9),_e=(H>>>14|M<<18)^(H>>>18|M<<14)^(H<<23|M>>>9),we=c[V],be=we.high,Se=we.low,Ce=W+me+((he=G+_e)>>>0<G>>>0?1:0),Le=ye+de;W=z,G=U,z=N,U=j,N=M,j=H,M=D+(Ce=(Ce=(Ce=Ce+fe+((he+=pe)>>>0<pe>>>0?1:0))+be+((he+=Se)>>>0<Se>>>0?1:0))+K+((he+=q)>>>0<q>>>0?1:0))+((H=F+he|0)>>>0<F>>>0?1:0)|0,D=x,F=T,x=I,T=O,I=P,O=A,P=Ce+(ve+ge+(Le>>>0<ye>>>0?1:0))+((A=he+Le|0)>>>0<he>>>0?1:0)|0}g=n.low=g+A,n.high=p+P+(g>>>0<A>>>0?1:0),v=o.low=v+O,o.high=d+I+(v>>>0<O>>>0?1:0),m=i.low=m+T,i.high=y+x+(m>>>0<T>>>0?1:0),w=a.low=w+F,a.high=_+D+(w>>>0<F>>>0?1:0),S=s.low=S+H,s.high=b+M+(S>>>0<H>>>0?1:0),L=l.low=L+j,l.high=C+N+(L>>>0<j>>>0?1:0),E=h.low=E+U,h.high=R+z+(E>>>0<U>>>0?1:0),k=f.low=k+G,f.high=B+W+(k>>>0<G>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),r.SHA512)})),ke((function(e,t){var r,n,o,i,a,s,c,u;e.exports=(n=(r=u=sr).x64,o=n.Word,i=n.WordArray,a=r.algo,s=a.SHA512,c=a.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(c),r.HmacSHA384=s._createHmacHelper(c),u.SHA384)})),ke((function(e,t){var r;e.exports=(r=sr,function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,a=t.x64.Word,s=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,i=0;i<24;i++){for(var s=0,h=0,f=0;f<7;f++){if(1&o){var p=(1<<f)-1;p<32?h^=1<<p:s^=1<<p-32}128&o?o=o<<1^113:o<<=1}l[i]=a.create(s,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=a.create()}();var f=s.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var i=e[t+2*o],a=e[t+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[o]).high^=a,k.low^=i}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,g=0,d=0;d<5;d++)p^=(k=r[f+5*d]).high,g^=k.low;var v=h[f];v.high=p,v.low=g}for(f=0;f<5;f++){var y=h[(f+4)%5],m=h[(f+1)%5],_=m.high,w=m.low;for(p=y.high^(_<<1|w>>>31),g=y.low^(w<<1|_>>>31),d=0;d<5;d++)(k=r[f+5*d]).high^=p,k.low^=g}for(var b=1;b<25;b++){var S=(k=r[b]).high,C=k.low,L=c[b];L<32?(p=S<<L|C>>>32-L,g=C<<L|S>>>32-L):(p=C<<L-32|S>>>64-L,g=S<<L-32|C>>>64-L);var R=h[u[b]];R.high=p,R.low=g}var E=h[0],B=r[0];for(E.high=B.high,E.low=B.low,f=0;f<5;f++)for(d=0;d<5;d++){var k=r[b=f+5*d],P=h[b],A=h[(f+1)%5+5*d],I=h[(f+2)%5+5*d];k.high=P.high^~A.high&I.high,k.low=P.low^~A.low&I.low}k=r[0];var O=l[s];k.high^=O.high,k.low^=O.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],l=0;l<c;l++){var h=a[l],f=h.high,p=h.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(f)}return new o.init(u,s)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=i._createHelper(f),t.HmacSHA3=i._createHmacHelper(f)}(Math),r.SHA3)})),ke((function(e,t){var r;e.exports=(r=sr,
/** @preserve
	(c) 2012 by Cédric Mesnil. All rights reserved.

	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
	*/
function(){var e=r,t=e.lib,n=t.WordArray,o=t.Hasher,i=e.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=i.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,f,_,w,b,S,C,L,R,E,B,k=this._hash.words,P=l.words,A=h.words,I=a.words,O=s.words,x=c.words,T=u.words;for(S=i=k[0],C=f=k[1],L=_=k[2],R=w=k[3],E=b=k[4],r=0;r<80;r+=1)B=i+e[t+I[r]]|0,B+=r<16?p(f,_,w)+P[0]:r<32?g(f,_,w)+P[1]:r<48?d(f,_,w)+P[2]:r<64?v(f,_,w)+P[3]:y(f,_,w)+P[4],B=(B=m(B|=0,x[r]))+b|0,i=b,b=w,w=m(_,10),_=f,f=B,B=S+e[t+O[r]]|0,B+=r<16?y(C,L,R)+A[0]:r<32?v(C,L,R)+A[1]:r<48?d(C,L,R)+A[2]:r<64?g(C,L,R)+A[3]:p(C,L,R)+A[4],B=(B=m(B|=0,T[r]))+E|0,S=E,E=R,R=m(L,10),L=C,C=B;B=k[1]+_+R|0,k[1]=k[2]+w+E|0,k[2]=k[3]+b+S|0,k[3]=k[4]+i+C|0,k[4]=k[0]+f+L|0,k[0]=B},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,a=0;a<5;a++){var s=i[a];i[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function g(e,t,r){return e&t|~e&r}function d(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function m(e,t){return e<<t|e>>>32-t}e.RIPEMD160=o._createHelper(f),e.HmacRIPEMD160=o._createHmacHelper(f)}(Math),r.RIPEMD160)})),ke((function(e,t){var r,n,o;e.exports=(n=(r=sr).lib.Base,o=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),a=this._iKey=t.clone(),s=i.words,c=a.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;i.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))})),ke((function(e,t){var r,n,o,i,a,s,c,u,l;e.exports=(n=(r=l=sr).lib,o=n.Base,i=n.WordArray,a=r.algo,s=a.SHA1,c=a.HMAC,u=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=c.create(r.hasher,e),o=i.create(),a=i.create([1]),s=o.words,u=a.words,l=r.keySize,h=r.iterations;s.length<l;){var f=n.update(t).finalize(a);n.reset();for(var p=f.words,g=p.length,d=f,v=1;v<h;v++){d=n.finalize(d),n.reset();for(var y=d.words,m=0;m<g;m++)p[m]^=y[m]}o.concat(f),u[0]++}return o.sigBytes=4*l,o}}),r.PBKDF2=function(e,t,r){return u.create(r).compute(e,t)},l.PBKDF2)})),ke((function(e,t){var r,n,o,i,a,s,c,u;e.exports=(n=(r=u=sr).lib,o=n.Base,i=n.WordArray,a=r.algo,s=a.MD5,c=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),o=i.create(),a=o.words,s=r.keySize,c=r.iterations;a.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var l=1;l<c;l++)u=n.finalize(u),n.reset();o.concat(u)}return o.sigBytes=4*s,o}}),r.EvpKDF=function(e,t,r){return c.create(r).compute(e,t)},u.EvpKDF)})),ke((function(e,t){var r;e.exports=void((r=sr).lib.Cipher||function(e){var t=r,n=t.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=t.enc,c=(s.Utf8,s.Base64),u=t.algo.EvpKDF,l=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?_:y}return function(t){return{encrypt:function(r,n,o){return e(n).encrypt(t,r,n,o)},decrypt:function(r,n,o){return e(n).decrypt(t,r,n,o)}}}}()}),h=(n.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),t.mode={}),f=n.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=h.CBC=function(){var t=f.extend();function r(t,r,n){var o=this._iv;if(o){var i=o;this._iv=e}else i=this._prevBlock;for(var a=0;a<n;a++)t[r+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);n.decryptBlock(e,t),r.call(this,e,t,o),this._prevBlock=i}}),t}(),g=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,o=n<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(o);var c=i.create(a,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},d=(n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:g}),reset:function(){l.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(r,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4}),n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),v=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=i.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(c)},parse:function(e){var t=c.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=i.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return d.create({ciphertext:t,salt:n})}},y=n.SerializableCipher=o.extend({cfg:o.extend({format:v}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),i=o.finalize(t),a=o.cfg;return d.create({ciphertext:i,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(t.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=i.random(8));var o=u.create({keySize:t+r}).compute(e,n),a=i.create(o.words.slice(t),4*r);return o.sigBytes=4*t,d.create({key:o,iv:a,salt:n})}},_=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:m}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=o.iv;var i=y.encrypt.call(this,e,t,o.key,n);return i.mixIn(o),i},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=o.iv,y.decrypt.call(this,e,t,o.key,n)}})}())})),ke((function(e,t){var r;e.exports=((r=sr).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,n){var o=this._iv;if(o){var i=o.slice(0);this._iv=void 0}else i=this._prevBlock;n.encryptBlock(i,0);for(var a=0;a<r;a++)e[t+a]^=i[a]}return e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,o=n.blockSize;t.call(this,e,r,o,n),this._prevBlock=e.slice(r,r+o)}}),e.Decryptor=e.extend({processBlock:function(e,r){var n=this._cipher,o=n.blockSize,i=e.slice(r,r+o);t.call(this,e,r,o,n),this._prevBlock=i}}),e}(),r.mode.CFB)})),ke((function(e,t){var r,n,o;e.exports=((o=sr).mode.CTR=(r=o.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var a=i.slice(0);r.encryptBlock(a,0),i[n-1]=i[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=a[s]}}),r.Decryptor=n,r),o.mode.CTR)})),ke((function(e,t){var r;e.exports=(
/** @preserve
	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
	 * derived from CryptoJS.mode.CTR
	 * Jan Hruby jhruby.web@gmail.com
	 */
(r=sr).mode.CTRGladman=function(){var e=r.lib.BlockCipherMode.extend();function t(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var o=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c<o;c++)e[t+c]^=s[c]}});return e.Decryptor=o,e}(),r.mode.CTRGladman)})),ke((function(e,t){var r,n,o;e.exports=((o=sr).mode.OFB=(r=o.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(i,0);for(var a=0;a<n;a++)e[t+a]^=i[a]}}),r.Decryptor=n,r),o.mode.OFB)})),ke((function(e,t){var r,n;e.exports=((n=sr).mode.ECB=((r=n.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),r.Decryptor=r.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),r),n.mode.ECB)})),ke((function(e,t){var r;e.exports=((r=sr).pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,i=r+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),ke((function(e,t){var r;e.exports=((r=sr).pad.Iso10126={pad:function(e,t){var n=4*t,o=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(o-1)).concat(r.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),ke((function(e,t){var r;e.exports=((r=sr).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),ke((function(e,t){var r;e.exports=((r=sr).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},r.pad.ZeroPadding)})),ke((function(e,t){var r;e.exports=((r=sr).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),ke((function(e,t){var r,n,o,i;e.exports=(n=(r=i=sr).lib.CipherParams,o=r.enc.Hex,r.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return n.create({ciphertext:t})}},i.format.Hex)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,o=[],i=[],a=[],s=[],c=[],u=[],l=[],h=[],f=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var g=n^n<<1^n<<2^n<<3^n<<4;g=g>>>8^255&g^99,o[r]=g,i[g]=r;var d=e[r],v=e[d],y=e[v],m=257*e[g]^16843008*g;a[r]=m<<24|m>>>8,s[r]=m<<16|m>>>16,c[r]=m<<8|m>>>24,u[r]=m,m=16843009*y^65537*v^257*d^16843008*r,l[g]=m<<24|m>>>8,h[g]=m<<16|m>>>16,f[g]=m<<8|m>>>24,p[g]=m,r?(r=d^e[e[e[y^d]]],n^=e[e[n]]):r=n=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],d=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],a=0;a<n;a++)if(a<r)i[a]=t[a];else{var s=i[a-1];a%r?r>6&&a%r==4&&(s=o[s>>>24]<<24|o[s>>>16&255]<<16|o[s>>>8&255]<<8|o[255&s]):(s=o[(s=s<<8|s>>>24)>>>24]<<24|o[s>>>16&255]<<16|o[s>>>8&255]<<8|o[255&s],s^=g[a/r|0]<<24),i[a]=i[a-r]^s}for(var c=this._invKeySchedule=[],u=0;u<n;u++)a=n-u,s=u%4?i[a]:i[a-4],c[u]=u<4||a<=4?s:l[o[s>>>24]]^h[o[s>>>16&255]]^f[o[s>>>8&255]]^p[o[255&s]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,h,f,p,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,i,a,s){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],h=e[t+2]^r[2],f=e[t+3]^r[3],p=4,g=1;g<c;g++){var d=n[u>>>24]^o[l>>>16&255]^i[h>>>8&255]^a[255&f]^r[p++],v=n[l>>>24]^o[h>>>16&255]^i[f>>>8&255]^a[255&u]^r[p++],y=n[h>>>24]^o[f>>>16&255]^i[u>>>8&255]^a[255&l]^r[p++],m=n[f>>>24]^o[u>>>16&255]^i[l>>>8&255]^a[255&h]^r[p++];u=d,l=v,h=y,f=m}d=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^r[p++],v=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&u])^r[p++],y=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^r[p++],m=(s[f>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],e[t]=d,e[t+1]=v,e[t+2]=y,e[t+3]=m},keySize:8});e.AES=t._createHelper(d)}(),r.AES)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib,n=t.WordArray,o=t.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=i.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=a[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var u=o[i]=[],l=c[i];for(r=0;r<24;r++)u[r/6|0]|=t[(s[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(s[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],i=this._lBlock,a=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((a^o[c])&l[c])>>>0];this._lBlock=a,this._rBlock=i^s}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function p(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=o._createHelper(h);var g=i.TripleDES=o.extend({_doReset:function(){var e=this._key.words;this._des1=h.createEncryptor(n.create(e.slice(0,2))),this._des2=h.createEncryptor(n.create(e.slice(2,4))),this._des3=h.createEncryptor(n.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=o._createHelper(g)}(),r.TripleDES)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var i=0;o<256;o++){var a=o%r,s=t[a>>>2]>>>24-a%4*8&255;i=(i+n[o]+s)%256;var c=n[o];n[o]=n[i],n[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}e.RC4=t._createHelper(o);var a=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],i=[],a=[],s=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var i=t.words,a=i[0],s=i[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(o[0]^=u,o[1]^=h,o[2]^=l,o[3]^=f,o[4]^=u,o[5]^=h,o[6]^=l,o[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(s)}(),r.Rabbit)})),ke((function(e,t){var r;e.exports=(r=sr,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],i=[],a=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var i=t.words,a=i[0],s=i[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),h=u>>>16|4294901760&l,f=l<<16|65535&u;for(n[0]^=u,n[1]^=h,n[2]^=l,n[3]^=f,n[4]^=u,n[5]^=h,n[6]^=l,n[7]^=f,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(s)}(),r.RabbitLegacy)})),ke((function(e,t){e.exports=sr}))),ur=cr.lib,lr=cr.SHA256,hr=cr.enc;function fr(e,t,r){var n=new ArrayBuffer(20),o=new DataView(n);return o.setUint8(0,0),o.setUint16(2,t,!0),o.setUint32(4,e,!0),o.setUint32(8,0,!0),o.setUint32(12,0,!0),o.setUint32(16,r,!0),n}function pr(t,r,n,o,i){var a,s=44+16*i.length,c=new Uint8Array(s),u=4294967295,l=0;a=0==n?e.SignedReportSelectors.UserOutputs:1==n?e.SignedReportSelectors.SystemOutputs:65535;var h=new Uint8Array(T("BBHLLLBBH",1,255&s,s>>8,t,r,o,0,n,a));c.set(h,0);for(var f=0;f<i.length;++f){var p=i[f],g=new Uint8Array(T("HHLLL",p.stream,0,p.id,p.timestamp,p.value));c.set(g,20+16*f),p.id<u&&(u=p.id),p.id>l&&(l=p.id)}var d=new Uint8Array(T("LL",u,l));c.set(d,20+16*i.length);var v=20+16*i.length+8,y=ur.WordArray.create(c.slice(0,v)),m=M(lr(y).toString(hr.Base64));return c.set(new Uint8Array(m.slice(0,16)),v),c.buffer}var gr,dr=function(e){function t(t,r,n,o){void 0===n&&(n="2.11.4"),void 0===o&&(o="btc1_v3");var i=e.call(this,8,"NRF52 ",n)||this;return i.hwTag=o,i.appInfo=i.combineVersion(r.appTag,r.appVersion),i.osInfo=i.combineVersion(r.osTag,r.osVersion),i.iotileID=t,i.streamerAcks={},i.streams={},i.highestUniqueID=0,i.realtimeStreamers=[],i.queuedReports=[],i.prestreamingHook=null,i.downloadStreamState=null,i.notificationCallback=null,i}return r(t,e),t.prototype.combineVersion=function(e,t){var r=t.split(".");if(2!=r.length)throw new d("Unable to parse 2 component version string: "+t);return parseInt(r[0])<<26|parseInt(r[1])<<20|e},t.prototype.isBufferedStream=function(e){var t=e>>12;return 5===t||0===t},t.prototype.addRealtimeStreamer=function(e,t){var r=this,n={intervalMS:t,timeoutHandle:null,stream:e};this.realtimeStreamers.push(n),this.isStreamingEnabled()&&(n.timeoutHandle=window.setInterval((function(){return r.handleRealtimeStreamer(n)}),t))},t.prototype.handleRealtimeStreamer=function(e){if(null!=this.notificationCallback&&e.stream in this.streams){var t=this.streams[e.stream];if(0!=t.length){var r=t[t.length-1],n=fr(this.iotileID,e.stream,r.value);this.notificationCallback(n)}}},t.prototype.isStreamingEnabled=function(){return null!==this.notificationCallback},t.prototype.enableStreaming=function(e){var t=this;if(!this.isStreamingEnabled()){this.notificationCallback=e;for(var r=0,n=this.queuedReports;r<n.length;r++){e(n[r])}this.queuedReports=[];for(var o=function(e){e.timeoutHandle=window.setInterval((function(){return t.handleRealtimeStreamer(e)}),e.intervalMS)},i=0,a=this.realtimeStreamers;i<a.length;i++){o(a[i])}}},t.prototype.disableStreaming=function(){if(this.isStreamingEnabled()){this.notificationCallback=null;for(var e=0,t=this.realtimeStreamers;e<t.length;e++){var r=t[e];null!=r.timeoutHandle&&(window.clearInterval(r.timeoutHandle),r.timeoutHandle=null)}}},t.prototype.getHardwareTag=function(){return[this.hwTag]},t.prototype.getDeviceInfo=function(){return[this.iotileID,0,0,0,0,0,this.osInfo,this.appInfo]},t.prototype.acknowledgeStreamer=function(e,t,r){var n=this.streamerAcks[e];return null==n&&(n=0),e<256&&r>this.highestUniqueID&&(this.highestUniqueID=r),r>n||t?(this.streamerAcks[e]=r,[0]):[2147713054]},t.prototype.inspectVirtualStream=function(e){if(!(e in this.streams))return[ar(32770,32769),0];if(this.isBufferedStream(e))return[ar(32770,32769),0];var t=this.streams[e];return 0===t.length?[ar(32770,32768),0]:[0,t[t.length-1].value]},t.prototype.pushReading=function(e,t){t in this.streams||(this.streams[t]=[]);var r={timestamp:Math.floor(Date.now()/1e3),uniqueID:0,value:e};return this.isBufferedStream(t)&&(r.uniqueID=++this.highestUniqueID),this.streams[t].push(r),[0]},t.prototype.beginDownloadStream=function(e){this.downloadStreamState={stream:e,currIndex:0};var t=0;return e in this.streams&&(t=this.streams[e].length),[0,t,Math.floor(Date.now()/1e3)]},t.prototype.downloadReading=function(e){if(null==this.downloadStreamState)return[ar(32770,32768),0,0];var t=this.streams[this.downloadStreamState.stream];if(this.downloadStreamState.currIndex>=t.length)return[ar(32770,32768),0,0];var r=t[this.downloadStreamState.currIndex++];return[0,r.timestamp,r.value]},n([rr(2,"","10s"),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Object)],t.prototype,"getHardwareTag",null),n([rr(4104,"","LLBBBBLL"),o("design:type",Function),o("design:paramtypes",[]),o("design:returntype",Object)],t.prototype,"getDeviceInfo",null),n([rr(8207,"HHL","L"),o("design:type",Function),o("design:paramtypes",[Number,Boolean,Number]),o("design:returntype",Object)],t.prototype,"acknowledgeStreamer",null),n([rr(8203,"H","LL"),o("design:type",Function),o("design:paramtypes",[Number]),o("design:returntype",void 0)],t.prototype,"inspectVirtualStream",null),n([rr(8192,"LH","L"),o("design:type",Function),o("design:paramtypes",[Number,Number]),o("design:returntype",void 0)],t.prototype,"pushReading",null),n([rr(8200,"H","LLL"),o("design:type",Function),o("design:paramtypes",[Number]),o("design:returntype",void 0)],t.prototype,"beginDownloadStream",null),n([rr(8201,"","LLL"),o("design:type",Function),o("design:paramtypes",[Number]),o("design:returntype",void 0)],t.prototype,"downloadReading",null),t}(or),vr=function(e){function t(t,r){var n,o=r.connected;null==o&&(o=!1),"string"==typeof t&&(t=parseInt(t,16));var i=new dr(t,{appTag:1024,appVersion:"0.0",osTag:1024,osVersion:"0.0"},"2.11.4","btc1_v3"),a=new ir(t,[i]);return n=e.call(this,a,o)||this,i.addRealtimeStreamer(A("unbuffered node 11"),1e3),i.addRealtimeStreamer(A("unbuffered node 13"),1e3),i.addRealtimeStreamer(A("unbuffered node 12"),1e3),i.addRealtimeStreamer(A("unbuffered node 14"),1e3),i.pushReading(1,A("unbuffered node 11")),i.pushReading(1,A("unbuffered node 13")),i.pushReading(1,A("unbuffered node 12")),i.pushReading(1,A("unbuffered node 14")),n}return r(t,e),t}(tr),yr=function(e){function t(t,r){var n,o=r.connected;null==o&&(o=!1),"string"==typeof t&&(t=parseInt(t,16));var i=new dr(t,{appTag:1024,appVersion:"0.0",osTag:1024,osVersion:"0.0"},"2.11.4","btc1_v3"),a=new ir(t,[i]);return n=e.call(this,a,o)||this,i.addRealtimeStreamer(A("unbuffered node 25"),1e3),i.pushReading(50,A("unbuffered node 25")),n}return r(t,e),t}(tr),mr=function(e){function t(t,r){var n,o=r.connected;null==o&&(o=!1),"string"==typeof t&&(t=parseInt(t,16));var i=new dr(t,{appTag:1024,appVersion:"0.0",osTag:1024,osVersion:"0.0"},"2.11.4","btc1_v3"),a=new ir(t,[i]);return n=e.call(this,a,o)||this,i.addRealtimeStreamer(A("unbuffered node 15"),1e3),i.pushReading(2048,A("unbuffered node 15")),r.double&&(i.addRealtimeStreamer(A("unbuffered node 16"),1e3),i.pushReading(1024,A("unbuffered node 16"))),n}return r(t,e),t}(tr),_r=function(e){function t(t,r){var n,o=r.connected;null==o&&(o=!1),"string"==typeof t&&(t=parseInt(t,16));var i=new dr(t,{appTag:1024,appVersion:"0.0",osTag:1024,osVersion:"0.0"},"2.11.4","btc1_v3"),a=new ir(t,[i]);n=e.call(this,a,o)||this;var s=pr(t,2,0,0,[{stream:20480,value:0,id:1,timestamp:0}]),c=fr(t,4107,1);return i.queuedReports=[s,c],n}return r(t,e),t}(tr),wr=function(){function e(e){for(var t in this.devices=[],this.Config=e,xt.info(e.BLE.MOCK_BLE_DEVICES),e.BLE.MOCK_BLE_DEVICES){var r=new(0,{nfc300:vr,soilmoisture:mr,temperature:yr,stream_test:_r}[e.BLE.MOCK_BLE_DEVICES[t].type])(t,e.BLE.MOCK_BLE_DEVICES[t].args);this.devices.push(r)}xt.info("Created "+this.devices.length+" fake devices"),this.scanInfo={inProgress:!1,discoveryTimer:null},this.connectionInfo={inProgress:!1,connected:!1,device:null}}return e.prototype.isEnabled=function(e,t){setTimeout(e,0)},e.prototype.startScan=function(e,t,r){var n=0;if(this.scanInfo.inProgress)return xt.error("startScan called twice without stopScan being called in between",Error),void setTimeout(r,10);this.scanInfo.inProgress=!0;var o=this;this.scanInfo.discoveryTimer=setTimeout((function(){if(o.scanInfo.discoveryTimer=null,o.scanInfo.inProgress)for(n=0;n<o.devices.length;++n)t(o.devices[n]);else xt.error("discover callback triggered outside of scanning period.  This is probably a race condition.",Error)}),this.Config.BLE.MOCK_BLE_SCAN_DELAY)},e.prototype.stopScan=function(e,t){this.scanInfo.inProgress?(null!==this.scanInfo.discoveryTimer&&(clearTimeout(this.scanInfo.discoveryTimer),this.scanInfo.discoveryTimer=null),this.scanInfo.inProgress=!1,e&&setTimeout(e,0)):xt.error("stopScan called without startScan first being called.",Error)},e.prototype.connect=function(e,t,r){if(this.connectionInfo.connected||this.connectionInfo.inProgress)return xt.error("Connect called twice",Error),void setTimeout((function(){r("Connect called twice to id: "+e)}),20);for(var n=0;n<this.devices.length;++n)if(this.devices[n].device.iotileID===e){if(this.devices[n].connected)setTimeout((function(){r("Connect called on device with other connected: "+e)}),20);else{var o=this;setTimeout((function(){o.finishConnection(t)}),o.Config.BLE.MOCK_BLE_SCAN_DELAY),this.connectionInfo.inProgress=!0,this.connectionInfo.device=this.devices[n],this.connectionInfo.disconnected=r}break}this.connectionInfo.inProgress||setTimeout((function(){r("Could not find device by id: "+e)}),20)},e.prototype.finishConnection=function(e){this.connectionInfo.inProgress||xt.error("finishConnection called in invalid state.",Error),this.connectionInfo.inProgress=!1,this.connectionInfo.connected=!0,e(this.connectionInfo.device)},e.prototype.isConnected=function(e,t,r){this.connectionInfo.connected&&this.connectionInfo.device.id===e?setTimeout(t,0):setTimeout(r,0)},e.prototype.disconnect=function(e,t,r){this.connectionInfo.connected&&this.connectionInfo.device.id===e?(this.connectionInfo.device.disconnect(t),this.connectionInfo.connected=!1,this.connectionInfo.device=null):setTimeout(r,0)},e.prototype.force_disconnect=function(){this.connectionInfo.connected&&(this.connectionInfo.disconnected("Unexpected disconnection"),this.disconnect(this.connectionInfo.device.id,(function(){}),(function(){})))},e.prototype.write=function(e,t,r,n,o,i){this.connectionInfo.connected&&this.connectionInfo.device.id===e?this.connectionInfo.device.write(t,r,n,o,i):setTimeout(i,10)},e.prototype.writeWithoutResponse=function(e,t,r,n,o,i){this.connectionInfo.connected&&this.connectionInfo.device.id===e?this.connectionInfo.device.write(t,r,n,o,i):setTimeout(i,10)},e.prototype.startNotification=function(e,t,r,n,o){this.connectionInfo.connected&&this.connectionInfo.device.id===e?this.connectionInfo.device.subscribe(t,r,n,o):setTimeout(o,10)},e.prototype.stopNotification=function(e,t,r,n,o){this.connectionInfo.connected&&this.connectionInfo.device.id===e?this.connectionInfo.device.unsubscribe(t,r,n,o):setTimeout(o,10)},e}();!function(e){e[e.RPC=0]="RPC",e[e.Streaming=1]="Streaming",e[e.Script=2]="Script",e[e.Tracing=3]="Tracing"}(gr||(gr={}));var br="00002000-3FF7-53BA-E611-132C0FF60F63",Sr=function(t){function n(r,n,o){var i=t.call(this)||this;i.charManagers={},i.characteristicNames={},i.adapterEventNames={},i.adParser=new Re(r.BLE.ARCH_BLE_COMPANY_ID,o),i.notification=n,i.state=e.AdapterState.Idle,i.connectionHooks=[],i.preconnectionHooks=[],i.lastScanResults=[],i.connectedDevice=null,i.tracingOpen=!1,i.interactive=!1,i.supportsFastWrites=!1,i.connectionMessages=[],i.characteristicNames[ye.ReceiveHeader]="2001",i.characteristicNames[ye.ReceivePayload]="2002",i.characteristicNames[ye.SendHeader]="2003",i.characteristicNames[ye.SendPayload]="2004",i.characteristicNames[ye.Streaming]="2005",i.characteristicNames[ye.HighspeedData]="2006",i.characteristicNames[ye.Tracing]="2007",i.adapterEventNames[e.AdapterEvent.ScanStarted]="adapter_scanstarted",i.adapterEventNames[e.AdapterEvent.ScanFinished]="adapter_scanfinished",i.adapterEventNames[e.AdapterEvent.Connected]="adapter_connected",i.adapterEventNames[e.AdapterEvent.ConnectionStarted]="adapter_connectionstarted",i.adapterEventNames[e.AdapterEvent.ConnectionFinished]="adapter_connectionfinished",i.adapterEventNames[e.AdapterEvent.Disconnected]="adapter_disconnected",i.adapterEventNames[e.AdapterEvent.UnrecoverableRPCError]="adapter_unrecoverablerpcerror",i.adapterEventNames[e.AdapterEvent.UnrecoverableStreamingError]="adapter_streamingerror",i.adapterEventNames[e.AdapterEvent.RawRealtimeReading]="adapter_rawrealtimereading",i.adapterEventNames[e.AdapterEvent.RawRobustReport]="adapter_rawrobustreport",i.adapterEventNames[e.AdapterEvent.RobustReportStarted]="adapter_robustreportstarted",i.adapterEventNames[e.AdapterEvent.RobustReportStalled]="adapter_robustreportstalled",i.adapterEventNames[e.AdapterEvent.RobustReportProgress]="adapter_robustreportprogress",i.adapterEventNames[e.AdapterEvent.RobustReportFinished]="adapter_robustreportfinished",i.charManagers[ye.Streaming]=new Cr,i.charManagers[ye.Tracing]=new Cr,i.charManagers[ye.ReceiveHeader]=new Cr,i.charManagers[ye.ReceivePayload]=new Cr,i.rpcInterface=new Dt,i.streamingInterface=new $t(r.BLE.STREAMING_BUFFER_SIZE,!0),i.scriptInterface=new Ft,i.tracingInterface=new Kt,r.BLE&&r.BLE.MOCK_BLE&&(It.info("Using Mock BLE implementation."),i.mockBLEService=new wr(r),window.ble=i.mockBLEService,window.device={platform:r.BLE.MOCK_BLE_DEVICE});var a=new Yt(o);return i.registerConnectionHook((function(e,t){return a.optimizeConnection(e,t)})),i.registerConnectionHook((function(e,t){return i.setReportSize(e,t)})),i}return r(n,t),n.prototype.setReportSize=function(e,t){return i(this,void 0,void 0,(function(){var e,r,n;return a(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,t.errorHandlingRPC(8,2565,"LB","L",[1048576,0],5)];case 1:return o.sent(),[4,t.typedRPC(8,2566,"","LBB",[],5)];case 2:return e=o.sent(),r=e[0],e[1],e[2],1048576!=r?It.error("Device report size failed to update",Error):It.info("Large device report size successfully configured"),[3,4];case 3:return n=o.sent(),It.debug("Couldn't configure sending larger reports on this device: ",n),[3,4];case 4:return[2,null]}}))}))},n.prototype.getConnectedDevice=function(){return this.connectedDevice},n.prototype.registerConnectionHook=function(e){this.connectionHooks.push(e)},n.prototype.registerPreconnectionHook=function(e){this.preconnectionHooks.push(e)},n.prototype.pause=function(){this.streamingInterface.stop()},n.prototype.resume=function(){this.notify(e.AdapterEvent.StreamingInterrupted,null)},n.prototype.enabled=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,t){window.ble.isEnabled((function(){return e(!0)}),(function(){return e(!1)}))}))]}))}))},n.prototype.scan=function(t){return i(this,void 0,void 0,(function(){var r,n,o;return a(this,(function(i){switch(i.label){case 0:r=[],n={},this.ensureIdle("scanning"),this.state=e.AdapterState.Scanning,this.notify(e.AdapterEvent.ScanStarted,{}),o=this,i.label=1;case 1:return i.trys.push([1,,4,5]),window.ble.startScan([],(function(e){try{var t=o.createIOTileAdvertisement(e);if(t.slug in n)return;n[t.slug]=!0,r.push(t)}catch(e){if(!(e instanceof le))throw e}})),[4,k(1e3*t)];case 2:return i.sent(),[4,this.stopScan()];case 3:return i.sent(),[3,5];case 4:return this.state=e.AdapterState.Idle,this.notify(e.AdapterEvent.ScanFinished,{count:r.length}),[7];case 5:return this.lastScanResults=r,[2,r]}}))}))},n.prototype.connectTo=function(e,t){return i(this,void 0,void 0,(function(){var r,n;return a(this,(function(o){switch(o.label){case 0:r=0,o.label=1;case 1:return r<this.lastScanResults.length?(n=this.lastScanResults[r]).slug!=e?[3,3]:[4,this.connect(n,t)]:[3,4];case 2:return[2,o.sent()];case 3:return++r,[3,1];case 4:return t&&t.scanIfNotFound?[4,this.scan(2)]:[3,9];case 5:o.sent(),r=0,o.label=6;case 6:return r<this.lastScanResults.length?(n=this.lastScanResults[r]).slug!=e?[3,8]:[4,this.connect(n,t)]:[3,9];case 7:return[2,o.sent()];case 8:return++r,[3,6];case 9:throw new ne("Could not find device slug in scan results")}}))}))},n.prototype.connect=function(t,r){return i(this,void 0,void 0,(function(){var n,o,i,s,c,u,l;return a(this,(function(a){switch(a.label){case 0:this.ensureIdle("connecting"),n=!0,o=!0,i=null,this.connectionMessages=[],this.interactive=!0,this.supportsFastWrites=!1,this.tracingOpen=!1,null!=r&&(null!=r.noStreamInterface&&(o=!r.noStreamInterface),null!=r.noRPCInterface&&(n=!r.noRPCInterface),null!=r.prestreamingHook&&(i=r.prestreamingHook),null!=r.noninteractive&&(this.interactive=!r.noninteractive)),c=0,a.label=1;case 1:return c<this.preconnectionHooks.length?[4,(0,this.preconnectionHooks[c])(t,this)]:[3,4];case 2:if(u=a.sent())throw new oe(u);a.label=3;case 3:return++c,[3,1];case 4:this.state=e.AdapterState.Connecting,this.notify(e.AdapterEvent.ConnectionStarted,{}),a.label=5;case 5:return a.trys.push([5,,22,23]),s=this,[4,this.connectInternal(t)];case 6:s.connectedDevice=a.sent(),a.label=7;case 7:return a.trys.push([7,19,,21]),n?[4,this.openInterface(gr.RPC)]:[3,9];case 8:a.sent(),a.label=9;case 9:return[4,this.openInterface(gr.Script)];case 10:a.sent(),c=0,a.label=11;case 11:return c<this.connectionHooks.length?[4,(0,this.connectionHooks[c])(this.connectedDevice,this)]:[3,14];case 12:if(u=a.sent())throw new oe(u);a.label=13;case 13:return++c,[3,11];case 14:return null==i?[3,16]:[4,i(this.connectedDevice,this)];case 15:a.sent(),a.label=16;case 16:return o?[4,this.openInterface(gr.Streaming)]:[3,18];case 17:a.sent(),a.label=18;case 18:return[3,21];case 19:return l=a.sent(),[4,this.disconnect()];case 20:throw a.sent(),l;case 21:return[3,23];case 22:return this.notify(e.AdapterEvent.ConnectionFinished,{}),[7];case 23:return this.notify(e.AdapterEvent.Connected,{device:this.connectedDevice}),[2,this.connectedDevice]}}))}))},n.prototype.rpc=function(e,t,r,n){return i(this,void 0,void 0,(function(){return a(this,(function(o){switch(o.label){case 0:return this.ensureConnected("sending rpc"),[4,this.rpcInterface.rpc(e,t,r,n)];case 1:return[2,o.sent()]}}))}))},n.prototype.sendScript=function(e,t){return i(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return this.ensureConnected("sending script"),[4,this.scriptInterface.send(e,t)];case 1:return r.sent(),[2]}}))}))},n.prototype.clearTrace=function(){this.tracingInterface.clearData()},n.prototype.waitForTracingData=function(e,t){return void 0===t&&(t=1e3),this.tracingInterface.waitForData(e,t)},n.prototype.typedRPC=function(e,t,r,n,o,s){return i(this,void 0,void 0,(function(){var i,c;return a(this,(function(a){switch(a.label){case 0:return i=T.apply(void 0,[r].concat(o)),[4,this.rpc(e,t,i,s)];case 1:return c=a.sent(),[2,D(n,c)]}}))}))},n.prototype.errorHandlingRPC=function(e,t,r,n,o,s){return i(this,void 0,void 0,(function(){var i,c;return a(this,(function(a){switch(a.label){case 0:if(0===n.length||"L"!=n[0])throw new d("Invalid response format for errorHandlingRPC that did not start with an L code for the error.");return[4,this.typedRPC(e,t,r,n,o,s)];case 1:if(i=a.sent(),0!=(c=i.shift()))throw It.error("Failed to execute rpc "+t+" on tile "+e,Error),new X(e,t,c);return[2,i]}}))}))},n.prototype.disconnect=function(){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return this.state!==e.AdapterState.Connected?[2]:(this.state=e.AdapterState.Disconnecting,this.connectedDevice?[4,this.disconnectInternal(this.connectedDevice.connectionID)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this.charManagers[ye.Streaming].removeAll(),this.charManagers[ye.ReceiveHeader].removeAll(),this.charManagers[ye.ReceivePayload].removeAll(),this.charManagers[ye.Tracing].removeAll(),this.state=e.AdapterState.Idle,this.connectedDevice=null,[2]}}))}))},n.prototype.subscribe=function(e,t){var r=this.adapterEventNames[e];return this.notification.subscribe(r,t)},n.prototype.addNotificationListener=function(e,t){return i(this,void 0,void 0,(function(){var r,n,o,i;return a(this,(function(a){if(this.ensureConnected("enable notifications"),!(e in this.charManagers))throw new m("Characteristic cannot be listened to: "+e);return r=this.charManagers[e],n=r.addListener(t),o=this,i=function(){return o.removeNotificationListener(e,n)},r.numListeners()>1?[2,i]:[2,new Promise((function(t,a){o.connectedDevice&&(window.ble.startNotification(o.connectedDevice.connectionID,br,o.characteristicNames[e],(function(e){r.handleData(e)}),(function(e){r.removeListener(n),a(e)})),setTimeout((function(){t(i)}),100))}))]}))}))},n.prototype.removeNotificationListener=function(e,t){return i(this,void 0,void 0,(function(){var r,n,o;return a(this,(function(i){if(!(e in this.charManagers))throw new m("Characteristic cannot be listened to: "+e);return r=this.charManagers[e],n=r.removeListener(t),o=this,n?[2,new Promise((function(t,r){o.connectedDevice&&window.ble.stopNotification(o.connectedDevice.connectionID,br,o.characteristicNames[e],(function(){return t()}),(function(e){return r(e)}))}))]:[2]}))}))},n.prototype.createChannel=function(){var e=this;return{write:function(t,r){return e.write(t,r)},subscribe:function(t,r){return e.addNotificationListener(t,r)},notify:function(t,r){return e.notify(t,r)}}},n.prototype.openInterface=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:switch(this.ensureConnected("open device interface"),e){case gr.RPC:return[3,1];case gr.Streaming:return[3,3];case gr.Script:return[3,5];case gr.Tracing:return[3,8]}return[3,10];case 1:return[4,this.rpcInterface.open(this.createChannel())];case 2:return t.sent(),[3,10];case 3:return[4,this.streamingInterface.open(this.createChannel())];case 4:return t.sent(),[3,10];case 5:return this.connectedDevice?[4,this.scriptInterface.open(this.connectedDevice,this.createChannel())]:[3,7];case 6:t.sent(),t.label=7;case 7:return[3,10];case 8:return[4,this.tracingInterface.open(this.createChannel())];case 9:return t.sent(),[3,10];case 10:return[2]}}))}))},n.prototype.enableTracing=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this.tracingOpen?[2]:[4,this.tracingInterface.open(this.createChannel())];case 1:return e.sent(),this.tracingOpen=!0,[2]}}))}))},n.prototype.closeInterface=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:switch(this.ensureConnected("close device interface"),e){case gr.RPC:return[3,1];case gr.Streaming:return[3,3];case gr.Script:return[3,5];case gr.Tracing:return[3,7]}return[3,9];case 1:return[4,this.rpcInterface.close()];case 2:case 4:case 6:case 8:return t.sent(),[3,9];case 3:return[4,this.streamingInterface.close()];case 5:return[4,this.scriptInterface.close()];case 7:return[4,this.tracingInterface.close()];case 9:return[2]}}))}))},n.prototype.ensureIdle=function(t){if(this.state!=e.AdapterState.Idle)throw new ce("action: '"+t+"'' started at invalid time, adapter was not idle.",this.state)},n.prototype.ensureConnected=function(t,r){if(this.state!=e.AdapterState.Connected)throw new ce("action: '"+t+"'' started at invalid time, adapter was not connected.",this.state,r)},n.prototype.notify=function(e,t){var r=this.adapterEventNames[e];this.notification.notify(r,t)},n.prototype.createIOTileAdvertisement=function(e){return this.adParser.processAdvertisement(e.id,e.rssi,e.advertising)},n.prototype.stopScan=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,t){window.ble.stopScan(e,t)}))]}))}))},n.prototype.write=function(t,r){return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){return this.ensureConnected("writing to characteristic","Error sending data to device"),n=this,[2,new Promise((function(o,i){var a=setTimeout((function(){i(new ae("Timeout sending data"))}),2e3),s=function(){clearTimeout(a),o()};n.connectedDevice&&(n.supportsFastWrites||n.adParser.platform()===e.Platform.Android?window.ble.writeWithoutResponse(n.connectedDevice.connectionID,br,n.characteristicNames[t],r,s,(function(e){clearTimeout(a),i(new ae(e))})):window.ble.write(n.connectedDevice.connectionID,br,n.characteristicNames[t],r,s,(function(e){clearTimeout(a),i(new ae(e))})))}))]}))}))},n.prototype.connectInternal=function(t){return i(this,void 0,void 0,(function(){var r;return a(this,(function(n){return r=this,[2,new Promise((function(n,o){window.ble.connect(t.connectionID,(function(o){r.supportsFastWrites=r.checkFastWriteSupport(o),r.supportsFastWrites&&It.info("Device supports fast writes, increasing RPC and script speed."),n(new Le(r,t)),r.state=e.AdapterState.Connected}),(function(t){r.state==e.AdapterState.Connecting?(r.state=e.AdapterState.Idle,o(new ie(t))):r.disconnectCallback(t)}))}))]}))}))},n.prototype.checkFastWriteSupport=function(e){var t=this.findCharacteristic(e,br,"2006"),r=this.findCharacteristic(e,br,"2003"),n=this.findCharacteristic(e,br,"2004");return null!=t&&null!=r&&null!=n&&(this.checkProperty(t,"WriteWithoutResponse")&&this.checkProperty(r,"WriteWithoutResponse")&&this.checkProperty(n,"WriteWithoutResponse"))},n.prototype.findCharacteristic=function(e,t,r){if(null==e.characteristics||null==e.characteristics.length)return null;for(var n=0,o=e.characteristics;n<o.length;n++){var i=o[n];if(i.service.toLowerCase()===t.toLowerCase()&&i.characteristic.toLowerCase()===r.toLowerCase())return i}return null},n.prototype.checkProperty=function(e,t){for(var r=0,n=e.properties;r<n.length;r++){if(n[r].toLowerCase()===t.toLowerCase())return!0}return!1},n.prototype.disconnectInternal=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){return[2,new Promise((function(t,r){window.ble.disconnect(e,t,r)}))]}))}))},n.prototype.disconnectCallback=function(t){if(It.info("Disconnect callback: "+JSON.stringify(t)),this.state==e.AdapterState.Connected){this.state=e.AdapterState.Idle;var r=this.connectedDevice;this.connectedDevice=null,this.charManagers[ye.Streaming].removeAll(),this.charManagers[ye.ReceiveHeader].removeAll(),this.charManagers[ye.ReceivePayload].removeAll(),this.charManagers[ye.Tracing].removeAll(),this.notify(e.AdapterEvent.Disconnected,{device:r})}},n}(Xt),Cr=function(){function e(){this.lastID=0,this.listenerCount=0,this.callbacks={}}return e.prototype.addListener=function(e){var t=this.lastID;return this.lastID+=1,this.listenerCount+=1,this.callbacks[t]=e,t},e.prototype.removeAll=function(){this.callbacks={},this.listenerCount=0},e.prototype.handleData=function(e){for(var t in this.callbacks)try{this.callbacks[t](e)}catch(e){}},e.prototype.numListeners=function(){return this.listenerCount},e.prototype.removeListener=function(e){if(!(e in this.callbacks))throw new m("Unknown characteristic listener key: "+e);return delete this.callbacks[e],this.listenerCount-=1,0==this.listenerCount},e}(),Lr=function(){function t(){}return t.prototype.mergeReports=function(e,t){this.checkReportsForMerging(e,t);var r=20+16*(e.readings.length+t.readings.length)+24,n=new ArrayBuffer(r);this.insertMergedHeader(n,e,t);var o=this.mergeReadings(n,e,t);return this.insertMergedFooter(n,o.lowestID,o.highestID),new ve(t.header.uuid,255,o.readings,n,t.receivedTime)},t.prototype.checkReportsForMerging=function(t,r){var n=t.header,o=r.header;if(t.validity!=e.SignatureStatus.Valid||r.validity!=e.SignatureStatus.Valid)throw new d("You can only merge reports that have valid signatures");if(n.uuid!=o.uuid)throw new d("Reports did not come from the same device");if(n.selector!=e.SignedReportSelectors.UserOutputs)throw new d("User report did not select user readings");if(o.selector!=e.SignedReportSelectors.SystemOutputs)throw new d("System report did not select system readings");if(o.sentTime<n.sentTime)throw new d("System report was sent before user report");if(o.reportID<n.reportID)throw new d("System report ID was lower than user report")},t.prototype.insertMergedHeader=function(t,r,n){var o=r.header,i=n.header,a=T("BBHLLLBBH",1,255&t.byteLength,t.byteLength>>8,o.uuid,i.reportID,i.sentTime,0,255,e.SignedReportSelectors.CombinedOutputs);F(t,a,0,0,a.byteLength)},t.prototype.mergeReadings=function(e,t,r){for(var n=0,o=0,i=t.readings.length+r.readings.length,a=0,s=4294967295,c=0,u=[],l=new Date,h=new Date(l.valueOf()-1e3*r.header.sentTime);a<i;){var f=void 0;0!=(f=this.pickNextReading(t,n,r,o)?r.readings[o++]:t.readings[n++]).id&&f.id<s&&(s=f.id),0!=f.id&&f.id>c&&(c=f.id),u.push(new he(f.stream,f.value,f.timestamp,h,f.id)),this.insertReading(e,20+16*a,f.timestamp,f.stream,f.value,f.id),a+=1}return{lowestID:s,highestID:c,readings:u}},t.prototype.pickNextReading=function(e,t,r,n){if(t==e.readings.length&&n==r.readings.length)throw new d("Both reports have been exhausted, no more readings to pick");if(t==e.readings.length)return!0;if(n==r.readings.length)return!1;var o=e.readings[t],i=r.readings[n];return!(o.id<i.id)},t.prototype.insertReading=function(e,t,r,n,o,i){var a=T("HHLLL",n,0,i,r,o);F(e,a,0,t,a.byteLength)},t.prototype.insertMergedFooter=function(e,t,r){var n=e.byteLength-24,o=T("LL",t,r);F(e,o,0,n,o.byteLength);var i=new V,a=e.slice(0,e.byteLength-16);F(e,i.calculateSignature(a),0,e.byteLength-16,16)},t}(),Rr=function(){},Er=function(){function e(e){this.callbacks={}}return e.prototype.addCallback=function(e){var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}));return this.callbacks[t]=e,t},e.prototype.triggerCallback=function(e,t){for(var r in this.callbacks)this.callbacks[r](e,t)},e.prototype.removeAll=function(){this.callbacks={}},e.prototype.removeCallback=function(e){if(!(e in this.callbacks))throw new m("Unknown event handler key: "+e);delete this.callbacks[e]},e}(),Br=function(e){function t(){var t=e.call(this)||this;return t.events={},t}return r(t,e),t.prototype.subscribe=function(e,t){e in this.events||(this.events[e]=new Er(e));var r=this.events[e].addCallback(t),n=this;return function(){n.events[e].removeCallback(r)}},t.prototype.notify=function(e,t){e in this.events&&this.events[e].triggerCallback(e,t)},t.prototype.removeAll=function(){for(var e in this.events)this.events[e].removeAll();this.events={}},t}(Rr);function kr(e,t,r,n){return{stream:A(e),timestamp:t,value:r,id:n}}e.IOTileDevice=Le,e.RemoteBridge=Se,e.Config=Ce,e.IOTileAdapter=Sr,e.IOTileRPCInterface=Dt,e.IOTileAdvertisementService=Re,e.ReportParserEvent=jt,e.ReportProgressEvent=Wt,e.ReportParser=Vt,e.SignedListReportMerger=Lr,e.catService=At,e.catAdapter=It,e.catBLEOptimizer=Ot,e.catMockBLE=xt,e.AbstractNotificationService=Rr,e.BasicNotificationService=Br,e.EventManager=Er,e.MockBleService=wr,e.BasicControllerTile=dr,e.findByDeviceID=function(e,t){var r=0;for(r=0;r<t.length;++r)if(t[r].deviceID===e)return t[r];if(r==t.length)return null},e.setupMockBLE=function(e){e.BLE={MOCK_BLE:!0,MOCK_BLE_DEVICE:"Android",STREAMING_BUFFER_SIZE:196608,ARCH_BLE_COMPANY_ID:960,MOCK_BLE_DEVICES:{3:{type:"nfc300",args:{robust:!1,osVersion:0,appVersion:0,hwVersion:"btc1_v2"}},4:{type:"nfc300",args:{robust:!1,osVersion:1024,appVersion:1028,hwVersion:"btc1_v2"}},5:{type:"nfc300",args:{robust:!0,osVersion:1024,appVersion:1027,hwVersion:"btc1_v2"}},6:{type:"nfc300",args:{robust:!0,osVersion:1024,appVersion:1028,hwVersion:"btc1_v3"}},7:{type:"nfc300",args:{robust:!1,osVersion:1024,appVersion:1027,hwVersion:"btc1_v3"}},8:{type:"nfc300",args:{robust:!0,osVersion:1024,appVersion:1027,hwVersion:"btc1_v3",connected:!0}},9:{type:"stream_test",args:{osVersion:1024,appVersion:1027,hwVersion:"btc1_v3"}}},MOCK_BLE_SCAN_DELAY:0}},e.StreamingError=J,e.ReportParsingStoppedError=Z,e.StreamingTimeoutError=Q,e.ReportParsingError=ee,e.RingBufferEmptyError=te,e.BluetoothError=re,e.ConnectionError=ne,e.ConnectionCancelledError=oe,e.ConnectionFailedError=ie,e.WriteError=ae,e.BluetoothDisabledError=se,e.OperationAtInvalidTimeError=ce,e.ScriptSentAtInvalidTime=ue,e.InvalidAdvertisingData=le,e.RawReading=he,e.IOTileReport=fe,e.IndividualReport=pe,e.USER_REPORT_STREAMER=0,e.SYSTEM_REPORT_STREAMER=1,e.COMBINED_REPORT_STREAMER=255,e.SignedListReport=ve,e.createIndividualReport=function(e,t,r,n,o){return T("BBHLLLL",0,0,A(t),e,n,o,r)},e.expectIndividual=function(e,t,r,n,o,i){expect(e.constructor.name).toBe("IndividualReport");var a=e;expect(a.deviceID).toBe(t),a.deviceID,expect(a.reading.stream).toBe(A(r)),expect(a.reading.value).toBe(n),expect(a.reading.timestamp).toBe(i),expect(a.sentTimestamp).toBe(o)},e.expectSequential=function(t,r,n,o,i){expect(t.constructor.name).toBe("SignedListReport");var a=t,s=a.header;expect(a.validity).toEqual(e.SignatureStatus.Valid),expect(s.uuid).toEqual(r),expect(s.streamer).toEqual(i),expect(a.readings.length).toEqual(o);for(var c=0;c<o;++c){var u=a.readings[c];expect(u.id).toEqual(c+1),expect(u.value).toEqual(c),expect(u.timestamp).toEqual(c),expect(u.stream).toEqual(A(n))}},e.feedInPieces=function(e,t,r){for(var n=0;n<e.byteLength;n+=r)t(e.slice(n,n+r))},e.createReading=kr,e.createSequentialReport=function(e,t,r,n,o){var i=[];null==o&&(o=0);for(var a=o;a<o+r;++a)i.push(kr(t,a,a,a+1));return pr(e,r+1,n,r+o,i)},e.BaseError=Jt,e.RPCNotFound=Zt,e.RPCArgumentsIncorrect=Qt,e.RPCResponseIncorrect=er,e.MockBLEDevice=tr,e.buildIndividualReport=fr,e.createHashListReport=pr,e.rpc=function(e,t,r,n){return function(o,i,a){o.rpcData={argFormat:r,respFormat:n,rpcID:t,address:e}}},e.tileRPC=rr,e.BaseRPCDispatcher=nr,e.VirtualTile=or,e.VirtualDevice=ir,e.packError=ar,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=/sm/cd1d6a4bbb61a4915a7c2de498c1ff2236f22ff3e6c12be08025fbabe7b418f5.map