excalibur
Version:
Excalibur.js is a simple JavaScript game engine with TypeScript bindings for making 2D games in HTML5 Canvas. Our mission is to make web game development as simple as possible.
2 lines • 542 kB
JavaScript
/*! For license information please see excalibur.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ex=e():t.ex=e()}(self,(()=>(()=>{"use strict";var t={851:(t,e,i)=>{i.d(e,{A:()=>a});var s=i(1),n=i.n(s),r=i(935),o=i.n(r)()(n());o.push([t.id,"/* Buttons styles start */\n\nbutton#excalibur-play {\n display: inline-block;\n position: relative;\n z-index: 999;\n border-radius: 6px;\n border: none;\n /*border: 3px solid;\n border-color: white;\n box-shadow: 0 0 10px #ccc;*/\n padding: 1rem 1.5rem 1rem 4rem;\n margin: 0;\n text-decoration: none;\n background: #00b233;\n color: #ffffff;\n font-family: sans-serif;\n font-size: 2rem;\n white-space: nowrap;\n line-height: 1;\n cursor: pointer;\n text-align: center;\n transition:\n background 250ms ease-in-out,\n transform 150ms ease;\n -webkit-appearance: none;\n -moz-appearance: none;\n\n -webkit-animation: excalibur-button-fadein 200ms; /* Safari, Chrome and Opera > 12.1 */\n -moz-animation: excalibur-button-fadein 200ms; /* Firefox < 16 */\n -ms-animation: excalibur-button-fadein 200ms; /* Internet Explorer */\n -o-animation: excalibur-button-fadein 200ms; /* Opera < 12.1 */\n animation: excalibur-button-fadein 200ms;\n}\n\n/*\nbutton#excalibur-play {\n display: none;\n}*/\n\nbutton#excalibur-play:after {\n position: absolute;\n content: '';\n border: 8px solid;\n border-color: transparent transparent transparent white;\n left: 35px;\n top: 24px;\n width: 0;\n height: 0;\n}\n\nbutton#excalibur-play:before {\n position: absolute;\n content: '';\n border: 3px solid;\n left: 19px;\n top: 14px;\n border-radius: 20px;\n width: 30px;\n height: 30px;\n}\n\nbutton#excalibur-play:hover,\nbutton#excalibur-play:focus {\n background: #00982c;\n}\n\nbutton#excalibur-play:focus {\n outline: 1px solid #fff;\n outline-offset: -4px;\n}\n\nbutton#excalibur-play:active {\n transform: scale(0.99);\n}\n\n@keyframes excalibur-button-fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Firefox < 16 */\n@-moz-keyframes excalibur-button-fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Safari, Chrome and Opera > 12.1 */\n@-webkit-keyframes excalibur-button-fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Internet Explorer */\n@-ms-keyframes excalibur-button-fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* Opera < 12.1 */\n@-o-keyframes excalibur-button-fadein {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n","",{version:3,sources:["webpack://./Director/Loader.css"],names:[],mappings:"AAAA,yBAAyB;;AAEzB;EACE,qBAAqB;EACrB,kBAAkB;EAClB,YAAY;EACZ,kBAAkB;EAClB,YAAY;EACZ;;+BAE6B;EAC7B,8BAA8B;EAC9B,SAAS;EACT,qBAAqB;EACrB,mBAAmB;EACnB,cAAc;EACd,uBAAuB;EACvB,eAAe;EACf,mBAAmB;EACnB,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB;;wBAEsB;EACtB,wBAAwB;EACxB,qBAAqB;;EAErB,gDAAgD,EAAE,oCAAoC;EACtF,6CAA6C,EAAE,iBAAiB;EAChE,4CAA4C,EAAE,sBAAsB;EACpE,2CAA2C,EAAE,iBAAiB;EAC9D,wCAAwC;AAC1C;;AAEA;;;EAGE;;AAEF;EACE,kBAAkB;EAClB,WAAW;EACX,iBAAiB;EACjB,uDAAuD;EACvD,UAAU;EACV,SAAS;EACT,QAAQ;EACR,SAAS;AACX;;AAEA;EACE,kBAAkB;EAClB,WAAW;EACX,iBAAiB;EACjB,UAAU;EACV,SAAS;EACT,mBAAmB;EACnB,WAAW;EACX,YAAY;AACd;;AAEA;;EAEE,mBAAmB;AACrB;;AAEA;EACE,uBAAuB;EACvB,oBAAoB;AACtB;;AAEA;EACE,sBAAsB;AACxB;;AAEA;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF;;AAEA,iBAAiB;AACjB;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF;;AAEA,oCAAoC;AACpC;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF;;AAEA,sBAAsB;AACtB;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF;;AAEA,iBAAiB;AACjB;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF",sourcesContent:["/* Buttons styles start */\r\n\r\nbutton#excalibur-play {\r\n display: inline-block;\r\n position: relative;\r\n z-index: 999;\r\n border-radius: 6px;\r\n border: none;\r\n /*border: 3px solid;\r\n border-color: white;\r\n box-shadow: 0 0 10px #ccc;*/\r\n padding: 1rem 1.5rem 1rem 4rem;\r\n margin: 0;\r\n text-decoration: none;\r\n background: #00b233;\r\n color: #ffffff;\r\n font-family: sans-serif;\r\n font-size: 2rem;\r\n white-space: nowrap;\r\n line-height: 1;\r\n cursor: pointer;\r\n text-align: center;\r\n transition:\r\n background 250ms ease-in-out,\r\n transform 150ms ease;\r\n -webkit-appearance: none;\r\n -moz-appearance: none;\r\n\r\n -webkit-animation: excalibur-button-fadein 200ms; /* Safari, Chrome and Opera > 12.1 */\r\n -moz-animation: excalibur-button-fadein 200ms; /* Firefox < 16 */\r\n -ms-animation: excalibur-button-fadein 200ms; /* Internet Explorer */\r\n -o-animation: excalibur-button-fadein 200ms; /* Opera < 12.1 */\r\n animation: excalibur-button-fadein 200ms;\r\n}\r\n\r\n/*\r\nbutton#excalibur-play {\r\n display: none;\r\n}*/\r\n\r\nbutton#excalibur-play:after {\r\n position: absolute;\r\n content: '';\r\n border: 8px solid;\r\n border-color: transparent transparent transparent white;\r\n left: 35px;\r\n top: 24px;\r\n width: 0;\r\n height: 0;\r\n}\r\n\r\nbutton#excalibur-play:before {\r\n position: absolute;\r\n content: '';\r\n border: 3px solid;\r\n left: 19px;\r\n top: 14px;\r\n border-radius: 20px;\r\n width: 30px;\r\n height: 30px;\r\n}\r\n\r\nbutton#excalibur-play:hover,\r\nbutton#excalibur-play:focus {\r\n background: #00982c;\r\n}\r\n\r\nbutton#excalibur-play:focus {\r\n outline: 1px solid #fff;\r\n outline-offset: -4px;\r\n}\r\n\r\nbutton#excalibur-play:active {\r\n transform: scale(0.99);\r\n}\r\n\r\n@keyframes excalibur-button-fadein {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n/* Firefox < 16 */\r\n@-moz-keyframes excalibur-button-fadein {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n/* Safari, Chrome and Opera > 12.1 */\r\n@-webkit-keyframes excalibur-button-fadein {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n/* Internet Explorer */\r\n@-ms-keyframes excalibur-button-fadein {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n/* Opera < 12.1 */\r\n@-o-keyframes excalibur-button-fadein {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n"],sourceRoot:""}]);const a=o},296:(t,e,i)=>{i.d(e,{A:()=>a});var s=i(1),n=i.n(s),r=i(935),o=i.n(r)()(n());o.push([t.id,"#ex-toast-container {\n position: absolute;\n height: 0;\n min-width: 50%;\n left: 50%;\n top: 0;\n}\n\n.ex-toast-message {\n left: -50%;\n position: relative;\n display: flex;\n justify-content: space-between;\n\n padding: 10px;\n margin-top: 5px;\n font-size: 18px;\n font-family: sans-serif;\n border-radius: 6px;\n border: 3px solid #b7b779;\n background-color: rgb(253, 253, 192);\n}\n\n.ex-toast-message button {\n align-self: flex-start;\n}\n","",{version:3,sources:["webpack://./Util/Toaster.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,SAAS;EACT,cAAc;EACd,SAAS;EACT,MAAM;AACR;;AAEA;EACE,UAAU;EACV,kBAAkB;EAClB,aAAa;EACb,8BAA8B;;EAE9B,aAAa;EACb,eAAe;EACf,eAAe;EACf,uBAAuB;EACvB,kBAAkB;EAClB,yBAAyB;EACzB,oCAAoC;AACtC;;AAEA;EACE,sBAAsB;AACxB",sourcesContent:["#ex-toast-container {\r\n position: absolute;\r\n height: 0;\r\n min-width: 50%;\r\n left: 50%;\r\n top: 0;\r\n}\r\n\r\n.ex-toast-message {\r\n left: -50%;\r\n position: relative;\r\n display: flex;\r\n justify-content: space-between;\r\n\r\n padding: 10px;\r\n margin-top: 5px;\r\n font-size: 18px;\r\n font-family: sans-serif;\r\n border-radius: 6px;\r\n border: 3px solid #b7b779;\r\n background-color: rgb(253, 253, 192);\r\n}\r\n\r\n.ex-toast-message button {\r\n align-self: flex-start;\r\n}\r\n"],sourceRoot:""}]);const a=o},935:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",s=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),s&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),s&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,s,n,r){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(s)for(var a=0;a<this.length;a++){var h=this[a][0];null!=h&&(o[h]=!0)}for(var l=0;l<t.length;l++){var c=[].concat(t[l]);s&&o[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),n&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=n):c[4]="".concat(n)),e.push(c))}},e}},1:t=>{t.exports=function(t){var e=t[1],i=t[3];if(!i)return e;if("function"==typeof btoa){var s=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),r="/*# ".concat(n," */");return[e].concat([r]).join("\n")}return[e].join("\n")}}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={id:s,exports:{}};return t[s](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};i.r(s),i.d(s,{ActionCompleteEvent:()=>ei,ActionContext:()=>yn,ActionQueue:()=>Fs,ActionSequence:()=>Po,ActionStartEvent:()=>ti,ActionsComponent:()=>bn,ActionsSystem:()=>fr,ActivateEvent:()=>Ze,Actor:()=>Tn,ActorEvents:()=>An,AddEvent:()=>ii,AddedComponent:()=>ni,AffineMatrix:()=>$,Animation:()=>Kt,AnimationDirection:()=>Nt,AnimationEvents:()=>jt,AnimationStrategy:()=>Wt,ArcadeSolver:()=>rr,AudioContextFactory:()=>Si,Axes:()=>Sr,Axis:()=>Un,BaseAlign:()=>ie,BezierCurve:()=>vn,Blink:()=>dn,BodyComponent:()=>Ss,BoundingBox:()=>U,BrowserComponent:()=>Jr,BrowserEvents:()=>to,Buttons:()=>Tr,Camera:()=>qn,CameraEvents:()=>Vn,Canvas:()=>Ei,Circle:()=>Es,CircleCollider:()=>us,Clock:()=>no,ClosestLineJumpTable:()=>ds,Collider:()=>is,ColliderComponent:()=>As,CollisionContact:()=>_s,CollisionEndEvent:()=>Xe,CollisionGroup:()=>$i,CollisionGroupManager:()=>Zi,CollisionJumpTable:()=>xs,CollisionPostSolveEvent:()=>Ve,CollisionPreSolveEvent:()=>Ge,CollisionStartEvent:()=>qe,CollisionSystem:()=>hr,CollisionType:()=>qi,Color:()=>R,ColorBlindFlags:()=>$r,ColorBlindnessMode:()=>Xr,ColorBlindnessPostProcessor:()=>Zr,Component:()=>Yt,CompositeCollider:()=>hs,ConsoleAppender:()=>L,ContactConstraintPoint:()=>or,ContactEndEvent:()=>We,ContactSolveBias:()=>Yi,ContactStartEvent:()=>Ne,CoordPlane:()=>Ht,CrossFade:()=>ta,CurveBy:()=>wn,CurveTo:()=>xn,DeactivateEvent:()=>$e,Debug:()=>ys,DebugConfig:()=>jr,DebugGraphicsComponent:()=>Rn,DebugSystem:()=>dr,DebugText:()=>ft,DefaultAntialiasOptions:()=>eo,DefaultGarbageCollectionOptions:()=>go,DefaultLoader:()=>Hi,DefaultPixelArtOptions:()=>io,DegreeOfFreedom:()=>Ts,Delay:()=>_n,Detector:()=>Vi,Die:()=>gn,Direction:()=>ne,Director:()=>co,DirectorEvents:()=>lo,DisplayMode:()=>bi,DynamicTree:()=>Ji,DynamicTreeCollisionProcessor:()=>es,EX_VERSION:()=>ga,EaseBy:()=>cn,EaseTo:()=>ln,EasingFunctions:()=>Rs,EdgeCollider:()=>ws,ElasticToActorStrategy:()=>Nn,EmitterType:()=>vo,Engine:()=>xo,EngineEvents:()=>fo,EnterTriggerEvent:()=>Qe,EnterViewPortEvent:()=>Ke,Entity:()=>li,EntityEvents:()=>hi,EntityManager:()=>Kn,EventEmitter:()=>g,EventTypes:()=>re,Events:()=>o,ExResponse:()=>Ii,ExcaliburGraphicsContext2DCanvas:()=>yi,ExcaliburGraphicsContextWebGL:()=>vi,ExitTriggerEvent:()=>Je,ExitViewPortEvent:()=>je,Fade:()=>un,FadeInOut:()=>Jo,Flags:()=>d,Flash:()=>mn,Follow:()=>pn,Font:()=>_e,FontCache:()=>ue,FontSource:()=>Yo,FontStyle:()=>se,FontUnit:()=>te,FpsSampler:()=>so,FrameStats:()=>Kr,Future:()=>_,GameEvent:()=>me,GameStartEvent:()=>ye,GameStopEvent:()=>be,Gamepad:()=>Ar,GamepadAxisEvent:()=>Le,GamepadButtonEvent:()=>ke,GamepadConnectEvent:()=>De,GamepadDisconnectEvent:()=>Be,Gamepads:()=>Cr,GarbageCollector:()=>po,Gif:()=>Wo,GifParser:()=>Xo,GlobalCoordinates:()=>Mr,GpuParticleEmitter:()=>Ao,GpuParticleRenderer:()=>Co,Graphic:()=>nt,GraphicsComponent:()=>fe,GraphicsGroup:()=>Qt,GraphicsSystem:()=>cr,HashColliderProxy:()=>wr,HashGridCell:()=>_r,HashGridProxy:()=>ur,HiddenEvent:()=>Ue,HorizontalFirst:()=>ns,ImageFiltering:()=>ot,ImageSource:()=>ut,ImageSourceAttributeConstants:()=>dt,ImageWrapping:()=>at,InitializeEvent:()=>Ye,InputHost:()=>Nr,InputMapper:()=>Er,IsometricEntityComponent:()=>mr,IsometricEntitySystem:()=>vr,IsometricMap:()=>So,IsometricTile:()=>To,KeyEvent:()=>Rr,Keyboard:()=>Fr,Keys:()=>Pr,KillEvent:()=>ve,Label:()=>wo,LimitCameraBoundsStrategy:()=>Gn,Line:()=>ia,LineSegment:()=>ls,Loader:()=>Wi,LoaderEvents:()=>Ui,LockCameraToActorAxisStrategy:()=>Hn,LockCameraToActorStrategy:()=>On,LogLevel:()=>M,Logger:()=>k,Material:()=>Ut,Matrix:()=>Z,MatrixLocations:()=>B,MediaEvent:()=>Mi,Meet:()=>fn,MotionComponent:()=>ci,MotionSystem:()=>nr,MoveBy:()=>qs,MoveByWithOptions:()=>Vs,MoveTo:()=>Zs,MoveToWithOptions:()=>Ys,NativePointerButton:()=>zr,NativeSoundEvent:()=>Di,NativeSoundProcessedEvent:()=>Bi,NineSlice:()=>ra,NineSliceStretch:()=>na,None:()=>rs,Observable:()=>Zt,OffscreenSystem:()=>xr,Pair:()=>ji,ParallaxComponent:()=>In,ParallelActions:()=>Eo,Particle:()=>ui,ParticleEmitter:()=>yo,ParticleRenderer:()=>gi,ParticleTransform:()=>_i,PhysicsStats:()=>Qr,PhysicsWorld:()=>br,PointerAbstraction:()=>kr,PointerButton:()=>Ur,PointerComponent:()=>Is,PointerEvent:()=>Dr,PointerEventReceiver:()=>Hr,PointerScope:()=>a,PointerSystem:()=>pr,PointerType:()=>Or,Polygon:()=>sa,PolygonCollider:()=>bs,Pool:()=>Lt,PostCollisionEvent:()=>He,PostDebugDrawEvent:()=>Ee,PostDrawEvent:()=>Ae,PostFrameEvent:()=>Me,PostKillEvent:()=>we,PostTransformDrawEvent:()=>Se,PostUpdateEvent:()=>Re,PreCollisionEvent:()=>Oe,PreDebugDrawEvent:()=>Pe,PreDrawEvent:()=>Ce,PreFrameEvent:()=>Fe,PreKillEvent:()=>xe,PreLoadEvent:()=>Wr,PreTransformDrawEvent:()=>Te,PreUpdateEvent:()=>Ie,Projection:()=>Ki,QuadIndexBuffer:()=>Mt,QuadTree:()=>Io,Query:()=>Qn,QueryManager:()=>tr,RadiusAroundActorStrategy:()=>Wn,Random:()=>f,Raster:()=>Jt,Ray:()=>ts,RealisticSolver:()=>ar,Rectangle:()=>Ps,RemoveEvent:()=>si,RemovedComponent:()=>oi,Repeat:()=>Bs,RepeatForever:()=>ks,Resolution:()=>Ci,Resource:()=>et,ResourceEvents:()=>tt,RotateBy:()=>tn,RotateByWithOptions:()=>Js,RotateTo:()=>Ks,RotateToWithOptions:()=>js,RotationType:()=>h,ScaleBy:()=>an,ScaleByWithOptions:()=>on,ScaleTo:()=>nn,ScaleToWithOptions:()=>sn,Scene:()=>qr,SceneEvents:()=>Gr,Screen:()=>Ti,ScreenAppender:()=>z,ScreenElement:()=>Pn,ScreenEvents:()=>Ai,ScreenShader:()=>Yr,ScrollPreventionMode:()=>mo,Semaphore:()=>_a,SeparatingAxis:()=>ps,SeparationInfo:()=>gs,Shader:()=>Tt,Shape:()=>Cs,Side:()=>D,Slide:()=>ea,SolverStrategy:()=>Xi,Sound:()=>zi,SoundEvents:()=>Li,SparseHashGrid:()=>gr,SparseHashGridCollisionProcessor:()=>yr,SpatialPartitionStrategy:()=>os,Sprite:()=>rt,SpriteFont:()=>_t,SpriteSheet:()=>pt,StandardClock:()=>ro,StateMachine:()=>Ri,StrategyContainer:()=>zn,Stream:()=>qo,System:()=>jn,SystemManager:()=>ir,SystemPriority:()=>Zn,SystemType:()=>$n,TagQuery:()=>Jn,TestClock:()=>oo,Text:()=>ge,TextAlign:()=>ee,TextureLoader:()=>ct,Tile:()=>Ln,TileMap:()=>kn,TileMapEvents:()=>Bn,TiledAnimation:()=>oa,TiledSprite:()=>gt,Timer:()=>En,Toaster:()=>ho,Transform:()=>qt,TransformComponent:()=>$t,Transition:()=>Qo,TreeNode:()=>Qi,Trigger:()=>Yn,TriggerEvents:()=>Xn,TwoPI:()=>m,Util:()=>l,Vector:()=>E,VectorView:()=>Gt,VertexBuffer:()=>St,VertexLayout:()=>Pt,VerticalFirst:()=>ss,VisibleEvent:()=>ze,WebAudio:()=>Pi,WebAudioInstance:()=>Fi,WheelDeltaMode:()=>Lr,WheelEvent:()=>Br,World:()=>sr,approximatelyEqual:()=>y,assert:()=>bo,canonicalizeAngle:()=>b,clamp:()=>w,coroutine:()=>Ko,createId:()=>u,frac:()=>v,getDefaultPhysicsConfig:()=>as,hasGraphicsTick:()=>pe,hasOnAdd:()=>Uo,hasOnInitialize:()=>Do,hasOnPostUpdate:()=>zo,hasOnPreUpdate:()=>ko,hasOnRemove:()=>Oo,hasPostDraw:()=>No,hasPreDraw:()=>Ho,has_add:()=>Fo,has_initialize:()=>Ro,has_postupdate:()=>Lo,has_preupdate:()=>Bo,has_remove:()=>Mo,inverseLerp:()=>Os,inverseLerpVector:()=>Hs,isActor:()=>Cn,isAddedComponent:()=>ri,isComponentCtor:()=>Xt,isLoaderConstructor:()=>Oi,isMoveByOptions:()=>Gs,isMoveToOptions:()=>Xs,isRemovedComponent:()=>ai,isRotateByOptions:()=>Qs,isRotateToOptions:()=>$s,isScaleByOptions:()=>rn,isScaleToOptions:()=>en,isSceneConstructor:()=>Vr,isScreenElement:()=>Sn,isSystemConstructor:()=>er,lerp:()=>Ls,lerpAngle:()=>zs,lerpVector:()=>Us,maxMessages:()=>aa,nextActionId:()=>Ds,obsolete:()=>da,parseImageFiltering:()=>ht,parseImageWrapping:()=>lt,pixelSnapEpsilon:()=>fi,randomInRange:()=>S,randomIntInRange:()=>P,range:()=>T,remap:()=>Ns,remapVector:()=>Ws,resetObsoleteCounter:()=>la,sign:()=>x,toDegrees:()=>C,toRadians:()=>A,vec:()=>I,webgl:()=>n});var n={};i.r(n),i.d(n,{getAttributeComponentSize:()=>bt,getAttributePointerType:()=>Ct,getGLTypeFromSource:()=>yt,getGlTypeSizeBytes:()=>xt,getMaxShaderComplexity:()=>At,isAttributeInSource:()=>wt});var r={};i.r(r),i.d(r,{circle:()=>ce,line:()=>oe,point:()=>ae,roundRect:()=>le,vector:()=>he});var o={};i.r(o),i.d(o,{ActionCompleteEvent:()=>ei,ActionStartEvent:()=>ti,ActivateEvent:()=>Ze,AddEvent:()=>ii,CollisionEndEvent:()=>Xe,CollisionPostSolveEvent:()=>Ve,CollisionPreSolveEvent:()=>Ge,CollisionStartEvent:()=>qe,ContactEndEvent:()=>We,ContactStartEvent:()=>Ne,DeactivateEvent:()=>$e,EnterTriggerEvent:()=>Qe,EnterViewPortEvent:()=>Ke,EventTypes:()=>re,ExitTriggerEvent:()=>Je,ExitViewPortEvent:()=>je,GameEvent:()=>me,GameStartEvent:()=>ye,GameStopEvent:()=>be,GamepadAxisEvent:()=>Le,GamepadButtonEvent:()=>ke,GamepadConnectEvent:()=>De,GamepadDisconnectEvent:()=>Be,HiddenEvent:()=>Ue,InitializeEvent:()=>Ye,KillEvent:()=>ve,PostCollisionEvent:()=>He,PostDebugDrawEvent:()=>Ee,PostDrawEvent:()=>Ae,PostFrameEvent:()=>Me,PostKillEvent:()=>we,PostTransformDrawEvent:()=>Se,PostUpdateEvent:()=>Re,PreCollisionEvent:()=>Oe,PreDebugDrawEvent:()=>Pe,PreDrawEvent:()=>Ce,PreFrameEvent:()=>Fe,PreKillEvent:()=>xe,PreTransformDrawEvent:()=>Te,PreUpdateEvent:()=>Ie,RemoveEvent:()=>si,VisibleEvent:()=>ze});var a,h,l={};function c(){if("undefined"==typeof window&&(window={audioContext:function(){}}),"undefined"==typeof window||window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setInterval(t,1e3/60)}),"undefined"==typeof window||window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(){}),"undefined"!=typeof window&&!window.AudioContext){if(window.webkitAudioContext){const t=window.webkitAudioContext.prototype.decodeAudioData;window.webkitAudioContext.prototype.decodeAudioData=function(e){return new Promise(((i,s)=>{t.call(this,e,i,s)}))}}window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext}"undefined"==typeof window||window.devicePixelRatio||(window.devicePixelRatio=window.devicePixelRatio||1),"undefined"==typeof window||window.requestIdleCallback||(window.requestIdleCallback=window.requestIdleCallback||function(t){const e=Date.now();return setTimeout((function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})}),1)},window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)})}i.r(l),i.d(l,{ConsoleAppender:()=>L,DrawUtil:()=>r,EasingFunctions:()=>Rs,LogLevel:()=>M,Logger:()=>k,Observable:()=>Zt,ScreenAppender:()=>z,addItemToArray:()=>H,contains:()=>W,delay:()=>V,fail:()=>G,getPosition:()=>O,isObject:()=>X,mergeDeep:()=>Y,omit:()=>q,removeItemFromArray:()=>N});class d{static useCanvasGraphicsContext(){d.enable("use-canvas-context")}static useLegacyImageRenderer(){d.enable("use-legacy-image-renderer")}static freeze(){d._FROZEN=!0}static _reset(){d._FROZEN=!1,d._FLAGS={}}static enable(t){if(this._FROZEN)throw Error("Feature flags can only be enabled before Engine constructor time");d._FLAGS[t]=!0}static disable(t){if(this._FROZEN)throw Error("Feature flags can only be disabled before Engine constructor time");d._FLAGS[t]=!1}static isEnabled(t){return!!d._FLAGS[t]}static show(){return Object.keys(d._FLAGS)}}function u(t,e){return{type:t,value:e}}d._FROZEN=!1,d._FLAGS={};class _{constructor(){this._isCompleted=!1,this.promise=new Promise(((t,e)=>{this._resolver=t,this._rejecter=e}))}get isCompleted(){return this._isCompleted}resolve(t){this._isCompleted||(this._isCompleted=!0,this._resolver(t))}reject(t){this._isCompleted||(this._isCompleted=!0,this._rejecter(t))}}class g{constructor(){this._paused=!1,this._empty=!0,this._listeners={},this._listenersOnce={},this._pipes=[]}clear(){this._listeners={},this._listenersOnce={},this._pipes.length=0,this._empty=!0}on(t,e){var i;return this._empty=!1,this._listeners[t]=null!==(i=this._listeners[t])&&void 0!==i?i:[],this._listeners[t].push(e),{close:()=>this.off(t,e)}}once(t,e){var i;return this._empty=!1,this._listenersOnce[t]=null!==(i=this._listenersOnce[t])&&void 0!==i?i:[],this._listenersOnce[t].push(e),{close:()=>this.off(t,e)}}off(t,e){var i,s;if(e){const n=null===(i=this._listeners[t])||void 0===i?void 0:i.filter((t=>t!==e));this._listeners[t]=n;const r=null===(s=this._listenersOnce[t])||void 0===s?void 0:s.filter((t=>t!==e));this._listenersOnce[t]=r}else delete this._listeners[t]}emit(t,e){if(this._empty)return;if(this._paused)return;const i=this._listeners[t];if(i)for(let t=0;t<i.length;t++)i[t](e);const s=this._listenersOnce[t];if(this._listenersOnce[t]=[],s)for(let t=0;t<s.length;t++)s[t](e);for(let i=0;i<this._pipes.length;i++)this._pipes[i].emit(t,e)}pipe(t){if(this===t)throw Error("Cannot pipe to self");return this._empty=!1,this._pipes.push(t),{close:()=>{const e=this._pipes.indexOf(t);e>-1&&this._pipes.splice(e,1)}}}unpipe(t){const e=this._pipes.indexOf(t);e>-1&&this._pipes.splice(e,1)}pause(){this._paused=!0}unpause(){this._paused=!1}}!function(t){t.Canvas="Canvas",t.Document="Document"}(a||(a={})),function(t){t.ShortestPath="shortest-path",t.LongestPath="longest-path",t.Clockwise="clockwise",t.CounterClockwise="counter-clockwise"}(h||(h={}));const p=4294967295;class f{constructor(t){this.seed=t,this._lowerMask=2147483647,this._upperMask=2147483648,this._w=32,this._n=624,this._m=397,this._a=2567483615,this._u=11,this._s=7,this._b=2636928640,this._t=15,this._c=4022730752,this._l=18,this._f=1812433253,this._mt=new Array(this._n),this._mt[0]=(t||Date.now())>>>0;for(let t=1;t<this._n;t++){const e=this._mt[t-1]^this._mt[t-1]>>>this._w-2;this._mt[t]=(this._f*((4294901760&e)>>>16)<<16)+this._f*(65535&e)+t>>>0}this._index=this._n}_twist(){const t=[0,this._a];let e=0,i=0;for(;i<this._n-this._m;i++)e=this._mt[i]&this._upperMask|this._mt[i+1]&this._lowerMask,this._mt[i]=this._mt[i+this._m]^e>>>1^t[1&e]&p;for(;i<this._n-1;i++)e=this._mt[i]&this._upperMask|this._mt[i+1]&this._lowerMask,this._mt[i]=this._mt[i+(this._m-this._n)]^e>>>1^t[1&e]&p;e=this._mt[this._n-1]&this._upperMask|this._mt[0]&this._lowerMask,this._mt[this._n-1]=this._mt[this._m-1]^e>>>1^t[1&e]&p,this._index=0}nextInt(){this._index>=this._n&&this._twist();let t=this._mt[this._index++];return t^=t>>>this._u,t^=t<<this._s&this._b,t^=t<<this._t&this._c,t^=t>>>this._l,t>>>0}next(){return this.nextInt()*(1/4294967296)}floating(t,e){return(e-t)*this.next()+t}integer(t,e){return Math.floor((e-t+1)*this.next()+t)}bool(t=.5){return this.next()<=t}pickOne(t){return t[this.integer(0,t.length-1)]}pickSet(t,e,i=!1){return i?this._pickSetWithDuplicates(t,e):this._pickSetWithoutDuplicates(t,e)}_pickSetWithoutDuplicates(t,e){if(e>t.length||e<0)throw new Error("Invalid number of elements to pick, must pick a value 0 < n <= length");if(e===t.length)return t;const i=new Array(e);let s=0;const n=t.slice(0);for(;s<e;){const t=this.integer(0,n.length-1);i[s++]=n[t],n.splice(t,1)}return i}_pickSetWithDuplicates(t,e){if(e<0)throw new Error("Invalid number of elements to pick, must pick a value 0 <= n < MAX_INT");const i=new Array(e);for(let s=0;s<e;s++)i[s]=this.pickOne(t);return i}shuffle(t){const e=t.slice(0);let i;for(let t=0;t<e.length-2;t++){const s=this.integer(t,e.length-1);i=e[t],e[t]=e[s],e[s]=i}return e}range(t,e,i){const s=new Array(t);for(let n=0;n<t;n++)s[n]=this.integer(e,i);return s}d4(){return this.integer(1,4)}d6(){return this.integer(1,6)}d8(){return this.integer(1,8)}d10(){return this.integer(1,10)}d12(){return this.integer(1,12)}d20(){return this.integer(1,20)}}const m=2*Math.PI;function v(t){return t>=0?t-Math.floor(t):t-Math.ceil(t)}function x(t){return 0===t?0:t<0?-1:1}function w(t,e,i){return Math.min(Math.max(e,t),i)}function y(t,e,i){return Math.abs(t-e)<i}function b(t){let e=t;if(t>=m)for(;e>=m;)e-=m;if(t<0)for(;e<0;)e+=m;return e}function C(t){return 180/Math.PI*t}function A(t){return t/180*Math.PI}const T=(t,e)=>Array.from(new Array(e-t+1),((e,i)=>i+t));function S(t,e,i=new f){return i?i.floating(t,e):t+Math.random()*(e-t)}function P(t,e,i=new f){return i?i.integer(t,e):Math.round(S(t,e))}class E{static get Zero(){return new E(0,0)}static get One(){return new E(1,1)}static get Half(){return new E(.5,.5)}static get Up(){return new E(0,-1)}static get Down(){return new E(0,1)}static get Left(){return new E(-1,0)}static get Right(){return new E(1,0)}static fromAngle(t){return new E(Math.cos(t),Math.sin(t))}static isValid(t){return null!=t&&(!isNaN(t.x)&&!isNaN(t.y)&&(t.x!==1/0&&t.y!==1/0&&t.x!==-1/0&&t.y!==-1/0))}static distance(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static min(t,e){return new E(Math.min(t.x,e.x),Math.min(t.y,e.y))}static max(t,e){return new E(Math.max(t.x,e.x),Math.max(t.y,e.y))}constructor(t,e){this._x=0,this._y=0,this._x=t,this._y=e}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}setTo(t,e){this.x=t,this.y=e}equals(t,e=E.EQUALS_EPSILON){return Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e}distance(t){if(!t)return Math.sqrt(this.x*this.x+this.y*this.y);const e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)}squareDistance(t){t||(t=E.Zero);const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}clampMagnitude(t){const e=w(this.magnitude,0,t);return this.magnitude=e,this}get size(){return this.distance()}set size(t){const e=this.normalize().scale(t);this.setTo(e.x,e.y)}get magnitude(){return this.distance()}set magnitude(t){this.normalize().scale(t,this)}normalize(){const t=this.distance();return 0===t?E.Zero:new E(this.x/t,this.y/t)}average(t){return this.add(t).scale(.5)}scale(t,e){const i=e||new E(0,0);return t instanceof E?(i.x=this.x*t.x,i.y=this.y*t.y):(i.x=this.x*t,i.y=this.y*t),i}add(t,e){return e?(e.x=this.x+t.x,e.y=this.y+t.y,e):new E(this.x+t.x,this.y+t.y)}sub(t,e){const i=e||new E(0,0),s=this.x-t.x,n=this.y-t.y;return i.x=s,i.y=n,i}addEqual(t){return this.setTo(this.x+t.x,this.y+t.y),this}subEqual(t){return this.setTo(this.x-t.x,this.y-t.y),this}scaleEqual(t){return this.setTo(this.x*t,this.y*t),this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return t instanceof E?this.x*t.y-this.y*t.x:"number"==typeof t?new E(t*this.y,-t*this.x):void 0}static cross(t,e){return new E(-t*e.y,t*e.x)}perpendicular(){return new E(this.y,-this.x)}normal(){return this.perpendicular().normalize()}negate(){return this.scale(-1)}toAngle(){return b(Math.atan2(this.y,this.x))}angleBetween(t,e){const i=this.toAngle(),s=b(t);let n=0,r=0;switch(n=s>i?s-i:(m-i+s)%m,r=(n-m)%m,e){case h.ShortestPath:return Math.abs(n)<Math.abs(r)?n:r;case h.LongestPath:return Math.abs(n)>Math.abs(r)?n:r;case h.Clockwise:return n;case h.CounterClockwise:return r}}rotate(t,e,i){const s=i||new E(0,0);e||(e=new E(0,0));const n=Math.sin(t),r=Math.cos(t),o=r*(this.x-e.x)-n*(this.y-e.y)+e.x,a=n*(this.x-e.x)+r*(this.y-e.y)+e.y;return s.x=o,s.y=a,s}clone(t){const e=null!=t?t:new E(0,0);return e.x=this.x,e.y=this.y,e}toString(t){return t?`(${this.x.toFixed(t)}, ${this.y.toFixed(t)})`:`(${this.x}, ${this.y})`}}function I(t,e){return new E(t,e)}E.EQUALS_EPSILON=.001;class R{constructor(t,e,i,s){this.r=t,this.g=e,this.b=i,this.a=null!=s?s:1}static fromRGB(t,e,i,s){return new R(t,e,i,s)}static fromRGBString(t){let e=null;if(e=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)/i)){const t=parseInt(e[1],10),i=parseInt(e[2],10),s=parseInt(e[3],10);let n=1;return e[4]&&(n=parseFloat(e[4])),new R(t,i,s,n)}throw new Error("Invalid rgb/a string: "+t)}static fromHex(t){let e=null;if(e=t.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i)){const t=parseInt(e[1],16),i=parseInt(e[2],16),s=parseInt(e[3],16);let n=1;return e[4]&&(n=parseInt(e[4],16)/255),new R(t,i,s,n)}throw new Error("Invalid hex string: "+t)}static fromHSL(t,e,i,s=1){return new F(t,e,i,s).toRGBA()}lighten(t=.1){const e=F.fromRGBA(this.r,this.g,this.b,this.a);return e.l+=(1-e.l)*t,e.toRGBA()}darken(t=.1){const e=F.fromRGBA(this.r,this.g,this.b,this.a);return e.l-=e.l*t,e.toRGBA()}saturate(t=.1){const e=F.fromRGBA(this.r,this.g,this.b,this.a);return e.s+=e.s*t,e.toRGBA()}desaturate(t=.1){const e=F.fromRGBA(this.r,this.g,this.b,this.a);return e.s-=e.s*t,e.toRGBA()}multiply(t){const e=t.r/255*this.r/255*255,i=t.g/255*this.g/255*255,s=t.b/255*this.b/255*255,n=t.a*this.a;return new R(e,i,s,n)}screen(t){const e=t.invert(),i=t.invert();return e.multiply(i).invert()}invert(){return new R(255-this.r,255-this.g,255-this.b,1-this.a)}average(t){const e=(t.r+this.r)/2,i=(t.g+this.g)/2,s=(t.b+this.b)/2,n=(t.a+this.a)/2;return new R(e,i,s,n)}equal(t){return this.toString()===t.toString()}toString(t="rgb"){switch(t){case"rgb":return this.toRGBA();case"hsl":return this.toHSLA();case"hex":return this.toHex();default:throw new Error("Invalid Color format")}}_componentToHex(t){const e=Math.max(Math.round(t),0).toString(16);return 1===e.length?"0"+e:e}toHex(){let t="#"+this._componentToHex(this.r)+this._componentToHex(this.g)+this._componentToHex(this.b);return 1!==this.a&&(t+=this._componentToHex(255*this.a)),t}toRGBA(){const t=String(this.r.toFixed(0))+", "+String(this.g.toFixed(0))+", "+String(this.b.toFixed(0));return void 0!==this.a||null!==this.a?"rgba("+t+", "+String(this.a)+")":"rgb("+t+")"}toHSLA(){return F.fromRGBA(this.r,this.g,this.b,this.a).toString()}fillStyle(){return this.toString()}clone(t){const e=t||new R(this.r,this.g,this.b,this.a);return e.r=this.r,e.g=this.g,e.b=this.b,e.a=this.a,e}static get Black(){return R.fromHex("#000000")}static get White(){return R.fromHex("#FFFFFF")}static get Gray(){return R.fromHex("#808080")}static get LightGray(){return R.fromHex("#D3D3D3")}static get DarkGray(){return R.fromHex("#A9A9A9")}static get Yellow(){return R.fromHex("#FFFF00")}static get Orange(){return R.fromHex("#FFA500")}static get Red(){return R.fromHex("#FF0000")}static get Vermilion(){return R.fromHex("#FF5B31")}static get Rose(){return R.fromHex("#FF007F")}static get Pink(){return R.fromHex("#FFC0CB")}static get Magenta(){return R.fromHex("#FF00FF")}static get Violet(){return R.fromHex("#7F00FF")}static get Purple(){return R.fromHex("#800080")}static get Blue(){return R.fromHex("#0000FF")}static get Azure(){return R.fromHex("#007FFF")}static get Cyan(){return R.fromHex("#00FFFF")}static get Viridian(){return R.fromHex("#59978F")}static get Teal(){return R.fromHex("#008080")}static get Green(){return R.fromHex("#00FF00")}static get Chartreuse(){return R.fromHex("#7FFF00")}static get Transparent(){return R.fromHex("#FFFFFF00")}static get ExcaliburBlue(){return R.fromHex("#176BAA")}static get Brown(){return R.fromHex("#964B00")}}class F{constructor(t,e,i,s){this.h=t,this.s=e,this.l=i,this.a=s}static hue2rgb(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}static fromRGBA(t,e,i,s){t/=255,e/=255,i/=255;const n=Math.max(t,e,i),r=Math.min(t,e,i);let o,a;const h=(n+r)/2;if(n===r)o=a=0;else{const s=n-r;switch(a=h>.5?s/(2-n-r):s/(n+r),n){case t:o=(e-i)/s+(e<i?6:0);break;case e:o=(i-t)/s+2;break;case i:o=(t-e)/s+4}o/=6}return new F(o,a,h,s)}toRGBA(){let t,e,i;if(0===this.s)t=e=i=this.l;else{const s=this.l<.5?this.l*(1+this.s):this.l+this.s-this.l*this.s,n=2*this.l-s;t=F.hue2rgb(n,s,this.h+1/3),e=F.hue2rgb(n,s,this.h),i=F.hue2rgb(n,s,this.h-1/3)}return new R(255*t,255*e,255*i,this.a)}toString(){return`hsla(${this.h.toFixed(0)}, ${this.s.toFixed(0)}, ${this.l.toFixed(0)}, ${this.a.toFixed(0)})`}}var M,D,B;!function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error",t[t.Fatal=4]="Fatal"}(M||(M={}));class k{constructor(){if(this._appenders=[],this.defaultLevel=M.Info,this._logOnceSet=new Set,k._INSTANCE)throw new Error("Logger is a singleton");return k._INSTANCE=this,k._INSTANCE.addAppender(new L),k._INSTANCE}static getInstance(){return null==k._INSTANCE&&(k._INSTANCE=new k),k._INSTANCE}addAppender(t){this._appenders.push(t)}clearAppenders(){this._appenders.length=0}_log(t,e){null==t&&(t=this.defaultLevel);const i=this._appenders.length;for(let s=0;s<i;s++)t>=this.defaultLevel&&this._appenders[s].log(t,e)}_logOnce(t,e){const i=t+e.join("+");this._logOnceSet.has(i)||(this._logOnceSet.add(i),this._log(t,e))}debug(...t){this._log(M.Debug,t)}debugOnce(...t){this._logOnce(M.Debug,t)}info(...t){this._log(M.Info,t)}infoOnce(...t){this._logOnce(M.Info,t)}warn(...t){this._log(M.Warn,t)}warnOnce(...t){this._logOnce(M.Warn,t)}error(...t){this._log(M.Error,t)}errorOnce(...t){this._logOnce(M.Error,t)}fatal(...t){this._log(M.Fatal,t)}fatalOnce(...t){this._logOnce(M.Fatal,t)}}k._INSTANCE=null;class L{log(t,e){if(!console&&!console.log&&console.warn&&console.error)return;const i=[];i.unshift.apply(i,e),i.unshift("["+M[t]+"] : "),t<M.Warn?console.log.apply?console.log.apply(console,i):console.log(i.join(" ")):t<M.Error?console.warn.apply?console.warn.apply(console,i):console.warn(i.join(" ")):console.error.apply?console.error.apply(console,i):console.error(i.join(" "))}}class z{constructor(t){var e,i;this._messages=[],this._pos=10,this._color=R.Black,this._options=t,this.canvas=document.createElement("canvas"),this._ctx=this.canvas.getContext("2d"),this.canvas.style.position="absolute",this.canvas.style.zIndex=null!==(i=null===(e=t.zIndex)||void 0===e?void 0:e.toString())&&void 0!==i?i:"99",document.body.appendChild(this.canvas),this._positionScreenAppenderCanvas(),t.engine.screen.events.on("resize",(()=>{this._positionScreenAppenderCanvas()}))}_positionScreenAppenderCanvas(){var t,e,i,s;const n=this._options;this.canvas.width=null!==(t=n.width)&&void 0!==t?t:n.engine.screen.resolution.width,this.canvas.height=null!==(e=n.height)&&void 0!==e?e:n.engine.screen.resolution.height,this.canvas.style.position="absolute";const r=n.engine.screen.screenToPageCoordinates(I(0,0));this.canvas.style.left=r.x+"px",this.canvas.style.top=r.y+"px",this._pos=null!==(i=n.xPos)&&void 0!==i?i:this._pos,this._color=null!==(s=n.color)&&void 0!==s?s:this._color}log(t,e){const i=e.join(",");this._ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this._messages.unshift("["+M[t]+"] : "+i);let s=10;this._messages=this._messages.slice(0,1e3);for(let t=0;t<this._messages.length;t++)this._ctx.fillStyle=this._color.toRGBA(),this._ctx.fillText(this._messages[t],this._pos,s),s+=10}}!function(t){t.None="None",t.Top="Top",t.Bottom="Bottom",t.Left="Left",t.Right="Right"}(D||(D={})),function(t){t.getOpposite=function(e){return e===t.Top?t.Bottom:e===t.Bottom?t.Top:e===t.Left?t.Right:e===t.Right?t.Left:t.None},t.fromDirection=function(e){return Math.abs(e.x)>=Math.abs(e.y)?e.x<=0?t.Left:t.Right:e.y<=0?t.Top:t.Bottom}}(D||(D={}));class U{constructor(t=0,e=0,i=0,s=0){this._points=[],"object"==typeof t?(this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom):"number"==typeof t&&(this.left=t,this.top=e,this.right=i,this.bottom=s)}clone(t){const e=t||new U(0,0,0,0);return e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e}reset(){this.left=0,this.top=0,this.bottom=0,this.right=0}static getSideFromIntersection(t){return t&&t?Math.abs(t.x)>Math.abs(t.y)?t.x<0?D.Right:D.Left:t.y<0?D.Bottom:D.Top:D.None}static fromPoints(t){let e=1/0,i=1/0,s=-1/0,n=-1/0;for(let r=0;r<t.length;r++)t[r].x<e&&(e=t[r].x),t[r].x>s&&(s=t[r].x),t[r].y<i&&(i=t[r].y),t[r].y>n&&(n=t[r].y);return new U(e,i,s,n)}static fromDimension(t,e,i=E.Half,s=E.Zero){return new U(-t*i.x+s.x,-e*i.y+s.y,t-t*i.x+s.x,e-e*i.y+s.y)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}hasZeroDimensions(){return 0===this.width||0===this.height}get center(){return new E((this.left+this.right)/2,(this.top+this.bottom)/2)}get topLeft(){return new E(this.left,this.top)}get bottomRight(){return new E(this.right,this.bottom)}get topRight(){return new E(this.right,this.top)}get bottomLeft(){return new E(this.left,this.bottom)}translate(t){return new U(this.left+t.x,this.top+t.y,this.right+t.x,this.bottom+t.y)}rotate(t,e=E.Zero){const i=this.getPoints().map((i=>i.rotate(t,e)));return U.fromPoints(i)}scale(t,e=E.Zero){const i=this.translate(e);return new U(i.left*t.x,i.top*t.y,i.right*t.x,i.bottom*t.y)}transform(t){const e=t.data[0]*this.left,i=t.data[1]*this.left,s=t.data[0]*this.right,n=t.data[1]*this.right,r=t.data[2]*this.top,o=t.data[3]*this.top,a=t.data[2]*this.bottom,h=t.data[3]*this.bottom,l=t.getPosition(),c=Math.min(e,s)+Math.min(r,a)+l.x,d=Math.min(i,n)+Math.min(o,h)+l.y,u=Math.max(e,s)+Math.max(r,a)+l.x,_=Math.max(i,n)+Math.max(o,h)+l.y;return new U({left:c,top:d,right:u,bottom:_})}getPerimeter(){return 2*(this.width+this.height)}getPoints(){return this._left===this.left&&this._right===this.right&&this._top===this.top&&this._bottom===this.bottom||(this._points.length=0,this._points.push(new E(this.left,this.top)),this._points.push(new E(this.right,this.top)),this._points.push(new E(this.right,this.bottom)),this._points.push(new E(this.left,this.bottom)),this._left=this.left,this._right=this.right,this._top=this.top,this._bottom=this.bottom),this._points}rayCast(t,e=1/0){let i=-1/0,s=1/0;const n=0===t.dir.x?Number.MAX_VALUE:1/t.dir.x,r=0===t.dir.y?Number.MAX_VALUE:1/t.dir.y,o=(this.left-t.pos.x)*n,a=(this.right-t.pos.x)*n;i=Math.min(o,a),s=Math.max(o,a);const h=(this.top-t.pos.y)*r,l=(this.bottom-t.pos.y)*r;return i=Math.max(i,Math.min(h,l)),s=Math.min(s,Math.max(h,l)),s>=Math.max(0,i)&&i<e}rayCastTime(t,e=1/0){let i=-1/0,s=1/0;const n=0===t.dir.x?Number.MAX_VALUE:1/t.dir.x,r=0===t.dir.y?Number.MAX_VALUE:1/t.dir.y,o=(this.left-t.pos.x)*n,a=(this.right-t.pos.x)*n;i=Math.min(o,a),s=Math.max(o,a);const h=(this.top-t.pos.y)*r,l=(this.bottom-t.pos.y)*r;return i=Math.max(i,Math.min(h,l)),s=Math.min(s,Math.max(h,l)),s>=Math.max(0,i)&&i<e?i:-1}contains(t){return t instanceof E?this.left<=t.x&&this.top<=t.y&&t.y<=this.bottom&&t.x<=this.right:t instanceof U&&(this.left<=t.left&&this.top<=t.top&&t.bottom<=this.bottom&&t.right<=this.right)}combine(t,e){const i=e||new U(0,0,0,0),s=Math.min(this.left,t.left),n=Math.min(this.top,t.top),r=Math.max(this.right,t.right),o=Math.max(this.bottom,t.bottom);return i.left=s,i.top=n,i.right=r,i.bottom=o,i}get dimensions(){return new E(this.width,this.height)}overlaps(t,e){const i=e||0;if(t.hasZeroDimensions())return this.contains(t);if(this.hasZeroDimensions())return t.contains(this);const s=this.combine(t);return s.width+i<t.width+this.width&&s.height+i<t.height+this.height}intersect(t){const e=this.combine(t);if(e.width<t.width+this.width&&e.height<t.height+this.height&&!e.dimensions.equals(t.dimensions)&&!e.dimensions.equals(this.dimensions)){let e=0;e=this.right>=t.left&&this.right<=t.right?t.left-this.right:t.right-this.left;let i=0;return i=this.top<=t.bottom&&this.top>=t.top?t.bottom-this.top:t.top-this.bottom,Math.abs(e)<Math.abs(i)?new E(e,0):new E(0,i)}if(e.dimensions.equals(t.dimensions)||e.dimensions.equals(this.dimensions)){let e=0;e=this.width-t.width>=0?this.right-t.right<=t.left-this.left?t.left-this.right:t.right-this.left:t.right-this.right<=this.left-t.left?this.left-t.right:this.right-t.left;let i=0;return i=this.height-t.height>=0?this.bottom-t.bottom<=t.top-this.top?t.top-this.bottom:t.bottom-this.top:t.bottom-this.bottom<=this.top-t.top?this.top-t.bottom:this.bottom-t.top,Math.abs(e)<Math.abs(i)?new E(e,0):new E(0,i)}return null}intersectWithSide(t){const e=this.intersect(t);return U.getSideFromIntersection(e)}draw(t,e=R.Yellow){t.debug.drawRect(this.left,this.top,this.width,this.height,{color:e})}}function O(t){if(t&&t.getBoundingClientRect){const e=t.getBoundingClientRect();return I(e.x+window.scrollX,e.y+window.scrollY)}return E.Zero}function H(t,e){return-1===e.indexOf(t)&&(e.push(t),!0)}function N(t,e){let i=-1;return(i=e.indexOf(t))>-1&&(e.splice(i,1),!0)}function W(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}function G(t){throw new Error(t)}function V(t,e){var i;const s=new _;return(null!==(i=null==e?void 0:e.schedule.bind(e))&&void 0!==i?i:setTimeout)((()=>{s.resolve()}),t),s.promise}function q(t,e){const i={};for(const s in t)e.includes(s)||(i[s]=t[s]);return i}function X(t){return t&&"object"==typeof t&&!Array.isArray(t)}function Y(t,...e){if(!e.length)return t;const i=e.shift();if(X(t)&&X(i))for(const e in i)X(i[e])?(t[e]||Object.assign(t,{[e]:{}}),Y(t[e],i[e])):Object.assign(t,{[e]:i[e]});return Y(t,...e)}!function(t){t[t.X=12]="X",t[t.Y=13]="Y"}(B||(B={}));class Z{constructor(){this.data=new Float32Array(16),this._scaleX=1,this._scaleSignX=1,this._scaleY=1,this._scaleSignY=1}static ortho(t,e,i,s,n,r){const o=new Z;return o.data[0]=2/(e-t),o.data[1]=0,o.data[2]=0,o.data[3]=0,o.data[4]=0,o.data[5]=2/(s-i),o.data[6]=0,o.data[7]=0,o.data[8]=0,o.data[9]=0,o.data[10]=-2/(r-n),o.data[11]=0,o.data[12]=-(e+t)/(e-t),o.data[13]=-(s+i)/(s-i),o.data[14]=-(r+n)/(r-n),o.data[15]=1,o}clone(t){const e=t||new Z;return e.data[0]=this.data[0],e.data[1]=this.data[1],e.data[2]=this.data[2],e.data[3]=this.data[3],e.data[4]=this.data[4],e.data[5]=this.data[5],e.data[6]=this.data[6],e.data[7]=this.data[7],e.data[8]=this.data[8],e.data[9]=this.data[9],e.data[10]=this.data[10],e.data[11]=this.data[11],e.data[12]=this.data[12],e.data[13]=this.data[13],e.data[14]=this.data[14],e.data[15]=this.data[15],e}toDOMMatrix(){return new DOMMatrix([...this.data])}static fromFloat32Array(t){const e=new Z;return e.data=t,e}static identity(){const t=new Z;return t.data[0]=1,t.data[1]=0,t.data[2]=0,t.data[3]=0,t.data[4]=0,t.data[5]=1,t.data[6]=0,t.data[7]=0,t.data[8]=0,t.data[9]=0,t.data[10]=1,t.data[11]=0,t.data[12]=0,t.data[13]=0,t.data[14]=0,t.data[15]=1,t}reset(){const t=this;return t.data[0]=1,t.data[1]=0,t.data[2]=0,t.data[3]=0,t.data[4]=0,t.data[5]=1,t.data[6]=0,t.data[7]=0,t.data[8]=0,t.data[9]=0,t.data[10]=1,t.data[11]=0,t.data[12]=0,t.data[13]=0,t.data[14]=0,t.data[15]=1,t}static translation(t,e){const i=Z.identity();return i.data[12]=t,i.data[13]=e,i}static scale(t,e){const i=Z.identity();return i.data[0]=t,i.data[5]=e,i.data[10]=1,i.data[15]=1,i}static rotation(t){const e=Z.identity();return e.data[0]=Math.cos(t),e.data[4]=-Math.sin(t),e.data[1]=Math.sin(t),e.data[5]=Math.cos(t),e}multiply(t,e){if(t instanceof E){const i=e||new E(0,0),s=t,n=s.x*this.data[0]+s.y*this.data[4]+this.data[12],r=s.x*this.data[1]+s.y*this.data[5]+this.data[13];return i.x=n,i.y=r,i}{const i=e||new Z,s=t,n=this.data[0],r=this.data[1],o=this.data[2],a=this.data[3],h=this.data[4],l=this.data[5],c=this.data[6],d=this.data[7],u=this.data[8],_=this.data[9],g=this.data[10],p=this.data[11],f=this.data[12],m=this.data[13],v=this.data[14],w=this.data[15],y=s.data[0],b=s.data[1],C=s.data[2],A=s.data[3],T=s.data[4],S=s.data[5],P=s.data[6],E=s.data[7],I=s.data[8],R=s.data[9],F=s.data[10],M=s.data[11],D=s.data[12],B=s.data[13],k=s.data[14],L=s.data[15];i.data[0]=n*y+h*b+u*C+f*A,i.data[1]=r*y+l*b+_*C+m*A,i.data[2]=o*y+c*b+g*C+v*A,i.data[3]=a*y+d*b+p*C+w*A,i.data[4]=n*T+h*S+u*P+f*E,i.data[5]=r*T+l*S+_*P+m*E,i.data[6]=o*T+c*S+g*P+v*E,i.data[7]=a*T+d*S+p*P+w*E,i.data[8]=n*I+h*R+u*F+f*M,i.data[9]=r*I+l*R+_*F+m*M,i.data[10]=o*I+c*R+g*F+v*M,i.data[11]=a*I+d*R+p*F+w*M,i.data[12]=n*D+h*B+u*k+f*L,i.data[13]=r*D+l*B+_*k+m*L,i.data[14]=o*D+c*B+g*k+v*L,i.data[15]=a*D+d*B+p*k+w*L;const z=this.getScale();return i._scaleSignX=x(z.x)*x(i._scaleSignX),i._scaleSignY=x(z.y)*x(i._scaleSignY),i}}translate(t,e){const i=this.data[0],s=this.data[1],n=this.data[2],r=this.data[3],o=this.data[4],a=this.data[5],h=this.data[6],l=this.data[7],c=this.data[8],d=this.data[9],u=this.data[10],_=this.data[11],g=this.data[12],p=this.data[13],f=this.data[14],m=this.data[15];return this.data[12]=i*t+o*e+0*c+1*g,this.data[13]=s*t+a*e+0*d+1*p,this.data[14]=n*t+h*e+0*u+1*f,this.data[15]=r*t+l*e+0*_+1*m,this}setPosition(t,e){this.data[12]=t,this.data[13]=e}getPosition(){return I(this.data[12],this.data[13])}rotate(t){const e=this.data[0],i=this.data[1],s=this.data[2],n=this.data[3],r=this.data[4],o=this.data[5],a=this.data[6],h=this.data[7],l=Math.sin(t),c=Math.cos(t);return this.data[0]=c*e+l*r,this.data[1]=c*i+l*o,this.data[2]=c*s+l*a,this.data[3]=c*n+l*h,this.data[4]=c*r-l*e,this.data[5]=c*o-l*i,this.data[6]=c*a-l*s,this.data[7]=c*h-l*n,this}scale(t,e){const i=this.data[0],s=this.data[1],n=this.data[2],r=this.data[3],o=this.data[4],a=this.data[5],h=this.data[6],l=this.data[7];return this.data[0]=i*t,this.data[1]=s*t,this.data[2]=n*t,this.data[3]=r*t,this.data[4]=o*e,this.data[5]=a*e,this.data[6]=h*e,this.data[7]=l*e,this}setRotation(t){const e=this.getScale(),i=Math.sin(t),s=Math.cos(t);this.data[0]=s*e.x,this.data[1]=i*e.y,this.data[4]=-i*e.x,this.data[5]=s*e.y}getRotation(){return b(Math.atan2(this.data[1]/this.getScaleY(),this.data[0]/this.getScaleX()))}getScaleX(){const t=I(this.data[0],this.data[4]).magnitude;return this._scaleSignX*t}getScaleY(){const t=I(this.data[1],this.data[5]).magnitude;return this._scaleSignY*t}getScale(){return I(this.getScaleX(),this.getScaleY())}setScaleX(t){if(this._scaleX===t)return;this._scaleSignX=x(t);const e=I(this.data[0]*this._scaleSignX,this.data[4]*this._scaleSignX).normalize();this.data[0]=e.x*t,this.data[4]=e.y*t,this._scaleX=t}setScaleY(t){if(this._scaleY===t)return;this._scaleSignY=x(t);const e=I(this.data[1]*this._scaleSignY,this.data[5]*this._scaleSignY).normalize();this.data[1]=e.x*t,this.data[5]=e.y*t,this._scaleY=t}setScale(t){this.setScaleX(t.x),this.setScaleY(t.y)}getBasisDeterminant(){return this.data[0]*this.data[5]-this.data[1]*this.data[4]}getAffineInverse(t){const e=1/this.getBasisDeterminant(),i=this.data[0],s=this.data[4],n=this.data[1],r=this.data[5],o=t||Z.identity();o.data[0]=r*e,o.data[1]=-n*e,o.data[4]=-s*e,o.data[5]=i*e;const a=this.data[12],h=this.data[13];return o.data[12]=-(a*o.data[0]+h*o.data[4]),o.data[13]=-(a*o.data[1]+h*o.data[5]),o}isIdentity(){return 1===this.data[0]&&0===this.data[1]&&0===this.data[2]&&0===this.data[3]&&0===this.data[4]&&1===this.data[5]&&0===this.data[6]&&0===this.data[7]&&0===this.data[8]&&0===this.data[9]&&1===this.data[10]&&0===this.data[11]&&0===this.data[12]&&0===this.data[13]&&0===this.data[14]&&1===this.data[15]}toString(){return`\n[${this.data[0]} ${this.data[4]} ${this.data[8]} ${this.data[12]}]\n[${this.data[1]} ${this.data[5]} ${this.data[9]} ${this.data[13]}]\n[${this.data[2]} ${this.data[6]} ${this.data[10]} ${this.data[14]}]\n[${this.data[3]} ${this.data[7]} ${this.data[11]} ${this.data[15]}]\n`}}class ${constructor(){this.data=new Float64Array(6),this._scale=new Float64Array([1,1]),this._scaleSignX=1,this._scaleSignY=1}toDOMMatrix(){return new DOMMatrix([...this.data])}static identity(){const t=new $;return t.data[0]=1,t.data[1]=0,t.data[2]=0,t.data[3]=1,t.data[4]=0,t.data[5]=0,t}static translation(t,e){const i=$.identity();return i.data[4]=t,i.data[5]=e,i}static scale(t,e){const i=$.identity();return i.data[0]=t,i.data[3]=e,i._scale[0]=t,i._scale[1]=e,i}static rotation(t){const e=$.identity();return e.data[0]=Math.cos(t),e.data[1]=Math.sin(t),e.data[2]=-Math.sin(t),e.data[3]=Math.cos(t),e}setPosition(t,e){this.data[4]=t,this.data[5]=e}getPosition(){return I(this.data[4],this.data[5])}rotate(t){const e=this.data[0],i=this.data[1],s=this.data[2],n=this.data[3],r=Math.sin(t),o=Math.cos(t);return this.data[0]=o*e+r*s,this.data[1]=o*i+r*n,this.data[2]=o*s-r*e,this.data[3]=o*n-r*i,this}translate(t,e){const i=this.data[0],s=this.data[1],n=this.data[2],r=this.data[3],o=this.data[4],a=this.data[5];return this.data[4]=i*t+n*e+o,this.data[5]=s*t+r*e+a,this}scale(t,e){const i=this.data[0],s=this.data[1],n=this.data[2],r=this.data[3];return this.data[0]=i*t,this.data[1]=s*t,this.data[2]=n*e,this.data[3]=r*e,this._scale[0]=t,this._scale[1]=e,this._scaleSignX=x(t),this._scaleSignY=x(e),this}determinant(){return this.data[0]*this.data[3]-this.data[1]*this.data[2]}inverse(t){const e=this.determinant();let i=e;0!==e&&(i=1/e);const s=this.data[0],n=this.data[2],r=this.data[1],o=this.data[3],a=t||$.identity();a.data[0]=o*i,a.data[1]=-r*i,a.data[2]=-n*i,a.data[3]=s*i;const h=this.data[4],l=this.data[5];return a.data[4]=-(h*a.data[0]+l*a.data[2]),a.data[5]=-(h*a.data[1]+l*a.data[3]),a}multiply(t,e){if(t instanceof E){const i=e||new E(0,0),s=t,n=s.x*this.data[0]+s.y*this.data[2]+this.data[4],r=s.x*this.data[1]+s.y*this.data[3]+this.data[5];return i.x=n,i.y=r,i}{const i=e||new $,s=t,n=this.data[0],r=this.data[1],o=this.data[2],a=this.data[3],h=this.data[4],l=this.data[5],c=s.data[0],d=s.data[1],u=s.data[2],_=s.data[3],g=s.data[4],p=s.data[5];i.data[0]=n*c+o*d,i.data[1]=r*c+a*d,i.data[2]=n*u+o*_,i.data[3]=r*u+a*_,i.data[4]=n*g+o*p+h,i.data[5]=r*g+a*p+l;const f=this._scaleSignX,m=this._scaleSignY;return i._scaleSignX=f*x(i._scaleSignX),i._scaleSignY=m*x(i._scaleSignY),i}}multiplyQuadInPlace(t){const e=t[0]*this.data[0]+t[1]*this.data[2]+this.data[4],i=t[0]*this.data[1]+t[1]*this.data[3]+this.data[5];t[0]=e,t[1]=i;const s=t[2]*this.data[0]+t[3]*this.data[2]+this.data[4],n=t[2]*this.data[1]+t[3]*this.data[3]+this.data[5];t[2]=s,t[3]=n;const r=t[4]*this.data[0]+t[5]*this.data[2]+this.data[4],o=t[4]*this.data[1]+t[5]*t