aboutsummaryrefslogtreecommitdiff
path: root/main.a4da0525.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.a4da0525.js')
-rw-r--r--main.a4da0525.js13
1 files changed, 0 insertions, 13 deletions
diff --git a/main.a4da0525.js b/main.a4da0525.js
deleted file mode 100644
index 5d55f92..0000000
--- a/main.a4da0525.js
+++ /dev/null
@@ -1,13 +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}({"thIN":[function(require,module,exports) {
-var define;
-var t;!function(i,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof t&&t.amd?t("nipplejs",[],e):"object"==typeof exports?exports.nipplejs=e():i.nipplejs=e()}(window,function(){return function(t){var i={};function e(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(o,n,function(i){return t[i]}.bind(null,n));return o},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0)}([function(t,i,e){"use strict";e.r(i);var o,n=function(t,i){var e=i.x-t.x,o=i.y-t.y;return Math.sqrt(e*e+o*o)},s=function(t){return t*(Math.PI/180)},r=function(t,i,e){for(var o,n=i.split(/[ ,]+/g),s=0;s<n.length;s+=1)o=n[s],t.addEventListener?t.addEventListener(o,e,!1):t.attachEvent&&t.attachEvent(o,e)},d=function(t,i,e){for(var o,n=i.split(/[ ,]+/g),s=0;s<n.length;s+=1)o=n[s],t.removeEventListener?t.removeEventListener(o,e):t.detachEvent&&t.detachEvent(o,e)},a=function(t){return t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t},p=function(){return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},c=function(t,i){i.top||i.right||i.bottom||i.left?(t.style.top=i.top,t.style.right=i.right,t.style.bottom=i.bottom,t.style.left=i.left):(t.style.left=i.x+"px",t.style.top=i.y+"px")},h=function(t,i,e){var o=l(t);for(var n in o)if(o.hasOwnProperty(n))if("string"==typeof i)o[n]=i+" "+e;else{for(var s="",r=0,d=i.length;r<d;r+=1)s+=i[r]+" "+e+", ";o[n]=s.slice(0,-2)}return o},l=function(t){var i={};return i[t]="",["webkit","Moz","o"].forEach(function(e){i[e+t.charAt(0).toUpperCase()+t.slice(1)]=""}),i},u=function(t,i){for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e]);return t},f=function(t,i){if(t.length)for(var e=0,o=t.length;e<o;e+=1)i(t[e]);else i(t)},y=!!("ontouchstart"in window),m=!!window.PointerEvent,v=!!window.MSPointerEvent,g={start:"mousedown",move:"mousemove",end:"mouseup"},b={};function x(){}m?o={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:v?o={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:y?(o={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},b=g):o=g,x.prototype.on=function(t,i){var e,o=t.split(/[ ,]+/g);this._handlers_=this._handlers_||{};for(var n=0;n<o.length;n+=1)e=o[n],this._handlers_[e]=this._handlers_[e]||[],this._handlers_[e].push(i);return this},x.prototype.off=function(t,i){return this._handlers_=this._handlers_||{},void 0===t?this._handlers_={}:void 0===i?this._handlers_[t]=null:this._handlers_[t]&&this._handlers_[t].indexOf(i)>=0&&this._handlers_[t].splice(this._handlers_[t].indexOf(i),1),this},x.prototype.trigger=function(t,i){var e,o=this,n=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var s=0;s<n.length;s+=1)e=n[s],o._handlers_[e]&&o._handlers_[e].length&&o._handlers_[e].forEach(function(t){t.call(o,{type:e,target:o},i)})},x.prototype.config=function(t){this.options=this.defaults||{},t&&(this.options=function(t,i){var e={};for(var o in t)t.hasOwnProperty(o)&&i.hasOwnProperty(o)?e[o]=i[o]:t.hasOwnProperty(o)&&(e[o]=t[o]);return e}(this.options,t))},x.prototype.bindEvt=function(t,i){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[i]=function(){"function"==typeof e["on"+i]?e["on"+i].apply(e,arguments):console.warn('[WARNING] : Missing "on'+i+'" handler.')},r(t,o[i],e._domHandlers_[i]),b[i]&&r(t,b[i],e._domHandlers_[i]),e},x.prototype.unbindEvt=function(t,i){return this._domHandlers_=this._domHandlers_||{},d(t,o[i],this._domHandlers_[i]),b[i]&&d(t,b[i],this._domHandlers_[i]),delete this._domHandlers_[i],this};var O=x;function _(t,i){return this.identifier=i.identifier,this.position=i.position,this.frontPosition=i.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(i),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=_.id,_.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}_.prototype=new O,_.constructor=_,_.id=0,_.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)},_.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",i=function(t,i){var e=l("borderRadius");for(var o in e)e.hasOwnProperty(o)&&(e[o]="50%");return e}(),e=h("transition","opacity",t),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:this.options.color,opacity:".5"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:this.options.color,opacity:".5"},u(o.el,e),"circle"===this.options.shape&&u(o.back,i),u(o.front,i),this.applyStyles(o),this},_.prototype.applyStyles=function(t){for(var i in this.ui)if(this.ui.hasOwnProperty(i))for(var e in t[i])this.ui[i].style[e]=t[i][e];return this},_.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)},_.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)},_.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},_.prototype.show=function(t){var i=this;return i.options.dataOnly?i:(clearTimeout(i.removeTimeout),clearTimeout(i.showTimeout),clearTimeout(i.restTimeout),i.addToDom(),i.restCallback(),setTimeout(function(){i.ui.el.style.opacity=1},0),i.showTimeout=setTimeout(function(){i.trigger("shown",i.instance),"function"==typeof t&&t.call(this)},i.options.fadeTime),i)},_.prototype.hide=function(t){var i=this;return i.options.dataOnly?i:(i.ui.el.style.opacity=i.options.restOpacity,clearTimeout(i.removeTimeout),clearTimeout(i.showTimeout),clearTimeout(i.restTimeout),i.removeTimeout=setTimeout(function(){var e="dynamic"===i.options.mode?"none":"block";i.ui.el.style.display=e,"function"==typeof t&&t.call(i),i.trigger("hidden",i.instance)},i.options.fadeTime),i.options.restJoystick&&i.setPosition(t,{x:0,y:0}),i)},_.prototype.setPosition=function(t,i){var e=this;e.frontPosition={x:i.x,y:i.y};var o=e.options.fadeTime+"ms",n={};n.front=h("transition",["top","left"],o);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(n),e.applyStyles(s),e.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(e),e.restCallback()},e.options.fadeTime)},_.prototype.restCallback=function(){var t={};t.front=h("transition","none",""),this.applyStyles(t),this.trigger("rested",this.instance)},_.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},_.prototype.computeDirection=function(t){var i,e,o,n=t.angle.radian,s=Math.PI/4,r=Math.PI/2;if(n>s&&n<3*s&&!t.lockX?i="up":n>-s&&n<=s&&!t.lockY?i="left":n>3*-s&&n<=-s&&!t.lockX?i="down":t.lockY||(i="right"),t.lockY||(e=n>-r&&n<r?"left":"right"),t.lockX||(o=n>0?"up":"down"),t.force>this.options.threshold){var d,a={};for(d in this.direction)this.direction.hasOwnProperty(d)&&(a[d]=this.direction[d]);var p={};for(d in this.direction={x:e,y:o,angle:i},t.direction=this.direction,a)a[d]===this.direction[d]&&(p[d]=!0);if(p.x&&p.y&&p.angle)return t;p.x&&p.y||this.trigger("plain",t),p.x||this.trigger("plain:"+e,t),p.y||this.trigger("plain:"+o,t),p.angle||this.trigger("dir dir:"+i,t)}else this.resetDirection();return t};var w=_;function T(t,i){return this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=t,this.id=T.id,T.id+=1,this.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1},this.config(i),"static"!==this.options.mode&&"semi"!==this.options.mode||(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}T.prototype=new O,T.constructor=T,T.id=0,T.prototype.prepareNipples=function(){var t=this.nipples;t.on=this.on.bind(this),t.off=this.off.bind(this),t.options=this.options,t.destroy=this.destroy.bind(this),t.ids=this.ids,t.id=this.id,t.processOnMove=this.processOnMove.bind(this),t.processOnEnd=this.processOnEnd.bind(this),t.get=function(i){if(void 0===i)return t[0];for(var e=0,o=t.length;e<o;e+=1)if(t[e].identifier===i)return t[e];return!1}},T.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},T.prototype.begin=function(){var t=this.options;if("static"===t.mode){var i=this.createNipple(t.position,this.manager.getIdentifier());i.add(),this.idles.push(i)}},T.prototype.createNipple=function(t,i){var e=p(),o={},n=this.options;if(t.x&&t.y)o={x:t.x-(e.x+this.box.left),y:t.y-(e.y+this.box.top)};else if(t.top||t.right||t.bottom||t.left){var s=document.createElement("DIV");s.style.display="hidden",s.style.top=t.top,s.style.right=t.right,s.style.bottom=t.bottom,s.style.left=t.left,s.style.position="absolute",n.zone.appendChild(s);var r=s.getBoundingClientRect();n.zone.removeChild(s),o=t,t={x:r.left+e.x,y:r.top+e.y}}var d=new w(this,{color:n.color,size:n.size,threshold:n.threshold,fadeTime:n.fadeTime,dataOnly:n.dataOnly,restJoystick:n.restJoystick,restOpacity:n.restOpacity,mode:n.mode,identifier:i,position:t,zone:n.zone,frontPosition:{x:0,y:0},shape:n.shape});return n.dataOnly||(c(d.ui.el,o),c(d.ui.front,d.frontPosition)),this.nipples.push(d),this.trigger("added "+d.identifier+":added",d),this.manager.trigger("added "+d.identifier+":added",d),this.bindNipple(d),d},T.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},T.prototype.bindNipple=function(t){var i,e=this,o=function(t,o){i=t.type+" "+o.id+":"+t.type,e.trigger(i,o)};t.on("destroyed",e.onDestroyed.bind(e)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},T.prototype.pressureFn=function(t,i,e){var o=this,n=0;clearInterval(o.pressureIntervals[e]),o.pressureIntervals[e]=setInterval(function(){var e=t.force||t.pressure||t.webkitForce||0;e!==n&&(i.trigger("pressure",e),o.trigger("pressure "+i.identifier+":pressure",e),n=e)}.bind(o),100)},T.prototype.onstart=function(t){var i=this,e=i.options,o=t;return t=a(t),i.updateBox(),f(t,function(n){i.actives.length<e.maxNumberOfNipples?i.processOnStart(n):o.type.match(/^touch/)&&(Object.keys(i.manager.ids).forEach(function(e){if(Object.values(o.touches).findIndex(function(t){return t.identifier===e})<0){var n=[t[0]];n.identifier=e,i.processOnEnd(n)}}),i.actives.length<e.maxNumberOfNipples&&i.processOnStart(n))}),i.manager.bindDocument(),!1},T.prototype.processOnStart=function(t){var i,e=this,o=e.options,s=e.manager.getIdentifier(t),r=t.force||t.pressure||t.webkitForce||0,d={x:t.pageX,y:t.pageY},a=e.getOrCreate(s,d);a.identifier!==s&&e.manager.removeIdentifier(a.identifier),a.identifier=s;var p=function(i){i.trigger("start",i),e.trigger("start "+i.id+":start",i),i.show(),r>0&&e.pressureFn(t,i,i.identifier),e.processOnMove(t)};if((i=e.idles.indexOf(a))>=0&&e.idles.splice(i,1),e.actives.push(a),e.ids.push(a.identifier),"semi"!==o.mode)p(a);else{if(!(n(d,a.position)<=o.catchDistance))return a.destroy(),void e.processOnStart(t);p(a)}return a},T.prototype.getOrCreate=function(t,i){var e,o=this.options;return/(semi|static)/.test(o.mode)?(e=this.idles[0])?(this.idles.splice(0,1),e):"semi"===o.mode?this.createNipple(i,t):(console.warn("Coudln't find the needed nipple."),!1):e=this.createNipple(i,t)},T.prototype.processOnMove=function(t){var i=this.options,e=this.manager.getIdentifier(t),o=this.nipples.get(e);if(function(t){return isNaN(t.buttons)?0!==t.pressure:0!==t.buttons}(t)){if(!o)return console.error("Found zombie joystick with ID "+e),void this.manager.removeIdentifier(e);if(i.dynamicPage){var r=p();a=o.el.getBoundingClientRect(),o.position={x:r.x+a.left,y:r.y+a.top}}o.identifier=e;var d=o.options.size/2,a={x:t.pageX,y:t.pageY};i.lockX&&(a.y=o.position.y),i.lockY&&(a.x=o.position.x);var h,l,u,f,y,m,v,g,b=n(a,o.position),x=(h=a,u=(l=o.position).x-h.x,f=l.y-h.y,function(t){return t*(180/Math.PI)}(Math.atan2(f,u))),O=s(x),_=b/d,w={distance:b,position:a};"circle"===o.options.shape?(b=Math.min(b,d),y=o.position,m=b,g={x:0,y:0},v=s(v=x),g.x=y.x-m*Math.cos(v),g.y=y.y-m*Math.sin(v),a=g):(a=function(t,i,e){return{x:Math.min(Math.max(t.x,i.x-e),i.x+e),y:Math.min(Math.max(t.y,i.y-e),i.y+e)}}(a,o.position,d),b=n(a,o.position));var T=a.x-o.position.x,k=a.y-o.position.y;o.frontPosition={x:T,y:k},i.dataOnly||c(o.ui.front,o.frontPosition);var P={identifier:o.identifier,position:a,force:_,pressure:t.force||t.pressure||t.webkitForce||0,distance:b,angle:{radian:O,degree:x},vector:{x:T/d,y:-k/d},raw:w,instance:o,lockX:i.lockX,lockY:i.lockY};(P=o.computeDirection(P)).angle={radian:s(180-x),degree:180-x},o.trigger("move",P),this.trigger("move "+o.id+":move",P)}else this.processOnEnd(t)},T.prototype.processOnEnd=function(t){var i=this,e=i.options,o=i.manager.getIdentifier(t),n=i.nipples.get(o),s=i.manager.removeIdentifier(n.identifier);n&&(e.dataOnly||n.hide(function(){"dynamic"===e.mode&&(n.trigger("removed",n),i.trigger("removed "+n.id+":removed",n),i.manager.trigger("removed "+n.id+":removed",n),n.destroy())}),clearInterval(i.pressureIntervals[n.identifier]),n.resetDirection(),n.trigger("end",n),i.trigger("end "+n.id+":end",n),i.ids.indexOf(n.identifier)>=0&&i.ids.splice(i.ids.indexOf(n.identifier),1),i.actives.indexOf(n)>=0&&i.actives.splice(i.actives.indexOf(n),1),/(semi|static)/.test(e.mode)?i.idles.push(n):i.nipples.indexOf(n)>=0&&i.nipples.splice(i.nipples.indexOf(n),1),i.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(i.manager.ids[s.id]=s.identifier))},T.prototype.onDestroyed=function(t,i){this.nipples.indexOf(i)>=0&&this.nipples.splice(this.nipples.indexOf(i),1),this.actives.indexOf(i)>=0&&this.actives.splice(this.actives.indexOf(i),1),this.idles.indexOf(i)>=0&&this.idles.splice(this.idles.indexOf(i),1),this.ids.indexOf(i.identifier)>=0&&this.ids.splice(this.ids.indexOf(i.identifier),1),this.manager.removeIdentifier(i.identifier),this.manager.unbindDocument()},T.prototype.destroy=function(){for(var t in this.unbindEvt(this.options.zone,"start"),this.nipples.forEach(function(t){t.destroy()}),this.pressureIntervals)this.pressureIntervals.hasOwnProperty(t)&&clearInterval(this.pressureIntervals[t]);this.trigger("destroyed",this.nipples),this.manager.unbindDocument(),this.off()};var k=T;function P(t){var i,e=this;return e.ids={},e.index=0,e.collections=[],e.config(t),e.prepareCollections(),r(window,"resize",function(t){clearTimeout(i),i=setTimeout(function(){var t,i=p();e.collections.forEach(function(e){e.forEach(function(e){t=e.el.getBoundingClientRect(),e.position={x:i.x+t.left,y:i.y+t.top}})})},100)}),e.collections}P.prototype=new O,P.constructor=P,P.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(i){var e;return t.collections.every(function(t){return!(e=t.get(i))}),e}},P.prototype.create=function(t){return this.createCollection(t)},P.prototype.createCollection=function(t){var i=new k(this,t);return this.bindCollection(i),this.collections.push(i),i},P.prototype.bindCollection=function(t){var i,e=this,o=function(t,o){i=t.type+" "+o.id+":"+t.type,e.trigger(i,o)};t.on("destroyed",e.onDestroyed.bind(e)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},P.prototype.bindDocument=function(){this.binded||(this.bindEvt(document,"move").bindEvt(document,"end"),this.binded=!0)},P.prototype.unbindDocument=function(t){Object.keys(this.ids).length&&!0!==t||(this.unbindEvt(document,"move").unbindEvt(document,"end"),this.binded=!1)},P.prototype.getIdentifier=function(t){var i;return t?void 0===(i=void 0===t.identifier?t.pointerId:t.identifier)&&(i=this.latest||0):i=this.index,void 0===this.ids[i]&&(this.ids[i]=this.index,this.index+=1),this.latest=i,this.ids[i]},P.prototype.removeIdentifier=function(t){var i={};for(var e in this.ids)if(this.ids[e]===t){i.id=e,i.identifier=this.ids[e],delete this.ids[e];break}return i},P.prototype.onmove=function(t){return this.onAny("move",t),!1},P.prototype.onend=function(t){return this.onAny("end",t),!1},P.prototype.oncancel=function(t){return this.onAny("end",t),!1},P.prototype.onAny=function(t,i){var e,o=this,n="processOn"+t.charAt(0).toUpperCase()+t.slice(1);return i=a(i),f(i,function(t){e=o.getIdentifier(t),f(o.collections,function(t,i,e){e.ids.indexOf(i)>=0&&(e[n](t),t._found_=!0)}.bind(null,t,e)),t._found_||o.removeIdentifier(e)}),!1},P.prototype.destroy=function(){this.unbindDocument(!0),this.ids={},this.index=0,this.collections.forEach(function(t){t.destroy()}),this.off()},P.prototype.onDestroyed=function(t,i){if(this.collections.indexOf(i)<0)return!1;this.collections.splice(this.collections.indexOf(i),1)};var E=new P;i.default={create:function(t){return E.create(t)},factory:E}}]).default});
-},{}],"GaXO":[function(require,module,exports) {
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.requestMicrobit=exports.getServices=void 0;var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};function t(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function n(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{s(r.next(e))}catch(e){a(e)}}function u(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,u)}s((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}var i,a=function(){function e(e){void 0===e&&(e=1),this.concurrent=e,this.queue=[],this.running=0}return e.prototype.pump=function(){return n(this,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:if(this.running>=this.concurrent)return[2];if(!(e=this.queue.shift()))return[2];this.running++,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.fn()];case 2:return t=r.sent(),e.resolve(t),[3,4];case 3:return n=r.sent(),e.reject(n),[3,4];case 4:return this.running--,[2,this.pump()]}})})},e.prototype.add=function(e){var t=this;return new Promise(function(n,r){return t.queue.push({fn:e,resolve:n,reject:r}),t.pump()})},e}(),o=function(){function e(e,t){this.service=e,this.emitter=t}return e.prototype.getCharacteristic=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return this.characteristics?[3,2]:(t=this,[4,this.service.getCharacteristics()]);case 1:t.characteristics=n.sent(),n.label=2;case 2:return[2,this.characteristics.find(function(t){return t.uuid===e})]}})})},e.prototype.getCharacteristicValue=function(t){return n(this,void 0,void 0,function(){var i,a=this;return r(this,function(o){switch(o.label){case 0:return[4,this.getCharacteristic(t)];case 1:if(!(i=o.sent()))throw new Error("Unable to locate characteristic");return[4,e.queue.add(function(){return n(a,void 0,void 0,function(){return r(this,function(e){return[2,i.readValue()]})})})];case 2:return[2,o.sent()]}})})},e.prototype.setCharacteristicValue=function(t,i){return n(this,void 0,void 0,function(){var a,o=this;return r(this,function(u){switch(u.label){case 0:return[4,this.getCharacteristic(t)];case 1:if(!(a=u.sent()))throw new Error("Unable to locate characteristic");return[4,e.queue.add(function(){return n(o,void 0,void 0,function(){return r(this,function(e){return[2,a.writeValue(i)]})})})];case 2:return u.sent(),[2]}})})},e.prototype.handleListener=function(t,i,a){return n(this,void 0,void 0,function(){var o,u=this;return r(this,function(s){switch(s.label){case 0:return[4,this.getCharacteristic(i)];case 1:return(o=s.sent())?[4,e.queue.add(function(){return n(u,void 0,void 0,function(){return r(this,function(e){return[2,o.startNotifications()]})})})]:[2];case 2:return s.sent(),this.emitter.on("newListener",function(i){if(!(i!==t||u.emitter.listenerCount(t)>0))return e.queue.add(function(){return n(u,void 0,void 0,function(){return r(this,function(e){return[2,o.addEventListener("characteristicvaluechanged",a)]})})})}),this.emitter.on("removeListener",function(i){if(!(i!==t||u.emitter.listenerCount(t)>0))return e.queue.add(function(){return n(u,void 0,void 0,function(){return r(this,function(e){return[2,o.removeEventListener("characteristicvaluechanged",a)]})})})}),[2]}})})},e.queue=new a,e}();!function(e){e.modelNumber="00002a24-0000-1000-8000-00805f9b34fb",e.serialNumber="00002a25-0000-1000-8000-00805f9b34fb",e.firmwareRevision="00002a26-0000-1000-8000-00805f9b34fb",e.hardwareRevision="00002a27-0000-1000-8000-00805f9b34fb",e.manufacturer="00002a29-0000-1000-8000-00805f9b34fb"}(i||(i={}));var u=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.prototype.readDeviceInformation=function(){return n(this,void 0,void 0,function(){var e,t,n,a,o,u;return r(this,function(r){switch(r.label){case 0:return e={},[4,this.readStringCharacteristic(i.modelNumber)];case 1:return(t=r.sent())&&(e.modelNumber=t),[4,this.readStringCharacteristic(i.serialNumber)];case 2:return(n=r.sent())&&(e.serialNumber=n),[4,this.readStringCharacteristic(i.firmwareRevision)];case 3:return(a=r.sent())&&(e.firmwareRevision=a),[4,this.readStringCharacteristic(i.hardwareRevision)];case 4:return(o=r.sent())&&(e.hardwareRevision=o),[4,this.readStringCharacteristic(i.manufacturer)];case 5:return(u=r.sent())&&(e.manufacturer=u),[2,e]}})})},e.prototype.readStringCharacteristic=function(e){return n(this,void 0,void 0,function(){var t,n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.helper.getCharacteristicValue(e)];case 1:return t=r.sent(),n=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),[2,String.fromCharCode.apply(null,Array.from(new Uint8Array(n)))];case 2:return r.sent(),[2,void 0];case 3:return[2]}})})},e.uuid="0000180a-0000-1000-8000-00805f9b34fb",e}();function s(){}function c(){c.init.call(this)}function h(e){return void 0===e._maxListeners?c.defaultMaxListeners:e._maxListeners}function f(e,t,n){if(t)e.call(n);else for(var r=e.length,i=y(e,r),a=0;a<r;++a)i[a].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,a=y(e,i),o=0;o<i;++o)a[o].call(n,r)}function l(e,t,n,r,i){if(t)e.call(n,r,i);else for(var a=e.length,o=y(e,a),u=0;u<a;++u)o[u].call(n,r,i)}function v(e,t,n,r,i,a){if(t)e.call(n,r,i,a);else for(var o=e.length,u=y(e,o),s=0;s<o;++s)u[s].call(n,r,i,a)}function p(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,a=y(e,i),o=0;o<i;++o)a[o].apply(n,r)}function g(e,t,n,r){var i,a,o,u;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]):(a=e._events=new s,e._eventsCount=0),o){if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=h(e))&&i>0&&o.length>i){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,"function"==typeof console.warn?console.warn(u):console.log(u)}}else o=a[t]=n,++e._eventsCount;return e}function m(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function w(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function y(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}s.prototype=Object.create(null),c.EventEmitter=c,c.usingDomains=!1,c.prototype.domain=void 0,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.init=function(){this.domain=null,c.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new s,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},c.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},c.prototype.getMaxListeners=function(){return h(this)},c.prototype.emit=function(e){var t,n,r,i,a,o,u,s="error"===e;if(o=this._events)s=s&&null==o.error;else if(!s)return!1;if(u=this.domain,s){if(t=arguments[1],!u){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=u,t.domainThrown=!1,u.emit("error",t),!1}if(!(n=o[e]))return!1;var h="function"==typeof n;switch(r=arguments.length){case 1:f(n,h,this);break;case 2:d(n,h,this,arguments[1]);break;case 3:l(n,h,this,arguments[1],arguments[2]);break;case 4:v(n,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),a=1;a<r;a++)i[a-1]=arguments[a];p(n,h,this,i)}return!0},c.prototype.addListener=function(e,t){return g(this,e,t,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,t){return g(this,e,t,!0)},c.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,m(this,e,t)),this},c.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,m(this,e,t)),this},c.prototype.removeListener=function(e,t){var n,r,i,a,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new s:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new s,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,o||t)}return this},c.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new s,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new s:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),a=0;a<i.length;++a)"removeListener"!==(r=i[a])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new s,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},c.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},c.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):w.call(e,t)},c.prototype.listenerCount=w,c.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var b,C,V=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.isEventListenerObject=function(e){return void 0!==e.handleEvent},t}return t(n,e),n.prototype.addEventListener=function(t,n){if(n){var r=this.isEventListenerObject(n)?n.handleEvent:n;e.prototype.addListener.call(this,t,r)}},n.prototype.removeEventListener=function(t,n){if(n){var r=this.isEventListenerObject(n)?n.handleEvent:n;e.prototype.removeListener.call(this,t,r)}},n.prototype.dispatchEvent=function(t,n){var r;return r="string"==typeof t?new CustomEvent(t,{detail:n}):t,e.prototype.emit.call(this,r.type,r)},n}(c);!function(e){e.buttonAState="e95dda90-251d-470a-a062-fa1922dfa9a8",e.buttonBState="e95dda91-251d-470a-a062-fa1922dfa9a8"}(b||(b={})),function(e){e[e.Release=0]="Release",e[e.ShortPress=1]="ShortPress",e[e.LongPress=2]="LongPress"}(C||(C={}));var L,D=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("buttonastatechanged",b.buttonAState,this.buttonAStateChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("buttonbstatechanged",b.buttonBState,this.buttonBStateChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.readButtonAState=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(b.buttonAState)];case 1:return[2,e.sent().getUint8(0)]}})})},i.prototype.readButtonBState=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(b.buttonBState)];case 1:return[2,e.sent().getUint8(0)]}})})},i.prototype.buttonAStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonastatechanged",t.getUint8(0))},i.prototype.buttonBStateChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("buttonbstatechanged",t.getUint8(0))},i.uuid="e95d9882-251d-470a-a062-fa1922dfa9a8",i}(V);!function(e){e.ledMatrixState="e95d7b77-251d-470a-a062-fa1922dfa9a8",e.ledText="e95d93ee-251d-470a-a062-fa1922dfa9a8",e.scrollingDelay="e95d0d2d-251d-470a-a062-fa1922dfa9a8"}(L||(L={}));var S,E=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.prototype.writeText=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.encodeString(e),[2,this.helper.setCharacteristicValue(L.ledText,t)]})})},e.prototype.readMatrixState=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(L.ledMatrixState)];case 1:return e=t.sent(),[2,this.viewToLedMatrix(e)]}})})},e.prototype.writeMatrixState=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.ledMatrixToView(e),[2,this.helper.setCharacteristicValue(L.ledMatrixState,t)]})})},e.prototype.getScrollingDelay=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(L.scrollingDelay)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},e.prototype.setScrollingDelay=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(L.scrollingDelay,t)]})})},e.prototype.encodeString=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return t},e.prototype.viewToLedMatrix=function(e){for(var t=[],n=0;n<5;n++)t[n]=this.byteToBoolArray(e.getUint8(n));return t},e.prototype.byteToBoolArray=function(e){for(var t=[!1,!1,!1,!1,!1],n=0;n<t.length;n++)t[n]=1==(1&e),e>>=1;return t.reverse()},e.prototype.ledMatrixToView=function(e){for(var t=new DataView(new ArrayBuffer(5)),n=0;n<5;n++)t.setUint8(n,this.boolArrayToByte(e[n]));return t},e.prototype.boolArrayToByte=function(e){return e.reduce(function(e,t){return e<<1|(t?1:0)},0)},e.uuid="e95dd91d-251d-470a-a062-fa1922dfa9a8",e}();!function(e){e.temperature="e95d9250-251d-470a-a062-fa1922dfa9a8",e.temperaturePeriod="e95d1b25-251d-470a-a062-fa1922dfa9a8"}(S||(S={}));var A,x=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("temperaturechanged",S.temperature,this.temperatureChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readTemperature=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(S.temperature)];case 1:return[2,e.sent().getInt8(0)]}})})},i.prototype.getTemperaturePeriod=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(S.temperaturePeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setTemperaturePeriod=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[4,this.helper.setCharacteristicValue(S.temperaturePeriod,t)];case 1:return[2,n.sent()]}})})},i.prototype.temperatureChangedHandler=function(e){var t=e.target.value;this.dispatchEvent("temperaturechanged",t.getInt8(0))},i.uuid="e95d6100-251d-470a-a062-fa1922dfa9a8",i}(V);!function(e){e.accelerometerData="e95dca4b-251d-470a-a062-fa1922dfa9a8",e.accelerometerPeriod="e95dfb24-251d-470a-a062-fa1922dfa9a8"}(A||(A={}));var T,U,_=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("accelerometerdatachanged",A.accelerometerData,this.accelerometerDataChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readAccelerometerData=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(A.accelerometerData)];case 1:return e=t.sent(),[2,this.dataViewToAccelerometerData(e)]}})})},i.prototype.getAccelerometerPeriod=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(A.accelerometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setAccelerometerPeriod=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(A.accelerometerPeriod,t)]})})},i.prototype.accelerometerDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToAccelerometerData(t);this.dispatchEvent("accelerometerdatachanged",n)},i.prototype.dataViewToAccelerometerData=function(e){return{x:e.getInt16(0,!0)/1e3,y:e.getInt16(2,!0)/1e3,z:e.getInt16(4,!0)/1e3}},i.uuid="e95d0753-251d-470a-a062-fa1922dfa9a8",i}(V);!function(e){e.magnetometerData="e95dfb11-251d-470a-a062-fa1922dfa9a8",e.magnetometerPeriod="e95d386c-251d-470a-a062-fa1922dfa9a8",e.magnetometerBearing="e95d9715-251d-470a-a062-fa1922dfa9a8",e.magnetometerCalibration="e95db358-251d-470a-a062-fa1922dfa9a8"}(T||(T={})),function(e){e[e.unknown=0]="unknown",e[e.requested=1]="requested",e[e.completed=2]="completed",e[e.errored=3]="errored"}(U||(U={}));var B,P,M,q=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("magnetometerdatachanged",T.magnetometerData,this.magnetometerDataChangedHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("magnetometerbearingchanged",T.magnetometerBearing,this.magnetometerBearingChangedHandler.bind(this))];case 2:return e.sent(),[4,this.helper.handleListener("magnetometercalibrationchanged",T.magnetometerCalibration,this.magnetometerCalibrationChangedHandler.bind(this))];case 3:return e.sent(),[2]}})})},i.prototype.calibrate=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.helper.setCharacteristicValue(T.magnetometerCalibration,new Uint8Array([1]))]})})},i.prototype.readMagnetometerData=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(T.magnetometerData)];case 1:return e=t.sent(),[2,this.dataViewToMagnetometerData(e)]}})})},i.prototype.readMagnetometerBearing=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(T.magnetometerBearing)];case 1:return 2===(e=t.sent()).byteLength?[2,e.getUint16(0,!0)]:[2,void 0]}})})},i.prototype.getMagnetometerPeriod=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.getCharacteristicValue(T.magnetometerPeriod)];case 1:return[2,e.sent().getUint16(0,!0)]}})})},i.prototype.setMagnetometerPeriod=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return(t=new DataView(new ArrayBuffer(2))).setUint16(0,e,!0),[2,this.helper.setCharacteristicValue(T.magnetometerPeriod,t)]})})},i.prototype.magnetometerDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToMagnetometerData(t);this.dispatchEvent("magnetometerdatachanged",n)},i.prototype.magnetometerBearingChangedHandler=function(e){var t=e.target.value;2===t.byteLength&&this.dispatchEvent("magnetometerbearingchanged",t.getUint16(0,!0))},i.prototype.magnetometerCalibrationChangedHandler=function(e){var t=e.target.value;1===t.byteLength&&this.dispatchEvent("magnetometercalibrationchanged",t.getUint8(0))},i.prototype.dataViewToMagnetometerData=function(e){return{x:e.getInt16(0,!0),y:e.getInt16(1,!0),z:e.getInt16(2,!0)}},i.uuid="e95df2d8-251d-470a-a062-fa1922dfa9a8",i}(V);!function(e){e.pinData="e95d8d00-251d-470a-a062-fa1922dfa9a8",e.pinAdConfiguration="e95d5899-251d-470a-a062-fa1922dfa9a8",e.pinIoConfiguration="e95db9fe-251d-470a-a062-fa1922dfa9a8",e.pwmControl="e95dd822-251d-470a-a062-fa1922dfa9a8"}(B||(B={})),function(e){e[e.Digital=0]="Digital",e[e.Analogue=1]="Analogue"}(P||(P={})),function(e){e[e.Output=0]="Output",e[e.Input=1]="Input"}(M||(M={}));var H,R=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("pindatachanged",B.pinData,this.pinDataChangedHandler.bind(this))];case 1:return e.sent(),[2]}})})},i.prototype.readPinData=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.pinData)];case 1:return e=t.sent(),[2,this.dataViewToPinData(e)]}})})},i.prototype.writePinData=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.pinDataToDataView(e),[2,this.helper.setCharacteristicValue(B.pinData,t)]})})},i.prototype.getAdConfiguration=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.pinAdConfiguration)];case 1:return e=t.sent(),[2,this.dataViewToConfig(e)]}})})},i.prototype.setAdConfiguration=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.configToDataView(e),[2,this.helper.setCharacteristicValue(B.pinAdConfiguration,t)]})})},i.prototype.getIoConfiguration=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(B.pinIoConfiguration)];case 1:return e=t.sent(),[2,this.dataViewToConfig(e)]}})})},i.prototype.setIoConfiguration=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.configToDataView(e),[2,this.helper.setCharacteristicValue(B.pinIoConfiguration,t)]})})},i.prototype.setPwmControl=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=this.pwmControlDataToDataView(e),[2,this.helper.setCharacteristicValue(B.pwmControl,t)]})})},i.prototype.pinDataChangedHandler=function(e){var t=e.target.value,n=this.dataViewToPinData(t);this.dispatchEvent("pindatachanged",n)},i.prototype.dataViewToPinData=function(e){for(var t=[],n=0;n<e.byteLength;n+=2)t.push({pin:e.getUint8(n),value:e.getUint8(n+1)});return t},i.prototype.pinDataToDataView=function(e){var t=new DataView(new ArrayBuffer(2*e.length));return e.forEach(function(e,n){t.setUint8(2*n,e.pin),t.setUint8(2*n+1,e.value)}),t},i.prototype.dataViewToConfig=function(e){for(var t=[],n=(e.getUint16(0)<<8)+e.getUint8(2),r=0;r<24;r++)t.push(n>>r);return t},i.prototype.configToDataView=function(e){for(var t=new DataView(new ArrayBuffer(3)),n=0,r=0;r<e.length;r++)n&=1<<e[r];return t.setUint16(0,n>>8,!0),t.setUint8(2,255&n),t},i.prototype.pwmControlDataToDataView=function(e){var t=new DataView(new ArrayBuffer(7));return t.setUint8(0,e.pin),t.setUint16(1,e.value,!0),t.setUint32(3,e.period,!0),t},i.uuid="e95d127b-251d-470a-a062-fa1922dfa9a8",i}(V);!function(e){e.tx="6e400002-b5a3-f393-e0a9-e50e24dcca9e",e.rx="6e400003-b5a3-f393-e0a9-e50e24dcca9e"}(H||(H={}));var I,O=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("receive",H.tx,this.receiveHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("receiveText",H.tx,this.receiveTextHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.send=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return[2,this.helper.setCharacteristicValue(H.rx,e)]})})},i.prototype.sendText=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return t=e.split("").map(function(e){return e.charCodeAt(0)}),[2,this.helper.setCharacteristicValue(H.rx,new Uint8Array(t).buffer)]})})},i.prototype.receiveHandler=function(e){var t=e.target.value,n=new Uint8Array(t.buffer);this.dispatchEvent("receive",n)},i.prototype.receiveTextHandler=function(e){var t=e.target.value,n=Array.prototype.slice.call(new Uint8Array(t.buffer)),r=String.fromCharCode.apply(null,n);this.dispatchEvent("receiveText",r)},i.uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e",i}(V);!function(e){e.microBitRequirements="e95db84c-251d-470a-a062-fa1922dfa9a8",e.microBitEvent="e95d9775-251d-470a-a062-fa1922dfa9a8",e.clientRequirements="e95d23c4-251d-470a-a062-fa1922dfa9a8",e.clientEvent="e95d5404-251d-470a-a062-fa1922dfa9a8"}(I||(I={}));var k,j=function(e){function i(t){var n=e.call(this)||this;return n.helper=new o(t,n),n}return t(i,e),i.create=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return[4,(t=new i(e)).init()];case 1:return n.sent(),[2,t]}})})},i.prototype.init=function(){return n(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.helper.handleListener("microbitevent",I.microBitEvent,this.eventHandler.bind(this))];case 1:return e.sent(),[4,this.helper.handleListener("microbitrequirementschanged",I.microBitRequirements,this.microbitRequirementsChangedHandler.bind(this))];case 2:return e.sent(),[2]}})})},i.prototype.getMicrobitRequirements=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(I.microBitRequirements)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},i.prototype.setClientRequirements=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return(n=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),n.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(I.clientRequirements,n)];case 1:return[2,r.sent()]}})})},i.prototype.readMicrobitEvent=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.helper.getCharacteristicValue(I.microBitEvent)];case 1:return e=t.sent(),[2,this.viewToMicrobitEvent(e)]}})})},i.prototype.writeClientEvent=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return(n=new DataView(new ArrayBuffer(4))).setUint16(0,e,!0),n.setUint16(1,t,!0),[4,this.helper.setCharacteristicValue(I.clientEvent,n)];case 1:return[2,r.sent()]}})})},i.prototype.microbitRequirementsChangedHandler=function(e){var t=e.target.value,n=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitrequirementschanged",n)},i.prototype.eventHandler=function(e){var t=e.target.value,n=this.viewToMicrobitEvent(t);this.dispatchEvent("microbitevent",n)},i.prototype.viewToMicrobitEvent=function(e){return{type:e.getUint16(0,!0),value:e.getUint16(1,!0)}},i.uuid="e95d93af-251d-470a-a062-fa1922dfa9a8",i}(V);(k||(k={})).dfuControl="e95d93b1-251d-470a-a062-fa1922dfa9a8";var N=function(){function e(e){this.helper=new o(e)}return e.create=function(t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,new e(t)]})})},e.prototype.requestDfu=function(){return this.helper.setCharacteristicValue(k.dfuControl,new Uint8Array([1]))},e.prototype.requestFlashCode=function(){return this.helper.setCharacteristicValue(k.dfuControl,new Uint8Array([2]))},e.uuid="e95d93b0-251d-470a-a062-fa1922dfa9a8",e}(),z=function(){function e(e){this.services=e}return e.prototype.createService=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return(t=this.services.find(function(t){return t.uuid===e.uuid}))?[4,e.create(t)]:[2,void 0];case 1:return[2,n.sent()]}})})},e}(),F=function(e){return n(void 0,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,e.requestDevice({filters:[{namePrefix:"BBC micro:bit"}],optionalServices:[u.uuid,D.uuid,E.uuid,x.uuid,_.uuid,q.uuid,R.uuid,O.uuid,j.uuid,N.uuid]})];case 1:return[2,t.sent()]}})})},G=function(e){return n(void 0,void 0,void 0,function(){var t,n,i,a,o,s,c,h,f,d,l,v;return r(this,function(r){switch(r.label){case 0:return e&&e.gatt?e.gatt.connected?[3,2]:[4,e.gatt.connect()]:[2,{}];case 1:r.sent(),r.label=2;case 2:return[4,e.gatt.getPrimaryServices()];case 3:return t=r.sent(),[4,(n=new z(t)).createService(u)];case 4:return i=r.sent(),[4,n.createService(D)];case 5:return a=r.sent(),[4,n.createService(E)];case 6:return o=r.sent(),[4,n.createService(x)];case 7:return s=r.sent(),[4,n.createService(_)];case 8:return c=r.sent(),[4,n.createService(q)];case 9:return h=r.sent(),[4,n.createService(O)];case 10:return f=r.sent(),[4,n.createService(j)];case 11:return d=r.sent(),[4,n.createService(N)];case 12:return l=r.sent(),[4,n.createService(R)];case 13:return v=r.sent(),[2,{deviceInformationService:i,buttonService:a,ledService:o,temperatureService:s,accelerometerService:c,magnetometerService:h,uartService:f,eventService:d,dfuControlService:l,ioPinService:v}]}})})};exports.getServices=G,exports.requestMicrobit=F;
-},{}],"SiMs":[function(require,module,exports) {
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.notif_alert=a,exports.notif_warn=i,exports.notif_info=c,exports.notif_success=l;let e=void 0,t=[];function n(a){let 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(()=>{(screen.availHeight<screen.availWidth||document.body.classList.contains("ignore-landscape-warning"))&&(clearInterval(e),e=void 0,n(t.pop()))},1e3),void t.push(a);let c=document.createElement("div");c.className="notification",c.appendChild(a[0]),c.appendChild(a[1]),i.appendChild(c),setTimeout(()=>{i.removeChild(c),t.length>0&&n(t.pop())},5e3)}else t.push(a)}function a(e){let t=document.createElement("div");t.className="notification-content";let a=document.createElement("p");a.innerHTML=e,t.appendChild(a);let i=document.createElement("i");i.className="alert fas fa-exclamation-triangle",t.appendChild(i),n([i,t])}function i(e){let t=document.createElement("div");t.className="notification-content";let a=document.createElement("p");a.innerHTML=e,t.appendChild(a);let i=document.createElement("i");i.className="warning fas fa-exclamation-triangle",t.appendChild(i),n([i,t])}function c(e){let t=document.createElement("div");t.className="notification-content";let a=document.createElement("p");a.innerHTML=e,t.appendChild(a);let i=document.createElement("i");i.className="info fas fa-info-circle",t.appendChild(i),n([i,t])}function l(e){let t=document.createElement("div");t.className="notification-content";let a=document.createElement("p");a.innerHTML=e,t.appendChild(a);let i=document.createElement("i");i.className="success fas fa-check-circle",t.appendChild(i),n([i,t])}
-},{}],"CLny":[function(require,module,exports) {
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./notification");function t(e,t){var s=t.get(e);if(!s)throw new TypeError("attempted to get private field on non-instance");return s.get?s.get.call(e):s.value}function s(e,t,s){var r=t.get(e);if(!r)throw new TypeError("attempted to set private field on non-instance");if(r.set)r.set.call(e,s);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=s}return s}var r=new WeakMap,a=new WeakMap,i=new WeakMap,n=new WeakMap,l=new WeakMap,o=new WeakMap;class h{constructor(){r.set(this,{writable:!0,value:0}),a.set(this,{writable:!0,value:0}),i.set(this,{writable:!0,value:0}),n.set(this,{writable:!0,value:0}),l.set(this,{writable:!0,value:0}),o.set(this,{writable:!0,value:0})}acc(e){e.match(/[A-Z][-,0-9]+/g).forEach((e,r)=>{switch(e.substring(0,1)){case"T":s(this,a,parseInt(e.substring(1,e.length)));break;case"R":s(this,n,parseInt(e.substring(1,e.length)));break;case"A":s(this,o,1==parseInt(e.substring(1,e.length))),t(this,o)?document.body.classList.add("armed"):document.body.classList.remove("armed");break;case"S":break;default:console.log(`Unkown acc: ${e}`)}}),document.querySelector(".acc-string pre").innerHTML=`T: ${t(this,a)}, R: ${t(this,n)}`}reset(){this.setArm(0),this.setThrottle(0),this.setRudder(0)}setThrottle(e){t(this,o)&&(e>100&&(e=100),e<0&&(e=0),s(this,r,e))}getThrottle(){return t(this,r)}setRudder(e){t(this,o)&&(e>90&&(e=90),e<-90&&(e=-90),s(this,i,e))}getRudder(){return t(this,i)}setArm(e){s(this,l,e),t(this,l)||(s(this,r,0),s(this,i,0))}getArm(){return t(this,l)}}exports.default=h;
-},{"./notification":"SiMs"}],"d6sW":[function(require,module,exports) {
-"use strict";var e=r(require("nipplejs")),t=require("microbit-web-bluetooth"),n=r(require("./hoverControlModule")),o=require("./notification");function r(e){return e&&e.__esModule?e:{default:e}}let i="service-worker.js";navigator.serviceWorker&&navigator.serviceWorker.register(i,{scope:"/hoverbit-ble/"}).then(e=>{e.onupdatefound=(()=>{const t=e.installing;null!=t&&(t.onstatechange=(()=>{"installed"===t.state&&(navigator.serviceWorker.controller?(0,o.notif_info)("New content is available, relaunch the app to install it."):(0,o.notif_success)("Content is cached for offline use."))}))}),e.update()}).catch(e=>{(0,o.notif_alert)("Could not install service worker..."),console.error("Error during service worker registration:",e)}),document.getElementById("btn_ignore_landscape_warning").addEventListener("click",()=>{document.body.classList.add("ignore-landscape-warning")});let c,a,d=new n.default,s=e.default.create({zone:document.querySelector(".joystick-left"),size:200,position:{left:"50%",bottom:"50%"},mode:"static",lockX:!0}),l=e.default.create({zone:document.querySelector(".joystick-right"),size:200,position:{left:"50%",bottom:"50%"},mode:"static",lockY:!0});s.on("move",(e,t)=>{let n=90*t.distance/100;t.angle.degree>90&&(n*=-1),d.setRudder(n)}),s.on("end",(e,t)=>{d.setRudder(0)}),l.on("move",(e,t)=>{let n=t.distance;t.angle.degree>90&&(n=0,t.distance>=100&&(d.reset(),d.getArm()&&(0,o.notif_alert)("Detected panicy reducing of throttle, dearming..."))),d.setThrottle(n)}),l.on("end",(e,t)=>{d.setThrottle(0)}),document.getElementById("btn_arm").addEventListener("click",()=>{d.setArm(!0)}),document.getElementById("btn_disarm").addEventListener("click",()=>{d.setArm(!1)}),document.querySelector("#btn_disconnect").addEventListener("click",()=>{d.reset(),c.gatt.disconnect()});let u=setInterval(()=>{void 0!==c&&c?c.gatt.connected?document.body.classList.add("connected"):(document.body.classList.remove("connected"),document.body.classList.remove("armed")):void 0!==c&&c.gatt.reconnect()},500),v=setInterval(async()=>{if(void 0!==c&&c&&c.gatt.connected&&a.uartService){let e="T"+d.getThrottle().toString()+"R"+d.getRudder().toString()+"A"+(d.getArm()?"1":"0")+"S0:";await a.uartService.sendText(e)}},70);function g(e){var t=document.querySelector(".ping i"),n=t.cloneNode(!0);if(t.parentNode.replaceChild(n,t),-1!=e.detail.indexOf(":")){let t=e.detail.split(":");"B"==t[0]?document.querySelector(".battery-status").innerHTML=t[1]+"mV":"ACC"==t[0]?d.acc(t[1]):console.log(t)}else(0,o.notif_warn)("Received weird data from MICRO:BIT..."),console.log(`Received unknown: ${e.detail}`)}document.getElementById("btn_connect").onclick=(async()=>{void 0!==c&&c.gatt.connected&&c.disconnect();const e=await(0,t.requestMicrobit)(window.navigator.bluetooth);if(c=e,e){d.reset();const n=await(0,t.getServices)(e);(a=n).deviceInformationService,n.uartService&&n.uartService.addEventListener("receiveText",g)}});
-},{"nipplejs":"thIN","microbit-web-bluetooth":"GaXO","./hoverControlModule":"CLny","./notification":"SiMs"}]},{},["d6sW"], null)
-//# sourceMappingURL=/hoverbit-ble/main.a4da0525.js.map \ No newline at end of file