mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-02 09:37:47 +01:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[1989],{70172:(e,t,n)=>{n.d(t,{Z:()=>y});var r=n(14050),o=n(33555),c=n(6137),s=n(83716),l=n(77361),i=n(83158),a=n(2155),d=n(46752),u=n(32340),m=n(6202),v=n(31212),f=n(59107),p=n(3657),g=n(21747),h=n(46898);const Z=(0,d.y)("Avatar");Z.media=Z("media"),Z.icon=Z("icon");const y=(0,r.X$)((e=>{var t;let{className:n,size:y="large",chat:P,user:E,photo:b,userStatus:I,text:w,isSavedMessages:A,withVideo:C,noLoop:T,lastSyncTime:B,animationLevel:N,observeIntersection:k,onClick:L}=e;const{loadFullUser:S}=(0,o.Sv)(),O=(0,r.sO)(null),U=(0,r.sO)(null),R=(0,r.sO)(0),q=(0,p.Op)(O,k),x=E&&(0,i.NB)(E),F=E&&(0,i.pK)(E.id);let D,V;const H=!l.as&&N===s.zy&&q&&C&&(null==E?void 0:E.isPremium)&&(null==E?void 0:E.hasVideoAvatar),M=null==E||null===(t=E.fullInfo)||void 0===t?void 0:t.profilePhoto,j=H&&(null==M?void 0:M.isVideo),z="jumbo"===y;A||x||(E?D=(0,i.RT)(E,z?"big":void 0):P?D=(0,i.RT)(P,z?"big":void 0):b&&(D=`photo${b.id}?size=m`),j&&(V=(0,i.RT)(E,void 0,"video")));const J=(0,m.Z)(D,!1,c.IU.BlobUrl,B),$=(0,m.Z)(V,!j,c.IU.BlobUrl,B),K=Boolean(J||$),X=Boolean(q&&$),{transitionClassNames:Y}=(0,v.Z)(K,void 0,K,"slow"),{handlePlaying:_}=(0,g.Z)(U,X);(0,h.Z)(U,[X]),(0,r.d4)((()=>{const e=U.current;if(!e||!$)return;const t=()=>{R.current+=1,R.current>=3||T?e.style.display="none":e.play()};return e.addEventListener("ended",t),()=>e.removeEventListener("ended",t)}),[T,$]);const W=null==E?void 0:E.id;(0,r.d4)((()=>{H&&!M&&S({userId:W})}),[S,M,W,H]);const G=(0,f.Z)();let Q;const ee=E?(0,i.Js)(E):P?(0,i.U)(G,P):w;if(A)Q=r.ZP.createElement("i",{className:(0,d.Z)(Z.icon,"icon-avatar-saved-messages"),"aria-label":ee});else if(x)Q=r.ZP.createElement("i",{className:(0,d.Z)(Z.icon,"icon-avatar-deleted-account"),"aria-label":ee});else if(F)Q=r.ZP.createElement("i",{className:(0,d.Z)(Z.icon,"icon-reply-filled"),"aria-label":ee});else if(K)Q=r.ZP.createElement(r.ZP.Fragment,null,r.ZP.createElement("img",{src:J,className:(0,d.Z)(Z.media,"avatar-media",Y,$&&"poster"),alt:ee,decoding:"async"}),X&&r.ZP.createElement("video",{ref:U,src:$,className:(0,d.Z)(Z.media,"avatar-media"),muted:!0,autoPlay:!0,disablePictureInPicture:!0,playsInline:!0,onPlaying:_}));else if(E){const e=(0,i.Js)(E);Q=e?(0,a.Xv)(e,2):void 0}else if(P){const e=(0,i.U)(G,P);Q=e&&(0,a.Xv)(e,(0,i.YC)(P.id)?2:1)}else w&&(Q=(0,a.Xv)(w,2));const te=!A&&E&&I&&(0,i.kM)(E,I),ne=(0,d.Z)(`Avatar size-${y}`,n,`color-bg-${(0,i.Rs)(E||P)}`,A&&"saved-messages",x&&"deleted-account",F&&"replies-bot-account",te&&"online",L&&"interactive",!A&&!J&&"no-photo"),re=Boolean(A||J),oe=(0,r.I4)((e=>{L&&L(e,re)}),[L,re]),ce=(E||P)&&(E||P).id;return r.ZP.createElement("div",{ref:O,className:ne,onClick:oe,"data-test-sender-id":s.Cg?ce:void 0,"aria-label":"string"==typeof Q?ee:void 0},"string"==typeof Q?(0,u.Z)(Q,["jumbo"===y?"hq_emoji":"emoji"]):Q)}))},21747:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(14050),o=n(69118),c=n(74753),s=n(45332),l=n(18674);function i(e,t){var n;const i=(0,r.sO)(null===(n=e.current)||void 0===n?void 0:n.paused),a=(0,r.sO)();a.current=t;const d=(0,r.sO)(),u=(0,r.I4)((()=>{d.current=!0,e.current&&(i.current=!e.current.paused,i.current&&e.current.pause())}),[e]),m=(0,r.I4)((()=>{d.current=!1,e.current&&i.current&&a.current&&document.body.contains(e.current)&&(0,c.Z)(e.current)}),[e]),v=(0,r.I4)((()=>{(0,o.T2)(m)}),[m]);return(0,s.Z)(u,v),(0,l.ZP)(u,m),{handlePlaying:(0,r.I4)((()=>{d.current&&(i.current=!0,e.current.pause())}),[e])}}},21273:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(91713),o=n(14050),c=n(69118),s=n(87675),l=n(77361),i=n(80036);const a=".ListItem",d=20,u=800,m=e=>{let{ref:t,className:n,items:m,itemSelector:v=a,preloadBackwards:f=d,sensitiveArea:p=u,withAbsolutePositioning:g,maxHeight:h,noScrollRestore:Z=!1,noScrollRestoreOnTop:y=!1,noFastList:P,cacheBuster:E,children:b,onLoadMore:I,onScroll:w,onKeyDown:A,onDragOver:C,onDragLeave:T}=e,B=(0,o.sO)(null);t&&(B=t);const N=(0,o.sO)({}),[k,L]=(0,o.Ye)((()=>I?[(0,c.Ds)((function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];I({direction:r.Uq.Backwards,noScroll:e})}),1e3,!0,!1),(0,c.Ds)((()=>{I({direction:r.Uq.Forwards})}),1e3,!0,!1)]:[]),[I,m]);(0,o.d4)((()=>{if(!k)return;if(f>0&&(!m||m.length<f))return void k(!0);const{scrollHeight:e,clientHeight:t}=B.current;t&&e<=t&&k()}),[m,k,f]),(0,o.bt)((()=>{const e=B.current,t=N.current;let n;if(t.listItemElements=e.querySelectorAll(v),t.currentAnchor&&Array.from(t.listItemElements).includes(t.currentAnchor)){const{scrollTop:r}=e;n=r+(t.currentAnchor.getBoundingClientRect().top-t.currentAnchorTop)}else{const e=t.listItemElements[0];e&&(t.currentAnchor=e,t.currentAnchorTop=e.getBoundingClientRect().top)}g||Z||y&&0===e.scrollTop||((0,s.Z)(e,n),t.isScrollTopJustUpdated=!0)}),[m,v,Z,y,E,g]);const S=(0,o.I4)((e=>{if(L&&k){const{isScrollTopJustUpdated:e,currentAnchor:t,currentAnchorTop:n}=N.current,r=N.current.listItemElements;if(e)return void(N.current.isScrollTopJustUpdated=!1);const o=r.length,c=B.current,{scrollTop:s,scrollHeight:l,offsetHeight:i}=c,a=s<=(o?r[0].offsetTop:0)+p,d=(o?r[o-1].offsetTop+r[o-1].offsetHeight:l)-(s+i)<=p;let u=!1;if(a){const e=r[0];if(e){const r=e.getBoundingClientRect().top,o=null!=t&&t.offsetParent&&t!==e?t.getBoundingClientRect().top:r;t&&void 0!==n&&o>n&&(N.current.currentAnchor=e,N.current.currentAnchorTop=r,u=!0,L())}}if(d){const e=r[o-1];if(e){const r=e.getBoundingClientRect().top,o=null!=t&&t.offsetParent&&t!==e?t.getBoundingClientRect().top:r;t&&void 0!==n&&o<n&&(N.current.currentAnchor=e,N.current.currentAnchorTop=r,u=!0,k())}}if(!u)if(null!=t&&t.offsetParent)N.current.currentAnchorTop=t.getBoundingClientRect().top;else{const e=r[0];e&&(N.current.currentAnchor=e,N.current.currentAnchorTop=e.getBoundingClientRect().top)}}w&&w(e)}),[k,L,w,p]);return o.ZP.createElement("div",{ref:B,className:n,onScroll:S,teactFastList:!P&&!g,onKeyDown:A,onDragOver:C,onDragLeave:T},g&&null!=m&&m.length?o.ZP.createElement("div",{teactFastList:!P,style:(0,i.Z)("position: relative",l.wZ&&`height: ${h}px`)},b):b)}},13103:(e,t,n)=>{n.d(t,{Z:()=>v});var r=n(14050),o=n(517),c=n(46752),s=n(18674),l=n(31212),i=n(274),a=n(59107),d=n(46590),u=n(231),m=n(62898);const v=e=>{let{dialogRef:t,title:n,className:v,isOpen:f,header:p,hasCloseButton:g,noBackdrop:h,children:Z,style:y,onClose:P,onCloseAnimationEnd:E,onEnter:b,shouldSkipHistoryAnimations:I}=e;const{shouldRender:w,transitionClassNames:A}=(0,l.Z)(f,E,I,void 0,I),C=(0,r.sO)(null);(0,r.d4)((()=>f?(0,o.Z)({onEsc:P,onEnter:b}):void 0),[f,P,b]),(0,r.d4)((()=>f&&C.current?function(e){function t(t){if("Tab"!==t.key)return;t.preventDefault(),t.stopPropagation();const n=Array.from(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(!n.length)return;const r=n.findIndex((e=>e.isSameNode(document.activeElement)));let o=0;r>=0&&(o=t.shiftKey?r>0?r-1:n.length-1:r<n.length-1?r+1:0),n[o].focus()}return document.addEventListener("keydown",t,!1),()=>{document.removeEventListener("keydown",t,!1)}}(C.current):void 0),[f]),(0,d.Z)({isActive:f,onBack:P}),(0,i.Z)((e=>{let[t]=e;return document.body.classList.toggle("has-open-dialog",Boolean(f)),(f||!f&&void 0!==t)&&(0,s.YW)(200),()=>{document.body.classList.remove("has-open-dialog")}}),[f]);const T=(0,a.Z)();if(!w)return;const B=(0,c.Z)("Modal",v,A,h&&"transparent-backdrop");return r.ZP.createElement(m.Z,null,r.ZP.createElement("div",{ref:C,className:B,tabIndex:-1,role:"dialog"},r.ZP.createElement("div",{className:"modal-container"},r.ZP.createElement("div",{className:"modal-backdrop",onClick:P}),r.ZP.createElement("div",{className:"modal-dialog",ref:t},p||(n?r.ZP.createElement("div",{className:"modal-header"},g&&r.ZP.createElement(u.Z,{round:!0,color:"translucent",size:"smaller",ariaLabel:T("Close"),onClick:P},r.ZP.createElement("i",{className:"icon-close"})),r.ZP.createElement("div",{className:"modal-title"},n)):void 0),r.ZP.createElement("div",{className:"modal-content custom-scroll",style:y},Z)))))}},62898:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(14050),o=n(31664);const c=e=>{let{containerId:t,className:n,children:c}=e;const s=(0,r.sO)();return s.current||(s.current=document.createElement("div")),(0,r.bt)((()=>{const e=document.querySelector(t||"#portals");if(!e)return;const r=s.current;return n&&r.classList.add(n),e.appendChild(r),()=>{o.Z.render(void 0,r),e.removeChild(r)}}),[n,t]),o.Z.render(c,s.current)}},9211:(e,t,n)=>{n.d(t,{M:()=>c,P:()=>s});var r=n(86087),o=n(83716);function c(e,t){var n;const{appConfig:c}=e;if(!c)return o.pr[t][0];const s=(0,r.wV)(e),{limits:l}=c,i=null!==(n=l[t][s?1:0])&&void 0!==n?n:o.pr[t][s?1:0];return"dialogFilters"===t?i+1:i}function s(e,t){const{appConfig:n}=e;if(!n)return o.pr[t][1];const{limits:r}=n;return r[t][1]}},27407:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(14050),o=n(91713),c=n(60782),s=n(65326),l=n(87204);function i(e,t,n,r){const{length:c}=e,s=r?e.indexOf(r):0,l=t===o.Uq.Forwards?s:s+1||c,i=Math.max(0,l-n),a=l+n-1,d=e.slice(Math.max(0,i),a+1);let u,m;switch(t){case o.Uq.Forwards:u=l>0,m=i>=0;break;case o.Uq.Backwards:u=l<c,m=a<=c-1}return{newViewportIds:d,areSomeLocal:u,areAllLocal:m}}const a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;const d=(0,r.sO)(),u=(0,r.sO)((()=>{if(!t||d.current)return;const{newViewportIds:e}=i(t,o.Uq.Forwards,a,t[0]);return e})()),m=(0,s.Z)();n&&(d.current={});const v=(0,l.Z)(t),f=(0,l.Z)(n);if(!t||n||t===v&&n===f)t||(u.current=void 0);else{const{offsetId:e=t[0],direction:n=o.Uq.Forwards}=d.current||{},{newViewportIds:r}=i(t,n,a,e);u.current&&(0,c.et)(u.current,r)||(u.current=r)}const p=(0,r.I4)((n=>{let{direction:r,noScroll:s}=n;const l=u.current,v=l?r===o.Uq.Backwards?l[l.length-1]:l[0]:void 0;if(!t)return void(e&&e({offsetId:v}));s||(d.current={...d.current,direction:r,offsetId:v});const{newViewportIds:f,areSomeLocal:p,areAllLocal:g}=i(t,r,a,v);!p||l&&(0,c.et)(l,f)||(u.current=f,m()),!g&&e&&e({offsetId:v})}),[t,a,e,m]);return n?[t]:[u.current,p]}},62357:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(14050);const o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=(0,r.sO)(e);(0,r.bt)((()=>{o.current=e}),[e]),(0,r.d4)((()=>{if(void 0===t)return;const e=setInterval((()=>o.current()),t);return n||o.current(),()=>clearInterval(e)}),[t,n])}},46898:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(14050),o=n(69118);function c(e,t){(0,r.d4)((()=>{const t=e.current;return()=>{t&&(0,o.T2)((()=>{t.pause(),t.src="",t.load()}))}}),t)}},87675:(e,t,n)=>{n.d(t,{Z:()=>s,z:()=>c});var r=n(77361),o=n(82972);function c(e){e.style.display="none",(0,o.Z)(e),e.style.display=""}const s=(e,t)=>{r.cj&&(e.style.overflow="hidden"),void 0!==t&&(e.scrollTop=t),r.cj&&(e.style.overflow="")}}}]);
|
|
//# sourceMappingURL=1989.834f949acc5977e509ff.js.map
|