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]=`6ccbade8-4277-4fa3-969f-dde1101280ab`,e._sentryDebugIdIdentifier=`sentry-dbid-6ccbade8-4277-4fa3-969f-dde1101280ab`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{$d as t,Ag as n,Dg as r,Ig as i,dn as a,eh as o,lh as s,mr as c,sh as l,st as u,th as d,wg as f,yu as p,zp as m}from"./entry.client-dr7r6s9a.js";import{t as h}from"./useEmitGameStreamDialogEvent-dljcy1v9.js";import{t as g}from"./useGameStreamDialogContext-ivl0rv5q.js";import{s as _}from"./PureInStreamConfirmationDialog.styles-f9kkr64u.js";import{t as v}from"./PureInStreamConfirmationDialog-ivf23uic.js";var y=e(i(),1),b=n(),x=a(v,()=>{let e=h(m.dialog.gameStream.confirmQuit.fullPath,`close`),{locDisconnect:n,locQuitGame:i,locNeverMind:a}=o(),{t:c}=s(`ConfirmQuitDialog`),v=c(`Are you sure?`,{shortKey:`sure_you_32dc7f`}),b=c(`All unsaved progress will be lost.`,{shortKey:`progress_unsaved_lost_67da39`}),{setDialogShellProps:x}=g(),{gameStream:S}=l(),{data:C}=r(S.queries.instance.getOptions()),{mutateAsync:w}=f(S.mutations.blockerReset),{mutateAsync:T}=f(S.mutations.unblockNavigation),{mutateAsync:E}=f(S.mutations.closeAllDialogs),D=u(),O=C?.navigationManager?.isSwitchStreamRedirectUrl(),k=d().getLogger(`ConfirmQuitDialog`),A=(0,y.useRef)(!1),j=(0,y.useCallback)(async()=>{A.current=!0;try{await w()}catch(e){k.error(`Failed to reset navigation blocker`,e)}e()},[w,e,k]),M={accessibleTitle:v,accessibleDescription:b,dismissable:!0,className:_,autoHeight:!0,onWillClose:j};(0,y.useEffect)(()=>{x(M)},[M,x]),(0,y.useEffect)(()=>()=>{A.current||w().catch(e=>{k.error(`Failed to reset navigation blocker on unmount`,e)})},[w,k]);let N=(0,y.useCallback)(async()=>{A.current=!0,e(),C||k.debug(`No game stream instance to shutdown`);try{await w(),await T(),D(t.home.$path(),{replace:!0}),C?.shutdownSession({reason:`Clean`}),await E()}catch(e){k.error(`Failed to quit game`,e)}},[C,k,e,w,T,D,E]);return{locTitle:v,locDescription:b,button1Props:{label:O?c(`Switch game`,{shortKey:`switch_game_212872`}):!C?.session||C.session.connectionType===p.Cloud?i():n(),onPress:N,kind:`destructive`,size:`standard`,as:`button`},button2Props:{label:a(),kind:`standard`,size:`standard`,as:`button`,onPress:j}}}),S=c(()=>(0,b.jsx)(x.useComponent(),{}),`ConfirmQuitDialog`);export{S as ConfirmQuitDialog,S as default,x as ConfirmQuitDialogConnection};