export default function(t,u){const g=8;const m=28;const p=.04;globalThis.addEventListener(`gamepadconnected`,()=>{});t.env.getGamepads=n=>{const t=navigator.getGamepads();const e=u?u.memory:wasm_memory;const a=new Float32Array(e.buffer);const o=new Uint32Array(e.buffer);const s=new Uint8Array(e.buffer);for(const[r,c]of t.slice(0,g).entries()){let t=n+m*r+1;if(!c||!c.connected||c.mapping!=="standard"){s[t]=0;continue}s[t]=1;t+=3;let e=0;for(const[i,f]of c.buttons.entries()){if(i<17&&f.pressed)e|=1<{const s=navigator.getGamepads().find(t=>t?.index===e);s?.vibrationActuator?.playEffect("dual-rumble",{duration:t,startDelay:n,strongMagnitude:a,weakMagnitude:o})}}