(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[5151],{15151(__unused_webpack_module,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{T:()=>_});var t=__webpack_require__(860012);var a=__webpack_require__(48084);var e=__webpack_require__(408685);var n=__webpack_require__(556734);var i=__webpack_require__(848574);var r=__webpack_require__(126528);var c=__webpack_require__(68940);var l=__webpack_require__(917214);var o=__webpack_require__(199448);var d=__webpack_require__(682988);var s=__webpack_require__(518176);var g=__webpack_require__(378831);var u=__webpack_require__(184899);var y=__webpack_require__(143195);var f=__webpack_require__(79222);var v=__webpack_require__(499749);var m=__webpack_require__(626481);var p=__webpack_require__(667855);var E=__webpack_require__(365161);var w=__webpack_require__(559167);let _=({isOnboarding:_=!1})=>{let{trackEvent:b,createEventBuilder:S}=(0,s.s)();let k=(0,l.P)();let h=(0,a.wA)();let{setIsBackupAndSyncFeatureEnabled:B,error:A}=(0,o.e)();let T=(0,a.d4)(p.$lR);let R=(0,a.d4)(p.IiS);let C=(0,a.d4)(u.Qz);let I=(0,a.d4)(p.R0A);let M=(0,a.d4)(u.Qy);let P=(0,a.d4)(y.JU);let J=_?I:C;let L=(0,t.useCallback)(t=>{b(S(d.gP.SettingsUpdated).addCategory(d.FZ.Settings).addProperties({settings_group:"backup_and_sync",settings_type:"main",old_value:J,new_value:t,was_notifications_on:P}).build())},[b,J,P]);(0,t.useEffect)(()=>{if(_){R===!1&&I===!0&&h((0,E.tW)());return}T===!1&&C&&(async()=>{try{await B(e.f.main,!1),await B(e.f.accountSyncing,!1),await B(e.f.contactSyncing,!1)}catch(t){console.error("Failed to disable backup and sync features:",t)}})()},[_,T,R,C,I,B,h]);let D=async()=>{if(_){if(J){L(!1),h((0,E.tW)());return}if(L(!0),R===!1){h((0,f.toY)({name:w.Md,enableBackupAndSync:async()=>{h((0,E.yy)()),h((0,E.B2)())}}));return}h((0,E.B2)());return}if(C){L(!1),await B(e.f.main,!1),await B(e.f.accountSyncing,!1),await B(e.f.contactSyncing,!1);return}if(L(!0),T===!1){h((0,f.toY)({name:w.Md,enableBackupAndSync:async()=>{await h((0,f.K9g)(!0)),await B(e.f.main,!0),await B(e.f.accountSyncing,!0),await B(e.f.contactSyncing,!0)}}));return}await B(e.f.main,!0),await B(e.f.accountSyncing,!0),await B(e.f.contactSyncing,!0)};let x=!_&&M;return t.createElement(r.a,{marginTop:4,marginBottom:4,paddingLeft:4,paddingRight:4,className:"privacy-settings__setting__wrapper",id:"backup-and-sync-toggle","data-testid":"backup-and-sync-container"},t.createElement(r.a,{flexDirection:n.uV.Row,justifyContent:n.TE.Between,alignItems:n.RE.Start,marginBottom:1},t.createElement(c.E,{variant:i.J3.BodyMd,fontWeight:i.IT.Medium},k("backupAndSyncEnable")),x?t.createElement(r.a,{paddingLeft:5,paddingRight:5},t.createElement(m.A,{size:36})):t.createElement("div",{className:"privacy-settings__setting__toggle","data-testid":"backup-and-sync-toggle-container"},t.createElement(v.A,{value:J,onToggle:D,dataTestId:"backup-and-sync-toggle-button"}))),t.createElement("div",{className:"privacy-settings__setting__description"},t.createElement(c.E,{variant:i.J3.BodyMd,color:i.r7.TextAlternative,asChild:!0},t.createElement("div",null,k("backupAndSyncEnableDescription",[t.createElement(c.E,{asChild:!0,variant:i.J3.BodyMd,key:"privacy-link",color:i.r7.InfoDefault},t.createElement("a",{href:g.A.PROFILE_PRIVACY,target:"_blank",rel:"noopener noreferrer"},k("backupAndSyncPrivacyLink")))]))),A&&t.createElement(r.a,{marginTop:4,paddingBottom:4},t.createElement(c.E,{color:i.r7.ErrorDefault,variant:i.J3.BodySm},k("notificationsSettingsBoxError")))))}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);