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