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]=`164cbb11-f88b-424c-a30b-08473e7a5809`,e._sentryDebugIdIdentifier=`sentry-dbid-164cbb11-f88b-424c-a30b-08473e7a5809`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{$m as t,Hm as n,Oi as r,Qh as i,Um as a,Yh as o,Zm as s,_r as c,jg as l,ng as u,op as d}from"./entry.client-mpghtlrl.js";import{cn as f}from"./workspace-leaf-files-oergw4h0.js";import{t as p}from"./useEmitGameStreamDialogEvent-m3jw3fvd.js";import{t as m}from"./useGameStreamDialogContext-orgnly77.js";import{s as h}from"./PureInStreamConfirmationDialog.styles-deafeydi.js";import{t as g}from"./PureInStreamConfirmationDialog-k0il2d8x.js";var _=e(l(),1),v=u(),y=c(g,()=>{let e=p(d.dialog.gameStream.confirmQuit.fullPath,`close`),{locDisconnect:r,locQuitGame:c,locNeverMind:l}=n(),{t:u}=t(`ConfirmQuitDialog`),g=u(`Are you sure?`,{shortKey:`sure_you_32dc7f`}),v=u(`All unsaved progress will be lost.`,{shortKey:`progress_unsaved_lost_67da39`}),{setDialogShellProps:y}=m(),{gameStream:b}=s(),{data:x}=i(b.queries.instance.getOptions()),{mutateAsync:S}=o(b.mutations.cancelQuit),{mutateAsync:C}=o(b.mutations.commitQuit),w=x?.navigationManager?.isSwitchStreamRedirectUrl(),T=a().getLogger(`ConfirmQuitDialog`),E=(0,_.useCallback)(async()=>{try{await S()}catch(e){T.error(`cancelQuit failed`,e)}e()},[S,e,T]),D=(0,_.useCallback)(async()=>{try{await C()}catch(e){T.error(`commitQuit failed`,e)}e()},[C,e,T]);(0,_.useEffect)(()=>()=>{S().catch(e=>{T.error(`cancelQuit failed on unmount`,e)})},[S,T]);let O={accessibleTitle:g,accessibleDescription:v,dismissable:!0,className:h,autoHeight:!0,onWillClose:E};return(0,_.useEffect)(()=>{y(O)},[O,y]),{locTitle:g,locDescription:v,button1Props:{label:w?u(`Switch game`,{shortKey:`switch_game_212872`}):!x?.session||x.session.connectionType===f.Cloud?c():r(),onPress:D,kind:`destructive`,size:`standard`,as:`button`},button2Props:{label:l(),kind:`standard`,size:`standard`,as:`button`,onPress:E}}}),b=r(()=>(0,v.jsx)(y.useComponent(),{}),`ConfirmQuitDialog`);export{b as ConfirmQuitDialog,b as default,y as ConfirmQuitDialogConnection};