@signageos/front-applet-extension-nexmosphere
Version:
Nexmosphere extension for signageOS Front Applet
2 lines • 22.6 kB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=9)}([function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,e.exports.once=function(e,t){return new Promise((function(n,r){function o(){void 0!==i&&e.removeListener("error",i),n([].slice.call(arguments))}var i;"error"!==t&&(i=function(n){e.removeListener(t,o),r(n)},e.once("error",i)),e.once(t,o)}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var s=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function f(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var o,i,a,u;if(c(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=f(e))>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,u=s,console&&console.warn&&console.warn(u)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=p.bind(r);return o.listener=n,r.wrapFn=o,o}function v(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):h(o,o.length)}function y(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return f(this)},u.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)i(s,this,t);else{var c=s.length,f=h(s,c);for(n=0;n<c;++n)i(f[n],this,t)}return!0},u.prototype.addListener=function(e,t){return l(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return l(this,e,t,!0)},u.prototype.once=function(e,t){return c(t),this.on(e,d(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,d(this,e,t)),this},u.prototype.removeListener=function(e,t){var n,r,o,i,a;if(c(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return v(this,e,!0)},u.prototype.rawListeners=function(e){return v(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SerialPortEvent=void 0,function(e){e.MESSAGE="message"}(t.SerialPortEvent||(t.SerialPortEvent={}))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function a(e){var t=l();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?s(e):t}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)})(e)}function f(e,t,n){return(f=l()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&p(o,n.prototype),o}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var v,y;Object.defineProperty(t,"__esModule",{value:!0}),t.createXRAntennaCommand=t.createAddresableCommand=t.parseMessage=t.UnknownCommandError=t.InvalidArgumentError=t.FormatType=t.CommandType=void 0,function(e){e.XTALK="X",e.GENERIC="G",e.SYSTEM="S",e.DIAGNOSTIC="D"}(v=t.CommandType||(t.CommandType={})),function(e){e.SHORT="A",e.LONG="B",e.SETTING="S"}(y=t.FormatType||(t.FormatType={}));var h=function(e){i(n,e);var t=a(n);function n(e){var r;return o(this,n),(r=t.call(this,null!=e?e:"Invalid argument error.")).name="InvalidArgumentError",Object.setPrototypeOf(s(r),n.prototype),r}return n}(c(Error));t.InvalidArgumentError=h;var m=function(e){i(n,e);var t=a(n);function n(e){var r;return o(this,n),(r=t.call(this,null!=e?e:"Unknown command.")).name="UnknownCommandError",Object.setPrototypeOf(s(r),n.prototype),r}return n}(c(Error));t.UnknownCommandError=m;var b=new RegExp(/^X\d{3}A\[\d{1,3}\]$/,"i"),E=new RegExp(/^XR\[P(U|B)\d{3}\]$/,"i"),g=new RegExp(/^X\d{3}B\[.{1,30}\]$/,"i");function w(e,t,n,r){return{command:e,type:t,address:n,format:r}}function S(e,t){return{type:"antenna",command:e,tagIndex:t}}t.parseMessage=function(e){if(0===e.length)throw new h("Message is empty.");var t,n,r;if(e.match(b))return n=v.XTALK,t=y.SHORT,r=(r=e.substr(1,3)).replace(/^0+/,""),w(e.slice(e.indexOf("[")+1,e.indexOf("]")),n,Number(r),t);if(e.match(E)){n="antenna";var o=e.slice(e.indexOf("[")+1,e.indexOf("]"));return S(o.substr(0,2),parseInt(o.substr(2,3)))}if(e.match(g))return n=v.XTALK,t=y.LONG,r=e.substr(1,3),w(e.slice(e.indexOf("[")+1,e.indexOf("]")),n,parseInt(r),t);throw new m},t.createAddresableCommand=w,t.createXRAntennaCommand=S},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=n(5),a=n(6),u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.serialPort=new a.default(t)}var t,n,u;return t=e,(n=[{key:"createButton",value:function(e,t){return new o.default(this.serialPort,e,t)}},{key:"createRfidAntenna",value:function(e){return new i.default(this.serialPort,e)}}])&&r(t.prototype,n),u&&r(t,u),e}();t.default=u},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=s(e);if(t){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isButtonPressed=t.ButtonStates=t.ButtonActions=void 0;var f,l,p=n(0),d=n(2),v=n(1);!function(e){e.Pressed="pressed",e.Released="released"}(f=t.ButtonActions||(t.ButtonActions={})),function(e){e[e.PRESSED=0]="PRESSED",e[e.RELEASED=1]="RELEASED"}(l=t.ButtonStates||(t.ButtonStates={}));var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r,u=a(s);function s(e,t,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(r=u.call(this)).serialPort=e,r.address=t,r.index=n,r.eventEmitter=new p.EventEmitter,r.state=l.RELEASED,r.initStream(),r}return t=s,(n=[{key:"isPressed",value:function(){return c(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.address.toString().padStart(3,"0"),n="X".concat(t,"A[]"),this.serialPort.sendMessage(n),e.next=5,this.waitForNextStateChange();case 5:return r=e.sent,e.abrupt("return",r===f.Pressed);case 7:case"end":return e.stop()}}),e,this)})))}},{key:"initStream",value:function(){var e=this;this.serialPort.on(v.SerialPortEvent.MESSAGE,(function(t){try{var n=d.parseMessage(t);if(n.type===d.CommandType.XTALK&&n.address===e.address&&n.format===d.FormatType.SHORT&&!isNaN(Number(n.command))){var r=Number(n.command);e.handleNewState(r)}}catch(e){!(e instanceof Error)||e instanceof d.InvalidArgumentError||e instanceof d.UnknownCommandError||console.error(e.message)}}))}},{key:"handleNewState",value:function(e){h(e,this.index)?(this.eventEmitter.emit("state_change",f.Pressed),this.handlePressed()):(this.eventEmitter.emit("state_change",f.Released),this.handleReleased())}},{key:"handlePressed",value:function(){this.state!==l.PRESSED&&(this.state=l.PRESSED,this.emit(f.Pressed))}},{key:"handleReleased",value:function(){this.state!==l.RELEASED&&(this.state=l.RELEASED,this.emit(f.Released))}},{key:"waitForNextStateChange",value:function(){var e=this;return new Promise((function(t){e.eventEmitter.once("state_change",t)}))}}])&&o(t.prototype,n),r&&o(t,r),s}(p.EventEmitter);function h(e,t){return!!(e&(1&e)<<t+1)}t.isButtonPressed=h,t.default=y},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=s(e);if(t){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RfidAntennaStates=t.RfidAntennaActions=void 0;var f,l,p=n(0),d=n(2),v=n(1);!function(e){e.Picked="picked",e.Placed="placed"}(f=t.RfidAntennaActions||(t.RfidAntennaActions={})),function(e){e[e.PLACED=0]="PLACED",e[e.PICKED=1]="PICKED"}(l=t.RfidAntennaStates||(t.RfidAntennaStates={}));var y=/^([ \t]*d\d{3}){4}$/,h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r,u=a(s);function s(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(n=u.call(this)).serialPort=e,n.address=t,n.eventEmitter=new p.EventEmitter,n.initStream(),n}return t=s,(n=[{key:"getPlacedTags",value:function(){return c(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.address.toString().padStart(3,"0"),this.serialPort.sendMessage("X".concat(t,"B[]")),e.next=4,this.waitForResponseStatus();case 4:return n=e.sent,r=n.replace(/[ \t]{2,}/g," ").trim(),o=r.split(" "),e.abrupt("return",o.map((function(e){return e.substr(1)})).map((function(e){return parseInt(e)})).filter((function(e){return 0!==e})));case 8:case"end":return e.stop()}}),e,this)})))}},{key:"initStream",value:function(){var e=this;this.serialPort.on(v.SerialPortEvent.MESSAGE,(function(t){try{var n=d.parseMessage(t);"antenna"===n.type?("PU"===n.command?e.state=l.PICKED:"PB"===n.command&&(e.state=l.PLACED),e.lastTagNumber=n.tagIndex):n.type===d.CommandType.XTALK&&n.address===e.address&&n.format===d.FormatType.SHORT?"1"===n.command?e.handlePicked(e.lastTagNumber):"0"===n.command&&e.handlePlaced(e.lastTagNumber):n.type===d.CommandType.XTALK&&n.format===d.FormatType.LONG&&n.address===e.address&&n.command.match(y)&&e.handleState(n.command)}catch(e){!(e instanceof Error)||e instanceof d.InvalidArgumentError||e instanceof d.UnknownCommandError||console.error(e.message)}}))}},{key:"handlePicked",value:function(e){this.emit(f.Picked,e)}},{key:"handlePlaced",value:function(e){this.emit(f.Placed,e)}},{key:"handleState",value:function(e){this.eventEmitter.emit("status_received",e)}},{key:"waitForResponseStatus",value:function(){var e=this;return new Promise((function(t){e.eventEmitter.once("status_received",t)}))}}])&&o(t.prototype,n),r&&o(t,r),s}(p.EventEmitter);t.default=h},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(1),a=n(7),u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.serialPort=t,this.eventEmitter=new o.EventEmitter,this.parser=new a.default(t),this.bindEvents()}var t,n,u;return t=e,(n=[{key:"on",value:function(e,t){this.eventEmitter.on(e,t)}},{key:"removeListener",value:function(e,t){this.eventEmitter.removeListener(e,t)}},{key:"removeAllListeners",value:function(e){e?this.eventEmitter.removeAllListeners(e):this.eventEmitter.removeAllListeners()}},{key:"sendMessage",value:function(e){this.serialPort.write(e+"\r\n")}},{key:"bindEvents",value:function(){var e=this;this.parser.onData((function(t){e.eventEmitter.emit(i.SerialPortEvent.MESSAGE,t)}))}}])&&r(t.prototype,n),u&&r(t,u),e}();t.default=u},function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.serialPort=t,this.dataBuffer="",this.eventEmitter=new a.EventEmitter,this.bindEvents()}var t,n,o;return t=e,(n=[{key:"onData",value:function(e){this.eventEmitter.on("data",e)}},{key:"bindEvents",value:function(){var e=this;this.serialPort.onData((function(t){return e.handleData(t)}))}},{key:"handleData",value:function(e){var t;for(this.dataBuffer+=this.convertDataToString(e);-1!==(t=this.dataBuffer.indexOf("\r\n"));){var n=this.dataBuffer.slice(0,t);this.eventEmitter.emit("data",n),this.dataBuffer=this.dataBuffer.slice(t+"\r\n".length)}}},{key:"convertDataToString",value:function(e){return r(e).map((function(e){return String.fromCharCode(e)})).join("")}}])&&i(t.prototype,n),o&&i(t,o),e}();t.default=u},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);window.Nexmosphere=r.default}])}));
//# sourceMappingURL=browser.js.map