"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[84348],{84348:function(e,n,t){t.r(n),t(84734);var a,o=t(22622),i=!1,c=!1,r=!1,d=!1,u=!1,s=!1,f=!1,l=!1,m=null,p=!1,v=!1,g=[12,13,14,15,0,1],w=function(){return p},b=function(e){var n=B(p,e,"GamepadA",13,!1,!0,m);p=e,e?null!=n&&(m=n):m=null},k=function(){return v},h=function(e){B(v,e,"GamepadB",27),v=e},G=function(e){B(i,e,"GamepadLeftThumbStickUp",38,!0),i=e},L=function(e){B(c,e,"GamepadLeftThumbStickDown",40,!0),c=e},E=function(e){B(r,e,"GamepadLeftThumbStickLeft",37,!0),r=e},D=function(e){B(d,e,"GamepadLeftThumbStickRight",39,!0),d=e},T=function(){return u},y=function(e){B(u,e,"GamepadDPadUp",38,!0),u=e},P=function(){return s},S=function(e){B(s,e,"GamepadDPadDown",40,!0),s=e},C=function(){return f},I=function(e){B(f,e,"GamepadDPadLeft",37,!0),f=e},x=function(){return l},A=function(e){B(l,e,"GamepadDPadRight",39,!0),l=e},F={},O={},R=-1!==navigator.userAgent.toLowerCase().indexOf("electron");function U(){return!(!R&&document.hidden)&&"Minimized"!==o.g.getWindowState()}function z(e,n,t){if(U()){var a=new Event(e,{bubbles:!0,cancelable:!0});return a.key=n,a.keyCode=t,(document.activeElement||document.body).dispatchEvent(a),a}}function B(e,n,t,a,o,i,c){var r,d=null;if(!0===n){var u=!1;!1===e?(u=!0,F[t]=0):o&&(u=function(e){var n=O[e]||0,t=(new Date).getTime();return 1===F[e]?t-n>=200:t-n>=40}(t)),u&&a&&(d=z("keydown",t,a),F[t]++,function(e){O[e]=(new Date).getTime()}(t))}else if(!1===n&&!0===e){var s;a&&(d=z("keyup",t,a)),!i||null!=c&&c.defaultPrevented||null!==(s=d)&&void 0!==s&&s.defaultPrevented||(r=document.activeElement||window,U()&&r.click())}return d}function M(){for(var e=navigator.getGamepads(),n=0,t=e.length;n<t;n++){var a=e[n];if(a){var o=a.axes,i=o[0],c=o[1];i>.75?D(!0):i<-.75?E(!0):c<-.75?G(!0):c>.75?L(!0):(E(!1),D(!1),G(!1),L(!1));for(var r=a.buttons,d=0,u=r.length;d<u;d++)if(-1!==g.indexOf(d))if(r[d].pressed)switch(d){case 12:y(!0);break;case 13:S(!0);break;case 14:I(!0);break;case 15:A(!0);break;case 0:b(!0);break;case 1:h(!0)}else switch(d){case 12:T()&&y(!1);break;case 13:P()&&S(!1);break;case 14:C()&&I(!1);break;case 15:x()&&A(!1);break;case 0:w()&&b(!1);break;case 1:k()&&h(!1)}}}}function N(){for(var e=navigator.getGamepads(),n=0,t=e.length;n<t;n++){var a=e[n];if(null!=a&&a.connected)return!0}return!1}function W(){N()&&document.hasFocus()&&(console.log("Gamepad connected! Starting input loop"),a||(a=setInterval(M,20)))}function j(){N()&&document.hasFocus()?console.log("Gamepad disconnected! There are gamepads still connected."):(console.log("Gamepad disconnected! No other gamepads are connected, stopping input loop"),clearInterval(a),a=void 0)}window.addEventListener("gamepaddisconnected",j),window.addEventListener("gamepadconnected",W),window.addEventListener("blur",j),window.addEventListener("focus",W),W(),window.navigator&&"string"==typeof window.navigator.gamepadInputEmulation&&(window.navigator.gamepadInputEmulation="gamepad")}}]);