try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`9958b509-fe91-4464-9295-b642299dc144`,e._sentryDebugIdIdentifier=`sentry-dbid-9958b509-fe91-4464-9295-b642299dc144`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{Cm as e,Oh as t,Sm as n,zs as r}from"./entry.client-dr7r6s9a.js";var i=class{requestor;hasMouseDevice=!1;hasKeyboardDevice=!1;registerForDeviceChange=async(e,t)=>{this.requestor||this.setupDeviceEventListeners(e,t)};hasMouseSupport(){return this.hasMouseDevice}hasKeyboardSupport(){return this.hasKeyboardDevice}getDeviceTypeCounts(){let e=navigator.getGamepads();return{gamepads:Array.from(e).filter(e=>e!==null).length,mouse:+!!this.hasMouseDevice,keyboard:+!!this.hasKeyboardDevice}}async fetchDevices(){let t=[],r=navigator.getGamepads();for(let e=0;e<r.length;e++)if(r[e]){let r=n(e);t.push(r)}if(this.detectInputModeDevices(),this.hasMouseDevice||this.hasKeyboardDevice){let n=e();t.push(n)}return t}setupDeviceEventListeners(e,t){this.requestor=new r(`device-manager-adaptor`,100).setProcessGamepadConnect(t=>{e({accessoryId:t.toString()})}).setProcessGamepadDisconnect(e=>{t({accessoryId:e.toString()})}).setProcessKeyboardInput((e,t)=>{this.hasKeyboardDevice=!0}).setProcessInputModeChange((e,t,n,r)=>{(r===`mouse`||t===`passive-mouse`)&&(this.hasMouseDevice=!0)}).build(),this.requestor.register(),this.requestor.enableGamepadTracking(),this.requestor.enableKeyboardTracking()}detectInputModeDevices(){let e=t.getActiveInputMode(),n=t.getDetailedInputMode();!this.hasMouseDevice&&(e===`mouse`||n===`passive-mouse`)&&(this.hasMouseDevice=!0),!this.hasKeyboardDevice&&(e===`keyboard`||e===`tab`)&&(this.hasKeyboardDevice=!0)}};export{i as WebDeviceManagerAdaptor};