summaryrefslogtreecommitdiff
path: root/main.cf2d245a.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.cf2d245a.js')
-rw-r--r--main.cf2d245a.js10
1 files changed, 0 insertions, 10 deletions
diff --git a/main.cf2d245a.js b/main.cf2d245a.js
deleted file mode 100644
index b0a0f91..0000000
--- a/main.cf2d245a.js
+++ /dev/null
@@ -1,10 +0,0 @@
-parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"COPm":[function(require,module,exports) {
-"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(){e=function(){return r};var r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(N){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,a=Object.create(o.prototype),c=new T(n||[]);return i(a,"_invoke",{value:O(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(N){return{type:"throw",arg:N}}}r.wrap=l;var v={};function p(){}function d(){}function y(){}var _={};s(_,c,function(){return this});var g=Object.getPrototypeOf,b=g&&g(g(x([])));b&&b!==n&&o.call(b,c)&&(_=b);var m=y.prototype=p.prototype=Object.create(_);function w(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function E(e,r){var n;i(this,"_invoke",{value:function(i,a){function c(){return new r(function(n,c){!function n(i,a,c,u){var f=h(e[i],e,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==t(l)&&o.call(l,"__await")?r.resolve(l.__await).then(function(t){n("next",t,c,u)},function(t){n("throw",t,c,u)}):r.resolve(l).then(function(t){s.value=t,c(s)},function(t){return n("throw",t,c,u)})}u(f.arg)}(i,a,n,c)})}return n=n?n.then(c,c):c()}})}function O(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=D(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function D(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,D(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function x(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(o.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:L}}function L(){return{value:void 0,done:!0}}return d.prototype=y,i(m,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:d,configurable:!0}),d.displayName=s(y,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,f,"GeneratorFunction")),t.prototype=Object.create(m),t},r.awrap=function(t){return{__await:t}},w(E.prototype),s(E.prototype,u,function(){return this}),r.AsyncIterator=E,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new E(l(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w(m),s(m,f,"Generator"),s(m,c,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=x,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),v}},r}function r(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(f){return void r(f)}c.done?e(u):Promise.resolve(u).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)})}}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}function i(t,e){return(i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=f();return function(){var r,n=s(t);if(e){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,d(n.key),n)}}function h(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e,r){return(e=d(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(e){var r=y(e,"string");return"symbol"===t(r)?r:String(r)}function y(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.uBitBLE=exports.MESEvents=void 0;var _="6e400001-b5a3-f393-e0a9-e50e24dcca9e",g="6e400002-b5a3-f393-e0a9-e50e24dcca9e",b="6e400003-b5a3-f393-e0a9-e50e24dcca9e",m="e95d93af-251d-470a-a062-fa1922dfa9a8",w="e95db84c-251d-470a-a062-fa1922dfa9a8",E="e95d23c4-251d-470a-a062-fa1922dfa9a8",O="e95d9775-251d-470a-a062-fa1922dfa9a8",D="e95d5404-251d-470a-a062-fa1922dfa9a8",P={MES_DPAD_CONTROLLER_ID:1104,MES_DPAD_BUTTON_A_DOWN:1,MES_DPAD_BUTTON_A_UP:2,MES_DPAD_BUTTON_B_DOWN:3,MES_DPAD_BUTTON_B_UP:4,MES_DPAD_BUTTON_C_DOWN:5,MES_DPAD_BUTTON_C_UP:6,MES_DPAD_BUTTON_D_DOWN:7,MES_DPAD_BUTTON_D_UP:8,MES_DPAD_BUTTON_1_DOWN:9,MES_DPAD_BUTTON_1_UP:10,MES_DPAD_BUTTON_2_DOWN:11,MES_DPAD_BUTTON_2_UP:12,MES_DPAD_BUTTON_3_DOWN:13,MES_DPAD_BUTTON_3_UP:14,MES_DPAD_BUTTON_4_DOWN:15,MES_DPAD_BUTTON_4_UP:16};exports.MESEvents=P;var S=h(function t(){v(this,t),p(this,"SERVICE_UUID",null)}),T=function(t){o(i,S);var r=a(i);function i(t,e){var n;return v(this,i),p(u(n=r.call(this)),"service",void 0),n.service=t,n.ubitEvent=e,console.log("EventService initialized."),n}return h(i,[{key:"sendEvent",value:function(t,e){this.ubitEvent.writeValue(new Uint16Array([t,e]))}}],[{key:"getService",value:function(){var t=n(e().mark(function t(r){var n,o;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return console.debug("Getting EventService"),t.next=3,r.getPrimaryService(i.SERVICE_UUID);case 3:return n=t.sent,console.debug("Getting UBitevent characteristic"),t.next=7,n.getCharacteristic(D);case 7:return o=t.sent,t.abrupt("return",new i(n,o));case 9:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()}]),i}();p(T,"SERVICE_UUID",m);var x=function(){function t(){v(this,t),p(this,"eventService",void 0),p(this,"device",void 0),this.onConnectCallback=function(){},this.onDisconnectCallback=function(){}}return h(t,[{key:"onConnect",value:function(t){this.onConnectCallback=t}},{key:"onDisconnect",value:function(t){this.onDisconnectCallback=t}},{key:"isConnected",value:function(){return!!this.device&&this.device.gatt.connected}},{key:"disconnect",value:function(){this.isConnected()&&this.device.gatt.disconnect()}},{key:"searchDevice",value:function(){var t=n(e().mark(function t(){var r,n;return e().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,navigator.bluetooth.requestDevice({filters:[{namePrefix:"BBC micro:bit"}],optionalServices:[m]});case 2:return this.device=t.sent,this.device.addEventListener("gattserverdisconnected",this.onDisconnectCallback),console.log("Connected to new device",this.device.name,this.device.id),console.debug("Connection to GATT server..."),t.next=8,this.device.gatt.connect();case 8:return r=t.sent,this.onConnectCallback(),console.debug("Getting services..."),t.next=13,T.getService(r);case 13:n=t.sent,this.eventService=n;case 15:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();function L(t){var e=[];for(var r in t.properties)!0===t.properties[r]&&e.push(r.toUpperCase());return"["+e.join(", ")+"]"}function N(t){for(var e=[],r=0;r<t.target.value.byteLength;r++)e[r]=t.target.value.getUint8(r);return String.fromCharCode.apply(null,e)}exports.uBitBLE=x;
-},{}],"SiMs":[function(require,module,exports) {
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.notif_alert=a,exports.notif_info=c,exports.notif_success=o,exports.notif_warn=i;var e=void 0,n=[];function t(a){var i=document.querySelector(".statusline .notification-area");if(null===i.querySelector(".notification")&&void 0===e){if(screen.availHeight>screen.availWidth&&!document.body.classList.contains("ignore-landscape-warning"))return e=setInterval(function(){(screen.availHeight<screen.availWidth||document.body.classList.contains("ignore-landscape-warning"))&&(clearInterval(e),e=void 0,t(n.pop()))},1e3),void n.push(a);var c=document.createElement("div");c.className="notification",c.appendChild(a[0]),c.appendChild(a[1]),i.appendChild(c),i.classList.add("show"),setTimeout(function(){i.classList.remove("show"),c.querySelector("p").style.opacity="0",setTimeout(function(){i.removeChild(c),n.length>0&&t(n.pop())},1e3)},1e4)}else n.push(a)}function a(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="alert fas fa-exclamation-triangle",n.appendChild(i),t([i,n])}function i(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="warning fas fa-exclamation-triangle",n.appendChild(i),t([i,n])}function c(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="info fas fa-info-circle",n.appendChild(i),t([i,n])}function o(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="success fas fa-check-circle",n.appendChild(i),t([i,n])}
-},{}],"W7Xq":[function(require,module,exports) {
-"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(){return(e="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var a=i(t,e);if(a){var s=Object.getOwnPropertyDescriptor(a,e);return s.get?s.get.call(arguments.length<3?t:n):s.value}}).apply(this,arguments)}function i(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=h();return function(){var i,n=l(t);if(e){var a=l(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return r(this,i)}}function r(e,i){if(i&&("object"===t(i)||"function"==typeof i))return i;if(void 0!==i)throw new TypeError("Derived constructors may only return object or undefined");return o(e)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return f(t)||g(t,e)||d(t,e)||c()}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(t,e){if(t){if("string"==typeof t)return y(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?y(t,e):void 0}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function g(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,s,r,o=[],h=!0,l=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1}else for(;!(h=(n=s.call(i)).done)&&(o.push(n.value),o.length!==e);h=!0);}catch(u){l=!0,a=u}finally{try{if(!h&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(l)throw a}}return o}}function f(t){if(Array.isArray(t))return t}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,x(n.key),n)}}function b(t,e,i){return e&&p(t.prototype,e),i&&p(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function w(t,e,i){m(t,e),e.set(t,i)}function m(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function k(t,e,i){return(e=x(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function x(e){var i=T(e,"string");return"symbol"===t(i)?i:String(i)}function T(e,i){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,i||"default");if("object"!==t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}function Y(t,e){return A(t,P(t,e,"get"))}function A(t,e){return e.get?e.get.call(t):e.value}function X(t,e,i){return E(t,P(t,e,"set"),i),i}function P(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function E(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Square=exports.GamepadJoystick=exports.GamepadButton=exports.Gamepad=void 0;var S=new WeakMap,O=new WeakMap,M=new WeakMap,B=new WeakMap,j=new WeakMap,I=function(){function t(e,i){var n=this;v(this,t),k(this,"canvas",void 0),w(this,S,{writable:!0,value:window.devicePixelRatio}),w(this,O,{writable:!0,value:void 0}),w(this,M,{writable:!0,value:void 0}),w(this,B,{writable:!0,value:void 0}),w(this,j,{writable:!0,value:[]}),k(this,"touches",{}),k(this,"showTouches",!1),this.canvas=document.createElement("canvas"),this.canvas.setAttribute("id",e),i.appendChild(this.canvas),addEventListener("resize",function(){return n.resize()}),this.resize(),console.debug("Created canvas",this.canvas),setInterval(function(){n.drawElements()},10)}return b(t,[{key:"resize",value:function(){X(this,B,this.canvas.getContext("2d")),X(this,M,+getComputedStyle(this.canvas).getPropertyValue("height").slice(0,-2)),X(this,O,+getComputedStyle(this.canvas).getPropertyValue("width").slice(0,-2)),this.canvas.setAttribute("height",Y(this,M)*Y(this,S)),this.canvas.setAttribute("width",Y(this,O)*Y(this,S))}},{key:"screenToCanvasX",value:function(t){return t*Y(this,S)}},{key:"screenToCanvasY",value:function(t){return t*Y(this,S)}},{key:"getTarget",value:function(t,e){t*=Y(this,S),e*=Y(this,S);for(var i=0;i<Y(this,j).length;i++)if(Y(this,j)[i]instanceof D&&Y(this,j)[i].collides(Y(this,B),t,e))return Y(this,j)[i]}},{key:"drawElements",value:function(){Y(this,B).clearRect(0,0,Y(this,O)*Y(this,S),Y(this,M)*Y(this,S));for(var t=0;t<Y(this,j).length;t++)Y(this,j)[t].draw(Y(this,B));this.showTouches&&this.drawTouches()}},{key:"drawTouches",value:function(t){for(var e=["200, 0, 0","0, 200, 0","0, 0, 200","200, 200, 0","200, 200, 200"],i=0,n=Object.entries(this.touches);i<n.length;i++){var a=u(n[i],2),s=a[0],r=a[1];Y(this,B).beginPath(),Y(this,B).arc(r.x*Y(this,S),r.y*Y(this,S),20*Y(this,S),0,2*Math.PI,!0),Y(this,B).fillStyle="rgba(".concat(e[s],", 0.2)"),Y(this,B).fill(),Y(this,B).lineWidth=2,Y(this,B).strokeStyle="rgba(".concat(e[s],", 0.8)"),Y(this,B).stroke()}}},{key:"addElement",value:function(t){Y(this,j).push(t),t.init()}},{key:"removeElementById",value:function(t){for(var e=0;e<Y(this,j).length;e++)if(t===Y(this,j)[e].id)return void Y(this,j).splice(e,1)}},{key:"removeAllElements",value:function(){Y(this,j).splice(0,Y(this,j).length)}}]),t}(),C=function(){function t(e,i){v(this,t),k(this,"gamepad",void 0),k(this,"id",void 0),k(this,"x",void 0),k(this,"y",void 0),k(this,"alignX",void 0),k(this,"alignY",void 0),k(this,"path",void 0),k(this,"isInside",void 0),k(this,"isActive",void 0),k(this,"type","Element");var n=Object.assign({id:null,x:0,y:0,alignX:null,alignY:null},e);this.id=n.id,this.x=n.x,this.y=n.y,this.alignX=n.alignX,this.alignY=n.alignY,this.gamepad=i}return b(t,[{key:"init",value:function(){}},{key:"getScaleX",value:function(t){return t.canvas.width/100}},{key:"getScaleY",value:function(t){return t.canvas.height/100}},{key:"getX",value:function(t){var e=this.x*this.getScaleY(t);return"center"===this.alignX&&(e=t.canvas.width/2+e),"right"===this.alignX&&(e=t.canvas.width-e),e}},{key:"getY",value:function(t){var e=this.y*this.getScaleY(t);return"center"===this.alignY&&(e=t.canvas.height/2+e),"bottom"===this.alignY&&(e=t.canvas.height-e),e}},{key:"draw",value:function(t){}},{key:"collides",value:function(t,e,i){return this.isInside=t.isPointInPath(this.path,e,i),this.isInside}}]),t}(),R=function(t){n(i,C);var e=s(i);function i(){return v(this,i),e.apply(this,arguments)}return b(i,[{key:"draw",value:function(t){this.path=new Path2D;var e=20*this.getScaleY(t);this.path.rect(this.getX(t)-e/2,this.getY(t)-e/2,e,e),t.fillStyle="rgba(100, 100, 100, 0.8)",t.fill(this.path)}}]),i}();exports.Square=R;var D=function(t){n(i,C);var e=s(i);function i(){var t;v(this,i);for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return k(o(t=e.call.apply(e,[this].concat(a))),"type","TouchElement"),k(o(t),"touchCount",0),t}return b(i,[{key:"setActive",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];["end","cancel"].includes(t.type)&&this.touchCount--;var i="start"==t.type;i!==this.isActive&&0==this.touchCount&&(this.isActive=i,e&&this.gamepad.handleTouchEventCallbacks(this.createTouchEventObject(this.isActive?"touchstart":"touchend"))),"start"==t.type&&this.touchCount++}},{key:"createTouchEventObject",value:function(t){return{id:this.id,action:t,type:this.type}}}]),i}(),L=function(t){n(i,D);var e=s(i);function i(t){var n;v(this,i);var a=Object.assign({keyboardButton:null,altText:null,altTextAlign:"left",shape:"round"},t);return k(o(n=e.call(this,t)),"shape",void 0),k(o(n),"altText",void 0),k(o(n),"altTextAlign",void 0),k(o(n),"type","GamepadButton"),n.keyboardButton=a.keyboardButton,n.shape=a.shape,n.altText=a.altText,n.altTextAlign=a.altTextAlign,n}return b(i,[{key:"init",value:function(){null!==this.keyboardButton&&this.gamepad.registerKeybinding(this.keyboardButton,this)}},{key:"draw",value:function(t){if(this.path=new Path2D,"round"===this.shape)this.path.arc(this.getX(t),this.getY(t),10*this.getScaleY(t),0,4*Math.PI,!0);else if("square"===this.shape){var e=20*this.getScaleY(t);this.path.rect(this.getX(t)-e/2,this.getY(t)-e/2,e,e)}this.isActive?t.fillStyle="rgba(80, 80, 80, 1)":t.fillStyle="rgba(100, 100, 100, 0.8)",t.fill(this.path);var i="".concat(Math.floor((8*this.getScaleY(t)).toString()),"px 'Press Start 2P'");if(t.font=i,t.textBaseline="middle",t.textAlign="center",t.fillStyle="rgba(255, 255, 255, 1)",t.fillText(this.id,this.getX(t),this.getY(t)),null!==this.altText&&this.gamepad.showAltText){t.beginPath(),t.font="".concat(Math.floor((3*this.getScaleY(t)).toString()),"px 'Press Start 2P'"),t.textBaseline="middle",t.textAlign="center",t.fillStyle="rgba(150, 150, 150, 1)";var n=this.getX(t),a=this.getY(t);switch(this.altTextAlign){case"left":n-=13*this.getScaleY(t);break;case"right":n+=13*this.getScaleY(t);break;case"top":a-=13*this.getScaleY(t);break;case"bottom":a+=13*this.getScaleY(t)}t.fillText(this.altText,n,a)}}}]),i}();exports.GamepadButton=L;var K=new WeakMap,q=new WeakMap,W=new WeakMap,G=function(t){n(a,D);var i=s(a);function a(t){var e;v(this,a);var n=Object.assign({lockX:!1,lockY:!1,autoCenter:!0,bindUp:null,bindLeft:null,bindRight:null,bindDown:null},t);return k(o(e=i.call(this,t)),"type","GamepadJoystick"),k(o(e),"mouseX",0),k(o(e),"mouseY",0),k(o(e),"cR",0),k(o(e),"cX",0),k(o(e),"cY",0),w(o(e),K,{writable:!0,value:void 0}),w(o(e),q,{writable:!0,value:void 0}),w(o(e),W,{writable:!0,value:{}}),X(o(e),K,n.lockX),X(o(e),q,n.lockY),e.bindUp=n.bindUp,e.bindLeft=n.bindLeft,e.bindRight=n.bindRight,e.bindDown=n.bindDown,e}return b(a,[{key:"init",value:function(){null!==this.bindUp&&this.gamepad.registerKeybinding(this.bindUp,this),null!==this.bindLeft&&this.gamepad.registerKeybinding(this.bindLeft,this),null!==this.bindRight&&this.gamepad.registerKeybinding(this.bindRight,this),null!==this.bindDown&&this.gamepad.registerKeybinding(this.bindDown,this)}},{key:"isKeyPressed",value:function(t){return null!==t&&Y(this,W).hasOwnProperty(t)&&Y(this,W)[t]>0}},{key:"createTouchEventObject",value:function(t){return{id:this.id,action:t,type:this.type,x:Math.round(this.mouseX/this.cR*100),y:Math.round(this.mouseY/this.cR*100)}}},{key:"setActive",value:function(t){e(l(a.prototype),"setActive",this).call(this,t,!1),t.hasOwnProperty("key")&&(Y(this,W).hasOwnProperty(t.key)||(Y(this,W)[t.key]=0),["start"].includes(t.type)&&Y(this,W)[t.key]++,["end","cancel"].includes(t.type)&&Y(this,W)[t.key]--);var i=this.cR;Y(this,K)||(t.hasOwnProperty("x")&&(this.mouseX=this.cX-this.gamepad.stage.screenToCanvasX(t.x),this.mouseX=Math.min(Math.abs(this.mouseX),i)*Math.sign(this.mouseX),this.mouseX*=-1),this.isKeyPressed(this.bindLeft)&&(this.mouseX=-i),this.isKeyPressed(this.bindRight)&&(this.mouseX=i),this.isKeyPressed(this.bindLeft)&&this.isKeyPressed(this.bindRight)&&(this.mouseX=0),this.isActive||(this.mouseX=0)),Y(this,q)||(t.hasOwnProperty("y")&&(this.mouseY=this.cY-this.gamepad.stage.screenToCanvasY(t.y),this.mouseY=Math.min(Math.abs(this.mouseY),i)*Math.sign(this.mouseY)),this.isKeyPressed(this.bindUp)&&(this.mouseY=i),this.isKeyPressed(this.bindDown)&&(this.mouseY=-i),this.isKeyPressed(this.bindUp)&&this.isKeyPressed(this.bindDown)&&(this.mouseY=0),this.isActive||(this.mouseY=0));var n="touchmove";this.isActive&&1==this.touchCount&&"start"===t.type&&(n="touchstart"),this.isActive||(n="touchend"),this.gamepad.handleTouchEventCallbacks(this.createTouchEventObject(n))}},{key:"draw",value:function(t){this.cX=this.getX(t),this.cY=this.getY(t),this.cR=25*this.getScaleY(t),this.path=new Path2D,this.path.arc(this.cX,this.cY,this.cR,0,4*Math.PI,!0),this.isActive?t.fillStyle="rgba(85, 85, 85, 0.8)":t.fillStyle="rgba(100, 100, 100, 0.8)",t.fill(this.path),t.beginPath(),t.arc(this.cX+this.mouseX,this.cY-this.mouseY,15*this.getScaleY(t),0,4*Math.PI,!0),t.fillStyle="rgba(130, 130, 130, 1)",t.fill()}}]),a}();exports.GamepadJoystick=G;var U=new WeakMap,_=new WeakMap,z=new WeakMap,V=new WeakMap,J=new WeakMap,H=new WeakMap,N=function(){function t(){v(this,t),k(this,"stage",void 0),w(this,U,{writable:!0,value:void 0}),w(this,_,{writable:!0,value:void 0}),w(this,z,{writable:!0,value:{}}),w(this,V,{writable:!0,value:{}}),w(this,J,{writable:!0,value:{}}),w(this,H,{writable:!0,value:[]}),k(this,"showDebug",!1),k(this,"showAltText",!0),k(this,"enableVibration",!0),this.stage=new I("GamePad",document.querySelector(".gamepad-wrapper")),this.addEventListeners()}return b(t,[{key:"addEventListeners",value:function(){var t=this,e=["keydown","keyup"];for(var i in e)document.addEventListener(e[i],function(e){return t.handleKeyEvent(e)},!1);for(var i in e=["touchstart","touchend","touchcancel","touchmove"])this.stage.canvas.addEventListener(e[i],function(e){return t.handleTouchEvent(e)},!1);for(var i in e=["mousedown","mouseup","mousemove"])this.stage.canvas.addEventListener(e[i],function(e){return t.handleMouseEvent(e)},!1)}},{key:"registerKeybinding",value:function(t,e){Y(this,V)[t]=e}},{key:"handleKeyEvent",value:function(t){if(Y(this,J).hasOwnProperty(t.keyCode)||(Y(this,J)[t.keyCode]={pressed:!1}),Y(this,V).hasOwnProperty(t.key)){var e="Key ".concat(t.key),i=Y(this,V)[t.key],n={touchId:e,key:t.key,type:{keydown:"start",keyup:"end"}[t.type]};switch(t.type){case"keydown":if(Y(this,J)[t.keyCode].pressed)return;Y(this,J)[t.keyCode].pressed=!0,Y(this,z)[e]={},Y(this,z)[e].target=i,Y(this,z)[e].hasOwnProperty("target")&&null!=Y(this,z)[e].target&&Y(this,z)[e].target.setActive(n);break;case"keyup":if(!Y(this,J)[t.keyCode].pressed)return;Y(this,J)[t.keyCode].pressed=!1,Y(this,z)[e].hasOwnProperty("target")&&null!=Y(this,z)[e].target&&Y(this,z)[e].target.setActive(n),delete Y(this,z)[e]}}this.stage.touches=Y(this,z),this.debugTouches()}},{key:"handleMouseEvent",value:function(t){this.processGamepadTouchEvent({x:t.clientX,y:t.clientY,touchId:"mouse",type:{mousedown:"start",mouseup:"end",mousemove:"move"}[t.type]})}},{key:"handleTouchEvent",value:function(t){t.preventDefault();for(var e={touchstart:"start",touchend:"end",touchcancel:"end",touchmove:"move"},i=0;i<t.changedTouches.length;i++){var n=t.changedTouches[i];this.processGamepadTouchEvent({x:n.clientX,y:n.clientY,touchId:n.identifier,type:e[t.type]})}}},{key:"processGamepadTouchEvent",value:function(t){var e=this.stage.getTarget(t.x,t.y);switch(t.type){case"start":Y(this,z)[t.touchId]={},Y(this,z)[t.touchId].target=e;case"move":Y(this,z).hasOwnProperty(t.touchId)&&(Y(this,z)[t.touchId].x=t.x,Y(this,z)[t.touchId].y=t.y,Y(this,z)[t.touchId].hasOwnProperty("target")&&null!=Y(this,z)[t.touchId].target&&Y(this,z)[t.touchId].target.setActive(t));break;case"end":case"cancel":Y(this,z)[t.touchId].hasOwnProperty("target")&&null!=Y(this,z)[t.touchId].target&&Y(this,z)[t.touchId].target.setActive(t),delete Y(this,z)[t.touchId];break;default:console.log("Unknown touch event",t.type)}this.stage.touches=Y(this,z),this.debugTouches()}},{key:"debugTouches",value:function(){var t="";if(this.showDebug)for(var e=0,i=Object.entries(Y(this,z));e<i.length;e++){var n=u(i[e],2),a=n[0],s=n[1];t+="[".concat(a,"] "),s.hasOwnProperty("x")&&(t+="x: ".concat(Math.round(s.x,2),", y: ").concat(Math.round(s.y),",")),t+="target: ".concat(s.target?s.target.id:null,"\n")}document.querySelector(".gamepad-touches").innerHTML=t}},{key:"handleTouchEventCallbacks",value:function(t){if(this.enableVibration&&["touchstart","touchend"].includes(t.action))try{window.navigator.vibrate(5)}catch(t){console.error(t)}for(var e=0;e<Y(this,H).length;e++)Y(this,H)[e](t)}},{key:"onTouchEvent",value:function(t){Y(this,H).push(t)}},{key:"addElements",value:function(t){for(var e=0;e<t.length;e++)t[e].gamepad=this,this.stage.addElement(t[e])}},{key:"removeElementsById",value:function(t){for(var e=0;e<t.length;e++)this.stage.removeElementById(t[e])}},{key:"removeAllElements",value:function(){this.stage.removeAllElements()}},{key:"setGamepadLayout",value:function(t){switch(console.debug("Setting the gamepad layout to ".concat(t,", deleting all current elements.")),this.removeAllElements(),t){case"1":this.addElements([new R({id:"filler1",x:40,y:0,alignX:"left",alignY:"center"}),new L({id:"C",x:20,y:0,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowLeft",altText:"◀",altTextAlign:"right"}),new L({id:"D",x:60,y:0,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowRight",altText:"▶",altTextAlign:"left"}),new L({id:"A",x:40,y:-20,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowUp",altText:"▲",altTextAlign:"bottom"}),new L({id:"B",x:40,y:20,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowDown",altText:"▼",altTextAlign:"top"}),new L({id:"3",x:20,y:0,alignX:"right",alignY:"center",shape:"round",keyboardButton:"3",altText:"3",altTextAlign:"left"}),new L({id:"4",x:60,y:0,alignX:"right",alignY:"center",shape:"round",keyboardButton:"4",altText:"4",altTextAlign:"right"}),new L({id:"1",x:40,y:-20,alignX:"right",alignY:"center",shape:"round",keyboardButton:"1",altText:"1",altTextAlign:"bottom"}),new L({id:"2",x:40,y:20,alignX:"right",alignY:"center",shape:"round",keyboardButton:"2",altText:"2",altTextAlign:"top"})]);break;case"2":this.addElements([new R({id:"filler2",x:40,y:0,alignX:"right",alignY:"center"}),new R({id:"filler1",x:40,y:0,alignX:"left",alignY:"center"}),new L({id:"C",x:20,y:0,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowLeft",altText:"◀",altTextAlign:"right"}),new L({id:"D",x:60,y:0,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowRight",altText:"▶",altTextAlign:"left"}),new L({id:"A",x:40,y:-20,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowUp",altText:"▲",altTextAlign:"bottom"}),new L({id:"B",x:40,y:20,alignX:"left",alignY:"center",shape:"square",keyboardButton:"ArrowDown",altText:"▼",altTextAlign:"top"}),new L({id:"3",x:20,y:0,alignX:"right",alignY:"center",shape:"square",keyboardButton:"3"}),new L({id:"4",x:60,y:0,alignX:"right",alignY:"center",shape:"square",keyboardButton:"4"}),new L({id:"1",x:40,y:-20,alignX:"right",alignY:"center",shape:"square",keyboardButton:"1"}),new L({id:"2",x:40,y:20,alignX:"right",alignY:"center",shape:"square",keyboardButton:"2"})]);break;case"9":this.addElements([new G({id:"left",x:40,y:0,alignX:"left",alignY:"center",lockX:!0,bindUp:"ArrowUp",bindDown:"ArrowDown"}),new G({id:"right",x:40,y:0,alignX:"right",alignY:"center",lockY:!0,bindLeft:"ArrowLeft",bindRight:"ArrowRight"})])}}}]),t}();exports.Gamepad=N;
-},{}],"d6sW":[function(require,module,exports) {
-"use strict";var e=require("./uBit"),t=require("./notification"),o=require("./gamepad");function n(e){return(n="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 r(e,t){return s(e)||l(e,t)||c(e,t)||a()}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){if(e){if("string"==typeof e)return i(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function l(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,r,a,c,i=[],l=!0,s=!1;try{if(a=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;l=!1}else for(;!(l=(n=a.call(o)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(u){s=!0,r=u}finally{try{if(!l&&null!=o.return&&(c=o.return(),Object(c)!==c))return}finally{if(s)throw r}}return i}}function s(e){if(Array.isArray(e))return e}function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?u(Object(o),!0).forEach(function(t){g(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function g(e,t,o){return(t=b(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function b(e){var t=m(e,"string");return"symbol"===n(t)?t:String(t)}function m(e,t){if("object"!==n(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var h="service-worker.js";navigator.serviceWorker&&navigator.serviceWorker.register(h,{scope:"/microbit-gamepad/"}).then(function(e){e.onupdatefound=function(){var o=e.installing;null!=o&&(o.onstatechange=function(){"installed"===o.state&&(navigator.serviceWorker.controller?(0,t.notif_info)("New content is available, relaunch the app to install it."):(0,t.notif_success)("Content is cached for offline use."))})},e.update()}).catch(function(e){(0,t.notif_warn)("Could not install service worker..."),console.error("Error during service worker registration:",e)}),document.getElementById("btn_ignore_landscape_warning").addEventListener("click",function(){document.body.classList.add("ignore-landscape-warning")}),navigator.bluetooth||(console.error("You do not have a bluetooth enabled browser, you need to have a bluetooth enabled browser..."),(0,t.notif_alert)("Your browser does not seem to support bluetooth, try using Google Chrome or Microsoft Edge."));var S=new o.Gamepad;window.gamepad=S;var y=new e.uBitBLE;window.ubit=y,document.querySelector(".settings-dialog #layout").addEventListener("change",function(e){S.setGamepadLayout(e.target.value),localStorage.setItem("gamepadLayout",e.target.value),document.querySelector(".button-states pre").innerHTML="No buttons pressed yet"}),null===localStorage.getItem("gamepadLayout")&&localStorage.setItem("gamepadLayout","1"),S.setGamepadLayout(localStorage.getItem("gamepadLayout")),document.querySelector(".button-states pre").innerHTML="No buttons pressed yet",document.querySelector(".settings-dialog #layout").value=localStorage.getItem("gamepadLayout"),document.querySelector(".settings-dialog #show-touches").addEventListener("change",function(e){S.stage.showTouches=e.target.checked,localStorage.setItem("showTouches",e.target.checked)}),null===localStorage.getItem("showTouches")&&localStorage.setItem("showTouches",!1),S.stage.showTouches="true"==localStorage.getItem("showTouches"),document.querySelector(".settings-dialog #show-touches").checked="true"==localStorage.getItem("showTouches"),document.querySelector(".settings-dialog #show-gamepad-alt-text").addEventListener("change",function(e){S.showAltText=e.target.checked,localStorage.setItem("showAltText",e.target.checked)}),null===localStorage.getItem("showAltText")&&localStorage.setItem("showAltText",!1),S.showAltText="true"==localStorage.getItem("showAltText"),document.querySelector(".settings-dialog #show-gamepad-alt-text").checked="true"==localStorage.getItem("showAltText"),document.querySelector(".settings-dialog #enable-haptic").addEventListener("change",function(e){S.enableVibration=e.target.checked,localStorage.setItem("enableHaptic",e.target.checked)}),null===localStorage.getItem("enableHaptic")&&localStorage.setItem("enableHaptic",!0),S.enableVibration="true"==localStorage.getItem("enableHaptic"),document.querySelector(".settings-dialog #enable-haptic").checked="true"==localStorage.getItem("enableHaptic"),document.querySelector(".settings-dialog #enable-debug").addEventListener("change",function(e){S.showDebug=e.target.checked,e.target.checked?document.body.classList.add("debug"):document.body.classList.remove("debug"),localStorage.setItem("enableDebug",e.target.checked)}),null===localStorage.getItem("enableDebug")&&localStorage.setItem("enableDebug",!1),S.showDebug="true"==localStorage.getItem("enableDebug"),"true"===localStorage.getItem("enableDebug")?document.body.classList.add("debug"):document.body.classList.remove("debug"),document.querySelector(".settings-dialog #enable-debug").checked="true"==localStorage.getItem("enableDebug"),document.querySelector("#btn_show_settings").addEventListener("click",function(){document.querySelector(".settings-dialog").classList.add("shown")}),document.querySelector("#btn_hide_settings").addEventListener("click",function(){document.querySelector(".settings-dialog").classList.remove("shown")}),document.querySelector("#btn_disconnect").addEventListener("click",function(){y.disconnect()}),document.getElementById("btn_connect").addEventListener("click",function(){navigator.bluetooth||(0,t.notif_alert)("You need a bluetooth enabled browser for this app to work, try chrome."),y.searchDevice()});var f={};S.onTouchEvent(function(e){["touchstart","touchmove"].includes(e.action)&&(f[e.id]=d({state:!0},e)),["touchend"].includes(e.action)&&(f[e.id]=d({state:!1},e));for(var t="",o=0,n=Object.entries(f);o<n.length;o++){var a=r(n[o],2),c=a[0],i=a[1];t+="".concat(c,": ").concat(i.state?"Pressed":"Not pressed"),i.hasOwnProperty("x")&&(t+=" (x: ".concat(i.x,", y: ").concat(i.y,")")),t+="\n"}document.querySelector(".button-states pre").innerHTML=t}),S.onTouchEvent(function(t){var o=e.MESEvents.MES_DPAD_CONTROLLER_ID,n=null;"touchstart"==t.action?"A"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_A_DOWN:"B"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_B_DOWN:"C"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_C_DOWN:"D"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_D_DOWN:"1"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_1_DOWN:"2"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_2_DOWN:"3"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_3_DOWN:"4"==t.id&&(n=e.MESEvents.MES_DPAD_BUTTON_4_DOWN):"touchend"==t.action&&("A"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_A_UP:"B"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_B_UP:"C"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_C_UP:"D"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_D_UP:"1"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_1_UP:"2"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_2_UP:"3"==t.id?n=e.MESEvents.MES_DPAD_BUTTON_3_UP:"4"==t.id&&(n=e.MESEvents.MES_DPAD_BUTTON_4_UP)),y.isConnected()&&null!=n&&y.eventService.sendEvent(o,n)}),y.onConnect(function(){document.body.classList.add("connected")}),y.onDisconnect(function(){document.body.classList.remove("connected")});
-},{"./uBit":"COPm","./notification":"SiMs","./gamepad":"W7Xq"}]},{},["d6sW"], null)
-//# sourceMappingURL=/microbit-gamepad/main.cf2d245a.js.map \ No newline at end of file