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]=`851ae30c-f858-45cc-a838-7354b050e8e7`,e._sentryDebugIdIdentifier=`sentry-dbid-851ae30c-f858-45cc-a838-7354b050e8e7`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{t}from"./useIntraDialogHistory-id9u91ur.js";import{Ag as n,Qh as r,Qm as i,Yh as a,Zm as o,_r as s,ai as c,eh as l,jg as u,mp as d,ng as f,op as p,pi as m,qd as h,qh as g,xi as _,xr as v}from"./entry.client-mpghtlrl.js";import{t as y}from"./useDeferRestore-dphp89mz.js";import{o as b,r as x}from"./SettingsDialog-0l6new0i.js";import{t as S}from"./TabContentLayout-c956lcpz.js";import{r as C,t as w}from"./utils-e7a4w3py.js";var T=e(u(),1),E=n(),D=e(m(),1),O=`SettingsStorageTab`;function k(e,t){return{actions:{delete:()=>e(`Delete`,{ns:O,shortKey:`delete_action`}),dontDelete:()=>e(`Don't delete`,{ns:O,shortKey:`dontdelete_action`}),refresh:()=>e(`Refresh`,{ns:O,shortKey:`refresh_action`}),dontRefresh:()=>e(`Don't Refresh`,{ns:O,shortKey:`dontrefresh_action`})},descriptions:{cloudSave:t=>e(`This will replace your saved data for {productTitle} on the XBOX Cloud Gaming platform with your most recent saved data from the XBOX network.

If your saved data on the XBOX network is less recent than your Cloud Gaming data, you might lose progress when you refresh.`,{ns:O,shortKey:`refresh_save_subtitle`,values:{productTitle:t}}),cloudSave360:t=>e(`This deletes all XBOX 360 game and profile data for {productTitle} on the XBOX Cloud Gaming platform.

Your saved games will remain on the XBOX network, however, and they will be synced the next time you play.`,{ns:O,shortKey:`delete_360_save_subtitle`,values:{productTitle:t}}),reservedSpace:t=>e(`Deleting reserved space for {productTitle} will return the game to its default installation state.

You won't lose game progress, but the game might need to re-reserve space to let you pick up where you left off.`,{ns:O,shortKey:`delete_reserved_space_subtitle`,values:{productTitle:t}}),saveEverywhere:(t,n,r)=>n?e(`All your trial data for {productTitle} will be removed from the XBOX network.

If this game shares or accesses data between editions or other games, that data might be deleted too.`,{ns:O,shortKey:`delete_save_everywhere_subtitle_lightweight_user`,values:{productTitle:t}}):e(`All of {gamertag}'s data for {productTitle} will be removed from the XBOX network.

If this game shares or accesses data between editions or other games, that data might be deleted too.`,{ns:O,shortKey:`delete_save_everywhere_subtitle`,values:{gamertag:r,productTitle:t}}),quickResume:()=>e(`Deleting the Quick Resume file will return your game progress to the last save point.`,{ns:O,shortKey:`delete_resume_quick_773d16`})},titles:{cloudSave:()=>e(`Refresh game data from the XBOX network?`,{ns:O,shortKey:`refresh_save_title`}),cloudSave360:()=>e(`Delete cloud data for this game?`,{ns:O,shortKey:`delete_360_save_title`}),reservedSpace:()=>e(`Delete reserved space?`,{ns:O,shortKey:`delete_reserved_space_title`}),saveEverywhere:()=>e(`This permanently deletes all saved data for this game.`,{ns:O,shortKey:`delete_save_everywhere_title`}),quickResume:t=>e(`Are you sure you want to delete Quick Resume for {productTitle}?`,{ns:O,shortKey:`prompt_delete_resume_quick_773d16`,values:{productTitle:t}})}}}var A=()=>l(O,k),j=f(),M=s(e=>{let t=(0,E.c)(44),{onAction:n,onCancel:r,contentType:i,productTitle:a,isLightweightUser:o,gamertag:s,isLoading:l,isError:u}=e,d=A(),f,p,m,h=!1;bb0:switch(i){case`QuickResume`:{let e;t[0]===d.descriptions?e=t[1]:(e=d.descriptions.quickResume(),t[0]=d.descriptions,t[1]=e),f=e;let n;t[2]===d.actions?n=t[3]:(n=d.actions.delete(),t[2]=d.actions,t[3]=n),p=n;let r;t[4]===d.actions?r=t[5]:(r=d.actions.dontDelete(),t[4]=d.actions,t[5]=r),m=r;break bb0}case`CloudSave`:{let e;t[6]!==d.descriptions||t[7]!==a?(e=d.descriptions.cloudSave(a),t[6]=d.descriptions,t[7]=a,t[8]=e):e=t[8],f=e;let n;t[9]===d.actions?n=t[10]:(n=d.actions.refresh(),t[9]=d.actions,t[10]=n),p=n;let r;t[11]===d.actions?r=t[12]:(r=d.actions.dontRefresh(),t[11]=d.actions,t[12]=r),m=r;break bb0}case`CloudSave360`:{let e;t[13]!==d.descriptions||t[14]!==a?(e=d.descriptions.cloudSave360(a),t[13]=d.descriptions,t[14]=a,t[15]=e):e=t[15],f=e;let n;t[16]===d.actions?n=t[17]:(n=d.actions.delete(),t[16]=d.actions,t[17]=n),p=n;let r;t[18]===d.actions?r=t[19]:(r=d.actions.dontDelete(),t[18]=d.actions,t[19]=r),m=r;break bb0}case`ReservedSpace`:{let e;t[20]!==d.descriptions||t[21]!==a?(e=d.descriptions.reservedSpace(a),t[20]=d.descriptions,t[21]=a,t[22]=e):e=t[22],f=e;let n;t[23]===d.actions?n=t[24]:(n=d.actions.delete(),t[23]=d.actions,t[24]=n),p=n;let r;t[25]===d.actions?r=t[26]:(r=d.actions.dontDelete(),t[25]=d.actions,t[26]=r),m=r;break bb0}case`GameSaves`:{let e;t[27]!==d.descriptions||t[28]!==a||t[29]!==o||t[30]!==s?(e=d.descriptions.saveEverywhere(a,o,s),t[27]=d.descriptions,t[28]=a,t[29]=o,t[30]=s,t[31]=e):e=t[31],f=e;let n;t[32]===d.actions?n=t[33]:(n=d.actions.delete(),t[32]=d.actions,t[33]=n),p=n;let r;t[34]===d.actions?r=t[35]:(r=d.actions.dontDelete(),t[34]=d.actions,t[35]=r),m=r;break bb0}default:f=``,p=``,m=``,h=!0}if(u||h){let e;return t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,j.jsx)(C,{}),t[36]=e):e=t[36],e}let g;return t[37]!==l||t[38]!==f||t[39]!==n||t[40]!==p||t[41]!==r||t[42]!==m?(g=l?(0,j.jsx)(`div`,{className:`flex w-full flex-col gap-4`,children:(0,j.jsxs)(c,{children:[(0,j.jsx)(_,{className:`m-internal-container-padding-tight h-[32px] w-full`}),(0,j.jsxs)(`div`,{className:`m-internal-container-padding-tight flex flex-col items-center gap-4 self-stretch sm-20:flex-row`,children:[(0,j.jsx)(_,{className:`h-[32px] w-full`}),(0,j.jsx)(_,{className:`h-[32px] w-full`})]})]})}):(0,j.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,j.jsx)(`div`,{className:(0,D.default)(`my-internal-container-padding-tight whitespace-pre text-wrap text-noninteractive-content-secondary-content type-body`,x),children:f}),(0,j.jsxs)(`div`,{className:`m-internal-container-padding-tight flex flex-col items-center gap-4 self-stretch sm-20:flex-row`,children:[(0,j.jsx)(v,{as:`button`,size:`large`,className:`w-full min-w-component-action-text-standard-min-width flex-1 content-center items-center py-component-action-text-standard-container-padding-top-and-bottom`,onPress:n,kind:`destructive`,children:p}),(0,j.jsx)(v,{as:`button`,size:`large`,className:`w-full min-w-component-action-text-standard-min-width flex-1 content-center items-center py-component-action-text-standard-container-padding-top-and-bottom`,onPress:r,children:m})]})]}),t[37]=l,t[38]=f,t[39]=n,t[40]=p,t[41]=r,t[42]=m,t[43]=g):g=t[43],g},()=>{let{authentication:{queries:{userInfo:e}},catalog:{queries:{productInfo:n}},gameSaves:{mutations:{deleteAllSaves:s}},services:{gameStream:{play:{queries:{userContent:c},mutations:{deleteUserContent:l}}}}}=o(),{trackUserAction:u}=i(),{productId:f,contentType:m}=d({from:p.dialog.settings.storage.confirmStorageDelete.id}),_=m,{setTitle:v,setSubtitle:x}=b(),{data:S,isLoading:C,isError:E}=r(n.basic.getOptions({productId:f})),D=S?.title??``,{data:O,isLoading:k,isError:j}=r(e.getActiveUserQuery().getOptions()),M=O?.isLightweightUser??!1,N=O?.gamertag?.uniqueGamertag??``,P=A(),{data:F,isLoading:I,isError:L}=r(c.getActiveUserQuery().getOptions()),{mutate:R}=a(l.getActiveUserMutation().getOptions()),{mutate:z}=a(s.getActiveUserMutation().getOptions()),B=F?.find(e=>{let t=w(e.contentType);return e.productId===f&&t===_}),V=!1,H,U=!1;switch(_){case`QuickResume`:H=P.titles.quickResume(D);break;case`CloudSave`:H=P.titles.cloudSave();break;case`CloudSave360`:H=P.titles.cloudSave360();break;case`ReservedSpace`:H=P.titles.reservedSpace();break;case`GameSaves`:H=P.titles.saveEverywhere(),U=!0;break;default:H=``,V=!0}(0,T.useEffect)(()=>{v(H),x(``)},[v,x,H]);let W=t(),G=()=>{if(W.canGoBack)W.goBack();else throw new h(`NavigationStack`,`previous`)},K=()=>{if(O)try{U?z({productId:f}):B&&R({contentType:B.contentType,storageId:B.storageId}),u(`DeleteGameContent`,{gameId:f,contentType:_,succeeded:!0},`Press`)}catch(e){u(`DeleteGameContent`,{gameId:f,contentType:_,succeeded:!1,failureReason:g(e).message},`Press`)}G()},q=()=>{G()},J=V||E||j||L,Y=C||k||I;return y(Y),{onAction:K,onCancel:q,contentType:_,productTitle:D,isLightweightUser:M,gamertag:N,isLoading:Y,isError:J}}),N=()=>{let e=(0,E.c)(2),t=M.useComponent(),n;return e[0]===t?n=e[1]:(n=(0,j.jsx)(S,{telemetryLocation:`ConfirmStorageDataDeletion`,children:(0,j.jsx)(t,{})}),e[0]=t,e[1]=n),n};export{N as ConfirmStorageDataDeletion};