PageSourceSearch

https://easypay.ua/1755.0f64d26ba982e61d.js

js easypay.ua collected 2026-09-24 09:55:06 UTC 47,006 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkweb_front_end_angular_cli=self.webpackChunkweb_front_end_angular_cli||[]).push([[1755],{11628:(Y,N,r)=>{r.d(N,{L:()=>I});var C=r(85240),A=r(12481),S=r(60316),P=r(77976);let I=(()=>{var x;class T{constructor(){this.linkService=(0,C.WQX)(P._),this.platform=(0,C.WQX)(A.Agw),this.FONT_URL="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap",this.fontLoaded=!1,this.loadFont()}loadFont(){!this.fontLoaded&&(0,S.UE)(this.platform)&&(document.querySelector(`link[href="${this.FONT_URL}"]`)||this.linkService.addTag({rel:"stylesheet",href:this.FONT_URL}),this.fontLoaded=!0)}}return(x=T).\u0275fac=function(n){return new(n||x)},x.\u0275prov=C.jDH({token:x,factory:x.\u0275fac,providedIn:"root"}),T})()},29223:(Y,N,r)=>{r.d(N,{K:()=>A});var C=r(12481);let A=(()=>{var S;class P{transform(x,T=5){return null==x&&(x=0),String(x).padStart(T,"0")}}return(S=P).\u0275fac=function(x){return new(x||S)},S.\u0275pipe=C.EJ8({name:"scoreFormat",type:S,pure:!0}),P})()},71755:(Y,N,r)=>{r.r(N),r.d(N,{horseGameRoutes:()=>V});var C=r(85240),A=r(99148),S=r(93683),P=r(34487),I=r(67696),x=r(68071),T=r(48503),X=r(29223),n=r(12481);const R=l=>[l];function b(l,D){if(1&l&&(n.j41(0,"div",2),n.EFF(1," \u0422\u0432\u0456\u0439 \u0440\u0435\u043a\u043e\u0440\u0434: "),n.j41(2,"span",3),n.EFF(3),n.nI1(4,"scoreFormat"),n.k0s()(),n.j41(5,"div",4),n.nrm(6,"i",5),n.EFF(7),n.k0s()),2&l){n.XpG(2);const p=n.r8f(1);n.R7$(3),n.JRh(n.i5U(4,2,null==p?null:p.highScore,5)),n.R7$(4),n.SpI(" ",null==p?null:p.accountLivesCount)}}function B(l,D){if(1&l&&(n.nVh(0,b,8,5),n.j41(1,"a",1),n.nI1(2,"localize"),n.EFF(3),n.nI1(4,"translate"),n.k0s()),2&l){const p=n.XpG();n.vxM(p.isAuth()?0:-1),n.R7$(),n.Y8G("routerLink",n.eq3(7,R,n.bMT(2,3,"./rules"))),n.R7$(2),n.SpI(" ",n.bMT(4,5,"promo.snake.head.link-text")," ")}}let k=(()=>{var l;class D{constructor(){this.isAuth=(0,A.hFB)(!1),this.horseService=(0,C.WQX)(I.Y),this.userGameInfo$=this.horseService.userGameInfo$,this.isActivePromo$=this.horseService.isHorsePromoActive()}}return(l=D).\u0275fac=function(f){return new(f||l)},l.\u0275cmp=n.VBU({type:l,selectors:[["app-horse-head"]],inputs:{isAuth:[1,"isAuth"]},decls:5,vars:7,consts:[[1,"horse-header","flex-container",3,"ngClass"],[1,"horse-rules",3,"routerLink"],[1,"horse-score"],[1,"horse-score-value","font-pixel"],[1,"horse-lives"],["heart",""]],template:function(f,_){1&f&&(n.j41(0,"section",0),n.SS7(1),n.nI1(2,"async"),n.nVh(3,B,5,9),n.nI1(4,"async"),n.k0s()),2&f&&(n.Y8G("ngClass",_.isAuth()?"align-justify":"align-right"),n.R7$(),n.bH3(n.bMT(2,2,_.userGameInfo$)),n.R7$(2),n.vxM(n.bMT(4,5,_.isActivePromo$)?3:-1))},dependencies:[S.YU,P.Wk,S.Jj,x.t,T.D9,X.K],styles:['.horse-header[_ngcontent-%COMP%]{height:var(--h-header-height);display:flex;align-items:center;gap:clamp(12px,3vw,24px);padding:10px 16px;background:#e6eff6;font-size:14px;font-weight:500;color:var(--text-color)}.horse-header.align-right[_ngcontent-%COMP%]{justify-content:flex-end}.horse-header[_ngcontent-%COMP%]   .horse-score[_ngcontent-%COMP%]{display:flex;gap:4px;cursor:default}.horse-header[_ngcontent-%COMP%]   .horse-score-value[_ngcontent-%COMP%]{font-weight:400}.horse-header[_ngcontent-%COMP%]   .horse-lives[_ngcontent-%COMP%]{margin-left:auto;font-weight:400;cursor:default}.horse-header[_ngcontent-%COMP%]   .horse-lives[_ngcontent-%COMP%]   [heart][_ngcontent-%COMP%]{width:24px;margin-bottom:-4px}.horse-header[_ngcontent-%COMP%]   .horse-rules[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;gap:2px;text-decoration:none;color:inherit}.horse-header[_ngcontent-%COMP%]   .horse-rules[_ngcontent-%COMP%]:before{content:"";background-image:url(/assets/images/horse-pics/bell.svg);background-size:contain;background-repeat:no-repeat;width:24px;height:24px;display:inline-block}'],changeDetection:0}),D})();var G=r(15456),c=r(68010),y=r(73929),W=r(98509),$=r(24331),j=r(51567),F=r(70271),K=r(63037),O=r(98764),J=r(2435),H=r(49074),Z=r(11628);function z(l,D){if(1&l&&(n.nrm(0,"app-horse-head",1),n.nI1(1,"async")),2&l){const p=n.XpG();n.Y8G("isAuth",n.bMT(1,1,null==p.authService?null:p.authService.isAuth$))}}let g=(()=>{var l;class D{constructor(f,_,q,tt){this.ps2pFontLoader=f,this.authService=_,this.publicService=q,this.horseService=tt,this.router=(0,C.WQX)(W.Ix),this.activatedRoute=(0,C.WQX)(W.nX),this.isNotRulesRoute=()=>"rules"!==this.activatedRoute.firstChild?.snapshot?.routeConfig?.path,this.showHeader$=this.router.events.pipe((0,j.p)(et=>et instanceof W.wF),(0,F.T)(()=>this.isNotRulesRoute()),(0,K.Z)(this.isNotRulesRoute())),this.authStateSubscription(),this.authService.isAuth$.value&&this.getUserGameInfo()}ngOnInit(){this.publicService.announceShowSupportChats(!1)}ngOnDestroy(){this.publicService.announceShowSupportChats(!0),this.horseService.resetHorseGameData()}authStateSubscription(){this.authService.authState().pipe((0,H.pQ)(),(0,O.M)(f=>this.onAuthStateChange(f))).subscribe()}onAuthStateChange(f){f?this.getUserGameInfo():this.horseService.resetHorseGameData()}getUserGameInfo(){this.horseService.horseGameAccountInfo().pipe((0,J.$)()).subscribe()}}return(l=D).\u0275fac=function(f){return new(f||l)(n.rXU(Z.L),n.rXU(c.u),n.rXU($.Z),n.rXU(I.Y))},l.\u0275cmp=n.VBU({type:l,selectors:[["app-horse-game"]],features:[n.Jv_([y.G])],decls:18,vars:7,consts:[[1,"horse-game","row","flex-dir-column"],[3,"isAuth"],["xmlns","http://www.w3.org/2000/svg",1,"hidden-autocomplete-input"],["id","play","viewBox","0 0 114 48"],["fill","currentColor","d","M103.22 42.67h5.33V5.34h-5.33zM108.56 38.22h5.33V9.78h-5.33zM10.78 0h92.44v48H10.78z"],["fill","currentColor","d","M10.78 5.33H5.45v37.33h5.33zM5.44 9.78H.11v28.44h5.33z"],["fill","currentColor","d","M110 0h4v4h-4zM110 44h4v4h-4zM1 0h4v4H1zM0 44h4v4H0z"],["x","57","y","18","fill","white","text-anchor","middle","dominant-baseline","hanging"],["id","jump","viewBox","0 0 114 48"]],template:function(f,_){1&f&&(n.j41(0,"article",0),n.nI1(1,"async"),n.nVh(2,z,2,3,"app-horse-head",1),n.nI1(3,"async"),n.nrm(4,"router-outlet"),n.k0s(),C.qSk(),n.j41(5,"svg",2)(6,"symbol",3),n.nrm(7,"path",4)(8,"path",5)(9,"path",6),n.j41(10,"text",7),n.EFF(11,"play"),n.k0s()(),n.j41(12,"symbol",8),n.nrm(13,"path",4)(14,"path",5)(1
15,"path",6),n.j41(16,"text",7),n.EFF(17,"jump"),n.k0s()()()),2&f&&(n.AVh("overflow",n.bMT(1,3,_.showHeader$)),n.R7$(2),n.vxM(n.bMT(3,5,_.showHeader$)?2:-1))},dependencies:[k,G.M,W.n3,S.Jj],styles:[':root{--text-color: #8CA6B7;--h-header-height: 40px;--game-container-height: 640px}  .font-pixel,   .game-button-style{font-family:"Press Start 2P"}  .heart,   [heart]{display:inline-block;width:16px;aspect-ratio:8/6;background-image:url(/assets/images/horse-pics/icon-live.svg);background-size:contain;background-repeat:no-repeat}  .game-button-style{font-size:22px;fill:#fff;text-anchor:middle;text-transform:uppercase;color:#b93600;cursor:pointer;clip-path:polygon(104px 0,100% 10px,100% 39px,104px 100%,10px 100%,0 39px,0 10px,10px 0);transform:scale(1.1);transition:background-color .2s ease,transform .3s ease}  .game-button-style:hover,   .game-button-style:active{color:#e63600}  .game-button-style:focus,   .game-button-style:active{transform:scale(1)}  .game-button-style:active{clip-path:polygon(0 0,100% 0,100% 100%,0 100%)}  .game-button-style svg{pointer-events:none}[_nghost-%COMP%]{display:block;padding:0}@media (min-width: 1024px) and (min-height: 740px){[_nghost-%COMP%]{padding:16px 0 40px;--h-header-height: 48px}}.horse-game[_ngcontent-%COMP%]{min-height:640px;max-width:640px;background:#d6e7f3}@media (min-width: 1024px){.horse-game[_ngcontent-%COMP%]{border-radius:5px}}'],changeDetection:0}),D})();var Q=r(9496);const V=[{path:"",component:g,children:[{path:"",loadComponent:()=>r.e(7196).then(r.bind(r,87196)).then(l=>l.HorseMainComponent),canActivate:[()=>{const l=(0,C.WQX)(I.Y),D=(0,C.WQX)(W.Ix),p=(0,C.WQX)(Q.Q);return l.isHorsePromoActive().pipe((0,O.M)(f=>{f||D.navigate([p.translateRoute("./promo/horse/rating")])}),(0,F.T)(f=>f))}]},{path:"rating",loadComponent:()=>Promise.all([r.e(2076),r.e(5356)]).then(r.bind(r,85356)).then(l=>l.HorseRatingComponent)},{path:"rules",loadComponent:()=>r.e(5700).then(r.bind(r,5700)).then(l=>l.HorseRulesComponent)},{path:"**",redirectTo:""}]}]},73929:(Y,N,r)=>{r.d(N,{G:()=>Et});var C=r(89204),A=r(75797);const I=window.devicePixelRatio>1,x=/iPad|iPhone|iPod/.test(window.navigator.userAgent),T=/Android/.test(window.navigator.userAgent)||x,n=(window,{ACCELERATION:.1,BG_CLOUD_SPEED:.2,BOTTOM_PAD:30,CLEAR_TIME:3e3,CLOUD_FREQUENCY:.5,GAMEOVER_CLEAR_TIME:750,GAP_COEFFICIENT:.6,GRAVITY:.6,INITIAL_JUMP_VELOCITY:12,INVERT_FADE_DURATION:12e3,INVERT_DISTANCE:700,MAX_BLINK_COUNT:3,MAX_CLOUDS:6,MAX_OBSTACLE_LENGTH:3,MAX_OBSTACLE_DUPLICATION:2,MAX_SPEED:13,MIN_JUMP_HEIGHT:35,MOBILE_SPEED_COEFFICIENT:1.2,RESOURCE_TEMPLATE_ID:"audio-resources",SPEED:6,SPEED_DROP_COEFFICIENT:3,DEBUG_HORSE:!0,DEBUG_OBSTACLES:!1}),R={WIDTH:600,HEIGHT:288},b={CANVAS:"runner-canvas",CONTAINER:"runner-container",TOUCH_CONTROLLER:"controller"},B={LDPI:{CLOUD:{x:86,y:2},HORIZON:{x:2,y:54},HORSE:{x:835,y:2},SANTA:{x:550,y:2},SNOWMAN_LARGE:{x:332,y:2},SNOWMAN_SMALL:{x:228,y:3},TEXT_SPRITE:{x:655,y:2}},HDPI:{CLOUD:{x:166,y:2},HORIZON:{x:2,y:104},HORSE:{x:1671,y:6},SANTA:{x:1100,y:2},SNOWMAN_LARGE:{x:665,y:3},SNOWMAN_SMALL:{x:456,y:3},TEXT_SPRITE:{x:1294,y:2}}},k={BUTTON_PRESS:"offline-sound-press",HIT:"offline-sound-hit",SCORE:"offline-sound-reached"},G={JUMP:{38:1,32:1},DUCK:{40:1},RESTART:{13:1}},c={ANIM_END:"webkitAnimationEnd",CLICK:"click",KEYDOWN:"keydown",KEYUP:"keyup",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",RESIZE:"resize",TOUCHEND:"touchend",TOUCHSTART:"touchstart",VISIBILITY:"visibilitychange",BLUR:"blur",FOCUS:"focus",LOAD:"load"};function y(o,e){return Math.floor(Math.random()*(e-o+1))+o}function j(o){const e=o.length/4*3,i=atob(o),t=new ArrayBuffer(e),s=new Uint8Array(t);for(let h=0;h<e;h++)s[h]=i.charCodeAt(h);return s.buffer}function F(){return x?(new Date).getTime():performance.now()}function K(o,e,i){const t=o.getContext("2d");if(!t)return!1;const s=Math.floor(window.devicePixelRatio)||1,h=Math.floor(t.webkitBackingStorePixelRatio)||1,a=s/h;if(s!==h){const m=e||o.width,d=i||o.height;return o.width=m*a,o.height=d*a,o.style.width=m+"px",o.style.height=d+"px",t.scale(a,a),!0}return 1==s&&(o.style.width=o.width+"px",o.style.height=o.height+"px"),!1}class J{constructor(e,i,t){this.canvas=e;const s=e.getContext("2d");if(!s)throw new Error("Could not get 2d context from canvas");this.canvasCtx=s,this.spritePos=i,this.containerWidth=t,this.xPos=t,this.yPos=0,this.remove=!1,this.cloudGap=y(100,400),this.init()}init(){this.yPos=y(30,71),this.draw()}draw(){this.canvasCtx.save();let e=46,i=14;I&&(e*=2,i*=2),u.imageSprite&&(this.canvasCtx.drawImage(u.imageSprite,this.spritePos.x,this.spritePos.y,e,i,this.xPos,this.yPos,46,14),this.canvasCtx.restore(
1))}update(e){this.remove||(this.xPos-=Math.ceil(e),this.isVisible()||(this.remove=!0))}isVisible(){return this.xPos+46>0}}const H={WIDTH:600,HEIGHT:12,YPOS:245};class Z{constructor(e,i){this.spritePos=i,this.canvas=e;const t=e.getContext("2d");if(!t)throw new Error("Could not get 2d context from canvas");this.canvasCtx=t,this.sourceDimensions={},this.dimensions=H,this.sourceXPos=[this.spritePos.x,this.spritePos.x+this.dimensions.WIDTH],this.xPos=[],this.yPos=0,this.bumpThreshold=.5,this.setSourceDimensions(),this.draw()}setSourceDimensions(){for(const e in H)I?"YPOS"!=e&&(this.sourceDimensions[e]=2*H[e]):this.sourceDimensions[e]=H[e],this.dimensions[e]=H[e];this.xPos=[0,H.WIDTH],this.yPos=H.YPOS}getRandomType(){return Math.random()>this.bumpThreshold?this.dimensions.WIDTH:0}draw(){u.imageSprite&&(this.canvasCtx.drawImage(u.imageSprite,this.sourceXPos[0],this.spritePos.y,this.sourceDimensions.WIDTH,this.sourceDimensions.HEIGHT,this.xPos[0],this.yPos,this.dimensions.WIDTH,this.dimensions.HEIGHT),this.canvasCtx.drawImage(u.imageSprite,this.sourceXPos[1],this.spritePos.y,this.sourceDimensions.WIDTH,this.sourceDimensions.HEIGHT,this.xPos[1],this.yPos,this.dimensions.WIDTH,this.dimensions.HEIGHT))}updateXPos(e,i){const t=e,s=0==e?1:0;this.xPos[t]-=i,this.xPos[s]=this.xPos[t]+this.dimensions.WIDTH,this.xPos[t]<=-this.dimensions.WIDTH&&(this.xPos[t]+=2*this.dimensions.WIDTH,this.xPos[s]=this.xPos[t]-this.dimensions.WIDTH,this.sourceXPos[t]=this.getRandomType()+this.spritePos.x)}update(e,i){const t=Math.floor(.06*i*e);this.updateXPos(this.xPos[0]<=0?0:1,t)}reset(){this.xPos[0]=0,this.xPos[1]=H.WIDTH}}class z{constructor(e,i,t){this.canvas=e;const s=e.getContext("2d");if(!s)throw new Error("Could not get 2d context from canvas");this.canvasCtx=s,this.image=i,this.containerWidth=t,this.width=Math.round(141/392*2280),this.height=141,this.yPos=110,this.speed=2,this.xPos=[100,this.width+100],this.init()}init(){this.xPos=[100,this.width+100]}draw(){!this.image||!this.image.complete||(this.canvasCtx.save(),this.canvasCtx.drawImage(this.image,0,0,2280,392,this.xPos[0],this.yPos,this.width,this.height),this.canvasCtx.drawImage(this.image,0,0,2280,392,this.xPos[1],this.yPos,this.width,this.height),this.canvasCtx.restore())}update(e,i){this.debugCurrentSpeed=i||0,this.debugSpeedPerMs=this.speed*(i||0)/1e3;const t=this.speed/1e3*e*i,s=Math.ceil(t);this.debugSpeedPerFrame=t,s>0&&(this.xPos[0]-=s/1.1,this.xPos[1]-=s/1.1,this.xPos[0]<=-this.width&&(this.xPos[0]+=2*this.width),this.xPos[1]<=-this.width&&(this.xPos[1]+=2*this.width),Math.abs(this.xPos[1]-this.xPos[0])<this.width&&(this.xPos[0]<this.xPos[1]?this.xPos[1]=this.xPos[0]+this.width:this.xPos[0]=this.xPos[1]+this.width))}reset(){this.xPos=[0,this.width]}}class g{constructor(e,i,t,s){this.x=e,this.y=i,this.width=t,this.height=s}}const V=[{type:"SNOWMAN_SMALL",width:17,height:35,yPos:223,multipleSpeed:4,minGap:120,minSpeed:0,collisionBoxes:[new g(0,17,5,18),new g(4,0,6,34),new g(10,4,7,30)]},{type:"SNOWMAN_LARGE",width:25,height:52,yPos:208,multipleSpeed:7,minGap:120,minSpeed:0,collisionBoxes:[new g(0,22,7,27),new g(6,0,12,49),new g(16,10,10,38)]},{type:"SANTA",width:81,height:42,yPos:[190,160],yPosMobile:[50,70],multipleSpeed:999,minSpeed:8.5,minGap:150,collisionBoxes:[new g(0,7,23,16),new g(10,21,70,20),new g(54,1,13,21),new g(67,13,15,7)],frameRate:1e3/12,speedOffset:1}];class l{constructor(e,i,t,s,h,a,m=0){this.canvasCtx=e,this.spritePos=t,this.typeConfig=i,this.gapCoefficient=h,this.size=y(1,3),this.dimensions=s,this.remove=!1,this.xPos=s.WIDTH+(m||0),this.yPos=0,this.width=0,this.collisionBoxes=[],this.gap=0,this.speedOffset=0,this.currentFrame=0,this.timer=0,this.init(a)}init(e){if(this.cloneCollisionBoxes(),this.size>1&&this.typeConfig.multipleSpeed>e&&(this.size=1),this.width=this.typeConfig.width*this.size,Array.isArray(this.typeConfig.yPos)){const i=T?this.typeConfig.yPosMobile:this.typeConfig.yPos;this.yPos=i[y(0,i.length-1)]}else this.yPos=this.typeConfig.yPos;this.size>1&&(this.collisionBoxes[1].width=this.width-this.collisionBoxes[0].width-this.collisionBoxes[2].width,this.collisionBoxes[2].x=this.width-this.collisionBoxes[2].width),this.typeConfig.speedOffset&&(this.speedOffset=this.t
1ypeConfig.speedOffset),this.gap=this.getGap(this.gapCoefficient,e)}draw(){let e=this.typeConfig.width,i=this.typeConfig.height;I&&(e*=2,i*=2);let t=e*this.size*(.5*(this.size-1))+this.spritePos.x;if(this.currentFrame>0&&(t+=e*this.currentFrame),u.imageSprite&&(this.canvasCtx.drawImage(u.imageSprite,t,this.spritePos.y,e*this.size,i,this.xPos,this.yPos,this.typeConfig.width*this.size,this.typeConfig.height),u.config.DEBUG_OBSTACLES)){this.canvasCtx.save(),this.canvasCtx.strokeStyle="#ff0000",this.canvasCtx.lineWidth=1,this.canvasCtx.strokeRect(this.xPos,this.yPos,this.typeConfig.width*this.size,this.typeConfig.height),this.canvasCtx.strokeStyle="#00ff00",this.canvasCtx.lineWidth=.5;for(let s=0;s<this.collisionBoxes.length;s++){const h=this.collisionBoxes[s];this.canvasCtx.strokeRect(this.xPos+h.x,this.yPos+h.y,h.width,h.height)}this.canvasCtx.restore()}}update(e,i){this.remove||(this.typeConfig.speedOffset&&(i+=this.speedOffset),this.xPos-=Math.floor(60*i/1e3*e),this.typeConfig.numFrames&&(this.timer+=e,this.timer>=(this.typeConfig.frameRate||0)&&(this.currentFrame=this.currentFrame==this.typeConfig.numFrames-1?0:this.currentFrame+1,this.timer=0)),this.isVisible()||(this.remove=!0))}getGap(e,i){const t=Math.round(this.width*i+this.typeConfig.minGap*e);return y(t,Math.round(1.5*t))}isVisible(){return this.xPos+this.width>0}cloneCollisionBoxes(){const e=this.typeConfig.collisionBoxes;for(let i=e.length-1;i>=0;i--){const t=e[i];this.collisionBoxes[i]=new g(t.x,t.y,t.width,t.height)}}}const D={BG_CLOUD_SPEED:.2,BUMPY_THRESHOLD:.3,CLOUD_FREQUENCY:.5,HORIZON_HEIGHT:16,MAX_CLOUDS:6};class p{constructor(e,i,t,s){this.canvas=e;const h=e.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");this.canvasCtx=h,this.config=D,this.dimensions=t,this.gapCoefficient=s,this.obstacles=[],this.obstacleHistory=[],this.horizonOffsets=[0,0],this.cloudFrequency=this.config.CLOUD_FREQUENCY,this.spritePos=i,this.clouds=[],this.cloudSpeed=this.config.BG_CLOUD_SPEED,this.horizonLine=null,this.backgroundMountain=null,this.init()}init(){this.addCloud(),this.horizonLine=new Z(this.canvas,this.spritePos.HORIZON),u.backgroundMountainImage&&(this.backgroundMountain=new z(this.canvas,u.backgroundMountainImage,this.dimensions.WIDTH))}update(e=0,i=0,t=!1,s){!this.backgroundMountain&&u.backgroundMountainImage&&u.backgroundMountainImage.complete&&(this.backgroundMountain=new z(this.canvas,u.backgroundMountainImage,this.dimensions.WIDTH)),this.backgroundMountain?.update(e,i),this.horizonLine?.update(e,i),this.updateClouds(e,i),t&&this.updateObstacles(e,i),this.draw(s)}draw(e){this.clouds?.length>0&&this.clouds.forEach(i=>{i.remove||i.draw()}),this.backgroundMountain?.draw(),e&&e?.draw(),this.horizonLine?.draw(),this.obstacles?.forEach(i=>{i.remove||i.draw()})}updateClouds(e,i){const t=this.cloudSpeed/1e3*e*i,s=this.clouds.length;if(s){for(let a=s-1;a>=0;a--)this.clouds[a].update(t);const h=this.clouds[s-1];s<this.config.MAX_CLOUDS&&this.dimensions.WIDTH-h.xPos>h.cloudGap&&this.cloudFrequency>Math.random()&&this.addCloud(),this.clouds=this.clouds.filter(function(a){return!a.remove})}else this.addCloud()}updateObstacles(e,i){let t=this.obstacles.slice(0);for(let s=0;s<this.obstacles.length;s++){const h=this.obstacles[s];h.update(e,i),h.remove&&t.shift()}if(this.obstacles=t,this.obstacles.length>0){const s=this.obstacles[this.obstacles.length-1];s&&!s.followingObstacleCreated&&s.isVisible()&&s.xPos+s.width+s.gap<this.dimensions.WIDTH&&(this.addNewObstacle(i),s.followingObstacleCreated=!0)}else this.addNewObstacle(i)}removeFirstObstacle(){this.obstacles.shift()}addNewObstacle(e){const i=y(0,V.length-1),t=V[i];this.duplicateObstacleCheck(t.type)||e<t.minSpeed?this.addNewObstacle(e):(this.obstacles.push(new l(this.canvasCtx,t,this.spritePos[t.type],this.dimensions,this.gapCoefficient,e,t.width)),this.obstacleHistory.unshift(t.type),this.obstacleHistory.length>1&&this.obstacleHistory.splice(u.config.MAX_OBSTACLE_DUPLICATION))}duplicateObstacleCheck(e){let i=0;for(let t=0;t<this.obstacleHistory.length;t++)i=this.obstacleHistory[t]==e?i+1:0;return i>=u.config.MAX_OBSTACLE_DUPLICATION}reset(){this.obstacles=[],this.horizonLine?.reset(),this.backgroundMountain?.reset()}resize(e,i){this.canvas.width=e,this.canvas.height=i}
1addCloud(){this.clouds.push(new J(this.canvas,this.spritePos.CLOUD,this.dimensions.WIDTH))}}const q={MAX_DISTANCE_UNITS:5,ACHIEVEMENT_DISTANCE:100,COEFFICIENT:.025,FLASH_DURATION:250,FLASH_ITERATIONS:3};class tt{constructor(e,i,t){this.canvas=e;const s=e.getContext("2d");if(!s)throw new Error("Could not get 2d context from canvas");this.canvasCtx=s,this.image=u.imageSprite,this.spritePos=i,this.x=0,this.y=5,this.currentDistance=0,this.maxScore=0,this.highScore="",this.container=null,this.currentScoreText="",this.acheivement=!1,this.defaultString="",this.flashTimer=0,this.flashIterations=0,this.invertTrigger=!1,this.config=q,this.maxScoreUnits=this.config.MAX_DISTANCE_UNITS,this.distance=0,this.init(t)}init(e){let i="";this.calcXPos(e),this.maxScore=this.maxScoreUnits;for(let t=0;t<this.maxScoreUnits;t++)this.defaultString+="0",i+="9";this.maxScore=parseInt(i),this.currentScoreText=this.defaultString}calcXPos(e){this.x=e-11*(this.maxScoreUnits+1)}drawScore(e){this.canvasCtx.save(),this.canvasCtx.translate(this.x,this.y),this.canvasCtx.font='13px "Press Start 2P"',this.canvasCtx.fillStyle="#535353",this.canvasCtx.textAlign="left",this.canvasCtx.textBaseline="top",this.canvasCtx.letterSpacing="0.5px",this.canvasCtx.fillText(e,-10,10),this.canvasCtx.restore()}getActualDistance(e){return e?Math.round(e*this.config.COEFFICIENT):0}update(e,i){let t=!0,s=!1;return this.acheivement?this.flashIterations<=this.config.FLASH_ITERATIONS?(this.flashTimer+=e,this.flashTimer<this.config.FLASH_DURATION?t=!1:this.flashTimer>2*this.config.FLASH_DURATION&&(this.flashTimer=0,this.flashIterations++)):(this.acheivement=!1,this.flashIterations=0,this.flashTimer=0):((i=this.getActualDistance(i))>this.maxScore&&this.maxScoreUnits==this.config.MAX_DISTANCE_UNITS?(this.maxScoreUnits++,this.maxScore=parseInt(this.maxScore+"9")):this.distance=0,i>0?(i%this.config.ACHIEVEMENT_DISTANCE==0&&(this.acheivement=!0,this.flashTimer=0,s=!0),this.currentScoreText=(this.defaultString+i).substr(-this.maxScoreUnits)):this.currentScoreText=this.defaultString),t&&this.drawScore(this.currentScoreText),s}reset(){this.update(0,0),this.acheivement=!1}}function st(o,e){return new g(o.x+e.x,o.y+e.y,o.width,o.height)}function ht(o,e,i){o.save(),o.strokeStyle="#f00",o.strokeRect(e.x,e.y,e.width,e.height),o.strokeStyle="#0f0",o.strokeRect(i.x,i.y,i.width,i.height),o.restore()}function rt(o,e){return o.x<e.x+e.width&&o.x+o.width>e.x&&o.y<e.y+e.height&&o.height+o.y>e.y}const it={DROP_VELOCITY:-5,GRAVITY:.6,HEIGHT:45,INIITAL_JUMP_VELOCITY:-10,INTRO_DURATION:1500,MAX_JUMP_HEIGHT:30,MIN_JUMP_HEIGHT:30,SPEED_DROP_COEFFICIENT:3,SPRITE_WIDTH:262,START_X_POS:100,START_X_MOBILE:93,WIDTH:44},at={RUNNING:[new g(0,21,10,5),new g(9,21,26,22),new g(24,0,12,43),new g(36,14,6,4)]};var U=function(o){return o.CRASHED="CRASHED",o.JUMPING="JUMPING",o.RUNNING="RUNNING",o.WAITING="WAITING",o}(U||{});const nt={WAITING:{frames:[46.9,0,0,0,0,0,0,143,0,0,0,0],msPerFrame:1e3},RUNNING:{frames:[95,143],msPerFrame:1e3/12},CRASHED:{frames:[228],msPerFrame:1e3/6},JUMPING:{frames:[0],msPerFrame:1e3/60}};class ut{constructor(e,i){this.canvas=e;const t=e.getContext("2d");if(!t)throw new Error("Could not get 2d context from canvas");this.canvasCtx=t,this.spritePos=i,this.xPos=0,this.yPos=0,this.groundYPos=0,this.currentFrame=0,this.currentAnimFrames=[],this.blinkDelay=0,this.blinkCount=0,this.animStartTime=0,this.timer=0,this.msPerFrame=1e3/60,this.config={...it},this.status=U.WAITING,this.jumping=!1,this.jumpVelocity=0,this.reachedMinHeight=!1,this.speedDrop=!1,this.jumpCount=0,this.jumpspotX=0,this.playingIntro=!1,this.minJumpHeight=0,this.midair=!1,this.collisionBoxes=at,this.init()}init(){this.groundYPos=R.HEIGHT-this.config.HEIGHT-u.config.BOTTOM_PAD,this.yPos=this.groundYPos,this.minJumpHeight=this.groundYPos-this.config.MIN_JUMP_HEIGHT,this.draw(0,0),this.update(0,U.WAITING)}setJumpVelocity(e){const i=1.5*Math.abs(it.INIITAL_JUMP_VELOCITY),t=Math.min(Math.max(e,0),i);this.config.INIITAL_JUMP_VELOCITY=-t,this.config.DROP_VELOCITY=-t/2}update(e,i){this.timer+=e,i&&(this.status=i,this.currentFrame=0,this.msPerFrame=nt[i].msPerFrame,this.currentAnimFrames=nt[i].frames);const t=T?this.config.START_X_MOBILE:this.config.START_X_POS;this.playingIntro&&this.xPos<t&&(this.xPos+=Math.round(t/this.config.INTRO_DURATION*e)),this.draw(this.currentAnimFrames[this.currentFrame],0),this.timer>=this.msPerFrame&&(this.currentFrame=this.currentFrame==this.currentAnimFrames.length-1?0:this.currentFrame+1,this.timer=0),this.speedDrop&&this.yPos==this.groundYPos&&(this.speedDrop=!1)}draw(e,i){let t=e,s=i,h=this.config.WIDTH,a=this.config.HEIGHT;if(I&&(t*=2,s*=2,h*=2,a*=2),t+=this.spritePos.x,s+=this.spritePos.y,u.imageSprite&&(this.canvasCtx.drawImage(u.imageSprite,t,s,h,a,this.xPos,this.yPos,this.config.WIDTH,this.config.HEIGHT),u.config.DEBUG_OBSTACLES&&u.config.DEBUG_HORSE)){this.canvasCtx.save();const m=this.config.WIDTH,d=this.config.HEIGHT;this.canvasCtx.strokeStyle="#FF0000",this.canvasCtx.strokeRect(this.xPos,this.yPos,m,d);const E=at.RUNNING,L=new g(this.xPos+1,this.yPos+1,m-2,d-2);this.canvasCtx.strokeStyle="#00FF00";for(let M=0;M<E.length;M++){const w=st(E[M],L);this.canvasCtx.strokeRect(w.x,w.y,w.width,w.height)}this.canvasCtx.fillStyle="#FFFF00",this.canvasCtx.font="10px Arial",this.canvasCtx.textAlign="center",this.canvasCtx.textBaseline="bottom",this.canvasCtx.restore(
1)}}setBlinkDelay(){this.blinkDelay=Math.ceil(7e3*Math.random())}blink(e){e-this.animStartTime>=this.blinkDelay&&(this.draw(this.currentAnimFrames[this.currentFrame],0),1==this.currentFrame&&(this.setBlinkDelay(),this.animStartTime=e,this.blinkCount++))}startJump(e){this.jumping||(this.update(0,U.JUMPING),this.jumpVelocity=this.config.INIITAL_JUMP_VELOCITY-e/10,this.jumping=!0,this.jumpCount++,this.reachedMinHeight=!1,this.speedDrop=!1)}endJump(){this.reachedMinHeight&&this.jumpVelocity<this.config.DROP_VELOCITY&&(this.jumpVelocity=this.config.DROP_VELOCITY)}updateJump(e,i){const s=e/nt[this.status].msPerFrame;this.yPos+=this.speedDrop?Math.round(this.jumpVelocity*this.config.SPEED_DROP_COEFFICIENT*s):Math.round(this.jumpVelocity*s),this.jumpVelocity+=this.config.GRAVITY*s,(this.yPos<this.minJumpHeight||this.speedDrop)&&(this.reachedMinHeight=!0),(this.yPos<this.config.MAX_JUMP_HEIGHT||this.speedDrop)&&this.endJump(),this.yPos>this.groundYPos&&(this.reset(),this.jumpCount++)}setSpeedDrop(){this.speedDrop=!0,this.jumpVelocity=1}reset(){this.yPos=this.groundYPos,this.jumpVelocity=0,this.jumping=!1,this.update(0,U.RUNNING),this.midair=!1,this.speedDrop=!1,this.jumpCount=0}}const ft={TEXT_X:50,TEXT_Y:12,TEXT_WIDTH:100,TEXT_HEIGHT:15};class mt{constructor(e,i,t){this.canvas=e;const s=e.getContext("2d");if(!s)throw new Error("Could not get 2d context from canvas");this.canvasCtx=s,this.canvasDimensions=t,this.textImgPos=i,this.draw()}updateDimensions(e,i){this.canvasDimensions.WIDTH=e,i&&(this.canvasDimensions.HEIGHT=i)}draw(){const e=ft;let t=e.TEXT_X,s=e.TEXT_Y,h=e.TEXT_WIDTH,a=e.TEXT_HEIGHT;const m=Math.round(this.canvasDimensions.WIDTH/2-e.TEXT_WIDTH/2),d=Math.round((this.canvasDimensions.HEIGHT-25)/3);I&&(s*=2,t*=2,h*=2,a*=2),t+=this.textImgPos.x,s+=this.textImgPos.y,u.imageSprite&&this.canvasCtx.drawImage(u.imageSprite,t,s,h,a,m,d,e.TEXT_WIDTH,e.TEXT_HEIGHT)}}const gt={FLAKE_SIZE:3,FALL_SPEED:.1,HORIZONTAL_SPEED_COEFFICIENT:.6,SPEED_VARIATION_MIN:.4,SPEED_VARIATION_MAX:1.2};class pt{constructor(e,i){this.canvas=e;const t=e.getContext("2d");if(!t)throw new Error("Could not get 2d context from canvas");this.canvasCtx=t,this.dimensions=i,this.config=gt,this.flakes=[],this.msPerFrame=1e3/60,this.updateCachedValues(),this.init()}updateCachedValues(){this.maxX=2*this.dimensions.WIDTH,this.minX=-this.config.FLAKE_SIZE,this.maxY=this.dimensions.HEIGHT,this.minY=-this.dimensions.HEIGHT}createSnowflake(){return{x:y(0,this.maxX),y:y(this.minY,0),speed:this.config.FALL_SPEED*(this.config.SPEED_VARIATION_MIN+Math.random()*(this.config.SPEED_VARIATION_MAX-this.config.SPEED_VARIATION_MIN))}}resetFlakePosition(e,i=!1,t=!1){t&&(e.y=-this.config.FLAKE_SIZE),i&&(e.x<this.minX?e.x=this.maxX+this.config.FLAKE_SIZE:e.x>this.maxX+this.config.FLAKE_SIZE&&(e.x=this.minX)),(i||t)&&(i&&(e.x=y(0,this.maxX)),t&&(e.y=y(this.minY,0)))}isFlakeVisible(e){return e.x>=this.minX&&e.x<=this.dimensions.WIDTH+this.config.FLAKE_SIZE&&e.y>=this.minY&&e.y<=this.maxY}getFlakeCount(){return Math.floor(this.dimensions.WIDTH/20)}init(){const e=this.getFlakeCount();this.flakes=[];for(let i=0;i<e;i++)this.flakes.push(this.createSnowflake())}update(e,i,t=!0){const s=t?i*this.config.HORIZONTAL_SPEED_COEFFICIENT*e/this.msPerFrame:0;for(let h=0;h<this.flakes.length;h++){const a=this.flakes[h];a.y+=a.speed*e,t&&(a.x-=s),a.y>this.maxY?this.resetFlakePosition(a,!0,!0):(a.x<this.minX||a.x>this.maxX+this.config.FLAKE_SIZE)&&this.resetFlakePosition(a,!0,!1)}}draw(){this.canvasCtx.save(),this.canvasCtx.fillStyle="#FFFFFF";const e=this.config.FLAKE_SIZE,i=this.flakes,t=this.canvasCtx;for(let s=0;s<i.length;s++){const h=i[s];this.isFlakeVisible(h)&&t.fillRect(Math.round(h.x),Math.round(h.y),e,e)}this.canvasCtx.restore()}reset(){this.init()}}let ct=null,xt=null,u=(()=>{var o;class e{constructor(t,s){this.outerContainerEl=document.querySelector(t),this.containerEl=null,this.config={...n,...s||{}},this.dimensions={...R},this.canvas=null,this.canvasCtx=null,this._horse=null,this.distanceMeter=null,this._distanceRan=0,this._currentScore=0,this.highestScore=0,this.time=0,this.runningTime=0,this.msPerFrame=1e3/60,this._currentSpeed=this.config.SPEED,this.lastIntegerSpeed=Math.floor(this.config.SPEED),this.speedMilestones=[],this.obstacles=[],this.activated=!1,this.playing=!1,this.crashed=!1,this.paused=!1,this.inverted=!1,this.isDestroyed=!1,this.invertTimer=0,this.resizeTimerId_=null,this.playCount=0,this.audioBuffer=null,this.soundFx={},this.audioContext=null,this.images={},this.imagesLoaded=0,this.horizon=null,this.gameOverPanel=null,this.touchController=null,this.spriteDef=B.LDPI,this.playingIntro=!1,this.updatePending=!1,this.raqId=0,this.invertTrigger=!1,this.loadImages(),Object.freeze(this.gameOver),Object.freeze(this.setSpeed)}get distanceRan(){return this._distanceRan}get currentScore(){return this._currentScore}get currentSpeed(){return this._currentSpeed}get horse(){return this._horse}setDistanceRan(t){(t<this._distanceRan||t<=this._distanceRan+2*this._currentSpeed)&&(this._distanceRan=t)}setCurrentScore(t){t>=0&&(this._currentScore=t)}setDistanceRanExternal(t){t>=0&&(this._distanceRan=t)}updateConfigSetting(t,s){if(t in this.config&&null!=s)switch(this.config[t]=s,t){case"GRAVITY":case"MIN_JUMP_HEIGHT":case"SPEED_DROP_COEFFICIENT":this._horse&&(this._horse.config[t]=s);break;case"INITIAL_JUMP_VELOCITY":this._horse&&this._horse.setJumpVelocity(s);break;case"SPEED":this.setSpeed(s)}}loadImages(){const t=new Image,s=new Image;t.src="/assets/images/horse-pics/elements-100x.png",s.src="/assets/images/horse-pics/elements-200x.png",I?(e.imageSprite=s,ct=s,this.spriteDef=B.HDPI):(e.imageSprite=t,ct=t,this.spriteDef=B.LDPI),e.backgroundMountainImage=new Image,xt=e.backgroundMountainImage,e.backgroundMountainImage.src="/assets/images/horse-pics/bg-mountain_200.png",e.backgroundMountainImage.addEventListener("error",function(){console.warn("Failed to load background mountain image")}),e.imageSprite.complete?this.init():e.imageSprite.addEventListener(c.LOAD,this.init.bind(this))}loadSounds(){try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return void console.warn("AudioContext not supported on this device");this.audioContext=new t;const h=document.getElementById(this.config.RESOURCE_TEMPLATE_ID)?.content;if(!h)return void console.warn("Audio resources template not found");for(const a in k){const m=h.getElementById(k[a]);if(!m)continue;const d=m.src;if(d&&d.includes(","))try{const E=d.substr(d.indexOf(",")+1);if(!E){console.warn(`Empty base64 string for ${a}`);continue}const L=j(E);this.audioContext.decodeAudioData(L.slice(0)).then(v=>{this.soundFx[a]=v},v=>{console.warn(`Failed to decode sound ${a}:`,v)})}catch(E){console.warn(`Failed to process base64 for ${a}:`,E)}else console.warn(`Invalid audio source for ${a}: missing data URI`)}}catch(t){console.warn("Failed to initialize audio context:",t),this.audioContext=null}}setSpeed(t){const h=1.2*this.config.MAX_SPEED;this._currentSpeed=Math.min(Math.max(t||this._currentSpeed,this.config.SPEED),h)}init(){this.adjustDimensions(),this.setSpeed(),this.containerEl=document.createElement("div"),this.containerEl.className=b.CONTAINER,this.canvas=function $(o,e,i,t){const s=document.createElement("canvas");
1return s.className=t?b.CANVAS+" "+t:b.CANVAS,s.width=e,s.height=i,o.appendChild(s),s}(this.containerEl,this.dimensions.WIDTH,this.dimensions.HEIGHT,"PLAYER");const t=this.canvas.getContext("2d");if(!t)throw new Error("Could not get 2d context from canvas");this.canvasCtx=t,this.canvasCtx.fill(),e.updateCanvasScaling(this.canvas),this.horizon=new p(this.canvas,this.spriteDef,this.dimensions,this.config.GAP_COEFFICIENT),this.snow=new pt(this.canvas,this.dimensions),this.distanceMeter=new tt(this.canvas,this.spriteDef.TEXT_SPRITE,this.dimensions.WIDTH),this._horse=new ut(this.canvas,this.spriteDef.HORSE),this.outerContainerEl.appendChild(this.containerEl),T?this.createTouchController():this.showKeysSuggestion(),this.startListening(),this.update(),window.addEventListener(c.RESIZE,this.debounceResize.bind(this))}createTouchController(){this.touchController=document.createElement("div"),this.touchController.className=b.TOUCH_CONTROLLER,this.outerContainerEl.appendChild(this.touchController)}showKeysSuggestion(){const t=document.querySelector(".control-suggestion");t&&(t.style.display="block")}debounceResize(){this.resizeTimerId_||(this.resizeTimerId_=setInterval(this.adjustDimensions.bind(this),250))}adjustDimensions(){this.resizeTimerId_&&(clearInterval(this.resizeTimerId_),this.resizeTimerId_=null);const t=window.getComputedStyle(this.outerContainerEl),s=Number(t.paddingLeft.substr(0,t.paddingLeft.length-2));this.dimensions.WIDTH=this.outerContainerEl.offsetWidth-2*s,this.dimensions.WIDTH=Math.min(600,this.dimensions.WIDTH),this.canvas&&this.canvasCtx&&(this.canvas.width=this.dimensions.WIDTH,this.canvas.height=this.dimensions.HEIGHT,e.updateCanvasScaling(this.canvas),this.distanceMeter.calcXPos(this.dimensions.WIDTH),this.clearCanvas(),this.horizon.update(0,0,!0,this.snow),this._horse.update(0),this.playing||this.crashed||this.paused?(this.containerEl.style.width=this.dimensions.WIDTH+"px",this.containerEl.style.height=this.dimensions.HEIGHT+"px",this.setCurrentScore(this.distanceMeter.getActualDistance(Math.ceil(this._distanceRan))),this.distanceMeter.update(0,Math.ceil(this._distanceRan)),this.stop()):this._horse.draw(0,0),this.crashed&&this.gameOverPanel&&(this.gameOverPanel.updateDimensions(this.dimensions.WIDTH),this.gameOverPanel.draw()))}playIntro(){if(this.activated||this.crashed)this.crashed&&this.restart();else{this.playingIntro=!0,this._horse.playingIntro=!0;const t="@-webkit-keyframes intro { from { width:"+it.WIDTH+"px }to { width: "+this.dimensions.WIDTH+"px }}",s=document.createElement("style");s.innerHTML=t,document.head.appendChild(s),this.containerEl.addEventListener(c.ANIM_END,this.startGame.bind(this)),this.containerEl.style.webkitAnimation="intro .4s ease-out 1 both",this.containerEl.style.width=this.dimensions.WIDTH+"px",this.touchController&&this.outerContainerEl.appendChild(this.touchController),this.playing=!0,this.activated=!0}}startGame(){this.runningTime=0,this.playingIntro=!1,this._horse.playingIntro=!1,this.containerEl.style.webkitAnimation="",this.playCount++,e.config.DEBUG_OBSTACLES&&(this.lastIntegerSpeed=Math.floor(this._currentSpeed),this.speedMilestones=[]),document.addEventListener(c.VISIBILITY,this.onVisibilityChange.bind(this)),window.addEventListener(c.BLUR,this.onVisibilityChange.bind(this)),window.addEventListener(c.FOCUS,this.onVisibilityChange.bind(this))}clearCanvas(){this.canvasCtx&&this.canvasCtx.clearRect(0,0,this.dimensions.WIDTH,this.dimensions.HEIGHT)}drawDebugSpeed(){if(!this.canvasCtx)return;this.canvasCtx.save(),this.canvasCtx.font="12px monospace",this.canvasCtx.fillStyle="#FF0000",this.canvasCtx.textAlign="left",this.canvasCtx.textBaseline="top";const m="Speed: "+(Math.round(10*this._currentSpeed)/10).toFixed(1);this.canvasCtx.fillText(m,5,5);const E="Time: "+(this.runningTime/1e3).toFixed(2)+"s",L=this.canvasCtx.measureText(m).width;if(this.canvasCtx.fillText(E,5+L+15,5),this.speedMilestones&&this.speedMilestones.length>0){let M=24;this.canvasCtx.fillText("Milestones:",5,M);for(let v=0;v<this.speedMilestones.length;v++){const w=this.speedMilestones[v],St=w.speed+": "+w.time+"s ("+w.distance.toFixed(2)+"m)";M+=14,this.canvasCtx.fillText(St,15,M)}}
1this.canvasCtx.restore()}drawBgMountainDebug(){if(!this.canvasCtx||!this.horizon||!this.horizon.backgroundMountain)return;const t=this.horizon.backgroundMountain;if(void 0===t.debugCurrentSpeed)return;this.canvasCtx.save();const s=this.distanceMeter.x-80,h=this.distanceMeter.y+13+5;this.canvasCtx.font="11px monospace",this.canvasCtx.fillStyle="#FF0000",this.canvasCtx.textAlign="left",this.canvasCtx.textBaseline="top";const m=["BgMountain:","Speed: "+t.debugCurrentSpeed.toFixed(1),"px/ms: "+(t.debugSpeedPerMs||0).toFixed(4),"px/frame: "+(t.debugSpeedPerFrame||0).toFixed(4)];for(let d=0;d<m.length;d++)this.canvasCtx.fillText(m[d],s,h+12*d);this.canvasCtx.restore()}update(){if(!this||this.isDestroyed)return;this.updatePending=!1;const t=F(),s=t-(this.time||t);if(this.time=t,this.playing){this.clearCanvas(),this.playingIntro||(this.runningTime+=s);const h=this.runningTime>this.config.CLEAR_TIME;if(1==this.horse.jumpCount&&!this.playingIntro&&this.playIntro(),this.snow&&this.snow.update(s,this._currentSpeed,this.activated&&!this.playingIntro&&!this.crashed),this.horizon.update(this.playingIntro?0:this.activated?s:0,this._currentSpeed,h,this.snow),this._horse.jumping&&this._horse.status!=U.CRASHED&&!this.crashed&&this._horse.updateJump(s,this._currentSpeed),h&&this.horizon.obstacles.length>0&&function et(o,e,i,t=!1){const h=new g(e.xPos+1,e.yPos+1,e.config.WIDTH-2,e.config.HEIGHT-2),a=new g(o.xPos+1,o.yPos+1,o.typeConfig.width*o.size-2,o.typeConfig.height-2);if(i&&t&&ht(i,h,a),rt(h,a)){const m=o.collisionBoxes,d=e.collisionBoxes.RUNNING;for(const E of d)for(const L of m){const M=st(E,h),v=st(L,a),w=rt(M,v);if(i&&t&&ht(i,M,v),w)return[M,v]}}return null}(this.horizon.obstacles[0],this._horse,this.canvasCtx||void 0,e.config.DEBUG_OBSTACLES))this.gameOver();else if(this.playingIntro||(this._distanceRan+=this._currentSpeed*s/this.msPerFrame,this.setCurrentScore(this.distanceMeter.getActualDistance(Math.ceil(this._distanceRan))),this._currentSpeed<this.config.MAX_SPEED&&(this._currentSpeed+=this.config.ACCELERATION*(s/1e3))),e.config.DEBUG_OBSTACLES){const d=Math.floor(this._currentSpeed);if(d>this.lastIntegerSpeed){const E=(this.runningTime/1e3).toFixed(2);this.speedMilestones.push({speed:d,time:E,distance:this._currentScore}),this.lastIntegerSpeed=d}}this.distanceMeter.update(s,Math.ceil(this._distanceRan))&&this.playSound(this.soundFx.SCORE),e.config.DEBUG_OBSTACLES&&(this.drawDebugSpeed(),this.drawBgMountainDebug())}else this.clearCanvas(),this._horse.update(s),this.snow&&!this.crashed&&this.snow.update(s,this._currentSpeed,this.activated),this.horizon.update(0,this._currentSpeed,!1,this.snow);(this.playing||!this.activated&&this._horse.blinkCount<e.config.MAX_BLINK_COUNT)&&(this._horse.update(s),this.scheduleNextUpdate()),this.crashed&&this.snow&&(this.clearCanvas(),this.horizon.update(0,this._currentSpeed,!1,this.snow),this._horse.update(s),this.snow.update(s,this._currentSpeed,!1),this.distanceMeter.update(s,Math.ceil(this._distanceRan)),this.gameOverPanel?.draw(),this.scheduleNextUpdate())}handleEvent(t){switch(t.type){case c.KEYDOWN:case c.TOUCHSTART:case c.MOUSEDOWN:this.onKeyDown(t);break;case c.KEYUP:case c.TOUCHEND:case c.MOUSEUP:this.onKeyUp(t)}}startListening(){document.addEventListener(c.KEYDOWN,this),document.addEventListener(c.KEYUP,this),T?(this.touchController.addEventListener(c.TOUCHSTART,this),this.touchController.addEventListener(c.TOUCHEND,this),this.containerEl.addEventListener(c.TOUCHSTART,this)):(document.addEventListener(c.MOUSEDOWN,this),document.addEventListener(c.MOUSEUP,this));const t=document.getElementById("canvasJump");t&&(t.addEventListener(c.TOUCHSTART,this),t.addEventListener(c.TOUCHEND,this),t.addEventListener(c.MOUSEDOWN,this),t.addEventListener(c.MOUSEUP,this))}stopListening(){document.removeEventListener(c.KEYDOWN,this),document.removeEventListener(c.KEYUP,this),T?(this.touchController.removeEventListener(c.TOUCHSTART,this),this.touchController.removeEventListener(c.TOUCHEND,this),this.containerEl.removeEventListener(c.TOUCHSTART,this)):(document.removeEventListener(c.MOUSEDOWN,this),document.removeEventListener(c.MOUSEUP,this));const t=document.getElementById("canvasJump");t&&(t.removeEventListener(c.TOUCHSTART,this),t.removeEventListener(c.TOUCHEND,this),t.removeEventListener(c.MOUSEDOWN,this),t.removeEventListener(c.MOUSEUP,this))}onKeyDown(t){T&&this.playing&&t.preventDefault();const h=t.keyCode;!this.crashed&&(G.JUMP[h]||t.type==c.TOUCHSTART||t.type==c.MOUSEDOWN&&"canvasJump"===t.target?.id)&&
1(this.playing||(this.loadSounds(),this.playing=!0,this.update(),window.errorPageController&&window.errorPageController.trackEasterEgg()),this._horse.jumping||(this.playSound(this.soundFx.BUTTON_PRESS),this._horse.startJump(this._currentSpeed))),this.playing&&!this.crashed&&G.DUCK[h]&&(t.preventDefault(),this._horse.jumping&&this._horse.setSpeedDrop())}onKeyUp(t){const s=String(t.keyCode),a=G.JUMP[s]||t.type==c.TOUCHEND||t.type==c.MOUSEUP&&"canvasJump"===t.target?.id;this.isRunning()&&a?this._horse.endJump():G.DUCK[s]&&(this._horse.speedDrop=!1)}scheduleNextUpdate(){this.isDestroyed||this.updatePending||(this.updatePending=!0,this.raqId=requestAnimationFrame(this.update.bind(this)))}isRunning(){return!!this.raqId}gameOver(){this.playSound(this.soundFx.HIT),function W(o){T&&window.navigator.vibrate&&window.navigator.vibrate(o)}(200),this.playing=!1,this.paused=!0,this.crashed=!0,this.distanceMeter.acheivement=!1,this._horse.update(100,U.CRASHED),this.distanceMeter.update(0,Math.ceil(this._distanceRan)),this.gameOverPanel?this.gameOverPanel.draw():this.gameOverPanel=new mt(this.canvas,this.spriteDef.TEXT_SPRITE,this.dimensions),this._currentScore>this.highestScore&&(this.highestScore=this._currentScore),this.time=F(),this.snow&&this.scheduleNextUpdate()}stop(){this.playing=!1,this.paused=!0,this.crashed&&this.snow||(cancelAnimationFrame(this.raqId),this.raqId=0)}cleanup(){this.isDestroyed=!0,this.playing=!1,this.paused=!0,this.raqId&&(cancelAnimationFrame(this.raqId),this.raqId=0)}play(){this.crashed||(this.playing=!0,this.paused=!1,this._horse.update(0,U.RUNNING),this.time=F(),this.update())}continueGame(){this.raqId&&(cancelAnimationFrame(this.raqId),this.raqId=0),this.updatePending=!1,this.crashed=!1,this.playing=!0,this.paused=!1,this.setSpeed(this.config.SPEED),this.runningTime=this.config.CLEAR_TIME,this.time=F(),this.horizon.reset(),this.horse.reset(),e.config.DEBUG_OBSTACLES&&(this.lastIntegerSpeed=Math.floor(this._currentSpeed),this.speedMilestones=[]),this.clearCanvas()}restart(){this.raqId=0,this.playCount++,this.runningTime=0,this.playing=!0,this.crashed=!1,this._distanceRan=0,this._currentScore=0,this.setSpeed(this.config.SPEED),this.time=F(),this.clearCanvas(),this.distanceMeter.reset(),this.horizon.reset(),this._horse.reset(),this.snow?.reset(),e.config.DEBUG_OBSTACLES&&(this.lastIntegerSpeed=Math.floor(this._currentSpeed),this.speedMilestones=[]),this.playSound(this.soundFx.BUTTON_PRESS),this.update()}onVisibilityChange(t){document.hidden||document.webkitHidden||"blur"==t.type||"visible"!=document.visibilityState||this.crashed||(this._horse.reset(),this.play())}playSound(t){if(t&&this.audioContext){const s=this.audioContext.createBufferSource();s.buffer=t,s.connect(this.audioContext.destination),s.start(0)}}}return(o=e).imageSprite=null,o.backgroundMountainImage=null,o.config=n,o.defaultDimensions=R,o.classes=b,o.spriteDefinition=B,o.sounds=k,o.keycodes=G,o.events=c,o.updateCanvasScaling=K,e})();var lt=r(85240),Ct=r(12481);let Et=(()=>{var o;class e{get score(){return this._score$.value}get isGameOver(){return this.gameOverState}get isPaused(){return this.gamePaused}constructor(t){this.ngZone=t,this.runner=null,this.isInitialized=!1,this.gamePaused=!1,this.gameOverState=!1,this._score$=new A.t(0),this._gameOver$=new A.t(!1),this._gameReset$=new A.t(!1),this._isPaused$=new A.t(!1),this.score$=this._score$.asObservable(),this.gameOver$=this._gameOver$.asObservable(),this.gameReset$=this._gameReset$.asObservable(),this.isPaused$=this._isPaused$.asObservable()}initialize(t){var s=this;return(0,C.A)(function*(h,a=!1){s.isInitialized&&(console.log(">> initialize: already initialized, destroying old instance"),s.destroy()),document.querySelector(`#${h}`)?s.ngZone.runOutsideAngular(()=>{a&&u.config&&(u.config.DEBUG_OBSTACLES=!0),s.runner=new u(`#${h}`),s.isInitialized=!0;const d=s.runner.update.bind(s.runner);s.runner.update=()=>{d(),s.ngZone.run(()=>{s.runner&&(s._score$.next(s.runner.currentScore||0),s.runner.crashed&&!s.gameOverState&&s.gameEnd())})}}):console.error(`Container #${h} not found`)}).apply(this,arguments)}setDebugObstacles(t){u.config&&(u.config.DEBUG_OBSTACLES=t)}start(){!this.runner||this.runner.playing||this.runner.crashed?this.runner&&this.runner.crashed&&(this.reset(),this.ngZone.runOutsideAngular(()=>{this.runner.play()})):(this.ngZone.runOutsideAngular(()=>{this.runner.play()}),this.gameOverState=!1,this._gameOver$.next(!1),this._gameReset$.next(!0),this._score$.next(0))}jump(){this.runner&&this.runner.playing?this.ngZone.runOutsideAngular(()=>{const t=new KeyboardEvent("keydown",{code:"Space",keyCode:32,key:" "});this.runner.onKeyDown(t)}):this.runner&&!this.runner.playing&&!this.runner.crashed&&this.start()}reset(){this.runner&&(this.ngZone.runOutsideAngular(()=>{this.runner.restart()}),this.gameOverState=!1,this._score$.next(0),this._gameOver$.next(!1),this._gameReset$.next(!0))}pause(){this.runner&&this.runner.playing&&(this.ngZone.runOutsideAngular(()=>{this.runner.stop()}),this.gamePaused=!0,this._isPaused$.next(!0))}resume(){this.runner&&!this.runner.playing&&!this.runner.crashed&&(this.ngZone.runOutsideAngular(()=>{this.runner.play()}),this.gamePaused=!1,this._isPaused$.next(!1))}continueWithLife(t){this.runner&&this.ngZone.runOutsideAngular(()=>{try{this.runner.continueGame();const s=Math.max(0,t||0),h=s/(this.runner.distanceMeter?.config?.COEFFICIENT??.025);this.runner.setCurrentScore(s),this.runner.setDistanceRanExternal(h),this.runner.play(),this.gameOverState=!1,this._gameOver$.next(!1),this._gameReset$.next(!0),this._score$.next(this.runner.currentScore)}catch(s){console.error("continueWithLife error",s)}})}gameEnd(){this.runner&&!this.gameOverState&&(this.ngZone.runOutsideAngular(()=>{this.runner.stop()}),this.gameOverState=!0,this._gameOver$.next(!0))}destroy(){if(this.runner){this.ngZone.runOutsideAngular(()=>{this.runner.cleanup()});const t=document.querySelector(".interstitial-wrapper")||document.querySelector(".runner-container");t&&(t.innerHTML=""),this.runner=null,this.isInitialized=!1,this.gameOverState=!1,this.gamePaused=!1,this._score$.next(0),this._gameOver$.next(!1),this._gameReset$.next(!1),this._isPaused$.next(!1)}}}return(o=e).\u0275fac=function(t){return new(t||o)(lt.KVO(Ct.SKi))},o.\u0275prov=lt.jDH({token:o,factory:o.\u0275fac,providedIn:"root"}),e})()}}]);
2//# sourceMappingURL=1755.0f64d26ba982e61d.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.