import{eM as f,bX as F,q as C,cs as _,an as y,bZ as b,b as e,bV as w,J as h,i as U,t as N}from"./index-6Jqoo2rk.js";import{u as P,S as T}from"./saveButton-BN9ptO_C.js";import{a0 as R,ao as D,ap as l,a1 as G}from"./appDialogsManager-DnVhdlim.js";import{S as p}from"./staticSwitch-DQBt4NKu.js";import{A as d}from"./accumulate-BydAFozl.js";import{H}from"./heightTransition-Du7NDu-z.js";import{I as m}from"./emailSetup-CFcJlzt-.js";import{u as I}from"./useIsPremium-DofwZSfP.js";import"./iconTsx-Cr8T7ZIv.js";import"./transition-DuxZkCEv.js";import"./putPreloader-WBjcuDFX.js";import"./htmlToSpan-DhAls8qz.js";import"./anchorCallback-DsA1XczG.js";import"./toast-B3QB1-N7.js";import"./paintQrCode-u2FNs0A8.js";import"./fastBlur-Co-79rP4.js";import"./bootstrapIm-BS8HLnlI.js";import"./space-DBcSn32d.js";import"./animations-O3syBkMX.js";import"./telInputField-Fj4gE689.js";import"./browser-BlRx6CLO.js";import"./_commonjsHelpers-DsqdWQfm.js";import"./mediaHeader-B5k-4_FU.js";import"./readBlobAsDataURL-DL2tTmc_.js";import"./tracking-CIK7NCFD.js";import"./getInputPasskeyResponse-RiY9Fe0r.js";import"./base64ToBytes-B7rMxzcy.js";import"./sha256-BMgYLqDy.js";import"./bytesCmp-DgkPox5J.js";const M=N("<div> ");function de(){const[o]=R(),{Row:r,rootScope:u}=f(),A=D(),[i]=F(()=>{const t=u.managers.appPrivacyManager.getGlobalPrivacySettings();return A.collect(t),t}),k=I(),s=C(()=>i.state==="ready"),[n,a]=_({keepArchivedUnmutedChats:!1,keepArchiveFromFolders:!1,archiveNonContactChats:!1});let c={keepArchivedUnmutedChats:!1,keepArchiveFromFolders:!1,archiveNonContactChats:!1};const g=C(()=>!y(n,c));b(()=>{s()&&(c={keepArchivedUnmutedChats:!!i()?.pFlags?.keep_archived_unmuted,keepArchiveFromFolders:!!i()?.pFlags?.keep_archived_folders,archiveNonContactChats:!!i()?.pFlags?.archive_and_mute_new_noncontact_peers},a(c))});const v=G(async()=>{if(!s())return;const t=structuredClone(i());t.pFlags??(t.pFlags={}),d(t.pFlags,"keep_archived_unmuted",n.keepArchivedUnmutedChats),d(t.pFlags,"keep_archived_folders",n.keepArchivedUnmutedChats?!0:n.keepArchiveFromFolders),d(t.pFlags,"archive_and_mute_new_noncontact_peers",n.archiveNonContactChats),await u.managers.appPrivacyManager.setGlobalPrivacySettings(t),o.close()});return o.isConfirmationNeededOnClose=P({hasChanges:g,saveAllSettings:v,descriptionLangKey:"UnsavedChangesDescription.Archive"}),[e(w,{get mount(){return o.header},get children(){return e(T,{get hasChanges(){return g()},onClick:()=>{v()}})}}),e(l,{name:"ArchiveSettings.UnmutedChats.Title",caption:"ArchiveSettings.UnmutedChats.Description",get children(){return e(r,{clickable:()=>a("keepArchivedUnmutedChats",t=>!t),get children(){return[e(r.Title,{get children(){return e(m,{key:"ArchiveSettings.UnmutedChats.Action"})}}),e(r.RightContent,{get children(){return e(p,{get checked(){return n.keepArchivedUnmutedChats}})}})]}})}}),e(h,{get when(){return s()},get children(){return[" ",e(H,{get children(){return e(h,{get when(){return!n.keepArchivedUnmutedChats},get children(){const t=M();return t.firstChild,t.style.setProperty("overflow","hidden"),U(t,e(l,{name:"ArchiveSettings.FolderChats.Title",caption:"ArchiveSettings.FolderChats.Description",get children(){return e(r,{clickable:()=>a("keepArchiveFromFolders",S=>!S),get children(){return[e(r.Title,{get children(){return e(m,{key:"ArchiveSettings.FolderChats.Action"})}}),e(r.RightContent,{get children(){return e(p,{get checked(){return n.keepArchiveFromFolders}})}})]}})}}),null),t}})}})]}}),e(h,{get when(){return k()},get children(){return e(l,{name:"ArchiveSettings.NewChats.Title",caption:"ArchiveSettings.NewChats.Description",get children(){return e(r,{clickable:()=>a("archiveNonContactChats",t=>!t),get children(){return[e(r.Title,{get children(){return e(m,{key:"ArchiveSettings.NewChats.Action"})}}),e(r.RightContent,{get children(){return e(p,{get checked(){return n.archiveNonContactChats}})}})]}})}})}})]}export{de as default};
//# sourceMappingURL=archiveSettingsTab-waKCkI6k.js.map
