Add-N
"),r.push(""),r.push("");var h=[r.join("\n")],a=this;try{var n=new window.Blob(h,{type:"image/svg+xml;charset=utf-8"})}catch(o){return a.state=t.FILE_ERRORED,void a.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){i.revokeObjectURL(a.data),a.onProcessComplete()},this.data.onerror=function(){i.revokeObjectURL(a.data),a.onProcessError()},i.createObjectURL(this.data,n,"image/svg+xml")},addToCache:function(){var e=this.cache.addImage(this.key,this.data);this.pendingDestroy(e)}});s.register("htmlTexture",function(e,t,i,s,r){if(Array.isArray(e))for(var h=0;h0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(h.START,this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(o.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(h.PROGRESS,this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size0&&t>e&&(t=e)),0!==h&&0!==s&&(s<0&&s<-h?s=-h:s>0&&s>h&&(s=h)),this.gameObject.x+=t,this.gameObject.y+=s}t<0?this.facing=i.FACING_LEFT:t>0&&(this.facing=i.FACING_RIGHT),s<0?this.facing=i.FACING_UP:s>0&&(this.facing=i.FACING_DOWN),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this._tx=t,this._ty=s},setBoundsRectangle:function(t){return this.customBoundsRectangle=t||this.world.bounds,this},checkWorldBounds:function(){var t=this.position,i=this.customBoundsRectangle,s=this.world.checkCollision,e=this.worldBounce?-this.worldBounce.x:-this.bounce.x,h=this.worldBounce?-this.worldBounce.y:-this.bounce.y,o=!1;return t.xi.right&&s.right&&(t.x=i.right-this.width,this.velocity.x*=e,this.blocked.right=!0,o=!0),t.yi.bottom&&s.down&&(t.y=i.bottom-this.height,this.velocity.y*=h,this.blocked.down=!0,o=!0),o&&(this.blocked.none=!1),o},setOffset:function(t,i){return void 0===i&&(i=t),this.offset.set(t,i),this.updateCenter(),this},setSize:function(t,i,s){void 0===s&&(s=!0);var e=this.gameObject;if(!t&&e.frame&&(t=e.frame.realWidth),!i&&e.frame&&(i=e.frame.realHeight),this.sourceWidth=t,this.sourceHeight=i,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),s&&e.getCenter){var h=e.displayWidth/2,o=e.displayHeight/2;this.offset.set(h-this.halfWidth,o-this.halfHeight)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,i,s){return void 0===i&&(i=this.offset.x),void 0===s&&(s=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(i,s),this.updateCenter()):this.isCircle=!1,this},reset:function(t,i){this.stop();var s=this.gameObject;s.setPosition(t,i),s.getTopLeft?s.getTopLeft(this.position):this.position.set(t,i),this.prev.copy(this.position),this.prevFrame.copy(this.position),this.rotation=s.angle,this.preRotation=s.angle,this.updateBounds(),this.updateCenter()},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,i){return this.isCircle?this.radius>0&&t>=this.left&&t<=this.right&&i>=this.top&&i<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-i)*(this.center.y-i)<=this.radius*this.radius:o(this,t,i)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaXFinal:function(){return this._tx},deltaYFinal:function(){return this._ty},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&this.world.pendingDestroy.set(this)},drawDebug:function(t){var i=this.position,s=i.x+this.halfWidth,e=i.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(s,e,this.width/2):(this.checkCollision.up&&t.lineBetween(i.x,i.y,i.x+this.width,i.y),this.checkCollision.right&&t.lineBetween(i.x+this.width,i.y,i.x+this.width,i.y+this.height),this.checkCollision.down&&t.lineBetween(i.x,i.y+this.height,i.x+this.width,i.y+this.height),this.checkCollision.left&&t.lineBetween(i.x,i.y,i.x,i.y+this.height))),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,this.world.defaults.velocityDebugColor,1),t.lineBetween(s,e,s+this.velocity.x/2,e+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t,i,s){void 0===t&&(t=!0),this.collideWorldBounds=t;var e=void 0!==i,h=void 0!==s;return(e||h)&&(this.worldBounce||(this.worldBounce=new n),e&&(this.worldBounce.x=i),h&&(this.worldBounce.y=s)),this},setVelocity:function(t,i){return this.velocity.set(t,i),t=this.velocity.x,i=this.velocity.y,this.speed=Math.sqrt(t*t+i*i),this},setVelocityX:function(t){this.velocity.x=t;var i=t,s=this.velocity.y;return this.speed=Math.sqrt(i*i+s*s),this},setVelocityY:function(t){this.velocity.y=t;var i=this.velocity.x,s=t;return this.speed=Math.sqrt(i*i+s*s),this},setMaxVelocity:function(t,i){return this.maxVelocity.set(t,i),this},setMaxSpeed:function(t){return this.maxSpeed=t,this},setBounce:function(t,i){return this.bounce.set(t,i),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,i){return this.acceleration.set(t,i),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=t,this},setDrag:function(t,i){return this.drag.set(t,i),this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,i){return this.gravity.set(t,i),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,i){return this.friction.set(t,i),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=t,this},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});module.exports=r;
},{"../../utils/Class":"JASv","./const":"FWI5","./events":"csuF","../../math/RadToDeg":"vauQ","../../geom/rectangle/Rectangle":"wYVB","../../geom/rectangle/Contains":"mjUt","../../math/Vector2":"qKN5"}],"Upa6":[function(require,module,exports) {
var t=require("../../utils/Class"),l=new t({initialize:function(t,l,i,s,e,c,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=l,this.object1=i,this.object2=s,this.collideCallback=e,this.processCallback=c,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});module.exports=l;
},{"../../utils/Class":"JASv"}],"WS1S":[function(require,module,exports) {
var e=require("./const"),o=function(o,n,c,i){var t=0,l=o.deltaAbsX()+n.deltaAbsX()+i;return 0===o._dx&&0===n._dx?(o.embedded=!0,n.embedded=!0):o._dx>n._dx?(t=o.right-n.x)>l&&!c||!1===o.checkCollision.right||!1===n.checkCollision.left?t=0:(o.touching.none=!1,o.touching.right=!0,n.touching.none=!1,n.touching.left=!0,n.physicsType===e.STATIC_BODY&&(o.blocked.none=!1,o.blocked.right=!0),o.physicsType===e.STATIC_BODY&&(n.blocked.none=!1,n.blocked.left=!0)):o._dxl&&!c||!1===o.checkCollision.left||!1===n.checkCollision.right?t=0:(o.touching.none=!1,o.touching.left=!0,n.touching.none=!1,n.touching.right=!0,n.physicsType===e.STATIC_BODY&&(o.blocked.none=!1,o.blocked.left=!0),o.physicsType===e.STATIC_BODY&&(n.blocked.none=!1,n.blocked.right=!0))),o.overlapX=t,n.overlapX=t,t};module.exports=o;
},{"./const":"FWI5"}],"JFvb":[function(require,module,exports) {
var o=require("./const"),e=function(e,n,c,d){var i=0,l=e.deltaAbsY()+n.deltaAbsY()+d;return 0===e._dy&&0===n._dy?(e.embedded=!0,n.embedded=!0):e._dy>n._dy?(i=e.bottom-n.y)>l&&!c||!1===e.checkCollision.down||!1===n.checkCollision.up?i=0:(e.touching.none=!1,e.touching.down=!0,n.touching.none=!1,n.touching.up=!0,n.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0),e.physicsType===o.STATIC_BODY&&(n.blocked.none=!1,n.blocked.up=!0)):e._dyl&&!c||!1===e.checkCollision.up||!1===n.checkCollision.down?i=0:(e.touching.none=!1,e.touching.up=!0,n.touching.none=!1,n.touching.down=!0,n.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0),e.physicsType===o.STATIC_BODY&&(n.blocked.none=!1,n.blocked.down=!0))),e.overlapY=i,n.overlapY=i,i};module.exports=e;
},{"./const":"FWI5"}],"wjuU":[function(require,module,exports) {
var l=function(l,a){return l.collisionCallback?!l.collisionCallback.call(l.collisionCallbackContext,a,l):!l.layer.callbacks[l.index]||!l.layer.callbacks[l.index].callback.call(l.layer.callbacks[l.index].callbackContext,a,l)};module.exports=l;
},{}],"eoRJ":[function(require,module,exports) {
var t=require("../utils/array/QuickSelect");function i(t){if(!(this instanceof i))return new i(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function n(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function x(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,h,e){for(var a,o=[n,r];o.length;)(r=o.pop())-(n=o.pop())<=h||(a=n+Math.ceil((r-n)/h/2)*h,t(i,a,n,r,e),o.push(n,a,a,r))}i.prototype={all:function(){return this._all(this.data,[])},search:function(t){var i=this.data,n=[],r=this.toBBox;if(!f(t,i))return n;for(var h,e,a,o,s=[];i;){for(h=0,e=i.children.length;h=0&&a[i].children.length>this._maxEntries;)this._split(a,i),i--;this._adjustParentBBoxes(h,a,i)},_split:function(t,i){var n=t[i],h=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,h);var a=this._chooseSplitIndex(n,e,h),o=x(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,r(n,this.toBBox),r(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},_splitRoot:function(t,i){this.data=x([t,i]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},_chooseSplitIndex:function(t,i,n){var r,e,a,o,l,m,c,f;for(m=c=1/0,r=i;r<=n-i;r++)o=u(e=h(t,0,r,this.toBBox),a=h(t,r,n,this.toBBox)),l=s(e)+s(a),o=i;a--)o=t.children[a],e(u,t.leaf?s(o):o),c+=l(u);return c},_adjustParentBBoxes:function(t,i,n){for(var r=n;r>=0;r--)e(i[r],t)},_condense:function(t){for(var i,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(i=t[n-1].children).splice(i.indexOf(t[n]),1):this.clear():r(t[n],this.toBBox)},compareMinX:function(t,i){return t.left-i.left},compareMinY:function(t,i){return t.top-i.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},module.exports=i;
},{"../utils/array/QuickSelect":"MEkw"}],"vdLB":[function(require,module,exports) {
var o=function(o,e){e<0?(o.blocked.none=!1,o.blocked.left=!0):e>0&&(o.blocked.none=!1,o.blocked.right=!0),o.position.x-=e,0===o.bounce.x?o.velocity.x=0:o.velocity.x=-o.velocity.x*o.bounce.x};module.exports=o;
},{}],"oBoz":[function(require,module,exports) {
var e=require("./ProcessTileSeparationX"),t=function(t,i,l,r,o,a){var c=0,h=i.faceLeft,f=i.faceRight,n=i.collideLeft,s=i.collideRight;return a||(h=!0,f=!0,n=!0,s=!0),t.deltaX()<0&&s&&t.checkCollision.left?f&&t.x0&&n&&t.checkCollision.right&&h&&t.right>l&&(c=t.right-l)>o&&(c=0),0!==c&&(t.customSeparateX?t.overlapX=c:e(t,c)),c};module.exports=t;
},{"./ProcessTileSeparationX":"vdLB"}],"VFIE":[function(require,module,exports) {
var o=function(o,e){e<0?(o.blocked.none=!1,o.blocked.up=!0):e>0&&(o.blocked.none=!1,o.blocked.down=!0),o.position.y-=e,0===o.bounce.y?o.velocity.y=0:o.velocity.y=-o.velocity.y*o.bounce.y};module.exports=o;
},{}],"Es5q":[function(require,module,exports) {
var o=require("./ProcessTileSeparationY"),e=function(e,t,l,a,c,r){var i=0,n=t.faceTop,p=t.faceBottom,d=t.collideUp,s=t.collideDown;return r||(n=!0,p=!0,d=!0,s=!0),e.deltaY()<0&&s&&e.checkCollision.up?p&&e.y0&&d&&e.checkCollision.down&&n&&e.bottom>l&&(i=e.bottom-l)>c&&(i=0),0!==i&&(e.customSeparateY?e.overlapY=i:o(e,i)),i};module.exports=e;
},{"./ProcessTileSeparationY":"VFIE"}],"m4LE":[function(require,module,exports) {
var t=function(t,o){return!(o.right<=t.left||o.bottom<=t.top||o.position.x>=t.right||o.position.y>=t.bottom)};module.exports=t;
},{}],"YqIp":[function(require,module,exports) {
var t=require("./TileCheckX"),e=require("./TileCheckY"),a=require("./TileIntersectsBody"),r=function(r,i,o,s,l,f,h){var n=s.left,b=s.top,u=s.right,c=s.bottom,d=o.faceLeft||o.faceRight,m=o.faceTop||o.faceBottom;if(h||(d=!0,m=!0),!d&&!m)return!1;var M=0,p=0,A=0,T=1;if(i.deltaAbsX()>i.deltaAbsY()?A=-1:i.deltaAbsX()0?1:-1),c=Math.sqrt(v*v*o.mass/m.mass)*(v>0?1:-1),x=.5*(s+c);s-=x,c-=x,o.velocity.x=x+s*o.bounce.x,m.velocity.x=x+c*m.bounce.x}return!0};module.exports=o;
},{"./GetOverlapX":"WS1S"}],"xEeA":[function(require,module,exports) {
var e=require("./GetOverlapY"),o=function(o,m,t,a){var r=e(o,m,t,a);if(t||0===r||o.immovable&&m.immovable||o.customSeparateY||m.customSeparateY)return 0!==r||o.embedded&&m.embedded;var v=o.velocity.y,y=m.velocity.y;if(o.immovable||m.immovable)o.immovable?(m.y+=r,m.velocity.y=v-y*m.bounce.y,o.moves&&(m.x+=(o.x-o.prev.x)*o.friction.x)):(o.y-=r,o.velocity.y=y-v*o.bounce.y,m.moves&&(o.x+=(m.x-m.prev.x)*m.friction.x));else{r*=.5,o.y-=r,m.y+=r;var i=Math.sqrt(y*y*m.mass/o.mass)*(y>0?1:-1),s=Math.sqrt(v*v*o.mass/m.mass)*(v>0?1:-1),c=.5*(i+s);i-=c,s-=c,o.velocity.y=c+i*o.bounce.y,m.velocity.y=c+s*m.bounce.y}return!0};module.exports=o;
},{"./GetOverlapY":"JFvb"}],"NZWW":[function(require,module,exports) {
var t=require("../../geom/circle/Contains"),i=require("../../utils/Class"),s=require("./const"),e=require("../../geom/rectangle/Contains"),h=require("../../math/Vector2"),o=new i({initialize:function(t,i){var e=i.width?i.width:64,o=i.height?i.height:64;this.world=t,this.gameObject=i,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new h,this.position=new h(i.x-i.displayOriginX,i.y-i.displayOriginY),this.width=e,this.height=o,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new h(i.x+this.halfWidth,i.y+this.halfHeight),this.velocity=h.ZERO,this.allowGravity=!1,this.gravity=h.ZERO,this.bounce=h.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=s.STATIC_BODY,this._dx=0,this._dy=0},setGameObject:function(t,i){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),i&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setOffset:function(t,i){return void 0===i&&(i=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,i),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,i,s){void 0===s&&(s=!0);var e=this.gameObject;if(!t&&e.frame&&(t=e.frame.realWidth),!i&&e.frame&&(i=e.frame.realHeight),this.world.staticTree.remove(this),this.width=t,this.height=i,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(i/2),s&&e.getCenter){var h=e.displayWidth/2,o=e.displayHeight/2;this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(h-this.halfWidth,o-this.halfHeight),this.position.x+=this.offset.x,this.position.y+=this.offset.y}return this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,i,s){return void 0===i&&(i=this.offset.x),void 0===s&&(s=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(i,s),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,i){var s=this.gameObject;void 0===t&&(t=s.x),void 0===i&&(i=s.y),this.world.staticTree.remove(this),s.setPosition(t,i),s.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(i,s){return this.isCircle?t(this,i,s):e(this,i,s)},postUpdate:function(){},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var i=this.position,s=i.x+this.halfWidth,e=i.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor,1),this.isCircle?t.strokeCircle(s,e,this.width/2):t.strokeRect(i.x,i.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});module.exports=o;
},{"../../geom/circle/Contains":"inZZ","../../utils/Class":"JASv","./const":"FWI5","../../geom/rectangle/Contains":"mjUt","../../math/Vector2":"qKN5"}],"EaXf":[function(require,module,exports) {
var e=require("./Body"),t=require("../../math/Clamp"),i=require("../../utils/Class"),r=require("./Collider"),s=require("./const"),o=require("../../math/distance/DistanceBetween"),l=require("eventemitter3"),a=require("./events"),n=require("../../math/fuzzy/Equal"),h=require("../../math/fuzzy/GreaterThan"),c=require("../../math/fuzzy/LessThan"),d=require("./GetOverlapX"),u=require("./GetOverlapY"),y=require("../../utils/object/GetValue"),p=require("../../structs/ProcessQueue"),m=require("./tilemap/ProcessTileCallbacks"),b=require("../../geom/rectangle/Rectangle"),v=require("../../structs/RTree"),f=require("./tilemap/SeparateTile"),g=require("./SeparateX"),x=require("./SeparateY"),T=require("../../structs/Set"),C=require("./StaticBody"),w=require("./tilemap/TileIntersectsBody"),O=require("../../gameobjects/components/TransformMatrix"),S=require("../../math/Vector2"),B=require("../../math/Wrap"),A=new i({Extends:l,initialize:function(e,t){l.call(this),this.scene=e,this.bodies=new T,this.staticBodies=new T,this.pendingDestroy=new T,this.colliders=new p,this.gravity=new S(y(t,"gravity.x",0),y(t,"gravity.y",0)),this.bounds=new b(y(t,"x",0),y(t,"y",0),y(t,"width",e.sys.scale.width),y(t,"height",e.sys.scale.height)),this.checkCollision={up:y(t,"checkCollision.up",!0),down:y(t,"checkCollision.down",!0),left:y(t,"checkCollision.left",!0),right:y(t,"checkCollision.right",!0)},this.fps=y(t,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=y(t,"timeScale",1),this.OVERLAP_BIAS=y(t,"overlapBias",4),this.TILE_BIAS=y(t,"tileBias",16),this.forceX=y(t,"forceX",!1),this.isPaused=y(t,"isPaused",!1),this._total=0,this.drawDebug=y(t,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:y(t,"debugShowBody",!0),debugShowStaticBody:y(t,"debugShowStaticBody",!0),debugShowVelocity:y(t,"debugShowVelocity",!0),bodyDebugColor:y(t,"debugBodyColor",16711935),staticBodyDebugColor:y(t,"debugStaticBodyColor",255),velocityDebugColor:y(t,"debugVelocityColor",65280)},this.maxEntries=y(t,"maxEntries",16),this.useTree=y(t,"useTree",!0),this.tree=new v(this.maxEntries),this.staticTree=new v(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new O,this._tempMatrix2=new O,this.drawDebug&&this.createDebugGraphic()},enable:function(e,t){void 0===t&&(t=s.DYNAMIC_BODY),Array.isArray(e)||(e=[e]);for(var i=0;i=o;for(i=0;i=o;)this._elapsed-=o,this.step(s)}},step:function(e){var t,i,r=this.bodies.entries,s=r.length;for(t=0;t0){var h=this.tree,c=this.staticTree;for(r=(i=n.entries).length,e=0;e-1&&p>m&&(e.velocity.normalize().scale(m),p=m),e.speed=p},separate:function(e,t,i,r,s){if(!e.enable||!t.enable||e.checkCollision.none||t.checkCollision.none||!this.intersects(e,t))return!1;if(i&&!1===i.call(r,e.gameObject,t.gameObject))return!1;if(e.isCircle&&t.isCircle)return this.separateCircle(e,t,s);if(e.isCircle!==t.isCircle){var o=e.isCircle?t:e,l=e.isCircle?e:t,n={x:o.x,y:o.y,right:o.right,bottom:o.bottom},h=l.center;if((h.yn.bottom)&&(h.xn.right))return this.separateCircle(e,t,s)}var c=!1,d=!1;this.forceX||Math.abs(this.gravity.y+e.gravity.y)l.right&&(s=o(n.x,n.y,l.right,l.y)-n.radius):n.y>l.bottom&&(n.xl.right&&(s=o(n.x,n.y,l.right,l.bottom)-n.radius)),s*=-1}else s=e.halfWidth+t.halfWidth-o(e.center.x,e.center.y,t.center.x,t.center.y);if(i||0===s||e.immovable&&t.immovable||e.customSeparateX||t.customSeparateX)return 0!==s&&(e.onOverlap||t.onOverlap)&&this.emit(a.OVERLAP,e.gameObject,t.gameObject,e,t),0!==s;var h=e.center.x-t.center.x,c=e.center.y-t.center.y,y=Math.sqrt(Math.pow(h,2)+Math.pow(c,2)),p=(t.center.x-e.center.x)/y||0,m=(t.center.y-e.center.y)/y||0,b=2*(e.velocity.x*p+e.velocity.y*m-t.velocity.x*p-t.velocity.y*m)/(e.mass+t.mass);e.immovable||(e.velocity.x=e.velocity.x-b*e.mass*p,e.velocity.y=e.velocity.y-b*e.mass*m),t.immovable||(t.velocity.x=t.velocity.x+b*t.mass*p,t.velocity.y=t.velocity.y+b*t.mass*m);var v=t.velocity.x-e.velocity.x,f=t.velocity.y-e.velocity.y,g=Math.atan2(f,v),x=this._frameTime;return e.immovable||t.immovable||(s/=2),e.immovable||(e.x+=e.velocity.x*x-s*Math.cos(g),e.y+=e.velocity.y*x-s*Math.sin(g)),t.immovable||(t.x+=t.velocity.x*x+s*Math.cos(g),t.y+=t.velocity.y*x+s*Math.sin(g)),e.velocity.x*=e.bounce.x,e.velocity.y*=e.bounce.y,t.velocity.x*=t.bounce.x,t.velocity.y*=t.bounce.y,(e.onCollide||t.onCollide)&&this.emit(a.COLLIDE,e.gameObject,t.gameObject,e,t),!0},intersects:function(e,t){return e!==t&&(e.isCircle||t.isCircle?e.isCircle?t.isCircle?o(e.center.x,e.center.y,t.center.x,t.center.y)<=e.halfWidth+t.halfWidth:this.circleBodyIntersects(e,t):this.circleBodyIntersects(t,e):!(e.right<=t.position.x||e.bottom<=t.position.y||e.position.x>=t.right||e.position.y>=t.bottom))},circleBodyIntersects:function(e,i){var r=t(e.center.x,i.left,i.right),s=t(e.center.y,i.top,i.bottom);return(e.center.x-r)*(e.center.x-r)+(e.center.y-s)*(e.center.y-s)<=e.halfWidth*e.halfWidth},overlap:function(e,t,i,r,s){return void 0===i&&(i=null),void 0===r&&(r=null),void 0===s&&(s=i),this.collideObjects(e,t,i,r,s,!0)},collide:function(e,t,i,r,s){return void 0===i&&(i=null),void 0===r&&(r=null),void 0===s&&(s=i),this.collideObjects(e,t,i,r,s,!1)},collideObjects:function(e,t,i,r,s,o){var l,a;e.isParent&&void 0===e.physicsType&&(e=e.children.entries),t&&t.isParent&&void 0===t.physicsType&&(t=t.children.entries);var n=Array.isArray(e),h=Array.isArray(t);if(this._total=0,n||h)if(!n&&h)for(l=0;l0},collideHandler:function(e,t,i,r,s,o){if(void 0===t&&e.isParent)return this.collideGroupVsGroup(e,e,i,r,s,o);if(!e||!t)return!1;if(e.body){if(t.body)return this.collideSpriteVsSprite(e,t,i,r,s,o);if(t.isParent)return this.collideSpriteVsGroup(e,t,i,r,s,o);if(t.isTilemap)return this.collideSpriteVsTilemapLayer(e,t,i,r,s,o)}else if(e.isParent){if(t.body)return this.collideSpriteVsGroup(t,e,i,r,s,o);if(t.isParent)return this.collideGroupVsGroup(e,t,i,r,s,o);if(t.isTilemap)return this.collideGroupVsTilemapLayer(e,t,i,r,s,o)}else if(e.isTilemap){if(t.body)return this.collideSpriteVsTilemapLayer(t,e,i,r,s,o);if(t.isParent)return this.collideGroupVsTilemapLayer(t,e,i,r,s,o)}},collideSpriteVsSprite:function(e,t,i,r,s,o){return!(!e.body||!t.body)&&(this.separate(e.body,t.body,r,s,o)&&(i&&i.call(s,e,t),this._total++),!0)},collideSpriteVsGroup:function(e,t,i,r,o,l){var a,n,h,c=e.body;if(0!==t.length&&c&&c.enable)if(this.useTree){var d=this.treeMinMax;d.minX=c.left,d.minY=c.top,d.maxX=c.right,d.maxY=c.bottom;var u=t.physicsType===s.DYNAMIC_BODY?this.tree.search(d):this.staticTree.search(d);for(n=u.length,a=0;ad.baseTileWidth){var u=(d.tileWidth-d.baseTileWidth)*t.scaleX;a-=u,h+=u}d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*t.scaleY);var y=t.getTilesWithinWorldXY(a,n,h,c);return 0!==y.length&&this.collideSpriteVsTilesHandler(e,y,i,r,s,o,!0)},collideSpriteVsTilesHandler:function(e,t,i,r,s,o,l){for(var n,h,c=e.body,d={left:0,right:0,top:0,bottom:0},u=!1,y=0;ys&&(o=d,s=h)}}return o},moveTo:function(e,t,i,o,r){void 0===o&&(o=60),void 0===r&&(r=0);var n=Math.atan2(i-e.y,t-e.x);return r>0&&(o=s(e.x,e.y,t,i)/(r/1e3)),e.body.velocity.setToPolar(n,o),n},moveToObject:function(e,t,s,i){return this.moveTo(e,t.x,t.y,s,i)},velocityFromAngle:function(e,s,i){return void 0===s&&(s=60),void 0===i&&(i=new h),i.setToPolar(t(e),s)},velocityFromRotation:function(e,t,s){return void 0===t&&(t=60),void 0===s&&(s=new h),s.setToPolar(e,t)},overlapRect:function(e,t,s,i,o,r){return c(this.world,e,t,s,i,o,r)},overlapCirc:function(e,t,s,i,o){return l(this.world,e,t,s,i,o)},shutdown:function(){if(this.world){var e=this.systems.events;e.off(u.UPDATE,this.world.update,this.world),e.off(u.POST_UPDATE,this.world.postUpdate,this.world),e.off(u.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off(u.START,this.start,this),this.scene=null,this.systems=null}});d.register("ArcadePhysics",v,"arcadePhysics"),module.exports=v;
},{"../../utils/Class":"JASv","../../math/DegToRad":"VYZO","../../math/distance/DistanceBetween":"ovvS","../../math/distance/DistanceSquared":"OAF7","./Factory":"Hlve","../../utils/object/GetFastValue":"cEup","../../utils/object/Merge":"NXFV","./components/OverlapCirc":"oRz8","./components/OverlapRect":"Um7c","../../plugins/PluginCache":"ZrqD","../../scene/events":"zvkO","../../math/Vector2":"qKN5","./World":"EaXf"}],"Waxg":[function(require,module,exports) {
var e=require("./const"),r=require("../../utils/object/Extend"),i={ArcadePhysics:require("./ArcadePhysics"),Body:require("./Body"),Collider:require("./Collider"),Components:require("./components"),Events:require("./events"),Factory:require("./Factory"),Group:require("./PhysicsGroup"),Image:require("./ArcadeImage"),Sprite:require("./ArcadeSprite"),StaticBody:require("./StaticBody"),StaticGroup:require("./StaticPhysicsGroup"),World:require("./World")};i=r(!1,i,e),module.exports=i;
},{"./const":"FWI5","../../utils/object/Extend":"SFmW","./ArcadePhysics":"oHzV","./Body":"gwNI","./Collider":"Upa6","./components":"rtKR","./events":"csuF","./Factory":"Hlve","./PhysicsGroup":"GovP","./ArcadeImage":"xNJw","./ArcadeSprite":"EKCX","./StaticBody":"NZWW","./StaticPhysicsGroup":"xy7Y","./World":"EaXf"}],"gq5x":[function(require,module,exports) {
module.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8};
},{}],"SiLD":[function(require,module,exports) {
var r=require("../../math/Clamp"),e=function(e,t,u,n,a){if(u)return r(t+u*e,-a,a);if(n){var i=n*e;return t-i>0?t-i:t+i<0?t+i:0}return r(t,-a,a)};module.exports=e;
},{"../../math/Clamp":"eCA1"}],"iMVb":[function(require,module,exports) {
module.exports={NONE:0,A:1,B:2,BOTH:3};
},{}],"hCPk":[function(require,module,exports) {
var n=function(n,e){if(n.standing=!1,e.collision.y&&(n.bounciness>0&&Math.abs(n.vel.y)>n.minBounceVelocity?n.vel.y*=-n.bounciness:(n.vel.y>0&&(n.standing=!0),n.vel.y=0)),e.collision.x&&(n.bounciness>0&&Math.abs(n.vel.x)>n.minBounceVelocity?n.vel.x*=-n.bounciness:n.vel.x=0),e.collision.slope){var l=e.collision.slope;if(n.bounciness>0){var s=n.vel.x*l.nx+n.vel.y*l.ny;n.vel.x=(n.vel.x-l.nx*s*2)*n.bounciness,n.vel.y=(n.vel.y-l.ny*s*2)*n.bounciness}else{var o=l.x*l.x+l.y*l.y,i=(n.vel.x*l.x+n.vel.y*l.y)/o;n.vel.x=l.x*i,n.vel.y=l.y*i;var v=Math.atan2(l.x,l.y);v>n.slopeStanding.min&&v=i.pos.x+i.size.x||this.pos.x+this.size.x<=i.pos.x||this.pos.y>=i.pos.y+i.size.y||this.pos.y+this.size.y<=i.pos.y)},resetSize:function(i,t,s,e){return this.pos.x=i,this.pos.y=t,this.size.x=s,this.size.y=e,this},toJSON:function(){return{name:this.name,size:{x:this.size.x,y:this.size.y},pos:{x:this.pos.x,y:this.pos.y},vel:{x:this.vel.x,y:this.vel.y},accel:{x:this.accel.x,y:this.accel.y},friction:{x:this.friction.x,y:this.friction.y},maxVel:{x:this.maxVel.x,y:this.maxVel.y},gravityFactor:this.gravityFactor,bounciness:this.bounciness,minBounceVelocity:this.minBounceVelocity,type:this.type,checkAgainst:this.checkAgainst,collides:this.collides}},fromJSON:function(){},check:function(){},collideWith:function(i,t){this.parent&&this.parent._collideCallback&&this.parent._collideCallback.call(this.parent._callbackScope,this,i,t)},handleMovementTrace:function(){return!0},destroy:function(){this.world.remove(this),this.enabled=!1,this.world=null,this.gameObject=null,this.parent=null}});module.exports=l;
},{"../../utils/Class":"JASv","./COLLIDES":"gq5x","./GetVelocity":"SiLD","./TYPE":"iMVb","./UpdateMotion":"hCPk"}],"Jk1d":[function(require,module,exports) {
module.exports={COLLIDE:require("./COLLIDE_EVENT"),PAUSE:require("./PAUSE_EVENT"),RESUME:require("./RESUME_EVENT")};
},{"./COLLIDE_EVENT":"TRUm","./PAUSE_EVENT":"XFXR","./RESUME_EVENT":"swsX"}],"hGUM":[function(require,module,exports) {
var e=.5,o=1/3,r=2/3;module.exports={2:[0,1,1,0,!0],3:[0,1,1,e,!0],4:[0,e,1,0,!0],5:[0,1,1,r,!0],6:[0,r,1,o,!0],7:[0,o,1,0,!0],8:[e,1,0,0,!0],9:[1,0,e,1,!0],10:[e,1,1,0,!0],11:[0,0,e,1,!0],12:[0,0,1,0,!1],13:[1,1,0,0,!0],14:[1,e,0,0,!0],15:[1,1,0,e,!0],16:[1,o,0,0,!0],17:[1,r,0,o,!0],18:[1,1,0,r,!0],19:[1,1,e,0,!0],20:[e,0,0,1,!0],21:[0,1,e,0,!0],22:[e,0,1,1,!0],23:[1,1,0,1,!1],24:[0,0,1,1,!0],25:[0,0,1,e,!0],26:[0,e,1,1,!0],27:[0,0,1,o,!0],28:[0,o,1,r,!0],29:[0,r,1,1,!0],30:[o,1,0,0,!0],31:[1,0,r,1,!0],32:[r,1,1,0,!0],33:[0,0,o,1,!0],34:[1,0,1,1,!1],35:[1,0,0,1,!0],36:[1,e,0,1,!0],37:[1,0,0,e,!0],38:[1,r,0,1,!0],39:[1,o,0,r,!0],40:[1,0,0,o,!0],41:[r,1,o,0,!0],42:[r,0,o,1,!0],43:[o,1,r,0,!0],44:[o,0,r,1,!0],45:[0,1,0,0,!1],52:[1,1,r,0,!0],53:[o,0,0,1,!0],54:[0,1,o,0,!0],55:[r,0,1,1,!0]};
},{}],"c6pU":[function(require,module,exports) {
var i=require("../../utils/Class"),t=require("./DefaultDefs"),s=new i({initialize:function(i,s){void 0===i&&(i=32),this.tilesize=i,this.data=Array.isArray(s)?s:[],this.width=Array.isArray(s)?s[0].length:0,this.height=Array.isArray(s)?s.length:0,this.lastSlope=55,this.tiledef=t},trace:function(i,t,s,e,a,o){var l={collision:{x:!1,y:!1,slope:!1},pos:{x:i+s,y:t+e},tile:{x:0,y:0}};if(!this.data)return l;var h=Math.ceil(Math.max(Math.abs(s),Math.abs(e))/this.tilesize);if(h>1)for(var r=s/h,f=e/h,n=0;n0?o:0,v=e<0?x:0,d=Math.max(Math.floor(s/x),0),k=Math.min(Math.ceil((s+l)/x),M);n=Math.floor((i.pos.x+u)/x);var D=Math.floor((t+u)/x);if((f>0||n===D||D<0||D>=y)&&(D=-1),n>=0&&n1&&c<=this.lastSlope&&this.checkDef(i,c,t,s,h,r,o,l,D,p));p++)if(1===(c=this.data[p][n])||c>this.lastSlope||c>1&&this.checkDef(i,c,t,s,h,r,o,l,n,p)){if(c>1&&c<=this.lastSlope&&i.collision.slope)break;i.collision.x=!0,i.tile.x=c,i.pos.x=n*x-u+v,t=i.pos.x,h=0;break}}if(a){var S=a>0?l:0,b=a<0?x:0,m=Math.max(Math.floor(i.pos.x/x),0),A=Math.min(Math.ceil((i.pos.x+o)/x),y);p=Math.floor((i.pos.y+S)/x);var z=Math.floor((s+S)/x);if((f>0||p===z||z<0||z>=M)&&(z=-1),p>=0&&p1&&c<=this.lastSlope&&this.checkDef(i,c,t,s,h,r,o,l,n,z));n++)if(1===(c=this.data[p][n])||c>this.lastSlope||c>1&&this.checkDef(i,c,t,s,h,r,o,l,n,p)){if(c>1&&c<=this.lastSlope&&i.collision.slope)break;i.collision.y=!0,i.tile.y=c,i.pos.y=p*x-S+b;break}}},checkDef:function(i,t,s,e,a,o,l,h,r,f){var n=this.tiledef[t];if(!n)return!1;var p=this.tilesize,c=(r+n[0])*p,x=(f+n[1])*p,y=(n[2]-n[0])*p,M=(n[3]-n[1])*p,u=n[4],v=s+a+(M<0?l:0)-c,d=e+o+(y>0?h:0)-x;if(y*d-M*v>0){if(a*-M+o*y<0)return u;var k=Math.sqrt(y*y+M*M),D=M/k,S=-y/k,b=v*D+d*S,m=D*b,A=S*b;return m*m+A*A>=a*a+o*o?u||y*(d-o)-M*(v-a)<.5:(i.pos.x=s+a-m,i.pos.y=e+o-A,i.collision.slope={x:y,y:M,nx:D,ny:S},!0)}return!1}});module.exports=s;
},{"../../utils/Class":"JASv","./DefaultDefs":"hGUM"}],"ztPj":[function(require,module,exports) {
var t={setAccelerationX:function(t){return this.accel.x=t,this},setAccelerationY:function(t){return this.accel.y=t,this},setAcceleration:function(t,e){return this.accel.x=t,this.accel.y=e,this}};module.exports=t;
},{}],"UMHP":[function(require,module,exports) {
var e={setBodySize:function(e,t){return void 0===t&&(t=e),this.body.size.x=Math.round(e),this.body.size.y=Math.round(t),this},setBodyScale:function(e,t){void 0===t&&(t=e);var i=this.body.gameObject;return i?(i.setScale(e,t),this.setBodySize(i.width*i.scaleX,i.height*i.scaleY)):this.setBodySize(this.body.size.x*e,this.body.size.y*t)}};module.exports=e;
},{}],"knkl":[function(require,module,exports) {
var t=require("../TYPE"),e={getBodyType:function(){return this.body.type},setTypeNone:function(){return this.body.type=t.NONE,this},setTypeA:function(){return this.body.type=t.A,this},setTypeB:function(){return this.body.type=t.B,this}};module.exports=e;
},{"../TYPE":"iMVb"}],"SsyU":[function(require,module,exports) {
var n={setBounce:function(n){return this.body.bounciness=n,this},setMinBounceVelocity:function(n){return this.body.minBounceVelocity=n,this},bounce:{get:function(){return this.body.bounciness},set:function(n){this.body.bounciness=n}}};module.exports=n;
},{}],"pWqi":[function(require,module,exports) {
var t=require("../TYPE"),s={setAvsB:function(){return this.setTypeA(),this.setCheckAgainstB()},setBvsA:function(){return this.setTypeB(),this.setCheckAgainstA()},setCheckAgainstNone:function(){return this.body.checkAgainst=t.NONE,this},setCheckAgainstA:function(){return this.body.checkAgainst=t.A,this},setCheckAgainstB:function(){return this.body.checkAgainst=t.B,this},checkAgainst:{get:function(){return this.body.checkAgainst},set:function(t){this.body.checkAgainst=t}}};module.exports=s;
},{"../TYPE":"iMVb"}],"HZTQ":[function(require,module,exports) {
var i=require("../COLLIDES"),l={_collideCallback:null,_callbackScope:null,setCollideCallback:function(i,l){return this._collideCallback=i,l&&(this._callbackScope=l),this},setCollidesNever:function(){return this.body.collides=i.NEVER,this},setLiteCollision:function(){return this.body.collides=i.LITE,this},setPassiveCollision:function(){return this.body.collides=i.PASSIVE,this},setActiveCollision:function(){return this.body.collides=i.ACTIVE,this},setFixedCollision:function(){return this.body.collides=i.FIXED,this},collides:{get:function(){return this.body.collides},set:function(i){this.body.collides=i}}};module.exports=l;
},{"../COLLIDES":"gq5x"}],"sOA4":[function(require,module,exports) {
var i={setFrictionX:function(i){return this.friction.x=i,this},setFrictionY:function(i){return this.friction.y=i,this},setFriction:function(i,t){return this.friction.x=i,this.friction.y=t,this}};module.exports=i;
},{}],"B15I":[function(require,module,exports) {
var t={setGravity:function(t){return this.body.gravityFactor=t,this},gravity:{get:function(){return this.body.gravityFactor},set:function(t){this.body.gravityFactor=t}}};module.exports=t;
},{}],"AOT4":[function(require,module,exports) {
var t={setOffset:function(t,s,e,o){return this.body.offset.x=t,this.body.offset.y=s,e&&this.setBodySize(e,o),this}};module.exports=t;
},{}],"Iav7":[function(require,module,exports) {
var e={setGameObject:function(e,t){return void 0===t&&(t=!0),e?(this.body.gameObject=e,t&&this.syncGameObject()):this.body.gameObject=null,this},syncGameObject:function(){var e=this.body.gameObject;return e&&this.setBodySize(e.width*e.scaleX,e.height*e.scaleY),this}};module.exports=e;
},{}],"jjUg":[function(require,module,exports) {
var t={setVelocityX:function(t){return this.vel.x=t,this},setVelocityY:function(t){return this.vel.y=t,this},setVelocity:function(t,e){return void 0===e&&(e=t),this.vel.x=t,this.vel.y=e,this},setMaxVelocity:function(t,e){return void 0===e&&(e=t),this.maxVel.x=t,this.maxVel.y=e,this}};module.exports=t;
},{}],"oDzl":[function(require,module,exports) {
module.exports={Acceleration:require("./Acceleration"),BodyScale:require("./BodyScale"),BodyType:require("./BodyType"),Bounce:require("./Bounce"),CheckAgainst:require("./CheckAgainst"),Collides:require("./Collides"),Debug:require("./Debug"),Friction:require("./Friction"),Gravity:require("./Gravity"),Offset:require("./Offset"),SetGameObject:require("./SetGameObject"),Velocity:require("./Velocity")};
},{"./Acceleration":"ztPj","./BodyScale":"UMHP","./BodyType":"knkl","./Bounce":"SsyU","./CheckAgainst":"pWqi","./Collides":"HZTQ","./Debug":"WF5N","./Friction":"sOA4","./Gravity":"B15I","./Offset":"AOT4","./SetGameObject":"Iav7","./Velocity":"jjUg"}],"YXLM":[function(require,module,exports) {
var i=require("../../utils/Class"),e=require("./components"),t=new i({Mixins:[e.Acceleration,e.BodyScale,e.BodyType,e.Bounce,e.CheckAgainst,e.Collides,e.Debug,e.Friction,e.Gravity,e.Offset,e.SetGameObject,e.Velocity],initialize:function(i,e,t,s,o){this.body=i.create(e,t,s,o),this.body.parent=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});module.exports=t;
},{"../../utils/Class":"JASv","./components":"oDzl"}],"OHB8":[function(require,module,exports) {
var e=require("../../utils/Class"),i=require("./components"),t=require("../../gameobjects/image/Image"),s=new e({Extends:t,Mixins:[i.Acceleration,i.BodyScale,i.BodyType,i.Bounce,i.CheckAgainst,i.Collides,i.Debug,i.Friction,i.Gravity,i.Offset,i.SetGameObject,i.Velocity],initialize:function(e,i,s,h,o){t.call(this,e.scene,i,s,h,o),this.body=e.create(i-this.frame.centerX,s-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});module.exports=s;
},{"../../utils/Class":"JASv","./components":"oDzl","../../gameobjects/image/Image":"DnOy"}],"hwW6":[function(require,module,exports) {
var e=require("../../utils/Class"),i=require("./components"),t=require("../../gameobjects/sprite/Sprite"),s=new e({Extends:t,Mixins:[i.Acceleration,i.BodyScale,i.BodyType,i.Bounce,i.CheckAgainst,i.Collides,i.Debug,i.Friction,i.Gravity,i.Offset,i.SetGameObject,i.Velocity],initialize:function(e,i,s,h,o){t.call(this,e.scene,i,s,h,o),this.body=e.create(i-this.frame.centerX,s-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});module.exports=s;
},{"../../utils/Class":"JASv","./components":"oDzl","../../gameobjects/sprite/Sprite":"ZUCM"}],"LDHt":[function(require,module,exports) {
var t=require("../../utils/Class"),e=require("./ImpactBody"),i=require("./ImpactImage"),r=require("./ImpactSprite"),s=new t({initialize:function(t){this.world=t,this.sys=t.scene.sys},body:function(t,i,r,s){return new e(this.world,t,i,r,s)},existing:function(t){var e=t.x-t.frame.centerX,i=t.y-t.frame.centerY,r=t.width,s=t.height;return t.body=this.world.create(e,i,r,s),t.body.parent=t,t.body.gameObject=t,t},image:function(t,e,r,s){var n=new i(this.world,t,e,r,s);return this.sys.displayList.add(n),n},sprite:function(t,e,i,s){var n=new r(this.world,t,e,i,s);return this.sys.displayList.add(n),this.sys.updateList.add(n),n},destroy:function(){this.world=null,this.sys=null}});module.exports=s;
},{"../../utils/Class":"JASv","./ImpactBody":"YXLM","./ImpactImage":"OHB8","./ImpactSprite":"hwW6"}],"TO6M":[function(require,module,exports) {
var s=function(s,o,e,x){var p=o.pos.x+o.size.x-e.pos.x;if(x){var i=o===x?e:o;x.vel.x=-x.vel.x*x.bounciness+i.vel.x;var l=s.collisionMap.trace(x.pos.x,x.pos.y,x===o?-p:p,0,x.size.x,x.size.y);x.pos.x=l.pos.x}else{var a=(o.vel.x-e.vel.x)/2;o.vel.x=-a,e.vel.x=a;var v=s.collisionMap.trace(o.pos.x,o.pos.y,-p/2,0,o.size.x,o.size.y);o.pos.x=Math.floor(v.pos.x);var r=s.collisionMap.trace(e.pos.x,e.pos.y,p/2,0,e.size.x,e.size.y);e.pos.x=Math.ceil(r.pos.x)}};module.exports=s;
},{}],"hed1":[function(require,module,exports) {
var s=function(s,e,o,y){var i,l,p=e.pos.y+e.size.y-o.pos.y;if(y){var a=e===y?o:e;y.vel.y=-y.vel.y*y.bounciness+a.vel.y,i=0,y===e&&Math.abs(y.vel.y-a.vel.y)0))l=s.collisionMap.trace(e.pos.x,e.pos.y,0,-(e.pos.y+e.size.y-o.pos.y),e.size.x,e.size.y),e.pos.y=l.pos.y,e.bounciness>0&&e.vel.y>e.minBounceVelocity?e.vel.y*=-e.bounciness:(e.standing=!0,e.vel.y=0);else{var v=(e.vel.y-o.vel.y)/2;e.vel.y=-v,o.vel.y=v,i=o.vel.x*s.delta,l=s.collisionMap.trace(e.pos.x,e.pos.y,i,-p/2,e.size.x,e.size.y),e.pos.y=l.pos.y;var c=s.collisionMap.trace(o.pos.x,o.pos.y,0,p/2,o.size.x,o.size.y);o.pos.y=c.pos.y}};module.exports=s;
},{}],"qtfM":[function(require,module,exports) {
var l=require("./COLLIDES"),e=require("./events"),i=require("./SeparateX"),t=require("./SeparateY"),s=function(s,a,r){var x=null;a.collides===l.LITE||r.collides===l.FIXED?x=a:r.collides!==l.LITE&&a.collides!==l.FIXED||(x=r),a.last.x+a.size.x>r.last.x&&a.last.xr.last.y&&a.last.yi.ACTIVE&&h(this,e,t))},setCollidesNever:function(e){for(var t=0;t0;t--){var r=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[r],e[r]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(n){return"undefined"!=typeof HTMLElement?n instanceof HTMLElement:!!(n&&n.nodeType&&n.nodeName)},n.isArray=function(n){return"[object Array]"===Object.prototype.toString.call(n)},n.isFunction=function(n){return"function"==typeof n},n.isPlainObject=function(n){return"object"==typeof n&&n.constructor===Object},n.isString=function(n){return"[object String]"===toString.call(n)},n.clamp=function(n,e,t){return nt?t:n},n.sign=function(n){return n<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-n._nowStartTime},n.random=function(n,t){return t=void 0!==t?t:1,(n=void 0!==n?n:0)+e()*(t-n)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(n){return 3==(n=n.replace("#","")).length&&(n=n.charAt(0)+n.charAt(0)+n.charAt(1)+n.charAt(1)+n.charAt(2)+n.charAt(2)),parseInt(n,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.nextId=function(){return n._nextId++},n.indexOf=function(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0;t0)return!1}return!0},r.scale=function(n,e,o,a){if(1===e&&1===o)return n;var l,u;a=a||r.centre(n);for(var f=0;f=0?f-1:r.length-1],c=r[f],s=r[(f+1)%r.length],i=e[f0&&(a|=2),3===a)return!1;return 0!==a||null},r.hull=function(r){var n,e,o=[],a=[];for((r=r.slice(0)).sort(function(r,t){var n=r.x-t.x;return 0!==n?n:r.y-t.y}),e=0;e=2&&t.cross3(a[a.length-2],a[a.length-1],n)<=0;)a.pop();a.push(n)}for(e=r.length-1;e>=0;e-=1){for(n=r[e];o.length>=2&&t.cross3(o[o.length-2],o[o.length-1],n)<=0;)o.pop();o.push(n)}return o.pop(),a.pop(),o.concat(a)};
},{"../geometry/Vector":"SoZW","../core/Common":"lVTS"}],"spdM":[function(require,module,exports) {
var e={};module.exports=e;var n=require("./Common");e.on=function(e,n,t){for(var r,s=n.split(" "),o=0;o0){r||(r={}),s=t.split(" ");for(var l=0;l0&&t.motion=t.sleepThreshold&&e.set(t,!0)):t.sleepCounter>0&&(t.sleepCounter-=1)}else e.set(t,!1)}},e.afterCollisions=function(i,o){for(var s=o*o*o,n=0;ne._motionWakeThreshold*s&&e.set(a,!1)}}}},e.set=function(e,o){var s=e.isSleeping;o?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,s||i.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,s&&i.trigger(e,"sleepEnd"))};
},{"./Events":"spdM"}],"DuOH":[function(require,module,exports) {
var x={};module.exports=x,x.create=function(m){var n={min:{x:0,y:0},max:{x:0,y:0}};return m&&x.update(n,m),n},x.update=function(x,m,n){x.min.x=1/0,x.max.x=-1/0,x.min.y=1/0,x.max.y=-1/0;for(var y=0;yx.max.x&&(x.max.x=a.x),a.xx.max.y&&(x.max.y=a.y),a.y0?x.max.x+=n.x:x.min.x+=n.x,n.y>0?x.max.y+=n.y:x.min.y+=n.y)},x.contains=function(x,m){return m.x>=x.min.x&&m.x<=x.max.x&&m.y>=x.min.y&&m.y<=x.max.y},x.overlaps=function(x,m){return x.min.x<=m.max.x&&x.max.x>=m.min.x&&x.max.y>=m.min.y&&x.min.y<=m.max.y},x.translate=function(x,m){x.min.x+=m.x,x.max.x+=m.x,x.min.y+=m.y,x.max.y+=m.y},x.shift=function(x,m){var n=x.max.x-x.min.x,y=x.max.y-x.min.y;x.min.x=m.x,x.max.x=m.x+n,x.min.y=m.y,x.max.y=m.y+y};
},{}],"AlFY":[function(require,module,exports) {
var r={};module.exports=r;var e=require("../geometry/Vector"),o=require("../core/Common");r.fromVertices=function(r){for(var t={},n=0;n0&&t.rotateAbout(l.position,s,e.position,l.position)}},e.setVelocity=function(e,i){e.positionPrev.x=e.position.x-i.x,e.positionPrev.y=e.position.y-i.y,e.velocity.x=i.x,e.velocity.y=i.y,e.speed=t.magnitude(e.velocity)},e.setAngularVelocity=function(e,i){e.anglePrev=e.angle-i,e.angularVelocity=i,e.angularSpeed=Math.abs(e.angularVelocity)},e.translate=function(i,n){e.setPosition(i,t.add(i.position,n))},e.rotate=function(i,t,n){if(n){var s=Math.cos(t),r=Math.sin(t),a=i.position.x-n.x,o=i.position.y-n.y;e.setPosition(i,{x:n.x+(a*s-o*r),y:n.y+(a*r+o*s)}),e.setAngle(i,i.angle+t)}else e.setAngle(i,i.angle+t)},e.scale=function(t,n,s,o){var l=0,c=0;o=o||t.position;for(var p=0;p0&&(l+=y.area,c+=y.inertia),y.position.x=o.x+(y.position.x-o.x)*n,y.position.y=o.y+(y.position.y-o.y)*s,r.update(y.bounds,y.vertices,t.velocity)}t.parts.length>1&&(t.area=l,t.isStatic||(e.setMass(t,t.density*l),e.setInertia(t,c))),t.circleRadius&&(n===s?t.circleRadius*=n:t.circleRadius=null)},e.update=function(e,n,s,o){var l=Math.pow(n*s*e.timeScale,2),c=1-e.frictionAir*s*e.timeScale,p=e.position.x-e.positionPrev.x,y=e.position.y-e.positionPrev.y;e.velocity.x=p*c*o+e.force.x/e.mass*l,e.velocity.y=y*c*o+e.force.y/e.mass*l,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.angularVelocity=(e.angle-e.anglePrev)*c*o+e.torque/e.inertia*l,e.anglePrev=e.angle,e.angle+=e.angularVelocity,e.speed=t.magnitude(e.velocity),e.angularSpeed=Math.abs(e.angularVelocity);for(var v=0;v0&&(u.position.x+=e.velocity.x,u.position.y+=e.velocity.y),0!==e.angularVelocity&&(i.rotate(u.vertices,e.angularVelocity,e.position),a.rotate(u.axes,e.angularVelocity),v>0&&t.rotateAbout(u.position,e.angularVelocity,e.position,u.position)),r.update(u.bounds,u.vertices,e.velocity)}},e.applyForce=function(e,i,t){e.force.x+=t.x,e.force.y+=t.y;var n=i.x-e.position.x,s=i.y-e.position.y;e.torque+=n*t.y-s*t.x},e._totalProperties=function(e){for(var i={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n=0&&h<=1&&l>=0&&l<=1}function t(r,n,t){return(n[0]-r[0])*(t[1]-r[1])-(t[0]-r[0])*(n[1]-r[1])}function e(r,n,e){return t(r,n,e)>0}function u(r,n,e){return t(r,n,e)>=0}function f(r,n,e){return t(r,n,e)<0}function o(r,n,e){return t(r,n,e)<=0}module.exports={decomp:x,quickDecomp:E,isSimple:C,removeCollinearPoints:L,removeDuplicatePoints:N,makeCCW:s};var i=[],h=[];function l(r,n,e,u){if(u){var f=i,o=h;f[0]=n[0]-r[0],f[1]=n[1]-r[1],o[0]=e[0]-n[0],o[1]=e[1]-n[1];var l=f[0]*o[0]+f[1]*o[1],a=Math.sqrt(f[0]*f[0]+f[1]*f[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(l/(a*c))t[n][0])&&(n=u);return!e(c(r,n-1),c(r,n),c(r,n+1))&&(p(r),!0)}function p(r){for(var n=[],t=r.length,e=0;e!==t;e++)n.push(r.pop());for(e=0;e!==t;e++)r[e]=n[e]}function m(r,n){return f(c(r,n-1),c(r,n),c(r,n+1))}var A=[],M=[];function d(n,t,e){var f,i,h=A,l=M;if(u(c(n,t+1),c(n,t),c(n,e))&&o(c(n,t-1),c(n,t),c(n,e)))return!1;i=a(c(n,t),c(n,e));for(var g=0;g!==n.length;++g)if((g+1)%n.length!==t&&g!==t&&u(c(n,t),c(n,e),c(n,g+1))&&o(c(n,t),c(n,e),c(n,g))&&(h[0]=c(n,t),h[1]=c(n,e),l[0]=c(n,g),l[1]=c(n,g+1),f=r(h,l),a(c(n,t),f)0?y(r,n):[r]}function y(r,n){if(0===n.length)return[r];if(n instanceof Array&&n.length&&n[0]instanceof Array&&2===n[0].length&&n[0][0]instanceof Array){for(var t=[r],e=0;el)return console.warn("quickDecomp: max level ("+l+") reached."),n;for(var X=0;Xx&&(x+=r.length),q=Number.MAX_VALUE,x3&&e>=0;--e)l(c(r,e-1),c(r,e),c(r,e+1),n)&&(r.splice(e%r.length,1),t++);return t}function N(r,n){for(var t=r.length-1;t>=1;--t)for(var e=r[t],u=t-1;u>=0;--u)V(e,r[u],n)&&r.splice(t,1)}function U(r,n,t){return t=t||0,Math.abs(r-n)<=t}function V(r,n,t){return U(r[0],n[0],t)&&U(r[1],n[1],t)}
},{}],"bOCr":[function(require,module,exports) {
var e={};module.exports=e;var r=require("../geometry/Vertices"),t=require("../core/Common"),i=require("../body/Body"),a=require("../geometry/Bounds"),o=require("../geometry/Vector"),n=require("../../poly-decomp");e.rectangle=function(e,a,o,n,c){c=c||{};var l={label:"Rectangle Body",position:{x:e,y:a},vertices:r.fromPath("L 0 0 L "+o+" 0 L "+o+" "+n+" L 0 "+n)};if(c.chamfer){var s=c.chamfer;l.vertices=r.chamfer(l.vertices,s.radius,s.quality,s.qualityMin,s.qualityMax),delete c.chamfer}return i.create(t.extend({},l,c))},e.trapezoid=function(e,a,o,n,c,l){l=l||{};var s,u=o*(c*=.5),v=u+(1-2*c)*o,d=v+u;s=c<.5?"L 0 0 L "+u+" "+-n+" L "+v+" "+-n+" L "+d+" 0":"L 0 0 L "+v+" "+-n+" L "+d+" 0";var f={label:"Trapezoid Body",position:{x:e,y:a},vertices:r.fromPath(s)};if(l.chamfer){var h=l.chamfer;f.vertices=r.chamfer(f.vertices,h.radius,h.quality,h.qualityMin,h.qualityMax),delete l.chamfer}return i.create(t.extend({},f,l))},e.circle=function(r,i,a,o,n){o=o||{};var c={label:"Circle Body",circleRadius:a};n=n||25;var l=Math.ceil(Math.max(10,Math.min(n,a)));return l%2==1&&(l+=1),e.polygon(r,i,l,a,t.extend({},c,o))},e.polygon=function(a,o,n,c,l){if(l=l||{},n<3)return e.circle(a,o,c,l);for(var s=2*Math.PI/n,u="",v=.5*s,d=0;d0&&r.area(q)1?(d=i.create(t.extend({parts:f.slice(0)},l)),i.setPosition(d,{x:a,y:o}),d):f[0]},e.flagCoincidentParts=function(e,r){void 0===r&&(r=5);for(var t=0;t0?1:.7),i.damping=i.damping||0,i.angularStiffness=i.angularStiffness||0,i.angleA=i.bodyA?i.bodyA.angle:i.angleA,i.angleB=i.bodyB?i.bodyB.angle:i.angleB,i.plugin={};var r={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return 0===i.length&&i.stiffness>.1?(r.type="pin",r.anchors=!1):i.stiffness<.9&&(r.type="spring"),i.render=a.extend(r,i.render),i},n.preSolveAll=function(n){for(var i=0;i0&&(g.position.x+=p.x,g.position.y+=p.y),0!==p.angle&&(i.rotate(g.vertices,p.angle,l.position),s.rotate(g.axes,p.angle),y>0&&e.rotateAbout(g.position,p.angle,l.position,g.position)),t.update(g.bounds,g.vertices,l.velocity)}p.angle*=n._warming,p.x*=n._warming,p.y*=n._warming}}},n.pointAWorld=function(n){return{x:(n.bodyA?n.bodyA.position.x:0)+n.pointA.x,y:(n.bodyA?n.bodyA.position.y:0)+n.pointA.y}},n.pointBWorld=function(n){return{x:(n.bodyB?n.bodyB.position.x:0)+n.pointB.x,y:(n.bodyB?n.bodyB.position.y:0)+n.pointB.y}};
},{"../geometry/Vertices":"JhJa","../geometry/Vector":"SoZW","../core/Sleeping":"zP33","../geometry/Bounds":"DuOH","../geometry/Axes":"AlFY","../core/Common":"lVTS"}],"fXQ4":[function(require,module,exports) {
var n={};module.exports=n;var e=require("../body/Composite"),r=require("../constraint/Constraint"),o=require("../core/Common"),t=require("../body/Body"),a=require("./Bodies");n.stack=function(n,r,o,a,d,i,s){for(var c,u=e.create({label:"Stack"}),y=n,b=r,l=0,x=0;xf&&(f=C),t.translate(B,{x:.5*p,y:.5*C}),y=B.bounds.max.x+d,e.addBody(u,B),c=B,l+=1}else y+=d}b+=f+i,y=n}return u},n.chain=function(n,t,a,d,i,s){for(var c=n.bodies,u=1;u0)for(c=0;c0&&(b=l[c-1+(s-1)*t],e.addConstraint(n,r.create(o.extend({bodyA:b,bodyB:y},i)))),d&&cb||i<(c=b-c)||i>o-1-c))return 1===y&&t.translate(u,{x:(i+(o%2==1?1:-1))*l,y:0}),s(e+(u?i*l:0)+i*d,r,i,c,u,y)})},n.newtonsCradle=function(n,o,t,d,i){for(var s=e.create({label:"Newtons Cradle"}),c=0;c1;if(!p||e!=p.x||t!=p.y){p&&r?(b=p.x,l=p.y):(b=0,l=0);var c={x:b+e,y:l+t};!r&&p||(p=c),u.push(c),y=b+e,f=l+t}},v=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":y=e.x,f=e.y;break;case"H":y=e.x;break;case"V":f=e.y}A(y,f,e.pathSegType)}};for(e._svgPathToAbsolute(t),o=t.getTotalLength(),g=[],c=0;c0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}},setFromTileRectangle:function(e){void 0===e&&(e={}),r(e,"isStatic")||(e.isStatic=!0),r(e,"addToWorld")||(e.addToWorld=!0);var i=this.tile.getBounds(),o=i.x+i.width/2,s=i.y+i.height/2,l=t.rectangle(o,s,i.width,i.height,e);return this.setBody(l,e.addToWorld),this},setFromTileCollision:function(i){void 0===i&&(i={}),r(i,"isStatic")||(i.isStatic=!0),r(i,"addToWorld")||(i.addToWorld=!0);for(var o=this.tile.tilemapLayer.scaleX,d=this.tile.tilemapLayer.scaleY,a=this.tile.getLeft(),h=this.tile.getTop(),n=this.tile.getCollisionGroup(),y=s(n,"objects",[]),c=[],u=0;u1&&(i.parts=c,this.setBody(e.create(i),i.addToWorld)),this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0}});module.exports=d;
},{"./lib/factory/Bodies":"bOCr","./lib/body/Body":"ZQ7a","../../utils/Class":"JASv","./components":"kAkt","../../utils/object/GetFastValue":"cEup","../../utils/object/HasValue":"hJUo","./lib/geometry/Vertices":"JhJa"}],"CbDk":[function(require,module,exports) {
var e={};module.exports=e;var r=require("../geometry/Vertices"),o=require("../geometry/Vector");e.collides=function(t,i,a){var n,s,p,d,l=!1;if(a){var x=t.parent,v=i.parent,u=x.speed*x.speed+x.angularSpeed*x.angularSpeed+v.speed*v.speed+v.angularSpeed*v.angularSpeed;l=a&&a.collided&&u<.2,d=a}else d={collided:!1,bodyA:t,bodyB:i};if(a&&l){var c=d.axisBody,y=c===t?i:t,m=[c.axes[a.axisNumber]];if(p=e._overlapAxes(c.vertices,y.vertices,m),d.reused=!0,p.overlap<=0)return d.collided=!1,d}else{if((n=e._overlapAxes(t.vertices,i.vertices,t.axes)).overlap<=0)return d.collided=!1,d;if((s=e._overlapAxes(i.vertices,t.vertices,i.axes)).overlap<=0)return d.collided=!1,d;n.overlapa?a=s:s=0?n.index-1:l.length-1],d.x=a.x-x.x,d.y=a.y-x.y,p=-o.dot(t,d),s=a,a=l[(n.index+1)%l.length],d.x=a.x-x.x,d.y=a.y-x.y,(i=-o.dot(t,d))1?1:0;d
1?1:0;v0:0!=(r.mask&e.category)&&0!=(e.mask&r.category)};
},{"./SAT":"CbDk","./Pair":"cKvI","../geometry/Bounds":"DuOH"}],"OTzz":[function(require,module,exports) {
var t=require("./lib/geometry/Bounds"),i=require("../../utils/Class"),s=require("./lib/body/Composite"),n=require("./lib/constraint/Constraint"),o=require("./lib/collision/Detector"),e=require("./events"),r=require("../../input/events"),l=require("../../utils/object/Merge"),h=require("./lib/core/Sleeping"),a=require("../../math/Vector2"),u=require("./lib/geometry/Vertices"),p=new i({initialize:function(t,i,s){void 0===s&&(s={});this.scene=t,this.world=i,this.camera=null,this.pointer=null,this.active=!0,this.position=new a,this.body=null,this.part=null,this.constraint=n.create(l(s,{label:"Pointer Constraint",pointA:{x:0,y:0},pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,collisionFilter:{category:1,mask:4294967295,group:0}})),this.world.on(e.BEFORE_UPDATE,this.update,this),t.sys.input.on(r.POINTER_DOWN,this.onDown,this),t.sys.input.on(r.POINTER_UP,this.onUp,this)},onDown:function(t){this.pointer||(this.pointer=t,this.camera=t.camera)},onUp:function(t){t===this.pointer&&(this.pointer=null)},getBody:function(i){var n=this.position,r=this.constraint;this.camera.getWorldPoint(i.x,i.y,n);for(var l=s.allBodies(this.world.localWorld),h=0;h1?1:0;os?(n.warn("Plugin.register:",e.toString(i),"was upgraded to",e.toString(r)),e._registry[r.name]=r):t-1},e.isFor=function(n,r){var i=n.for&&e.dependencyParse(n.for);return!n.for||r.name===i.name&&e.versionSatisfies(r.version,i.range)},e.use=function(r,i){if(r.uses=(r.uses||[]).concat(i||[]),0!==r.uses.length){for(var t=e.dependencies(r),s=n.topologicalSort(t),a=[],o=0;o0&&!u.silent&&n.info(a.join(" "))}else n.warn("Plugin.use:",e.toString(r),"does not specify any dependencies to install.")},e.dependencies=function(r,i){var t=e.dependencyParse(r),s=t.name;if(!(s in(i=i||{}))){r=e.resolve(r)||r,i[s]=n.map(r.uses||[],function(i){e.isPlugin(i)&&e.register(i);var s=e.dependencyParse(i),a=e.resolve(i);return a&&!e.versionSatisfies(a.version,s.range)?(n.warn("Plugin.dependencies:",e.toString(a),"does not satisfy",e.toString(s),"used by",e.toString(t)+"."),a._warned=!0,r._warned=!0):a||(n.warn("Plugin.dependencies:",e.toString(i),"used by",e.toString(t),"could not be resolved."),r._warned=!0),s.name});for(var a=0;a=t[2];if("^"===i.operator)return t[0]>0?a[0]===t[0]&&s.number>=i.number:t[1]>0?a[1]===t[1]&&a[2]>=t[2]:a[2]===t[2]}return n===r||"*"===n};
},{"./Common":"lVTS"}],"Ywbp":[function(require,module,exports) {
var e={};module.exports=e;var r=require("./Plugin"),t=require("./Common");e.name="matter-js",e.version="0.14.2",e.uses=[],e.used=[],e.use=function(){r.use(e,Array.prototype.slice.call(arguments))},e.before=function(r,a){return r=r.replace(/^Matter./,""),t.chainPathBefore(e,r,a)},e.after=function(r,a){return r=r.replace(/^Matter./,""),t.chainPathAfter(e,r,a)};
},{"./Plugin":"y68X","./Common":"lVTS"}],"OARP":[function(require,module,exports) {
var e={};module.exports=e;var r=require("./Composite"),o=require("../constraint/Constraint"),t=require("../core/Common");e.create=function(e){var o=r.create(),a={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return t.extend(o,a,e)};
},{"./Composite":"Tlkx","../constraint/Constraint":"sj0G","../core/Common":"lVTS"}],"U9pO":[function(require,module,exports) {
var e={};module.exports=e;var t=require("./Pair"),r=require("./Detector"),o=require("../core/Common");e.create=function(t){var i={controller:e,detector:r.collisions,buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return o.extend(i,t)},e.update=function(t,r,o,i){var n,a,s,u,d,c=o.world,g=t.buckets,l=!1,f=o.metrics;for(f.broadphaseTests=0,n=0;nc.bounds.max.x||b.bounds.max.yc.bounds.max.y)){var h=e._getRegion(t,b);if(!b.region||h.id!==b.region.id||i){f.broadphaseTests+=1,b.region&&!i||(b.region=h);var m=e._regionUnion(h,b.region);for(a=m.startCol;a<=m.endCol;a++)for(s=m.startRow;s<=m.endRow;s++){u=g[d=e._getBucketId(a,s)];var v=a>=h.startCol&&a<=h.endCol&&s>=h.startRow&&s<=h.endRow,R=a>=b.region.startCol&&a<=b.region.endCol&&s>=b.region.startRow&&s<=b.region.endRow;!v&&R&&R&&u&&e._bucketRemoveBody(t,u,b),(b.region===h||v&&!R||i)&&(u||(u=e._createBucket(g,d)),e._bucketAddBody(t,u,b))}b.region=h,l=!0}}}l&&(t.pairsList=e._createActivePairsList(t))},e.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},e._regionUnion=function(t,r){var o=Math.min(t.startCol,r.startCol),i=Math.max(t.endCol,r.endCol),n=Math.min(t.startRow,r.startRow),a=Math.max(t.endRow,r.endRow);return e._createRegion(o,i,n,a)},e._getRegion=function(t,r){var o=r.bounds,i=Math.floor(o.min.x/t.bucketWidth),n=Math.floor(o.max.x/t.bucketWidth),a=Math.floor(o.min.y/t.bucketHeight),s=Math.floor(o.max.y/t.bucketHeight);return e._createRegion(i,n,a,s)},e._createRegion=function(e,t,r,o){return{id:e+","+t+","+r+","+o,startCol:e,endCol:t,startRow:r,endRow:o}},e._getBucketId=function(e,t){return"C"+e+"R"+t},e._createBucket=function(e,t){return e[t]=[]},e._bucketAddBody=function(e,r,o){for(var i=0;i0?i.push(r):delete e.pairs[t[n]];return i};
},{"./Pair":"cKvI","./Detector":"uyPb","../core/Common":"lVTS"}],"OjQH":[function(require,module,exports) {
var e={};module.exports=e;var i=require("./Pair"),t=require("../core/Common");e._pairMaxIdleLife=1e3,e.create=function(e){return t.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},e)},e.update=function(e,t,l){var o,n,c,r,s=e.list,d=e.table,a=e.collisionStart,h=e.collisionEnd,u=e.collisionActive;for(a.length=0,h.length=0,u.length=0,r=0;re._pairMaxIdleLife&&d.push(c);for(c=0;cu.friction*u.frictionStatic*N*n&&(k=q,j=o.clamp(u.friction*W*n,-k,k));var w=t.cross(d,x),z=t.cross(C,x),E=h/(g.inverseMass+I.inverseMass+g.inverseInertia*w*w+I.inverseInertia*z*z);if(D*=E,j*=E,T<0&&T*T>i._restingThresh*n)_.normalImpulse=0;else{var F=_.normalImpulse;_.normalImpulse=Math.min(_.normalImpulse+D,0),D=_.normalImpulse-F}if(B*B>i._restingThreshTangent*n)_.tangentImpulse=0;else{var G=_.tangentImpulse;_.tangentImpulse=o.clamp(_.tangentImpulse+j,-k,k),j=_.tangentImpulse-G}r.x=x.x*D+P.x*j,r.y=x.y*D+P.y*j,g.isStatic||g.isSleeping||(g.positionPrev.x+=r.x*g.inverseMass,g.positionPrev.y+=r.y*g.inverseMass,g.anglePrev+=t.cross(d,r)*g.inverseInertia),I.isStatic||I.isSleeping||(I.positionPrev.x-=r.x*I.inverseMass,I.positionPrev.y-=r.y*I.inverseMass,I.anglePrev-=t.cross(C,r)*I.inverseInertia)}}}};
},{"../geometry/Vertices":"JhJa","../geometry/Vector":"SoZW","../core/Common":"lVTS","../geometry/Bounds":"DuOH"}],"eIfX":[function(require,module,exports) {
var e={};module.exports=e;var s=require("../body/Composite"),r=require("./Common");e.create=function(e){return r.extend({extended:!1,narrowDetections:0,narrowphaseTests:0,narrowReuse:0,narrowReuseCount:0,midphaseTests:0,broadphaseTests:0,narrowEff:1e-4,midEff:1e-4,broadEff:1e-4,collisions:0,buckets:0,bodies:0,pairs:0},!1,e)},e.reset=function(e){e.extended&&(e.narrowDetections=0,e.narrowphaseTests=0,e.narrowReuse=0,e.narrowReuseCount=0,e.midphaseTests=0,e.broadphaseTests=0,e.narrowEff=0,e.midEff=0,e.broadEff=0,e.collisions=0,e.buckets=0,e.pairs=0,e.bodies=0)},e.update=function(e,r){if(e.extended){var o=r.world,t=s.allBodies(o);e.collisions=e.narrowDetections,e.pairs=r.pairs.list.length,e.bodies=t.length,e.midEff=(e.narrowDetections/(e.midphaseTests||1)).toFixed(2),e.narrowEff=(e.narrowDetections/(e.narrowphaseTests||1)).toFixed(2),e.broadEff=(1-e.broadphaseTests/(t.length||1)).toFixed(2),e.narrowReuse=(e.narrowReuseCount/(e.narrowphaseTests||1)).toFixed(2)}};
},{"../body/Composite":"Tlkx","./Common":"lVTS"}],"XYdd":[function(require,module,exports) {
var e={};module.exports=e;var r=require("../body/World"),i=require("./Sleeping"),t=require("../collision/Resolver"),o=require("../collision/Pairs"),l=require("./Metrics"),a=require("../collision/Grid"),s=require("./Events"),n=require("../body/Composite"),c=require("../constraint/Constraint"),d=require("./Common"),p=require("../body/Body");e.create=function(e,i){i=(i=d.isElement(e)?i:e)||{},((e=d.isElement(e)?e:null)||i.render)&&d.warn("Engine.create: engine.render is deprecated (see docs)");var t={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},timing:{timestamp:0,timeScale:1},broadphase:{controller:a}},s=d.extend(t,i);return s.world=i.world||r.create(s.world),s.pairs=o.create(),s.broadphase=s.broadphase.controller.create(s.broadphase),s.metrics=s.metrics||{extended:!1},s.metrics=l.create(s.metrics),s},e.update=function(r,a,d){a=a||1e3/60,d=d||1;var p,v=r.world,m=r.timing,g=r.broadphase,u=[];m.timestamp+=a*m.timeScale;var f={timestamp:m.timestamp};s.trigger(r,"beforeUpdate",f);var S=n.allBodies(v),y=n.allConstraints(v);for(l.reset(r.metrics),r.enableSleeping&&i.update(S,m.timeScale),e._bodiesApplyGravity(S,v.gravity),e._bodiesUpdate(S,a,m.timeScale,d,v.bounds),c.preSolveAll(S),p=0;p0&&s.trigger(r,"collisionStart",{pairs:h.collisionStart}),t.preSolvePosition(h.list),p=0;p0&&s.trigger(r,"collisionActive",{pairs:h.collisionActive}),h.collisionEnd.length>0&&s.trigger(r,"collisionEnd",{pairs:h.collisionEnd}),l.update(r.metrics,r),e._bodiesClearForces(S),s.trigger(r,"afterUpdate",f),r},e.merge=function(r,t){if(d.extend(r,t),t.world){r.world=t.world,e.clear(r);for(var o=n.allBodies(r.world),l=0;l0)for(var s=i+1;so.max.x?a=o.min.x-n.max.x:n.max.xo.max.y?i=o.min.y-n.max.y:n.max.y0&&(t=n[0].bodyA,o=n[0].bodyB),e.emit(s.COLLISION_START,i,t,o)}),c.on(i,"collisionActive",function(i){var t,o,n=i.pairs;n.length>0&&(t=n[0].bodyA,o=n[0].bodyB),e.emit(s.COLLISION_ACTIVE,i,t,o)}),c.on(i,"collisionEnd",function(i){var t,o,n=i.pairs;n.length>0&&(t=n[0].bodyA,o=n[0].bodyB),e.emit(s.COLLISION_END,i,t,o)})},setBounds:function(e,i,t,o,n,r,l,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===t&&(t=this.scene.sys.scale.width),void 0===o&&(o=this.scene.sys.scale.height),void 0===n&&(n=64),void 0===r&&(r=!0),void 0===l&&(l=!0),void 0===s&&(s=!0),void 0===a&&(a=!0),this.updateWall(r,"left",e-n,i-n,n,o+2*n),this.updateWall(l,"right",e+t,i-n,n,o+2*n),this.updateWall(s,"top",e,i-n,t,n),this.updateWall(a,"bottom",e,i+o,t,n),this},updateWall:function(e,i,t,o,n,r){var l=this.walls[i];e?(l&&y.remove(this.localWorld,l),t+=n/2,o+=r/2,this.walls[i]=this.create(t,o,n,r,{isStatic:!0,friction:0,frictionStatic:0})):(l&&y.remove(this.localWorld,l),this.walls[i]=null)},createDebugGraphic:function(){var e=this.scene.sys.add.graphics({x:0,y:0});return e.setDepth(Number.MAX_VALUE),this.debugGraphic=e,this.drawDebug=!0,e},disableGravity:function(){return this.localWorld.gravity.x=0,this.localWorld.gravity.y=0,this.localWorld.gravity.scale=0,this},setGravity:function(e,i,t){return void 0===e&&(e=0),void 0===i&&(i=1),this.localWorld.gravity.x=e,this.localWorld.gravity.y=i,void 0!==t&&(this.localWorld.gravity.scale=t),this},create:function(i,t,o,n,r){var l=e.rectangle(i,t,o,n,r);return y.add(this.localWorld,l),l},add:function(e){return y.add(this.localWorld,e),this},remove:function(e,i){Array.isArray(e)||(e=[e]);for(var t=0;to.deltaMax?o.deltaMax:i)/o.delta,o.delta=i),0!==o.timeScalePrev&&(l*=n.timeScale/o.timeScalePrev),0===n.timeScale&&(l=0),o.timeScalePrev=n.timeScale,o.correction=l,o.frameCounter+=1,e-o.counterTimestamp>=1e3&&(o.fps=o.frameCounter*((e-o.counterTimestamp)/1e3),o.counterTimestamp=e,o.frameCounter=0),r.update(t,i,l)}},step:function(e,i){r.update(this.engine,e,i)},update60Hz:function(){return 1e3/60},update30Hz:function(){return 1e3/30},has:function(e){var i=e.hasOwnProperty("body")?e.body:e;return null!==n.get(this.localWorld,i.id,i.type)},getAllBodies:function(){return n.allBodies(this.localWorld)},getAllConstraints:function(){return n.allConstraints(this.localWorld)},getAllComposites:function(){return n.allComposites(this.localWorld)},postUpdate:function(){if(this.drawDebug){var e=this.debugConfig,i=this.engine,t=this.debugGraphic,o=n.allBodies(this.localWorld);this.debugGraphic.clear(),e.showBroadphase&&i.broadphase.controller&&this.renderGrid(i.broadphase,t,e.broadphaseColor,.5),e.showBounds&&this.renderBodyBounds(o,t,e.boundsColor,.5),(e.showBody||e.showStaticBody)&&this.renderBodies(o),e.showJoint&&this.renderJoints(),(e.showAxes||e.showAngleIndicator)&&this.renderBodyAxes(o,t,e.showAxes,e.angleColor,.5),e.showVelocity&&this.renderBodyVelocity(o,t,e.velocityColor,1,2),e.showSeparations&&this.renderSeparations(i.pairs.list,t,e.separationColor),e.showCollisions&&this.renderCollisions(i.pairs.list,t,e.collisionColor)}},renderGrid:function(e,i,t,n){i.lineStyle(1,t,n);for(var r=o.keys(e.buckets),l=0;l0){var h=a[0].vertex.x,d=a[0].vertex.y;2===a.length&&(h=(a[0].vertex.x+a[1].vertex.x)/2,d=(a[0].vertex.y+a[1].vertex.y)/2),s.bodyB===s.supports[0].body||s.bodyA.isStatic?i.lineBetween(h-8*s.normal.x,d-8*s.normal.y,h,d):i.lineBetween(h+8*s.normal.x,d+8*s.normal.y,h,d)}}return this},renderBodyBounds:function(e,i,t,o){i.lineStyle(1,t,o);for(var n=0;n1?1:0;a1?1:0;s1?1:0;s1&&this.renderConvexHull(v,i,y,g)}}},renderBody:function(e,i,t,o,n,r,l,s){void 0===o&&(o=null),void 0===n&&(n=null),void 0===r&&(r=1),void 0===l&&(l=null),void 0===s&&(s=null);for(var a=this.debugConfig,h=a.sensorFillColor,d=a.sensorLineColor,c=e.parts,u=c.length,y=u>1?1:0;y1){var n=e.vertices;i.lineStyle(o,t),i.beginPath(),i.moveTo(n[0].x,n[0].y);for(var r=1;r0&&(i.fillStyle(s),i.fillCircle(d.x,d.y,a),i.fillCircle(c.x,c.y,a)),this},resetCollisionIDs:function(){return i._nextCollidingGroupId=1,i._nextNonCollidingGroupId=-1,i._nextCategory=1,this},shutdown:function(){c.off(this.engine),this.removeAllListeners(),y.clear(this.localWorld,!1),r.clear(this.engine),this.drawDebug&&this.debugGraphic.destroy()},destroy:function(){this.shutdown()}});module.exports=v;
},{"./lib/factory/Bodies":"bOCr","./lib/body/Body":"ZQ7a","../../utils/Class":"JASv","./lib/core/Common":"lVTS","./lib/body/Composite":"Tlkx","./lib/core/Engine":"XYdd","eventemitter3":"JJlS","./events":"O5an","../../utils/object/GetFastValue":"cEup","../../utils/object/GetValue":"OqLI","./lib/core/Events":"spdM","./MatterTileBody":"l6TC","./lib/body/World":"OARP","./lib/geometry/Vector":"SoZW"}],"nweT":[function(require,module,exports) {
var t=require("../../display/align/const"),e=require("./lib/geometry/Axes"),i=require("./lib/factory/Bodies"),s=require("./lib/body/Body"),o=require("./BodyBounds"),r=require("./lib/geometry/Bounds"),n=require("../../utils/Class"),h=require("./lib/body/Composite"),a=require("./lib/factory/Composites"),l=require("./lib/constraint/Constraint"),u=require("./lib/collision/Detector"),c=require("../../math/distance/DistanceBetween"),d=require("./Factory"),y=require("../../utils/object/GetFastValue"),g=require("../../utils/object/GetValue"),f=require("./lib/collision/Grid"),p=require("./lib/plugins/MatterAttractors"),b=require("./lib/plugins/MatterCollisionEvents"),B=require("./lib/core/Matter"),T=require("./lib/plugins/MatterWrap"),v=require("../../utils/object/Merge"),m=require("./lib/collision/Pair"),w=require("./lib/collision/Pairs"),E=require("./lib/core/Plugin"),M=require("../../plugins/PluginCache"),q=require("./lib/collision/Query"),A=require("./lib/collision/Resolver"),P=require("./lib/collision/SAT"),O=require("../../scene/events"),_=require("./lib/geometry/Svg"),C=require("./lib/geometry/Vector"),x=require("./lib/geometry/Vertices"),R=require("./World"),V=new n({initialize:function(t){this.scene=t,this.systems=t.sys,this.config=this.getConfig(),this.world,this.add,this.bodyBounds,this.body=s,this.composite=h,this.detector=u,this.grid=f,this.pair=m,this.pairs=w,this.query=q,this.resolver=A,this.sat=P,this.constraint=l,this.bodies=i,this.composites=a,this.axes=e,this.bounds=r,this.svg=_,this.vector=C,this.vertices=x,this.verts=x,this._tempVec2=C.create(),g(this.config,"plugins.collisionevents",!0)&&this.enableCollisionEventsPlugin(),g(this.config,"plugins.attractors",!1)&&this.enableAttractorPlugin(),g(this.config,"plugins.wrap",!1)&&this.enableWrapPlugin(),A._restingThresh=g(this.config,"restingThresh",4),A._restingThreshTangent=g(this.config,"restingThreshTangent",6),A._positionDampen=g(this.config,"positionDampen",.9),A._positionWarming=g(this.config,"positionWarming",.8),A._frictionNormalMultiplier=g(this.config,"frictionNormalMultiplier",5),t.sys.events.once(O.BOOT,this.boot,this),t.sys.events.on(O.START,this.start,this)},boot:function(){this.world=new R(this.scene,this.config),this.add=new d(this.world),this.bodyBounds=new o,this.systems.events.once(O.DESTROY,this.destroy,this)},start:function(){this.world||(this.world=new R(this.scene,this.config),this.add=new d(this.world));var t=this.systems.events;t.on(O.UPDATE,this.world.update,this.world),t.on(O.POST_UPDATE,this.world.postUpdate,this.world),t.once(O.SHUTDOWN,this.shutdown,this)},getConfig:function(){var t=this.systems.game.config.physics,e=this.systems.settings.physics;return v(y(e,"matter",{}),y(t,"matter",{}))},enableAttractorPlugin:function(){return E.register(p),E.use(B,p),this},enableWrapPlugin:function(){return E.register(T),E.use(B,T),this},enableCollisionEventsPlugin:function(){return E.register(b),E.use(B,b),this},pause:function(){return this.world.pause()},resume:function(){return this.world.resume()},set60Hz:function(){return this.world.getDelta=this.world.update60Hz,this.world.autoUpdate=!0,this},set30Hz:function(){return this.world.getDelta=this.world.update30Hz,this.world.autoUpdate=!0,this},step:function(t,e){this.world.step(t,e)},containsPoint:function(t,e,i){t=this.getMatterBodies(t);var s=C.create(e,i);return q.point(t,s).length>0},intersectPoint:function(t,e,i){i=this.getMatterBodies(i);var s=C.create(t,e),o=[];return q.point(i,s).forEach(function(t){-1===o.indexOf(t)&&o.push(t)}),o},intersectRect:function(t,e,i,s,o,r){void 0===o&&(o=!1),r=this.getMatterBodies(r);var n={min:{x:t,y:e},max:{x:t+i,y:e+s}},h=[];return q.region(r,n,o).forEach(function(t){-1===h.indexOf(t)&&h.push(t)}),h},intersectRay:function(t,e,i,s,o,r){void 0===o&&(o=1),r=this.getMatterBodies(r);for(var n=[],h=q.ray(r,C.create(t,e),C.create(i,s),o),a=0;a=this._duration&&this.transitionComplete()},transitionComplete:function(){var t=this._target.sys,s=this._target.sys.settings;this.systems.events.off(e.UPDATE,this.step,this),t.events.emit(e.TRANSITION_COMPLETE,this.scene),s.isTransition=!1,s.transitionFrom=null,this._duration=0,this._target=null,this._onUpdate=null,this._onUpdateScope=null,this._willRemove?this.manager.remove(this.key):this._willSleep?this.systems.sleep():this.manager.stop(this.key)},add:function(t,s,e,i){return this.manager.add(t,s,e,i)},launch:function(t,s){return t&&t!==this.key&&this.manager.queueOp("start",t,s),this},run:function(t,s){return t&&t!==this.key&&this.manager.queueOp("run",t,s),this},pause:function(t,s){return void 0===t&&(t=this.key),this.manager.queueOp("pause",t,s),this},resume:function(t,s){return void 0===t&&(t=this.key),this.manager.queueOp("resume",t,s),this},sleep:function(t,s){return void 0===t&&(t=this.key),this.manager.queueOp("sleep",t,s),this},wake:function(t,s){return void 0===t&&(t=this.key),this.manager.queueOp("wake",t,s),this},switch:function(t){return t!==this.key&&this.manager.queueOp("switch",this.key,t),this},stop:function(t,s){return void 0===t&&(t=this.key),this.manager.queueOp("stop",t,s),this},setActive:function(t,s,e){void 0===s&&(s=this.key);var i=this.manager.getScene(s);return i&&i.sys.setActive(t,e),this},setVisible:function(t,s){void 0===s&&(s=this.key);var e=this.manager.getScene(s);return e&&e.sys.setVisible(t),this},isSleeping:function(t){return void 0===t&&(t=this.key),this.manager.isSleeping(t)},isActive:function(t){return void 0===t&&(t=this.key),this.manager.isActive(t)},isPaused:function(t){return void 0===t&&(t=this.key),this.manager.isPaused(t)},isVisible:function(t){return void 0===t&&(t=this.key),this.manager.isVisible(t)},swapPosition:function(t,s){return void 0===s&&(s=this.key),t!==s&&this.manager.swapPosition(t,s),this},moveAbove:function(t,s){return void 0===s&&(s=this.key),t!==s&&this.manager.moveAbove(t,s),this},moveBelow:function(t,s){return void 0===s&&(s=this.key),t!==s&&this.manager.moveBelow(t,s),this},remove:function(t){return void 0===t&&(t=this.key),this.manager.remove(t),this},moveUp:function(t){return void 0===t&&(t=this.key),this.manager.moveUp(t),this},moveDown:function(t){return void 0===t&&(t=this.key),this.manager.moveDown(t),this},bringToTop:function(t){return void 0===t&&(t=this.key),this.manager.bringToTop(t),this},sendToBack:function(t){return void 0===t&&(t=this.key),this.manager.sendToBack(t),this},get:function(t){return this.manager.getScene(t)},getIndex:function(t){return void 0===t&&(t=this.key),this.manager.getIndex(t)},shutdown:function(){var t=this.systems.events;t.off(e.SHUTDOWN,this.shutdown,this),t.off(e.POST_UPDATE,this.step,this),t.off(e.TRANSITION_OUT)},destroy:function(){this.shutdown(),this.scene.sys.events.off(e.START,this.start,this),this.scene=null,this.systems=null,this.settings=null,this.manager=null}});n.register("ScenePlugin",r,"scenePlugin"),module.exports=r;
},{"../math/Clamp":"eCA1","../utils/Class":"JASv","./events":"zvkO","../utils/object/GetFastValue":"cEup","../plugins/PluginCache":"ZrqD"}],"eZD7":[function(require,module,exports) {
var e=require("./const"),r=require("../utils/object/Extend"),n={Events:require("./events"),SceneManager:require("./SceneManager"),ScenePlugin:require("./ScenePlugin"),Settings:require("./Settings"),Systems:require("./Systems")};n=r(!1,n,e),module.exports=n;
},{"./const":"AD22","../utils/object/Extend":"SFmW","./events":"zvkO","./SceneManager":"Xv1C","./ScenePlugin":"LtdL","./Settings":"cFNQ","./Systems":"cAYG"}],"ACuu":[function(require,module,exports) {
module.exports={List:require("./List"),Map:require("./Map"),ProcessQueue:require("./ProcessQueue"),RTree:require("./RTree"),Set:require("./Set"),Size:require("./Size")};
},{"./List":"ZAHL","./Map":"l4f9","./ProcessQueue":"zyEQ","./RTree":"eoRJ","./Set":"qWkr","./Size":"Kwmj"}],"JzNx":[function(require,module,exports) {
var E={LINEAR:0,NEAREST:1};module.exports=E;
},{}],"t3dj":[function(require,module,exports) {
var e=require("../utils/object/Extend"),r=require("./const"),u={CanvasTexture:require("./CanvasTexture"),Events:require("./events"),FilterMode:r,Frame:require("./Frame"),Parsers:require("./parsers"),Texture:require("./Texture"),TextureManager:require("./TextureManager"),TextureSource:require("./TextureSource")};u=e(!1,u,r),module.exports=u;
},{"../utils/object/Extend":"SFmW","./const":"JzNx","./CanvasTexture":"IG0K","./events":"Gfo3","./Frame":"nGOG","./parsers":"o3TW","./Texture":"K94h","./TextureManager":"CPbt","./TextureSource":"nM6K"}],"qQvm":[function(require,module,exports) {
var t=function(t,e,r){return t>=0&&t=0&&eh.width&&(a=Math.max(h.width-t,0)),e+n>h.height&&(n=Math.max(h.height-e,0));for(var u=[],l=e;l=0&&f=0&&g=w;o--)(d=p[h][o])&&-1!==d.index&&d.visible&&0!==d.alpha&&r.push(d);else if(2===t)for(h=v;h>=g;h--)for(o=w;p[h]&&o=g;h--)for(o=x;p[h]&&o>=w;o--)(d=p[h][o])&&-1!==d.index&&d.visible&&0!==d.alpha&&r.push(d);return n.tilesDrawn=r.length,n.tilesTotal=f*u,r};module.exports=a;
},{"../../math/snap/SnapFloor":"hQtq","../../math/snap/SnapCeil":"XcEv"}],"oyad":[function(require,module,exports) {
var o=function(o,e){e?o.setCollision(!0,!0,!0,!0,!1):o.resetCollision(!1)};module.exports=o;
},{}],"YkLd":[function(require,module,exports) {
var e=require("./GetTilesWithin"),i=require("./CalculateFacesWithin"),l=require("./SetTileCollision"),n=function(n,r,t,o,u,a,d){for(var s=-1!==d.collideIndexes.indexOf(n),c=e(r,t,o,u,null,d),x=0;x=0;d--)for(f=t.width-1;f>=0;f--)if((o=t.data[d][f])&&o.index===i){if(n===r)return o;n+=1}}else for(d=0;d-1}return!1};module.exports=e;
},{"./IsInLayerBounds":"qQvm"}],"fK4L":[function(require,module,exports) {
var r=require("./HasTileAt"),e=require("./WorldToTileX"),i=require("./WorldToTileY"),o=function(o,l,u,T){var t=e(o,!0,u,T),a=i(l,!0,u,T);return r(t,a,T)};module.exports=o;
},{"./HasTileAt":"TNBX","./WorldToTileX":"qo0R","./WorldToTileY":"AKKJ"}],"TqCu":[function(require,module,exports) {
var t=require("../utils/Class"),i=require("../gameobjects/components"),e=require("../geom/rectangle"),s=new t({Mixins:[i.Alpha,i.Flip,i.Visible],initialize:function(t,i,e,s,h,l,o,n){this.layer=t,this.index=i,this.x=e,this.y=s,this.width=h,this.height=l,this.baseWidth=void 0!==o?o:h,this.baseHeight=void 0!==n?n:l,this.pixelX=0,this.pixelY=0,this.updatePixelXY(),this.properties={},this.rotation=0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceLeft=!1,this.faceRight=!1,this.faceTop=!1,this.faceBottom=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.tint=16777215,this.physics={}},containsPoint:function(t,i){return!(tthis.right||i>this.bottom)},copy:function(t){return this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.visible=t.visible,this.setFlip(t.flipX,t.flipY),this.tint=t.tint,this.rotation=t.rotation,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext,this},getCollisionGroup:function(){return this.tileset?this.tileset.getTileCollisionGroup(this.index):null},getTileData:function(){return this.tileset?this.tileset.getTileData(this.index):null},getLeft:function(t){var i=this.tilemapLayer;return i?i.tileToWorldX(this.x,t):this.x*this.baseWidth},getRight:function(t){var i=this.tilemapLayer;return i?this.getLeft(t)+this.width*i.scaleX:this.getLeft(t)+this.width},getTop:function(t){var i=this.tilemapLayer;return i?i.tileToWorldY(this.y,t)-(this.height-this.baseHeight)*i.scaleY:this.y*this.baseHeight-(this.height-this.baseHeight)},getBottom:function(t){var i=this.tilemapLayer;return i?this.getTop(t)+this.height*i.scaleY:this.getTop(t)+this.height},getBounds:function(t,i){return void 0===i&&(i=new e),i.x=this.getLeft(),i.y=this.getTop(),i.width=this.getRight()-i.x,i.height=this.getBottom()-i.y,i},getCenterX:function(t){return(this.getLeft(t)+this.getRight(t))/2},getCenterY:function(t){return(this.getTop(t)+this.getBottom(t))/2},destroy:function(){this.collisionCallback=void 0,this.collisionCallbackContext=void 0,this.properties=void 0},intersects:function(t,i,e,s){return!(e<=this.pixelX||s<=this.pixelY||t>=this.right||i>=this.bottom)},isInteresting:function(t,i){return t&&i?this.canCollide||this.hasInterestingFace:t?this.collides:!!i&&this.hasInterestingFace},resetCollision:function(t){(void 0===t&&(t=!0),this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,t)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},resetFaces:function(){return this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this},setCollision:function(t,i,e,s,h){(void 0===i&&(i=t),void 0===e&&(e=t),void 0===s&&(s=t),void 0===h&&(h=!0),this.collideLeft=t,this.collideRight=i,this.collideUp=e,this.collideDown=s,this.faceLeft=t,this.faceRight=i,this.faceTop=e,this.faceBottom=s,h)&&(this.tilemapLayer&&this.tilemapLayer.calculateFacesAt(this.x,this.y));return this},setCollisionCallback:function(t,i){return null===t?(this.collisionCallback=void 0,this.collisionCallbackContext=void 0):(this.collisionCallback=t,this.collisionCallbackContext=i),this},setSize:function(t,i,e,s){return void 0!==t&&(this.width=t),void 0!==i&&(this.height=i),void 0!==e&&(this.baseWidth=e),void 0!==s&&(this.baseHeight=s),this.updatePixelXY(),this},updatePixelXY:function(){return this.pixelX=this.x*this.baseWidth,this.pixelY=this.y*this.baseHeight,this},canCollide:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}},collides:{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}},hasInterestingFace:{get:function(){return this.faceTop||this.faceBottom||this.faceLeft||this.faceRight}},tileset:{get:function(){var t=this.layer.tilemapLayer;if(t){var i=t.gidMap[this.index];if(i)return i}return null}},tilemapLayer:{get:function(){return this.layer.tilemapLayer}},tilemap:{get:function(){var t=this.tilemapLayer;return t?t.tilemap:null}}});module.exports=s;
},{"../utils/Class":"JASv","../gameobjects/components":"VjLH","../geom/rectangle":"fJix"}],"OFjj":[function(require,module,exports) {
var e=require("../Tile"),i=require("./IsInLayerBounds"),a=require("./CalculateFacesAt"),l=require("./SetTileCollision"),t=function(t,d,n,r,u){if(!i(d,n,u))return null;void 0===r&&(r=!0);var o=u.data[n][d],s=o&&o.collides;if(t instanceof e)null===u.data[n][d]&&(u.data[n][d]=new e(u,t.index,d,n,t.width,t.height)),u.data[n][d].copy(t);else{var c=t;null===u.data[n][d]?u.data[n][d]=new e(u,c,d,n,u.tileWidth,u.tileHeight):u.data[n][d].index=c}var x=u.data[n][d],f=-1!==u.collideIndexes.indexOf(x.index);return l(x,f),r&&s!==x.collides&&a(d,n,u),x};module.exports=t;
},{"../Tile":"TqCu","./IsInLayerBounds":"qQvm","./CalculateFacesAt":"DbKU","./SetTileCollision":"oyad"}],"NkOQ":[function(require,module,exports) {
var r=require("./PutTileAt"),e=require("./WorldToTileX"),i=require("./WorldToTileY"),o=function(o,u,l,t,T,d){var n=e(u,!0,T,d),q=i(l,!0,T,d);return r(o,n,q,t,d)};module.exports=o;
},{"./PutTileAt":"OFjj","./WorldToTileX":"qo0R","./WorldToTileY":"AKKJ"}],"jRCQ":[function(require,module,exports) {
var r=require("./CalculateFacesWithin"),e=require("./PutTileAt"),a=function(a,i,t,l,u){if(!Array.isArray(a))return null;void 0===l&&(l=!0),Array.isArray(a[0])||(a=[a]);for(var n=a.length,o=a[0].length,v=0;va)){for(var v=o;v<=a;v++)r(v,t,l);if(n)for(var h=0;h=o&&u.index<=a&&i(u,t)}d&&e(0,0,l.width,l.height,l)}};module.exports=o;
},{"./SetTileCollision":"oyad","./CalculateFacesWithin":"olYP","./SetLayerCollisionIndex":"UIVl"}],"uMMg":[function(require,module,exports) {
var i=require("./SetTileCollision"),e=require("./CalculateFacesWithin"),r=require("./SetLayerCollisionIndex"),a=function(a,o,t,d){void 0===o&&(o=!0),void 0===t&&(t=!0),Array.isArray(a)||(a=[a]);for(var n=0;n0&&i(h,o)}}t&&e(0,0,r.width,r.height,r)};module.exports=o;
},{"./SetTileCollision":"oyad","./CalculateFacesWithin":"olYP"}],"kQvI":[function(require,module,exports) {
var l=function(l,a,c,e){if("number"==typeof l)e.callbacks[l]=null!==a?{callback:a,callbackContext:c}:void 0;else for(var o=0,n=l.length;o>>0;return t};module.exports=r;
},{}],"J69X":[function(require,module,exports) {
var a=2147483648,o=1073741824,t=536870912,e=function(e){var i=Boolean(e&a),l=Boolean(e&o),n=Boolean(e&t);e&=~(a|o|t);var p=0,r=!1;return i&&l&&n?(p=Math.PI/2,r=!0):i&&l&&!n?(p=Math.PI,r=!1):i&&!l&&n?(p=Math.PI/2,r=!1):!i||l||n?!i&&l&&n?(p=3*Math.PI/2,r=!1):i||!l||n?i||l||!n?i||l||n||(p=0,r=!1):(p=3*Math.PI/2,r=!0):(p=Math.PI,r=!0):(p=0,r=!0),{gid:e,flippedHorizontal:i,flippedVertical:l,flippedAntiDiagonal:n,rotation:p,flipped:r}};module.exports=e;
},{}],"oPOP":[function(require,module,exports) {
var e=require("../../../utils/object/GetFastValue"),i=function(i,t,a){if(!t)return{i:0,layers:i.layers,name:"",opacity:1,visible:!0,x:0,y:0};var r=t.x+e(t,"startx",0)*i.tilewidth+e(t,"offsetx",0),s=t.y+e(t,"starty",0)*i.tileheight+e(t,"offsety",0);return{i:0,layers:t.layers,name:a.name+t.name+"/",opacity:a.opacity*t.opacity,visible:a.visible&&t.visible,x:a.x+r,y:a.y+s}};module.exports=i;
},{"../../../utils/object/GetFastValue":"cEup"}],"MMLZ":[function(require,module,exports) {
var e=require("./Base64Decode"),i=require("../../../utils/object/GetFastValue"),t=require("../../mapdata/LayerData"),a=require("./ParseGID"),r=require("../../Tile"),l=require("./CreateGroupLayer"),h=function(h,n){for(var s=i(h,"infinite",!1),o=[],p=[],d=l(h);d.i0;)if(d.i>=d.layers.length){if(p.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}d=p.pop()}else{var g=d.layers[d.i];if(d.i++,"tilelayer"===g.type)if(g.compression)console.warn("TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer '"+g.name+"'");else{if(g.encoding&&"base64"===g.encoding){if(g.chunks)for(var u=0;u0?((w=new r(f,y.gid,I,J,h.tilewidth,h.tileheight)).rotation=y.rotation,w.flipX=y.flipped,v[J][I]=w):(c=n?null:new r(f,-1,I,J,h.tilewidth,h.tileheight),v[J][I]=c),++m===T.width&&(L++,m=0)}}else{f=new t({name:d.name+g.name,x:d.x+i(g,"offsetx",0)+g.x,y:d.y+i(g,"offsety",0)+g.y,width:g.width,height:g.height,tileWidth:h.tilewidth,tileHeight:h.tileheight,alpha:d.opacity*g.opacity,visible:d.visible&&g.visible,properties:i(g,"properties",{})});for(var N=[],O=0,S=g.data.length;O0?((w=new r(f,y.gid,m,v.length,h.tilewidth,h.tileheight)).rotation=y.rotation,w.flipX=y.flipped,N.push(w)):(c=n?null:new r(f,-1,m,v.length,h.tilewidth,h.tileheight),N.push(c)),++m===g.width&&(v.push(N),m=0,N=[])}f.data=v,o.push(f)}else if("group"===g.type){var W=l(h,g,d);p.push(d),d=W}}return o};module.exports=h;
},{"./Base64Decode":"Aezy","../../../utils/object/GetFastValue":"cEup","../../mapdata/LayerData":"kSFm","./ParseGID":"J69X","../../Tile":"TqCu","./CreateGroupLayer":"oPOP"}],"vTwh":[function(require,module,exports) {
var e=require("../../../utils/object/GetFastValue"),r=require("./CreateGroupLayer"),a=function(a){for(var i=[],t=[],l=r(a);l.i0;)if(l.i>=l.layers.length){if(t.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}l=t.pop()}else{var s=l.layers[l.i];if(l.i++,"imagelayer"===s.type){var p=e(s,"offsetx",0)+e(s,"startx",0),o=e(s,"offsety",0)+e(s,"starty",0);i.push({name:l.name+s.name,image:s.image,x:l.x+p+s.x,y:l.y+o+s.y,alpha:l.opacity*s.opacity,visible:l.visible&&s.visible,properties:e(s,"properties",{})})}else if("group"===s.type){var y=r(a,s,l);t.push(l),l=y}}return i};module.exports=a;
},{"../../../utils/object/GetFastValue":"cEup","./CreateGroupLayer":"oPOP"}],"DnWo":[function(require,module,exports) {
var i=require("../utils/Class"),t=new i({initialize:function(i,t,e,s,h,n,l,a){(void 0===e||e<=0)&&(e=32),(void 0===s||s<=0)&&(s=32),void 0===h&&(h=0),void 0===n&&(n=0),void 0===l&&(l={}),void 0===a&&(a={}),this.name=i,this.firstgid=t,this.tileWidth=e,this.tileHeight=s,this.tileMargin=h,this.tileSpacing=n,this.tileProperties=l,this.tileData=a,this.image=null,this.glTexture=null,this.rows=0,this.columns=0,this.total=0,this.texCoordinates=[]},getTileProperties:function(i){return this.containsTileIndex(i)?this.tileProperties[i-this.firstgid]:null},getTileData:function(i){return this.containsTileIndex(i)?this.tileData[i-this.firstgid]:null},getTileCollisionGroup:function(i){var t=this.getTileData(i);return t&&t.objectgroup?t.objectgroup:null},containsTileIndex:function(i){return i>=this.firstgid&&i=this.firstgid&&i1){if(Array.isArray(p.tiles)){for(var c={},u={},m=0;m0;)if(o.i>=o.layers.length){if(l.length<1){console.warn("TilemapParser.parseTiledJSON - Invalid layer group hierarchy");break}o=l.pop()}else{var p=o.layers[o.i];if(o.i++,p.opacity*=o.opacity,p.visible=o.visible&&p.visible,"objectgroup"===p.type){p.name=o.name+p.name;for(var u=o.x+e(p,"startx",0)+e(p,"offsetx",0),n=o.y+e(p,"starty",0)+e(p,"offsety",0),y=[],c=0;c-1?new i(n,o,v,u,h.tilesize,h.tilesize):a?null:new i(n,-1,v,u,h.tilesize,h.tilesize),s.push(g)}d.push(s),s=[]}n.data=d,l.push(n)}return l};module.exports=t;
},{"../../mapdata/LayerData":"kSFm","../../Tile":"TqCu"}],"smtc":[function(require,module,exports) {
var e=require("../../Tileset"),r=function(r){for(var i=[],t=[],l=0;lh&&(h=l.layer[y].width),l.layer[y].height>n&&(n=l.layer[y].height);var o=new r({width:h,height:n,name:i,tileWidth:l.layer[0].tilesize,tileHeight:l.layer[0].tilesize,format:e.WELTMEISTER});return o.layers=t(l,s),o.tilesets=a(l),o};module.exports=i;
},{"../../Formats":"T6CI","../../mapdata/MapData":"z96B","./ParseTileLayers":"Y0G5","./ParseTilesets":"smtc"}],"kThX":[function(require,module,exports) {
var e=require("../Formats"),r=require("./Parse2DArray"),a=require("./ParseCSV"),i=require("./tiled/ParseJSONTiled"),s=require("./impact/ParseWeltmeister"),t=function(t,u,c,l,n,o){var d;switch(u){case e.ARRAY_2D:d=r(t,c,l,n,o);break;case e.CSV:d=a(t,c,l,n,o);break;case e.TILED_JSON:d=i(t,c,o);break;case e.WELTMEISTER:d=s(t,c,o);break;default:console.warn("Unrecognized tilemap data format: "+u),d=null}return d};module.exports=t;
},{"../Formats":"T6CI","./Parse2DArray":"NwR9","./ParseCSV":"CB3P","./tiled/ParseJSONTiled":"LRWD","./impact/ParseWeltmeister":"EGEt"}],"COZg":[function(require,module,exports) {
module.exports={ParseTileLayers:require("./ParseTileLayers"),ParseTilesets:require("./ParseTilesets"),ParseWeltmeister:require("./ParseWeltmeister")};
},{"./ParseTileLayers":"Y0G5","./ParseTilesets":"smtc","./ParseWeltmeister":"EGEt"}],"yZsX":[function(require,module,exports) {
module.exports={AssignTileProperties:require("./AssignTileProperties"),Base64Decode:require("./Base64Decode"),BuildTilesetIndex:require("./BuildTilesetIndex"),ParseGID:require("./ParseGID"),ParseImageLayers:require("./ParseImageLayers"),ParseJSONTiled:require("./ParseJSONTiled"),ParseObject:require("./ParseObject"),ParseObjectLayers:require("./ParseObjectLayers"),ParseTileLayers:require("./ParseTileLayers"),ParseTilesets:require("./ParseTilesets")};
},{"./AssignTileProperties":"Y1x5","./Base64Decode":"Aezy","./BuildTilesetIndex":"BBkz","./ParseGID":"J69X","./ParseImageLayers":"vTwh","./ParseJSONTiled":"LRWD","./ParseObject":"GF9e","./ParseObjectLayers":"s44V","./ParseTileLayers":"MMLZ","./ParseTilesets":"tMbX"}],"SMBj":[function(require,module,exports) {
module.exports={Parse:require("./Parse"),Parse2DArray:require("./Parse2DArray"),ParseCSV:require("./ParseCSV"),Impact:require("./impact/"),Tiled:require("./tiled/")};
},{"./Parse":"kThX","./Parse2DArray":"NwR9","./ParseCSV":"CB3P","./impact/":"COZg","./tiled/":"yZsX"}],"i8Go":[function(require,module,exports) {
var e=require("../../renderer/webgl/Utils"),l=function(l,i,t,a){i.cull(a);var r=i.culledTiles,h=r.length,n=a.alpha*i.alpha;if(!(0===h||n<=0))for(var p=i.gidMap,o=i.pipeline,d=e.getTintAppendFloatAlphaAndSwap,g=i.scrollFactorX,c=i.scrollFactorY,u=i.x,x=i.y,s=i.scaleX,f=i.scaleY,v=i.tileset,w=0;w1||l.scaleY>1)&&(n.imageSmoothingEnabled=!1);for(var f=0;f=0&&i<4&&(this._renderOrder=i),this},calculateFacesAt:function(i,t){return r.CalculateFacesAt(i,t,this.layer),this},calculateFacesWithin:function(i,t,e,l){return r.CalculateFacesWithin(i,t,e,l,this.layer),this},createFromTiles:function(i,t,e,l,n){return r.CreateFromTiles(i,t,e,l,n,this.layer)},cull:function(i){return this.cullCallback(this.layer,i,this.culledTiles,this._renderOrder)},copy:function(i,t,e,l,n,s,o){return r.Copy(i,t,e,l,n,s,o,this.layer),this},destroy:function(i){void 0===i&&(i=!0),this.tilemap&&(this.layer.tilemapLayer===this&&(this.layer.tilemapLayer=void 0),i&&this.tilemap.removeLayer(this),this.tilemap=void 0,this.layer=void 0,this.culledTiles.length=0,this.cullCallback=null,this.gidMap=[],this.tileset=[],l.prototype.destroy.call(this))},fill:function(i,t,e,l,n,s){return r.Fill(i,t,e,l,n,s,this.layer),this},filterTiles:function(i,t,e,l,n,s,o){return r.FilterTiles(i,t,e,l,n,s,o,this.layer)},findByIndex:function(i,t,e){return r.FindByIndex(i,t,e,this.layer)},findTile:function(i,t,e,l,n,s,o){return r.FindTile(i,t,e,l,n,s,o,this.layer)},forEachTile:function(i,t,e,l,n,s,o){return r.ForEachTile(i,t,e,l,n,s,o,this.layer),this},getTileAt:function(i,t,e){return r.GetTileAt(i,t,e,this.layer)},getTileAtWorldXY:function(i,t,e,l){return r.GetTileAtWorldXY(i,t,e,l,this.layer)},getTilesWithin:function(i,t,e,l,n){return r.GetTilesWithin(i,t,e,l,n,this.layer)},getTilesWithinShape:function(i,t,e){return r.GetTilesWithinShape(i,t,e,this.layer)},getTilesWithinWorldXY:function(i,t,e,l,n,s){return r.GetTilesWithinWorldXY(i,t,e,l,n,s,this.layer)},hasTileAt:function(i,t){return r.HasTileAt(i,t,this.layer)},hasTileAtWorldXY:function(i,t,e){return r.HasTileAtWorldXY(i,t,e,this.layer)},putTileAt:function(i,t,e,l){return r.PutTileAt(i,t,e,l,this.layer)},putTileAtWorldXY:function(i,t,e,l,n){return r.PutTileAtWorldXY(i,t,e,l,n,this.layer)},putTilesAt:function(i,t,e,l){return r.PutTilesAt(i,t,e,l,this.layer),this},randomize:function(i,t,e,l,n){return r.Randomize(i,t,e,l,n,this.layer),this},removeTileAt:function(i,t,e,l){return r.RemoveTileAt(i,t,e,l,this.layer)},removeTileAtWorldXY:function(i,t,e,l,n){return r.RemoveTileAtWorldXY(i,t,e,l,n,this.layer)},renderDebug:function(i,t){return r.RenderDebug(i,t,this.layer),this},replaceByIndex:function(i,t,e,l,n,s){return r.ReplaceByIndex(i,t,e,l,n,s,this.layer),this},setSkipCull:function(i){return void 0===i&&(i=!0),this.skipCull=i,this},setCullPadding:function(i,t){return void 0===i&&(i=1),void 0===t&&(t=1),this.cullPaddingX=i,this.cullPaddingY=t,this},setCollision:function(i,t,e,l){return r.SetCollision(i,t,e,this.layer,l),this},setCollisionBetween:function(i,t,e,l){return r.SetCollisionBetween(i,t,e,l,this.layer),this},setCollisionByProperty:function(i,t,e){return r.SetCollisionByProperty(i,t,e,this.layer),this},setCollisionByExclusion:function(i,t,e){return r.SetCollisionByExclusion(i,t,e,this.layer),this},setCollisionFromCollisionGroup:function(i,t){return r.SetCollisionFromCollisionGroup(i,t,this.layer),this},setTileIndexCallback:function(i,t,e){return r.SetTileIndexCallback(i,t,e,this.layer),this},setTileLocationCallback:function(i,t,e,l,n,s){return r.SetTileLocationCallback(i,t,e,l,n,s,this.layer),this},shuffle:function(i,t,e,l){return r.Shuffle(i,t,e,l,this.layer),this},swapByIndex:function(i,t,e,l,n,s){return r.SwapByIndex(i,t,e,l,n,s,this.layer),this},tileToWorldX:function(i,t){return r.TileToWorldX(i,t,this.layer)},tileToWorldY:function(i,t){return r.TileToWorldY(i,t,this.layer)},tileToWorldXY:function(i,t,e,l){return r.TileToWorldXY(i,t,e,l,this.layer)},weightedRandomize:function(i,t,e,l,n){return r.WeightedRandomize(i,t,e,l,n,this.layer),this},worldToTileX:function(i,t,e){return r.WorldToTileX(i,t,e,this.layer)},worldToTileY:function(i,t,e){return r.WorldToTileY(i,t,e,this.layer)},worldToTileXY:function(i,t,e,l,n){return r.WorldToTileXY(i,t,e,l,n,this.layer)}});module.exports=n;
},{"../../utils/Class":"JASv","../../gameobjects/components":"VjLH","./DynamicTilemapLayerRender":"vB00","../../gameobjects/GameObject":"AetT","../components":"rgTA"}],"FqMn":[function(require,module,exports) {
var e=function(e,r,t,l){var o=r.tileset,i=r.pipeline,n=i.vertexBuffer;e.setPipeline(i),i.modelIdentity(),i.modelTranslate(r.x-l.scrollX*r.scrollFactorX,r.y-l.scrollY*r.scrollFactorY,0),i.modelScale(r.scaleX,r.scaleY,1),i.viewLoad2D(l.matrix.matrix);for(var a=0;a0&&(e.currentPipeline&&e.currentPipeline.vertexCount>0&&e.flush(),i.vertexBuffer=r.vertexBuffer[a],e.setPipeline(i),e.setTexture2D(o[a].glTexture,0),e.gl.drawArrays(i.topology,0,r.vertexCount[a]));i.vertexBuffer=n,i.viewIdentity(),i.modelIdentity()};module.exports=e;
},{}],"u6jP":[function(require,module,exports) {
var l=function(l,a,e,t,r){a.cull(t);var o=a.culledTiles,i=o.length;if(0!==i){var c=l._tempMatrix1,s=l._tempMatrix2,p=l._tempMatrix3;s.applyITRS(a.x,a.y,a.rotation,a.scaleX,a.scaleY),c.copyFrom(t.matrix);var n=l.currentContext,x=a.gidMap;n.save(),r?(c.multiplyWithOffset(r,-t.scrollX*a.scrollFactorX,-t.scrollY*a.scrollFactorY),s.e=a.x,s.f=a.y,c.multiply(s,p),p.copyToContext(n)):(s.e-=t.scrollX*a.scrollFactorX,s.f-=t.scrollY*a.scrollFactorY,s.copyToContext(n));var f=t.alpha*a.alpha;(!l.antialias||a.scaleX>1||a.scaleY>1)&&(n.imageSmoothingEnabled=!1);for(var m=0;mp||!s.visible||(v=this.batchTile(v,s,a,d,f,e,t));else if(1===y)for(n=0;n=0;h--)!(s=c[n][h])||s.indexp||!s.visible||(v=this.batchTile(v,s,a,d,f,e,t));else if(2===y)for(n=u-1;n>=0;n--)for(h=0;hp||!s.visible||(v=this.batchTile(v,s,a,d,f,e,t));else if(3===y)for(n=u-1;n>=0;n--)for(h=o-1;h>=0;h--)!(s=c[n][h])||s.indexp||!s.visible||(v=this.batchTile(v,s,a,d,f,e,t));this.dirty[t]=!1,null===g?(g=i.createVertexBuffer(x,r.STATIC_DRAW),this.vertexBuffer[t]=g):(i.setVertexBuffer(g),r.bufferSubData(r.ARRAY_BUFFER,0,x))}return this},batchTile:function(e,t,i,r,l,s,n){var a=i.getTileTextureCoordinates(t.index);if(!a)return e;var o=i.tileWidth,u=i.tileHeight,d=o/2,f=u/2,c=a.x/r,y=a.y/l,T=(a.x+o)/r,p=(a.y+u)/l,g=this._tempMatrix,x=-d,v=-f;t.flipX&&(o*=-1,x+=i.tileWidth),t.flipY&&(u*=-1,v+=i.tileHeight);var C=x+o,m=v+u;g.applyITRS(d+t.pixelX,f+t.pixelY,t.rotation,1,1);var b=h.getTintAppendFloatAlpha(16777215,s.alpha*this.alpha*t.alpha),w=g.getX(x,v),W=g.getY(x,v),A=g.getX(x,m),F=g.getY(x,m),X=g.getX(C,m),Y=g.getY(C,m),B=g.getX(C,v),S=g.getY(C,v);s.roundPixels&&(w=Math.round(w),W=Math.round(W),A=Math.round(A),F=Math.round(F),X=Math.round(X),Y=Math.round(Y),B=Math.round(B),S=Math.round(S));var M=this.vertexViewF32[n],V=this.vertexViewU32[n];return M[++e]=w,M[++e]=W,M[++e]=c,M[++e]=y,M[++e]=0,V[++e]=b,M[++e]=A,M[++e]=F,M[++e]=c,M[++e]=p,M[++e]=0,V[++e]=b,M[++e]=X,M[++e]=Y,M[++e]=T,M[++e]=p,M[++e]=0,V[++e]=b,M[++e]=w,M[++e]=W,M[++e]=c,M[++e]=y,M[++e]=0,V[++e]=b,M[++e]=X,M[++e]=Y,M[++e]=T,M[++e]=p,M[++e]=0,V[++e]=b,M[++e]=B,M[++e]=S,M[++e]=T,M[++e]=y,M[++e]=0,V[++e]=b,this.vertexCount[n]+=6,e},setRenderOrder:function(e){if("string"==typeof e&&(e=["right-down","left-down","right-up","left-up"].indexOf(e)),e>=0&&e<4){this._renderOrder=e;for(var t=0;t-1&&(this.renderOrder=e),this},addTilesetImage:function(e,t,i,n,l,s,a){if(void 0===e)return null;if(null==t&&(t=e),!this.scene.sys.textures.exists(t))return console.warn("Invalid Tileset Image: "+t),null;var u=this.scene.sys.textures.get(t),o=this.getTilesetIndex(e);if(null===o&&this.format===r.TILED_JSON)return console.warn("No data found for Tileset: "+e),null;var h=this.tilesets[o];return h?(h.setTileSize(i,n),h.setSpacing(l,s),h.setImage(u),h):(void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===l&&(l=0),void 0===s&&(s=0),void 0===a&&(a=0),(h=new y(e,a,i,n,l,s)).setImage(u),this.tilesets.push(h),h)},convertLayerToStatic:function(e){if(null===(e=this.getLayer(e)))return null;var t=e.tilemapLayer;if(!(t&&t instanceof i))return null;var n=new u(t.scene,t.tilemap,t.layerIndex,t.tileset,t.x,t.y);return this.scene.sys.displayList.add(n),t.destroy(),n},copy:function(e,t,i,n,r,l,s,a){return a=this.getLayer(a),this._isStaticCall(a,"copy")?this:null!==a?(h.Copy(e,t,i,n,r,l,s,a),this):null},createBlankDynamicLayer:function(e,t,n,r,s,a,u,h){if(void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=this.width),void 0===a&&(a=this.height),void 0===u&&(u=this.tileWidth),void 0===h&&(h=this.tileHeight),null!==this.getLayerIndex(e))return console.warn("Invalid Tilemap Layer ID: "+e),null;for(var y,d=new l({name:e,tileWidth:u,tileHeight:h,width:s,height:a}),c=0;c-1&&this.putTileAt(t,l.x,l.y,i,l.tilemapLayer)}return n},removeTileAt:function(e,t,i,n,r){return r=this.getLayer(r),this._isStaticCall(r,"removeTileAt")?null:null===r?null:h.RemoveTileAt(e,t,i,n,r)},removeTileAtWorldXY:function(e,t,i,n,r,l){return l=this.getLayer(l),this._isStaticCall(l,"removeTileAtWorldXY")?null:null===l?null:h.RemoveTileAtWorldXY(e,t,i,n,r,l)},renderDebug:function(e,t,i){return null===(i=this.getLayer(i))?null:(h.RenderDebug(e,t,i),this)},renderDebugFull:function(e,t){for(var i=this.layers,n=0;n0){var t=this.delay+this.delay*this.repeat;return(this.elapsed+this.delay*(this.repeat-this.repeatCount))/t}return this.getProgress()},getRepeatCount:function(){return this.repeatCount},getElapsed:function(){return this.elapsed},getElapsedSeconds:function(){return.001*this.elapsed},remove:function(t){void 0===t&&(t=!1),this.elapsed=this.delay,this.hasDispatched=!t,this.repeatCount=0},destroy:function(){this.callback=void 0,this.callbackScope=void 0,this.args=[]}});module.exports=s;
},{"../utils/Class":"JASv","../utils/object/GetFastValue":"cEup"}],"aDRu":[function(require,module,exports) {
var e=require("../utils/Class"),t=require("../plugins/PluginCache"),s=require("../scene/events"),i=require("./TimerEvent"),n=new e({initialize:function(e){this.scene=e,this.systems=e.sys,this.now=0,this.timeScale=1,this.paused=!1,this._active=[],this._pendingInsertion=[],this._pendingRemoval=[],e.sys.events.once(s.BOOT,this.boot,this),e.sys.events.on(s.START,this.start,this)},boot:function(){this.now=this.systems.game.loop.time,this.systems.events.once(s.DESTROY,this.destroy,this)},start:function(){var e=this.systems.events;e.on(s.PRE_UPDATE,this.preUpdate,this),e.on(s.UPDATE,this.update,this),e.once(s.SHUTDOWN,this.shutdown,this)},addEvent:function(e){var t=new i(e);return this._pendingInsertion.push(t),t},delayedCall:function(e,t,s,i){return this.addEvent({delay:e,callback:t,args:s,callbackScope:i})},clearPendingEvents:function(){return this._pendingInsertion=[],this},removeAllEvents:function(){return this._pendingRemoval=this._pendingRemoval.concat(this._active),this},preUpdate:function(){var e=this._pendingRemoval.length,t=this._pendingInsertion.length;if(0!==e||0!==t){var s,i;for(s=0;s-1&&this._active.splice(n,1),i.destroy()}for(s=0;s=i.delay)){var n=i.elapsed-i.delay;i.elapsed=i.delay,!i.hasDispatched&&i.callback&&(i.hasDispatched=!0,i.callback.apply(i.callbackScope,i.args)),i.repeatCount>0?(i.repeatCount--,i.elapsed=n,i.hasDispatched=!1):this._pendingRemoval.push(i)}}}},shutdown:function(){var e;for(e=0;e0&&(i.totalDuration+=i.t2*i.repeat),i.totalDuration>t&&(t=i.totalDuration),i.delay0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay,this.startDelay=e},init:function(){if(this.paused&&!this.parentIsTimeline)return this.state=r.PENDING_ADD,this._pausedState=r.INIT,!1;for(var t=this.data,e=this.totalTargets,s=0;s0?(this.elapsed=0,this.progress=0,this.loopCounter--,this.resetTweenData(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=r.LOOP_DELAY):(this.state=r.ACTIVE,this.dispatchTweenEvent(s.TWEEN_LOOP,this.callbacks.onLoop))):this.completeDelay>0?(this.state=r.COMPLETE_DELAY,this.countdown=this.completeDelay):(this.state=r.PENDING_REMOVE,this.dispatchTweenEvent(s.TWEEN_COMPLETE,this.callbacks.onComplete))},pause:function(){return this.state===r.PAUSED?this:(this.paused=!0,this._pausedState=this.state,this.state=r.PAUSED,this)},play:function(t){void 0===t&&(t=!1);var e=this.state;return e!==r.INIT||this.parentIsTimeline?e===r.ACTIVE||e===r.PENDING_ADD&&this._pausedState===r.PENDING_ADD?this:this.parentIsTimeline||e!==r.PENDING_REMOVE&&e!==r.REMOVED?(this.parentIsTimeline?(this.resetTweenData(t),0===this.calculatedOffset?this.state=r.ACTIVE:(this.countdown=this.calculatedOffset,this.state=r.OFFSET_DELAY)):this.paused?(this.paused=!1,this.makeActive()):(this.resetTweenData(t),this.state=r.ACTIVE,this.makeActive()),this):(this.seek(0),this.parent.makeActive(this),this):(this.resetTweenData(!1),this.state=r.ACTIVE,this)},resetTweenData:function(t){for(var e=this.data,s=this.totalData,a=this.totalTargets,i=0;i0&&(n.elapsed=n.delay,n.state=r.DELAY),n.getActiveValue&&(h[o]=n.getActiveValue(n.target,n.key,n.start))}},resume:function(){return this.state===r.PAUSED?(this.paused=!1,this.state=this._pausedState):this.play(),this},seek:function(t,e){if(void 0===e&&(e=16.6),this.totalDuration>=36e5)return console.warn("Tween.seek duration too long"),this;this.state===r.REMOVED&&this.makeActive(),this.elapsed=0,this.progress=0,this.totalElapsed=0,this.totalProgress=0;for(var s=this.data,a=this.totalTargets,i=0;i0&&(n.elapsed=n.delay,n.state=r.DELAY)}this.calcDuration();var u=!1;this.state===r.PAUSED&&(u=!0,this.state=r.ACTIVE),this.isSeeking=!0;do{this.update(0,e)}while(this.totalProgress0?(e.repeatCounter--,e.elapsed=a,e.progress=a/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY(),e.start=e.getStartValue(e.target,e.key,e.start,e.index,t.totalTargets,t),e.end=e.getEndValue(e.target,e.key,e.start,e.index,t.totalTargets,t),e.repeatDelay>0?(e.elapsed=e.repeatDelay-a,e.current=e.start,e.target[e.key]=e.current,r.REPEAT_DELAY):(this.dispatchTweenDataEvent(s.TWEEN_REPEAT,t.callbacks.onRepeat,e),r.PLAYING_FORWARD)):r.COMPLETE},setStateFromStart:function(t,e,a){return e.repeatCounter>0?(e.repeatCounter--,e.elapsed=a,e.progress=a/e.duration,e.flipX&&e.target.toggleFlipX(),e.flipY&&e.target.toggleFlipY(),e.end=e.getEndValue(e.target,e.key,e.start,e.index,t.totalTargets,t),e.repeatDelay>0?(e.elapsed=e.repeatDelay-a,e.current=e.start,e.target[e.key]=e.current,r.REPEAT_DELAY):(this.dispatchTweenDataEvent(s.TWEEN_REPEAT,t.callbacks.onRepeat,e),r.PLAYING_FORWARD)):r.COMPLETE},updateTweenData:function(t,e,a){var i=e.target;switch(e.state){case r.PLAYING_FORWARD:case r.PLAYING_BACKWARD:if(!i){e.state=r.COMPLETE;break}var n=e.elapsed,h=e.duration,o=0;(n+=a)>h&&(o=n-h,n=h);var l=e.state===r.PLAYING_FORWARD,p=n/h;if(e.elapsed=n,e.progress=p,e.previous=e.current,1===p)l?(e.current=e.end,i[e.key]=e.end,e.hold>0?(e.elapsed=e.hold-o,e.state=r.HOLD_DELAY):e.state=this.setStateFromEnd(t,e,o)):(e.current=e.start,i[e.key]=e.start,e.state=this.setStateFromStart(t,e,o));else{var u=l?e.ease(p):e.ease(1-p);e.current=e.start+(e.end-e.start)*u,i[e.key]=e.current}this.dispatchTweenDataEvent(s.TWEEN_UPDATE,t.callbacks.onUpdate,e);break;case r.DELAY:e.elapsed-=a,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=r.PENDING_RENDER);break;case r.REPEAT_DELAY:e.elapsed-=a,e.elapsed<=0&&(e.elapsed=Math.abs(e.elapsed),e.state=r.PLAYING_FORWARD,this.dispatchTweenDataEvent(s.TWEEN_REPEAT,t.callbacks.onRepeat,e));break;case r.HOLD_DELAY:e.elapsed-=a,e.elapsed<=0&&(e.state=this.setStateFromEnd(t,e,Math.abs(e.elapsed)));break;case r.PENDING_RENDER:i?(e.start=e.getStartValue(i,e.key,i[e.key],e.index,t.totalTargets,t),e.end=e.getEndValue(i,e.key,e.start,e.index,t.totalTargets,t),e.current=e.start,i[e.key]=e.start,e.state=r.PLAYING_FORWARD):e.state=r.COMPLETE}return e.state!==r.COMPLETE}});h.TYPES=["onActive","onComplete","onLoop","onRepeat","onStart","onUpdate","onYoyo"],i.register("tween",function(t){return this.scene.sys.tweens.add(t)}),a.register("tween",function(t){return this.scene.sys.tweens.create(t)}),module.exports=h;
},{"../../utils/Class":"JASv","eventemitter3":"JJlS","../events":"hKal","../../gameobjects/GameObjectCreator":"vSy1","../../gameobjects/GameObjectFactory":"QDoc","./const":"lmb7","../../math/const":"HC1y"}],"LMHi":[function(require,module,exports) {
var e=function(e,t,a,r,l,o,n,u,d,p,i,s,y,g,c){return{target:e,index:t,key:a,getActiveValue:o,getEndValue:r,getStartValue:l,ease:n,duration:0,totalDuration:0,delay:0,yoyo:p,hold:0,repeat:0,repeatDelay:0,flipX:g,flipY:c,progress:0,elapsed:0,repeatCounter:0,start:0,previous:0,current:0,end:0,t1:0,t2:0,gen:{delay:u,duration:d,hold:i,repeat:s,repeatDelay:y},state:0}};module.exports=e;
},{}],"KBMM":[function(require,module,exports) {
var e=require("../tween/Defaults"),a=require("../../utils/object/GetAdvancedValue"),r=require("./GetBoolean"),t=require("./GetEaseFunction"),o=require("./GetNewValue"),l=require("../../utils/object/GetValue"),u=require("./GetValueOp"),n=require("../tween/Tween"),s=require("../tween/TweenData"),i=function(i,p,c){void 0===c&&(c=e);var d=l(p,"from",0),v=l(p,"to",1),y=[{value:d}],f=o(p,"delay",c.delay),m=o(p,"duration",c.duration),q=l(p,"easeParams",c.easeParams),D=t(l(p,"ease",c.ease),q),w=o(p,"hold",c.hold),h=o(p,"repeat",c.repeat),G=o(p,"repeatDelay",c.repeatDelay),b=r(p,"yoyo",c.yoyo),g=[],P=u("value",v),S=s(y[0],0,"value",P.getEnd,P.getStart,P.getActive,D,f,m,b,w,h,G,!1,!1);S.start=d,S.current=d,S.to=v,g.push(S);var V=new n(i,g,y);V.offset=a(p,"offset",null),V.completeDelay=a(p,"completeDelay",0),V.loop=Math.round(a(p,"loop",0)),V.loopDelay=Math.round(a(p,"loopDelay",0)),V.paused=r(p,"paused",!1),V.useFrames=r(p,"useFrames",!1);for(var E=l(p,"callbackScope",V),F=[V,null],T=n.TYPES,j=0;jG&&(G=N),A[x][I]=N}}}var _=u?r(u):null;return l?function(r,a,t,e){var o,u=0,l=e%F,s=Math.floor(e/F);if(l>=0&&l=0&&s0?this.totalDuration=this.duration+this.completeDelay+(this.duration+this.loopDelay)*this.loopCounter:this.totalDuration=this.duration+this.completeDelay},init:function(){return this.calcDuration(),this.progress=0,this.totalProgress=0,!this.paused||(this.state=a.PAUSED,!1)},resetTweens:function(t){for(var s=0;s0?(this.elapsed=0,this.progress=0,this.loopCounter--,this.resetTweens(!0),this.loopDelay>0?(this.countdown=this.loopDelay,this.state=a.LOOP_DELAY):(this.state=a.ACTIVE,this.dispatchTimelineEvent(e.TIMELINE_LOOP,this.callbacks.onLoop))):this.completeDelay>0?(this.state=a.COMPLETE_DELAY,this.countdown=this.completeDelay):(this.state=a.PENDING_REMOVE,this.dispatchTimelineEvent(e.TIMELINE_COMPLETE,this.callbacks.onComplete))},update:function(t,s){if(this.state!==a.PAUSED){switch(this.useFrames&&(s=1*this.manager.timeScale),s*=this.timeScale,this.elapsed+=s,this.progress=Math.min(this.elapsed/this.duration,1),this.totalElapsed+=s,this.totalProgress=Math.min(this.totalElapsed/this.totalDuration,1),this.state){case a.ACTIVE:for(var i=this.totalData,o=0;o0?Math.floor(v/m.length):l(d,"duration",f.duration),f.delay=l(d,"delay",f.delay),f.easeParams=u(d,"easeParams",f.easeParams),f.ease=t(u(d,"ease",f.ease),f.easeParams),f.hold=l(d,"hold",f.hold),f.repeat=l(d,"repeat",f.repeat),f.repeatDelay=l(d,"repeatDelay",f.repeatDelay),f.yoyo=r(d,"yoyo",f.yoyo),f.flipX=r(d,"flipX",f.flipX),f.flipY=r(d,"flipY",f.flipY);for(var q=0;q-1&&(e.state=u.REMOVED,n.splice(r,1)):(e.state=u.REMOVED,i.splice(r,1))}for(s.length=0,s=this._add,t=0;t>2],s+=n[(3&e[g])<<4|e[g+1]>>4],s+=n[(15&e[g+1])<<2|e[g+2]>>6],s+=n[63&e[g+2]];return a%3==2?s=s.substring(0,s.length-1)+"=":a%3==1&&(s=s.substring(0,s.length-2)+"=="),s};module.exports=r;
},{}],"TMnL":[function(require,module,exports) {
module.exports={ArrayBufferToBase64:require("./ArrayBufferToBase64"),Base64ToArrayBuffer:require("./Base64ToArrayBuffer")};
},{"./ArrayBufferToBase64":"Ausw","./Base64ToArrayBuffer":"q9By"}],"Xc2f":[function(require,module,exports) {
var e=require("./GetValue"),r=require("../../math/Clamp"),u=function(u,a,t,i,o){void 0===o&&(o=t);var l=e(u,a,o);return r(l,t,i)};module.exports=u;
},{"./GetValue":"OqLI","../../math/Clamp":"eCA1"}],"X7Gt":[function(require,module,exports) {
var r=function(r,e){for(var n=0;n0;){this.cameras.pop().destroy()}return this.main},update:function(s,t){for(var e=0,i=this.cameras.length;e0?(s=(o=i)-h,a=this.getSubString(t,s,o)):a="";var c,l=e-h;l>0?(o=(s=0)+l,this.insertIdx=o,c=this.getSubString(t,s,o)):(c="",this.insertIdx=0),r=c+a}return r}},{key:"startTimer",value:function(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:0,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.gameObject.setText(t)}},{key:"getTextLength",value:function(t){var e=this.gameObject;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.gameObject;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}}])&&s(e.prototype,i),t}();Object.assign(a.prototype,n.a);var h=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},c={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},l=a;e.a=l},2:function(t,e,i){"use strict";var n=Phaser.Scene;e.a=function(t){return t instanceof n}},224:function(t,i,n){"use strict";n.r(i);var r=n(136);function s(t){return(s="function"==typeof Symbol&&"symbol"==e(Symbol.iterator)?function(t){return e(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)})(t)}function o(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:1,t=e.toString(),o=[],n=0;n2&&void 0!==arguments[2]?arguments[2]:15e3;i(this,r);var l=1;"No Time Limit"==o.Game.gameModeName&&(l=2*t.WIDTH);return f=u(this,c(r).call(this,e,0,0,l,10,1044942)),"No Time Limit"!=o.Game.gameModeName&&(f.timebarTween=e.scene.scene.tweens.add({targets:a(f),width:{from:0,to:t.WIDTH},ease:"Linear",duration:s,repeat:0,yoyo:!1,onComplete:function(){e.scene.remove("PlayScene"),e.scene.start("GameOverScene")}})),e.add.existing(a(f)),f}return f(r,e.default.GameObjects.Rectangle),r}(),p=l;exports.default=p;
},{"phaser":"g7IM","../config":"itQ5","../state":"dm40"}],"Xoal":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("../config");function s(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function i(t,s){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:1;this.graphics=this.scene.add.graphics(),this.graphics.lineStyle(2,16711680,t);for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:1;this.show(t);for(var s=0,i=0;i1&&(this.input=new Array(t)),1===e?this.output=this.context.createGain():e>1&&(this.output=new Array(e))},Object.defineProperty(s.default.AudioNode.prototype,"channelCount",{get:function(){return this.output.channelCount},set:function(t){return this.output.channelCount=t}}),Object.defineProperty(s.default.AudioNode.prototype,"channelCountMode",{get:function(){return this.output.channelCountMode},set:function(t){return this.output.channelCountMode=t}}),Object.defineProperty(s.default.AudioNode.prototype,"channelInterpretation",{get:function(){return this.output.channelInterpretation},set:function(t){return this.output.channelInterpretation=t}}),Object.defineProperty(s.default.AudioNode.prototype,"numberOfInputs",{get:function(){return this.input?s.default.isArray(this.input)?this.input.length:1:0}}),Object.defineProperty(s.default.AudioNode.prototype,"numberOfOutputs",{get:function(){return this.output?s.default.isArray(this.output)?this.output.length:1:0}}),s.default.AudioNode.prototype.connect=function(t,e,i){return s.default.isArray(this.output)?(e=s.default.defaultArg(e,0),this.output[e].connect(t,0,i)):s.default.connect(this.output,t,e,i),this},s.default.AudioNode.prototype.disconnect=function(t,e,i){return s.default.isArray(this.output)?(e=s.default.defaultArg(e,0),this.output[e].disconnect(t,0,i)):s.default.disconnect(this.output,t,e,i),this},s.default.AudioNode.prototype.chain=function(){var t=Array.from(arguments);return t.unshift(this),s.default.connectSeries.apply(void 0,t),this},s.default.AudioNode.prototype.fan=function(){for(var t=0;t0){var i=this._state.get(e);if(i&&i.state===s.default.State.Started&&i.time!==e){var n,o=e-this.toSeconds(i.time);i.duration&&(n=this.toSeconds(i.duration)-o),this._start(t,this.toSeconds(i.offset)+o,n)}}}.bind(this),this._syncedStop=function(t){var e=s.default.Transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));this._state.getValueAtTime(e)===s.default.State.Started&&this._stop(t)}.bind(this),s.default.Transport.on("start loopStart",this._syncedStart),s.default.Transport.on("stop pause loopEnd",this._syncedStop),this},s.default.Source.prototype.unsync=function(){this._synced&&(s.default.Transport.off("stop pause loopEnd",this._syncedStop),s.default.Transport.off("start loopStart",this._syncedStart)),this._synced=!1;for(var t=0;t0}}),Object.defineProperty(s.default.Buffer.prototype,"duration",{get:function(){return this._buffer?this._buffer.duration:0}}),Object.defineProperty(s.default.Buffer.prototype,"length",{get:function(){return this._buffer?this._buffer.length:0}}),Object.defineProperty(s.default.Buffer.prototype,"numberOfChannels",{get:function(){return this._buffer?this._buffer.numberOfChannels:0}}),s.default.Buffer.prototype.fromArray=function(t){var e=t[0].length>0,i=e?t.length:1,s=e?t[0].length:t.length,n=this.context.createBuffer(i,s,this.context.sampleRate);e||1!==i||(t=[t]);for(var o=0;o0&&e%this._ppq!=0&&e%(2*this._swingTicks)!=0){var i=e%(2*this._swingTicks)/(2*this._swingTicks),n=Math.sin(i*Math.PI)*this._swingAmount;t+=s.default.Ticks(2*this._swingTicks/3).toSeconds()*n}this.loop&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._timeline.forEachAtTime(e,function(e){e.invoke(t)})},s.default.Transport.prototype.schedule=function(t,e){var i=new s.default.TransportEvent(this,{time:s.default.TransportTime(e),callback:t});return this._addEvent(i,this._timeline)},s.default.Transport.prototype.scheduleRepeat=function(t,e,i,n){var o=new s.default.TransportRepeatEvent(this,{callback:t,interval:s.default.Time(e),time:s.default.TransportTime(i),duration:s.default.Time(s.default.defaultArg(n,1/0))});return this._addEvent(o,this._repeatedEvents)},s.default.Transport.prototype.scheduleOnce=function(t,e){var i=new s.default.TransportEvent(this,{time:s.default.TransportTime(e),callback:t,once:!0});return this._addEvent(i,this._timeline)},s.default.Transport.prototype.clear=function(t){if(this._scheduledEvents.hasOwnProperty(t)){var e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this},s.default.Transport.prototype._addEvent=function(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id},s.default.Transport.prototype.cancel=function(t){return t=s.default.defaultArg(t,0),t=this.toTicks(t),this._timeline.forEachFrom(t,function(t){this.clear(t.id)}.bind(this)),this._repeatedEvents.forEachFrom(t,function(t){this.clear(t.id)}.bind(this)),this},s.default.Transport.prototype._bindClockEvents=function(){this._clock.on("start",function(t,e){e=s.default.Ticks(e).toSeconds(),this.emit("start",t,e)}.bind(this)),this._clock.on("stop",function(t){this.emit("stop",t)}.bind(this)),this._clock.on("pause",function(t){this.emit("pause",t)}.bind(this))},Object.defineProperty(s.default.Transport.prototype,"state",{get:function(){return this._clock.getStateAtTime(this.now())}}),s.default.Transport.prototype.start=function(t,e){return s.default.isDefined(e)&&(e=this.toTicks(e)),this._clock.start(t,e),this},s.default.Transport.prototype.stop=function(t){return this._clock.stop(t),this},s.default.Transport.prototype.pause=function(t){return this._clock.pause(t),this},s.default.Transport.prototype.toggle=function(t){return t=this.toSeconds(t),this._clock.getStateAtTime(t)!==s.default.State.Started?this.start(t):this.stop(t),this},Object.defineProperty(s.default.Transport.prototype,"timeSignature",{get:function(){return this._timeSignature},set:function(t){s.default.isArray(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}}),Object.defineProperty(s.default.Transport.prototype,"loopStart",{get:function(){return s.default.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t)}}),Object.defineProperty(s.default.Transport.prototype,"loopEnd",{get:function(){return s.default.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t)}}),s.default.Transport.prototype.setLoopPoints=function(t,e){return this.loopStart=t,this.loopEnd=e,this},Object.defineProperty(s.default.Transport.prototype,"swing",{get:function(){return this._swingAmount},set:function(t){this._swingAmount=t}}),Object.defineProperty(s.default.Transport.prototype,"swingSubdivision",{get:function(){return s.default.Ticks(this._swingTicks).toNotation()},set:function(t){this._swingTicks=this.toTicks(t)}}),Object.defineProperty(s.default.Transport.prototype,"position",{get:function(){var t=this.now(),e=this._clock.getTicksAtTime(t);return s.default.Ticks(e).toBarsBeatsSixteenths()},set:function(t){var e=this.toTicks(t);this.ticks=e}}),Object.defineProperty(s.default.Transport.prototype,"seconds",{get:function(){return this._clock.seconds},set:function(t){var e=this.now(),i=this.bpm.timeToTicks(t,e);this.ticks=i}}),Object.defineProperty(s.default.Transport.prototype,"progress",{get:function(){if(this.loop){var t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}}),Object.defineProperty(s.default.Transport.prototype,"ticks",{get:function(){return this._clock.ticks},set:function(t){if(this._clock.ticks!==t){var e=this.now();this.state===s.default.State.Started?(this.emit("stop",e),this._clock.setTicksAtTime(t,e),this.emit("start",e,this.seconds)):this._clock.setTicksAtTime(t,e)}}}),s.default.Transport.prototype.getTicksAtTime=function(t){return Math.round(this._clock.getTicksAtTime(t))},s.default.Transport.prototype.getSecondsAtTime=function(t){return this._clock.getSecondsAtTime(t)},Object.defineProperty(s.default.Transport.prototype,"PPQ",{get:function(){return this._ppq},set:function(t){var e=this.bpm.value;this._ppq=t,this.bpm.value=e}}),s.default.Transport.prototype._fromUnits=function(t){return 1/(60/t/this.PPQ)},s.default.Transport.prototype._toUnits=function(t){return t/this.PPQ*60},s.default.Transport.prototype.nextSubdivision=function(t){if(t=this.toTicks(t),this.state!==s.default.State.Started)return 0;var e=this.now(),i=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(i,e)},s.default.Transport.prototype.syncSignal=function(t,e){if(!e){var i=this.now();e=0!==t.getValueAtTime(i)?t.getValueAtTime(i)/this.bpm.getValueAtTime(i):0}var n=new s.default.Gain(e);return this.bpm.chain(n,t._param),this._syncedSignals.push({ratio:n,signal:t,initial:t.value}),t.value=0,this},s.default.Transport.prototype.unsyncSignal=function(t){for(var e=this._syncedSignals.length-1;e>=0;e--){var i=this._syncedSignals[e];i.signal===t&&(i.ratio.dispose(),i.signal.value=i.initial,this._syncedSignals.splice(e,1))}return this},s.default.Transport.prototype.dispose=function(){return s.default.Emitter.prototype.dispose.call(this),this._clock.dispose(),this._clock=null,this._writable("bpm"),this.bpm=null,this._timeline.dispose(),this._timeline=null,this._repeatedEvents.dispose(),this._repeatedEvents=null,this};var n=s.default.Transport;s.default.Transport=new n,s.default.Context.on("init",function(t){t.transport&&t.transport.isTransport?s.default.Transport=t.transport:s.default.Transport=new n}),s.default.Context.on("close",function(t){t.transport&&t.transport.isTransport&&t.transport.dispose()}),e.default=s.default.Transport},function(t,e,i){"use strict";i.r(e);var s=i(0);i(2),i(6),i(16),i(64),s.default.Oscillator=function(){var t=s.default.defaults(arguments,["frequency","type"],s.default.Oscillator);s.default.Source.call(this,t),this._oscillator=null,this.frequency=new s.default.Signal(t.frequency,s.default.Type.Frequency),this.detune=new s.default.Signal(t.detune,s.default.Type.Cents),this._wave=null,this._partials=t.partials,this._partialCount=t.partialCount,this._phase=t.phase,this._type=t.type,t.partialCount&&t.type!==s.default.Oscillator.Type.Custom&&(this._type=this.baseType+t.partialCount.toString()),this.phase=this._phase,this._readOnly(["frequency","detune"])},s.default.extend(s.default.Oscillator,s.default.Source),s.default.Oscillator.defaults={type:"sine",frequency:440,detune:0,phase:0,partials:[],partialCount:0},s.default.Oscillator.Type={Sine:"sine",Triangle:"triangle",Sawtooth:"sawtooth",Square:"square",Custom:"custom"},s.default.Oscillator.prototype._start=function(t){this.log("start",t);var e=new s.default.OscillatorNode;this._oscillator=e,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),t=this.toSeconds(t),this._oscillator.start(t)},s.default.Oscillator.prototype._stop=function(t){return this.log("stop",t),this._oscillator&&(t=this.toSeconds(t),this._oscillator.stop(t)),this},s.default.Oscillator.prototype.restart=function(t){return this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(this.toSeconds(t)),this},s.default.Oscillator.prototype.syncFrequency=function(){return s.default.Transport.syncSignal(this.frequency),this},s.default.Oscillator.prototype.unsyncFrequency=function(){return s.default.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(s.default.Oscillator.prototype,"type",{get:function(){return this._type},set:function(t){var e=[s.default.Oscillator.Type.Sine,s.default.Oscillator.Type.Square,s.default.Oscillator.Type.Triangle,s.default.Oscillator.Type.Sawtooth].includes(t);if(0===this._phase&&e)this._wave=null,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=t);else{var i=this._getRealImaginary(t,this._phase),n=this.context.createPeriodicWave(i[0],i[1]);this._wave=n,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}this._type=t}}),Object.defineProperty(s.default.Oscillator.prototype,"baseType",{get:function(){return this._type.replace(this.partialCount,"")},set:function(t){this.partialCount&&this._type!==s.default.Oscillator.Type.Custom&&t!==s.default.Oscillator.Type.Custom?this.type=t+this.partialCount:this.type=t}}),Object.defineProperty(s.default.Oscillator.prototype,"partialCount",{get:function(){return this._partialCount},set:function(t){var e=this._type,i=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);i&&(e=i[1]),this._type!==s.default.Oscillator.Type.Custom&&(this.type=0===t?e:e+t.toString())}}),s.default.Oscillator.prototype.get=function(){var t=s.default.prototype.get.apply(this,arguments);return t.type!==s.default.Oscillator.Type.Custom&&delete t.partials,t},s.default.Oscillator.prototype._getRealImaginary=function(t,e){var i=2048,n=new Float32Array(i),o=new Float32Array(i),a=1;if(t===s.default.Oscillator.Type.Custom)a=this._partials.length+1,this._partialCount=this._partials.length,i=a;else{var r=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);r?(a=parseInt(r[2])+1,this._partialCount=parseInt(r[2]),t=r[1],i=a=Math.max(a,2)):this._partialCount=0,this._partials=[]}for(var l=1;l>1&1?-1:1):0,this._partials[l-1]=u;break;case s.default.Oscillator.Type.Custom:u=this._partials[l-1];break;default:throw new TypeError("Tone.Oscillator: invalid type: "+t)}0!==u?(n[l]=-u*Math.sin(e*l),o[l]=u*Math.cos(e*l)):(n[l]=0,o[l]=0)}return[n,o]},s.default.Oscillator.prototype._inverseFFT=function(t,e,i){for(var s=0,n=t.length,o=0;othis.memory){var i=this.length-this.memory;this._timeline.splice(0,i)}return this},s.default.Timeline.prototype.remove=function(t){var e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this},s.default.Timeline.prototype.get=function(t,e){e=s.default.defaultArg(e,"time");var i=this._search(t,e);return-1!==i?this._timeline[i]:null},s.default.Timeline.prototype.peek=function(){return this._timeline[0]},s.default.Timeline.prototype.shift=function(){return this._timeline.shift()},s.default.Timeline.prototype.getAfter=function(t,e){e=s.default.defaultArg(e,"time");var i=this._search(t,e);return i+10&&this._timeline[i-1][e]=0?this._timeline[n-1]:null},s.default.Timeline.prototype.cancel=function(t){if(this._timeline.length>1){var e=this._search(t);if(e>=0)if(this._timeline[e].time===t){for(var i=e;i>=0&&this._timeline[i].time===t;i--)e=i;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&this._timeline[0].time>=t&&(this._timeline=[]);return this},s.default.Timeline.prototype.cancelBefore=function(t){var e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this},s.default.Timeline.prototype.previousEvent=function(t){var e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null},s.default.Timeline.prototype._search=function(t,e){if(0===this._timeline.length)return-1;e=s.default.defaultArg(e,"time");var i=0,n=this._timeline.length,o=n;if(n>0&&this._timeline[n-1][e]<=t)return n-1;for(;it)return a;r[e]>t?o=a:i=a+1}return-1},s.default.Timeline.prototype._iterate=function(t,e,i){e=s.default.defaultArg(e,0),i=s.default.defaultArg(i,this._timeline.length-1),this._timeline.slice(e,i+1).forEach(function(e){t.call(this,e)}.bind(this))},s.default.Timeline.prototype.forEach=function(t){return this._iterate(t),this},s.default.Timeline.prototype.forEachBefore=function(t,e){var i=this._search(t);return-1!==i&&this._iterate(e,0,i),this},s.default.Timeline.prototype.forEachAfter=function(t,e){var i=this._search(t);return this._iterate(e,i+1),this},s.default.Timeline.prototype.forEachBetween=function(t,e,i){var s=this._search(t),n=this._search(e);return-1!==s&&-1!==n?(this._timeline[s].time!==t&&(s+=1),this._timeline[n].time===e&&(n-=1),this._iterate(i,s,n)):-1===s&&this._iterate(i,0,n),this},s.default.Timeline.prototype.forEachFrom=function(t,e){for(var i=this._search(t);i>=0&&this._timeline[i].time>=t;)i--;return this._iterate(e,i+1),this},s.default.Timeline.prototype.forEachAtTime=function(t,e){var i=this._search(t);return-1!==i&&this._iterate(function(i){i.time===t&&e.call(this,i)},0,i),this},s.default.Timeline.prototype.dispose=function(){return s.default.prototype.dispose.call(this),this._timeline=null,this},e.default=s.default.Timeline},function(t,e,i){"use strict";i.r(e);var s=i(0);i(21),i(2),s.default.Monophonic=function(t){t=s.default.defaultArg(t,s.default.Monophonic.defaults),s.default.Instrument.call(this,t),this.portamento=t.portamento},s.default.extend(s.default.Monophonic,s.default.Instrument),s.default.Monophonic.defaults={portamento:0},s.default.Monophonic.prototype.triggerAttack=function(t,e,i){return this.log("triggerAttack",t,e,i),e=this.toSeconds(e),this._triggerEnvelopeAttack(e,i),this.setNote(t,e),this},s.default.Monophonic.prototype.triggerRelease=function(t){return this.log("triggerRelease",t),t=this.toSeconds(t),this._triggerEnvelopeRelease(t),this},s.default.Monophonic.prototype._triggerEnvelopeAttack=function(){},s.default.Monophonic.prototype._triggerEnvelopeRelease=function(){},s.default.Monophonic.prototype.getLevelAtTime=function(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)},s.default.Monophonic.prototype.setNote=function(t,e){if(e=this.toSeconds(e),this.portamento>0&&this.getLevelAtTime(e)>.05){var i=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(t,i,e)}else this.frequency.setValueAtTime(t,e);return this},e.default=s.default.Monophonic},function(t,e,i){"use strict";i.r(e);var s=i(0);i(29),i(5),i(2),s.default.Scale=function(t,e){s.default.SignalBase.call(this),this._outputMin=s.default.defaultArg(t,0),this._outputMax=s.default.defaultArg(e,1),this._scale=this.input=new s.default.Multiply(1),this._add=this.output=new s.default.Add(0),this._scale.connect(this._add),this._setRange()},s.default.extend(s.default.Scale,s.default.SignalBase),Object.defineProperty(s.default.Scale.prototype,"min",{get:function(){return this._outputMin},set:function(t){this._outputMin=t,this._setRange()}}),Object.defineProperty(s.default.Scale.prototype,"max",{get:function(){return this._outputMax},set:function(t){this._outputMax=t,this._setRange()}}),s.default.Scale.prototype._setRange=function(){this._add.value=this._outputMin,this._scale.value=this._outputMax-this._outputMin},s.default.Scale.prototype.dispose=function(){return s.default.SignalBase.prototype.dispose.call(this),this._add.dispose(),this._add=null,this._scale.dispose(),this._scale=null,this},e.default=s.default.Scale},function(t,e,i){"use strict";i.r(e);var s=i(0);i(2),i(3),i(1),s.default.Volume=function(){var t=s.default.defaults(arguments,["volume"],s.default.Volume);s.default.AudioNode.call(this,t),this.output=this.input=new s.default.Gain(t.volume,s.default.Type.Decibels),this._unmutedVolume=t.volume,this.volume=this.output.gain,this._readOnly("volume"),this.mute=t.mute},s.default.extend(s.default.Volume,s.default.AudioNode),s.default.Volume.defaults={volume:0,mute:!1},Object.defineProperty(s.default.Volume.prototype,"mute",{get:function(){return this.volume.value===-1/0},set:function(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}}),s.default.Volume.prototype.dispose=function(){return this.input.dispose(),s.default.AudioNode.prototype.dispose.call(this),this._writable("volume"),this.volume.dispose(),this.volume=null,this},e.default=s.default.Volume},function(t,e,i){"use strict";i.r(e);var s=i(0);i(3),i(30),s.default.Zero=function(){s.default.SignalBase.call(this),this._gain=this.input=this.output=new s.default.Gain,s.default.connect(this.context.getConstant(0),this._gain)},s.default.extend(s.default.Zero,s.default.SignalBase),s.default.Zero.prototype.dispose=function(){return s.default.SignalBase.prototype.dispose.call(this),this._gain.dispose(),this._gain=null,this},e.default=s.default.Zero},function(t,e,i){"use strict";i.r(e);var s=i(0);i(2),i(3),s.default.Add=function(t){s.default.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.input[1]=this.output=new s.default.Gain,this._param=this.input[1]=new s.default.Signal(t),this._param.connect(this._sum)},s.default.extend(s.default.Add,s.default.Signal),s.default.Add.prototype.dispose=function(){return s.default.Signal.prototype.dispose.call(this),this._sum.dispose(),this._sum=null,this},e.default=s.default.Add},function(t,e,i){"use strict";i.r(e);var s=i(0);i(1),s.default.SignalBase=function(){s.default.AudioNode.call(this)},s.default.extend(s.default.SignalBase,s.default.AudioNode),s.default.SignalBase.prototype.connect=function(t,e,i){return s.default.Signal&&s.default.Signal===t.constructor||s.default.Param&&s.default.Param===t.constructor?(t._param.cancelScheduledValues(0),t._param.setValueAtTime(0,0),t.overridden=!0):t instanceof AudioParam&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0)),s.default.AudioNode.prototype.connect.call(this,t,e,i),this},e.default=s.default.SignalBase},function(t,e,i){"use strict";i.r(e);var s=i(0);i(47),i(3),s.default.AmplitudeEnvelope=function(){s.default.Envelope.apply(this,arguments),this.input=this.output=new s.default.Gain,this._sig.connect(this.output.gain)},s.default.extend(s.default.AmplitudeEnvelope,s.default.Envelope),s.default.AmplitudeEnvelope.prototype.dispose=function(){return s.default.Envelope.prototype.dispose.call(this),this},e.default=s.default.AmplitudeEnvelope},function(t,e,i){"use strict";i.r(e);var s=i(0);i(11),i(6),i(3),i(1),s.default.BufferSource=function(){var t=s.default.defaults(arguments,["buffer","onload"],s.default.BufferSource);s.default.AudioNode.call(this,t),this.onended=t.onended,this._startTime=-1,this._sourceStarted=!1,this._sourceStopped=!1,this._stopTime=-1,this._gainNode=this.output=new s.default.Gain(0),this._source=this.context.createBufferSource(),s.default.connect(this._source,this._gainNode),this._source.onended=this._onended.bind(this),this._buffer=new s.default.Buffer(t.buffer,t.onload),this.playbackRate=new s.default.Param({param:this._source.playbackRate,units:s.default.Type.Positive,value:t.playbackRate}),this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut,this.curve=t.curve,this._onendedTimeout=-1,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd},s.default.extend(s.default.BufferSource,s.default.AudioNode),s.default.BufferSource.defaults={onended:s.default.noOp,onload:s.default.noOp,loop:!1,loopStart:0,loopEnd:0,fadeIn:0,fadeOut:0,curve:"linear",playbackRate:1},Object.defineProperty(s.default.BufferSource.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),s.default.BufferSource.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),-1!==this._startTime&&this._startTime<=t&&(-1===this._stopTime||t0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this.curve?this._gainNode.gain.linearRampToValueAtTime(n,t+o):this._gainNode.gain.exponentialApproachValueAtTime(n,t,o)):this._gainNode.gain.setValueAtTime(n,t),this._startTime=t,s.default.isDefined(i)){var a=this.toSeconds(i);a=Math.max(a,0),this.stop(t+a)}if(this.loop){var r=this.loopEnd||this.buffer.duration,l=this.loopStart;e>=r&&(e=(e-l)%(r-l)+l)}return this._source.buffer=this.buffer.get(),this._source.loopEnd=this.loopEnd||this.buffer.duration,e0?"linear"===this.curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),s.default.context.clearTimeout(this._onendedTimeout),this._onendedTimeout=s.default.context.setTimeout(this._onended.bind(this),this._stopTime-this.now()),this},s.default.BufferSource.prototype.cancelStop=function(){if(-1!==this._startTime&&!this._sourceStopped){var t=this.toSeconds(this.fadeIn);this._gainNode.gain.cancelScheduledValues(this._startTime+t+this.sampleTime),this.context.clearTimeout(this._onendedTimeout),this._stopTime=-1}return this},s.default.BufferSource.prototype._onended=function(){if(!this._sourceStopped){this._sourceStopped=!0;var t="exponential"===this.curve?2*this.fadeOut:0;this._sourceStarted&&-1!==this._stopTime&&this._source.stop(this._stopTime+t),this.onended(this),setTimeout(function(){this._source&&(this._source.disconnect(),this._gainNode.disconnect())}.bind(this),1e3*t+100)}},Object.defineProperty(s.default.BufferSource.prototype,"loopStart",{get:function(){return this._source.loopStart},set:function(t){this._source.loopStart=this.toSeconds(t)}}),Object.defineProperty(s.default.BufferSource.prototype,"loopEnd",{get:function(){return this._source.loopEnd},set:function(t){this._source.loopEnd=this.toSeconds(t)}}),Object.defineProperty(s.default.BufferSource.prototype,"buffer",{get:function(){return this._buffer},set:function(t){this._buffer.set(t)}}),Object.defineProperty(s.default.BufferSource.prototype,"loop",{get:function(){return this._source.loop},set:function(t){this._source.loop=t,this.cancelStop()}}),s.default.BufferSource.prototype.dispose=function(){return this._wasDisposed||(this._wasDisposed=!0,s.default.AudioNode.prototype.dispose.call(this),this.onended=null,this._source.onended=null,this._source.disconnect(),this._source=null,this._gainNode.dispose(),this._gainNode=null,this._buffer.dispose(),this._buffer=null,this._startTime=-1,this.playbackRate=null,s.default.context.clearTimeout(this._onendedTimeout)),this},e.default=s.default.BufferSource},function(t,e,i){"use strict";i.r(e);var s=i(0);i(8),i(2),i(5),i(3),s.default.FeedbackEffect=function(){var t=s.default.defaults(arguments,["feedback"],s.default.FeedbackEffect);s.default.Effect.call(this,t),this._feedbackGain=new s.default.Gain(t.feedback,s.default.Type.NormalRange),this.feedback=this._feedbackGain.gain,this.effectReturn.chain(this._feedbackGain,this.effectSend),this._readOnly(["feedback"])},s.default.extend(s.default.FeedbackEffect,s.default.Effect),s.default.FeedbackEffect.defaults={feedback:.125},s.default.FeedbackEffect.prototype.dispose=function(){return s.default.Effect.prototype.dispose.call(this),this._writable(["feedback"]),this._feedbackGain.dispose(),this._feedbackGain=null,this.feedback=null,this},e.default=s.default.FeedbackEffect},function(t,e,i){"use strict";i.r(e);var s=i(0);i(24),i(4),s.default.TimelineState=function(t){s.default.Timeline.call(this),this._initial=t},s.default.extend(s.default.TimelineState,s.default.Timeline),s.default.TimelineState.prototype.getValueAtTime=function(t){var e=this.get(t);return null!==e?e.state:this._initial},s.default.TimelineState.prototype.setStateAtTime=function(t,e){return this.add({state:t,time:e}),this},s.default.TimelineState.prototype.getLastState=function(t,e){e=this.toSeconds(e);for(var i=this._search(e);i>=0;i--){var s=this._timeline[i];if(s.state===t)return s}},s.default.TimelineState.prototype.getNextState=function(t,e){e=this.toSeconds(e);var i=this._search(e);if(-1!==i)for(var s=i;s0&&(i=(1-o)/(1/i)),0===i)this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,i,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,i,t);else if(i>0){this._sig.cancelAndHoldAtTime(t);for(var a=this._attackCurve,r=1;r0){var i=this.toSeconds(this.release);if("linear"===this._releaseCurve)this._sig.linearRampTo(0,i,t);else if("exponential"===this._releaseCurve)this._sig.targetRampTo(0,i,t);else{var n=this._releaseCurve;s.default.isArray(n)&&(this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(n,t,i,e))}}return this},s.default.Envelope.prototype.getValueAtTime=function(t){return this._sig.getValueAtTime(t)},s.default.Envelope.prototype.triggerAttackRelease=function(t,e,i){return e=this.toSeconds(e),this.triggerAttack(e,i),this.triggerRelease(e+this.toSeconds(t)),this},s.default.Envelope.prototype.cancel=function(t){return this._sig.cancelScheduledValues(t),this},s.default.Envelope.prototype.connect=s.default.SignalBase.prototype.connect,function(){var t,e,i=[];for(t=0;t<128;t++)i[t]=Math.sin(t/127*(Math.PI/2));var n=[];for(t=0;t<127;t++){e=t/127;var o=Math.sin(e*(2*Math.PI)*6.4-Math.PI/2)+1;n[t]=o/10+.83*e}n[127]=1;var a=[];for(t=0;t<128;t++)a[t]=Math.ceil(t/127*5)/5;var r=[];for(t=0;t<128;t++)e=t/127,r[t]=.5*(1-Math.cos(Math.PI*e));var l,u=[];for(t=0;t<128;t++){e=t/127;var d=4*Math.pow(e,3)+.2,f=Math.cos(d*Math.PI*2*e);u[t]=Math.abs(f*(1-e))}function h(t){for(var e=new Array(t.length),i=0;i1){e=1/0,s.default.isNumber(this._loop)&&(e=this._loop*this._getLoopDuration());var n=this._state.getAfter(i);null!==n&&(e=Math.min(e,n.time-i)),e!==1/0&&(this._state.setStateAtTime(s.default.State.Stopped,i+e+1),e=s.default.Ticks(e));var o=s.default.Ticks(this._getLoopDuration());t.id=s.default.Transport.scheduleRepeat(this._tick.bind(this),o,s.default.Ticks(i),e)}else t.id=s.default.Transport.schedule(this._tick.bind(this),s.default.Ticks(i))}}.bind(this)),this},Object.defineProperty(s.default.Event.prototype,"state",{get:function(){return this._state.getValueAtTime(s.default.Transport.ticks)}}),Object.defineProperty(s.default.Event.prototype,"startOffset",{get:function(){return this._startOffset},set:function(t){this._startOffset=t}}),Object.defineProperty(s.default.Event.prototype,"probability",{get:function(){return this._probability},set:function(t){this._probability=t}}),Object.defineProperty(s.default.Event.prototype,"humanize",{get:function(){return this._humanize},set:function(t){this._humanize=t}}),s.default.Event.prototype.start=function(t){return t=this.toTicks(t),this._state.getValueAtTime(t)===s.default.State.Stopped&&(this._state.add({state:s.default.State.Started,time:t,id:void 0}),this._rescheduleEvents(t)),this},s.default.Event.prototype.stop=function(t){if(this.cancel(t),t=this.toTicks(t),this._state.getValueAtTime(t)===s.default.State.Started){this._state.setStateAtTime(s.default.State.Stopped,t);var e=this._state.getBefore(t),i=t;null!==e&&(i=e.time),this._rescheduleEvents(i)}return this},s.default.Event.prototype.cancel=function(t){return t=s.default.defaultArg(t,-1/0),t=this.toTicks(t),this._state.forEachFrom(t,function(t){s.default.Transport.clear(t.id)}),this._state.cancel(t),this},s.default.Event.prototype._tick=function(t){var e=s.default.Transport.getTicksAtTime(t);if(!this.mute&&this._state.getValueAtTime(e)===s.default.State.Started){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){var i=.02;s.default.isBoolean(this.humanize)||(i=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*i}this.callback(t,this.value)}},s.default.Event.prototype._getLoopDuration=function(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)},Object.defineProperty(s.default.Event.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this._rescheduleEvents()}}),Object.defineProperty(s.default.Event.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._rescheduleEvents()}}),Object.defineProperty(s.default.Event.prototype,"loopEnd",{get:function(){return s.default.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(s.default.Event.prototype,"loopStart",{get:function(){return s.default.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(s.default.Event.prototype,"progress",{get:function(){if(this._loop){var t=s.default.Transport.ticks,e=this._state.get(t);if(null!==e&&e.state===s.default.State.Started){var i=this._getLoopDuration();return(t-e.time)%i/i}return 0}return 0}}),s.default.Event.prototype.dispose=function(){this.cancel(),this._state.dispose(),this._state=null,this.callback=null,this.value=null},e.default=s.default.Event},function(t,e,i){"use strict";i.r(e);var s=i(0);i(2),i(13),i(29),i(10),i(3),i(1),s.default.MidSideMerge=function(){s.default.AudioNode.call(this),this.createInsOuts(2,0),this.mid=this.input[0]=new s.default.Gain,this._left=new s.default.Add,this._timesTwoLeft=new s.default.Multiply(Math.SQRT1_2),this.side=this.input[1]=new s.default.Gain,this._right=new s.default.Subtract,this._timesTwoRight=new s.default.Multiply(Math.SQRT1_2),this._merge=this.output=new s.default.Merge,this.mid.connect(this._left,0,0),this.side.connect(this._left,0,1),this.mid.connect(this._right,0,0),this.side.connect(this._right,0,1),this._left.connect(this._timesTwoLeft),this._right.connect(this._timesTwoRight),this._timesTwoLeft.connect(this._merge,0,0),this._timesTwoRight.connect(this._merge,0,1)},s.default.extend(s.default.MidSideMerge,s.default.AudioNode),s.default.MidSideMerge.prototype.dispose=function(){return s.default.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._left.dispose(),this._left=null,this._timesTwoLeft.dispose(),this._timesTwoLeft=null,this._right.dispose(),this._right=null,this._timesTwoRight.dispose(),this._timesTwoRight=null,this._merge.dispose(),this._merge=null,this},e.default=s.default.MidSideMerge},function(t,e,i){"use strict";i.r(e);var s=i(0);i(29),i(13),i(2),i(19),i(1),s.default.MidSideSplit=function(){s.default.AudioNode.call(this),this.createInsOuts(0,2),this._split=this.input=new s.default.Split,this._midAdd=new s.default.Add,this.mid=this.output[0]=new s.default.Multiply(Math.SQRT1_2),this._sideSubtract=new s.default.Subtract,this.side=this.output[1]=new s.default.Multiply(Math.SQRT1_2),this._split.connect(this._midAdd,0,0),this._split.connect(this._midAdd,1,1),this._split.connect(this._sideSubtract,0,0),this._split.connect(this._sideSubtract,1,1),this._midAdd.connect(this.mid),this._sideSubtract.connect(this.side)},s.default.extend(s.default.MidSideSplit,s.default.AudioNode),s.default.MidSideSplit.prototype.dispose=function(){return s.default.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midAdd.dispose(),this._midAdd=null,this._sideSubtract.dispose(),this._sideSubtract=null,this._split.dispose(),this._split=null,this},e.default=s.default.MidSideSplit},function(t,e,i){"use strict";i.r(e);var s=i(0);i(2),i(9),i(1),i(59),s.default.LowpassCombFilter=function(){var t=s.default.defaults(arguments,["delayTime","resonance","dampening"],s.default.LowpassCombFilter);s.default.AudioNode.call(this),this._combFilter=this.output=new s.default.FeedbackCombFilter(t.delayTime,t.resonance),this.delayTime=this._combFilter.delayTime,this._lowpass=this.input=new s.default.Filter({frequency:t.dampening,type:"lowpass",Q:0,rolloff:-12}),this.dampening=this._lowpass.frequency,this.resonance=this._combFilter.resonance,this._lowpass.connect(this._combFilter),this._readOnly(["dampening","resonance","delayTime"])},s.default.extend(s.default.LowpassCombFilter,s.default.AudioNode),s.default.LowpassCombFilter.defaults={delayTime:.1,resonance:.5,dampening:3e3},s.default.LowpassCombFilter.prototype.dispose=function(){return s.default.AudioNode.prototype.dispose.call(this),this._writable(["dampening","resonance","delayTime"]),this._combFilter.dispose(),this._combFilter=null,this.resonance=null,this.delayTime=null,this._lowpass.dispose(),this._lowpass=null,this.dampening=null,this},e.default=s.default.LowpassCombFilter},function(t,e,i){"use strict";i.r(e);var s=i(0);i(45),s.default.Ticks=function(t,e){if(!(this instanceof s.default.Ticks))return new s.default.Ticks(t,e);s.default.TransportTime.call(this,t,e)},s.default.extend(s.default.Ticks,s.default.TransportTime),s.default.Ticks.prototype._defaultUnits="i",s.default.Ticks.prototype._now=function(){return s.default.Transport.ticks},s.default.Ticks.prototype._beatsToUnits=function(t){return this._getPPQ()*t},s.default.Ticks.prototype._secondsToUnits=function(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())},s.default.Ticks.prototype._ticksToUnits=function(t){return t},s.default.Ticks.prototype.toTicks=function(){return this.valueOf()},s.default.Ticks.prototype.toSeconds=function(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())},e.default=s.default.Ticks},function(t,e,i){"use strict";i.r(e);var s=i(0);i(55),s.default.TransportEvent=function(t,e){e=s.default.defaultArg(e,s.default.TransportEvent.defaults),s.default.call(this),this.Transport=t,this.id=s.default.TransportEvent._eventId++,this.time=s.default.Ticks(e.time),this.callback=e.callback,this._once=e.once},s.default.extend(s.default.TransportEvent),s.default.TransportEvent.defaults={once:!1,callback:s.default.noOp},s.default.TransportEvent._eventId=0,s.default.TransportEvent.prototype.invoke=function(t){this.callback&&(this.callback(t),this._once&&this.Transport&&this.Transport.clear(this.id))},s.default.TransportEvent.prototype.dispose=function(){return s.default.prototype.dispose.call(this),this.Transport=null,this.callback=null,this.time=null,this},e.default=s.default.TransportEvent},function(t,e,i){"use strict";i.r(e);var s=i(0);i(82),i(34),i(24),i(14),s.default.TickSource=function(){var t=s.default.defaults(arguments,["frequency"],s.default.TickSource);this.frequency=new s.default.TickSignal(t.frequency),this._readOnly("frequency"),this._state=new s.default.TimelineState(s.default.State.Stopped),this._state.setStateAtTime(s.default.State.Stopped,0),this._tickOffset=new s.default.Timeline,this.setTicksAtTime(0,0)},s.default.extend(s.default.TickSource),s.default.TickSource.defaults={frequency:1},Object.defineProperty(s.default.TickSource.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),s.default.TickSource.prototype.start=function(t,e){return t=this.toSeconds(t),this._state.getValueAtTime(t)!==s.default.State.Started&&(this._state.setStateAtTime(s.default.State.Started,t),s.default.isDefined(e)&&this.setTicksAtTime(e,t)),this},s.default.TickSource.prototype.stop=function(t){if(t=this.toSeconds(t),this._state.getValueAtTime(t)===s.default.State.Stopped){var e=this._state.get(t);e.time>0&&(this._tickOffset.cancel(e.time),this._state.cancel(e.time))}return this._state.cancel(t),this._state.setStateAtTime(s.default.State.Stopped,t),this.setTicksAtTime(0,t),this},s.default.TickSource.prototype.pause=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)===s.default.State.Started&&this._state.setStateAtTime(s.default.State.Paused,t),this},s.default.TickSource.prototype.cancel=function(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this},s.default.TickSource.prototype.getTicksAtTime=function(t){t=this.toSeconds(t);var e=this._state.getLastState(s.default.State.Stopped,t),i={state:s.default.State.Paused,time:t};this._state.add(i);var n=e,o=0;return this._state.forEachBetween(e.time,t+this.sampleTime,function(t){var e=n.time,i=this._tickOffset.get(t.time);i.time>=n.time&&(o=i.ticks,e=i.time),n.state===s.default.State.Started&&t.state!==s.default.State.Started&&(o+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e)),n=t}.bind(this)),this._state.remove(i),o},Object.defineProperty(s.default.TickSource.prototype,"ticks",{get:function(){return this.getTicksAtTime(this.now())},set:function(t){this.setTicksAtTime(t,this.now())}}),Object.defineProperty(s.default.TickSource.prototype,"seconds",{get:function(){return this.getSecondsAtTime(this.now())},set:function(t){var e=this.now(),i=this.frequency.timeToTicks(t,e);this.setTicksAtTime(i,e)}}),s.default.TickSource.prototype.getSecondsAtTime=function(t){t=this.toSeconds(t);var e=this._state.getLastState(s.default.State.Stopped,t),i={state:s.default.State.Paused,time:t};this._state.add(i);var n=e,o=0;return this._state.forEachBetween(e.time,t+this.sampleTime,function(t){var e=n.time,i=this._tickOffset.get(t.time);i.time>=n.time&&(o=i.seconds,e=i.time),n.state===s.default.State.Started&&t.state!==s.default.State.Started&&(o+=t.time-e),n=t}.bind(this)),this._state.remove(i),o},s.default.TickSource.prototype.setTicksAtTime=function(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({time:e,ticks:t,seconds:this.frequency.getDurationOfTicks(t,e)}),this},s.default.TickSource.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)},s.default.TickSource.prototype.getTimeOfTick=function(t,e){e=s.default.defaultArg(e,this.now());var i=this._tickOffset.get(e),n=this._state.get(e),o=Math.max(i.time,n.time),a=this.frequency.getTicksAtTime(o)+t-i.ticks;return this.frequency.getTimeOfTick(a)},s.default.TickSource.prototype.forEachTickBetween=function(t,e,i){var n=this._state.get(t);if(this._state.forEachBetween(t,e,function(e){n.state===s.default.State.Started&&e.state!==s.default.State.Started&&this.forEachTickBetween(Math.max(n.time,t),e.time-this.sampleTime,i),n=e}.bind(this)),t=Math.max(n.time,t),n.state===s.default.State.Started&&this._state){var o=this.frequency.getTicksAtTime(t),a=(o-this.frequency.getTicksAtTime(n.time))%1;0!==a&&(a=1-a);for(var r=this.frequency.getTimeOfTick(o+a),l=null;r3&&(s=parseFloat(parseFloat(s).toFixed(3))),[i,e,s].join(":")},s.default.Time.prototype.toTicks=function(){var t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())},s.default.Time.prototype.toSeconds=function(){return this.valueOf()},s.default.Time.prototype.toMidi=function(){return s.default.Frequency.ftom(this.toFrequency())},e.default=s.default.Time},function(t,e,i){"use strict";i.r(e);var s=i(0);i(11),i(6),i(3),i(1),s.default.supported&&(OscillatorNode.prototype.setPeriodicWave||(OscillatorNode.prototype.setPeriodicWave=OscillatorNode.prototype.setWaveTable),AudioContext.prototype.createPeriodicWave||(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable)),s.default.OscillatorNode=function(){var t=s.default.defaults(arguments,["frequency","type"],s.default.OscillatorNode);s.default.AudioNode.call(this,t),this.onended=t.onended,this._startTime=-1,this._stopTime=-1,this._gainNode=this.output=new s.default.Gain(0),this._oscillator=this.context.createOscillator(),s.default.connect(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new s.default.Param({param:this._oscillator.frequency,units:s.default.Type.Frequency,value:t.frequency}),this.detune=new s.default.Param({param:this._oscillator.detune,units:s.default.Type.Cents,value:t.detune}),this._gain=1},s.default.extend(s.default.OscillatorNode,s.default.AudioNode),s.default.OscillatorNode.defaults={frequency:440,detune:0,type:"sine",onended:s.default.noOp},Object.defineProperty(s.default.OscillatorNode.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),s.default.OscillatorNode.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),-1!==this._startTime&&t>=this._startTime&&(-1===this._stopTime||t<=this._stopTime)?s.default.State.Started:s.default.State.Stopped},s.default.OscillatorNode.prototype.start=function(t){if(this.log("start",t),-1!==this._startTime)throw new Error("cannot call OscillatorNode.start more than once");return this._startTime=this.toSeconds(t),this._startTime=Math.max(this._startTime,this.context.currentTime),this._oscillator.start(this._startTime),this._gainNode.gain.setValueAtTime(1,this._startTime),this},s.default.OscillatorNode.prototype.setPeriodicWave=function(t){return this._oscillator.setPeriodicWave(t),this},s.default.OscillatorNode.prototype.stop=function(t){return this.log("stop",t),this.assert(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop(),this._stopTime=this.toSeconds(t),this._stopTime=Math.max(this._stopTime,this.context.currentTime),this._stopTime>this._startTime?(this._gainNode.gain.setValueAtTime(0,this._stopTime),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(function(){this._oscillator.stop(this.now()),this.onended(),setTimeout(function(){this._oscillator&&(this._oscillator.disconnect(),this._gainNode.disconnect())}.bind(this),100)}.bind(this),this._stopTime-this.context.currentTime)):this._gainNode.gain.cancelScheduledValues(this._startTime),this},s.default.OscillatorNode.prototype.cancelStop=function(){return-1!==this._startTime&&(this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1),this},Object.defineProperty(s.default.OscillatorNode.prototype,"type",{get:function(){return this._oscillator.type},set:function(t){this._oscillator.type=t}}),s.default.OscillatorNode.prototype.dispose=function(){return this._wasDisposed||(this._wasDisposed=!0,this.context.clearTimeout(this._timeout),s.default.AudioNode.prototype.dispose.call(this),this.onended=null,this._oscillator.disconnect(),this._oscillator=null,this._gainNode.dispose(),this._gainNode=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null),this},e.default=s.default.OscillatorNode},function(t,e,i){"use strict";i.r(e);var s=i(0);i(11),i(6),i(57),i(32),s.default.Player=function(t){var e;t instanceof s.default.Buffer&&t.loaded?(t=t.get(),e=s.default.Player.defaults):e=s.default.defaults(arguments,["url","onload"],s.default.Player),s.default.Source.call(this,e),this.autostart=e.autostart,this._buffer=new s.default.Buffer({url:e.url,onload:this._onload.bind(this,e.onload),reverse:e.reverse}),t instanceof AudioBuffer&&this._buffer.set(t),this._loop=e.loop,this._loopStart=e.loopStart,this._loopEnd=e.loopEnd,this._playbackRate=e.playbackRate,this._activeSources=[],this.fadeIn=e.fadeIn,this.fadeOut=e.fadeOut},s.default.extend(s.default.Player,s.default.Source),s.default.Player.defaults={onload:s.default.noOp,playbackRate:1,loop:!1,autostart:!1,loopStart:0,loopEnd:0,reverse:!1,fadeIn:0,fadeOut:0},s.default.Player.prototype.load=function(t,e){return this._buffer.load(t,this._onload.bind(this,e))},s.default.Player.prototype._onload=function(t){(t=s.default.defaultArg(t,s.default.noOp))(this),this.autostart&&this.start()},s.default.Player.prototype._onSourceEnd=function(t){var e=this._activeSources.indexOf(t);this._activeSources.splice(e,1),0!==this._activeSources.length||this._synced||this._state.setStateAtTime(s.default.State.Stopped,s.default.now())},s.default.Player.prototype._start=function(t,e,i){e=this._loop?s.default.defaultArg(e,this._loopStart):s.default.defaultArg(e,0),e=this.toSeconds(e),this._synced&&(e*=this._playbackRate);var n=s.default.defaultArg(i,Math.max(this._buffer.duration-e,0));n=this.toSeconds(n),n/=this._playbackRate,t=this.toSeconds(t);var o=new s.default.BufferSource({buffer:this._buffer,loop:this._loop,loopStart:this._loopStart,loopEnd:this._loopEnd,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate,fadeIn:this.fadeIn,fadeOut:this.fadeOut}).connect(this.output);return this._loop||this._synced||this._state.setStateAtTime(s.default.State.Stopped,t+n),this._activeSources.push(o),this._loop&&s.default.isUndef(i)?o.start(t,e):o.start(t,e,n-this.toSeconds(this.fadeOut)),this},s.default.Player.prototype._stop=function(t){return t=this.toSeconds(t),this._activeSources.forEach(function(e){e.stop(t)}),this},s.default.Player.prototype.restart=function(t,e,i){return this._stop(t),this._start(t,e,i),this},s.default.Player.prototype.seek=function(t,e){return e=this.toSeconds(e),this._state.getValueAtTime(e)===s.default.State.Started&&(t=this.toSeconds(t),this._stop(e),this._start(e,t)),this},s.default.Player.prototype.setLoopPoints=function(t,e){return this.loopStart=t,this.loopEnd=e,this},Object.defineProperty(s.default.Player.prototype,"loopStart",{get:function(){return this._loopStart},set:function(t){this._loopStart=t,this._activeSources.forEach(function(e){e.loopStart=t})}}),Object.defineProperty(s.default.Player.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(t){this._loopEnd=t,this._activeSources.forEach(function(e){e.loopEnd=t})}}),Object.defineProperty(s.default.Player.prototype,"buffer",{get:function(){return this._buffer},set:function(t){this._buffer.set(t)}}),Object.defineProperty(s.default.Player.prototype,"loop",{get:function(){return this._loop},set:function(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach(function(e){e.loop=t}),t)){var e=this._state.getNextState(s.default.State.Stopped,this.now());e&&this._state.cancel(e.time)}}}),Object.defineProperty(s.default.Player.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t;var e=this.now(),i=this._state.getNextState(s.default.State.Stopped,e);i&&this._state.cancel(i.time),this._activeSources.forEach(function(i){i.cancelStop(),i.playbackRate.setValueAtTime(t,e)})}}),Object.defineProperty(s.default.Player.prototype,"reverse",{get:function(){return this._buffer.reverse},set:function(t){this._buffer.reverse=t}}),Object.defineProperty(s.default.Player.prototype,"loaded",{get:function(){return this._buffer.loaded}}),s.default.Player.prototype.dispose=function(){return this._activeSources.forEach(function(t){t.dispose()}),this._activeSources=null,s.default.Source.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this},e.default=s.default.Player},function(t,e,i){"use strict";i.r(e);var s=i(0);i(31),i(41),i(37),i(2),i(9),i(25),s.default.MonoSynth=function(t){t=s.default.defaultArg(t,s.default.MonoSynth.defaults),s.default.Monophonic.call(this,t),this.oscillator=new s.default.OmniOscillator(t.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new s.default.Filter(t.filter),this.filter.frequency.value=5e3,this.filterEnvelope=new s.default.FrequencyEnvelope(t.filterEnvelope),this.envelope=new s.default.AmplitudeEnvelope(t.envelope),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),this._readOnly(["oscillator","frequency","detune","filter","filterEnvelope","envelope"])},s.default.extend(s.default.MonoSynth,s.default.Monophonic),s.default.MonoSynth.defaults={frequency:"C4",detune:0,oscillator:{type:"square"},filter:{Q:6,type:"lowpass",rolloff:-24},envelope:{attack:.005,decay:.1,sustain:.9,release:1},filterEnvelope:{attack:.06,decay:.2,sustain:.5,release:2,baseFrequency:200,octaves:7,exponent:2}},s.default.MonoSynth.prototype._triggerEnvelopeAttack=function(t,e){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),0===this.envelope.sustain&&this.oscillator.stop(t+this.envelope.attack+this.envelope.decay),this},s.default.MonoSynth.prototype._triggerEnvelopeRelease=function(t){return this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.envelope.release),this},s.default.MonoSynth.prototype.dispose=function(){return s.default.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","filter","filterEnvelope","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.filterEnvelope.dispose(),this.filterEnvelope=null,this.filter.dispose(),this.filter=null,this.frequency=null,this.detune=null,this},e.default=s.default.MonoSynth},function(t,e,i){"use strict";i.r(e);var s=i(0);i(6),i(17),i(5),i(3),s.default.FatOscillator=function(){var t=s.default.defaults(arguments,["frequency","type","spread"],s.default.FatOscillator);s.default.Source.call(this,t),this.frequency=new s.default.Signal(t.frequency,s.default.Type.Frequency),this.detune=new s.default.Signal(t.detune,s.default.Type.Cents),this._oscillators=[],this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,this._readOnly(["frequency","detune"])},s.default.extend(s.default.FatOscillator,s.default.Source),s.default.FatOscillator.defaults={frequency:440,detune:0,phase:0,spread:20,count:3,type:"sawtooth",partials:[],partialCount:0},s.default.FatOscillator.prototype._start=function(t){t=this.toSeconds(t),this._forEach(function(e){e.start(t)})},s.default.FatOscillator.prototype._stop=function(t){t=this.toSeconds(t),this._forEach(function(e){e.stop(t)})},s.default.FatOscillator.prototype.restart=function(t){t=this.toSeconds(t),this._forEach(function(e){e.restart(t)})},s.default.FatOscillator.prototype._forEach=function(t){for(var e=0;e1){var e=-t/2,i=t/(this._oscillators.length-1);this._forEach(function(t,s){t.detune.value=e+i*s})}}}),Object.defineProperty(s.default.FatOscillator.prototype,"count",{get:function(){return this._oscillators.length},set:function(t){if(t=Math.max(t,1),this._oscillators.length!==t){this._forEach(function(t){t.dispose()}),this._oscillators=[];for(var e=0;e=this._loopStart&&t.startOffset=i&&(t.loop=!1,t.start(s.default.Ticks(e))):t.startOffset>=i&&t.start(s.default.Ticks(e))},Object.defineProperty(s.default.Part.prototype,"startOffset",{get:function(){return this._startOffset},set:function(t){this._startOffset=t,this._forEach(function(t){t.startOffset+=this._startOffset})}}),s.default.Part.prototype.stop=function(t){var e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime(s.default.State.Stopped,e),this._forEach(function(e){e.stop(t)}),this},s.default.Part.prototype.at=function(t,e){t=s.default.TransportTime(t);for(var i=s.default.Ticks(1).toSeconds(),n=0;n=0;i--){var n=this._events[i];n.startOffset===t&&(s.default.isUndef(e)||s.default.isDefined(e)&&n.value===e)&&(this._events.splice(i,1),n.dispose())}return this},s.default.Part.prototype.removeAll=function(){return this._forEach(function(t){t.dispose()}),this._events=[],this},s.default.Part.prototype.cancel=function(t){return this._forEach(function(e){e.cancel(t)}),this._state.cancel(this.toTicks(t)),this},s.default.Part.prototype._forEach=function(t,e){if(this._events){e=s.default.defaultArg(e,this);for(var i=this._events.length-1;i>=0;i--){var n=this._events[i];n instanceof s.default.Part?n._forEach(t,e):t.call(e,n)}}return this},s.default.Part.prototype._setAll=function(t,e){this._forEach(function(i){i[t]=e})},s.default.Part.prototype._tick=function(t,e){this.mute||this.callback(t,e)},s.default.Part.prototype._testLoopBoundries=function(t){this._loop&&(t.startOffset=this._loopEnd)?t.cancel(0):t.state===s.default.State.Stopped&&this._restartEvent(t)},Object.defineProperty(s.default.Part.prototype,"probability",{get:function(){return this._probability},set:function(t){this._probability=t,this._setAll("probability",t)}}),Object.defineProperty(s.default.Part.prototype,"humanize",{get:function(){return this._humanize},set:function(t){this._humanize=t,this._setAll("humanize",t)}}),Object.defineProperty(s.default.Part.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=t,this._forEach(function(e){e._loopStart=this._loopStart,e._loopEnd=this._loopEnd,e.loop=t,this._testLoopBoundries(e)})}}),Object.defineProperty(s.default.Part.prototype,"loopEnd",{get:function(){return s.default.Ticks(this._loopEnd).toSeconds()},set:function(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach(function(e){e.loopEnd=t,this._testLoopBoundries(e)})}}),Object.defineProperty(s.default.Part.prototype,"loopStart",{get:function(){return s.default.Ticks(this._loopStart).toSeconds()},set:function(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach(function(t){t.loopStart=this.loopStart,this._testLoopBoundries(t)})}}),Object.defineProperty(s.default.Part.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._setAll("playbackRate",t)}}),Object.defineProperty(s.default.Part.prototype,"length",{get:function(){return this._events.length}}),s.default.Part.prototype.dispose=function(){return s.default.Event.prototype.dispose.call(this),this.removeAll(),this.callback=null,this._events=null,this},e.default=s.default.Part},function(t,e,i){"use strict";i.r(e);var s=i(0);i(51),s.default.Loop=function(){var t=s.default.defaults(arguments,["callback","interval"],s.default.Loop);s.default.call(this),this._event=new s.default.Event({callback:this._tick.bind(this),loop:!0,loopEnd:t.interval,playbackRate:t.playbackRate,probability:t.probability}),this.callback=t.callback,this.iterations=t.iterations},s.default.extend(s.default.Loop),s.default.Loop.defaults={interval:"4n",callback:s.default.noOp,playbackRate:1,iterations:1/0,probability:!0,mute:!1},s.default.Loop.prototype.start=function(t){return this._event.start(t),this},s.default.Loop.prototype.stop=function(t){return this._event.stop(t),this},s.default.Loop.prototype.cancel=function(t){return this._event.cancel(t),this},s.default.Loop.prototype._tick=function(t){this.callback(t)},Object.defineProperty(s.default.Loop.prototype,"state",{get:function(){return this._event.state}}),Object.defineProperty(s.default.Loop.prototype,"progress",{get:function(){return this._event.progress}}),Object.defineProperty(s.default.Loop.prototype,"interval",{get:function(){return this._event.loopEnd},set:function(t){this._event.loopEnd=t}}),Object.defineProperty(s.default.Loop.prototype,"playbackRate",{get:function(){return this._event.playbackRate},set:function(t){this._event.playbackRate=t}}),Object.defineProperty(s.default.Loop.prototype,"humanize",{get:function(){return this._event.humanize},set:function(t){this._event.humanize=t}}),Object.defineProperty(s.default.Loop.prototype,"probability",{get:function(){return this._event.probability},set:function(t){this._event.probability=t}}),Object.defineProperty(s.default.Loop.prototype,"mute",{get:function(){return this._event.mute},set:function(t){this._event.mute=t}}),Object.defineProperty(s.default.Loop.prototype,"iterations",{get:function(){return!0===this._event.loop?1/0:this._event.loop},set:function(t){this._event.loop=t===1/0||t}}),s.default.Loop.prototype.dispose=function(){this._event.dispose(),this._event=null,this.callback=null},e.default=s.default.Loop},function(t,e,i){"use strict";i.r(e);var s=i(0);i(15),i(33),s.default.StereoXFeedbackEffect=function(){var t=s.default.defaults(arguments,["feedback"],s.default.FeedbackEffect);s.default.StereoEffect.call(this,t),this.feedback=new s.default.Signal(t.feedback,s.default.Type.NormalRange),this._feedbackLR=new s.default.Gain,this._feedbackRL=new s.default.Gain,this.effectReturnL.chain(this._feedbackLR,this.effectSendR),this.effectReturnR.chain(this._feedbackRL,this.effectSendL),this.feedback.fan(this._feedbackLR.gain,this._feedbackRL.gain),this._readOnly(["feedback"])},s.default.extend(s.default.StereoXFeedbackEffect,s.default.StereoEffect),s.default.StereoXFeedbackEffect.prototype.dispose=function(){return s.default.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackLR.dispose(),this._feedbackLR=null,this._feedbackRL.dispose(),this._feedbackRL=null,this},e.default=s.default.StereoXFeedbackEffect},function(t,e,i){"use strict";i.r(e);var s=i(0);i(8),i(53),i(52),s.default.MidSideEffect=function(){s.default.Effect.apply(this,arguments),this._midSideSplit=new s.default.MidSideSplit,this._midSideMerge=new s.default.MidSideMerge,this.midSend=this._midSideSplit.mid,this.sideSend=this._midSideSplit.side,this.midReturn=this._midSideMerge.mid,this.sideReturn=this._midSideMerge.side,this.effectSend.connect(this._midSideSplit),this._midSideMerge.connect(this.effectReturn)},s.default.extend(s.default.MidSideEffect,s.default.Effect),s.default.MidSideEffect.prototype.dispose=function(){return s.default.Effect.prototype.dispose.call(this),this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this.midSend=null,this.sideSend=null,this.midReturn=null,this.sideReturn=null,this},e.default=s.default.MidSideEffect},function(t,e,i){"use strict";i.r(e);var s=i(0);i(11),i(8),s.default.Convolver=function(){var t=s.default.defaults(arguments,["url","onload"],s.default.Convolver);s.default.Effect.call(this,t),this._convolver=this.context.createConvolver(),this._buffer=new s.default.Buffer(t.url,function(e){this.buffer=e.get(),t.onload()}.bind(this)),this._buffer.loaded&&(this.buffer=this._buffer),this.normalize=t.normalize,this.connectEffect(this._convolver)},s.default.extend(s.default.Convolver,s.default.Effect),s.default.Convolver.defaults={onload:s.default.noOp,normalize:!0},Object.defineProperty(s.default.Convolver.prototype,"buffer",{get:function(){return this._buffer.length?this._buffer:null},set:function(t){this._buffer.set(t),this._convolver.buffer&&(this.effectSend.disconnect(),this._convolver.disconnect(),this._convolver=this.context.createConvolver(),this.connectEffect(this._convolver)),this._convolver.buffer=this._buffer.get()}}),Object.defineProperty(s.default.Convolver.prototype,"normalize",{get:function(){return this._convolver.normalize},set:function(t){this._convolver.normalize=t}}),s.default.Convolver.prototype.load=function(t,e){return this._buffer.load(t,function(t){this.buffer=t,e&&e()}.bind(this))},s.default.Convolver.prototype.dispose=function(){return s.default.Effect.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this._convolver.disconnect(),this._convolver=null,this},e.default=s.default.Convolver},function(t,e,i){"use strict";i.r(e);var s=i(0);i(7),i(5),i(13),s.default.Modulo=function(t){s.default.SignalBase.call(this),this.createInsOuts(1,0),this._shaper=new s.default.WaveShaper(Math.pow(2,16)),this._multiply=new s.default.Multiply,this._subtract=this.output=new s.default.Subtract,this._modSignal=new s.default.Signal(t),s.default.connect(this.input,this._shaper),s.default.connect(this.input,this._subtract),this._modSignal.connect(this._multiply,0,0),this._shaper.connect(this._multiply,0,1),this._multiply.connect(this._subtract,0,1),this._setWaveShaper(t)},s.default.extend(s.default.Modulo,s.default.SignalBase),s.default.Modulo.prototype._setWaveShaper=function(t){this._shaper.setMap(function(e){return Math.floor((e+1e-4)/t)})},Object.defineProperty(s.default.Modulo.prototype,"value",{get:function(){return this._modSignal.value},set:function(t){this._modSignal.value=t,this._setWaveShaper(t)}}),s.default.Modulo.prototype.dispose=function(){return s.default.SignalBase.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this._multiply.dispose(),this._multiply=null,this._subtract.dispose(),this._subtract=null,this._modSignal.dispose(),this._modSignal=null,this},e.default=s.default.Modulo},function(t,e,i){"use strict";i.r(e);var s=i(0);i(20),i(92),s.default.OfflineContext=function(t,e,i){var n=new OfflineAudioContext(t,e*i,i);s.default.Context.call(this,{context:n,clockSource:"offline",lookAhead:0,updateInterval:128/i}),this._duration=e,this._currentTime=0},s.default.extend(s.default.OfflineContext,s.default.Context),s.default.OfflineContext.prototype.now=function(){return this._currentTime},s.default.OfflineContext.prototype.resume=function(){return Promise.resolve()},s.default.OfflineContext.prototype.render=function(){for(;this._duration-this._currentTime>=0;)this.emit("tick"),this._currentTime+=.005;return this._context.startRendering()},s.default.OfflineContext.prototype.close=function(){return this._context=null,Promise.resolve()},e.default=s.default.OfflineContext},function(t,e,i){"use strict";i.r(e);var s=i(0);i(16),i(11),i(76),i(40),s.default.Offline=function(t,e){var i=s.default.context.sampleRate,n=s.default.context,o=new s.default.OfflineContext(2,e,i);s.default.context=o;var a=t(s.default.Transport),r=null;return r=a&&s.default.isFunction(a.then)?a.then(function(){return o.render()}):o.render(),s.default.context=n,r.then(function(t){return new s.default.Buffer(t)})},e.default=s.default.Offline},function(t,e,i){"use strict";i.r(e);var s=i(0);i(11),s.default.Buffers=function(t){var e=Array.prototype.slice.call(arguments);e.shift();var i=s.default.defaults(e,["onload","baseUrl"],s.default.Buffers);for(var n in s.default.call(this),this._buffers={},this.baseUrl=i.baseUrl,this._loadingCount=0,t)this._loadingCount++,this.add(n,t[n],this._bufferLoaded.bind(this,i.onload))},s.default.extend(s.default.Buffers),s.default.Buffers.defaults={onload:s.default.noOp,baseUrl:""},s.default.Buffers.prototype.has=function(t){return this._buffers.hasOwnProperty(t)},s.default.Buffers.prototype.get=function(t){if(this.has(t))return this._buffers[t];throw new Error("Tone.Buffers: no buffer named "+t)},s.default.Buffers.prototype._bufferLoaded=function(t){this._loadingCount--,0===this._loadingCount&&t&&t(this)},Object.defineProperty(s.default.Buffers.prototype,"loaded",{get:function(){var t=!0;for(var e in this._buffers){var i=this.get(e);t=t&&i.loaded}return t}}),s.default.Buffers.prototype.add=function(t,e,i){return i=s.default.defaultArg(i,s.default.noOp),e instanceof s.default.Buffer?(this._buffers[t]=e,i(this)):e instanceof AudioBuffer?(this._buffers[t]=new s.default.Buffer(e),i(this)):s.default.isString(e)&&(this._buffers[t]=new s.default.Buffer(this.baseUrl+e,i)),this},s.default.Buffers.prototype.dispose=function(){for(var t in s.default.prototype.dispose.call(this),this._buffers)this._buffers[t].dispose();return this._buffers=null,this},e.default=s.default.Buffers},function(t,e,i){"use strict";i.r(e);var s=i(0);s.default.CtrlPattern=function(){var t=s.default.defaults(arguments,["values","type"],s.default.CtrlPattern);s.default.call(this),this.values=t.values,this.index=0,this._type=null,this._shuffled=null,this._direction=null,this.type=t.type},s.default.extend(s.default.CtrlPattern),s.default.CtrlPattern.Type={Up:"up",Down:"down",UpDown:"upDown",DownUp:"downUp",AlternateUp:"alternateUp",AlternateDown:"alternateDown",Random:"random",RandomWalk:"randomWalk",RandomOnce:"randomOnce"},s.default.CtrlPattern.defaults={type:s.default.CtrlPattern.Type.Up,values:[]},Object.defineProperty(s.default.CtrlPattern.prototype,"value",{get:function(){if(0!==this.values.length){if(1===this.values.length)return this.values[0];this.index=Math.min(this.index,this.values.length-1);var t=this.values[this.index];return this.type===s.default.CtrlPattern.Type.RandomOnce&&(this.values.length!==this._shuffled.length&&this._shuffleValues(),t=this.values[this._shuffled[this.index]]),t}}}),Object.defineProperty(s.default.CtrlPattern.prototype,"type",{get:function(){return this._type},set:function(t){this._type=t,this._shuffled=null,this._type===s.default.CtrlPattern.Type.Up||this._type===s.default.CtrlPattern.Type.UpDown||this._type===s.default.CtrlPattern.Type.RandomOnce||this._type===s.default.CtrlPattern.Type.AlternateUp?this.index=0:this._type!==s.default.CtrlPattern.Type.Down&&this._type!==s.default.CtrlPattern.Type.DownUp&&this._type!==s.default.CtrlPattern.Type.AlternateDown||(this.index=this.values.length-1),this._type===s.default.CtrlPattern.Type.UpDown||this._type===s.default.CtrlPattern.Type.AlternateUp?this._direction=s.default.CtrlPattern.Type.Up:this._type!==s.default.CtrlPattern.Type.DownUp&&this._type!==s.default.CtrlPattern.Type.AlternateDown||(this._direction=s.default.CtrlPattern.Type.Down),this._type===s.default.CtrlPattern.Type.RandomOnce?this._shuffleValues():this._type===s.default.CtrlPattern.Type.Random&&(this.index=Math.floor(Math.random()*this.values.length))}}),s.default.CtrlPattern.prototype.next=function(){var t=this.type;return t===s.default.CtrlPattern.Type.Up?(this.index++,this.index>=this.values.length&&(this.index=0)):t===s.default.CtrlPattern.Type.Down?(this.index--,this.index<0&&(this.index=this.values.length-1)):t===s.default.CtrlPattern.Type.UpDown||t===s.default.CtrlPattern.Type.DownUp?(this._direction===s.default.CtrlPattern.Type.Up?this.index++:this.index--,this.index<0?(this.index=1,this._direction=s.default.CtrlPattern.Type.Up):this.index>=this.values.length&&(this.index=this.values.length-2,this._direction=s.default.CtrlPattern.Type.Down)):t===s.default.CtrlPattern.Type.Random?this.index=Math.floor(Math.random()*this.values.length):t===s.default.CtrlPattern.Type.RandomWalk?Math.random()<.5?(this.index--,this.index=Math.max(this.index,0)):(this.index++,this.index=Math.min(this.index,this.values.length-1)):t===s.default.CtrlPattern.Type.RandomOnce?(this.index++,this.index>=this.values.length&&(this.index=0,this._shuffleValues())):t===s.default.CtrlPattern.Type.AlternateUp?(this._direction===s.default.CtrlPattern.Type.Up?(this.index+=2,this._direction=s.default.CtrlPattern.Type.Down):(this.index-=1,this._direction=s.default.CtrlPattern.Type.Up),this.index>=this.values.length&&(this.index=0,this._direction=s.default.CtrlPattern.Type.Up)):t===s.default.CtrlPattern.Type.AlternateDown&&(this._direction===s.default.CtrlPattern.Type.Up?(this.index+=1,this._direction=s.default.CtrlPattern.Type.Down):(this.index-=2,this._direction=s.default.CtrlPattern.Type.Up),this.index<0&&(this.index=this.values.length-1,this._direction=s.default.CtrlPattern.Type.Down)),this.value},s.default.CtrlPattern.prototype._shuffleValues=function(){var t=[];this._shuffled=[];for(var e=0;e0;){var i=t.splice(Math.floor(t.length*Math.random()),1);this._shuffled.push(i[0])}},s.default.CtrlPattern.prototype.dispose=function(){this._shuffled=null,this.values=null},e.default=s.default.CtrlPattern},function(t,e,i){"use strict";i.r(e);var s=i(0);i(56),i(55),s.default.TransportRepeatEvent=function(t,e){s.default.TransportEvent.call(this,t,e),e=s.default.defaultArg(e,s.default.TransportRepeatEvent.defaults),this.duration=s.default.Ticks(e.duration),this._interval=s.default.Ticks(e.interval),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this),this.Transport.on("start loopStart",this._boundRestart),this._restart()},s.default.extend(s.default.TransportRepeatEvent,s.default.TransportEvent),s.default.TransportRepeatEvent.defaults={duration:1/0,interval:1},s.default.TransportRepeatEvent.prototype.invoke=function(t){this._createEvents(t),s.default.TransportEvent.prototype.invoke.call(this,t)},s.default.TransportRepeatEvent.prototype._createEvents=function(t){var e=this.Transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._intervalthis.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.Transport.scheduleOnce(this.invoke.bind(this),s.default.Ticks(this._nextTick)),this._nextTick+=this._interval,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),s.default.Ticks(this._nextTick))},s.default.TransportRepeatEvent.prototype.dispose=function(){return this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this.Transport.off("start loopStart",this._boundRestart),this._boundCreateEvents=null,s.default.TransportEvent.prototype.dispose.call(this),this.duration=null,this._interval=null,this},e.default=s.default.TransportRepeatEvent},function(t,e,i){"use strict";i.r(e);var s=i(0);i(4),s.default.IntervalTimeline=function(){s.default.call(this),this._root=null,this._length=0},s.default.extend(s.default.IntervalTimeline),s.default.IntervalTimeline.prototype.add=function(t){if(s.default.isUndef(t.time)||s.default.isUndef(t.duration))throw new Error("Tone.IntervalTimeline: events must have time and duration parameters");t.time=t.time.valueOf();var e=new n(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this},s.default.IntervalTimeline.prototype.remove=function(t){if(null!==this._root){var e=[];this._root.search(t.time,e);for(var i=0;i0)if(null===t.left.right)(e=t.left).right=t.right,i=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent.right=e.left,i=e.parent,e.left=t.left,e.right=t.right}else if(null===t.right.left)(e=t.right).left=t.left,i=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent.left=e.right,i=e.parent,e.left=t.left,e.right=t.right}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),this._rebalance(i)}t.dispose()},s.default.IntervalTimeline.prototype._rotateLeft=function(t){var e=t.parent,i=t.isLeftChild(),s=t.right;t.right=s.left,s.left=t,null!==e?i?e.left=s:e.right=s:this._setRoot(s)},s.default.IntervalTimeline.prototype._rotateRight=function(t){var e=t.parent,i=t.isLeftChild(),s=t.left;t.left=s.right,s.right=t,null!==e?i?e.left=s:e.right=s:this._setRoot(s)},s.default.IntervalTimeline.prototype._rebalance=function(t){var e=t.getBalance();e>1?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))},s.default.IntervalTimeline.prototype.get=function(t){if(null!==this._root){var e=[];if(this._root.search(t,e),e.length>0){for(var i=e[0],s=1;si.low&&(i=e[s]);return i.event}}return null},s.default.IntervalTimeline.prototype.forEach=function(t){if(null!==this._root){var e=[];this._root.traverse(function(t){e.push(t)});for(var i=0;i=0;s--){var n=i[s].event;n&&e(n)}}return this},s.default.IntervalTimeline.prototype.forEachFrom=function(t,e){if(null!==this._root){var i=[];this._root.searchAfter(t,i);for(var s=i.length-1;s>=0;s--)e(i[s].event)}return this},s.default.IntervalTimeline.prototype.dispose=function(){var t=[];null!==this._root&&this._root.traverse(function(e){t.push(e)});for(var e=0;ethis.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))},n.prototype.searchAfter=function(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)},n.prototype.traverse=function(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)},n.prototype.updateHeight=function(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0},n.prototype.updateMax=function(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))},n.prototype.getBalance=function(){var t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t},n.prototype.isLeftChild=function(){return null!==this.parent&&this.parent.left===this},Object.defineProperty(n.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}}),Object.defineProperty(n.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}}),n.prototype.dispose=function(){this.parent=null,this._left=null,this._right=null,this.event=null},e.default=s.default.IntervalTimeline},function(t,e,i){"use strict";i.r(e);var s=i(0);function n(t){return function(e,i){i=this.toSeconds(i),t.apply(this,arguments);var s=this._events.get(i),n=this._events.previousEvent(s),o=this._getTicksUntilEvent(n,i);return s.ticks=Math.max(o,0),this}}i(2),s.default.TickSignal=function(t){t=s.default.defaultArg(t,1),s.default.Signal.call(this,{units:s.default.Type.Ticks,value:t}),this._events.memory=1/0,this.cancelScheduledValues(0),this._events.add({type:s.default.Param.AutomationType.SetValue,time:0,value:t})},s.default.extend(s.default.TickSignal,s.default.Signal),s.default.TickSignal.prototype.setValueAtTime=n(s.default.Signal.prototype.setValueAtTime),s.default.TickSignal.prototype.linearRampToValueAtTime=n(s.default.Signal.prototype.linearRampToValueAtTime),s.default.TickSignal.prototype.setTargetAtTime=function(t,e,i){e=this.toSeconds(e),this.setRampPoint(e),t=this._fromUnits(t);for(var s=this._events.get(e),n=Math.round(Math.max(1/i,1)),o=0;o<=n;o++){var a=i*o+e,r=this._exponentialApproach(s.time,s.value,t,i,a);this.linearRampToValueAtTime(this._toUnits(r),a)}return this},s.default.TickSignal.prototype.exponentialRampToValueAtTime=function(t,e){e=this.toSeconds(e),t=this._fromUnits(t);for(var i=this._events.get(e),s=Math.round(Math.max(10*(e-i.time),1)),n=(e-i.time)/s,o=0;o<=s;o++){var a=n*o+i.time,r=this._exponentialInterpolate(i.time,i.value,e,t,a);this.linearRampToValueAtTime(this._toUnits(r),a)}return this},s.default.TickSignal.prototype._getTicksUntilEvent=function(t,e){if(null===t)t={ticks:0,time:0};else if(s.default.isUndef(t.ticks)){var i=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(i,t.time)}var n=this.getValueAtTime(t.time),o=this.getValueAtTime(e);return this._events.get(e).time===e&&this._events.get(e).type===s.default.Param.AutomationType.SetValue&&(o=this.getValueAtTime(e-this.sampleTime)),.5*(e-t.time)*(n+o)+t.ticks},s.default.TickSignal.prototype.getTicksAtTime=function(t){t=this.toSeconds(t);var e=this._events.get(t);return Math.max(this._getTicksUntilEvent(e,t),0)},s.default.TickSignal.prototype.getDurationOfTicks=function(t,e){e=this.toSeconds(e);var i=this.getTicksAtTime(e);return this.getTimeOfTick(i+t)-e},s.default.TickSignal.prototype.getTimeOfTick=function(t){var e=this._events.get(t,"ticks"),i=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&i&&i.type===s.default.Param.AutomationType.Linear&&e.value!==i.value){var n=this.getValueAtTime(e.time),o=(this.getValueAtTime(i.time)-n)/(i.time-e.time),a=Math.sqrt(Math.pow(n,2)-2*o*(e.ticks-t)),r=(-n+a)/o;return(r>0?r:(-n-a)/o)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue},s.default.TickSignal.prototype.ticksToTime=function(t,e){return e=this.toSeconds(e),new s.default.Time(this.getDurationOfTicks(t,e))},s.default.TickSignal.prototype.timeToTicks=function(t,e){e=this.toSeconds(e),t=this.toSeconds(t);var i=this.getTicksAtTime(e),n=this.getTicksAtTime(e+t);return new s.default.Ticks(n-i)},e.default=s.default.TickSignal},function(t,e,i){"use strict";i.r(e);var s=i(0);i(57),i(34),i(35),i(20),s.default.Clock=function(){var t=s.default.defaults(arguments,["callback","frequency"],s.default.Clock);s.default.Emitter.call(this),this.callback=t.callback,this._nextTick=0,this._tickSource=new s.default.TickSource(t.frequency),this._lastUpdate=0,this.frequency=this._tickSource.frequency,this._readOnly("frequency"),this._state=new s.default.TimelineState(s.default.State.Stopped),this._state.setStateAtTime(s.default.State.Stopped,0),this._boundLoop=this._loop.bind(this),this.context.on("tick",this._boundLoop)},s.default.extend(s.default.Clock,s.default.Emitter),s.default.Clock.defaults={callback:s.default.noOp,frequency:1},Object.defineProperty(s.default.Clock.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),s.default.Clock.prototype.start=function(t,e){return this.context.resume(),t=this.toSeconds(t),this._state.getValueAtTime(t)!==s.default.State.Started&&(this._state.setStateAtTime(s.default.State.Started,t),this._tickSource.start(t,e),t0)i=e[0];else if(!i&&s.default.isDefined(t))throw new Error("Tone.UserMedia: no matching device: "+t);this._device=i;var n={audio:{echoCancellation:!1,sampleRate:this.context.sampleRate,noiseSuppression:!1,mozNoiseSuppression:!1}};return i&&(n.audio.deviceId=i.deviceId),navigator.mediaDevices.getUserMedia(n).then(function(t){return this._stream||(this._stream=t,this._mediaStream=this.context.createMediaStreamSource(t),s.default.connect(this._mediaStream,this.output)),this}.bind(this))}.bind(this))},s.default.UserMedia.prototype.close=function(){return this._stream&&(this._stream.getAudioTracks().forEach(function(t){t.stop()}),this._stream=null,this._mediaStream.disconnect(),this._mediaStream=null),this._device=null,this},s.default.UserMedia.enumerateDevices=function(){return navigator.mediaDevices.enumerateDevices().then(function(t){return t.filter(function(t){return"audioinput"===t.kind})})},Object.defineProperty(s.default.UserMedia.prototype,"state",{get:function(){return this._stream&&this._stream.active?s.default.State.Started:s.default.State.Stopped}}),Object.defineProperty(s.default.UserMedia.prototype,"deviceId",{get:function(){return this._device?this._device.deviceId:null}}),Object.defineProperty(s.default.UserMedia.prototype,"groupId",{get:function(){return this._device?this._device.groupId:null}}),Object.defineProperty(s.default.UserMedia.prototype,"label",{get:function(){return this._device?this._device.label:null}}),Object.defineProperty(s.default.UserMedia.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),s.default.UserMedia.prototype.dispose=function(){return s.default.AudioNode.prototype.dispose.call(this),this.close(),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this},Object.defineProperty(s.default.UserMedia,"supported",{get:function(){return s.default.isDefined(navigator.mediaDevices)&&s.default.isFunction(navigator.mediaDevices.getUserMedia)}}),e.default=s.default.UserMedia},function(t,e,i){"use strict";i.r(e);var s=i(0);i(65),i(27),i(1),s.default.Players=function(t){var e=Array.prototype.slice.call(arguments);e.shift();var i=s.default.defaults(e,["onload"],s.default.Players);for(var n in s.default.AudioNode.call(this,i),this._volume=this.output=new s.default.Volume(i.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=i.mute,this._players={},this._loadingCount=0,this._fadeIn=i.fadeIn,this._fadeOut=i.fadeOut,t)this._loadingCount++,this.add(n,t[n],this._bufferLoaded.bind(this,i.onload))},s.default.extend(s.default.Players,s.default.AudioNode),s.default.Players.defaults={volume:0,mute:!1,onload:s.default.noOp,fadeIn:0,fadeOut:0},s.default.Players.prototype._bufferLoaded=function(t){this._loadingCount--,0===this._loadingCount&&t&&t(this)},Object.defineProperty(s.default.Players.prototype,"mute",{get:function(){return this._volume.mute},set:function(t){this._volume.mute=t}}),Object.defineProperty(s.default.Players.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(t){this._fadeIn=t,this._forEach(function(e){e.fadeIn=t})}}),Object.defineProperty(s.default.Players.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(t){this._fadeOut=t,this._forEach(function(e){e.fadeOut=t})}}),Object.defineProperty(s.default.Players.prototype,"state",{get:function(){var t=!1;return this._forEach(function(e){t=t||e.state===s.default.State.Started}),t?s.default.State.Started:s.default.State.Stopped}}),s.default.Players.prototype.has=function(t){return this._players.hasOwnProperty(t)},s.default.Players.prototype.get=function(t){if(this.has(t))return this._players[t];throw new Error("Tone.Players: no player named "+t)},s.default.Players.prototype._forEach=function(t){for(var e in this._players)t(this._players[e],e);return this},Object.defineProperty(s.default.Players.prototype,"loaded",{get:function(){var t=!0;return this._forEach(function(e){t=t&&e.loaded}),t}}),s.default.Players.prototype.add=function(t,e,i){return this._players[t]=new s.default.Player(e,i).connect(this.output),this._players[t].fadeIn=this._fadeIn,this._players[t].fadeOut=this._fadeOut,this},s.default.Players.prototype.stopAll=function(t){this._forEach(function(e){e.stop(t)})},s.default.Players.prototype.dispose=function(){return s.default.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable("volume"),this.volume=null,this.output=null,this._forEach(function(t){t.dispose()}),this._players=null,this},e.default=s.default.Players},function(t,e,i){"use strict";i.r(e);var s=i(0);i(6),i(11),i(32),s.default.GrainPlayer=function(){var t=s.default.defaults(arguments,["url","onload"],s.default.GrainPlayer);s.default.Source.call(this,t),this.buffer=new s.default.Buffer(t.url,t.onload.bind(void 0,this)),this._clock=new s.default.Clock(this._tick.bind(this),t.grainSize),this._loopStart=0,this._loopEnd=0,this._activeSources=[],this._playbackRate=t.playbackRate,this._grainSize=t.grainSize,this._overlap=t.overlap,this.detune=t.detune,this.overlap=t.overlap,this.loop=t.loop,this.playbackRate=t.playbackRate,this.grainSize=t.grainSize,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.reverse=t.reverse,this._clock.on("stop",this._onstop.bind(this))},s.default.extend(s.default.GrainPlayer,s.default.Source),s.default.GrainPlayer.defaults={onload:s.default.noOp,overlap:.1,grainSize:.2,playbackRate:1,detune:0,loop:!1,loopStart:0,loopEnd:0,reverse:!1},s.default.GrainPlayer.prototype._start=function(t,e,i){e=s.default.defaultArg(e,0),e=this.toSeconds(e),t=this.toSeconds(t),this._offset=e,this._clock.start(t),i&&this.stop(t+this.toSeconds(i))},s.default.GrainPlayer.prototype._stop=function(t){this._clock.stop(t)},s.default.GrainPlayer.prototype._onstop=function(t){this._activeSources.forEach(function(e){e.fadeOut=0,e.stop(t)})},s.default.GrainPlayer.prototype._tick=function(t){if(!this.loop&&this._offset>this.buffer.duration)this.stop(t);else{var e=this._offset0,"polyphony must be greater than 0"),this.detune=new s.default.Signal(t.detune,s.default.Type.Cents),this._readOnly("detune");for(var e=0;e1e-5)return i})||this.voices.slice().sort(function(e,i){var s=e.getLevelAtTime(t+this.blockTime),n=i.getLevelAtTime(t+this.blockTime);return s<1e-5&&(s=0),n<1e-5&&(n=0),s-n}.bind(this))[0]},s.default.PolySynth.prototype.triggerAttack=function(t,e,i){return Array.isArray(t)||(t=[t]),e=this.toSeconds(e),t.forEach(function(t){var s=this._getClosestVoice(e,t);s.triggerAttack(t,e,i),this.log("triggerAttack",s.index,t)}.bind(this)),this},s.default.PolySynth.prototype.triggerRelease=function(t,e){return Array.isArray(t)||(t=[t]),e=this.toSeconds(e),t.forEach(function(t){var i=this._getClosestVoice(e,t);this.log("triggerRelease",i.index,t),i.triggerRelease(e)}.bind(this)),this},s.default.PolySynth.prototype.triggerAttackRelease=function(t,e,i,n){if(i=this.toSeconds(i),this.triggerAttack(t,i,n),s.default.isArray(e)&&s.default.isArray(t))for(var o=0;o0&&requestAnimationFrame(this._boundDrawLoop)},s.default.Draw=new s.default.Draw,e.default=s.default.Draw},function(t,e,i){"use strict";i.r(e);var s=i(0),n=(i(3),{});s.default.prototype.send=function(t,e){n.hasOwnProperty(t)||(n[t]=this.context.createGain()),e=s.default.defaultArg(e,0);var i=new s.default.Gain(e,s.default.Type.Decibels);return this.connect(i),i.connect(n[t]),i},s.default.prototype.receive=function(t,e){return n.hasOwnProperty(t)||(n[t]=this.context.createGain()),s.default.connect(n[t],this,0,e),this},s.default.Context.on("init",function(t){t.buses?n=t.buses:(n={},t.buses=n)}),e.default=s.default},function(t,e,i){"use strict";i.r(e);var s=i(0);i(4),s.default.CtrlRandom=function(){var t=s.default.defaults(arguments,["min","max"],s.default.CtrlRandom);s.default.call(this),this.min=t.min,this.max=t.max,this.integer=t.integer},s.default.extend(s.default.CtrlRandom),s.default.CtrlRandom.defaults={min:0,max:1,integer:!1},Object.defineProperty(s.default.CtrlRandom.prototype,"value",{get:function(){var t=this.toSeconds(this.min),e=this.toSeconds(this.max),i=Math.random(),s=i*t+(1-i)*e;return this.integer&&(s=Math.floor(s)),s}}),e.default=s.default.CtrlRandom},function(t,e,i){"use strict";i.r(e);var s=i(0);s.default.CtrlMarkov=function(t,e){s.default.call(this),this.values=s.default.defaultArg(t,{}),this.value=s.default.defaultArg(e,Object.keys(this.values)[0])},s.default.extend(s.default.CtrlMarkov),s.default.CtrlMarkov.prototype.next=function(){if(this.values.hasOwnProperty(this.value)){var t=this.values[this.value];if(s.default.isArray(t))for(var e=this._getProbDistribution(t),i=Math.random(),n=0,o=0;on&&i=200&&(e.Game.level+=.2,e.Game.digits+=.2),e.Game.rounds>=15&&(e.Game.levelName+=2,e.Game.rounds=0,e.Game.digits=1,e.Game.hints+=1),e.Game.levelName>=11&&(this.timePerRound=1e4),this.scene.restart()}}}]),c}(),w=G;exports.default=w;
},{"../state":"dm40","../config":"itQ5","../objects/QuestionObject":"JcmE","../objects/AnswerObject":"VRPY","../objects/TimebarObject":"zh8K","../scripts/grid":"Xoal","tone":"DNic"}],"JXnn":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=require("../state"),e=o(require("../scripts/grid")),n=require("../config");function o(t){return t&&t.__esModule?t:{default:t}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n