-
Notifications
You must be signed in to change notification settings - Fork 661
/
Copy pathmainTab-Di4I7Vit.js
2 lines (2 loc) · 10 KB
/
mainTab-Di4I7Vit.js
1
2
import{a3 as W,eP as oe,Y as y,X as D,k as Z,V as B,$ as f,a1 as N,Z as s,a2 as M,bo as de,a5 as A,U as H,ac as _e,a4 as ge,W as J,cF as me,a7 as he,bp as ee,ad as pe,df as ve,dh as te,aa as V,bU as K,a0 as Q,i as g,bn as Se}from"./index-BisvWswr.js";import{u as se}from"./actions-O9QOCban.js";import{I as ne,u as fe,a as ae,S as j,R as q,c as $e}from"./appDialogsManager-D2zOoR-q.js";import{S as be}from"./staticSwitch-C0Iufmp5.js";import{T as Pe,S as U}from"./chatBackground-D9OaT0tf.js";import{L as ce,c as ye}from"./lottieAnimation-DJeWK9rV.js";import"./page-BdPVZANi.js";import"./avatar-DcDWfqyG.js";import"./putPreloader-BOF3ZbMC.js";import"./htmlToSpan-DhAls8qz.js";import"./textToSvgURL-Cnw_Q8Rw.js";import"./fastBlur-Co-79rP4.js";import"./countryInputField-d9FQkCMC.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./codeInputField-BIG1qSpW.js";const ke="_Container_1qplo_1",Ce="_KeysContainer_1qplo_7",Le="_KeyButton_1qplo_13",we="_selected_1qplo_35",Ee="_KeyButtonFirst_1qplo_53",Te="_KeyButtonLast_1qplo_57",Be="_PlusIcon_1qplo_62",Me="_TargetKey_1qplo_67",E={Container:ke,KeysContainer:Ce,KeyButton:Le,selected:we,KeyButtonFirst:Ee,KeyButtonLast:Te,PlusIcon:Be,TargetKey:Me},Re=M("<span>"),Ke=M("<div><div></div><div>"),xe=M("<button>"),Y=["Ctrl","Alt","Shift","Meta"],Oe=n=>{const d=oe(()=>n.value,(a,l)=>l.includes(a)),$=a=>a==="Meta"?s(ne,{icon:de?"mac_command_key":"win_key"}):(()=>{const l=Re();return y(l,a),l})(),k=a=>{if(n.value.includes(a)){const l=n.value.filter(m=>m!==a);if(!l.length){const m=[0,1,2,3].filter(e=>e!==Y.indexOf(a));l.push(Y[m[Math.floor(Math.random()*m.length)]])}n.onChange(l)}else n.onChange([...n.value,a])};return(()=>{const a=Ke(),l=a.firstChild,m=l.nextSibling;return y(l,()=>Y.map((e,i,b)=>(()=>{const v=xe();return v.$$click=k,v.$$clickData=e,D(Z,v,()=>!0),y(v,()=>$(e)),B(t=>{const _=E.KeyButton,u={[E.selected]:d(e),[E.KeyButtonFirst]:i===0,[E.KeyButtonLast]:i===b.length-1};return _!==t._v$5&&f(v,t._v$5=_),t._v$6=N(v,u,t._v$6),t},{_v$5:void 0,_v$6:void 0}),v})())),y(a,s(ne,{get class(){return E.PlusIcon},icon:"plus"}),m),y(m,()=>n.key),B(e=>{const i=E.Container,b={[n.class]:!!n.class},v=E.KeysContainer,t=E.TargetKey;return i!==e._v$&&f(a,e._v$=i),e._v$2=N(a,b,e._v$2),v!==e._v$3&&f(l,e._v$3=v),t!==e._v$4&&f(m,e._v$4=t),e},{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),a})()};W(["click"]);const De="_Overlay_deagn_36",Ae="_Value_deagn_45",He="_Select_deagn_52",Ie="_SelectClip_deagn_63",Fe="_Option_deagn_75",qe="_selected_deagn_87",R={Overlay:De,Value:Ae,Select:He,SelectClip:Ie,Option:Fe,selected:qe},Ve=M("<div>"),Ne=M("<div><div><div>"),Ue=M("<div><span>"),ze=n=>{let d;const $=A(()=>n.options.find(t=>t.value===n.value)?.label),[k,a]=H();_e(()=>{a($()())});const l=oe(()=>n.value),[m,e]=H();ge(()=>{const t=new ee;t.add(window)("resize",()=>{n.isOpen&&n.onClose?.()}),J(()=>{t.removeAll()})});const i=(t,_)=>{const u=t.firstElementChild,r=u.querySelector(`.${R.selected}`);if(!r||!u)return;const c=d.getBoundingClientRect(),h=u.getBoundingClientRect(),p=r.getBoundingClientRect(),P=p.top-h.top,C=P+p.height,I=P+p.height/2,z=c.left+c.width/2;let L=c.top+c.height/2-I;const O=L+h.height>window.innerHeight||L<0;if(O&&(L+=Math.max(0,-L)+Math.min(0,window.innerHeight-(L+h.height))),u.style.setProperty("--x",""+z),u.style.setProperty("--y",""+L),u.animate({opacity:[0,1]},{duration:120}).finished.then(()=>{O&&_()}),O)return;const F=Math.max(P,h.height-C),X=w=>`polygon(0% ${P-w}px, 100% ${P-w}px, 100% ${C+w}px, 0px ${C+w}px)`;pe(0,F,400,w=>{u.style.setProperty("clip-path",X(w))},{easing:ve,onEnd:()=>{u.style.removeProperty("clip-path"),_()}})},b=async(t,_)=>{await t.firstElementChild.animate({opacity:[1,0]},{duration:120}).finished,_()},v=t=>{const _=[n.parent,m()];if(!_.every(Boolean))return;_.every(r=>{const c=r.getBoundingClientRect();return Math.max(c.left-t.clientX,t.clientX-c.right,c.top-t.clientY,t.clientY-c.bottom)>100})&&n.onClose?.()};return[(()=>{const t=Ve(),_=d;return typeof _=="function"?D(_,t):d=t,y(t,k),B(()=>f(t,R.Value)),t})(),s(he,{get children(){return s(Pe,{appear:!0,onEnter:i,onExit:b,get children(){return A(()=>!!n.isOpen)()&&(()=>{const t=Ne(),_=t.firstChild,u=_.firstChild;return t.$$mousemove=v,t.$$click=r=>{r.stopPropagation(),n.onClose?.()},D(e,u),y(u,s(me,{get each(){return n.options},children:r=>(()=>{const c=Ue(),h=c.firstChild;return c.$$click=n.onChange,c.$$clickData=r.value,D(Z,c,()=>!0),y(h,()=>r.label()),B(p=>{const P=R.Option,C={[R.selected]:l(r.value)};return P!==p._v$4&&f(c,p._v$4=P),p._v$5=N(c,C,p._v$5),p},{_v$4:void 0,_v$5:void 0}),c})()})),B(r=>{const c=R.Overlay,h=R.SelectClip,p=R.Select;return c!==r._v$&&f(t,r._v$=c),h!==r._v$2&&f(_,r._v$2=h),p!==r._v$3&&f(u,r._v$3=p),r},{_v$:void 0,_v$2:void 0,_v$3:void 0}),t})()}})}})]};W(["click","mousemove"]);const Xe="_MainDescription_1pm2o_36",Ye="_FirstSection_1pm2o_44",Qe="_Row_1pm2o_49",je="_ShortcutBuilderRow_1pm2o_54",Ge="_ShortcutBuilderRowChild_1pm2o_60",We="_collapsed_1pm2o_63",Ze="_Hint_1pm2o_68",T={MainDescription:Xe,FirstSection:Ye,Row:Qe,ShortcutBuilderRow:je,ShortcutBuilderRowChild:Ge,collapsed:We,Hint:Ze},ie=M("<div>"),Je=M('<div><button class="btn-primary btn-color-primary btn-large">'),G=(n,d)=>({appendTo:n.scrollable.container,duration:2500,from:"bottom",textElement:g(d),icon:"premium_lock",class:T.Hint,canCloseOnPeerChange:!1}),vt=()=>{const{rootScope:n}=te(),d=fe(),[$,{mutate:k}]=V(()=>{const e=n.managers.appStateManager.getState().then(i=>i.settings?.passcode?.enabled||!1);return d.collect(e),e}),[a,l]=H(!1),m=new ee;return m.add(n)("settings_updated",({key:e,value:i})=>{e===K("settings","passcode","enabled")&&k(i)}),J(()=>{m.removeAll()}),s(Q,{get when(){return $.state==="ready"},get children(){return A(()=>!!($()||a()))()?s(tt,{onDisable:()=>l(!0)}):s(et,{})}})},et=()=>{const[n,{AppPasscodeEnterPasswordTab:d,AppPasscodeLockTab:$}]=ae(),{enablePasscode:k}=se(),{setQuizHint:a}=te(),l=()=>{n.slider.createTab(d).open({onSubmit:e=>{m(e),e=""},buttonText:"PasscodeLock.Next",inputLabel:"PasscodeLock.EnterAPasscode"})},m=e=>{n.slider.createTab(d).open({onSubmit:async(i,b)=>{if(i!==e)throw{};await k(i),i="",b.slider.sliceTabsUntilTab($,b),b.close(),a(G(n,"PasscodeLock.PasscodeHasBeenSet"))},buttonText:"PasscodeLock.SetPasscode",inputLabel:"PasscodeLock.ReEnterPasscode"})};return s(j,{caption:"PasscodeLock.Notice",get children(){return[s(ce,{name:"UtyanPasscode"}),(()=>{const e=ie();return y(e,()=>g("PasscodeLock.Description")),B(()=>f(e,T.MainDescription)),e})(),s(U,{amount:"0.5rem"}),(()=>{const e=Je(),i=e.firstChild;return i.$$click=l,D(Z,i,()=>!0),y(i,()=>g("PasscodeLock.TurnOn")),B(()=>f(e,ye.AdditionalPadding)),e})(),s(U,{amount:"1rem"})]}})},tt=n=>{const[d,{AppPasscodeEnterPasswordTab:$,AppPasscodeLockTab:k,AppPrivacyAndSecurityTab:a}]=ae(),{disablePasscode:l,changePasscode:m}=se(),{rootScope:e,setQuizHint:i}=te(),b=[{value:0,label:()=>g("PasscodeLock.Disabled")},{value:1,label:()=>g("MinutesShort",[1])},{value:5,label:()=>g("MinutesShort",[5])},{value:10,label:()=>g("MinutesShort",[10])},{value:15,label:()=>g("MinutesShort",[15])},{value:30,label:()=>g("MinutesShort",[30])}],[v,t]=H(),[_,u]=H(!1),[r,{mutate:c}]=V(()=>e.managers.appStateManager.getState().then(o=>o?.settings?.passcode?.autoLockTimeoutMins||0)),[h,{mutate:p}]=V(()=>e.managers.appStateManager.getState().then(o=>o?.settings?.passcode?.lockShortcutEnabled||!1)),[P,{mutate:C}]=V(()=>e.managers.appStateManager.getState().then(o=>o?.settings?.passcode?.lockShortcut||[])),I=new ee;I.add(e)("settings_updated",({key:o,value:S})=>{o===K("settings","passcode","lockShortcut")?C(S):o===K("settings","passcode","lockShortcutEnabled")?p(S):o===K("settings","passcode","autoLockTimeoutMins")&&c(S)});function z(o){C(o),e.managers.appStateManager.setByKey(K("settings","passcode","lockShortcut"),o)}function L(o){p(o),e.managers.appStateManager.setByKey(K("settings","passcode","lockShortcutEnabled"),o)}function O(o){c(o),e.managers.appStateManager.setByKey(K("settings","passcode","autoLockTimeoutMins"),o)}J(()=>{I.removeAll()});const F=()=>!Se&&P.state==="ready"&&h.state==="ready",X=()=>{d.slider.createTab($).open({onSubmit:o=>{w(o),o=""},buttonText:"PasscodeLock.Next",inputLabel:"PasscodeLock.EnterAPasscode"},"PasscodeLock.EnterANewPasscode")},w=o=>{d.slider.createTab($).open({onSubmit:async(S,x)=>{if(S!==o)throw{};await m(S),S="",x.slider.sliceTabsUntilTab(k,x),x.close(),i(G(d,"PasscodeLock.PasscodeHasBeenChanged"))},buttonText:"PasscodeLock.SetPasscode",inputLabel:"PasscodeLock.ReEnterPasscode"},"PasscodeLock.ReEnterPasscode")},re=()=>{$e({title:g("PasscodeLock.TurnOff.Title"),description:g("PasscodeLock.TurnOff.Description"),button:{text:g("PasscodeLock.TurnOff"),isDanger:!0}}).then(async()=>{n.onDisable(),await l(),d.close(),i(G(d.slider.getTab(a),"PasscodeLock.PasscodeHasBeenDisabled"))}).catch(()=>{})},le=[A(()=>g("PasscodeLock.Description")),s(U,{amount:"1rem"}),A(()=>g("PasscodeLock.Notice"))];return[s(j,{get class(){return T.FirstSection},caption:le,get children(){return[s(ce,{name:"UtyanPasscode"}),s(U,{amount:"1.125rem"}),s(q,{get title(){return g("PasscodeLock.TurnOff.Title")},icon:"lockoff",clickable:re}),s(q,{get title(){return g("PasscodeLock.ChangePasscode")},icon:"key",clickable:X})]}}),s(j,{get caption(){return F()?"PasscodeLock.LockShortcutDescription":void 0},get children(){return[s(Q,{get when(){return r.state==="ready"},get children(){return s(q,{ref:t,get classList(){return{[T.Row]:!0}},get title(){return g("PasscodeLock.AutoLock")},get rightContent(){return s(ze,{get value(){return r()},onClose:()=>u(!1),options:b,onChange:O,get isOpen(){return _()},get parent(){return v()}})},clickable:()=>{u(!0)}})}}),s(Q,{get when(){return F()},get children(){return[s(q,{get title(){return g("PasscodeLock.EnableLockShortcut")},get classList(){return{[T.Row]:!0}},get rightContent(){return s(be,{get checked(){return h()}})},clickable:o=>{L(!h())}}),(()=>{const o=ie();return y(o,s(Oe,{get class(){return T.ShortcutBuilderRowChild},get value(){return P()||[]},onChange:z,key:"L"})),B(S=>{const x=T.ShortcutBuilderRow,ue={[T.collapsed]:!h()};return x!==S._v$&&f(o,S._v$=x),S._v$2=N(o,ue,S._v$2),S},{_v$:void 0,_v$2:void 0}),o})()]}})]}})]};W(["click"]);export{vt as default};
//# sourceMappingURL=mainTab-Di4I7Vit.js.map