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]=`1b38c461-05a1-47b0-8457-1f121a59c06e`,e._sentryDebugIdIdentifier=`sentry-dbid-1b38c461-05a1-47b0-8457-1f121a59c06e`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{Ag as t,Dg as n,Fg as r,Ig as i,Kl as a,dn as o,eh as s,hn as c,lh as l,or as u,sh as d,wg as f}from"./entry.client-dr7r6s9a.js";import{n as p,t as m}from"./useAnnouncement-cz71ehgy.js";import{n as h,t as g}from"./DialogShell-k2jpaw9r.js";var _=e(u(),1),v=r(),y=e(i(),1),b=t(),x=o(e=>{let t=(0,v.c)(21),{devices:n,isLoading:r,onPair:i,onTryAgain:a}=e,{t:o}=l(`BluetoothScanDevicesDialog`),{locAccessibilityItemEnumeration:u,locTryAgain:d}=s(),f;if(n&&n.length>0){let e;t[0]===o?e=t[1]:(e=o(`We've found these controllers`,{shortKey:`weve_found_controllers`}),t[0]=o,t[1]=e),f=e}else{let e;t[2]===o?e=t[3]:(e=o(`No controllers found`,{shortKey:`no_controllers_found`}),t[2]=o,t[3]=e),f=e}if(m(f),r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,b.jsx)(`div`,{className:`mb-4 text-noninteractive-content-primary-content !type-display1`,children:`\xA0`})}),t[4]=e):e=t[4],e}let p;t[5]===f?p=t[6]:(p=(0,b.jsx)(`div`,{className:`mb-4 text-noninteractive-content-primary-content !type-display1`,children:f}),t[5]=f,t[6]=p);let h;t[7]!==n.length||t[8]!==o?(h=n.length>0&&(0,b.jsx)(`div`,{className:`mb-8 text-noninteractive-content-primary-content type-subtitle1`,children:o(`Select which controller you would like to pair`,{shortKey:`select_controller_to_pair`})}),t[7]=n.length,t[8]=o,t[9]=h):h=t[9];let _;t[10]!==n||t[11]!==o||t[12]!==i||t[13]!==u||t[14]!==d||t[15]!==a?(_=n.length>0?(0,b.jsx)(g.ScrollContainer,{className:`relative flex h-full flex-col overflow-y-auto overflow-x-hidden rounded-md p-2 [--scrollbar-track-margin-top:var(--modal-spacing)]`,children:n.map((e,t)=>{let r=e.name.trim()||o(`Wireless Controller`,{shortKey:`btscan_default_controller_name`});return(0,b.jsx)(c,{as:`button`,onPress:()=>i(e.macAddress),className:`mb-4 !min-h-component-item-menu-min-height w-full justify-start text-center text-noninteractive-content-primary-content !type-title2`,"aria-label":u(r,t+1,n.length),children:(0,b.jsx)(`div`,{className:`text-noninteractive-content-primary-content !type-section2`,children:r})},t)})}):(0,b.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:(0,b.jsx)(c,{as:`button`,onPress:a,className:`min-w-component-action-text-standard-min-width`,"data-auto-focus":!0,"aria-label":u(d(),1,1),children:d()})}),t[10]=n,t[11]=o,t[12]=i,t[13]=u,t[14]=d,t[15]=a,t[16]=_):_=t[16];let y;return t[17]!==p||t[18]!==h||t[19]!==_?(y=(0,b.jsxs)(b.Fragment,{children:[p,h,_]}),t[17]=p,t[18]=h,t[19]=_,t[20]=y):y=t[20],y},({onClose:e,...t})=>{let{bluetooth:r,dialog:{mutations:i}}=d(),{data:o,isLoading:s}=n(r.queries.scannedDevices.getOptions()),{mutate:c}=f(i.goBack.getOptions()),[l,u]=(0,y.useState)(!1);return{devices:o||[],isLoading:s,onPair:t=>{l||(e?.(t),c(),u(!0))},onTryAgain:()=>{l||(e?.(void 0,a.NoDevicesFoundScan),c(),u(!0))},...t}}),S=e=>{let t=(0,v.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r=h.useComponent(),i=x.useComponent(),a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,_.default)(`modal-generic modal-floating flex h-[740px] w-[1020px] flex-col gap-layout-vertical-related-content-in-a-section-loose bg-container-backgrounds-elevation-background-level-2 bg-cover pb-[0px] pe-layout-horizontal-margin ps-layout-horizontal-margin pt-[60px]`),t[2]=a):a=t[2];let o;t[3]!==i||t[4]!==n?(o=(0,b.jsx)(p,{children:(0,b.jsx)(i,{...n})}),t[3]=i,t[4]=n,t[5]=o):o=t[5];let s;return t[6]!==r||t[7]!==o?(s=(0,b.jsx)(r,{className:a,children:o}),t[6]=r,t[7]=o,t[8]=s):s=t[8],s};export{S as BluetoothScanDevicesDialog,S as default};