"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[941],{7941:(t,i,e)=>{e.r(i),e.d(i,{default:()=>p});var s=e(7361),n=e(6926);function a(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}class h{constructor(t){this.worker=t,a(this,"requestStates",new Map),a(this,"requestStatesByCallback",new Map),this.subscribe()}request(t){const{worker:i,requestStates:e,requestStatesByCallback:s}=this,a=(0,n.Z)(e),h={type:"callMethod",messageId:a,...t},r={messageId:a},o=new Promise(((t,i)=>{Object.assign(r,{resolve:t,reject:i})}));if("function"==typeof h.args[h.args.length-1]){const t=h.args.pop();r.callback=t,s.set(t,r)}return e.set(a,r),o.catch((()=>{})).finally((()=>{e.delete(a),r.callback&&s.delete(r.callback)})),i.postMessage(h),o}cancelCallback(t){t.isCanceled=!0;const{messageId:i}=this.requestStatesByCallback.get(t)||{};i&&this.worker.postMessage({type:"cancelProgress",messageId:i})}subscribe(){const{worker:t,requestStates:i}=this;t.addEventListener("message",(t=>{let{data:e}=t;if("methodResponse"===e.type){const t=i.get(e.messageId);t&&(e.error?t.reject(e.error):t.resolve(e.response))}else if("methodCallback"===e.type){var s;const t=i.get(e.messageId);null==t||null===(s=t.callback)||void 0===s||s.call(t,...e.callbackArgs)}else if("unhandledError"===e.type){var n;throw new Error(null===(n=e.error)||void 0===n?void 0:n.message)}}))}}var r=e(9933),o=e(3570);function d(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}const c=s.wB?.75:1,u=s.wZ?.5:.75,l=s.s$?2:4,m=new Array(4).fill(void 0).map((()=>new h(new Worker(new URL(e.p+e.u(354),e.b)))));let g=-1;const p=class{constructor(t,i,e,s={},n,a,h){this.id=t,this.container=i,this.animationData=e,this.params=s,this.onLoad=n,this.customColor=a,this.onEnded=h,d(this,"imgSize",void 0),d(this,"key",void 0),d(this,"msPerFrame",1e3/60),d(this,"reduceFactor",1),d(this,"cacheModulo",void 0),d(this,"chunkSize",void 0),d(this,"workerIndex",void 0),d(this,"chunks",[]),d(this,"framesCount",void 0),d(this,"chunksCount",void 0),d(this,"canvas",document.createElement("canvas")),d(this,"ctx",this.canvas.getContext("2d")),d(this,"isAnimating",!1),d(this,"isWaiting",!0),d(this,"isOnLoadFired",!1),d(this,"isDestroyed",!1),d(this,"approxFrameIndex",0),d(this,"prevFrameIndex",-1),d(this,"stopFrameIndex",0),d(this,"speed",1),d(this,"direction",1),d(this,"lastRenderAt",void 0),this.initContainer(),this.initConfig(),this.initRenderer()}isPlaying(){return this.isAnimating||this.isWaiting}play(){this.stopFrameIndex=void 0,this.direction=1,this.doPlay()}pause(){this.isWaiting?this.stopFrameIndex=this.approxFrameIndex:this.isAnimating=!1;const t=this.getChunkIndex(this.approxFrameIndex);this.chunks=this.chunks.map(((i,e)=>e===t?i:void 0))}goToAndPlay(t){this.approxFrameIndex=Math.floor(t/this.reduceFactor),this.stopFrameIndex=void 0,this.direction=1,this.doPlay()}goToAndStop(t){this.approxFrameIndex=Math.floor(t/this.reduceFactor),this.stopFrameIndex=Math.floor(t/this.reduceFactor),this.direction=1,this.doPlay()}playSegment(t){let[i,e]=t;this.approxFrameIndex=Math.floor(i/this.reduceFactor),this.stopFrameIndex=Math.floor(e/this.reduceFactor),this.direction=i{if(this.isDestroyed)return!1;if(!this.isAnimating&&this.isOnLoadFired)return!1;const t=Math.round(this.approxFrameIndex),i=this.getChunkIndex(t),e=this.chunks[i];if(!e||0===e.length)return this.requestChunk(i),this.isAnimating=!1,this.isWaiting=!0,!1;if(this.cacheModulo&&i%this.cacheModulo==0&&this.cleanupPrevChunk(i),t!==this.prevFrameIndex){const i=this.getFrame(t);if(!i)return this.isAnimating=!1,this.isWaiting=!0,!1;const e=new Uint8ClampedArray(i);if(this.customColor)for(let t=0;t0&&(t===this.framesCount-1||h>this.framesCount-1)){var r;if(this.params.noLoop)return this.isAnimating=!1,null===(r=this.onEnded)||void 0===r||r.call(this),!1;this.approxFrameIndex=0}else if(a<0&&(0===t||h<0)){var o;if(this.params.noLoop)return this.isAnimating=!1,null===(o=this.onEnded)||void 0===o||o.call(this),!1;this.approxFrameIndex=this.framesCount-1}else{if(void 0!==this.stopFrameIndex&&(t===this.stopFrameIndex||a>0&&h>this.stopFrameIndex||a<0&&h{function s(t,i){return i-Math.floor(i/t)*t}e.d(i,{Z:()=>s})}}]); //# sourceMappingURL=941.367e239e47c825643813.js.map