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]=`796ba643-d314-4abd-a9ff-b7fc258c8797`,e._sentryDebugIdIdentifier=`sentry-dbid-796ba643-d314-4abd-a9ff-b7fc258c8797`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{ct as t,dt as n,ft as r,lt as i,mt as a,pt as o,ut as s}from"./xds-react-components-lks62tbl.js";import{En as c,Fg as l,Fn as u,Ig as d,Lm as f,Nn as p,Or as m,Pn as h,W as g,Xt as _,eh as v}from"./entry.client-dr7r6s9a.js";import{t as y}from"./useAButtonHandler-ftqyzpyw.js";import{n as b,t as x}from"./useYButtonHandler-fu1lospy.js";var S=e(d(),1),C=l(),w={a:y,b:c,x:b,y:x,menu:t,view:h,center:g,"left-bumper":o,"right-bumper":a,"dpad-down":i,"dpad-left":s,"dpad-right":n,"dpad-up":r,"left-stick-button":u(`left-stick-button`),"right-stick-button":u(`right-stick-button`)},T=(e,t=`release`,n,r)=>{let i=w[e??`x`];i(t,e&&n?n:()=>!1,r)},E=(e,t)=>{let n=t.includes(`alt`),r=t.includes(`shift`),i=t.includes(`ctrl`),a=t.includes(`win`);return e.altKey===n&&e.shiftKey===r&&e.ctrlKey===i&&e.metaKey===a},D=(e,t,n,r)=>{let i=(0,C.c)(6),a;i[0]===t?a=i[1]:(a=t===void 0?[]:t,i[0]=t,i[1]=a);let o=a,s=n===void 0?`press`:n,c;i[2]!==r||i[3]!==e||i[4]!==o?(c=t=>!r||!e||!E(t,o)?!1:r(),i[2]=r,i[3]=e,i[4]=o,i[5]=c):c=i[5],p(e??`Escape`,s,c)},O=(e,t,n)=>e?(n(t.sound),t.action(),!0):!1,k=(e,t)=>{let n=(0,C.c)(10),r=t===void 0?!0:t,i=m(),a=r&&i,{addAccelerator:o,removeAccelerator:s}=f(),{playSound:c}=_(),l,u;n[0]!==a||n[1]!==o||n[2]!==e||n[3]!==s?(l=()=>(a&&o(e),()=>{a&&s(e)}),u=[e,o,s,a],n[0]=a,n[1]=o,n[2]=e,n[3]=s,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,S.useEffect)(l,u);let d;n[6]!==a||n[7]!==e||n[8]!==c?(d=()=>O(a,e,c),n[6]=a,n[7]=e,n[8]=c,n[9]=d):d=n[9];let p=d;T(e.trigger.button,`release`,p)},A=(e,t)=>{let n=(0,C.c)(10),r=t===void 0?!0:t,i=m(),a=r&&i,{addAccelerator:o,removeAccelerator:s}=f(),{playSound:c}=_(),l,u;n[0]!==a||n[1]!==o||n[2]!==e||n[3]!==s?(l=()=>(a&&o(e),()=>{a&&s(e)}),u=[e,o,s,a],n[0]=a,n[1]=o,n[2]=e,n[3]=s,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,S.useEffect)(l,u);let d;n[6]!==a||n[7]!==e||n[8]!==c?(d=()=>O(a,e,c),n[6]=a,n[7]=e,n[8]=c,n[9]=d):d=n[9];let p=d;D(e.trigger.key,e.trigger.modifiers,`press`,p)};function j(e,t){let n=(0,C.c)(26),{locBack:r,locClose:i,locMoreOptions:a}=v(),o;bb0:switch(e){case`gamepad-back`:{let e;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(e={type:`gamepad`,button:`b`},n[0]=e):e=n[0];let i;n[1]===r?i=n[2]:(i=r(),n[1]=r,n[2]=i);let a;n[3]!==t||n[4]!==i?(a={trigger:e,action:t,sound:`back`,label:i},n[3]=t,n[4]=i,n[5]=a):a=n[5],o=a;break bb0}case`gamepad-close`:{let e;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(e={type:`gamepad`,button:`b`},n[6]=e):e=n[6];let r;n[7]===i?r=n[8]:(r=i(),n[7]=i,n[8]=r);let a;n[9]!==t||n[10]!==r?(a={trigger:e,action:t,sound:`overlayOut`,label:r},n[9]=t,n[10]=r,n[11]=a):a=n[11],o=a;break bb0}case`gamepad-context-menu`:{let e;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(e={type:`gamepad`,button:`menu`},n[12]=e):e=n[12];let r;n[13]===a?r=n[14]:(r=a(),n[13]=a,n[14]=r);let i;n[15]!==t||n[16]!==r?(i={trigger:e,action:t,sound:`invoke`,label:r},n[15]=t,n[16]=r,n[17]=i):i=n[17],o=i;break bb0}case`keyboard-back`:{let e;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],n[18]=e):e=n[18];let r;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(r={type:`keyboard`,key:`Escape`,modifiers:e},n[19]=r):r=n[19];let i;n[20]===t?i=n[21]:(i={trigger:r,action:t,sound:`back`,isHidden:!0},n[20]=t,n[21]=i),o=i;break bb0}case`keyboard-close`:{let e;n[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],n[22]=e):e=n[22];let r;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(r={type:`keyboard`,key:`Escape`,modifiers:e},n[23]=r):r=n[23];let i;n[24]===t?i=n[25]:(i={trigger:r,action:t,sound:`overlayOut`,isHidden:!0},n[24]=t,n[25]=i),o=i;break bb0}default:throw Error(`Unhandled accelerator kind: ${e}`)}return o}export{k as n,A as r,j as t};