const PROPERTY_TYPE={NUMBER:1,VECTOR2:2,COLOR:3},SHAPES={RECT:1,ELLIPSE:2},TRANS_TYPE={LINEAR:1,QUAD:2,CUBIC:3,QUART:4,QUINT:5,SINE:6,EXPONENTIAL:7,CIRCULAR:8,ELASTIC:9,BACK:10,BOUNCE:11},EASE_TYPE={IN:1,OUT:2,IN_OUT:3},RENDER_MODES={P2D:1,WEBGL:2},STYLE={DEFAULT_FONT_SIZE:20,DEFAULT_STYLE:{"font-family":"Lato"}},Easings={Linear:{ease:function(t,e,i,s){return e+i*t/s}},Quad:{easeIn:function(t,e,i,s){return i*(t/=s)*t+e},easeOut:function(t,e,i,s){return-i*(t/=s)*(t-2)+e},easeInOut:function(t,e,i,s){return(t/=s/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e}},Cubic:{easeIn:function(t,e,i,s){return i*(t/=s)*t*t+e},easeOut:function(t,e,i,s){return i*((t=t/s-1)*t*t+1)+e},easeInOut:function(t,e,i,s){return(t/=s/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e}},Quart:{easeIn:function(t,e,i,s){return i*(t/=s)*t*t*t+e},easeOut:function(t,e,i,s){return-i*((t=t/s-1)*t*t*t-1)+e},easeInOut:function(t,e,i,s){return(t/=s/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e}},Quint:{easeIn:function(t,e,i,s){return i*(t/=s)*t*t*t*t+e},easeOut:function(t,e,i,s){return i*((t=t/s-1)*t*t*t*t+1)+e},easeInOut:function(t,e,i,s){return(t/=s/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e}},Sine:{easeIn:function(t,e,i,s){return-i*Math.cos(t/s*(Math.PI/2))+i+e},easeOut:function(t,e,i,s){return i*Math.sin(t/s*(Math.PI/2))+e},easeInOut:function(t,e,i,s){return-i/2*(Math.cos(Math.PI*t/s)-1)+e}},Expo:{easeIn:function(t,e,i,s){return 0==t?e:i*Math.pow(2,10*(t/s-1))+e},easeOut:function(t,e,i,s){return t==s?e+i:i*(1-Math.pow(2,-10*t/s))+e},easeInOut:function(t,e,i,s){return 0==t?e:t==s?e+i:(t/=s/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e}},Circ:{easeIn:function(t,e,i,s){return-i*(Math.sqrt(1-(t/=s)*t)-1)+e},easeOut:function(t,e,i,s){return i*Math.sqrt(1-(t=t/s-1)*t)+e},easeInOut:function(t,e,i,s){return(t/=s/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e}},Elastic:{easeIn:function(t,e,i,s){var n=1.70158,a=0,h=i;return 0==t?e:1==(t/=s)?e+i:(a=a||.3*s,n=h{i.P5Image=t})},getTextureByName:function(e){for(let t=0;t{i.P5Font=t})},getFontByName:function(e){for(let t=0;t=this.tweenData.length||(this.tweenData[t].playing=!0)}stopAll(){for(let t=0;t=this.tweenData.length||(this.tweenData[t].playing=!1)}resumeAll(){for(let t=0;t=this.tweenData.length||(this.tweenData[t].playing=!0)}resetAll(){this.doneTweens=0,this.done=!1;for(let t=0;t=this.tweenData.length||(this.doneTweens--,this.done=!1,this.tweenData[t].t=0,this.tweenData[t].done=!1)}removeAll(){for(;0=this.tweenData.length||this.tweenData.splice(t,1)}seekAll(e){if(!(e<0))for(let t=0;t=this.tweenData.length||(this.tweenData[t].t=min(e,this.tweenData[t].duration))}allDone(){this.emitSignal("tweenAllCompleted"),this.done=!0}initSignals(){this.addSignal("tweenAllCompleted"),this.addSignal("tweenCompleted"),this.addSignal("tweenStarted"),this._initSignals()}update(e){if(!this.updatePaused){this.done||this.doneTweens!=this.tweenData.length||this.allDone();for(let t=0;t=this.getCurrentFrameTime()&&(this.frame=(this.frame+1)%this.getCurrentNumFrames(),this.timeSinceLastFrame=0)),this.P5Image=this.getCurrentFrame(),this.updateChildren(t))}}class Area2D extends Object2D{constructor(t,e,i,s=!0,n=!1){switch(super(t),this.shapeType=e,this.shapeType){case SHAPES.RECT:this.shapeName="Rect";break;case SHAPES.ELLIPSE:this.shapeName="Ellipse"}this.shape=i,this.listenToMouse=s,this.drawDebug=n,this.mouseIn=!1}setDrawDebug(t){this.drawDebug=t}initSignals(){this.addSignal("mouseEntered"),this.addSignal("mouseExited"),this._initSignals()}update(t){this.updatePaused||(this.udpateGlobalTransform(),this.listenToMouse&&(Collisions[this.shapeName].point(this.globalPosition.x,this.globalPosition.y,this.globalRotationDegrees,this.globalScale.x,this.globalScale.y,this.shape,GameHandler.mouseX,GameHandler.mouseY)?(this.mouseIn||this.emitSignal("mouseEntered"),this.mouseIn=!0):(this.mouseIn&&this.emitSignal("mouseExited"),this.mouseIn=!1)),this.updateChildren(t))}draw(t,e){if(this.visible){if(e.push(),this.applyTransform(e),this.drawDebug){switch(e.push(),e.noStroke(),e.fill(0,0,100,100),this.shapeType){case SHAPES.ELLIPSE:e.ellipseMode(CENTER),e.ellipse(0,0,2*this.shape.rx,2*this.shape.ry);break;case SHAPES.RECT:e.rectMode(CENTER),e.rect(0,0,this.shape.w,this.shape.h)}e.pop()}this.drawChildren(t,e),e.pop()}}}class UIObject extends GameObject{constructor(t){super(t),this.P5Element=null,this.visible=!0,this.position=new Vector2(0,0),this.size=new Vector2(300,100),this.fontSize=STYLE.DEFAULT_FONT_SIZE}connectCallbacks(){this.P5Element.mousePressed(this.onMousePressed),this.P5Element.doubleClicked(this.onDoubleClicked),this.P5Element.mouseWheel(this.onMouseWheel),this.P5Element.mouseReleased(this.onMouseReleased),this.P5Element.mouseClicked(this.onMouseClicked),this.P5Element.mouseMoved(this.onMouseMoved),this.P5Element.mouseOver(this.onMouseOver),this.P5Element.mouseOut(this.onMouseOut),this.P5Element.touchStarted(this.onTouchStarted),this.P5Element.touchMoved(this.onTouchMoved),this.P5Element.touchEnded(this.onTouchEnded),this.P5Element.dragOver(this.onDragOver),this.P5Element.dragLeave(this.onDragLeave),this.P5Element.pandoraObject=this}setPosition(t,e){this.position.x=t,this.position.y=e}setSize(t,e){this.size.x=t,this.size.y=e}setFontSize(t){this.fontSize=t}setVisibility(t){t?this.P5Element.show():this.P5Element.hide(),this.visible=!this.visible}setValue(t){this.P5Element.value(t)}setStyle(t){for(var[e,i]of Object.entries(t))this.P5Element.style(""+e,i)}getPosition(){return this.position}getSize(){return this.size}getFontSize(){return this.fontSize}getVisibility(){return this.visible}getValue(){return this.P5Element.value()}show(){this.visible=!0,this.P5Element.show();for(let t=0;t