const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/src-ln7rh653.js","assets/rolldown-runtime-eb2nym32.js","assets/entry.client-dr7r6s9a.js","assets/applicationManager-ieqxakm8.js","assets/connectionManager-d2rg2gp7.js","assets/ossNotices-nwqrwgqn.js","assets/LocationPermission-kane13ev.js","assets/NodeWrappers-d8d7hboq.js","assets/Styles-pe7l89m3.js","assets/ControllerPairingHeader-o5r7pkm4.js","assets/getControllerPairingRouterEnvironment-cyamx6ev.js","assets/routes-cum86uu1.js","assets/useControllerPairingCommonTranslation-lqkd50h0.js","assets/useShouldUseDialogNavigation-m43o5g92.js","assets/privileges-jro7zmhy.js","assets/useInitialFocusIn-fziws25j.js","assets/Announcer-ns276d3u.js","assets/useFindNewFocus-kskwmu1u.js","assets/BluetoothScan-cj84oib7.js","assets/useCloseHandler-ct51xnyg.js"])))=>i.map(i=>d[i]);
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]=`bc6f53a3-96a9-4ea3-a352-7ed340429633`,e._sentryDebugIdIdentifier=`sentry-dbid-bc6f53a3-96a9-4ea3-a352-7ed340429633`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{R as t}from"./vendor-misc-hfpbxrii.js";import{$d as n,Dg as r,Fg as i,Hh as a,Ig as o,Jh as s,Nf as c,Rh as ee,Ro as te,Tg as ne,Uh as re,Um as ie,kg as ae,mt as oe,sh as se,wg as l}from"./entry.client-dr7r6s9a.js";import{o as ce}from"./stream-gate-hooks-fa9kj8pw.js";import{Rt as u,zt as d}from"./workspace-leaf-files-mc5sghv7.js";import{r as f}from"./bluetoothManagerPlugin-lxlkwq70.js";var p=e(o(),1),le=i();function ue(e,t,n){let r;return r=e&&t?!n:!1,r}function de(e){let[t,n]=(0,p.useState)(!1),r=(0,p.useCallback)(async()=>{let{isBluetoothEnabled:e}=await s(async()=>{let{isBluetoothEnabled:e}=await import(`./src-ln7rh653.js`);return{isBluetoothEnabled:e}},__vite__mapDeps([0,1,2,3,4,5])),t=e(e=>{e.isEnabled&&(t.cancel(),n(!0))},()=>{})},[]);return(0,p.useEffect)(()=>{e&&r()},[r,e]),t}var m=null,h=null,g=null,_=null,v=null,y=null,b=null,fe=(e,t,n)=>{},pe=(e,t,n)=>{},me=(e,t)=>{m&&clearTimeout(m),m=setTimeout(()=>{m=null,e()},2e3)},he=(e,t,n)=>{let r={deviceName:`Test`,deviceAddress:`Address`,deviceClass:0};h&&clearTimeout(h),h=setTimeout(()=>{h=null,t(r)},2e3)},ge=(e,t)=>{let n=()=>{let t=document.createElement(`div`);t.style.cssText=`
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            border: 2px solid #ccc;
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
            z-index: 10000;
            font-family: Arial, sans-serif;
            max-width: 400px;
            text-align: center;
        `,t.innerHTML=`
            <div style="margin-bottom: 16px;">
                <strong>Allow Xbox to access this device's location?</strong>
            </div>
            <div style="margin-bottom: 20px; color: #666; font-size: 14px;">
                You can change this later in Settings > Apps
            </div>
            <div style="display: flex; flex-direction: column; gap: 8px;">
                <button id="whileUsing" style="padding: 8px 16px; background: #0078d4; color: white; border: none; border-radius: 4px; cursor: pointer;">While using the app</button>
                <button id="onlyOnce" style="padding: 8px 16px; background: #0078d4; color: white; border: none; border-radius: 4px; cursor: pointer;">Only this time</button>
                <button id="deny" style="padding: 8px 16px; background: #666; color: white; border: none; border-radius: 4px; cursor: pointer;">Deny</button>
                <button id="denyForever" style="padding: 8px 16px; background: #666; color: white; border: none; border-radius: 4px; cursor: pointer;">Deny and don't ask again</button>
            </div>
        `,document.body.appendChild(t);let n=()=>document.body.removeChild(t);t.querySelector(`#whileUsing`).addEventListener(`click`,()=>{n(),setTimeout(()=>e(!0),200)}),t.querySelector(`#onlyOnce`).addEventListener(`click`,()=>{n(),setTimeout(()=>e(!0),200)}),t.querySelector(`#deny`).addEventListener(`click`,()=>{n(),setTimeout(()=>e(!1),200)}),t.querySelector(`#denyForever`).addEventListener(`click`,()=>{n(),setTimeout(()=>e(!1),200)})};g&&clearTimeout(g),g=setTimeout(()=>{g=null,n()},500)},_e=(e,t)=>{_&&clearTimeout(_),_=setTimeout(()=>{_=null,e(!1)},100)},x=c.Idle,S=new Set,C=[{name:`Xbox Wireless Controller`,macAddress:`00:11:22:33:44:55`},{name:`Xbox Elite Controller`,macAddress:`AA:BB:CC:DD:EE:FF`},{name:`DualSense Wireless`,macAddress:`11:22:33:44:55:66`}],w=null,ve=e=>{w=e},ye=()=>x,be=e=>(S.add(e),()=>{S.delete(e)}),T=e=>{x=e,S.forEach(t=>t(e))},xe=()=>{v&&clearTimeout(v),y&&clearTimeout(y),T(c.Scanning),v=setTimeout(()=>{v=null,w&&w.setQueryData([`system`,`bluetooth`,`scannedDevices`],C),T(c.DeviceSelection)},2e3)},Se=e=>{b&&clearTimeout(b),T(c.Pairing),b=setTimeout(()=>{b=null,T(c.Paired)},1500)},Ce=()=>{v&&=(clearTimeout(v),null),y&&=(clearTimeout(y),null),b&&=(clearTimeout(b),null),T(c.Idle)},E=()=>globalThis?.plugins?.intentShim,D=e=>{switch(e){case u.Xbox:case u.XboxTakehome:return`controllerXboxSeriesXSDefault`;case u.Luna:return`controllerLunaDefault`;case u.Caccs:return`controllerGenericDefault`;case u.PlayStation:return`controllerPlaystationDualSenseDefault`;case u.Switch:return`controllerNintendoSwitchProDefault`;default:return`controllerGenericDefault`}},we=[`Xbox`,`Xbox Wireless Controller`],O=`045e`,Te=[`Luna`],k=`0171`,Ee=[`PLAYSTATION`,`PS3`,`DualSense`],A=`054c`,j=[`Pro Controller`],M=`057e`,N={[u.Xbox]:we,[u.Luna]:Te,[u.PlayStation]:Ee,[u.Switch]:j},De={[u.Xbox]:O,[u.Luna]:k,[u.PlayStation]:A,[u.Switch]:M},P=/Vendor:\s*([0-9a-fA-F]+)/,F=(e,t)=>{if(t?.isAccsId(e))return u.XboxTakehome;let n=e.match(P)?.[1],r=u.Other;return n&&Object.entries(De).forEach(([e,t])=>{if(n===t){r=u[e];return}}),Object.entries(N).forEach(([t,n])=>{if(n.some(t=>e.includes(t))){r=u[t];return}}),r};function I(e,t){return e===void 0&&t(`Plugin is not available`),e}var Oe=(e,t,n)=>{I(f(),n)?.bondDevice(e,t,n)},ke=(e,t,n)=>{I(f(),n)?.unbondDevice(e,t,n)},Ae=(e,t)=>{I(f(),t)?.stopScan(e,t)},je=(e,t,n)=>{I(f(),n)?.scanDevices(e,t,n)},Me=(e,t)=>{I(f(),t)?.hasLocationPermissions(e,t)},Ne=(e,t)=>{I(f(),t)?.requestLocationPermissions(e,t)},Pe=(e,t,n)=>{I(E(),n)?.startActivityForResult(e,t,n)},Fe=()=>ee();function L(e){let t=(0,p.lazy)(e);return t.preload=e,t}var R=L(()=>s(()=>import(`./LocationPermission-kane13ev.js`),__vite__mapDeps([6,1,2,7,8,9,10,11,12,13,14,15,16,17]))),z=L(()=>s(()=>import(`./BluetoothScan-cj84oib7.js`),__vite__mapDeps([18,1,2,8,9,10,11,19,12]))),B=e=>e===!0,Ie=()=>B(d.EnableWebOSInAppPairing);function Le(e,t){return e===`page`||e===`TVFireOSOnBrowser`||e===`TVSamsungOnBrowser`||e===`TVFireOSOnBrowserDialog`||e===`TVSamsungOnBrowserDialog`||e===`dialog`&&!!t}function V(){return(0,p.useContext)(Be)}var Re=(e,t,n)=>{let r=(0,le.c)(5),i,a;return r[0]!==e||r[1]!==n||r[2]!==t?(i=()=>{e?n(!0):!e&&t&&n(!1)},a=[t,e,n],r[0]=e,r[1]=n,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,p.useEffect)(i,a),e||!t},ze=(e,i,o,s,c,ee)=>{let u=(0,le.c)(87),{accs:d,bluetooth:f,deviceInformation:m,deviceStatus:h,dialog:g,onboarding:_}=se(),{mutations:v,queries:y,keys:b}=g,x;u[0]===d.queries.isAccsUxEnabled?x=u[1]:(x=d.queries.isAccsUxEnabled.getOptions(),u[0]=d.queries.isAccsUxEnabled,u[1]=x);let{data:S}=r(x),C;u[2]===d.queries.isCaccsUxEnabled?C=u[3]:(C=d.queries.isCaccsUxEnabled.getOptions(),u[2]=d.queries.isCaccsUxEnabled,u[3]=C);let{data:w}=r(C),T=Ie(),E=de(),D;u[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=a(),u[4]=D):D=u[4];let we=D,O;u[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=Fe(),u[5]=O):O=u[5];let Te=O,k;u[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=re(),u[6]=k):k=u[6];let Ee=k,A=oe(),j=ce(),M=ue(T,we,Te),{pathname:N}=ie(),[De]=t(n.controllerPairing),{redirectUri:P}=De,F;u[7]!==N||u[8]!==P||u[9]!==_.queries.onboardingNavigation?(F=_.queries.onboardingNavigation.getOptions({pathname:N,redirectUri:P}),u[7]=N,u[8]=P,u[9]=_.queries.onboardingNavigation,u[10]=F):F=u[10];let{data:I}=r(F),L;u[11]===m.queries.adaptor?L=u[12]:(L=m.queries.adaptor.getOptions(),u[11]=m.queries.adaptor,u[12]=L);let R;u[13]===h.queries.isLocalGamepadConnected?R=u[14]:(R=h.queries.isLocalGamepadConnected.getOptions(),u[13]=h.queries.isLocalGamepadConnected,u[14]=R);let z;u[15]===h.queries.isRemoteGamepadConnected?z=u[16]:(z=h.queries.isRemoteGamepadConnected.getOptions(),u[15]=h.queries.isRemoteGamepadConnected,u[16]=z);let B;u[17]===h.queries.isGamepadConnected?B=u[18]:(B=h.queries.isGamepadConnected.getOptions(),u[17]=h.queries.isGamepadConnected,u[18]=B);let V;u[19]!==L||u[20]!==R||u[21]!==z||u[22]!==B?(V={queries:[L,R,z,B]},u[19]=L,u[20]=R,u[21]=z,u[22]=B,u[23]=V):V=u[23];let[ze,Be,Ve,He]=ne(V),{data:H}=ze,{data:Ue}=Be,{data:We}=Ve,{data:Ge}=He,U=H.isTV,Ke=H.isFireOS,qe=H.isHomeOS,Je=H.isKepler,Ye=H.isWebOS,W;u[24]===v.open?W=u[25]:(W=v.open.getOptions(),u[24]=v.open,u[25]=W);let{mutate:Xe}=l(W),G;u[26]===f.queries.pairingState?G=u[27]:(G=f.queries.pairingState.getOptions(),u[26]=f.queries.pairingState,u[27]=G);let{data:Ze}=r(G),[Qe,$e]=(0,p.useState)(ye),K,q;u[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>be($e),q=[],u[28]=K,u[29]=q):(K=u[28],q=u[29]),(0,p.useEffect)(K,q);let J;u[30]===f.mutations.startDeviceScan?J=u[31]:(J=f.mutations.startDeviceScan.getOptions(),u[30]=f.mutations.startDeviceScan,u[31]=J);let{mutate:et}=l(J),tt;u[32]===f.mutations.pairDevice?tt=u[33]:(tt=f.mutations.pairDevice.getOptions(),u[32]=f.mutations.pairDevice,u[33]=tt);let{mutate:nt}=l(tt),rt;u[34]===f.mutations.resetPairingState?rt=u[35]:(rt=f.mutations.resetPairingState.getOptions(),u[34]=f.mutations.resetPairingState,u[35]=rt);let{mutate:it}=l(rt),at=ae(),Y=e===`TVFireOSOnBrowser`||e===`TVFireOSOnBrowserDialog`||e===`TVSamsungOnBrowser`||e===`TVSamsungOnBrowserDialog`,ot,st;u[36]!==Y||u[37]!==at?(ot=()=>(Y&&ve(at),()=>{Y&&ve(null)}),st=[Y,at],u[36]=Y,u[37]=at,u[38]=ot,u[39]=st):(ot=u[38],st=u[39]),(0,p.useEffect)(ot,st);let X;u[40]===v.goBack?X=u[41]:(X=v.goBack.getOptions(),u[40]=v.goBack,u[41]=X);let{mutate:Z}=l(X),ct;u[42]===Z?ct=u[43]:(ct=()=>{Z()},u[42]=Z,u[43]=ct);let lt=ct,ut=te(),dt=s??lt,ft;u[44]!==b.controllerPairing.fullPath||u[45]!==y.isDialogOpen?(ft=y.isDialogOpen.getOptions({key:b.controllerPairing.fullPath}),u[44]=b.controllerPairing.fullPath,u[45]=y.isDialogOpen,u[46]=ft):ft=u[46];let{data:pt}=r(ft),mt;u[47]!==b.bluetoothScanDevices.fullPath||u[48]!==y.isDialogOpen?(mt=y.isDialogOpen.getOptions({key:b.bluetoothScanDevices.fullPath}),u[47]=b.bluetoothScanDevices.fullPath,u[48]=y.isDialogOpen,u[49]=mt):mt=u[49];let{data:ht}=r(mt),[gt,_t]=(0,p.useState)(!1),vt=Re(pt,gt,_t),[yt,bt]=(0,p.useState)(!1),xt=Re(ht,yt,bt),St=I?.nextOnboardingFlowUrl,Q;u[50]!==e||u[51]!==U?(Q=Le(e,U),u[50]=e,u[51]=U,u[52]=Q):Q=u[52];let $;return u[53]!==A||u[54]!==i||u[55]!==S||u[56]!==w||u[57]!==T||u[58]!==Ge||u[59]!==j||u[60]!==Z||u[61]!==Ke||u[62]!==qe||u[63]!==Je||u[64]!==U||u[65]!==M||u[66]!==Ye||u[67]!==E||u[68]!==Ue||u[69]!==e||u[70]!==St||u[71]!==ee||u[72]!==dt||u[73]!==Xe||u[74]!==Ze||u[75]!==et||u[76]!==nt||u[77]!==it||u[78]!==vt||u[79]!==xt||u[80]!==We||u[81]!==o||u[82]!==ut||u[83]!==c||u[84]!==Q||u[85]!==Qe?($={activeInputMode:A,btBondDevice:Oe,btScanDevices:je,btStopScan:Ae,btUnbondDevice:ke,controllerType:i,featureGateEnableAccs:S,featureGateEnableCAccs:w,featureGateEnableWebOSInAppPairing:T,gamepadConnected:Ge,gamepadsInOrder:j,goBackForDialog:Z,hasBluetoothSupport:Te,hasFireOsApi:Ee,hasLocationPermissions:Me,hasTizenApi:we,isFireOS:Ke,isHomeOS:qe,isKepler:Je,isMocked:!1,isTV:U,isUsbConnection:M,isWebOS:Ye,isWebOSBluetoothEnabled:E,localGamepadConnected:Ue,navigationContext:e,nextOnboardingFlowUrl:St,onBack:ee,onClosed:dt,openDialog:Xe,pairingState:Ze,startDeviceScan:et,pairDevice:nt,resetPairingState:it,isPairingDialogCloseHandled:vt,isBTDialogCloseHandled:xt,remoteGamepadConnected:We,requestLocationPermissions:Ne,setControllerType:o,startActivityForResult:Pe,windowBreakpoint:ut,initialPath:c,fullscreen:Q},e===`TVFireOSOnBrowser`||e===`TVFireOSOnBrowserDialog`?($.isMocked=!0,$.hasBluetoothSupport=!0,$.hasFireOsApi=!0,$.hasTizenApi=!1,$.isFireOS=!0,$.isKepler=!1,$.isTV=!0,$.isWebOS=!1,$.isWebOSBluetoothEnabled=!1,$.navigationContext=e===`TVFireOSOnBrowser`?`page`:`dialog`,$.fullscreen=!0):(e===`TVSamsungOnBrowser`||e===`TVSamsungOnBrowserDialog`)&&($.isMocked=!0,$.hasBluetoothSupport=!0,$.hasFireOsApi=!1,$.hasTizenApi=!0,$.isFireOS=!1,$.isKepler=!1,$.isTV=!0,$.isWebOS=!1,$.isWebOSBluetoothEnabled=!1,$.navigationContext=e===`TVSamsungOnBrowser`?`page`:`dialog`,$.fullscreen=!0),$.isMocked&&($.btBondDevice=pe,$.btScanDevices=he,$.btStopScan=me,$.btUnbondDevice=fe,$.hasLocationPermissions=_e,$.requestLocationPermissions=ge,$.startDeviceScan=xe,$.pairDevice=Se,$.resetPairingState=Ce,$.pairingState=Qe),u[53]=A,u[54]=i,u[55]=S,u[56]=w,u[57]=T,u[58]=Ge,u[59]=j,u[60]=Z,u[61]=Ke,u[62]=qe,u[63]=Je,u[64]=U,u[65]=M,u[66]=Ye,u[67]=E,u[68]=Ue,u[69]=e,u[70]=St,u[71]=ee,u[72]=dt,u[73]=Xe,u[74]=Ze,u[75]=et,u[76]=nt,u[77]=it,u[78]=vt,u[79]=xt,u[80]=We,u[81]=o,u[82]=ut,u[83]=c,u[84]=Q,u[85]=Qe,u[86]=$):$=u[86],$},Be=(0,p.createContext)({activeInputMode:void 0,btBondDevice:void 0,btScanDevices:void 0,btStopScan:void 0,btUnbondDevice:void 0,controllerType:void 0,featureGateEnableAccs:void 0,featureGateEnableCAccs:void 0,featureGateEnableWebOSInAppPairing:void 0,gamepadConnected:void 0,gamepadsInOrder:void 0,hasBluetoothSupport:void 0,hasFireOsApi:void 0,hasLocationPermissions:void 0,hasTizenApi:void 0,isFireOS:void 0,isHomeOS:void 0,isKepler:void 0,isMocked:void 0,isTV:void 0,isUsbConnection:void 0,isWebOS:void 0,isWebOSBluetoothEnabled:void 0,localGamepadConnected:void 0,navigationContext:void 0,nextOnboardingFlowUrl:void 0,onBack:void 0,setOnBack:void 0,onClosed:void 0,openDialog:void 0,isPairingDialogCloseHandled:void 0,isBTDialogCloseHandled:void 0,remoteGamepadConnected:void 0,requestLocationPermissions:void 0,setControllerType:void 0,pairingState:void 0,startDeviceScan:void 0,resetPairingState:void 0,pairDevice:void 0,startActivityForResult:void 0,windowBreakpoint:void 0,initialPath:void 0,fullscreen:void 0});export{z as a,D as c,ze as i,ue as l,Le as n,R as o,V as r,F as s,Be as t};