DollyDeviceDiagnosticRescueDownloadModal.react",["fbt","CometRelay","DateConsts","DollyDeviceDiagnosticContext","DollyDeviceDiagnosticErrorModal.react","DollyDeviceDiagnosticRescueDownloadModalQuery.graphql","DollyDeviceDiagnosticUpdateDialog.react","DollyDeviceDiagnosticUtil","FBLogger","MCDSFlexbox.react","MCDSText.react","isStringNullOrEmpty","promiseDone","react","useDollyDeviceDiagnosticConnection","useDollyDeviceDiagnosticDisconnectOrErrorModal","useDollyDeviceDiagnosticLogger","useDollyDeviceDiagnosticPreloadAssets","useOnBeforeUnload","useStoreLogEventOnceOnInitialRender"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k=j||(j=d("react"));e=j;var l=e.useCallback,m=e.useContext,n=e.useState,o=7*d("DateConsts").MS_PER_MIN;function a(a){var e=a.deviceClient,f=a.onClose,g=a.onComplete;a=a.onReconnect;var j=m(c("DollyDeviceDiagnosticContext"));j=j.device;var p=n(null),q=p[0],r=p[1];p=n(0);var s=p[0],t=p[1];p=c("useDollyDeviceDiagnosticConnection")();p=p.isDisconnected;var u=n(null),v=u[0],w=u[1];c("useOnBeforeUnload")(function(){return{warnMessage:h._(/*BTDS*/"Are you sure you want to leave?")}});u=c("useDollyDeviceDiagnosticLogger")({currentStep:d("DollyDeviceDiagnosticUtil").DollyDeviceDiagnosticStepName.DOWNLOAD_RESCUE,serialNumber:e.getSerialNumber()});var x=u.logClick,y=u.logRescueDownloadAttempt,z=u.logRescueDownloadFail,A=u.logRescueDownloadSuccess;u=u.logView;c("useStoreLogEventOnceOnInitialRender")(u);u=d("CometRelay").useLazyLoadQuery(i!==void 0?i:i=b("DollyDeviceDiagnosticRescueDownloadModalQuery.graphql"),{serialNumber:e.getSerialNumber()});u=u.xfb_list_webusb_device_latest_build_query;if(u==null)throw c("FBLogger")("dolly").mustfixThrow("Build info is null");var B=u.build_number,C=u.rescue_url;u=u.status_code;var D=l(function(){var a="rescue.zip";w(Date.now());y(B);c("promiseDone")(e.download(a,C,t),function(a){A(B),g(a)},function(a){r("Error downloading file");z(B,"Error downloading file");throw c("FBLogger")("dolly").mustfixThrow("Error downloading file. %s",a)})},[B,e,y,z,A,g,C]);p=c("useDollyDeviceDiagnosticDisconnectOrErrorModal")(p,f,a,q,u);if(p!=null)return p;if(c("isStringNullOrEmpty")(C)){z(B,"No rescue image available for this device, serial: "+e.getSerialNumber()+", device type: "+((q=j==null?void 0:j.productName)!=null?q:"unknown"));return k.jsx(c("DollyDeviceDiagnosticErrorModal.react"),{currentStep:d("DollyDeviceDiagnosticUtil").DollyDeviceDiagnosticStepName.DOWNLOAD_RESCUE,errorMessage:"No recovery image available for this device.",onClose:f,onReconnect:a})}if(s===0)return k.jsx(c("DollyDeviceDiagnosticUpdateDialog.react"),{modalDetails:{illustration:{imageUrl:d("useDollyDeviceDiagnosticPreloadAssets").AssetSource.DOWNLOAD_UPDATES,size:d("DollyDeviceDiagnosticUtil").DollyDeviceDiagnosticImageSize.SMALL},progressContent:{title:h._(/*BTDS*/"Ready for download"),content:[k.jsx(c("MCDSText.react"),{children:h._(/*BTDS*/"The latest recovery software is ready to be downloaded. Please make sure you have 2GB of storage available on this computer.")},0),k.jsx(c("MCDSText.react"),{children:h._(/*BTDS*/"Keep your device connected during the download. It may take up to 7 minutes.")},1),h._(/*BTDS*/"Do not disconnect your device while the software is downloading.")]},action:{label:h._(/*BTDS*/"Start download"),onClick:function(){x("Start download rescue image"),D()}},onClose:f,isDismissable:!0}});u=s>0?[k.jsx(c("MCDSFlexbox.react"),{alignItems:"center",direction:"column",children:k.jsxs(c("MCDSText.react"),{textAlign:"center",children:[h._(/*BTDS*/"Downloaded:")," ",Math.floor(s),"%"]})},0)]:[];u.push(h._(/*BTDS*/"Do not disconnect your device."));return k.jsx(c("DollyDeviceDiagnosticUpdateDialog.react"),{errorCalloutProps:v!=null&&Date.now()-v>o?{title:h._(/*BTDS*/"Looks like this is taking longer than expected"),message:h._(/*BTDS*/"If the software still hasnu2019t been downloaded in the next 5 minutes, please power off your device, disconnect it, and try again."),messageTextAlignment:"center"}:null,modalDetails:{illustration:{imageUrl:d("useDollyDeviceDiagnosticPreloadAssets").AssetSource.DOWNLOAD_UPDATES,size:d("DollyDeviceDiagnosticUtil").DollyDeviceDiagnosticImageSize.SMALL},progressContent:{title:h._(/*BTDS*/"Downloading software..."),content:u},onClose:f,isDismissable:!1}})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),226);
-----
DollyDeviceDiagnosticRescueDownloadModalQuery.graphql",["DollyDeviceDiagnosticRescueDownloadModalQuery_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"serialNumber"}],c=[{kind:"Variable",name:"serial",variableName:"serialNumber"}],d={alias:null,args:null,kind:"ScalarField",name:"rescue_url",storageKey:null},e={alias:null,args:null,kind:"ScalarField",name:"build_number",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"status_code",storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"DollyDeviceDiagnosticRescueDownloadModalQuery",selections:[{alias:null,args:c,concreteType:"XFBFirmwareOTALatestBuildInfo",kind:"LinkedField",name:"xfb_list_webusb_device_latest_build_query",plural:!1,selections:[{kind:"RequiredField",field:d,action:"THROW",path:"xfb_list_webusb_device_latest_build_query.rescue_url"},{kind:"RequiredField",field:e,action:"THROW",path:"xfb_list_webusb_device_latest_build_query.build_number"},{kind:"RequiredField",field:f,action:"THROW",path:"xfb_list_webusb_device_latest_build_query.status_code"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"DollyDeviceDiagnosticRescueDownloadModalQuery",selections:[{alias:null,args:c,concreteType:"XFBFirmwareOTALatestBuildInfo",kind:"LinkedField",name:"xfb_list_webusb_device_latest_build_query",plural:!1,selections:[d,e,f],storageKey:null}]},params:{id:b("DollyDeviceDiagnosticRescueDownloadModalQuery_facebookRelayOperation"),metadata:{},name:"DollyDeviceDiagnosticRescueDownloadModalQuery",operationKind:"query",text:null}}}();e.exports=a}),null);
-----
DollyDeviceDiagnosticRescueDownloadModalQuery_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="9677694425687179"}),null);
-----