From 571188506bb5675d55d214b034b04c1d13de8665 Mon Sep 17 00:00:00 2001 From: Scott Westover Date: Fri, 29 Mar 2024 14:21:45 -0400 Subject: [PATCH] updated shader example Signed-off-by: Scott Westover --- .../{index-BgEoxzBH.js => index-DN94fAOg.js} | 38 +++++++++++++------ examples/shader-examples/index.html | 2 +- 2 files changed, 27 insertions(+), 13 deletions(-) rename examples/shader-examples/assets/js/{index-BgEoxzBH.js => index-DN94fAOg.js} (99%) diff --git a/examples/shader-examples/assets/js/index-BgEoxzBH.js b/examples/shader-examples/assets/js/index-DN94fAOg.js similarity index 99% rename from examples/shader-examples/assets/js/index-BgEoxzBH.js rename to examples/shader-examples/assets/js/index-DN94fAOg.js index a337cd8..7a28b7d 100644 --- a/examples/shader-examples/assets/js/index-BgEoxzBH.js +++ b/examples/shader-examples/assets/js/index-DN94fAOg.js @@ -1,4 +1,4 @@ -var Ft=(at,nt,ut)=>{if(!nt.has(at))throw TypeError("Cannot "+ut)};var Mt=(at,nt,ut)=>(Ft(at,nt,"read from private field"),ut?ut.call(at):nt.get(at)),Lt=(at,nt,ut)=>{if(nt.has(at))throw TypeError("Cannot add the same private member more than once");nt instanceof WeakSet?nt.add(at):nt.set(at,ut)},Rt=(at,nt,ut,mt)=>(Ft(at,nt,"write to private field"),mt?mt.call(at,ut):nt.set(at,ut),ut);(function(){const nt=document.createElement("link").relList;if(nt&&nt.supports&&nt.supports("modulepreload"))return;for(const ft of document.querySelectorAll('link[rel="modulepreload"]'))mt(ft);new MutationObserver(ft=>{for(const pt of ft)if(pt.type==="childList")for(const p of pt.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&mt(p)}).observe(document,{childList:!0,subtree:!0});function ut(ft){const pt={};return ft.integrity&&(pt.integrity=ft.integrity),ft.referrerPolicy&&(pt.referrerPolicy=ft.referrerPolicy),ft.crossOrigin==="use-credentials"?pt.credentials="include":ft.crossOrigin==="anonymous"?pt.credentials="omit":pt.credentials="same-origin",pt}function mt(ft){if(ft.ep)return;ft.ep=!0;const pt=ut(ft);fetch(ft.href,pt)}})();var Yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wt(at){return at&&at.__esModule&&Object.prototype.hasOwnProperty.call(at,"default")?at.default:at}var Vt={exports:{}};(function(at,nt){(function(mt,ft){at.exports=ft()})(Yt,()=>(()=>{var ut={50792:p=>{var S=Object.prototype.hasOwnProperty,t="~";function d(){}Object.create&&(d.prototype=Object.create(null),new d().__proto__||(t=!1));function c(e,s,h){this.fn=e,this.context=s,this.once=h||!1}function a(e,s,h,i,o){if(typeof h!="function")throw new TypeError("The listener must be a function");var f=new c(h,i||e,o),l=t?t+s:s;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],f]:e._events[l].push(f):(e._events[l]=f,e._eventsCount++),e}function r(e,s){--e._eventsCount===0?e._events=new d:delete e._events[s]}function n(){this._events=new d,this._eventsCount=0}n.prototype.eventNames=function(){var s=[],h,i;if(this._eventsCount===0)return s;for(i in h=this._events)S.call(h,i)&&s.push(t?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(h)):s},n.prototype.listeners=function(s){var h=t?t+s:s,i=this._events[h];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,f=i.length,l=new Array(f);o{/** +var Ot=(at,st,ht)=>{if(!st.has(at))throw TypeError("Cannot "+ht)};var Rt=(at,st,ht)=>(Ot(at,st,"read from private field"),ht?ht.call(at):st.get(at)),Lt=(at,st,ht)=>{if(st.has(at))throw TypeError("Cannot add the same private member more than once");st instanceof WeakSet?st.add(at):st.set(at,ht)},Ft=(at,st,ht,mt)=>(Ot(at,st,"write to private field"),mt?mt.call(at,ht):st.set(at,ht),ht);(function(){const st=document.createElement("link").relList;if(st&&st.supports&&st.supports("modulepreload"))return;for(const ft of document.querySelectorAll('link[rel="modulepreload"]'))mt(ft);new MutationObserver(ft=>{for(const pt of ft)if(pt.type==="childList")for(const p of pt.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&mt(p)}).observe(document,{childList:!0,subtree:!0});function ht(ft){const pt={};return ft.integrity&&(pt.integrity=ft.integrity),ft.referrerPolicy&&(pt.referrerPolicy=ft.referrerPolicy),ft.crossOrigin==="use-credentials"?pt.credentials="include":ft.crossOrigin==="anonymous"?pt.credentials="omit":pt.credentials="same-origin",pt}function mt(ft){if(ft.ep)return;ft.ep=!0;const pt=ht(ft);fetch(ft.href,pt)}})();var bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kt(at){return at&&at.__esModule&&Object.prototype.hasOwnProperty.call(at,"default")?at.default:at}var Ht={exports:{}};(function(at,st){(function(mt,ft){at.exports=ft()})(bt,()=>(()=>{var ht={50792:p=>{var S=Object.prototype.hasOwnProperty,t="~";function d(){}Object.create&&(d.prototype=Object.create(null),new d().__proto__||(t=!1));function c(e,s,h){this.fn=e,this.context=s,this.once=h||!1}function a(e,s,h,i,o){if(typeof h!="function")throw new TypeError("The listener must be a function");var f=new c(h,i||e,o),l=t?t+s:s;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],f]:e._events[l].push(f):(e._events[l]=f,e._eventsCount++),e}function r(e,s){--e._eventsCount===0?e._events=new d:delete e._events[s]}function n(){this._events=new d,this._eventsCount=0}n.prototype.eventNames=function(){var s=[],h,i;if(this._eventsCount===0)return s;for(i in h=this._events)S.call(h,i)&&s.push(t?i.slice(1):i);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(h)):s},n.prototype.listeners=function(s){var h=t?t+s:s,i=this._events[h];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,f=i.length,l=new Array(f);o{/** * @author samme * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1154,7 +1154,7 @@ var Ft=(at,nt,ut)=>{if(!nt.has(at))throw TypeError("Cannot "+ut)};var Mt=(at,nt, * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} */var S=function(t,d,c,a){if(c===void 0&&(c=!1),a===void 0)return a={local:{x:0,y:0,width:0,height:0},global:{x:0,y:0,width:0,height:0},lines:{shortest:0,longest:0,lengths:null,height:0},wrappedText:"",words:[],characters:[],scaleX:0,scaleY:0},a;var r=t.text,n=r.length,e=t.maxWidth,s=t.wordWrapCharCode,h=Number.MAX_VALUE,i=Number.MAX_VALUE,o=0,f=0,l=t.fontData.chars,u=t.fontData.lineHeight,v=t.letterSpacing,g=t.lineSpacing,x=0,m=0,y=0,T=null,E=t._align,C=0,A=0,P=t.fontSize/t.fontData.size,M=P*t.scaleX,F=P*t.scaleY,L=null,D=0,I=[],U=Number.MAX_VALUE,z=0,w=0,G=0,R,O=[],B=[],N=null;if(e>0){for(R=0;Re||$>e?(W.push(H.i-1),H.cr?(W.push(H.i+H.word.length),Y=0,V=null):V=H):H.cr&&(W.push(H.i+H.word.length),Y=0,V=null)}var q=function(ot,vt,ct){return ot.substr(0,vt)+ct+ot.substr(vt+1)};for(R=W.length-1;R>=0;R--)r=q(r,W[R],` -`);a.wrappedText=r,n=r.length,O=[],N=null}var tt=0;for(R=0;Rz&&(z=G),GC&&(h=C),i>A&&(i=A);var Q=C+T.xAdvance,k=A+u;oz&&(z=G),G0)for(var et=0;et{/** +`);a.wrappedText=r,n=r.length,O=[],N=null}var tt=0;for(R=0;Rz&&(z=G),GC&&(h=C),i>A&&(i=A);var Q=C+T.xAdvance,k=A+u;oz&&(z=G),G0)for(var et=0;et{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -1198,7 +1198,7 @@ var Ft=(at,nt,ut)=>{if(!nt.has(at))throw TypeError("Cannot "+ut)};var Mt=(at,nt, * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var d=t(91296),c=t(61340),a=t(70554),r=new c,n=function(e,s,h,i){var o=s.text,f=o.length;if(f!==0){h.addToRenderList(s);var l=e.pipelines.set(s.pipeline,s),u=d(s,h,i);e.pipelines.preBatch(s);var v=u.sprite,g=u.calc,x=r,m=s.cropWidth>0||s.cropHeight>0;m&&(l.flush(),e.pushScissor(g.tx,g.ty,s.cropWidth*g.scaleX,s.cropHeight*g.scaleY));var y=s.frame,T=y.glTexture,E=s.tintFill,C=a.getTintAppendFloatAlpha(s.tintTopLeft,h.alpha*s._alphaTL),A=a.getTintAppendFloatAlpha(s.tintTopRight,h.alpha*s._alphaTR),P=a.getTintAppendFloatAlpha(s.tintBottomLeft,h.alpha*s._alphaBL),M=a.getTintAppendFloatAlpha(s.tintBottomRight,h.alpha*s._alphaBR),F=l.setGameObject(s),L=0,D=0,I=0,U=0,z=s.letterSpacing,w,G=0,R=0,O,B=s.scrollX,N=s.scrollY,X=s.fontData,V=X.chars,Y=X.lineHeight,W=s.fontSize/X.size,H=0,b=s._align,K=0,J=0,Z=s.getTextBounds(!1);s.maxWidth>0&&(o=Z.wrappedText,f=o.length);var $=s._bounds.lines;b===1?J=($.longest-$.lengths[0])/2:b===2&&(J=$.longest-$.lengths[0]);for(var q=h.roundPixels,tt=s.displayCallback,_=s.callbackData,Q=0;Q{/** + */var d=t(91296),c=t(61340),a=t(70554),r=new c,n=function(e,s,h,i){var o=s.text,f=o.length;if(f!==0){h.addToRenderList(s);var l=e.pipelines.set(s.pipeline,s),u=d(s,h,i);e.pipelines.preBatch(s);var v=u.sprite,g=u.calc,x=r,m=s.cropWidth>0||s.cropHeight>0;m&&(l.flush(),e.pushScissor(g.tx,g.ty,s.cropWidth*g.scaleX,s.cropHeight*g.scaleY));var y=s.frame,T=y.glTexture,E=s.tintFill,C=a.getTintAppendFloatAlpha(s.tintTopLeft,h.alpha*s._alphaTL),A=a.getTintAppendFloatAlpha(s.tintTopRight,h.alpha*s._alphaTR),P=a.getTintAppendFloatAlpha(s.tintBottomLeft,h.alpha*s._alphaBL),M=a.getTintAppendFloatAlpha(s.tintBottomRight,h.alpha*s._alphaBR),F=l.setGameObject(s),L=0,D=0,I=0,U=0,z=s.letterSpacing,w,G=0,R=0,O,B=s.scrollX,N=s.scrollY,X=s.fontData,V=X.chars,Y=X.lineHeight,W=s.fontSize/X.size,H=0,b=s._align,K=0,J=0,Z=s.getTextBounds(!1);s.maxWidth>0&&(o=Z.wrappedText,f=o.length);var $=s._bounds.lines;b===1?J=($.longest-$.lengths[0])/2:b===2&&(J=$.longest-$.lengths[0]);for(var q=h.roundPixels,tt=s.displayCallback,_=s.callbackData,Q=0;Q{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -2597,7 +2597,7 @@ var Ft=(at,nt,ut)=>{if(!nt.has(at))throw TypeError("Cannot "+ut)};var Mt=(at,nt, * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var d=t(83997),c=t(95540),a=t(37867),r=t(25836),n=t(39318),e=new r,s=new r,h=new a,i=function(o){var f=c(o,"mesh"),l=c(o,"texture",null),u=c(o,"frame"),v=c(o,"width",1),g=c(o,"height",v),x=c(o,"widthSegments",1),m=c(o,"heightSegments",x),y=c(o,"x",0),T=c(o,"y",0),E=c(o,"z",0),C=c(o,"rotateX",0),A=c(o,"rotateY",0),P=c(o,"rotateZ",0),M=c(o,"zIsUp",!0),F=c(o,"isOrtho",f?f.dirtyCache[11]:!1),L=c(o,"colors",[16777215]),D=c(o,"alphas",[1]),I=c(o,"tile",!1),U=c(o,"flipY",!1),z=c(o,"width",null),w={faces:[],verts:[]};e.set(y,T,E),s.set(C,A,P),h.fromRotationXYTranslation(s,e,M);var G;if(!l&&f)l=f.texture,u||(G=f.frame);else if(f&&typeof l=="string")l=f.scene.sys.textures.get(l);else if(!l)return w;G||(G=l.get(u)),!z&&F&&l&&f&&(v=G.width/f.height,g=G.height/f.height);var R=v/2,O=g/2,B=Math.floor(x),N=Math.floor(m),X=B+1,V=N+1,Y=v/B,W=g/N,H=[],b=[],K,J,Z=0,$=1,q=0,tt=1;G&&(Z=G.u0,$=G.u1,U?(q=G.v1,tt=G.v0):(q=G.v0,tt=G.v1));var _=$-Z,Q=tt-q;for(J=0;J{/** + */var d=t(83997),c=t(95540),a=t(37867),r=t(25836),n=t(39318),e=new r,s=new r,h=new a,i=function(o){var f=c(o,"mesh"),l=c(o,"texture",null),u=c(o,"frame"),v=c(o,"width",1),g=c(o,"height",v),x=c(o,"widthSegments",1),m=c(o,"heightSegments",x),y=c(o,"x",0),T=c(o,"y",0),E=c(o,"z",0),C=c(o,"rotateX",0),A=c(o,"rotateY",0),P=c(o,"rotateZ",0),M=c(o,"zIsUp",!0),F=c(o,"isOrtho",f?f.dirtyCache[11]:!1),L=c(o,"colors",[16777215]),D=c(o,"alphas",[1]),I=c(o,"tile",!1),U=c(o,"flipY",!1),z=c(o,"width",null),w={faces:[],verts:[]};e.set(y,T,E),s.set(C,A,P),h.fromRotationXYTranslation(s,e,M);var G;if(!l&&f)l=f.texture,u||(G=f.frame);else if(f&&typeof l=="string")l=f.scene.sys.textures.get(l);else if(!l)return w;G||(G=l.get(u)),!z&&F&&l&&f&&(v=G.width/f.height,g=G.height/f.height);var R=v/2,O=g/2,B=Math.floor(x),N=Math.floor(m),X=B+1,V=N+1,Y=v/B,W=g/N,H=[],b=[],K,J,Z=0,$=1,q=0,tt=1;G&&(Z=G.u0,$=G.u1,U?(q=G.v1,tt=G.v0):(q=G.v0,tt=G.v1));var _=$-Z,Q=tt-q;for(J=0;J{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4259,7 +4259,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var d=t(55495),c=t(37742),a=t(45319),r=t(83419),n=t(79342),e=t(37747),s=t(20339),h=t(52816),i=t(50792),o=t(63012),f=t(43855),l=t(5470),u=t(94977),v=t(64897),g=t(45170),x=t(96523),m=t(35154),y=t(36383),T=t(25774),E=t(96602),C=t(87841),A=t(59542),P=t(40012),M=t(14087),F=t(89936),L=t(35072),D=t(72624),I=t(2483),U=t(61340),z=t(26099),w=t(15994),G=new r({Extends:i,initialize:function(O,B){i.call(this),this.scene=O,this.bodies=new L,this.staticBodies=new L,this.pendingDestroy=new L,this.colliders=new T,this.gravity=new z(m(B,"gravity.x",0),m(B,"gravity.y",0)),this.bounds=new C(m(B,"x",0),m(B,"y",0),m(B,"width",O.sys.scale.width),m(B,"height",O.sys.scale.height)),this.checkCollision={up:m(B,"checkCollision.up",!0),down:m(B,"checkCollision.down",!0),left:m(B,"checkCollision.left",!0),right:m(B,"checkCollision.right",!0)},this.fps=m(B,"fps",60),this.fixedStep=m(B,"fixedStep",!0),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=m(B,"timeScale",1),this.OVERLAP_BIAS=m(B,"overlapBias",4),this.TILE_BIAS=m(B,"tileBias",16),this.forceX=m(B,"forceX",!1),this.isPaused=m(B,"isPaused",!1),this._total=0,this.drawDebug=m(B,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:m(B,"debugShowBody",!0),debugShowStaticBody:m(B,"debugShowStaticBody",!0),debugShowVelocity:m(B,"debugShowVelocity",!0),bodyDebugColor:m(B,"debugBodyColor",16711935),staticBodyDebugColor:m(B,"debugStaticBodyColor",255),velocityDebugColor:m(B,"debugVelocityColor",65280)},this.maxEntries=m(B,"maxEntries",16),this.useTree=m(B,"useTree",!0),this.tree=new A(this.maxEntries),this.staticTree=new A(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new U,this._tempMatrix2=new U,this.tileFilterOptions={isColliding:!0,isNotEmpty:!0,hasInterestingFace:!0},this.drawDebug&&this.createDebugGraphic()},enable:function(R,O){O===void 0&&(O=e.DYNAMIC_BODY),Array.isArray(R)||(R=[R]);for(var B=0;B=X;for(this.fixedStep||(N=O*.001,W=!0,this._elapsed=0),B=0;B=X;)this._elapsed-=X,this.step(N)}},step:function(R){var O,B,N=this.bodies.entries,X=N.length;for(O=0;O0){var H=this.tree,b=this.staticTree;for(B=W.entries,N=B.length,R=0;R-1&&R.velocity.length()>J&&(R.velocity.normalize().scale(J),K=J),R.speed=K},separate:function(R,O,B,N,X){var V,Y,W=!1,H=!0;if(!R.enable||!O.enable||R.checkCollision.none||O.checkCollision.none||!this.intersects(R,O)||B&&B.call(N,R.gameObject,O.gameObject)===!1)return W;if(R.isCircle||O.isCircle){var b=this.separateCircle(R,O,X);b.result?(W=!0,H=!1):(V=b.x,Y=b.y,H=!0)}if(H){var K=!1,J=!1,Z=this.OVERLAP_BIAS;X?(K=M(R,O,X,Z,V),J=F(R,O,X,Z,Y)):this.forceX||Math.abs(this.gravity.y+R.gravity.y)k&&(J=s($,q,k,Q)-tt):q>j&&($<_?J=s($,q,_,j)-tt:$>k&&(J=s($,q,k,j)-tt)),J*=-1}else J=R.halfWidth+O.halfWidth-h(V,Y);R.overlapR=J,O.overlapR=J;var et=d(V,Y),it=(J+y.EPSILON)*Math.cos(et),lt=(J+y.EPSILON)*Math.sin(et),ht={overlap:J,result:!1,x:it,y:lt};if(B&&(!Z||Z&&J!==0))return ht.result=!0,ht;if(!Z&&J===0||W&&H||R.customSeparateX||O.customSeparateX)return ht.x=void 0,ht.y=void 0,ht;var rt=!R.pushable&&!O.pushable;if(Z){var st=V.x-Y.x,dt=V.y-Y.y,ot=Math.sqrt(Math.pow(st,2)+Math.pow(dt,2)),vt=(Y.x-V.x)/ot||0,ct=(Y.y-V.y)/ot||0,gt=2*(b.x*vt+b.y*ct-K.x*vt-K.y*ct)/(R.mass+O.mass);(W||H)&&(gt*=2),W||(b.x=b.x-gt/R.mass*vt,b.y=b.y-gt/R.mass*ct,b.multiply(R.bounce)),H||(K.x=K.x+gt/O.mass*vt,K.y=K.y+gt/O.mass*ct,K.multiply(O.bounce)),!W&&!H&&(it*=.5,lt*=.5),W||(R.x-=it,R.y-=lt,R.updateCenter()),H||(O.x+=it,O.y+=lt,O.updateCenter()),ht.result=!0}else!W||R.pushable||rt?(R.x-=it,R.y-=lt,R.updateCenter()):(!H||O.pushable||rt)&&(O.x+=it,O.y+=lt,O.updateCenter()),ht.x=void 0,ht.y=void 0;return ht},intersects:function(R,O){return R===O?!1:!R.isCircle&&!O.isCircle?!(R.right<=O.left||R.bottom<=O.top||R.left>=O.right||R.top>=O.bottom):R.isCircle?O.isCircle?h(R.center,O.center)<=R.halfWidth+O.halfWidth:this.circleBodyIntersects(R,O):this.circleBodyIntersects(O,R)},circleBodyIntersects:function(R,O){var B=a(R.center.x,O.left,O.right),N=a(R.center.y,O.top,O.bottom),X=(R.center.x-B)*(R.center.x-B),V=(R.center.y-N)*(R.center.y-N);return X+V<=R.halfWidth*R.halfWidth},overlap:function(R,O,B,N,X){return B===void 0&&(B=null),N===void 0&&(N=null),X===void 0&&(X=B),this.collideObjects(R,O,B,N,X,!0)},collide:function(R,O,B,N,X){return B===void 0&&(B=null),N===void 0&&(N=null),X===void 0&&(X=B),this.collideObjects(R,O,B,N,X,!1)},collideObjects:function(R,O,B,N,X,V){var Y,W;R.isParent&&(R.physicsType===void 0||O===void 0||R===O)&&(R=R.children.entries),O&&O.isParent&&O.physicsType===void 0&&(O=O.children.entries);var H=Array.isArray(R),b=Array.isArray(O);if(this._total=0,!H&&!b)this.collideHandler(R,O,B,N,X,V);else if(!H&&b)for(Y=0;Y0},collideHandler:function(R,O,B,N,X,V){if(O===void 0&&R.isParent)return this.collideGroupVsGroup(R,R,B,N,X,V);if(!R||!O)return!1;if(R.body||R.isBody){if(O.body||O.isBody)return this.collideSpriteVsSprite(R,O,B,N,X,V);if(O.isParent)return this.collideSpriteVsGroup(R,O,B,N,X,V);if(O.isTilemap)return this.collideSpriteVsTilemapLayer(R,O,B,N,X,V)}else if(R.isParent){if(O.body||O.isBody)return this.collideSpriteVsGroup(O,R,B,N,X,V);if(O.isParent)return this.collideGroupVsGroup(R,O,B,N,X,V);if(O.isTilemap)return this.collideGroupVsTilemapLayer(R,O,B,N,X,V)}else if(R.isTilemap){if(O.body||O.isBody)return this.collideSpriteVsTilemapLayer(O,R,B,N,X,V);if(O.isParent)return this.collideGroupVsTilemapLayer(O,R,B,N,X,V)}},canCollide:function(R,O){return R&&O&&(R.collisionMask&O.collisionCategory)!==0&&(O.collisionMask&R.collisionCategory)!==0},collideSpriteVsSprite:function(R,O,B,N,X,V){var Y=R.isBody?R:R.body,W=O.isBody?O:O.body;return this.canCollide(Y,W)?(this.separate(Y,W,N,X,V)&&(B&&B.call(X,R,O),this._total++),!0):!1},collideSpriteVsGroup:function(R,O,B,N,X,V){var Y=R.isBody?R:R.body;if(!(O.length===0||!Y||!Y.enable||Y.checkCollision.none||!this.canCollide(Y,O))){var W,H,b;if(this.useTree||O.physicsType===e.STATIC_BODY){var K=this.treeMinMax;K.minX=Y.left,K.minY=Y.top,K.maxX=Y.right,K.maxY=Y.bottom;var J=O.physicsType===e.DYNAMIC_BODY?this.tree.search(K):this.staticTree.search(K);for(H=J.length,W=0;W{/** + */var d=t(55495),c=t(37742),a=t(45319),r=t(83419),n=t(79342),e=t(37747),s=t(20339),h=t(52816),i=t(50792),o=t(63012),f=t(43855),l=t(5470),u=t(94977),v=t(64897),g=t(45170),x=t(96523),m=t(35154),y=t(36383),T=t(25774),E=t(96602),C=t(87841),A=t(59542),P=t(40012),M=t(14087),F=t(89936),L=t(35072),D=t(72624),I=t(2483),U=t(61340),z=t(26099),w=t(15994),G=new r({Extends:i,initialize:function(O,B){i.call(this),this.scene=O,this.bodies=new L,this.staticBodies=new L,this.pendingDestroy=new L,this.colliders=new T,this.gravity=new z(m(B,"gravity.x",0),m(B,"gravity.y",0)),this.bounds=new C(m(B,"x",0),m(B,"y",0),m(B,"width",O.sys.scale.width),m(B,"height",O.sys.scale.height)),this.checkCollision={up:m(B,"checkCollision.up",!0),down:m(B,"checkCollision.down",!0),left:m(B,"checkCollision.left",!0),right:m(B,"checkCollision.right",!0)},this.fps=m(B,"fps",60),this.fixedStep=m(B,"fixedStep",!0),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=m(B,"timeScale",1),this.OVERLAP_BIAS=m(B,"overlapBias",4),this.TILE_BIAS=m(B,"tileBias",16),this.forceX=m(B,"forceX",!1),this.isPaused=m(B,"isPaused",!1),this._total=0,this.drawDebug=m(B,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:m(B,"debugShowBody",!0),debugShowStaticBody:m(B,"debugShowStaticBody",!0),debugShowVelocity:m(B,"debugShowVelocity",!0),bodyDebugColor:m(B,"debugBodyColor",16711935),staticBodyDebugColor:m(B,"debugStaticBodyColor",255),velocityDebugColor:m(B,"debugVelocityColor",65280)},this.maxEntries=m(B,"maxEntries",16),this.useTree=m(B,"useTree",!0),this.tree=new A(this.maxEntries),this.staticTree=new A(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new U,this._tempMatrix2=new U,this.tileFilterOptions={isColliding:!0,isNotEmpty:!0,hasInterestingFace:!0},this.drawDebug&&this.createDebugGraphic()},enable:function(R,O){O===void 0&&(O=e.DYNAMIC_BODY),Array.isArray(R)||(R=[R]);for(var B=0;B=X;for(this.fixedStep||(N=O*.001,W=!0,this._elapsed=0),B=0;B=X;)this._elapsed-=X,this.step(N)}},step:function(R){var O,B,N=this.bodies.entries,X=N.length;for(O=0;O0){var H=this.tree,b=this.staticTree;for(B=W.entries,N=B.length,R=0;R-1&&R.velocity.length()>J&&(R.velocity.normalize().scale(J),K=J),R.speed=K},separate:function(R,O,B,N,X){var V,Y,W=!1,H=!0;if(!R.enable||!O.enable||R.checkCollision.none||O.checkCollision.none||!this.intersects(R,O)||B&&B.call(N,R.gameObject,O.gameObject)===!1)return W;if(R.isCircle||O.isCircle){var b=this.separateCircle(R,O,X);b.result?(W=!0,H=!1):(V=b.x,Y=b.y,H=!0)}if(H){var K=!1,J=!1,Z=this.OVERLAP_BIAS;X?(K=M(R,O,X,Z,V),J=F(R,O,X,Z,Y)):this.forceX||Math.abs(this.gravity.y+R.gravity.y)k&&(J=s($,q,k,Q)-tt):q>j&&($<_?J=s($,q,_,j)-tt:$>k&&(J=s($,q,k,j)-tt)),J*=-1}else J=R.halfWidth+O.halfWidth-h(V,Y);R.overlapR=J,O.overlapR=J;var et=d(V,Y),it=(J+y.EPSILON)*Math.cos(et),ut=(J+y.EPSILON)*Math.sin(et),lt={overlap:J,result:!1,x:it,y:ut};if(B&&(!Z||Z&&J!==0))return lt.result=!0,lt;if(!Z&&J===0||W&&H||R.customSeparateX||O.customSeparateX)return lt.x=void 0,lt.y=void 0,lt;var rt=!R.pushable&&!O.pushable;if(Z){var nt=V.x-Y.x,dt=V.y-Y.y,ot=Math.sqrt(Math.pow(nt,2)+Math.pow(dt,2)),vt=(Y.x-V.x)/ot||0,ct=(Y.y-V.y)/ot||0,gt=2*(b.x*vt+b.y*ct-K.x*vt-K.y*ct)/(R.mass+O.mass);(W||H)&&(gt*=2),W||(b.x=b.x-gt/R.mass*vt,b.y=b.y-gt/R.mass*ct,b.multiply(R.bounce)),H||(K.x=K.x+gt/O.mass*vt,K.y=K.y+gt/O.mass*ct,K.multiply(O.bounce)),!W&&!H&&(it*=.5,ut*=.5),W||(R.x-=it,R.y-=ut,R.updateCenter()),H||(O.x+=it,O.y+=ut,O.updateCenter()),lt.result=!0}else!W||R.pushable||rt?(R.x-=it,R.y-=ut,R.updateCenter()):(!H||O.pushable||rt)&&(O.x+=it,O.y+=ut,O.updateCenter()),lt.x=void 0,lt.y=void 0;return lt},intersects:function(R,O){return R===O?!1:!R.isCircle&&!O.isCircle?!(R.right<=O.left||R.bottom<=O.top||R.left>=O.right||R.top>=O.bottom):R.isCircle?O.isCircle?h(R.center,O.center)<=R.halfWidth+O.halfWidth:this.circleBodyIntersects(R,O):this.circleBodyIntersects(O,R)},circleBodyIntersects:function(R,O){var B=a(R.center.x,O.left,O.right),N=a(R.center.y,O.top,O.bottom),X=(R.center.x-B)*(R.center.x-B),V=(R.center.y-N)*(R.center.y-N);return X+V<=R.halfWidth*R.halfWidth},overlap:function(R,O,B,N,X){return B===void 0&&(B=null),N===void 0&&(N=null),X===void 0&&(X=B),this.collideObjects(R,O,B,N,X,!0)},collide:function(R,O,B,N,X){return B===void 0&&(B=null),N===void 0&&(N=null),X===void 0&&(X=B),this.collideObjects(R,O,B,N,X,!1)},collideObjects:function(R,O,B,N,X,V){var Y,W;R.isParent&&(R.physicsType===void 0||O===void 0||R===O)&&(R=R.children.entries),O&&O.isParent&&O.physicsType===void 0&&(O=O.children.entries);var H=Array.isArray(R),b=Array.isArray(O);if(this._total=0,!H&&!b)this.collideHandler(R,O,B,N,X,V);else if(!H&&b)for(Y=0;Y0},collideHandler:function(R,O,B,N,X,V){if(O===void 0&&R.isParent)return this.collideGroupVsGroup(R,R,B,N,X,V);if(!R||!O)return!1;if(R.body||R.isBody){if(O.body||O.isBody)return this.collideSpriteVsSprite(R,O,B,N,X,V);if(O.isParent)return this.collideSpriteVsGroup(R,O,B,N,X,V);if(O.isTilemap)return this.collideSpriteVsTilemapLayer(R,O,B,N,X,V)}else if(R.isParent){if(O.body||O.isBody)return this.collideSpriteVsGroup(O,R,B,N,X,V);if(O.isParent)return this.collideGroupVsGroup(R,O,B,N,X,V);if(O.isTilemap)return this.collideGroupVsTilemapLayer(R,O,B,N,X,V)}else if(R.isTilemap){if(O.body||O.isBody)return this.collideSpriteVsTilemapLayer(O,R,B,N,X,V);if(O.isParent)return this.collideGroupVsTilemapLayer(O,R,B,N,X,V)}},canCollide:function(R,O){return R&&O&&(R.collisionMask&O.collisionCategory)!==0&&(O.collisionMask&R.collisionCategory)!==0},collideSpriteVsSprite:function(R,O,B,N,X,V){var Y=R.isBody?R:R.body,W=O.isBody?O:O.body;return this.canCollide(Y,W)?(this.separate(Y,W,N,X,V)&&(B&&B.call(X,R,O),this._total++),!0):!1},collideSpriteVsGroup:function(R,O,B,N,X,V){var Y=R.isBody?R:R.body;if(!(O.length===0||!Y||!Y.enable||Y.checkCollision.none||!this.canCollide(Y,O))){var W,H,b;if(this.useTree||O.physicsType===e.STATIC_BODY){var K=this.treeMinMax;K.minX=Y.left,K.minY=Y.top,K.maxX=Y.right,K.maxY=Y.bottom;var J=O.physicsType===e.DYNAMIC_BODY?this.tree.search(K):this.staticTree.search(K);for(H=J.length,W=0;W{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4573,7 +4573,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */p.exports={BodyBounds:t(68174),Components:t(31884),Events:t(1121),Factory:t(28137),MatterGameObject:t(75803),Image:t(23181),Matter:t(19933),MatterPhysics:t(42045),PolyDecomp:t(55973),Sprite:t(34803),TileBody:t(73834),PhysicsEditorParser:t(19496),PhysicsJSONParser:t(85791),PointerConstraint:t(98713),World:t(68243)}},22562:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(31725),r=t(53614),n=t(53402),e=t(15647),s=t(66615);(function(){d._timeCorrection=!0,d._inertiaScale=4,d._nextCollidingGroupId=1,d._nextNonCollidingGroupId=-1,d._nextCategory=1,d._baseDelta=16.666666666666668,d.create=function(i){var o={id:n.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,deltaTime:16.666666666666668,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!i.hasOwnProperty("position")&&i.hasOwnProperty("vertices")?i.position=c.centre(i.vertices):i.hasOwnProperty("vertices")||(o.vertices=c.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var f=n.extend(o,i);return h(f,i),f.setOnCollideWith=function(l,u){return u?this.onCollideWith[l.id]=u:delete this.onCollideWith[l.id],this},f},d.nextGroup=function(i){return i?d._nextNonCollidingGroupId--:d._nextCollidingGroupId++},d.nextCategory=function(){return d._nextCategory=d._nextCategory<<1,d._nextCategory};var h=function(i,o){if(o=o||{},d.set(i,{bounds:i.bounds||e.create(i.vertices),positionPrev:i.positionPrev||a.clone(i.position),anglePrev:i.anglePrev||i.angle,vertices:i.vertices,parts:i.parts||[i],isStatic:i.isStatic,isSleeping:i.isSleeping,parent:i.parent||i}),c.rotate(i.vertices,i.angle,i.position),s.rotate(i.axes,i.angle),e.update(i.bounds,i.vertices,i.velocity),d.set(i,{axes:o.axes||i.axes,area:o.area||i.area,mass:o.mass||i.mass,inertia:o.inertia||i.inertia}),i.parts.length===1){var f=i.bounds,l=i.centerOfMass,u=i.centerOffset,v=f.max.x-f.min.x,g=f.max.y-f.min.y;l.x=-(f.min.x-i.position.x)/v,l.y=-(f.min.y-i.position.y)/g,u.x=v*l.x,u.y=g*l.y}};d.set=function(i,o,f){var l;typeof o=="string"&&(l=o,o={},o[l]=f);for(l in o)if(Object.prototype.hasOwnProperty.call(o,l))switch(f=o[l],l){case"isStatic":d.setStatic(i,f);break;case"isSleeping":r.set(i,f);break;case"mass":d.setMass(i,f);break;case"density":d.setDensity(i,f);break;case"inertia":d.setInertia(i,f);break;case"vertices":d.setVertices(i,f);break;case"position":d.setPosition(i,f);break;case"angle":d.setAngle(i,f);break;case"velocity":d.setVelocity(i,f);break;case"angularVelocity":d.setAngularVelocity(i,f);break;case"speed":d.setSpeed(i,f);break;case"angularSpeed":d.setAngularSpeed(i,f);break;case"parts":d.setParts(i,f);break;case"centre":d.setCentre(i,f);break;default:i[l]=f}},d.setStatic=function(i,o){for(var f=0;f0&&a.rotateAbout(v.position,l,i.position,v.position)}},d.setVelocity=function(i,o){var f=i.deltaTime/d._baseDelta;i.positionPrev.x=i.position.x-o.x*f,i.positionPrev.y=i.position.y-o.y*f,i.velocity.x=(i.position.x-i.positionPrev.x)/f,i.velocity.y=(i.position.y-i.positionPrev.y)/f,i.speed=a.magnitude(i.velocity)},d.getVelocity=function(i){var o=d._baseDelta/i.deltaTime;return{x:(i.position.x-i.positionPrev.x)*o,y:(i.position.y-i.positionPrev.y)*o}},d.getSpeed=function(i){return a.magnitude(d.getVelocity(i))},d.setSpeed=function(i,o){d.setVelocity(i,a.mult(a.normalise(d.getVelocity(i)),o))},d.setAngularVelocity=function(i,o){var f=i.deltaTime/d._baseDelta;i.anglePrev=i.angle-o*f,i.angularVelocity=(i.angle-i.anglePrev)/f,i.angularSpeed=Math.abs(i.angularVelocity)},d.getAngularVelocity=function(i){return(i.angle-i.anglePrev)*d._baseDelta/i.deltaTime},d.getAngularSpeed=function(i){return Math.abs(d.getAngularVelocity(i))},d.setAngularSpeed=function(i,o){d.setAngularVelocity(i,n.sign(d.getAngularVelocity(i))*o)},d.translate=function(i,o,f){d.setPosition(i,a.add(i.position,o),f)},d.rotate=function(i,o,f,l){if(!f)d.setAngle(i,i.angle+o,l);else{var u=Math.cos(o),v=Math.sin(o),g=i.position.x-f.x,x=i.position.y-f.y;d.setPosition(i,{x:f.x+(g*u-x*v),y:f.y+(g*v+x*u)},l),d.setAngle(i,i.angle+o,l)}},d.scale=function(i,o,f,l){var u=0,v=0;l=l||i.position;for(var g=i.inertia===1/0,x=0;x0&&(u+=m.area,v+=m.inertia),m.position.x=l.x+(m.position.x-l.x)*o,m.position.y=l.y+(m.position.y-l.y)*f,e.update(m.bounds,m.vertices,i.velocity)}i.parts.length>1&&(i.area=u,i.isStatic||(d.setMass(i,i.density*u),d.setInertia(i,v))),i.circleRadius&&(o===f?i.circleRadius*=o:i.circleRadius=null),g&&d.setInertia(i,1/0)},d.update=function(i,o){o=(typeof o<"u"?o:16.666666666666668)*i.timeScale;var f=o*o,l=d._timeCorrection?o/(i.deltaTime||o):1,u=1-i.frictionAir*(o/n._baseDelta),v=(i.position.x-i.positionPrev.x)*l,g=(i.position.y-i.positionPrev.y)*l;i.velocity.x=v*u+i.force.x/i.mass*f,i.velocity.y=g*u+i.force.y/i.mass*f,i.positionPrev.x=i.position.x,i.positionPrev.y=i.position.y,i.position.x+=i.velocity.x,i.position.y+=i.velocity.y,i.deltaTime=o,i.angularVelocity=(i.angle-i.anglePrev)*u*l+i.torque/i.inertia*f,i.anglePrev=i.angle,i.angle+=i.angularVelocity,i.speed=a.magnitude(i.velocity),i.angularSpeed=Math.abs(i.angularVelocity);for(var x=0;x0&&(m.position.x+=i.velocity.x,m.position.y+=i.velocity.y),i.angularVelocity!==0&&(c.rotate(m.vertices,i.angularVelocity,i.position),s.rotate(m.axes,i.angularVelocity),x>0&&a.rotateAbout(m.position,i.angularVelocity,i.position,m.position)),e.update(m.bounds,m.vertices,i.velocity)}},d.updateVelocities=function(i){var o=d._baseDelta/i.deltaTime,f=i.velocity;f.x=(i.position.x-i.positionPrev.x)*o,f.y=(i.position.y-i.positionPrev.y)*o,i.speed=Math.sqrt(f.x*f.x+f.y*f.y),i.angularVelocity=(i.angle-i.anglePrev)*o,i.angularSpeed=Math.abs(i.angularVelocity)},d.applyForce=function(i,o,f){var l={x:o.x-i.position.x,y:o.y-i.position.y};i.force.x+=f.x,i.force.y+=f.y,i.torque+=l.x*f.y-l.y*f.x},d._totalProperties=function(i){for(var o={mass:0,area:0,inertia:0,centre:{x:0,y:0}},f=i.parts.length===1?0:1;f{var d={};p.exports=d;var c=t(35810),a=t(53402),r=t(15647),n=t(22562);(function(){d.create=function(e){return a.extend({id:a.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},e)},d.setModified=function(e,s,h,i){if(c.trigger(e,"compositeModified",e),e.isModified=s,s&&e.cache&&(e.cache.allBodies=null,e.cache.allConstraints=null,e.cache.allComposites=null),h&&e.parent&&d.setModified(e.parent,s,h,i),i)for(var o=0;o{var d={};p.exports=d;var c=t(69351);(function(){d.create=c.create,d.add=c.add,d.remove=c.remove,d.clear=c.clear,d.addComposite=c.addComposite,d.addBody=c.addBody,d.addConstraint=c.addConstraint})()},52284:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(4506);(function(){var r=[],n={overlap:0,axis:null},e={overlap:0,axis:null};d.create=function(s,h){return{pair:null,collided:!1,bodyA:s,bodyB:h,parentA:s.parent,parentB:h.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},d.collides=function(s,h,i){if(d._overlapAxes(n,s.vertices,h.vertices,s.axes),n.overlap<=0||(d._overlapAxes(e,h.vertices,s.vertices,h.axes),e.overlap<=0))return null;var o=i&&i.table[a.id(s,h)],f;o?f=o.collision:(f=d.create(s,h),f.collided=!0,f.bodyA=s.idw?w=P:PG?G=P:Pf?f=u:u{var S={};p.exports=S,function(){S.create=function(t){return{vertex:t,normalImpulse:0,tangentImpulse:0}}}()},81388:(p,S,t)=>{var d={};p.exports=d;var c=t(53402),a=t(52284);(function(){d.create=function(r){var n={bodies:[],pairs:null};return c.extend(n,r)},d.setBodies=function(r,n){r.bodies=n.slice(0)},d.clear=function(r){r.bodies=[]},d.collisions=function(r){var n=[],e=r.pairs,s=r.bodies,h=s.length,i=d.canCollide,o=a.collides,f,l;for(s.sort(d._compareBoundsX),f=0;fg)break;if(!(xA.max.y)&&!(y&&(C.isStatic||C.isSleeping))&&i(u.collisionFilter,C.collisionFilter)){var P=C.parts.length;if(E&&P===1){var M=o(u,C,e);M&&n.push(M)}else for(var F=T>1?1:0,L=P>1?1:0,D=F;DA.max.x||v.max.xA.max.y)){var M=o(I,z,e);M&&n.push(M)}}}}}return n},d.canCollide=function(r,n){return r.group===n.group&&r.group!==0?r.group>0:(r.mask&n.category)!==0&&(n.mask&r.category)!==0},d._compareBoundsX=function(r,n){return r.bounds.min.x-n.bounds.min.x}})()},4506:(p,S,t)=>{var d={};p.exports=d;var c=t(43424);(function(){d.create=function(a,r){var n=a.bodyA,e=a.bodyB,s={id:d.id(n,e),bodyA:n,bodyB:e,collision:a,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||e.isSensor,timeCreated:r,timeUpdated:r,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return d.update(s,a,r),s},d.update=function(a,r,n){var e=a.contacts,s=r.supports,h=a.activeContacts,i=r.parentA,o=r.parentB,f=i.vertices.length;a.isActive=!0,a.timeUpdated=n,a.collision=r,a.separation=r.depth,a.inverseMass=i.inverseMass+o.inverseMass,a.friction=i.frictiono.frictionStatic?i.frictionStatic:o.frictionStatic,a.restitution=i.restitution>o.restitution?i.restitution:o.restitution,a.slop=i.slop>o.slop?i.slop:o.slop,r.pair=a,h.length=0;for(var l=0;l{var d={};p.exports=d;var c=t(4506),a=t(53402);(function(){d.create=function(r){return a.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},r)},d.update=function(r,n,e){var s=r.list,h=s.length,i=r.table,o=n.length,f=r.collisionStart,l=r.collisionEnd,u=r.collisionActive,v,g,x,m;for(f.length=0,l.length=0,u.length=0,m=0;m{var d={};p.exports=d;var c=t(31725),a=t(52284),r=t(15647),n=t(66280),e=t(41598);(function(){d.collides=function(s,h){for(var i=[],o=h.length,f=s.bounds,l=a.collides,u=r.overlaps,v=0;v{var d={};p.exports=d;var c=t(41598),a=t(53402),r=t(15647);(function(){d._restingThresh=2,d._restingThreshTangent=Math.sqrt(6),d._positionDampen=.9,d._positionWarming=.8,d._frictionNormalMultiplier=5,d._frictionMaxStatic=Number.MAX_VALUE,d.preSolvePosition=function(n){var e,s,h,i=n.length;for(e=0;eQ?(x=q>0?q:-q,g=T.friction*(q>0?1:-1)*i,g<-x?g=-x:g>x&&(g=x)):(g=q,x=u);var k=N*L-X*F,j=V*L-Y*F,et=w/(G+C.inverseInertia*k*k+A.inverseInertia*j*j),it=(1+T.restitution)*$*et;if(g*=et,$0&&(O.normalImpulse=0),it=O.normalImpulse-lt}if(q<-f||q>f)O.tangentImpulse=0;else{var ht=O.tangentImpulse;O.tangentImpulse+=g,O.tangentImpulse<-x&&(O.tangentImpulse=-x),O.tangentImpulse>x&&(O.tangentImpulse=x),g=O.tangentImpulse-ht}var rt=F*it+D*g,st=L*it+I*g;C.isStatic||C.isSleeping||(C.positionPrev.x+=rt*C.inverseMass,C.positionPrev.y+=st*C.inverseMass,C.anglePrev+=(N*st-X*rt)*C.inverseInertia),A.isStatic||A.isSleeping||(A.positionPrev.x-=rt*A.inverseMass,A.positionPrev.y-=st*A.inverseMass,A.anglePrev-=(V*st-Y*rt)*A.inverseInertia)}}}}})()},48140:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(31725),r=t(53614),n=t(15647),e=t(66615),s=t(53402);(function(){d._warming=.4,d._torqueDampen=1,d._minLength=1e-6,d.create=function(h){var i=h;i.bodyA&&!i.pointA&&(i.pointA={x:0,y:0}),i.bodyB&&!i.pointB&&(i.pointB={x:0,y:0});var o=i.bodyA?a.add(i.bodyA.position,i.pointA):i.pointA,f=i.bodyB?a.add(i.bodyB.position,i.pointB):i.pointB,l=a.magnitude(a.sub(o,f));i.length=typeof i.length<"u"?i.length:l,i.id=i.id||s.nextId(),i.label=i.label||"Constraint",i.type="constraint",i.stiffness=i.stiffness||(i.length>0?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 u={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return i.length===0&&i.stiffness>.1?(u.type="pin",u.anchors=!1):i.stiffness<.9&&(u.type="spring"),i.render=s.extend(u,i.render),i},d.preSolveAll=function(h){for(var i=0;i=1||h.length===0,E=T?h.stiffness*i:h.stiffness*i*i,C=h.damping*i,A=a.mult(x,y*E),P=(o?o.inverseMass:0)+(f?f.inverseMass:0),M=(o?o.inverseInertia:0)+(f?f.inverseInertia:0),F=P+M,L,D,I,U,z;if(C>0){var w=a.create();I=a.div(x,m),z=a.sub(f&&a.sub(f.position,f.positionPrev)||w,o&&a.sub(o.position,o.positionPrev)||w),U=a.dot(I,z)}o&&!o.isStatic&&(D=o.inverseMass/P,o.constraintImpulse.x-=A.x*D,o.constraintImpulse.y-=A.y*D,o.position.x-=A.x*D,o.position.y-=A.y*D,C>0&&(o.positionPrev.x-=C*I.x*U*D,o.positionPrev.y-=C*I.y*U*D),L=a.cross(l,A)/F*d._torqueDampen*o.inverseInertia*(1-h.angularStiffness),o.constraintImpulse.angle-=L,o.angle-=L),f&&!f.isStatic&&(D=f.inverseMass/P,f.constraintImpulse.x+=A.x*D,f.constraintImpulse.y+=A.y*D,f.position.x+=A.x*D,f.position.y+=A.y*D,C>0&&(f.positionPrev.x+=C*I.x*U*D,f.positionPrev.y+=C*I.y*U*D),L=a.cross(u,A)/F*d._torqueDampen*f.inverseInertia*(1-h.angularStiffness),f.constraintImpulse.angle+=L,f.angle+=L)}}},d.postSolveAll=function(h){for(var i=0;i0&&(u.position.x+=f.x,u.position.y+=f.y),f.angle!==0&&(c.rotate(u.vertices,f.angle,o.position),e.rotate(u.axes,f.angle),l>0&&a.rotateAbout(u.position,f.angle,o.position,u.position)),n.update(u.bounds,u.vertices,o.velocity)}f.angle*=d._warming,f.x*=d._warming,f.y*=d._warming}}},d.pointAWorld=function(h){return{x:(h.bodyA?h.bodyA.position.x:0)+(h.pointA?h.pointA.x:0),y:(h.bodyA?h.bodyA.position.y:0)+(h.pointA?h.pointA.y:0)}},d.pointBWorld=function(h){return{x:(h.bodyB?h.bodyB.position.x:0)+(h.pointB?h.pointB.x:0),y:(h.bodyB?h.bodyB.position.y:0)+(h.pointB?h.pointB.y:0)}},d.currentLength=function(h){var i=(h.bodyA?h.bodyA.position.x:0)+(h.pointA?h.pointA.x:0),o=(h.bodyA?h.bodyA.position.y:0)+(h.pointA?h.pointA.y:0),f=(h.bodyB?h.bodyB.position.x:0)+(h.pointB?h.pointB.x:0),l=(h.bodyB?h.bodyB.position.y:0)+(h.pointB?h.pointB.y:0),u=i-f,v=o-l;return Math.sqrt(u*u+v*v)}})()},53402:(p,S,t)=>{var d={};p.exports=d,function(){d._baseDelta=16.666666666666668,d._nextId=0,d._seed=0,d._nowStartTime=+new Date,d._warnedOnce={},d._decomp=null,d.extend=function(a,r){var n,e;typeof r=="boolean"?(n=2,e=r):(n=1,e=!0);for(var s=n;s0;r--){var n=Math.floor(d.random()*(r+1)),e=a[r];a[r]=a[n],a[n]=e}return a},d.choose=function(a){return a[Math.floor(d.random()*a.length)]},d.isElement=function(a){return typeof HTMLElement<"u"?a instanceof HTMLElement:!!(a&&a.nodeType&&a.nodeName)},d.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"},d.isFunction=function(a){return typeof a=="function"},d.isPlainObject=function(a){return typeof a=="object"&&a.constructor===Object},d.isString=function(a){return toString.call(a)==="[object String]"},d.clamp=function(a,r,n){return an?n:a},d.sign=function(a){return a<0?-1:1},d.now=function(){if(typeof window<"u"&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-d._nowStartTime},d.random=function(a,r){return a=typeof a<"u"?a:0,r=typeof r<"u"?r:1,a+c()*(r-a)};var c=function(){return d._seed=(d._seed*9301+49297)%233280,d._seed/233280};d.colorToNumber=function(a){return a=a.replace("#",""),a.length==3&&(a=a.charAt(0)+a.charAt(0)+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)),parseInt(a,16)},d.logLevel=1,d.log=function(){console&&d.logLevel>0&&d.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},d.info=function(){console&&d.logLevel>0&&d.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},d.warn=function(){console&&d.logLevel>0&&d.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},d.warnOnce=function(){var a=Array.prototype.slice.call(arguments).join(" ");d._warnedOnce[a]||(d.warn(a),d._warnedOnce[a]=!0)},d.deprecated=function(a,r,n){a[r]=d.chain(function(){d.warnOnce("🔅 deprecated 🔅",n)},a[r])},d.nextId=function(){return d._nextId++},d.indexOf=function(a,r){if(a.indexOf)return a.indexOf(r);for(var n=0;n{var d={};p.exports=d;var c=t(53614),a=t(66272),r=t(81388),n=t(99561),e=t(35810),s=t(69351),h=t(48140),i=t(53402),o=t(22562);(function(){d.create=function(f){f=f||{};var l={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},u=i.extend(l,f);return u.world=f.world||s.create({label:"World"}),u.pairs=f.pairs||n.create(),u.detector=f.detector||r.create(),u.grid={buckets:[]},u.world.gravity=u.gravity,u.broadphase=u.grid,u.metrics={},u},d.update=function(f,l){var u=i.now(),v=f.world,g=f.detector,x=f.pairs,m=f.timing,y=m.timestamp,T;l=typeof l<"u"?l:i._baseDelta,l*=m.timeScale,m.timestamp+=l,m.lastDelta=l;var E={timestamp:m.timestamp,delta:l};e.trigger(f,"beforeUpdate",E);var C=s.allBodies(v),A=s.allConstraints(v);for(v.isModified&&(r.setBodies(g,C),s.setModified(v,!1,!1,!0)),f.enableSleeping&&c.update(C,l),d._bodiesApplyGravity(C,f.gravity),l>0&&d._bodiesUpdate(C,l),e.trigger(f,"beforeSolve",E),h.preSolveAll(C),T=0;T0&&e.trigger(f,"collisionStart",{pairs:x.collisionStart,timestamp:m.timestamp,delta:l});var M=i.clamp(20/f.positionIterations,0,1);for(a.preSolvePosition(x.list),T=0;T0&&e.trigger(f,"collisionActive",{pairs:x.collisionActive,timestamp:m.timestamp,delta:l}),x.collisionEnd.length>0&&e.trigger(f,"collisionEnd",{pairs:x.collisionEnd,timestamp:m.timestamp,delta:l}),d._bodiesClearForces(C),e.trigger(f,"afterUpdate",E),f.timing.lastElapsed=i.now()-u,f},d.merge=function(f,l){if(i.extend(f,l),l.world){f.world=l.world,d.clear(f);for(var u=s.allBodies(f.world),v=0;v{var d={};p.exports=d;var c=t(53402);(function(){d.on=function(a,r,n){for(var e=r.split(" "),s,h=0;h0){n||(n={}),e=r.split(" ");for(var f=0;f{var d={};p.exports=d;var c=t(73832),a=t(53402);(function(){d.name="matter-js",d.version="0.19.0",d.uses=[],d.used=[],d.use=function(){c.use(d,Array.prototype.slice.call(arguments))},d.before=function(r,n){return r=r.replace(/^Matter./,""),a.chainPathBefore(d,r,n)},d.after=function(r,n){return r=r.replace(/^Matter./,""),a.chainPathAfter(d,r,n)}})()},73832:(p,S,t)=>{var d={};p.exports=d;var c=t(53402);(function(){d._registry={},d.register=function(a){if(d.isPlugin(a)||c.warn("Plugin.register:",d.toString(a),"does not implement all required fields."),a.name in d._registry){var r=d._registry[a.name],n=d.versionParse(a.version).number,e=d.versionParse(r.version).number;n>e?(c.warn("Plugin.register:",d.toString(r),"was upgraded to",d.toString(a)),d._registry[a.name]=a):n-1},d.isFor=function(a,r){var n=a.for&&d.dependencyParse(a.for);return!a.for||r.name===n.name&&d.versionSatisfies(r.version,n.range)},d.use=function(a,r){if(a.uses=(a.uses||[]).concat(r||[]),a.uses.length===0){c.warn("Plugin.use:",d.toString(a),"does not specify any dependencies to install.");return}for(var n=d.dependencies(a),e=c.topologicalSort(n),s=[],h=0;h0&&!i.silent&&c.info(s.join(" "))},d.dependencies=function(a,r){var n=d.dependencyParse(a),e=n.name;if(r=r||{},!(e in r)){a=d.resolve(a)||a,r[e]=c.map(a.uses||[],function(h){d.isPlugin(h)&&d.register(h);var i=d.dependencyParse(h),o=d.resolve(h);return o&&!d.versionSatisfies(o.version,i.range)?(c.warn("Plugin.dependencies:",d.toString(o),"does not satisfy",d.toString(i),"used by",d.toString(n)+"."),o._warned=!0,a._warned=!0):o||(c.warn("Plugin.dependencies:",d.toString(h),"used by",d.toString(n),"could not be resolved."),a._warned=!0),i.name});for(var s=0;s=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;r.test(a)||c.warn("Plugin.versionParse:",a,"is not a valid version or range.");var n=r.exec(a),e=Number(n[4]),s=Number(n[5]),h=Number(n[6]);return{isRange:!!(n[1]||n[2]),version:n[3],range:a,operator:n[1]||n[2]||"",major:e,minor:s,patch:h,parts:[e,s,h],prerelease:n[7],number:e*1e8+s*1e4+h}},d.versionSatisfies=function(a,r){r=r||"*";var n=d.versionParse(r),e=d.versionParse(a);if(n.isRange){if(n.operator==="*"||a==="*")return!0;if(n.operator===">")return e.number>n.number;if(n.operator===">=")return e.number>=n.number;if(n.operator==="~")return e.major===n.major&&e.minor===n.minor&&e.patch>=n.patch;if(n.operator==="^")return n.major>0?e.major===n.major&&e.number>=n.number:n.minor>0?e.minor===n.minor&&e.patch>=n.patch:e.patch===n.patch}return a===r||a==="*"}})()},53614:(p,S,t)=>{var d={};p.exports=d;var c=t(22562),a=t(35810),r=t(53402);(function(){d._motionWakeThreshold=.18,d._motionSleepThreshold=.08,d._minBias=.9,d.update=function(n,e){for(var s=e/r._baseDelta,h=d._motionSleepThreshold,i=0;i0&&o.motion=o.sleepThreshold/s&&d.set(o,!0)):o.sleepCounter>0&&(o.sleepCounter-=1)}},d.afterCollisions=function(n){for(var e=d._motionSleepThreshold,s=0;se&&d.set(l,!1)}}}},d.set=function(n,e){var s=n.isSleeping;e?(n.isSleeping=!0,n.sleepCounter=n.sleepThreshold,n.positionImpulse.x=0,n.positionImpulse.y=0,n.positionPrev.x=n.position.x,n.positionPrev.y=n.position.y,n.anglePrev=n.angle,n.speed=0,n.angularSpeed=0,n.motion=0,s||a.trigger(n,"sleepStart")):(n.isSleeping=!1,n.sleepCounter=0,s&&a.trigger(n,"sleepEnd"))}})()},66280:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(53402),r=t(22562),n=t(15647),e=t(31725);(function(){d.rectangle=function(s,h,i,o,f){f=f||{};var l={label:"Rectangle Body",position:{x:s,y:h},vertices:c.fromPath("L 0 0 L "+i+" 0 L "+i+" "+o+" L 0 "+o)};if(f.chamfer){var u=f.chamfer;l.vertices=c.chamfer(l.vertices,u.radius,u.quality,u.qualityMin,u.qualityMax),delete f.chamfer}return r.create(a.extend({},l,f))},d.trapezoid=function(s,h,i,o,f,l){l=l||{},f*=.5;var u=(1-f*2)*i,v=i*f,g=v+u,x=g+v,m;f<.5?m="L 0 0 L "+v+" "+-o+" L "+g+" "+-o+" L "+x+" 0":m="L 0 0 L "+g+" "+-o+" L "+x+" 0";var y={label:"Trapezoid Body",position:{x:s,y:h},vertices:c.fromPath(m)};if(l.chamfer){var T=l.chamfer;y.vertices=c.chamfer(y.vertices,T.radius,T.quality,T.qualityMin,T.qualityMax),delete l.chamfer}return r.create(a.extend({},y,l))},d.circle=function(s,h,i,o,f){o=o||{};var l={label:"Circle Body",circleRadius:i};f=f||25;var u=Math.ceil(Math.max(10,Math.min(f,i)));return u%2===1&&(u+=1),d.polygon(s,h,u,i,a.extend({},l,o))},d.polygon=function(s,h,i,o,f){if(f=f||{},i<3)return d.circle(s,h,o,f);for(var l=2*Math.PI/i,u="",v=l*.5,g=0;g0&&c.area(z)1?(m=r.create(a.extend({parts:y.slice(0)},o)),r.setPosition(m,{x:s,y:h}),m):y[0]},d.flagCoincidentParts=function(s,h){h===void 0&&(h=5);for(var i=0;i{var d={};p.exports=d;var c=t(69351),a=t(48140),r=t(53402),n=t(22562),e=t(66280);(function(){d.stack=function(s,h,i,o,f,l,u){for(var v=c.create({label:"Stack"}),g=s,x=h,m,y=0,T=0;TE&&(E=P),n.translate(A,{x:M*.5,y:P*.5}),g=A.bounds.max.x+f,c.addBody(v,A),m=A,y+=1}else g+=f}x+=E+l,g=s}return v},d.chain=function(s,h,i,o,f,l){for(var u=s.bodies,v=1;v0)for(v=0;v0&&(m=l[v-1+(u-1)*h],c.addConstraint(s,a.create(r.extend({bodyA:m,bodyB:x},f)))),o&&vE)){m=E-m;var A=m,P=i-1-m;if(!(xP)){T===1&&n.translate(y,{x:(x+(i%2===1?1:-1))*C,y:0});var M=y?x*C:0;return u(s+M+x*f,g,x,m,y,T)}}})},d.newtonsCradle=function(s,h,i,o,f){for(var l=c.create({label:"Newtons Cradle"}),u=0;u{var d={};p.exports=d;var c=t(31725),a=t(53402);(function(){d.fromVertices=function(r){for(var n={},e=0;e{var S={};p.exports=S,function(){S.create=function(t){var d={min:{x:0,y:0},max:{x:0,y:0}};return t&&S.update(d,t),d},S.update=function(t,d,c){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var a=0;at.max.x&&(t.max.x=r.x),r.xt.max.y&&(t.max.y=r.y),r.y0?t.max.x+=c.x:t.min.x+=c.x,c.y>0?t.max.y+=c.y:t.min.y+=c.y)},S.contains=function(t,d){return d.x>=t.min.x&&d.x<=t.max.x&&d.y>=t.min.y&&d.y<=t.max.y},S.overlaps=function(t,d){return t.min.x<=d.max.x&&t.max.x>=d.min.x&&t.max.y>=d.min.y&&t.min.y<=d.max.y},S.translate=function(t,d){t.min.x+=d.x,t.max.x+=d.x,t.min.y+=d.y,t.max.y+=d.y},S.shift=function(t,d){var c=t.max.x-t.min.x,a=t.max.y-t.min.y;t.min.x=d.x,t.max.x=d.x+c,t.min.y=d.y,t.max.y=d.y+a}}()},74058:(p,S,t)=>{var d={};p.exports=d,t(15647);var c=t(53402);(function(){d.pathToVertices=function(a,r){typeof window<"u"&&!("SVGPathSeg"in window)&&c.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var n,e,s,h,i,o,f,l,u,v,g=[],x,m,y=0,T=0,E=0;r=r||15;var C=function(P,M,F){var L=F%2===1&&F>1;if(!u||P!=u.x||M!=u.y){u&&L?(x=u.x,m=u.y):(x=0,m=0);var D={x:x+P,y:m+M};(L||!u)&&(u=D),g.push(D),T=x+P,E=m+M}},A=function(P){var M=P.pathSegTypeAsLetter.toUpperCase();if(M!=="Z"){switch(M){case"M":case"L":case"T":case"C":case"S":case"Q":T=P.x,E=P.y;break;case"H":T=P.x;break;case"V":E=P.y;break}C(T,E,P.pathSegType)}};for(d._svgPathToAbsolute(a),s=a.getTotalLength(),o=[],n=0;n{var S={};p.exports=S,function(){S.create=function(t,d){return{x:t||0,y:d||0}},S.clone=function(t){return{x:t.x,y:t.y}},S.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},S.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},S.rotate=function(t,d,c){var a=Math.cos(d),r=Math.sin(d);c||(c={});var n=t.x*a-t.y*r;return c.y=t.x*r+t.y*a,c.x=n,c},S.rotateAbout=function(t,d,c,a){var r=Math.cos(d),n=Math.sin(d);a||(a={});var e=c.x+((t.x-c.x)*r-(t.y-c.y)*n);return a.y=c.y+((t.x-c.x)*n+(t.y-c.y)*r),a.x=e,a},S.normalise=function(t){var d=S.magnitude(t);return d===0?{x:0,y:0}:{x:t.x/d,y:t.y/d}},S.dot=function(t,d){return t.x*d.x+t.y*d.y},S.cross=function(t,d){return t.x*d.y-t.y*d.x},S.cross3=function(t,d,c){return(d.x-t.x)*(c.y-t.y)-(d.y-t.y)*(c.x-t.x)},S.add=function(t,d,c){return c||(c={}),c.x=t.x+d.x,c.y=t.y+d.y,c},S.sub=function(t,d,c){return c||(c={}),c.x=t.x-d.x,c.y=t.y-d.y,c},S.mult=function(t,d){return{x:t.x*d,y:t.y*d}},S.div=function(t,d){return{x:t.x/d,y:t.y/d}},S.perp=function(t,d){return d=d===!0?-1:1,{x:d*-t.y,y:d*t.x}},S.neg=function(t){return{x:-t.x,y:-t.y}},S.angle=function(t,d){return Math.atan2(d.y-t.y,d.x-t.x)},S._temp=[S.create(),S.create(),S.create(),S.create(),S.create(),S.create()]}()},41598:(p,S,t)=>{var d={};p.exports=d;var c=t(31725),a=t(53402);(function(){d.create=function(r,n){for(var e=[],s=0;s0)return!1;i=o}return!0},d.scale=function(r,n,e,s){if(n===1&&e===1)return r;s=s||d.centre(r);for(var h,i,o=0;o=0?o-1:r.length-1],l=r[o],u=r[(o+1)%r.length],v=n[o0&&(n|=2),n===3)return!1;return n!==0?!0:null},d.hull=function(r){var n=[],e=[],s,h;for(r=r.slice(0),r.sort(function(i,o){var f=i.x-o.x;return f!==0?f:i.y-o.y}),h=0;h=2&&c.cross3(e[e.length-2],e[e.length-1],s)<=0;)e.pop();e.push(s)}for(h=r.length-1;h>=0;h-=1){for(s=r[h];n.length>=2&&c.cross3(n[n.length-2],n[n.length-1],s)<=0;)n.pop();n.push(s)}return n.pop(),e.pop(),n.concat(e)}})()},18210:(p,S,t)=>{var d=t(19933),c={name:"matter-attractors",version:"0.1.7",for:"matter-js@^0.19.0",silent:!0,install:function(a){a.after("Body.create",function(){c.Body.init(this)}),a.before("Engine.update",function(r){c.Engine.update(r)})},Body:{init:function(a){a.plugin.attractors=a.plugin.attractors||[]}},Engine:{update:function(a){for(var r=d.Composite.allBodies(a.world),n=0;n0)for(var h=0;h{/** + */p.exports={BodyBounds:t(68174),Components:t(31884),Events:t(1121),Factory:t(28137),MatterGameObject:t(75803),Image:t(23181),Matter:t(19933),MatterPhysics:t(42045),PolyDecomp:t(55973),Sprite:t(34803),TileBody:t(73834),PhysicsEditorParser:t(19496),PhysicsJSONParser:t(85791),PointerConstraint:t(98713),World:t(68243)}},22562:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(31725),r=t(53614),n=t(53402),e=t(15647),s=t(66615);(function(){d._timeCorrection=!0,d._inertiaScale=4,d._nextCollidingGroupId=1,d._nextNonCollidingGroupId=-1,d._nextCategory=1,d._baseDelta=16.666666666666668,d.create=function(i){var o={id:n.nextId(),type:"body",label:"Body",parts:[],plugin:{},angle:0,vertices:null,position:{x:0,y:0},force:{x:0,y:0},torque:0,positionImpulse:{x:0,y:0},constraintImpulse:{x:0,y:0,angle:0},totalContacts:0,speed:0,angularSpeed:0,velocity:{x:0,y:0},angularVelocity:0,isSensor:!1,isStatic:!1,isSleeping:!1,motion:0,sleepThreshold:60,density:.001,restitution:0,friction:.1,frictionStatic:.5,frictionAir:.01,collisionFilter:{category:1,mask:4294967295,group:0},slop:.05,timeScale:1,events:null,bounds:null,chamfer:null,circleRadius:0,positionPrev:null,anglePrev:0,parent:null,axes:null,area:0,mass:0,inverseMass:0,inertia:0,deltaTime:16.666666666666668,inverseInertia:0,_original:null,render:{visible:!0,opacity:1,sprite:{xOffset:0,yOffset:0},fillColor:null,fillOpacity:null,lineColor:null,lineOpacity:null,lineThickness:null},gameObject:null,scale:{x:1,y:1},centerOfMass:{x:0,y:0},centerOffset:{x:0,y:0},gravityScale:{x:1,y:1},ignoreGravity:!1,ignorePointer:!1,onCollideCallback:null,onCollideEndCallback:null,onCollideActiveCallback:null,onCollideWith:{}};!i.hasOwnProperty("position")&&i.hasOwnProperty("vertices")?i.position=c.centre(i.vertices):i.hasOwnProperty("vertices")||(o.vertices=c.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"));var f=n.extend(o,i);return h(f,i),f.setOnCollideWith=function(l,u){return u?this.onCollideWith[l.id]=u:delete this.onCollideWith[l.id],this},f},d.nextGroup=function(i){return i?d._nextNonCollidingGroupId--:d._nextCollidingGroupId++},d.nextCategory=function(){return d._nextCategory=d._nextCategory<<1,d._nextCategory};var h=function(i,o){if(o=o||{},d.set(i,{bounds:i.bounds||e.create(i.vertices),positionPrev:i.positionPrev||a.clone(i.position),anglePrev:i.anglePrev||i.angle,vertices:i.vertices,parts:i.parts||[i],isStatic:i.isStatic,isSleeping:i.isSleeping,parent:i.parent||i}),c.rotate(i.vertices,i.angle,i.position),s.rotate(i.axes,i.angle),e.update(i.bounds,i.vertices,i.velocity),d.set(i,{axes:o.axes||i.axes,area:o.area||i.area,mass:o.mass||i.mass,inertia:o.inertia||i.inertia}),i.parts.length===1){var f=i.bounds,l=i.centerOfMass,u=i.centerOffset,v=f.max.x-f.min.x,g=f.max.y-f.min.y;l.x=-(f.min.x-i.position.x)/v,l.y=-(f.min.y-i.position.y)/g,u.x=v*l.x,u.y=g*l.y}};d.set=function(i,o,f){var l;typeof o=="string"&&(l=o,o={},o[l]=f);for(l in o)if(Object.prototype.hasOwnProperty.call(o,l))switch(f=o[l],l){case"isStatic":d.setStatic(i,f);break;case"isSleeping":r.set(i,f);break;case"mass":d.setMass(i,f);break;case"density":d.setDensity(i,f);break;case"inertia":d.setInertia(i,f);break;case"vertices":d.setVertices(i,f);break;case"position":d.setPosition(i,f);break;case"angle":d.setAngle(i,f);break;case"velocity":d.setVelocity(i,f);break;case"angularVelocity":d.setAngularVelocity(i,f);break;case"speed":d.setSpeed(i,f);break;case"angularSpeed":d.setAngularSpeed(i,f);break;case"parts":d.setParts(i,f);break;case"centre":d.setCentre(i,f);break;default:i[l]=f}},d.setStatic=function(i,o){for(var f=0;f0&&a.rotateAbout(v.position,l,i.position,v.position)}},d.setVelocity=function(i,o){var f=i.deltaTime/d._baseDelta;i.positionPrev.x=i.position.x-o.x*f,i.positionPrev.y=i.position.y-o.y*f,i.velocity.x=(i.position.x-i.positionPrev.x)/f,i.velocity.y=(i.position.y-i.positionPrev.y)/f,i.speed=a.magnitude(i.velocity)},d.getVelocity=function(i){var o=d._baseDelta/i.deltaTime;return{x:(i.position.x-i.positionPrev.x)*o,y:(i.position.y-i.positionPrev.y)*o}},d.getSpeed=function(i){return a.magnitude(d.getVelocity(i))},d.setSpeed=function(i,o){d.setVelocity(i,a.mult(a.normalise(d.getVelocity(i)),o))},d.setAngularVelocity=function(i,o){var f=i.deltaTime/d._baseDelta;i.anglePrev=i.angle-o*f,i.angularVelocity=(i.angle-i.anglePrev)/f,i.angularSpeed=Math.abs(i.angularVelocity)},d.getAngularVelocity=function(i){return(i.angle-i.anglePrev)*d._baseDelta/i.deltaTime},d.getAngularSpeed=function(i){return Math.abs(d.getAngularVelocity(i))},d.setAngularSpeed=function(i,o){d.setAngularVelocity(i,n.sign(d.getAngularVelocity(i))*o)},d.translate=function(i,o,f){d.setPosition(i,a.add(i.position,o),f)},d.rotate=function(i,o,f,l){if(!f)d.setAngle(i,i.angle+o,l);else{var u=Math.cos(o),v=Math.sin(o),g=i.position.x-f.x,x=i.position.y-f.y;d.setPosition(i,{x:f.x+(g*u-x*v),y:f.y+(g*v+x*u)},l),d.setAngle(i,i.angle+o,l)}},d.scale=function(i,o,f,l){var u=0,v=0;l=l||i.position;for(var g=i.inertia===1/0,x=0;x0&&(u+=m.area,v+=m.inertia),m.position.x=l.x+(m.position.x-l.x)*o,m.position.y=l.y+(m.position.y-l.y)*f,e.update(m.bounds,m.vertices,i.velocity)}i.parts.length>1&&(i.area=u,i.isStatic||(d.setMass(i,i.density*u),d.setInertia(i,v))),i.circleRadius&&(o===f?i.circleRadius*=o:i.circleRadius=null),g&&d.setInertia(i,1/0)},d.update=function(i,o){o=(typeof o<"u"?o:16.666666666666668)*i.timeScale;var f=o*o,l=d._timeCorrection?o/(i.deltaTime||o):1,u=1-i.frictionAir*(o/n._baseDelta),v=(i.position.x-i.positionPrev.x)*l,g=(i.position.y-i.positionPrev.y)*l;i.velocity.x=v*u+i.force.x/i.mass*f,i.velocity.y=g*u+i.force.y/i.mass*f,i.positionPrev.x=i.position.x,i.positionPrev.y=i.position.y,i.position.x+=i.velocity.x,i.position.y+=i.velocity.y,i.deltaTime=o,i.angularVelocity=(i.angle-i.anglePrev)*u*l+i.torque/i.inertia*f,i.anglePrev=i.angle,i.angle+=i.angularVelocity,i.speed=a.magnitude(i.velocity),i.angularSpeed=Math.abs(i.angularVelocity);for(var x=0;x0&&(m.position.x+=i.velocity.x,m.position.y+=i.velocity.y),i.angularVelocity!==0&&(c.rotate(m.vertices,i.angularVelocity,i.position),s.rotate(m.axes,i.angularVelocity),x>0&&a.rotateAbout(m.position,i.angularVelocity,i.position,m.position)),e.update(m.bounds,m.vertices,i.velocity)}},d.updateVelocities=function(i){var o=d._baseDelta/i.deltaTime,f=i.velocity;f.x=(i.position.x-i.positionPrev.x)*o,f.y=(i.position.y-i.positionPrev.y)*o,i.speed=Math.sqrt(f.x*f.x+f.y*f.y),i.angularVelocity=(i.angle-i.anglePrev)*o,i.angularSpeed=Math.abs(i.angularVelocity)},d.applyForce=function(i,o,f){var l={x:o.x-i.position.x,y:o.y-i.position.y};i.force.x+=f.x,i.force.y+=f.y,i.torque+=l.x*f.y-l.y*f.x},d._totalProperties=function(i){for(var o={mass:0,area:0,inertia:0,centre:{x:0,y:0}},f=i.parts.length===1?0:1;f{var d={};p.exports=d;var c=t(35810),a=t(53402),r=t(15647),n=t(22562);(function(){d.create=function(e){return a.extend({id:a.nextId(),type:"composite",parent:null,isModified:!1,bodies:[],constraints:[],composites:[],label:"Composite",plugin:{},cache:{allBodies:null,allConstraints:null,allComposites:null}},e)},d.setModified=function(e,s,h,i){if(c.trigger(e,"compositeModified",e),e.isModified=s,s&&e.cache&&(e.cache.allBodies=null,e.cache.allConstraints=null,e.cache.allComposites=null),h&&e.parent&&d.setModified(e.parent,s,h,i),i)for(var o=0;o{var d={};p.exports=d;var c=t(69351);(function(){d.create=c.create,d.add=c.add,d.remove=c.remove,d.clear=c.clear,d.addComposite=c.addComposite,d.addBody=c.addBody,d.addConstraint=c.addConstraint})()},52284:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(4506);(function(){var r=[],n={overlap:0,axis:null},e={overlap:0,axis:null};d.create=function(s,h){return{pair:null,collided:!1,bodyA:s,bodyB:h,parentA:s.parent,parentB:h.parent,depth:0,normal:{x:0,y:0},tangent:{x:0,y:0},penetration:{x:0,y:0},supports:[]}},d.collides=function(s,h,i){if(d._overlapAxes(n,s.vertices,h.vertices,s.axes),n.overlap<=0||(d._overlapAxes(e,h.vertices,s.vertices,h.axes),e.overlap<=0))return null;var o=i&&i.table[a.id(s,h)],f;o?f=o.collision:(f=d.create(s,h),f.collided=!0,f.bodyA=s.idw?w=P:PG?G=P:Pf?f=u:u{var S={};p.exports=S,function(){S.create=function(t){return{vertex:t,normalImpulse:0,tangentImpulse:0}}}()},81388:(p,S,t)=>{var d={};p.exports=d;var c=t(53402),a=t(52284);(function(){d.create=function(r){var n={bodies:[],pairs:null};return c.extend(n,r)},d.setBodies=function(r,n){r.bodies=n.slice(0)},d.clear=function(r){r.bodies=[]},d.collisions=function(r){var n=[],e=r.pairs,s=r.bodies,h=s.length,i=d.canCollide,o=a.collides,f,l;for(s.sort(d._compareBoundsX),f=0;fg)break;if(!(xA.max.y)&&!(y&&(C.isStatic||C.isSleeping))&&i(u.collisionFilter,C.collisionFilter)){var P=C.parts.length;if(E&&P===1){var M=o(u,C,e);M&&n.push(M)}else for(var F=T>1?1:0,L=P>1?1:0,D=F;DA.max.x||v.max.xA.max.y)){var M=o(I,z,e);M&&n.push(M)}}}}}return n},d.canCollide=function(r,n){return r.group===n.group&&r.group!==0?r.group>0:(r.mask&n.category)!==0&&(n.mask&r.category)!==0},d._compareBoundsX=function(r,n){return r.bounds.min.x-n.bounds.min.x}})()},4506:(p,S,t)=>{var d={};p.exports=d;var c=t(43424);(function(){d.create=function(a,r){var n=a.bodyA,e=a.bodyB,s={id:d.id(n,e),bodyA:n,bodyB:e,collision:a,contacts:[],activeContacts:[],separation:0,isActive:!0,confirmedActive:!0,isSensor:n.isSensor||e.isSensor,timeCreated:r,timeUpdated:r,inverseMass:0,friction:0,frictionStatic:0,restitution:0,slop:0};return d.update(s,a,r),s},d.update=function(a,r,n){var e=a.contacts,s=r.supports,h=a.activeContacts,i=r.parentA,o=r.parentB,f=i.vertices.length;a.isActive=!0,a.timeUpdated=n,a.collision=r,a.separation=r.depth,a.inverseMass=i.inverseMass+o.inverseMass,a.friction=i.frictiono.frictionStatic?i.frictionStatic:o.frictionStatic,a.restitution=i.restitution>o.restitution?i.restitution:o.restitution,a.slop=i.slop>o.slop?i.slop:o.slop,r.pair=a,h.length=0;for(var l=0;l{var d={};p.exports=d;var c=t(4506),a=t(53402);(function(){d.create=function(r){return a.extend({table:{},list:[],collisionStart:[],collisionActive:[],collisionEnd:[]},r)},d.update=function(r,n,e){var s=r.list,h=s.length,i=r.table,o=n.length,f=r.collisionStart,l=r.collisionEnd,u=r.collisionActive,v,g,x,m;for(f.length=0,l.length=0,u.length=0,m=0;m{var d={};p.exports=d;var c=t(31725),a=t(52284),r=t(15647),n=t(66280),e=t(41598);(function(){d.collides=function(s,h){for(var i=[],o=h.length,f=s.bounds,l=a.collides,u=r.overlaps,v=0;v{var d={};p.exports=d;var c=t(41598),a=t(53402),r=t(15647);(function(){d._restingThresh=2,d._restingThreshTangent=Math.sqrt(6),d._positionDampen=.9,d._positionWarming=.8,d._frictionNormalMultiplier=5,d._frictionMaxStatic=Number.MAX_VALUE,d.preSolvePosition=function(n){var e,s,h,i=n.length;for(e=0;eQ?(x=q>0?q:-q,g=T.friction*(q>0?1:-1)*i,g<-x?g=-x:g>x&&(g=x)):(g=q,x=u);var k=N*L-X*F,j=V*L-Y*F,et=w/(G+C.inverseInertia*k*k+A.inverseInertia*j*j),it=(1+T.restitution)*$*et;if(g*=et,$0&&(O.normalImpulse=0),it=O.normalImpulse-ut}if(q<-f||q>f)O.tangentImpulse=0;else{var lt=O.tangentImpulse;O.tangentImpulse+=g,O.tangentImpulse<-x&&(O.tangentImpulse=-x),O.tangentImpulse>x&&(O.tangentImpulse=x),g=O.tangentImpulse-lt}var rt=F*it+D*g,nt=L*it+I*g;C.isStatic||C.isSleeping||(C.positionPrev.x+=rt*C.inverseMass,C.positionPrev.y+=nt*C.inverseMass,C.anglePrev+=(N*nt-X*rt)*C.inverseInertia),A.isStatic||A.isSleeping||(A.positionPrev.x-=rt*A.inverseMass,A.positionPrev.y-=nt*A.inverseMass,A.anglePrev-=(V*nt-Y*rt)*A.inverseInertia)}}}}})()},48140:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(31725),r=t(53614),n=t(15647),e=t(66615),s=t(53402);(function(){d._warming=.4,d._torqueDampen=1,d._minLength=1e-6,d.create=function(h){var i=h;i.bodyA&&!i.pointA&&(i.pointA={x:0,y:0}),i.bodyB&&!i.pointB&&(i.pointB={x:0,y:0});var o=i.bodyA?a.add(i.bodyA.position,i.pointA):i.pointA,f=i.bodyB?a.add(i.bodyB.position,i.pointB):i.pointB,l=a.magnitude(a.sub(o,f));i.length=typeof i.length<"u"?i.length:l,i.id=i.id||s.nextId(),i.label=i.label||"Constraint",i.type="constraint",i.stiffness=i.stiffness||(i.length>0?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 u={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return i.length===0&&i.stiffness>.1?(u.type="pin",u.anchors=!1):i.stiffness<.9&&(u.type="spring"),i.render=s.extend(u,i.render),i},d.preSolveAll=function(h){for(var i=0;i=1||h.length===0,E=T?h.stiffness*i:h.stiffness*i*i,C=h.damping*i,A=a.mult(x,y*E),P=(o?o.inverseMass:0)+(f?f.inverseMass:0),M=(o?o.inverseInertia:0)+(f?f.inverseInertia:0),F=P+M,L,D,I,U,z;if(C>0){var w=a.create();I=a.div(x,m),z=a.sub(f&&a.sub(f.position,f.positionPrev)||w,o&&a.sub(o.position,o.positionPrev)||w),U=a.dot(I,z)}o&&!o.isStatic&&(D=o.inverseMass/P,o.constraintImpulse.x-=A.x*D,o.constraintImpulse.y-=A.y*D,o.position.x-=A.x*D,o.position.y-=A.y*D,C>0&&(o.positionPrev.x-=C*I.x*U*D,o.positionPrev.y-=C*I.y*U*D),L=a.cross(l,A)/F*d._torqueDampen*o.inverseInertia*(1-h.angularStiffness),o.constraintImpulse.angle-=L,o.angle-=L),f&&!f.isStatic&&(D=f.inverseMass/P,f.constraintImpulse.x+=A.x*D,f.constraintImpulse.y+=A.y*D,f.position.x+=A.x*D,f.position.y+=A.y*D,C>0&&(f.positionPrev.x+=C*I.x*U*D,f.positionPrev.y+=C*I.y*U*D),L=a.cross(u,A)/F*d._torqueDampen*f.inverseInertia*(1-h.angularStiffness),f.constraintImpulse.angle+=L,f.angle+=L)}}},d.postSolveAll=function(h){for(var i=0;i0&&(u.position.x+=f.x,u.position.y+=f.y),f.angle!==0&&(c.rotate(u.vertices,f.angle,o.position),e.rotate(u.axes,f.angle),l>0&&a.rotateAbout(u.position,f.angle,o.position,u.position)),n.update(u.bounds,u.vertices,o.velocity)}f.angle*=d._warming,f.x*=d._warming,f.y*=d._warming}}},d.pointAWorld=function(h){return{x:(h.bodyA?h.bodyA.position.x:0)+(h.pointA?h.pointA.x:0),y:(h.bodyA?h.bodyA.position.y:0)+(h.pointA?h.pointA.y:0)}},d.pointBWorld=function(h){return{x:(h.bodyB?h.bodyB.position.x:0)+(h.pointB?h.pointB.x:0),y:(h.bodyB?h.bodyB.position.y:0)+(h.pointB?h.pointB.y:0)}},d.currentLength=function(h){var i=(h.bodyA?h.bodyA.position.x:0)+(h.pointA?h.pointA.x:0),o=(h.bodyA?h.bodyA.position.y:0)+(h.pointA?h.pointA.y:0),f=(h.bodyB?h.bodyB.position.x:0)+(h.pointB?h.pointB.x:0),l=(h.bodyB?h.bodyB.position.y:0)+(h.pointB?h.pointB.y:0),u=i-f,v=o-l;return Math.sqrt(u*u+v*v)}})()},53402:(p,S,t)=>{var d={};p.exports=d,function(){d._baseDelta=16.666666666666668,d._nextId=0,d._seed=0,d._nowStartTime=+new Date,d._warnedOnce={},d._decomp=null,d.extend=function(a,r){var n,e;typeof r=="boolean"?(n=2,e=r):(n=1,e=!0);for(var s=n;s0;r--){var n=Math.floor(d.random()*(r+1)),e=a[r];a[r]=a[n],a[n]=e}return a},d.choose=function(a){return a[Math.floor(d.random()*a.length)]},d.isElement=function(a){return typeof HTMLElement<"u"?a instanceof HTMLElement:!!(a&&a.nodeType&&a.nodeName)},d.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"},d.isFunction=function(a){return typeof a=="function"},d.isPlainObject=function(a){return typeof a=="object"&&a.constructor===Object},d.isString=function(a){return toString.call(a)==="[object String]"},d.clamp=function(a,r,n){return an?n:a},d.sign=function(a){return a<0?-1:1},d.now=function(){if(typeof window<"u"&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-d._nowStartTime},d.random=function(a,r){return a=typeof a<"u"?a:0,r=typeof r<"u"?r:1,a+c()*(r-a)};var c=function(){return d._seed=(d._seed*9301+49297)%233280,d._seed/233280};d.colorToNumber=function(a){return a=a.replace("#",""),a.length==3&&(a=a.charAt(0)+a.charAt(0)+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)),parseInt(a,16)},d.logLevel=1,d.log=function(){console&&d.logLevel>0&&d.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},d.info=function(){console&&d.logLevel>0&&d.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},d.warn=function(){console&&d.logLevel>0&&d.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},d.warnOnce=function(){var a=Array.prototype.slice.call(arguments).join(" ");d._warnedOnce[a]||(d.warn(a),d._warnedOnce[a]=!0)},d.deprecated=function(a,r,n){a[r]=d.chain(function(){d.warnOnce("🔅 deprecated 🔅",n)},a[r])},d.nextId=function(){return d._nextId++},d.indexOf=function(a,r){if(a.indexOf)return a.indexOf(r);for(var n=0;n{var d={};p.exports=d;var c=t(53614),a=t(66272),r=t(81388),n=t(99561),e=t(35810),s=t(69351),h=t(48140),i=t(53402),o=t(22562);(function(){d.create=function(f){f=f||{};var l={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],plugin:{},gravity:{x:0,y:1,scale:.001},timing:{timestamp:0,timeScale:1,lastDelta:0,lastElapsed:0}},u=i.extend(l,f);return u.world=f.world||s.create({label:"World"}),u.pairs=f.pairs||n.create(),u.detector=f.detector||r.create(),u.grid={buckets:[]},u.world.gravity=u.gravity,u.broadphase=u.grid,u.metrics={},u},d.update=function(f,l){var u=i.now(),v=f.world,g=f.detector,x=f.pairs,m=f.timing,y=m.timestamp,T;l=typeof l<"u"?l:i._baseDelta,l*=m.timeScale,m.timestamp+=l,m.lastDelta=l;var E={timestamp:m.timestamp,delta:l};e.trigger(f,"beforeUpdate",E);var C=s.allBodies(v),A=s.allConstraints(v);for(v.isModified&&(r.setBodies(g,C),s.setModified(v,!1,!1,!0)),f.enableSleeping&&c.update(C,l),d._bodiesApplyGravity(C,f.gravity),l>0&&d._bodiesUpdate(C,l),e.trigger(f,"beforeSolve",E),h.preSolveAll(C),T=0;T0&&e.trigger(f,"collisionStart",{pairs:x.collisionStart,timestamp:m.timestamp,delta:l});var M=i.clamp(20/f.positionIterations,0,1);for(a.preSolvePosition(x.list),T=0;T0&&e.trigger(f,"collisionActive",{pairs:x.collisionActive,timestamp:m.timestamp,delta:l}),x.collisionEnd.length>0&&e.trigger(f,"collisionEnd",{pairs:x.collisionEnd,timestamp:m.timestamp,delta:l}),d._bodiesClearForces(C),e.trigger(f,"afterUpdate",E),f.timing.lastElapsed=i.now()-u,f},d.merge=function(f,l){if(i.extend(f,l),l.world){f.world=l.world,d.clear(f);for(var u=s.allBodies(f.world),v=0;v{var d={};p.exports=d;var c=t(53402);(function(){d.on=function(a,r,n){for(var e=r.split(" "),s,h=0;h0){n||(n={}),e=r.split(" ");for(var f=0;f{var d={};p.exports=d;var c=t(73832),a=t(53402);(function(){d.name="matter-js",d.version="0.19.0",d.uses=[],d.used=[],d.use=function(){c.use(d,Array.prototype.slice.call(arguments))},d.before=function(r,n){return r=r.replace(/^Matter./,""),a.chainPathBefore(d,r,n)},d.after=function(r,n){return r=r.replace(/^Matter./,""),a.chainPathAfter(d,r,n)}})()},73832:(p,S,t)=>{var d={};p.exports=d;var c=t(53402);(function(){d._registry={},d.register=function(a){if(d.isPlugin(a)||c.warn("Plugin.register:",d.toString(a),"does not implement all required fields."),a.name in d._registry){var r=d._registry[a.name],n=d.versionParse(a.version).number,e=d.versionParse(r.version).number;n>e?(c.warn("Plugin.register:",d.toString(r),"was upgraded to",d.toString(a)),d._registry[a.name]=a):n-1},d.isFor=function(a,r){var n=a.for&&d.dependencyParse(a.for);return!a.for||r.name===n.name&&d.versionSatisfies(r.version,n.range)},d.use=function(a,r){if(a.uses=(a.uses||[]).concat(r||[]),a.uses.length===0){c.warn("Plugin.use:",d.toString(a),"does not specify any dependencies to install.");return}for(var n=d.dependencies(a),e=c.topologicalSort(n),s=[],h=0;h0&&!i.silent&&c.info(s.join(" "))},d.dependencies=function(a,r){var n=d.dependencyParse(a),e=n.name;if(r=r||{},!(e in r)){a=d.resolve(a)||a,r[e]=c.map(a.uses||[],function(h){d.isPlugin(h)&&d.register(h);var i=d.dependencyParse(h),o=d.resolve(h);return o&&!d.versionSatisfies(o.version,i.range)?(c.warn("Plugin.dependencies:",d.toString(o),"does not satisfy",d.toString(i),"used by",d.toString(n)+"."),o._warned=!0,a._warned=!0):o||(c.warn("Plugin.dependencies:",d.toString(h),"used by",d.toString(n),"could not be resolved."),a._warned=!0),i.name});for(var s=0;s=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;r.test(a)||c.warn("Plugin.versionParse:",a,"is not a valid version or range.");var n=r.exec(a),e=Number(n[4]),s=Number(n[5]),h=Number(n[6]);return{isRange:!!(n[1]||n[2]),version:n[3],range:a,operator:n[1]||n[2]||"",major:e,minor:s,patch:h,parts:[e,s,h],prerelease:n[7],number:e*1e8+s*1e4+h}},d.versionSatisfies=function(a,r){r=r||"*";var n=d.versionParse(r),e=d.versionParse(a);if(n.isRange){if(n.operator==="*"||a==="*")return!0;if(n.operator===">")return e.number>n.number;if(n.operator===">=")return e.number>=n.number;if(n.operator==="~")return e.major===n.major&&e.minor===n.minor&&e.patch>=n.patch;if(n.operator==="^")return n.major>0?e.major===n.major&&e.number>=n.number:n.minor>0?e.minor===n.minor&&e.patch>=n.patch:e.patch===n.patch}return a===r||a==="*"}})()},53614:(p,S,t)=>{var d={};p.exports=d;var c=t(22562),a=t(35810),r=t(53402);(function(){d._motionWakeThreshold=.18,d._motionSleepThreshold=.08,d._minBias=.9,d.update=function(n,e){for(var s=e/r._baseDelta,h=d._motionSleepThreshold,i=0;i0&&o.motion=o.sleepThreshold/s&&d.set(o,!0)):o.sleepCounter>0&&(o.sleepCounter-=1)}},d.afterCollisions=function(n){for(var e=d._motionSleepThreshold,s=0;se&&d.set(l,!1)}}}},d.set=function(n,e){var s=n.isSleeping;e?(n.isSleeping=!0,n.sleepCounter=n.sleepThreshold,n.positionImpulse.x=0,n.positionImpulse.y=0,n.positionPrev.x=n.position.x,n.positionPrev.y=n.position.y,n.anglePrev=n.angle,n.speed=0,n.angularSpeed=0,n.motion=0,s||a.trigger(n,"sleepStart")):(n.isSleeping=!1,n.sleepCounter=0,s&&a.trigger(n,"sleepEnd"))}})()},66280:(p,S,t)=>{var d={};p.exports=d;var c=t(41598),a=t(53402),r=t(22562),n=t(15647),e=t(31725);(function(){d.rectangle=function(s,h,i,o,f){f=f||{};var l={label:"Rectangle Body",position:{x:s,y:h},vertices:c.fromPath("L 0 0 L "+i+" 0 L "+i+" "+o+" L 0 "+o)};if(f.chamfer){var u=f.chamfer;l.vertices=c.chamfer(l.vertices,u.radius,u.quality,u.qualityMin,u.qualityMax),delete f.chamfer}return r.create(a.extend({},l,f))},d.trapezoid=function(s,h,i,o,f,l){l=l||{},f*=.5;var u=(1-f*2)*i,v=i*f,g=v+u,x=g+v,m;f<.5?m="L 0 0 L "+v+" "+-o+" L "+g+" "+-o+" L "+x+" 0":m="L 0 0 L "+g+" "+-o+" L "+x+" 0";var y={label:"Trapezoid Body",position:{x:s,y:h},vertices:c.fromPath(m)};if(l.chamfer){var T=l.chamfer;y.vertices=c.chamfer(y.vertices,T.radius,T.quality,T.qualityMin,T.qualityMax),delete l.chamfer}return r.create(a.extend({},y,l))},d.circle=function(s,h,i,o,f){o=o||{};var l={label:"Circle Body",circleRadius:i};f=f||25;var u=Math.ceil(Math.max(10,Math.min(f,i)));return u%2===1&&(u+=1),d.polygon(s,h,u,i,a.extend({},l,o))},d.polygon=function(s,h,i,o,f){if(f=f||{},i<3)return d.circle(s,h,o,f);for(var l=2*Math.PI/i,u="",v=l*.5,g=0;g0&&c.area(z)1?(m=r.create(a.extend({parts:y.slice(0)},o)),r.setPosition(m,{x:s,y:h}),m):y[0]},d.flagCoincidentParts=function(s,h){h===void 0&&(h=5);for(var i=0;i{var d={};p.exports=d;var c=t(69351),a=t(48140),r=t(53402),n=t(22562),e=t(66280);(function(){d.stack=function(s,h,i,o,f,l,u){for(var v=c.create({label:"Stack"}),g=s,x=h,m,y=0,T=0;TE&&(E=P),n.translate(A,{x:M*.5,y:P*.5}),g=A.bounds.max.x+f,c.addBody(v,A),m=A,y+=1}else g+=f}x+=E+l,g=s}return v},d.chain=function(s,h,i,o,f,l){for(var u=s.bodies,v=1;v0)for(v=0;v0&&(m=l[v-1+(u-1)*h],c.addConstraint(s,a.create(r.extend({bodyA:m,bodyB:x},f)))),o&&vE)){m=E-m;var A=m,P=i-1-m;if(!(xP)){T===1&&n.translate(y,{x:(x+(i%2===1?1:-1))*C,y:0});var M=y?x*C:0;return u(s+M+x*f,g,x,m,y,T)}}})},d.newtonsCradle=function(s,h,i,o,f){for(var l=c.create({label:"Newtons Cradle"}),u=0;u{var d={};p.exports=d;var c=t(31725),a=t(53402);(function(){d.fromVertices=function(r){for(var n={},e=0;e{var S={};p.exports=S,function(){S.create=function(t){var d={min:{x:0,y:0},max:{x:0,y:0}};return t&&S.update(d,t),d},S.update=function(t,d,c){t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var a=0;at.max.x&&(t.max.x=r.x),r.xt.max.y&&(t.max.y=r.y),r.y0?t.max.x+=c.x:t.min.x+=c.x,c.y>0?t.max.y+=c.y:t.min.y+=c.y)},S.contains=function(t,d){return d.x>=t.min.x&&d.x<=t.max.x&&d.y>=t.min.y&&d.y<=t.max.y},S.overlaps=function(t,d){return t.min.x<=d.max.x&&t.max.x>=d.min.x&&t.max.y>=d.min.y&&t.min.y<=d.max.y},S.translate=function(t,d){t.min.x+=d.x,t.max.x+=d.x,t.min.y+=d.y,t.max.y+=d.y},S.shift=function(t,d){var c=t.max.x-t.min.x,a=t.max.y-t.min.y;t.min.x=d.x,t.max.x=d.x+c,t.min.y=d.y,t.max.y=d.y+a}}()},74058:(p,S,t)=>{var d={};p.exports=d,t(15647);var c=t(53402);(function(){d.pathToVertices=function(a,r){typeof window<"u"&&!("SVGPathSeg"in window)&&c.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");var n,e,s,h,i,o,f,l,u,v,g=[],x,m,y=0,T=0,E=0;r=r||15;var C=function(P,M,F){var L=F%2===1&&F>1;if(!u||P!=u.x||M!=u.y){u&&L?(x=u.x,m=u.y):(x=0,m=0);var D={x:x+P,y:m+M};(L||!u)&&(u=D),g.push(D),T=x+P,E=m+M}},A=function(P){var M=P.pathSegTypeAsLetter.toUpperCase();if(M!=="Z"){switch(M){case"M":case"L":case"T":case"C":case"S":case"Q":T=P.x,E=P.y;break;case"H":T=P.x;break;case"V":E=P.y;break}C(T,E,P.pathSegType)}};for(d._svgPathToAbsolute(a),s=a.getTotalLength(),o=[],n=0;n{var S={};p.exports=S,function(){S.create=function(t,d){return{x:t||0,y:d||0}},S.clone=function(t){return{x:t.x,y:t.y}},S.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},S.magnitudeSquared=function(t){return t.x*t.x+t.y*t.y},S.rotate=function(t,d,c){var a=Math.cos(d),r=Math.sin(d);c||(c={});var n=t.x*a-t.y*r;return c.y=t.x*r+t.y*a,c.x=n,c},S.rotateAbout=function(t,d,c,a){var r=Math.cos(d),n=Math.sin(d);a||(a={});var e=c.x+((t.x-c.x)*r-(t.y-c.y)*n);return a.y=c.y+((t.x-c.x)*n+(t.y-c.y)*r),a.x=e,a},S.normalise=function(t){var d=S.magnitude(t);return d===0?{x:0,y:0}:{x:t.x/d,y:t.y/d}},S.dot=function(t,d){return t.x*d.x+t.y*d.y},S.cross=function(t,d){return t.x*d.y-t.y*d.x},S.cross3=function(t,d,c){return(d.x-t.x)*(c.y-t.y)-(d.y-t.y)*(c.x-t.x)},S.add=function(t,d,c){return c||(c={}),c.x=t.x+d.x,c.y=t.y+d.y,c},S.sub=function(t,d,c){return c||(c={}),c.x=t.x-d.x,c.y=t.y-d.y,c},S.mult=function(t,d){return{x:t.x*d,y:t.y*d}},S.div=function(t,d){return{x:t.x/d,y:t.y/d}},S.perp=function(t,d){return d=d===!0?-1:1,{x:d*-t.y,y:d*t.x}},S.neg=function(t){return{x:-t.x,y:-t.y}},S.angle=function(t,d){return Math.atan2(d.y-t.y,d.x-t.x)},S._temp=[S.create(),S.create(),S.create(),S.create(),S.create(),S.create()]}()},41598:(p,S,t)=>{var d={};p.exports=d;var c=t(31725),a=t(53402);(function(){d.create=function(r,n){for(var e=[],s=0;s0)return!1;i=o}return!0},d.scale=function(r,n,e,s){if(n===1&&e===1)return r;s=s||d.centre(r);for(var h,i,o=0;o=0?o-1:r.length-1],l=r[o],u=r[(o+1)%r.length],v=n[o0&&(n|=2),n===3)return!1;return n!==0?!0:null},d.hull=function(r){var n=[],e=[],s,h;for(r=r.slice(0),r.sort(function(i,o){var f=i.x-o.x;return f!==0?f:i.y-o.y}),h=0;h=2&&c.cross3(e[e.length-2],e[e.length-1],s)<=0;)e.pop();e.push(s)}for(h=r.length-1;h>=0;h-=1){for(s=r[h];n.length>=2&&c.cross3(n[n.length-2],n[n.length-1],s)<=0;)n.pop();n.push(s)}return n.pop(),e.pop(),n.concat(e)}})()},18210:(p,S,t)=>{var d=t(19933),c={name:"matter-attractors",version:"0.1.7",for:"matter-js@^0.19.0",silent:!0,install:function(a){a.after("Body.create",function(){c.Body.init(this)}),a.before("Engine.update",function(r){c.Engine.update(r)})},Body:{init:function(a){a.plugin.attractors=a.plugin.attractors||[]}},Engine:{update:function(a){for(var r=d.Composite.allBodies(a.world),n=0;n0)for(var h=0;h{/** * @author @dxu https://github.com/dxu/matter-collision-events * @author Richard Davey * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -4736,7 +4736,7 @@ return new `+this.key+`(); * @author Felipe Alfonso <@bitnenfer> * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var d=t(83419),c=t(94811),a=t(95540),r=t(98840),n=t(44667),e=t(61340),s=t(70554),h=t(14500),i=t(29100),o=new d({Extends:i,initialize:function(l){var u=l.game.renderer,v=a(l,"fragShader",r);l.fragShader=s.parseFragmentShaderMaxTextures(v,u.maxTextures),l.vertShader=a(l,"vertShader",n),l.attributes=a(l,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:h.UNSIGNED_BYTE,normalized:!0}]),l.resizeUniform="uResolution",i.call(this,l),this._tempMatrix1=new e,this._tempMatrix2=new e,this._tempMatrix3=new e,this.calcMatrix=new e,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){i.prototype.boot.call(this);var f=this.renderer;this.set1iv("uMainSampler",f.textureIndexes),this.set2f("uResolution",f.width,f.height),this.set1i("uRoundPixels",f.config.roundPixels)},batchSprite:function(f,l,u){this.manager.set(this,f);var v=this._tempMatrix1,g=this._tempMatrix2,x=this._tempMatrix3,m=f.frame,y=m.glTexture,T=m.u0,E=m.v0,C=m.u1,A=m.v1,P=m.x,M=m.y,F=m.cutWidth,L=m.cutHeight,D=m.customPivot,I=f.displayOriginX,U=f.displayOriginY,z=-I+P,w=-U+M;if(f.isCropped){var G=f._crop;(G.flipX!==f.flipX||G.flipY!==f.flipY)&&m.updateCropUVs(G,f.flipX,f.flipY),T=G.u0,E=G.v0,C=G.u1,A=G.v1,F=G.width,L=G.height,P=G.x,M=G.y,z=-I+P,w=-U+M}var R=1,O=1;f.flipX&&(D||(z+=-m.realWidth+I*2),R=-1),(f.flipY||m.source.isGLTexture&&m.source.isRenderTexture&&!y.flipY)&&(D||(w+=-m.realHeight+U*2),O=-1);var B=f.x,N=f.y;g.applyITRS(B,N,f.rotation,f.scaleX*R,f.scaleY*O),v.copyFrom(l.matrix),u?(v.multiplyWithOffset(u,-l.scrollX*f.scrollFactorX,-l.scrollY*f.scrollFactorY),g.e=B,g.f=N):(g.e-=l.scrollX*f.scrollFactorX,g.f-=l.scrollY*f.scrollFactorY),v.multiply(g,x);var X=x.setQuad(z,w,z+F,w+L),V=s.getTintAppendFloatAlpha,Y=l.alpha,W=V(f.tintTopLeft,Y*f._alphaTL),H=V(f.tintTopRight,Y*f._alphaTR),b=V(f.tintBottomLeft,Y*f._alphaBL),K=V(f.tintBottomRight,Y*f._alphaBR);this.shouldFlush(6)&&this.flush();var J=this.setGameObject(f,m);this.manager.preBatch(f),this.currentShader.set1i("uRoundPixels",l.roundPixels),this.batchQuad(f,X[0],X[1],X[2],X[3],X[4],X[5],X[6],X[7],T,E,C,A,W,H,b,K,f.tintFill,y,J),this.manager.postBatch(f)},batchTexture:function(f,l,u,v,g,x,m,y,T,E,C,A,P,M,F,L,D,I,U,z,w,G,R,O,B,N,X,V,Y,W,H,b,K){K===void 0&&(K=!1),this.manager.set(this,f);var J=this._tempMatrix1,Z=this._tempMatrix2,$=this._tempMatrix3,q=I/u+X,tt=U/v+V,_=(I+z)/u+X,Q=(U+w)/v+V,k=m,j=y,et=-L,it=-D;if(f.isCropped){var lt=f._crop,ht=lt.width,rt=lt.height;k=ht,j=rt,m=ht,y=rt,I=lt.x,U=lt.y;var st=I,dt=U;A&&(st=z-lt.x-ht),P&&(dt=w-lt.y-rt),q=st/u+X,tt=dt/v+V,_=(st+ht)/u+X,Q=(dt+rt)/v+V,et=-L+I,it=-D+U}P=P^(!H&&l.isRenderTexture?1:0),A&&(k*=-1,et+=m),P&&(j*=-1,it+=y),Z.applyITRS(g,x,C,T,E),J.copyFrom(Y.matrix),W?(J.multiplyWithOffset(W,-Y.scrollX*M,-Y.scrollY*F),Z.e=g,Z.f=x):(Z.e-=Y.scrollX*M,Z.f-=Y.scrollY*F),J.multiply(Z,$);var ot=$.setQuad(et,it,et+k,it+j);b==null&&(b=this.setTexture2D(l)),f&&!K&&this.manager.preBatch(f),this.currentShader.set1i("uRoundPixels",Y.roundPixels),this.batchQuad(f,ot[0],ot[1],ot[2],ot[3],ot[4],ot[5],ot[6],ot[7],q,tt,_,Q,G,R,O,B,N,l,b),f&&!K&&this.manager.postBatch(f)},batchTextureFrame:function(f,l,u,v,g,x,m){this.manager.set(this);var y=this._tempMatrix1.copyFrom(x),T=this._tempMatrix2;m?y.multiply(m,T):T=y;var E=T.setQuad(l,u,l+f.width,u+f.height),C=this.setTexture2D(f.source.glTexture);v=s.getTintAppendFloatAlpha(v,g),this.batchQuad(null,E[0],E[1],E[2],E[3],E[4],E[5],E[6],E[7],f.u0,f.v0,f.u1,f.v1,v,v,v,v,0,f.glTexture,C)},batchFillRect:function(f,l,u,v,g,x){this.renderer.pipelines.set(this);var m=this.calcMatrix;x&&x.multiply(g,m);var y=m.setQuad(f,l,f+u,l+v),T=this.fillTint;this.batchQuad(null,y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],0,0,1,1,T.TL,T.TR,T.BL,T.BR,2)},batchFillTriangle:function(f,l,u,v,g,x,m,y){this.renderer.pipelines.set(this);var T=this.calcMatrix;y&&y.multiply(m,T);var E=T.getX(f,l),C=T.getY(f,l),A=T.getX(u,v),P=T.getY(u,v),M=T.getX(g,x),F=T.getY(g,x),L=this.fillTint;this.currentShader.set1i("uRoundPixels",!1),this.batchTri(null,E,C,A,P,M,F,0,0,1,1,L.TL,L.TR,L.BL,2)},batchStrokeTriangle:function(f,l,u,v,g,x,m,y,T){var E=this.tempTriangle;E[0].x=f,E[0].y=l,E[0].width=m,E[1].x=u,E[1].y=v,E[1].width=m,E[2].x=g,E[2].y=x,E[2].width=m,E[3].x=f,E[3].y=l,E[3].width=m,this.batchStrokePath(E,m,!1,y,T)},batchFillPath:function(f,l,u){this.renderer.pipelines.set(this);var v=this.calcMatrix;u&&u.multiply(l,v);for(var g=f.length,x=this.polygonCache,m,y,T=this.fillTint.TL,E=this.fillTint.TR,C=this.fillTint.BL,A=0;A0&&k[4]?this.batchQuad(null,J,Z,W,H,k[0],k[1],k[2],k[3],0,0,1,1,q,tt,_,Q,2):(j[0]=J,j[1]=Z,j[2]=W,j[3]=H,j[4]=1),T&&j[4]?this.batchQuad(null,V,Y,b,K,j[0],j[1],j[2],j[3],0,0,1,1,q,tt,_,Q,2):(k[0]=V,k[1]=Y,k[2]=b,k[3]=K,k[4]=1)}}},destroy:function(){return this._tempMatrix1.destroy(),this._tempMatrix2.destroy(),this._tempMatrix3.destroy(),this._tempMatrix1=null,this._tempMatrix1=null,this._tempMatrix1=null,i.prototype.destroy.call(this),this}});p.exports=o},43439:(p,S,t)=>{/** + */var d=t(83419),c=t(94811),a=t(95540),r=t(98840),n=t(44667),e=t(61340),s=t(70554),h=t(14500),i=t(29100),o=new d({Extends:i,initialize:function(l){var u=l.game.renderer,v=a(l,"fragShader",r);l.fragShader=s.parseFragmentShaderMaxTextures(v,u.maxTextures),l.vertShader=a(l,"vertShader",n),l.attributes=a(l,"attributes",[{name:"inPosition",size:2},{name:"inTexCoord",size:2},{name:"inTexId"},{name:"inTintEffect"},{name:"inTint",size:4,type:h.UNSIGNED_BYTE,normalized:!0}]),l.resizeUniform="uResolution",i.call(this,l),this._tempMatrix1=new e,this._tempMatrix2=new e,this._tempMatrix3=new e,this.calcMatrix=new e,this.tempTriangle=[{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0},{x:0,y:0,width:0}],this.strokeTint={TL:0,TR:0,BL:0,BR:0},this.fillTint={TL:0,TR:0,BL:0,BR:0},this.currentFrame={u0:0,v0:0,u1:1,v1:1},this.firstQuad=[0,0,0,0,0],this.prevQuad=[0,0,0,0,0],this.polygonCache=[]},boot:function(){i.prototype.boot.call(this);var f=this.renderer;this.set1iv("uMainSampler",f.textureIndexes),this.set2f("uResolution",f.width,f.height),this.set1i("uRoundPixels",f.config.roundPixels)},batchSprite:function(f,l,u){this.manager.set(this,f);var v=this._tempMatrix1,g=this._tempMatrix2,x=this._tempMatrix3,m=f.frame,y=m.glTexture,T=m.u0,E=m.v0,C=m.u1,A=m.v1,P=m.x,M=m.y,F=m.cutWidth,L=m.cutHeight,D=m.customPivot,I=f.displayOriginX,U=f.displayOriginY,z=-I+P,w=-U+M;if(f.isCropped){var G=f._crop;(G.flipX!==f.flipX||G.flipY!==f.flipY)&&m.updateCropUVs(G,f.flipX,f.flipY),T=G.u0,E=G.v0,C=G.u1,A=G.v1,F=G.width,L=G.height,P=G.x,M=G.y,z=-I+P,w=-U+M}var R=1,O=1;f.flipX&&(D||(z+=-m.realWidth+I*2),R=-1),(f.flipY||m.source.isGLTexture&&m.source.isRenderTexture&&!y.flipY)&&(D||(w+=-m.realHeight+U*2),O=-1);var B=f.x,N=f.y;g.applyITRS(B,N,f.rotation,f.scaleX*R,f.scaleY*O),v.copyFrom(l.matrix),u?(v.multiplyWithOffset(u,-l.scrollX*f.scrollFactorX,-l.scrollY*f.scrollFactorY),g.e=B,g.f=N):(g.e-=l.scrollX*f.scrollFactorX,g.f-=l.scrollY*f.scrollFactorY),v.multiply(g,x);var X=x.setQuad(z,w,z+F,w+L),V=s.getTintAppendFloatAlpha,Y=l.alpha,W=V(f.tintTopLeft,Y*f._alphaTL),H=V(f.tintTopRight,Y*f._alphaTR),b=V(f.tintBottomLeft,Y*f._alphaBL),K=V(f.tintBottomRight,Y*f._alphaBR);this.shouldFlush(6)&&this.flush();var J=this.setGameObject(f,m);this.manager.preBatch(f),this.currentShader.set1i("uRoundPixels",l.roundPixels),this.batchQuad(f,X[0],X[1],X[2],X[3],X[4],X[5],X[6],X[7],T,E,C,A,W,H,b,K,f.tintFill,y,J),this.manager.postBatch(f)},batchTexture:function(f,l,u,v,g,x,m,y,T,E,C,A,P,M,F,L,D,I,U,z,w,G,R,O,B,N,X,V,Y,W,H,b,K){K===void 0&&(K=!1),this.manager.set(this,f);var J=this._tempMatrix1,Z=this._tempMatrix2,$=this._tempMatrix3,q=I/u+X,tt=U/v+V,_=(I+z)/u+X,Q=(U+w)/v+V,k=m,j=y,et=-L,it=-D;if(f.isCropped){var ut=f._crop,lt=ut.width,rt=ut.height;k=lt,j=rt,m=lt,y=rt,I=ut.x,U=ut.y;var nt=I,dt=U;A&&(nt=z-ut.x-lt),P&&(dt=w-ut.y-rt),q=nt/u+X,tt=dt/v+V,_=(nt+lt)/u+X,Q=(dt+rt)/v+V,et=-L+I,it=-D+U}P=P^(!H&&l.isRenderTexture?1:0),A&&(k*=-1,et+=m),P&&(j*=-1,it+=y),Z.applyITRS(g,x,C,T,E),J.copyFrom(Y.matrix),W?(J.multiplyWithOffset(W,-Y.scrollX*M,-Y.scrollY*F),Z.e=g,Z.f=x):(Z.e-=Y.scrollX*M,Z.f-=Y.scrollY*F),J.multiply(Z,$);var ot=$.setQuad(et,it,et+k,it+j);b==null&&(b=this.setTexture2D(l)),f&&!K&&this.manager.preBatch(f),this.currentShader.set1i("uRoundPixels",Y.roundPixels),this.batchQuad(f,ot[0],ot[1],ot[2],ot[3],ot[4],ot[5],ot[6],ot[7],q,tt,_,Q,G,R,O,B,N,l,b),f&&!K&&this.manager.postBatch(f)},batchTextureFrame:function(f,l,u,v,g,x,m){this.manager.set(this);var y=this._tempMatrix1.copyFrom(x),T=this._tempMatrix2;m?y.multiply(m,T):T=y;var E=T.setQuad(l,u,l+f.width,u+f.height),C=this.setTexture2D(f.source.glTexture);v=s.getTintAppendFloatAlpha(v,g),this.batchQuad(null,E[0],E[1],E[2],E[3],E[4],E[5],E[6],E[7],f.u0,f.v0,f.u1,f.v1,v,v,v,v,0,f.glTexture,C)},batchFillRect:function(f,l,u,v,g,x){this.renderer.pipelines.set(this);var m=this.calcMatrix;x&&x.multiply(g,m);var y=m.setQuad(f,l,f+u,l+v),T=this.fillTint;this.batchQuad(null,y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],0,0,1,1,T.TL,T.TR,T.BL,T.BR,2)},batchFillTriangle:function(f,l,u,v,g,x,m,y){this.renderer.pipelines.set(this);var T=this.calcMatrix;y&&y.multiply(m,T);var E=T.getX(f,l),C=T.getY(f,l),A=T.getX(u,v),P=T.getY(u,v),M=T.getX(g,x),F=T.getY(g,x),L=this.fillTint;this.currentShader.set1i("uRoundPixels",!1),this.batchTri(null,E,C,A,P,M,F,0,0,1,1,L.TL,L.TR,L.BL,2)},batchStrokeTriangle:function(f,l,u,v,g,x,m,y,T){var E=this.tempTriangle;E[0].x=f,E[0].y=l,E[0].width=m,E[1].x=u,E[1].y=v,E[1].width=m,E[2].x=g,E[2].y=x,E[2].width=m,E[3].x=f,E[3].y=l,E[3].width=m,this.batchStrokePath(E,m,!1,y,T)},batchFillPath:function(f,l,u){this.renderer.pipelines.set(this);var v=this.calcMatrix;u&&u.multiply(l,v);for(var g=f.length,x=this.polygonCache,m,y,T=this.fillTint.TL,E=this.fillTint.TR,C=this.fillTint.BL,A=0;A0&&k[4]?this.batchQuad(null,J,Z,W,H,k[0],k[1],k[2],k[3],0,0,1,1,q,tt,_,Q,2):(j[0]=J,j[1]=Z,j[2]=W,j[3]=H,j[4]=1),T&&j[4]?this.batchQuad(null,V,Y,b,K,j[0],j[1],j[2],j[3],0,0,1,1,q,tt,_,Q,2):(k[0]=V,k[1]=Y,k[2]=b,k[3]=K,k[4]=1)}}},destroy:function(){return this._tempMatrix1.destroy(),this._tempMatrix2.destroy(),this._tempMatrix3.destroy(),this._tempMatrix1=null,this._tempMatrix1=null,this._tempMatrix1=null,i.prototype.destroy.call(this),this}});p.exports=o},43439:(p,S,t)=>{/** * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} @@ -6342,7 +6342,7 @@ return new `+this.key+`(); * @author Richard Davey * @copyright 2013-2024 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */p.exports={Format:t(27902),Pad:t(41836),RemoveAt:t(33628),Reverse:t(27671),UppercaseFirst:t(35355),UUID:t(45650)}}},mt={};function ft(p){var S=mt[p];if(S!==void 0)return S.exports;var t=mt[p]={exports:{}};return ut[p](t,t.exports,ft),t.exports}ft.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}();var pt=ft(85454);return pt})())})(Vt);var Ht=Vt.exports;const xt=Wt(Ht),bt=` + */p.exports={Format:t(27902),Pad:t(41836),RemoveAt:t(33628),Reverse:t(27671),UppercaseFirst:t(35355),UUID:t(45650)}}},mt={};function ft(p){var S=mt[p];if(S!==void 0)return S.exports;var t=mt[p]={exports:{}};return ht[p](t,t.exports,ft),t.exports}ft.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}();var pt=ft(85454);return pt})())})(Ht);var Zt=Ht.exports;const xt=Kt(Zt),Jt=` #define SHADER_NAME NOTHING_POST_TINT #ifdef GL_ES @@ -6356,7 +6356,7 @@ uniform sampler2D uMainSampler; void main() { gl_FragColor = texture2D(uMainSampler, outTexCoord); } -`;class Ot extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(nt){super({game:nt,fragShader:bt})}}const Dt="BG";class Kt extends xt.Scene{constructor(){super({key:"NothingPostFxScene"})}preload(){this.load.image(Dt,"assets/images/bg.png")}create(){var nt;this.add.image(0,0,Dt).setOrigin(0),this.renderer.pipelines.addPostPipeline("NothingPostFxPipeline",Ot),this.cameras.main.setPostPipeline(Ot),(nt=this.input.keyboard)==null||nt.once("keydown-SPACE",()=>{this.scene.start("ColorPostFxScene")})}}const Zt=` +`;class Dt extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(st){super({game:st,fragShader:Jt})}}const wt="BG";class Qt extends xt.Scene{constructor(){super({key:"NothingPostFxScene"})}preload(){this.load.image(wt,"assets/images/bg.png")}create(){var st;this.add.image(0,0,wt).setOrigin(0),this.renderer.pipelines.addPostPipeline("NothingPostFxPipeline",Dt),this.cameras.main.setPostPipeline(Dt),(st=this.input.keyboard)==null||st.once("keydown-SPACE",()=>{this.scene.start("ColorPostFxScene")})}}const $t=` #define SHADER_NAME COLOR_POST_TINT #ifdef GL_ES @@ -6367,7 +6367,7 @@ void main() { // RGB, Alpha gl_FragColor = vec4(0.0, 0.0, 0.0, 0.2); } -`;class wt extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(nt){super({game:nt,fragShader:Zt})}}const Bt="BG";class Jt extends xt.Scene{constructor(){super({key:"ColorPostFxScene"})}preload(){this.load.image(Bt,"assets/images/bg.png")}create(){var nt;this.add.image(0,0,Bt).setOrigin(0),this.renderer.pipelines.addPostPipeline("ColorPostFxPipeline",wt),this.cameras.main.setPostPipeline(wt),(nt=this.input.keyboard)==null||nt.once("keydown-SPACE",()=>{this.scene.start("GreyScalePostFxScene")})}}const Qt=` +`;class Bt extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(st){super({game:st,fragShader:$t})}}const It="BG";class jt extends xt.Scene{constructor(){super({key:"ColorPostFxScene"})}preload(){this.load.image(It,"assets/images/bg.png")}create(){var st;this.add.image(0,0,It).setOrigin(0),this.renderer.pipelines.addPostPipeline("ColorPostFxPipeline",Bt),this.cameras.main.setPostPipeline(Bt),(st=this.input.keyboard)==null||st.once("keydown-SPACE",()=>{this.scene.start("GreyScalePostFxScene")})}}const kt=` #define SHADER_NAME GREY_SCALE_POST_TINT #ifdef GL_ES @@ -6383,7 +6383,7 @@ void main() { // mix https://thebookofshaders.com/glossary/?search=mix gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2126 * gl_FragColor.r + 0.7152 * gl_FragColor.g + 0.0722 * gl_FragColor.b), 1.0); } -`;class It extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(nt){super({game:nt,fragShader:Qt})}}const Gt="BG";class $t extends xt.Scene{constructor(){super({key:"GreyScalePostFxScene"})}preload(){this.load.image(Gt,"assets/images/bg.png")}create(){var nt;this.add.image(0,0,Gt).setOrigin(0),this.renderer.pipelines.addPostPipeline("GreyScalePostFxPipeline",It),this.cameras.main.setPostPipeline(It),(nt=this.input.keyboard)==null||nt.once("keydown-SPACE",()=>{this.scene.start("WipePostFxScene")})}}const jt=` +`;class Gt extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(st){super({game:st,fragShader:kt})}}const Nt="BG";class qt extends xt.Scene{constructor(){super({key:"GreyScalePostFxScene"})}preload(){this.load.image(Nt,"assets/images/bg.png")}create(){var st;this.add.image(0,0,Nt).setOrigin(0),this.renderer.pipelines.addPostPipeline("GreyScalePostFxPipeline",Gt),this.cameras.main.setPostPipeline(Gt),(st=this.input.keyboard)==null||st.once("keydown-SPACE",()=>{this.scene.start("DynamicColorPostFxScene")})}}const _t=` #define SHADER_NAME WIPE_POST_FX #ifdef GL_ES @@ -6403,4 +6403,18 @@ void main() { gl_FragColor = texture2D(uMainSampler, outTexCoord); } } -`;var Pt;class Nt extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(ut){super({game:ut,fragShader:jt});Lt(this,Pt,void 0);Rt(this,Pt,0)}get progress(){return Mt(this,Pt)}set progress(ut){Rt(this,Pt,ut)}onPreRender(){this.set1f("uCutoff",Mt(this,Pt))}}Pt=new WeakMap;const Ut="BG";class kt extends xt.Scene{constructor(){super({key:"WipePostFxScene"})}preload(){this.load.image(Ut,"assets/images/bg.png")}create(){var nt;this.add.image(0,0,Ut).setOrigin(0),this.renderer.pipelines.addPostPipeline("WipePostFxPipeline",Nt),this.cameras.main.setPostPipeline(Nt),this.tweens.add({targets:this.cameras.main.getPostPipeline("WipePostFxPipeline"),progress:1,duration:2e3,delay:1e3}),(nt=this.input.keyboard)==null||nt.once("keydown-SPACE",()=>{this.scene.start("BuiltInFxScene")})}}const Xt="BG",zt="CHARACTERS";class qt extends xt.Scene{constructor(){super({key:"BuiltInFxScene"})}preload(){this.load.image(Xt,"assets/images/bg.png"),this.load.spritesheet(zt,"assets/images/custom.png",{frameWidth:64,frameHeight:88})}create(){var ut,mt;this.add.image(0,0,Xt).setOrigin(0),(ut=this.add.image(487,310,zt,7).preFX)==null||ut.addGradient(255,65280,0),(mt=this.input.keyboard)==null||mt.once("keydown-SPACE",()=>{this.scene.start("NothingPostFxScene")})}}const _t={type:xt.WEBGL,pixelArt:!0,scale:{parent:"game-container",width:1024,height:576,mode:xt.Scale.FIT,autoCenter:xt.Scale.CENTER_BOTH},backgroundColor:"#5c5b5b"},At=new xt.Game(_t);At.scene.add("NothingPostFxScene",Kt);At.scene.add("ColorPostFxScene",Jt);At.scene.add("GreyScalePostFxScene",$t);At.scene.add("WipePostFxScene",kt);At.scene.add("BuiltInFxScene",qt);At.scene.start("NothingPostFxScene"); +`;var Pt;class Ut extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(ht){super({game:ht,fragShader:_t});Lt(this,Pt,void 0);Ft(this,Pt,0)}get progress(){return Rt(this,Pt)}set progress(ht){Ft(this,Pt,ht)}onPreRender(){this.set1f("uCutoff",Rt(this,Pt))}}Pt=new WeakMap;const Xt="BG";class te extends xt.Scene{constructor(){super({key:"WipePostFxScene"})}preload(){this.load.image(Xt,"assets/images/bg.png")}create(){var st;this.add.image(0,0,Xt).setOrigin(0),this.renderer.pipelines.addPostPipeline("WipePostFxPipeline",Ut),this.cameras.main.setPostPipeline(Ut),this.tweens.add({targets:this.cameras.main.getPostPipeline("WipePostFxPipeline"),progress:1,duration:2e3,delay:1e3}),(st=this.input.keyboard)==null||st.once("keydown-SPACE",()=>{this.scene.start("BuiltInFxScene")})}}const zt="BG",Vt="CHARACTERS";class ee extends xt.Scene{constructor(){super({key:"BuiltInFxScene"})}preload(){this.load.image(zt,"assets/images/bg.png"),this.load.spritesheet(Vt,"assets/images/custom.png",{frameWidth:64,frameHeight:88})}create(){var ht,mt;this.add.image(0,0,zt).setOrigin(0),(ht=this.add.image(487,310,Vt,7).preFX)==null||ht.addGradient(255,65280,0),this.cameras.main.postFX.addGradient(16711680),(mt=this.input.keyboard)==null||mt.once("keydown-SPACE",()=>{this.scene.start("NothingPostFxScene")})}}const ie=` +#define SHADER_NAME NOTHING_POST_TINT + +#ifdef GL_ES +precision mediump float; +#endif + +varying vec2 outTexCoord; +uniform sampler2D uMainSampler; +uniform float uTest; + +void main() { + gl_FragColor = vec4(uTest, 0.4, 0.723, 1.0); +} +`;var At;class Yt extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(ht){super({game:ht,fragShader:ie});Lt(this,At,void 0);Ft(this,At,0)}get progress(){return Rt(this,At)}set progress(ht){Ft(this,At,ht)}onPreRender(){this.set1f("uTest",Rt(this,At))}}At=new WeakMap;const Wt="BG";class se extends xt.Scene{constructor(){super({key:"DynamicColorPostFxScene"})}preload(){this.load.image(Wt,"assets/images/bg.png")}create(){var st;this.add.image(0,0,Wt).setOrigin(0),this.renderer.pipelines.addPostPipeline("DynamicColorPostFxPipeline",Yt),this.cameras.main.setPostPipeline(Yt),this.tweens.add({targets:this.cameras.main.getPostPipeline("DynamicColorPostFxPipeline"),progress:1,duration:2e3,delay:1e3,repeat:-1,yoyo:!0}),(st=this.input.keyboard)==null||st.once("keydown-SPACE",()=>{this.scene.start("WipePostFxScene")})}}const ne={type:xt.WEBGL,pixelArt:!0,scale:{parent:"game-container",width:1024,height:576,mode:xt.Scale.FIT,autoCenter:xt.Scale.CENTER_BOTH},backgroundColor:"#5c5b5b"},Mt=new xt.Game(ne);Mt.scene.add("NothingPostFxScene",Qt);Mt.scene.add("ColorPostFxScene",jt);Mt.scene.add("GreyScalePostFxScene",qt);Mt.scene.add("DynamicColorPostFxScene",se);Mt.scene.add("WipePostFxScene",te);Mt.scene.add("BuiltInFxScene",ee);Mt.scene.start("NothingPostFxScene"); diff --git a/examples/shader-examples/index.html b/examples/shader-examples/index.html index b618ed2..5ce6acc 100644 --- a/examples/shader-examples/index.html +++ b/examples/shader-examples/index.html @@ -14,7 +14,7 @@ background: #d7d7d7; } - +