phaser-raycaster
Version:
Raycasting plugin for Phaser 3.
6 lines • 69.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("PhaserRaycaster",[],t):"object"==typeof exports?exports.PhaserRaycaster=t():e.PhaserRaycaster=t()}(self,(function(){return function(){var e={781:function(e,t,i){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}function o(e,t,i){return t=h(t),function(e,t){if(t&&("object"==n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,i||[],h(e).constructor):t.apply(e,i))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(a=function(){return!!e})()}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)
/**
* @author Marcin Walczak <contact@marcin-walczak.pl>
* @copyright 2023 Marcin Walczak
* @license {@link https://github.com/wiserim/phaser-raycaster/blob/master/LICENSE|MIT License}
*/}var l=function(){function e(t,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(r=o(this,e,[t,n]))._Raycaster=i(232).t,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(e,Phaser.Plugins.ScenePlugin),t=e,n=[{key:"createRaycaster",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.scene=this.scene,new this._Raycaster(e)}}],n&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,s}();e.exports=l},998:function(e,t,i){"use strict";function n(){return this.object.getBounds()}i.r(t),i.d(t,{getBoundingBox:function(){return n}})},197:function(e,t,i){"use strict";i.d(t,{$:function(){return g}});var n=i(502),r=i(919),s=i(645),o=i(821),a=i(620),h=i(265),c=i(216),l=i(458),u=i(998);function g(e){switch(this.object=e.object,void 0===e.type&&(e.type=e.object.type),"body"!==e.type&&"composite"!==e.type||(e.type="MatterBody"),this.type=e.type,e.type){case"Polygon":this.getPoints=s.getPoints,this.getSegments=s.getSegments,this.getBoundingBox=u.getBoundingBox,this.updateMap=s.updateMap;break;case"Arc":this.segmentCount=e.segmentCount?e.segmentCount:0,this.circle=!e.segmentCount,this.getPoints=o.getPoints,this.getSegments=o.getSegments,this.getBoundingBox=u.getBoundingBox,this.updateMap=o.updateMap,this.setSegmentCount=l.setSegmentCount;break;case"Line":this.getPoints=r.getPoints,this.getSegments=r.getSegments,this.getBoundingBox=u.getBoundingBox,this.updateMap=r.updateMap;break;case"Container":this.mapChild=e.mapChild?e.mapChild:null,this.segmentCount=e.segmentCount?e.segmentCount:0,this._circles=[],this.getPoints=a.getPoints,this.getSegments=a.getSegments,this.getBoundingBox=u.getBoundingBox,this.updateMap=a.updateMap,this._updateChildMap=a._updateChildMap,this.setSegmentCount=l.setSegmentCount;break;case"StaticTilemapLayer":case"DynamicTilemapLayer":case"TilemapLayer":this.collisionTiles=e.collisionTiles?e.collisionTiles:[],this.getPoints=h.getPoints,this.getSegments=h.getSegments,this.getBoundingBox=u.getBoundingBox,this.updateMap=h.updateMap,this.setCollisionTiles=h.setCollisionTiles,this.object.setOrigin(0,0);break;case"MatterBody":this.forceConvex=!!e.forceConvex,this.forceVerticesMapping=!!e.forceVerticesMapping,this.circle=!1,this.getPoints=c.getPoints,this.getSegments=c.getSegments,this.getBoundingBox=c.getBoundingBox,this.updateMap=c.updateMap;break;default:this.getPoints=n.getPoints,this.getSegments=n.getSegments,this.getBoundingBox=u.getBoundingBox,this.updateMap=n.updateMap}return"MatterBody"!=this.type&&"function"!=typeof this.object.getBounds&&(this.notSupported=!0),this.dynamic=1==e.dynamic,this.active=void 0===e.active||e.active,this}},385:function(e,t,i){"use strict";function n(){for(var e in"body"===this.object.type||"composite"===this.object.type?delete this.object.raycasterMap:this.object.data&&this.object.data.remove("raycasterMap"),this)delete this[e]}i.d(t,{z:function(){return n}})},821:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.active)return[];if(this._points.length>0)return this._points;var t=[],i=new Phaser.Geom.Point;if(i.x=this.object.x-this.object.displayWidth*(this.object.originX-.5),i.y=this.object.y-this.object.displayHeight*(this.object.originY-.5),e){var n,r=new Phaser.Geom.Line,s=new Phaser.Geom.Line,o=this.object.rotation;if(0!==o){var a=new Phaser.Geom.Line(this.object.x,this.object.y,i.x,i.y);Phaser.Geom.Line.SetToAngle(a,this.object.x,this.object.y,Phaser.Geom.Line.Angle(a)+o,Phaser.Geom.Line.Length(a));var h=a.getPointB();n=new Phaser.Geom.Line(e.origin.x,e.origin.y,h.x,h.y)}else n=new Phaser.Geom.Line(e.origin.x,e.origin.y,i.x,i.y);var c=Math.sqrt(Math.pow(Phaser.Geom.Line.Length(n),2)-Math.pow(this.object.radius*this.object.scaleX,2)),l=Phaser.Geom.Line.Angle(n),u=Math.asin(this.object.radius*this.object.scaleX/Phaser.Geom.Line.Length(n));Phaser.Geom.Line.SetToAngle(r,e.origin.x,e.origin.y,l-u,c),Phaser.Geom.Line.SetToAngle(s,e.origin.x,e.origin.y,l+u,c),t.push(r.getPointB()),t.push(s.getPointB()),t[0].neighbours=[t[1]],t[1].neighbours=[t[0]]}return t}function o(){return this.active?this._segments:[]}function a(){if(!this.active)return this;if(!this.segmentCount)return this._points=[],this._segments=[],this;var e=new Phaser.Geom.Point;e.x=this.object.x-this.object.displayWidth*this.object.originX+this.object.radius*this.object.scaleX,e.y=this.object.y-this.object.displayHeight*this.object.originY+this.object.radius*this.object.scaleY;var t=this.object.geom.getPoints(this.segmentCount),i=[],r=this.object.rotation;if(0!==r){var s,o=[],a=n(t);try{for(a.s();!(s=a.n()).done;){var h=s.value,c=new Phaser.Geom.Line(this.object.x,this.object.y,this.object.x+(h.x+this.object.radius)*this.object.scaleX,this.object.y+(h.y+this.object.radius)*this.object.scaleY);Phaser.Geom.Line.SetToAngle(c,this.object.x,this.object.y,Phaser.Geom.Line.Angle(c)+r,Phaser.Geom.Line.Length(c)),o.push(c.getPointB())}}catch(e){a.e(e)}finally{a.f()}t=o}else{var l,u=n(t);try{for(u.s();!(l=u.n()).done;){var g=l.value;g.x=g.x*this.object.scaleX+e.x,g.y=g.y*this.object.scaleY+e.y}}catch(e){u.e(e)}finally{u.f()}}for(var y=0,d=t.length;y<d;y++){var p=y>0?t[y-1]:t.slice(-1)[0],f=y<d-1?t[y+1]:t[0];i.push(new Phaser.Geom.Line(t[y].x,t[y].y,f.x,f.y)),t[y].neighbours=[p,f]}return this._points=t,this._segments=i,this}i.r(t),i.d(t,{getPoints:function(){return s},getSegments:function(){return o},updateMap:function(){return a}})},620:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.active)return[];var i=this._points,r=new Phaser.Geom.Point;if(r.x=this.object.x-this.object.displayWidth*this.object.originX,r.y=this.object.y-this.object.displayHeight*this.object.originY,0==this.segmentCount&&!t&&e){var s=new Phaser.Geom.Line(0,0,e.origin.x-r.x,e.origin.y-r.y);Phaser.Geom.Line.SetToAngle(s,0,0,Phaser.Geom.Line.Angle(s)-this.object.rotation,Phaser.Geom.Line.Length(s));var o,a,h=new Phaser.Geom.Line,c=new Phaser.Geom.Line,l=n(this._circles);try{for(l.s();!(a=l.n()).done;){var u=a.value;u.points=[],o=new Phaser.Geom.Line(e.origin.x,e.origin.y,u.x,u.y);var g=Math.sqrt(Math.pow(Phaser.Geom.Line.Length(o),2)-Math.pow(u.radius,2)),y=Phaser.Geom.Line.Angle(o),d=Math.asin(u.radius/Phaser.Geom.Line.Length(o));Phaser.Geom.Line.SetToAngle(h,e.origin.x,e.origin.y,y-d,g),Phaser.Geom.Line.SetToAngle(c,e.origin.x,e.origin.y,y+d,g),u.points.push(h.getPointB()),u.points.push(c.getPointB()),i.push(h.getPointB()),i.push(c.getPointB())}}catch(e){l.e(e)}finally{l.f()}}return i}function o(){return this.active?this._segments:[]}function a(){if(!this.active)return this;var e=[],t=[],i=this.object;this._circles=[];var r=new Phaser.Geom.Point;r.x=this.object.x-this.object.displayWidth*this.object.originX,r.y=this.object.y-this.object.displayHeight*this.object.originY;var s=i.rotation;if(this.mapChild)this._updateChildMap(this.mapChild,e,t,s,r);else{i.iterate(function(i){this._updateChildMap(i,e,t,s,r)}.bind(this));for(var o=0,a=i.list.length;o<a;o++){var h=i.list[o],c=h.data.get("raycasterMap");if(c)for(var l=o+1,u=i.list.length;l<u;l++){var g=i.list[l],y=g.data.get("raycasterMap");if(y&&Phaser.Geom.Intersects.RectangleToRectangle(h.getBounds(),g.getBounds())){var d,p=n(c.getSegments());try{for(p.s();!(d=p.n()).done;){var f,b=d.value,m=n(y.getSegments());try{for(m.s();!(f=m.n()).done;){var v=f.value,P=[];if(Phaser.Geom.Intersects.LineToLine(b,v,P))if(0!==s){var x=new Phaser.Geom.Line(i.x,i.y,P.x*i.scaleX+r.x,P.y*i.scaleY+r.y);Phaser.Geom.Line.SetToAngle(x,this.object.x,this.object.y,Phaser.Geom.Line.Angle(x)+s,Phaser.Geom.Line.Length(x)),e.push(x.getPointB())}else e.push(new Phaser.Geom.Point(P.x*i.scaleX+r.x,P.y*i.scaleX+r.y))}}catch(e){m.e(e)}finally{m.f()}}}catch(e){p.e(e)}finally{p.f()}}}}}return this._points=e,this._segments=t,this}function h(e,t,i,r,s){if(e.data||e.setDataEnabled(),!e.data.get("raycasterMapNotSupported")){var o=e.data.get("raycasterMap");if(o)o.updateMap();else{if((o=new this.constructor({object:e,segmentCount:this.segmentCount})).notSupported)return o.destroy(),void e.data.set("raycasterMapNotSupported",!0);e.data.set("raycasterMap",o)}var a,h=[],c=n(o.getPoints(!1,!0));try{for(c.s();!(a=c.n()).done;){var l=a.value,u=void 0;if(0!==r){var g=new Phaser.Geom.Line(this.object.x,this.object.y,l.x*this.object.scaleX+s.x,l.y*this.object.scaleY+s.y);Phaser.Geom.Line.SetToAngle(g,this.object.x,this.object.y,Phaser.Geom.Line.Angle(g)+r,Phaser.Geom.Line.Length(g)),u=g.getPointB()}else u=new Phaser.Geom.Point(l.x*this.object.scaleX+s.x,l.y*this.object.scaleX+s.y);if(u.neighbours=[],h.length>0){var y=h.slice(-1)[0];y.neighbours.push(u),u.neighbours.push(y)}h.push(u),t.push(u)}}catch(e){c.e(e)}finally{c.f()}h.length>0&&h.slice(-1)[0].neighbours.push(h[0]);var d,p=n(o.getSegments());try{for(p.s();!(d=p.n()).done;){var f=d.value;if(0!==r){var b=f.getPointA(),m=f.getPointB(),v=new Phaser.Geom.Line(this.object.x,this.object.y,b.x*this.object.scaleX+s.x,b.y*this.object.scaleY+s.y),P=new Phaser.Geom.Line(this.object.x,this.object.y,m.x*this.object.scaleX+s.x,m.y*this.object.scaleY+s.y);Phaser.Geom.Line.SetToAngle(v,this.object.x,this.object.y,Phaser.Geom.Line.Angle(v)+r,Phaser.Geom.Line.Length(v)),Phaser.Geom.Line.SetToAngle(P,this.object.x,this.object.y,Phaser.Geom.Line.Angle(P)+r,Phaser.Geom.Line.Length(P)),i.push(new Phaser.Geom.Line(v.getPointB().x,v.getPointB().y,P.getPointB().x,P.getPointB().y))}else i.push(new Phaser.Geom.Line(f.getPointA().x*this.object.scaleX+s.x,f.getPointA().y*this.object.scaleY+s.y,f.getPointB().x*this.object.scaleX+s.x,f.getPointB().y*this.object.scaleY+s.y))}}catch(e){p.e(e)}finally{p.f()}if("Arc"==o.type&&0==this.segmentCount){var x=new Phaser.Geom.Point;if(x.x=(o.object.x-o.object.displayWidth*(o.object.originX-.5))*this.object.scaleX+s.x,x.y=(o.object.y-o.object.displayHeight*(o.object.originY-.5))*this.object.scaleY+s.y,0!==r){var j=new Phaser.Geom.Line(this.object.x,this.object.y,x.x,x.y);Phaser.Geom.Line.SetToAngle(j,this.object.x,this.object.y,Phaser.Geom.Line.Angle(j)+r,Phaser.Geom.Line.Length(j)),x=j.getPointB()}this._circles.push(new Phaser.Geom.Circle(x.x,x.y,o.object.radius*o.object.scaleX*this.object.scaleX))}else if("Container"===o.type){var M,w=n(o._circles);try{for(w.s();!(M=w.n()).done;){var G=M.value,_=new Phaser.Geom.Point;if(_.x=G.x*this.object.scaleX+s.x,_.y=G.y*this.object.scaleY+s.y,0!==r){var A=new Phaser.Geom.Line(this.object.x,this.object.y,_.x,_.y);Phaser.Geom.Line.SetToAngle(A,this.object.x,this.object.y,Phaser.Geom.Line.Angle(A)+r,Phaser.Geom.Line.Length(A)),_=A.getPointB()}this._circles.push(new Phaser.Geom.Circle(_.x,_.y,G.radius*this.object.scaleX))}}catch(e){w.e(e)}finally{w.f()}}}}i.r(t),i.d(t,{_updateChildMap:function(){return h},getPoints:function(){return s},getSegments:function(){return o},updateMap:function(){return a}})},465:function(e,t,i){"use strict";function n(e,t){return this._raycaster=t||!1,this.type,this.active,this._dynamic=!1,this.circle=!1,this.object,this._points=[],this._segments=[],this.getPoints,this.getSegments,this.getBoundingBox,this.updateMap,this.config(e),this.notSupported||this.updateMap(),this}i.d(t,{T:function(){return n}}),n.prototype={config:i(197).$,destroy:i(385).z,get dynamic(){return this._dynamic},set dynamic(e){if(this._dynamic==e)return this;if(e)this._dynamic=!0,this._raycaster&&(this._raycaster.dynamicMappedObjects.push(this.object),this._raycaster._stats.mappedObjects.dynamic=this._raycaster.dynamicMappedObjects.length,this._raycaster._stats.mappedObjects.static=this._raycaster._stats.mappedObjects.total-this._raycaster._stats.mappedObjects.dynamic);else if(this._dynamic=!1,this._raycaster){var t=this._raycaster.dynamicMappedObjects.indexOf(this.object);t>=0&&this._raycaster.dynamicMappedObjects.splice(t,1),this._raycaster._stats.mappedObjects.dynamic=this._raycaster.dynamicMappedObjects.length,this._raycaster._stats.mappedObjects.static=this._raycaster._stats.mappedObjects.total-this._raycaster._stats.mappedObjects.dynamic}return this}},n.prototype.constructor=n},919:function(e,t,i){"use strict";function n(){return this.active?this._points:[]}function r(){return this.active?this._segments:[]}function s(){if(!this.active)return this;var e=[],t=[],i=new Phaser.Geom.Point;i.x=this.object.x-this.object.displayWidth*this.object.originX,i.y=this.object.y-this.object.displayHeight*this.object.originY;var n=this.object.geom.getPointA(),r=this.object.geom.getPointB(),s=this.object.rotation;if(0!==s){var o=new Phaser.Geom.Line(this.object.x,this.object.y,n.x*this.object.scaleX+i.x,n.y*this.object.scaleY+i.y);Phaser.Geom.Line.SetToAngle(o,this.object.x,this.object.y,Phaser.Geom.Line.Angle(o)+s,Phaser.Geom.Line.Length(o)),n=o.getPointB();var a=new Phaser.Geom.Line(this.object.x,this.object.y,r.x*this.object.scaleX+i.x,r.y*this.object.scaleY+i.y);Phaser.Geom.Line.SetToAngle(a,this.object.x,this.object.y,Phaser.Geom.Line.Angle(a)+s,Phaser.Geom.Line.Length(a)),r=a.getPointB(),e.push(new Phaser.Geom.Point(n.x,n.y)),e.push(new Phaser.Geom.Point(r.x,r.y)),t.push(new Phaser.Geom.Line(n.x,n.y,r.x,r.y))}else e.push(new Phaser.Geom.Point(n.x*this.object.scaleX+i.x,n.y*this.object.scaleY+i.y)),e.push(new Phaser.Geom.Point(r.x*this.object.scaleX+i.x,r.y*this.object.scaleY+i.y)),t.push(new Phaser.Geom.Line(n.x*this.object.scaleX+i.x,n.y*this.object.scaleY+i.y,r.x+i.x*this.object.scaleX,r.y*this.object.scaleY+i.y));return e[0].neighbours=[e[1]],e[1].neighbours=[e[0]],this._points=e,this._segments=t,this}i.r(t),i.d(t,{getPoints:function(){return n},getSegments:function(){return r},updateMap:function(){return s}})},216:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.active)return[];var t="body"===this.object.type||"composite"===this.object.type?this.object:this.object.body;if(e&&!this.forceVerticesMapping&&t.circleRadius>0){var i=[],n=new Phaser.Geom.Line,r=new Phaser.Geom.Line,s=new Phaser.Geom.Line(e.origin.x,e.origin.y,t.position.x,t.position.y),o=Math.sqrt(Math.pow(Phaser.Geom.Line.Length(s),2)-Math.pow(t.circleRadius*t.scale.x,2)),a=Phaser.Geom.Line.Angle(s),h=Math.asin(t.circleRadius*t.scale.x/Phaser.Geom.Line.Length(s));return Phaser.Geom.Line.SetToAngle(n,e.origin.x,e.origin.y,a-h,o),Phaser.Geom.Line.SetToAngle(r,e.origin.x,e.origin.y,a+h,o),i.push(n.getPointB(),r.getPointB()),i}return this._points}function o(){return this.active?this._segments:[]}function a(){if(!this.active)return this;var e=[],t=[],i="body"===this.object.type||"composite"===this.object.type?this.object:this.object.body,r=[i],s=!1;if(i.circleRadius>0&&!this.forceVerticesMapping)return this.circle=!0,this._points=e,this._segments=t,this;this.circle=!1,"composite"==i.type&&(r=i.bodies),(void 0===i.bounds&&"composite"==i.type||"composite"==i.type&&this.dynamic)&&(s=!0);var o,a=n(r);try{for(a.s();!(o=a.n()).done;){var h=o.value;if(1===h.parts.length||this.forceConvex){var c=h.parts[0].vertices;e.push(new Phaser.Geom.Point(c[0].x,c[0].y)),e[0].neighbours=[];for(var l=1,u=c.length;l<u;l++){var g=e.slice(-1)[0],y=new Phaser.Geom.Point(c[l].x,c[l].y);g.neighbours||(g.neighbours=[]),g.neighbours.push(y),y.neighbours=[g],e.push(y);var d=new Phaser.Geom.Line(g.x,g.y,y.x,y.y);t.push(d)}var p=new Phaser.Geom.Line(c[c.length-1].x,c[c.length-1].y,c[0].x,c[0].y);t.push(p),e[0].neighbours.push(e.slice(-1)[0])}else{for(var f=[],b=[],m=1,v=h.parts.length;m<v;m++){for(var P=h.parts[m].vertices,x=[],j=0,M=P.length;j<M;j++){var w=new Phaser.Geom.Point(P[j].x,P[j].y);if(x.length){var G=x.slice(-1)[0];w.neighbours=[G],G.neighbours.push(w)}else w.neighbours=[];var _=P[j].x+"/"+P[j].y;void 0===b[_]?(e.push(w),b[_]=w):(b[_].neighbours.push(w),w.neighbours.push(b[_])),x.push(w),P[j].isInternal&&(f.push(x),x=[])}f.push(x)}for(var A=0,S=f;A<S.length;A++){var B,L=S[A],O=0;for(O=0,B=L.length-1;O<B;O++)t.push(new Phaser.Geom.Line(L[O].x,L[O].y,L[O+1].x,L[O+1].y))}}}}catch(e){a.e(e)}finally{a.f()}if(this._points=e,this._segments=t,s){var T=this._raycaster.scene.matter.composite.bounds(i);i.bounds=T}return this}function h(){var e="body"===this.object.type||"composite"===this.object.type?this.object.bounds:this.object.body.bounds;return new Phaser.Geom.Rectangle(e.min.x,e.min.y,e.max.x-e.min.x,e.max.y-e.min.y)}i.r(t),i.d(t,{getBoundingBox:function(){return h},getPoints:function(){return s},getSegments:function(){return o},updateMap:function(){return a}})},645:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){return this.active?this._points:[]}function o(){return this.active?this._segments:[]}function a(){if(!this.active)return this;var e=[],t=[],i=new Phaser.Geom.Point;i.x=this.object.x-this.object.displayWidth*this.object.originX,i.y=this.object.y-this.object.displayHeight*this.object.originY;var r=this.object.rotation;if(0!==r){var s,o=n(this.object.geom.points);try{for(o.s();!(s=o.n()).done;){var a=s.value,h=new Phaser.Geom.Line(this.object.x,this.object.y,a.x*this.object.scaleX+i.x,a.y*this.object.scaleY+i.y);Phaser.Geom.Line.SetToAngle(h,this.object.x,this.object.y,Phaser.Geom.Line.Angle(h)+r,Phaser.Geom.Line.Length(h)),e.push(h.getPointB())}}catch(e){o.e(e)}finally{o.f()}}else{var c,l=n(this.object.geom.points);try{for(l.s();!(c=l.n()).done;){var u=c.value;e.push(new Phaser.Geom.Point(u.x*this.object.scaleX+i.x,u.y*this.object.scaleY+i.y))}}catch(e){l.e(e)}finally{l.f()}}for(var g=0,y=e.length;g<y;g++){var d=g>0?e[g-1]:e.slice(-1)[0],p=g<y-1?e[g+1]:e[0];t.push(new Phaser.Geom.Line(e[g].x,e[g].y,p.x,p.y)),e[g].neighbours=[d,p]}for(var f=0,b=e.length;f<b;f++)f+1<b&&t.push(new Phaser.Geom.Line(e[f].x,e[f].y,e[f+1].x,e[f+1].y));return this.object.closePath||(t.pop(),e[0].neighbours.shift(),e[e.length-1].neighbours.pop()),this._points=e,this._segments=t,this}i.r(t),i.d(t,{getPoints:function(){return s},getSegments:function(){return o},updateMap:function(){return a}})},502:function(e,t,i){"use strict";function n(){return this.active?this._points:[]}function r(){return this.active?this._segments:[]}function s(){if(!this.active)return this;for(var e=[],t=[],i=0,n=(e=[this.object.getTopLeft(),this.object.getTopRight(),this.object.getBottomRight(),this.object.getBottomLeft()]).length;i<n;i++){var r=i>0?e[i-1]:e.slice(-1)[0],s=i<n-1?e[i+1]:e[0];t.push(new Phaser.Geom.Line(e[i].x,e[i].y,s.x,s.y)),e[i].neighbours=[r,s]}return this._points=e,this._segments=t,this}i.r(t),i.d(t,{getPoints:function(){return n},getSegments:function(){return r},updateMap:function(){return s}})},265:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.active)return[];if(!e||e&&(0==e.detectionRange||e.detectionRange>=Phaser.Math.MAX_SAFE_INTEGER))return this._points;var t,i=[],r=n(this._points);try{for(r.s();!(t=r.n()).done;){var s=t.value;Phaser.Math.Distance.Between(e.origin.x,e.origin.y,s.x,s.y)<=e.detectionRange&&i.push(s)}}catch(e){r.e(e)}finally{r.f()}var o,a=n(this.getSegments(e));try{for(a.s();!(o=a.n()).done;){var h=o.value;Phaser.Math.Distance.Between(e.origin.x,e.origin.y,h.x1,h.y1)>e.detectionRange&&i.push(new Phaser.Geom.Point(h.x1,h.y1)),Phaser.Math.Distance.Between(e.origin.x,e.origin.y,h.x2,h.y2)>e.detectionRange&&i.push(new Phaser.Geom.Point(h.x2,h.y2))}}catch(e){a.e(e)}finally{a.f()}return i}function o(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.active)return[];if(!e||e&&(0==e.detectionRange||e.detectionRange>=Phaser.Math.MAX_SAFE_INTEGER))return this._segments;var t,i=[],r=n(this._segments);try{for(r.s();!(t=r.n()).done;){var s=t.value;Phaser.Geom.Intersects.LineToCircle(s,e.detectionRangeCircle)&&i.push(s)}}catch(e){r.e(e)}finally{r.f()}return i}function a(){if(!this.active)return this;for(var e=[],t=[],i=Array(this.object.layer.data[0].length+1),n=0,r=i.length;n<r;n++)i[n]=[];var s,o,a=new Phaser.Geom.Point(this.object.x,this.object.y),h=this.object.layer.data[0],c=this.object.layer.tileWidth*this.object.scaleX,l=this.object.layer.tileHeight*this.object.scaleY;this.collisionTiles.includes(h[0].index)&&(s=new Phaser.Geom.Point(a.x,a.y),o=new Phaser.Geom.Point(c+a.x,a.y),i[0].push(s));for(var u=1,g=h.length;u<g;u++){var y=h[u];if(this.collisionTiles.includes(y.index)){var d=u*c+a.x,p=a.y;s||(s=new Phaser.Geom.Point(d,p),i[u].push(s)),o?o.x=d+c:o=new Phaser.Geom.Point(d+c,p)}else s&&(s.neighbours=[o],o.neighbours=[s],e.push(s,o),t.push(new Phaser.Geom.Line(s.x,s.y,o.x,o.y)),i[u].push(o),s=!1,o=!1)}s&&(s.neighbours=[o],o.neighbours=[s],e.push(s,o),t.push(new Phaser.Geom.Line(s.x,s.y,o.x,o.y)),i[h.length].push(o)),s=!1,o=!1;for(var f=1,b=this.object.layer.data.length;f<b;f++){h=this.object.layer.data[f];var m=this.object.layer.data[f-1];this.collisionTiles.includes(h[0].index)!=this.collisionTiles.includes(m[0].index)&&(s=new Phaser.Geom.Point(a.x,f*l+a.y),o=new Phaser.Geom.Point(c+a.x,f*l+a.y),i[0].push(s));for(var v=1,P=h.length;v<P;v++){var x=h[v];if(this.collisionTiles.includes(x.index)!=this.collisionTiles.includes(m[v].index)){var j=v*c+a.x,M=f*l+a.y;s||(s=new Phaser.Geom.Point(j,M),i[v].push(s)),o?o.x=j+c:o=new Phaser.Geom.Point(j+c,M)}else s&&(s.neighbours=[o],o.neighbours=[s],e.push(s,o),t.push(new Phaser.Geom.Line(s.x,s.y,o.x,o.y)),i[v].push(o),s=!1,o=!1)}s&&(s.neighbours=[o],o.neighbours=[s],e.push(s,o),t.push(new Phaser.Geom.Line(s.x,s.y,o.x,o.y)),i[h.length].push(o)),s=!1,o=!1}h=this.object.layer.data.slice(-1)[0];var w=this.object.layer.data.length*l+a.y;this.collisionTiles.includes(h[0].index)&&(s=new Phaser.Geom.Point(a.x,w),o=new Phaser.Geom.Point(c+a.x,w),i[0].push(s));for(var G=1,_=h.length;G<_;G++){var A=h[G];if(this.collisionTiles.includes(A.index)){var S=G*c+a.x;s||(s=new Phaser.Geom.Point(S,w),i[G].push(s)),o?o.x=S+c:o=new Phaser.Geom.Point(S+c,w)}else s&&(s.neighbours=[o],o.neighbours=[s],e.push(s,o),t.push(new Phaser.Geom.Line(s.x,s.y,o.x,o.y)),i[G].push(o),s=!1,o=!1)}s&&(s.neighbours=[o],o.neighbours=[s],e.push(s,o),t.push(new Phaser.Geom.Line(s.x,s.y,o.x,o.y)),i[h.length].push(o));for(var B=0,L=i.length;B<L;B++)for(var O=i[B],T=0,C=O.length-1;T<C;T++)t.push(new Phaser.Geom.Line(O[T].x,O[T].y,O[T+1].x,O[T+1].y)),O[T].neighbours.push(O[T+1]),O[T+1].neighbours.push(O[T]),T++;return this._points=e,this._segments=t,this}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.collisionTiles=e,this}i.r(t),i.d(t,{getPoints:function(){return s},getSegments:function(){return o},setCollisionTiles:function(){return h},updateMap:function(){return a}})},458:function(e,t,i){"use strict";function n(e){return this.segmentCount=e,this.circle=!e,this.updateMap(),this}i.r(t),i.d(t,{setSegmentCount:function(){return n}})},822:function(e,t,i){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.angle=Phaser.Math.Angle.Normalize(e),Phaser.Geom.Line.SetToAngle(this._ray,this.origin.x,this.origin.y,this.angle,this.rayRange),this}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.angle=Phaser.Math.Angle.Normalize(Phaser.Math.DegToRad(e)),Phaser.Geom.Line.SetToAngle(this._ray,this.origin.x,this.origin.y,this.angle,this.rayRange),this}i.d(t,{O:function(){return r},S:function(){return n}})},974:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e,t,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=this.rayRange,o=!!r.internal&&r.internal,a=performance.now(),h={method:"cast",rays:1,testedMappedObjects:0,hitMappedObjects:0,segments:0,time:0};if(this._raycaster&&this._raycaster.boundingBox){var c=[];if(Phaser.Geom.Intersects.GetLineToRectangle(this._ray,this._raycaster.boundingBox.rectangle,c),1===c.length)e=c[0];else if(c.length>1){var l,u=n(c);try{for(u.s();!(l=u.n()).done;){var g=l.value,y=Phaser.Math.Distance.Between(this.origin.x,this.origin.y,g.x,g.y);y<s&&(s=y,e=g)}}catch(e){u.e(e)}finally{u.f()}}else if(r.target){var d=Phaser.Math.Distance.Between(this.origin.x,this.origin.y,r.target.x,r.target.y);this.rayRange>d&&(s=d,e=r.target)}}if(!r.objects){if(!this._raycaster)return intersections;r.objects=this._raycaster.mappedObjects}var p,f,b=n(r.objects);try{for(b.s();!(p=b.n()).done;){var m=p.value,v=void 0,P=void 0,x=[],j=!1;if(v="body"===m.type||"composite"===m.type?m.raycasterMap:m.data.get("raycasterMap"),h.testedMappedObjects++,o?P=v._boundingBox:(P=v.getBoundingBox()).setTo(P.x-.1,P.y-.1,P.width+.2,P.height+.2),0!==Phaser.Geom.Intersects.GetLineToRectangle(this._ray,P,x).length){if(Phaser.Geom.Rectangle.ContainsPoint(P,this.origin))j=!0;else{var M,w=n(x);try{for(w.s();!(M=w.n()).done;){var G=M.value;if(Phaser.Math.Distance.Between(this.origin.x,this.origin.y,G.x,G.y)<s){j=!0;break}}}catch(e){w.e(e)}finally{w.f()}}if(j){h.hitMappedObjects++,h.segments+=v.getSegments(this).length;var _,A=n(v.getSegments(this));try{for(A.s();!(_=A.n()).done;){var S=_.value,B=[];if(r.target){if(Phaser.Geom.Point.Equals(r.target,S.getPointA())||Phaser.Geom.Point.Equals(r.target,S.getPointB()))B=r.target;else if(!Phaser.Geom.Intersects.LineToLine(this._ray,S,B))continue}else if(!Phaser.Geom.Intersects.LineToLine(this._ray,S,B))continue;var L=Phaser.Math.Distance.Between(this.origin.x,this.origin.y,B.x,B.y);L<s&&(s=L,e=B,i=v.object,t=S)}}catch(e){A.e(e)}finally{A.f()}if(v.circle){if(v._points.length>0)continue;if(r.target){var O,T=v.getPoints(this),C=!1,R=n(T);try{for(R.s();!(O=R.n()).done;){var I=O.value;if(Phaser.Geom.Point.Equals(r.target,I)){var E=Phaser.Math.Distance.Between(this.origin.x,this.origin.y,I.x,I.y);if(E<s){s=E,e=I,i=v.object,C=!0;break}}}}catch(e){R.e(e)}finally{R.f()}if(C)continue}var D=[],X=new Phaser.Geom.Point;X.x=v.object.x-v.object.displayWidth*(v.object.originX-.5),X.y=v.object.y-v.object.displayHeight*(v.object.originY-.5);var k=v.object.rotation;if(0!==k){var Y=new Phaser.Geom.Line(v.object.x,v.object.y,X.x,X.y);Phaser.Geom.Line.SetToAngle(Y,v.object.x,v.object.y,Phaser.Geom.Line.Angle(Y)+k,Phaser.Geom.Line.Length(Y));var N=Y.getPointB();X.x=N.x,X.y=N.y}var W=new Phaser.Geom.Circle(X.x,X.y,v.object.radius*v.object.scaleX);if(Phaser.Geom.Intersects.GetLineToCircle(this._ray,W,D)){var z,$=n(D);try{for($.s();!(z=$.n()).done;){var q=z.value,F=Phaser.Math.Distance.Between(this._ray.x1,this._ray.y1,q.x,q.y);F<s&&(s=F,e=q,i=v.object)}}catch(e){$.e(e)}finally{$.f()}}}if("Container"==v.type&&v._circles.length>0){var U,H=n(v._circles);try{for(H.s();!(U=H.n()).done;){var V=U.value;if(r.target){var Z,J=!1,K=n(V.points);try{for(K.s();!(Z=K.n()).done;){var Q=Z.value;if(Phaser.Geom.Point.Equals(r.target,Q)){var ee=Phaser.Math.Distance.Between(this.origin.x,this.origin.y,Q.x,Q.y);if(ee<s){s=ee,e=Q,i=v.object,J=!0;break}}}}catch(e){K.e(e)}finally{K.f()}if(J)continue}var te=[];if(Phaser.Geom.Intersects.GetLineToCircle(this._ray,V,te)){var ie,ne=n(te);try{for(ne.s();!(ie=ne.n()).done;){var re=ie.value,se=Phaser.Math.Distance.Between(this._ray.x1,this._ray.y1,re.x,re.y);se<s&&(s=se,e=re,i=v.object)}}catch(e){ne.e(e)}finally{ne.f()}}}}catch(e){H.e(e)}finally{H.f()}}}}}}catch(e){b.e(e)}finally{b.f()}if(o?(this._stats.rays++,this._stats.testedMappedObjects+=h.testedMappedObjects,this._stats.hitMappedObjects+=h.hitMappedObjects,this._stats.segments+=h.segments):(h.time=performance.now()-a,this._stats=h),e)(f=new Phaser.Geom.Point(e.x,e.y)).segment=t,f.object=i;else{if(this.ignoreNotIntersectedRays)return!1;f=this._ray.getPointB()}return this.round&&(f.x=Math.round(f.x),f.y=Math.round(f.y)),o||this.drawDebug([f]),f}i.d(t,{w:function(){return s}})},506:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.angle,i=[],r=[],s=[],o=[],a=performance.now();if(this._stats={method:"castCircle",rays:0,testedMappedObjects:0,hitMappedObjects:0,segments:0,time:0},!e.objects){if(!this._raycaster)return i;e.objects=this._raycaster.mappedObjects}if(this._raycaster&&this._raycaster.boundingBox){var h,c=n(this._raycaster.boundingBox.points);try{for(c.s();!(h=c.n()).done;){var l=h.value;s.push({point:l,angle:Phaser.Math.Angle.Between(this.origin.x,this.origin.y,l.x,l.y)})}}catch(e){c.e(e)}finally{c.f()}}for(var u=0,g=e.objects.length;u<g;u++){var y=e.objects[u];if(this.boundsInRange(y)){o.push(y);var d=void 0,p=void 0;(p=(d="body"===y.type||"composite"===y.type?y.raycasterMap:y.data.get("raycasterMap")).getBoundingBox()).setTo(p.x-.1,p.y-.1,p.width+.2,p.height+.2),d._boundingBox=p,r.push(d);var f,b=n(d.getPoints(this));try{for(b.s();!(f=b.n()).done;){var m=f.value;s.push({point:m,angle:Phaser.Math.Angle.Between(this.origin.x,this.origin.y,m.x,m.y)})}}catch(e){b.e(e)}finally{b.f()}for(var v=u+1,P=e.objects.length;v<P;v++){var x=e.objects[v],j=void 0;if(j="body"===x.type||"composite"===x.type?x.raycasterMap:x.data.get("raycasterMap"),Phaser.Geom.Intersects.RectangleToRectangle(d.getBoundingBox(),j.getBoundingBox())){var M,w=n(d.getSegments(this));try{for(w.s();!(M=w.n()).done;){var G,_=M.value,A=n(j.getSegments(this));try{for(A.s();!(G=A.n()).done;){var S=G.value,B=[];if(Phaser.Geom.Intersects.LineToLine(_,S,B)){var L={point:new Phaser.Geom.Point(B.x,B.y),angle:Phaser.Math.Angle.Between(this.origin.x,this.origin.y,B.x,B.y)};L.point.intersection=!1,s.push(L)}}}catch(e){A.e(e)}finally{A.f()}}}catch(e){w.e(e)}finally{w.f()}}}}}s.sort(function(e,t){return e.angle==t.angle?Phaser.Math.Distance.Between(this.origin.x,this.origin.y,e.point.x,e.point.y)>Phaser.Math.Distance.Between(this.origin.x,this.origin.y,t.point.x,t.point.y)?1:-1:e.angle-t.angle}.bind(this));for(var O={angle:!1},T=0,C=s;T<C.length;T++){var R=C[T];if(R.angle!==O.angle){O=R,this.setAngle(R.angle);var I=this.cast({objects:o,target:R.point,internal:!0});if(I){var E=!1;if(this.round){var D=new Phaser.Geom.Point(Math.round(R.point.x),Math.round(R.point.y));E=Phaser.Geom.Point.Equals(D,I)}else E=Phaser.Geom.Point.Equals(R.point,I);if(E)if(!R.point.neighbours||R.point.neighbours.length<2);else if(Phaser.Math.Angle.Normalize(this.angle-Phaser.Math.Angle.BetweenPoints(this.origin,R.point.neighbours[0]))<1e-4||Phaser.Math.Angle.Normalize(this.angle-Phaser.Math.Angle.BetweenPoints(this.origin,R.point.neighbours[1]))<1e-4);else{var X=[];R.point.neighboursTriangle||(R.point.neighboursTriangle=new Phaser.Geom.Triangle(R.point.x,R.point.y,R.point.neighbours[0].x,R.point.neighbours[0].y,R.point.neighbours[1].x,R.point.neighbours[1].y)),Phaser.Geom.Intersects.GetTriangleToLine(R.point.neighboursTriangle,this._ray,X);for(var k=0,Y=X;k<Y.length;k++){var N=Y[k];if(Math.abs(R.point.x-N.x)>1e-4&&Math.abs(R.point.y-N.y)>1e-4){E=!1;break}}}else;if(E){this.setAngle(R.angle-1e-4);var W=this.cast({objects:o,internal:!0});W&&i.push(W),i.push(I),this.setAngle(R.angle+1e-4);var z=this.cast({objects:o,internal:!0});z&&i.push(z);continue}i.push(I)}}}return this.setAngle(t),this.intersections=i,this.autoSlice&&(this.slicedIntersections=this.slice()),this._stats.time=performance.now()-a,this.drawDebug(i),i}i.d(t,{I:function(){return s}})},757:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.angle,s=[],o=[],a=[],h=[],c=this.cone,l=performance.now();if(this._stats={method:"castCone",rays:0,testedMappedObjects:0,hitMappedObjects:0,segments:0,time:0},void 0!==i.cone&&(c=i.cone),void 0!==i.coneDeg&&(c=Phaser.Math.DegToRad(i.coneDeg)),e=this.angle-c/2,t=this.angle+c/2,this.setAngle(e),a.push({point:this._ray.getPointB(),angle:e,angleOffsetDeg:Phaser.Math.RadToDeg(-c/2)}),this.setAngle(t),a.push({point:this._ray.getPointB(),angle:t,angleOffsetDeg:Phaser.Math.RadToDeg(c/2)}),!i.objects){if(!this._raycaster)return s;i.objects=this._raycaster.mappedObjects}if(this._raycaster&&this._raycaster.boundingBox){var u,g=n(this._raycaster.boundingBox.points);try{for(g.s();!(u=g.n()).done;){var y=u.value,d=Phaser.Math.Angle.Between(this.origin.x,this.origin.y,y.x,y.y),p=Phaser.Math.Angle.ShortestBetween(Phaser.Math.RadToDeg(d),Phaser.Math.RadToDeg(r));Math.abs(p)<Phaser.Math.RadToDeg(c/2)&&a.push({point:y,angle:d,angleOffsetDeg:-p})}}catch(e){g.e(e)}finally{g.f()}}for(var f=0,b=i.objects.length;f<b;f++){var m=i.objects[f];if(this.boundsInRange(m)){h.push(m);var v=void 0,P=void 0;(P=(v="body"===m.type||"composite"===m.type?m.raycasterMap:m.data.get("raycasterMap")).getBoundingBox()).setTo(P.x-.1,P.y-.1,P.width+.2,P.height+.2),v._boundingBox=P,o.push(v);var x,j=n(v.getPoints(this));try{for(j.s();!(x=j.n()).done;){var M=x.value,w=Phaser.Math.Angle.Between(this.origin.x,this.origin.y,M.x,M.y),G=Phaser.Math.Angle.ShortestBetween(Phaser.Math.RadToDeg(w),Phaser.Math.RadToDeg(r));Math.abs(G)<Phaser.Math.RadToDeg(c/2)&&a.push({point:M,angle:Phaser.Math.Angle.Between(this.origin.x,this.origin.y,M.x,M.y),angleOffsetDeg:-G})}}catch(e){j.e(e)}finally{j.f()}for(var _=f+1,A=i.objects.length;_<A;_++){var S=i.objects[_],B=void 0;if(B="body"===S.type||"composite"===S.type?S.raycasterMap:S.data.get("raycasterMap"),Phaser.Geom.Intersects.RectangleToRectangle(v.getBoundingBox(),B.getBoundingBox())){var L,O=n(v.getSegments(this));try{for(O.s();!(L=O.n()).done;){var T,C=L.value,R=n(B.getSegments(this));try{for(R.s();!(T=R.n()).done;){var I=T.value,E=[];if(Phaser.Geom.Intersects.LineToLine(C,I,E)){var D=Phaser.Math.Angle.Between(this.origin.x,this.origin.y,E.x,E.y),X=Phaser.Math.Angle.ShortestBetween(Phaser.Math.RadToDeg(D),Phaser.Math.RadToDeg(r));Math.abs(X)<Phaser.Math.RadToDeg(c/2)&&a.push({point:new Phaser.Geom.Point(E.x,E.y),angle:Phaser.Math.Angle.Between(this.origin.x,this.origin.y,E.x,E.y),angleOffsetDeg:-X})}}}catch(e){R.e(e)}finally{R.f()}}}catch(e){O.e(e)}finally{O.f()}}}}}a.sort(function(e,t){return e.angle==t.angle?Phaser.Math.Distance.Between(this.origin.x,this.origin.y,e.point.x,e.point.y)>Phaser.Math.Distance.Between(this.origin.x,this.origin.y,t.point.x,t.point.y)?1:-1:e.angleOffsetDeg-t.angleOffsetDeg}.bind(this));for(var k={angle:!1},Y=0,N=a;Y<N.length;Y++){var W=N[Y];if(W.angle!==k.angle){k=W,this.setAngle(W.angle);var z=this.cast({objects:h,target:W.point,internal:!0});if(z){var $=!1;if(this.round){var q=new Phaser.Geom.Point(Math.round(W.point.x),Math.round(W.point.y));$=Phaser.Geom.Point.Equals(q,z)}else $=Phaser.Geom.Point.Equals(W.point,z);if($)if(!W.point.neighbours||W.point.neighbours.length<2);else if(Phaser.Math.Angle.Normalize(this.angle-Phaser.Math.Angle.BetweenPoints(this.origin,W.point.neighbours[0]))<1e-4||Phaser.Math.Angle.Normalize(this.angle-Phaser.Math.Angle.BetweenPoints(this.origin,W.point.neighbours[1]))<1e-4);else{var F=[];W.point.neighboursTriangle||(W.point.neighboursTriangle=new Phaser.Geom.Triangle(W.point.x,W.point.y,W.point.neighbours[0].x,W.point.neighbours[0].y,W.point.neighbours[1].x,W.point.neighbours[1].y)),Phaser.Geom.Intersects.GetTriangleToLine(W.point.neighboursTriangle,this._ray,F);for(var U=0,H=F;U<H.length;U++){var V=H[U];if(Math.abs(W.point.x-V.x)>1e-4&&Math.abs(W.point.y-V.y)>1e-4){$=!1;break}}}else;if($){this.setAngle(W.angle-1e-4);var Z=this.cast({objects:h,internal:!0});Z&&s.push(Z),s.push(z),this.setAngle(W.angle+1e-4);var J=this.cast({objects:h,internal:!0});J&&s.push(J);continue}s.push(z)}}}return this.setAngle(r),this.intersections=s,this.autoSlice&&(this.slicedIntersections=this.slice(s,!1)),this._stats.time=performance.now()-l,this.drawDebug(s),s}i.d(t,{d:function(){return s}})},582:function(e,t,i){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.cone=e,this}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.cone=Phaser.Math.DegToRad(e),this}i.d(t,{M:function(){return n},U:function(){return r}})},807:function(e,t,i){"use strict";function n(e){return this.object=e.object,void 0!==e.origin&&this.origin.setTo(e.origin.x,e.origin.y),void 0!==e.angle&&(this.angle=Phaser.Math.Angle.Normalize(e.angle)),void 0!==e.angleDeg&&(this.angle=Phaser.Math.Angle.Normalize(Phaser.Math.DegToRad(e.angleDeg))),void 0!==e.cone&&(this.cone=e.cone),void 0!==e.coneDeg&&(this.cone=Phaser.Math.DegToRad(e.coneDeg)),void 0!==e.rayRange&&(this.rayRange=e.rayRange),void 0!==e.collisionRange&&(this.collisionRange=e.collisionRange),void 0!==e.detectionRange&&(this.detectionRange=e.detectionRange),void 0!==e.ignoreNotIntersectedRays&&(this.ignoreNotIntersectedRays=1==e.ignoreNotIntersectedRays),void 0!==e.round&&(this.round=1==e.round),void 0!==e.autoSlice&&(this.autoSlice=1==e.autoSlice),void 0!==e.enablePhysics&&e.enablePhysics&&this.enablePhysics(e.enablePhysics),Phaser.Geom.Line.SetToAngle(this._ray,this.origin.x,this.origin.y,this.angle,this.rayRange),this.detectionRangeCircle.setTo(this.origin.x,this.origin.y,this.detectionRange),this._raycaster.debugOptions.enabled&&void 0!==this._raycaster.scene&&(this.graphics=this._raycaster.scene.add.graphics({lineStyle:{width:1,color:65280},fillStyle:{color:16711935}}),this.graphics.setDepth(1e3)),this}i.d(t,{$:function(){return n}})},882:function(e,t,i){"use strict";function n(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,h=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){h=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(h)throw o}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function s(e){if(void 0===this.graphics||!this._raycaster.debugOptions.enabled)return this;if(this.graphics.clear(),!this._raycaster.debugOptions.rays)return this;if(this._raycaster.debugOptions.graphics.ray){this.graphics.lineStyle(1,this._raycaster.debugOptions.graphics.ray);var t,i=n(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;this.graphics.strokeLineShape({x1:this.origin.x,y1:this.origin.y,x2:r.x,y2:r.y})}}catch(e){i.e(e)}finally{i.f()}}if(this._raycaster.debugOptions.graphics.rayPoint){this.graphics.fillStyle(this._raycaster.debugOptions.graphics.rayPoint),this.graphics.fillPoint(this.origin.x,this.origin.y,3);var s,o=n(e);try{for(o.s();!(s=o.n()).done;){var a=s.value;this.graphics.fillPoint(a.x,a.y,3)}}catch(e){o.e(e)}finally{o.f()}}return this}i.d(t,{s:function(){return s}})},487:function(e,t,i){"use strict";function n(){for(var e in this.graphics&&this.graphics.destroy(),this)delete this[e]}i.d(t,{z:function(){return n}})},181:function(e,t,i){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"arcade";if(void 0!==this.body)return this;if(this.collisionCircle=this._raycaster.scene.add.circle(this.origin.x,this.origin.y,this.collisionRange),this.collisionCircle._ray=this,"matter"===e){if(this.bodyType="matter",this.collisionRange==Phaser.Math.MAX_SAFE_INTEGER){var t=this._raycaster.boundingBox;this._raycaster.scene.matter.add.gameObject(this.collisionCircle,{shape:{type:"rectangle",x:t.rectangle.centerX,y:t.rectangle.centerY,width:t.rectangle.width,height:t.rectangle.height},label:"phaser-raycaster-ray-body",isSensor:!0,ignoreGravity:!0})}else this._raycaster.scene.matter.add.gameObject(this.collisionCircle,{shape:{type:"circle"},label:"phaser-raycaster-ray-body",isSensor:!0,ignoreGravity:!0});this.bo