(function(t,e,i){function n(i,r){var s=e[i];if(!s){var o=t[i];if(!o)return;var a={};s=e[i]={exports:a},o[0]((function(t){return n(o[1][t]||t)}),s,a)}return s.exports}for(var r=0;r=0;i--)e.push(cc.v2(t[i].x,t[i].y));return e}function o(t){for(var e=[],i=0;i=this._duration},_cloneDecoration:function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},_reverseEaseList:function(t){if(this._easeList){t._easeList=[];for(var e=0;e1.192092896e-7?this._duration:1.192092896e-7);e=1>e?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},startWithTarget:function(t){cc.Action.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},reverse:function(){return cc.logID(1010),null},setAmplitudeRate:function(t){cc.logID(1011)},getAmplitudeRate:function(){return cc.logID(1012),0},speed:function(t){return t<=0?(cc.logID(1013),this):(this._speedMethod=!0,this._speed*=t,this)},getSpeed:function(){return this._speed},setSpeed:function(t){return this._speed=t,this},repeat:function(t){return t=Math.round(t),isNaN(t)||t<1?(cc.logID(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},repeatForever:function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this}}),cc.actionInterval=function(t){return new cc.ActionInterval(t)},cc.Sequence=cc.Class({name:"cc.Sequence",extends:cc.ActionInterval,ctor:function(t){this._actions=[],this._split=null,this._last=0,this._reversed=!1;var e=t instanceof Array?t:arguments;if(1!==e.length){var i=e.length-1;if(i>=0&&null==e[i]&&cc.logID(1015),i>=0){for(var n,r=e[0],s=1;s1?e%1:e),this._last=n)},reverse:function(){var t=cc.Sequence._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t}}),cc.sequence=function(t){var e=t instanceof Array?t:arguments;if(1===e.length)return cc.errorID(1019),null;var i=e.length-1;i>=0&&null==e[i]&&cc.logID(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=cc.Sequence._actionOneTwo(n,e[r]))}return n},cc.Sequence._actionOneTwo=function(t,e){var i=new cc.Sequence;return i.initWithTwoActions(t,e),i},cc.Repeat=cc.Class({name:"cc.Repeat",extends:cc.ActionInterval,ctor:function(t,e){this._times=0,this._total=0,this._nextDt=0,this._actionInstant=!1,this._innerAction=null,void 0!==e&&this.initWithAction(t,e)},initWithAction:function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof cc.ActionInstant&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},clone:function(){var t=new cc.Repeat;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},startWithTarget:function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,cc.ActionInterval.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},stop:function(){this._innerAction.stop(),cc.Action.prototype.stop.call(this)},update:function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total1?1:r;t>=1&&this._total=0&&null==e[i]&&cc.logID(1015),i>=0){for(var n,r=e[0],s=1;sr?this._two=cc.Sequence._actionOneTwo(e,cc.delayTime(n-r)):n0&&null==e[e.length-1]&&cc.logID(1015);for(var i=e[0],n=1;n180&&(i-=360),i<-180&&(i+=360),this._startAngle=e,this._angle=cc.macro.ROTATE_ACTION_CCW?i:-i},reverse:function(){cc.logID(1016)},update:function(t){t=this._computeEaseTime(t),this.target&&(this.target.angle=this._startAngle+this._angle*t)}}),cc.rotateTo=function(t,e){return new cc.RotateTo(t,e)},cc.RotateBy=cc.Class({name:"cc.RotateBy",extends:cc.ActionInterval,ctor:function(t,e){e*=cc.macro.ROTATE_ACTION_CCW?1:-1,this._deltaAngle=0,this._startAngle=0,void 0!==e&&this.initWithDuration(t,e)},initWithDuration:function(t,e){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._deltaAngle=e,!0)},clone:function(){var t=new cc.RotateBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._deltaAngle),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._startAngle=t.angle},update:function(t){t=this._computeEaseTime(t),this.target&&(this.target.angle=this._startAngle+this._deltaAngle*t)},reverse:function(){var t=new cc.RotateBy(this._duration,-this._deltaAngle);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.rotateBy=function(t,e){return new cc.RotateBy(t,e)},cc.MoveBy=cc.Class({name:"cc.MoveBy",extends:cc.ActionInterval,ctor:function(t,e,i){this._positionDelta=cc.v2(0,0),this._startPosition=cc.v2(0,0),this._previousPosition=cc.v2(0,0),void 0!==e&&cc.MoveBy.prototype.initWithDuration.call(this,t,e,i)},initWithDuration:function(t,e,i){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(void 0!==e.x&&(i=e.y,e=e.x),this._positionDelta.x=e,this._positionDelta.y=i,!0)},clone:function(){var t=new cc.MoveBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._positionDelta),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t);var e=t.x,i=t.y;this._previousPosition.x=e,this._previousPosition.y=i,this._startPosition.x=e,this._startPosition.y=i},update:function(t){if(t=this._computeEaseTime(t),this.target){var e=this._positionDelta.x*t,i=this._positionDelta.y*t,n=this._startPosition;if(cc.macro.ENABLE_STACKABLE_ACTIONS){var r=this.target.x,s=this.target.y,o=this._previousPosition;n.x=n.x+r-o.x,n.y=n.y+s-o.y,e+=n.x,i+=n.y,o.x=e,o.y=i,this.target.setPosition(e,i)}else this.target.setPosition(n.x+e,n.y+i)}},reverse:function(){var t=new cc.MoveBy(this._duration,cc.v2(-this._positionDelta.x,-this._positionDelta.y));return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.moveBy=function(t,e,i){return new cc.MoveBy(t,e,i)},cc.MoveTo=cc.Class({name:"cc.MoveTo",extends:cc.MoveBy,ctor:function(t,e,i){this._endPosition=cc.v2(0,0),void 0!==e&&this.initWithDuration(t,e,i)},initWithDuration:function(t,e,i){return!!cc.MoveBy.prototype.initWithDuration.call(this,t,e,i)&&(void 0!==e.x&&(i=e.y,e=e.x),this._endPosition.x=e,this._endPosition.y=i,!0)},clone:function(){var t=new cc.MoveTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._endPosition),t},startWithTarget:function(t){cc.MoveBy.prototype.startWithTarget.call(this,t),this._positionDelta.x=this._endPosition.x-t.x,this._positionDelta.y=this._endPosition.y-t.y}}),cc.moveTo=function(t,e,i){return new cc.MoveTo(t,e,i)},cc.SkewTo=cc.Class({name:"cc.SkewTo",extends:cc.ActionInterval,ctor:function(t,e,i){this._skewX=0,this._skewY=0,this._startSkewX=0,this._startSkewY=0,this._endSkewX=0,this._endSkewY=0,this._deltaX=0,this._deltaY=0,void 0!==i&&cc.SkewTo.prototype.initWithDuration.call(this,t,e,i)},initWithDuration:function(t,e,i){var n=!1;return cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._endSkewX=e,this._endSkewY=i,n=!0),n},clone:function(){var t=new cc.SkewTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._endSkewX,this._endSkewY),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._startSkewX=t.skewX%180,this._deltaX=this._endSkewX-this._startSkewX,this._deltaX>180&&(this._deltaX-=360),this._deltaX<-180&&(this._deltaX+=360),this._startSkewY=t.skewY%360,this._deltaY=this._endSkewY-this._startSkewY,this._deltaY>180&&(this._deltaY-=360),this._deltaY<-180&&(this._deltaY+=360)},update:function(t){t=this._computeEaseTime(t),this.target.skewX=this._startSkewX+this._deltaX*t,this.target.skewY=this._startSkewY+this._deltaY*t}}),cc.skewTo=function(t,e,i){return new cc.SkewTo(t,e,i)},cc.SkewBy=cc.Class({name:"cc.SkewBy",extends:cc.SkewTo,ctor:function(t,e,i){void 0!==i&&this.initWithDuration(t,e,i)},initWithDuration:function(t,e,i){var n=!1;return cc.SkewTo.prototype.initWithDuration.call(this,t,e,i)&&(this._skewX=e,this._skewY=i,n=!0),n},clone:function(){var t=new cc.SkewBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._skewX,this._skewY),t},startWithTarget:function(t){cc.SkewTo.prototype.startWithTarget.call(this,t),this._deltaX=this._skewX,this._deltaY=this._skewY,this._endSkewX=this._startSkewX+this._deltaX,this._endSkewY=this._startSkewY+this._deltaY},reverse:function(){var t=new cc.SkewBy(this._duration,-this._skewX,-this._skewY);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.skewBy=function(t,e,i){return new cc.SkewBy(t,e,i)},cc.JumpBy=cc.Class({name:"cc.JumpBy",extends:cc.ActionInterval,ctor:function(t,e,i,n,r){this._startPosition=cc.v2(0,0),this._previousPosition=cc.v2(0,0),this._delta=cc.v2(0,0),this._height=0,this._jumps=0,void 0!==n&&cc.JumpBy.prototype.initWithDuration.call(this,t,e,i,n,r)},initWithDuration:function(t,e,i,n,r){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(void 0===r&&(r=n,n=i,i=e.y,e=e.x),this._delta.x=e,this._delta.y=i,this._height=n,this._jumps=r,!0)},clone:function(){var t=new cc.JumpBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._delta,this._height,this._jumps),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t);var e=t.x,i=t.y;this._previousPosition.x=e,this._previousPosition.y=i,this._startPosition.x=e,this._startPosition.y=i},update:function(t){if(t=this._computeEaseTime(t),this.target){var e=t*this._jumps%1,i=4*this._height*e*(1-e);i+=this._delta.y*t;var n=this._delta.x*t,r=this._startPosition;if(cc.macro.ENABLE_STACKABLE_ACTIONS){var s=this.target.x,o=this.target.y,a=this._previousPosition;r.x=r.x+s-a.x,r.y=r.y+o-a.y,n+=r.x,i+=r.y,a.x=n,a.y=i,this.target.setPosition(n,i)}else this.target.setPosition(r.x+n,r.y+i)}},reverse:function(){var t=new cc.JumpBy(this._duration,cc.v2(-this._delta.x,-this._delta.y),this._height,this._jumps);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.jumpBy=function(t,e,i,n,r){return new cc.JumpBy(t,e,i,n,r)},cc.JumpTo=cc.Class({name:"cc.JumpTo",extends:cc.JumpBy,ctor:function(t,e,i,n,r){this._endPosition=cc.v2(0,0),void 0!==n&&this.initWithDuration(t,e,i,n,r)},initWithDuration:function(t,e,i,n,r){return!!cc.JumpBy.prototype.initWithDuration.call(this,t,e,i,n,r)&&(void 0===r&&(i=e.y,e=e.x),this._endPosition.x=e,this._endPosition.y=i,!0)},startWithTarget:function(t){cc.JumpBy.prototype.startWithTarget.call(this,t),this._delta.x=this._endPosition.x-this._startPosition.x,this._delta.y=this._endPosition.y-this._startPosition.y},clone:function(){var t=new cc.JumpTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._endPosition,this._height,this._jumps),t}}),cc.jumpTo=function(t,e,i,n,r){return new cc.JumpTo(t,e,i,n,r)},cc.BezierBy=cc.Class({name:"cc.BezierBy",extends:cc.ActionInterval,ctor:function(t,e){this._config=[],this._startPosition=cc.v2(0,0),this._previousPosition=cc.v2(0,0),e&&cc.BezierBy.prototype.initWithDuration.call(this,t,e)},initWithDuration:function(t,e){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._config=e,!0)},clone:function(){var t=new cc.BezierBy;this._cloneDecoration(t);for(var e=[],i=0;ie/2?255:0}},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._originalState=t.opacity},stop:function(){this.target.opacity=this._originalState,cc.ActionInterval.prototype.stop.call(this)},reverse:function(){var t=new cc.Blink(this._duration,this._times);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.blink=function(t,e){return new cc.Blink(t,e)},cc.FadeTo=cc.Class({name:"cc.FadeTo",extends:cc.ActionInterval,ctor:function(t,e){this._toOpacity=0,this._fromOpacity=0,void 0!==e&&cc.FadeTo.prototype.initWithDuration.call(this,t,e)},initWithDuration:function(t,e){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._toOpacity=e,!0)},clone:function(){var t=new cc.FadeTo;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._toOpacity),t},update:function(t){t=this._computeEaseTime(t);var e=void 0!==this._fromOpacity?this._fromOpacity:255;this.target.opacity=e+(this._toOpacity-e)*t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._fromOpacity=t.opacity}}),cc.fadeTo=function(t,e){return new cc.FadeTo(t,e)},cc.FadeIn=cc.Class({name:"cc.FadeIn",extends:cc.FadeTo,ctor:function(t){null==t&&(t=0),this._reverseAction=null,this.initWithDuration(t,255)},reverse:function(){var t=new cc.FadeOut;return t.initWithDuration(this._duration,0),this._cloneDecoration(t),this._reverseEaseList(t),t},clone:function(){var t=new cc.FadeIn;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._toOpacity),t},startWithTarget:function(t){this._reverseAction&&(this._toOpacity=this._reverseAction._fromOpacity),cc.FadeTo.prototype.startWithTarget.call(this,t)}}),cc.fadeIn=function(t){return new cc.FadeIn(t)},cc.FadeOut=cc.Class({name:"cc.FadeOut",extends:cc.FadeTo,ctor:function(t){null==t&&(t=0),this._reverseAction=null,this.initWithDuration(t,0)},reverse:function(){var t=new cc.FadeIn;return t._reverseAction=this,t.initWithDuration(this._duration,255),this._cloneDecoration(t),this._reverseEaseList(t),t},clone:function(){var t=new cc.FadeOut;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._toOpacity),t}}),cc.fadeOut=function(t){return new cc.FadeOut(t)},cc.TintTo=cc.Class({name:"cc.TintTo",extends:cc.ActionInterval,ctor:function(t,e,i,n){this._to=cc.color(0,0,0),this._from=cc.color(0,0,0),e instanceof cc.Color&&(n=e.b,i=e.g,e=e.r),void 0!==n&&this.initWithDuration(t,e,i,n)},initWithDuration:function(t,e,i,n){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._to=cc.color(e,i,n),!0)},clone:function(){var t=new cc.TintTo;this._cloneDecoration(t);var e=this._to;return t.initWithDuration(this._duration,e.r,e.g,e.b),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._from=this.target.color},update:function(t){t=this._computeEaseTime(t);var e=this._from,i=this._to;e&&(this.target.color=cc.color(e.r+(i.r-e.r)*t,e.g+(i.g-e.g)*t,e.b+(i.b-e.b)*t))}}),cc.tintTo=function(t,e,i,n){return new cc.TintTo(t,e,i,n)},cc.TintBy=cc.Class({name:"cc.TintBy",extends:cc.ActionInterval,ctor:function(t,e,i,n){this._deltaR=0,this._deltaG=0,this._deltaB=0,this._fromR=0,this._fromG=0,this._fromB=0,void 0!==n&&this.initWithDuration(t,e,i,n)},initWithDuration:function(t,e,i,n){return!!cc.ActionInterval.prototype.initWithDuration.call(this,t)&&(this._deltaR=e,this._deltaG=i,this._deltaB=n,!0)},clone:function(){var t=new cc.TintBy;return this._cloneDecoration(t),t.initWithDuration(this._duration,this._deltaR,this._deltaG,this._deltaB),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t);var e=t.color;this._fromR=e.r,this._fromG=e.g,this._fromB=e.b},update:function(t){t=this._computeEaseTime(t),this.target.color=cc.color(this._fromR+this._deltaR*t,this._fromG+this._deltaG*t,this._fromB+this._deltaB*t)},reverse:function(){var t=new cc.TintBy(this._duration,-this._deltaR,-this._deltaG,-this._deltaB);return this._cloneDecoration(t),this._reverseEaseList(t),t}}),cc.tintBy=function(t,e,i,n){return new cc.TintBy(t,e,i,n)},cc.DelayTime=cc.Class({name:"cc.DelayTime",extends:cc.ActionInterval,update:function(t){},reverse:function(){var t=new cc.DelayTime(this._duration);return this._cloneDecoration(t),this._reverseEaseList(t),t},clone:function(){var t=new cc.DelayTime;return this._cloneDecoration(t),t.initWithDuration(this._duration),t}}),cc.delayTime=function(t){return new cc.DelayTime(t)},cc.ReverseTime=cc.Class({name:"cc.ReverseTime",extends:cc.ActionInterval,ctor:function(t){this._other=null,t&&this.initWithAction(t)},initWithAction:function(t){return t?t===this._other?(cc.errorID(1029),!1):!!cc.ActionInterval.prototype.initWithDuration.call(this,t._duration)&&(this._other=t,!0):(cc.errorID(1028),!1)},clone:function(){var t=new cc.ReverseTime;return this._cloneDecoration(t),t.initWithAction(this._other.clone()),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._other.startWithTarget(t)},update:function(t){t=this._computeEaseTime(t),this._other&&this._other.update(1-t)},reverse:function(){return this._other.clone()},stop:function(){this._other.stop(),cc.Action.prototype.stop.call(this)}}),cc.reverseTime=function(t){return new cc.ReverseTime(t)},cc.TargetedAction=cc.Class({name:"cc.TargetedAction",extends:cc.ActionInterval,ctor:function(t,e){this._action=null,this._forcedTarget=null,e&&this.initWithTarget(t,e)},initWithTarget:function(t,e){return!!this.initWithDuration(e._duration)&&(this._forcedTarget=t,this._action=e,!0)},clone:function(){var t=new cc.TargetedAction;return this._cloneDecoration(t),t.initWithTarget(this._forcedTarget,this._action.clone()),t},startWithTarget:function(t){cc.ActionInterval.prototype.startWithTarget.call(this,t),this._action.startWithTarget(this._forcedTarget)},stop:function(){this._action.stop()},update:function(t){t=this._computeEaseTime(t),this._action.update(t)},getForcedTarget:function(){return this._forcedTarget},setForcedTarget:function(t){this._forcedTarget!==t&&(this._forcedTarget=t)}}),cc.targetedAction=function(t,e){return new cc.TargetedAction(t,e)}}),{}],6:[(function(t,e,i){"use strict";t("../core/platform/CCClass");var n=t("../core/platform/js"),r=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1};cc.ActionManager=function(){this._hashTargets=n.createMap(!0),this._arrayTargets=[],this._currentTarget=null,cc.director._scheduler&&cc.director._scheduler.enableForTarget(this)},cc.ActionManager.prototype={constructor:cc.ActionManager,_elementPool:[],_searchElementByTarget:function(t,e){for(var i=0;i=n&&i.actionIndex--;break}}else cc.logID(1001)}},removeActionByTag:function(t,e){t===cc.Action.TAG_INVALID&&cc.logID(1002),cc.assertID(e,1003);var i=this._hashTargets[e._id];if(i)for(var n=i.actions.length,r=0;r=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},_deleteHashElement:function(t){var e=!1;if(t&&!t.lock&&this._hashTargets[t.target._id]){delete this._hashTargets[t.target._id];for(var i=this._arrayTargets,n=0,r=i.length;n=0?d=s.events[p]:(d=new a,s.ratios.push(f),s.events.push(d)),d.add(_.func,_.params)}}u.playState=function(t,e){t.clip&&(t.curveLoaded||_(this.target,t),t.animator=this,t.play(),"number"==typeof e&&t.setTime(e),this.play())},u.stopStatesExcept=function(t){var e=this._anims,i=e.array;for(e.i=0;e.i=0?(this._anims.fastRemoveAt(e),0===this._anims.array.length&&this.stop()):cc.errorID(3908),t.animator=null},u.sample=function(){var t=this._anims,e=t.array;for(t.i=0;t.i1e-6){g=!1;break}l._findFrameIndex=g?o:c;var A=l.values[0];return void 0===A||null===A||l._lerp||("number"==typeof A?l._lerp=s.prototype._lerpNumber:A instanceof cc.Quat?l._lerp=s.prototype._lerpQuat:A instanceof cc.Vec2||A instanceof cc.Vec3?l._lerp=s.prototype._lerpVector:A.lerp&&(l._lerp=s.prototype._lerpObject)),l},createTargetCurves:function(t,e,i){var n=e.props,r=e.comps;if(n)for(var s in n){var o=n[s],a=this.createPropCurve(t,s,o);i.push(a)}if(r)for(var c in r){var l=t.getComponent(c);if(l){var h=r[c];for(var u in h){var _=h[u],f=this.createPropCurve(l,u,_);i.push(f)}}}},createCurves:function(t,e){var i=this.curveData,n=i.paths,r=[];for(var s in this.createTargetCurves(e,i,r),n){var o=cc.find(s,e);if(o){var a=n[s];this.createTargetCurves(o,a,r)}}return r}});cc.AnimationClip=e.exports=l}),{"../core/utils/binary-search":243,"./animation-curves":11,"./motion-path-helper":17,"./types":19}],11:[(function(t,e,i){"use strict";var n=t("./bezier").bezierByTime,r=t("../core/utils/binary-search").binarySearchEpsilon,s=t("./types").WrapModeMask,o=t("./types").WrappedInfo;function a(t,e){if("string"==typeof e){var i=cc.easing[e];i?t=i(t):cc.errorID(3906,e)}else Array.isArray(e)&&(t=n(e,t));return t}var c=cc.Class({name:"cc.AnimCurve",sample:function(t,e,i){},onTimeChangedManually:void 0});function l(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return~t.length;var s=(e=(e-n)/(r-n))/(1/i),o=0|s;return s-o<1e-6?o:o+1-s<1e-6?o+1:~(o+1)}var h=cc.Class({name:"cc.DynamicAnimCurve",extends:c,ctor:function(){this._cachedIndex=0},properties:{target:null,prop:"",values:[],ratios:[],types:[]},_findFrameIndex:r,_lerp:void 0,_lerpNumber:function(t,e,i){return t+(e-t)*i},_lerpObject:function(t,e,i){return t.lerp(e,i)},_lerpQuat:(function(){var t=cc.quat();return function(e,i,n){return e.lerp(i,n,t)}})(),_lerpVector:(function(){var t=cc.v3();return function(e,i,n){return e.lerp(i,n,t)}})(),sample:function(t,e,i){var n=this.values,r=this.ratios,s=r.length;if(0!==s){var o=!0,c=this._cachedIndex;if(c<0&&(c=~c)>0&&cl&&e=s)u=n[s-1];else{var f=n[_-1];if(this._lerp){var d=r[_-1],p=r[_],m=this.types[_-1],y=(e-d)/(p-d);m&&(y=a(y,m));var v=n[_];u=this._lerp(f,v,y)}else u=f}else u=n[_];this.target[this.prop]=u}}});h.Linear=null,h.Bezier=function(t){return t};var u=function(){this.events=[]};u.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})};var _=cc.Class({name:"cc.EventAnimCurve",extends:c,properties:{target:null,ratios:[],events:[],_wrappedInfo:{default:function(){return new o}},_lastWrappedInfo:null,_ignoreIndex:NaN},_wrapIterations:function(t){return t-(0|t)==0&&(t-=1),0|t},sample:function(t,e,i){var n=this.ratios.length,a=i.getWrappedInfo(i.time,this._wrappedInfo),c=a.direction,l=r(this.ratios,a.ratio);if(l<0&&(l=~l-1,c<0&&(l+=1)),this._ignoreIndex!==l&&(this._ignoreIndex=NaN),a.frameIndex=l,!this._lastWrappedInfo)return this._fireEvent(l),void(this._lastWrappedInfo=new o(a));var h=i.wrapMode,u=this._wrapIterations(a.iterations),_=this._lastWrappedInfo,f=this._wrapIterations(_.iterations),d=_.frameIndex,p=_.direction,m=-1!==f&&u!==f;if(d===l&&m&&1===n)this._fireEvent(0);else if(d!==l||m){c=p;do{if(d!==l){if(-1===c&&0===d&&l>0?((h&s.PingPong)===s.PingPong?c*=-1:d=n,f++):1===c&&d===n-1&&lu)break}d+=c,cc.director.getAnimationManager().pushDelayEvent(this,"_fireEvent",[d])}while(d!==l&&d>-1&&d=this.events.length||this._ignoreIndex===t)){var e=this.events[t].events;if(this.target.isValid)for(var i=this.target._components,n=0;n=0?this._anims.fastRemoveAt(e):cc.errorID(3907)},pushDelayEvent:function(t,e,i){this._delayEvents.push({target:t,func:e,args:i})}});cc.AnimationManager=e.exports=r}),{}],13:[(function(t,e,i){"use strict";var n=cc.js,r=t("./playable"),s=t("./types"),o=s.WrappedInfo,a=s.WrapMode,c=s.WrapModeMask;function l(t,e){r.call(this),this._currentFramePlayed=!1,this._delay=0,this._delayTime=0,this._wrappedInfo=new o,this._lastWrappedInfo=null,this._process=u,this._clip=t,this._name=e||t&&t.name,this.animator=null,this.curves=[],this.delay=0,this.repeatCount=1,this.duration=1,this.speed=1,this.wrapMode=a.Normal,this.time=0,this._target=null,this._lastframeEventOn=!1,this.emit=function(){for(var t=new Array(arguments.length),e=0,i=t.length;e1&&(0|e.iterations)>(0|t.iterations)&&this.emit("lastframe",this),t.set(e));e.stopped&&(this.stop(),this.emit("finished",this))}function _(){var t=this.time,e=this.duration;t>e?0===(t%=e)&&(t=e):t<0&&0!==(t%=e)&&(t+=e);for(var i=t/e,n=this.curves,r=0,s=n.length;r0&&this._lastIterations>i||this.time<0&&this._lastIterations0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this.speed:this._currentFramePlayed=!0,this._process())},h._needRevers=function(t){var e=this.wrapMode,i=!1;(e&c.PingPong)===c.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i));return(e&c.Reverse)===c.Reverse&&(i=!i),i},h.getWrappedInfo=function(t,e){e=e||new o;var i=!1,n=this.duration,r=this.repeatCount,s=t>0?t/n:-t/n;if(s>=r){s=r,i=!0;var a=r-(0|r);0===a&&(a=1),t=a*n*(t>0?1:-1)}if(t>n){var l=t%n;t=0===l?n:l}else t<0&&0!==(t%=n)&&(t+=n);var h=!1,u=this._wrapMode&c.ShouldWrap;u&&(h=this._needRevers(s));var _=h?-1:1;return this.speed<0&&(_*=-1),u&&h&&(t=n-t),e.ratio=t/n,e.time=t,e.direction=_,e.stopped=i,e.iterations=s,e},h.sample=function(){for(var t=this.getWrappedInfo(this.time,this._wrappedInfo),e=this.curves,i=0,n=e.length;i0}),(function(){this.curves.length=0})),n.getset(h,"wrapMode",(function(){return this._wrapMode}),(function(t){this._wrapMode=t,this.time=0,t&c.Loop?this.repeatCount=1/0:this.repeatCount=1})),n.getset(h,"repeatCount",(function(){return this._repeatCount}),(function(t){this._repeatCount=t;var e=this._wrapMode&c.ShouldWrap,i=(this.wrapMode&c.Reverse)===c.Reverse;this._process=t!==1/0||e||i?u:_})),n.getset(h,"delay",(function(){return this._delay}),(function(t){this._delayTime=this._delay=t})),cc.AnimationState=e.exports=l}),{"./playable":18,"./types":19}],14:[(function(t,e,i){"use strict";function n(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}var r=Math.cos,s=Math.acos,o=Math.max,a=2*Math.PI,c=Math.sqrt;function l(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function h(t,e){var i,n,h,u,_=e-0,f=e-t[0],d=3*_,p=3*f,m=3*(e-t[2]),y=1/(-_+p-m+(e-1)),v=(d-6*f+m)*y,g=v*(1/3),x=(-d+p)*y,C=1/3*(3*x-v*v),A=C*(1/3),b=(2*v*v*v-9*v*x+27*(_*y))/27,S=b/2,T=S*S+A*A*A;if(T<0){var w=1/3*-C,E=c(w*w*w),B=-b/(2*E),M=s(B<-1?-1:B>1?1:B),I=2*l(E);return n=I*r(M*(1/3))-g,h=I*r((M+a)*(1/3))-g,u=I*r((M+2*a)*(1/3))-g,0<=n&&n<=1?0<=h&&h<=1?0<=u&&u<=1?o(n,h,u):o(n,h):0<=u&&u<=1?o(n,u):n:0<=h&&h<=1?0<=u&&u<=1?o(h,u):h:u}if(0===T)return h=-(i=S<0?l(-S):-l(S))-g,0<=(n=2*i-g)&&n<=1?0<=h&&h<=1?o(n,h):n:h;var R=c(T);return n=(i=l(-S+R))-l(S+R)-g}function u(t,e){var i=h(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}e.exports={bezier:n,bezierByTime:u}}),{}],15:[(function(t,e,i){"use strict";var n={constant:function(){return 0},linear:function(t){return t},quadIn:function(t){return t*t},quadOut:function(t){return t*(2-t)},quadInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quartIn:function(t){return t*t*t*t},quartOut:function(t){return 1- --t*t*t*t},quartInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quintIn:function(t){return t*t*t*t*t},quintOut:function(t){return--t*t*t*t*t+1},quintInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sineIn:function(t){return 1-Math.cos(t*Math.PI/2)},sineOut:function(t){return Math.sin(t*Math.PI/2)},sineInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},expoIn:function(t){return 0===t?0:Math.pow(1024,t-1)},expoOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},expoInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circIn:function(t){return 1-Math.sqrt(1-t*t)},circOut:function(t){return Math.sqrt(1- --t*t)},circInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-n.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*n.bounceIn(2*t):.5*n.bounceOut(2*t-1)+.5},smooth:function(t){return t<=0?0:t>=1?1:t*t*(3-2*t)},fade:function(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}};function r(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}n.quadOutIn=r(n.quadIn,n.quadOut),n.cubicOutIn=r(n.cubicIn,n.cubicOut),n.quartOutIn=r(n.quartIn,n.quartOut),n.quintOutIn=r(n.quintIn,n.quintOut),n.sineOutIn=r(n.sineIn,n.sineOut),n.expoOutIn=r(n.expoIn,n.expoOut),n.circOutIn=r(n.circIn,n.circOut),n.backOutIn=r(n.backIn,n.backOut),n.bounceIn=function(t){return 1-n.bounceOut(1-t)},n.bounceInOut=function(t){return t<.5?.5*n.bounceIn(2*t):.5*n.bounceOut(2*t-1)+.5},n.bounceOutIn=r(n.bounceIn,n.bounceOut),cc.easing=e.exports=n}),{}],16:[(function(t,e,i){"use strict";t("./bezier"),t("./easing"),t("./types"),t("./motion-path-helper"),t("./animation-curves"),t("./animation-clip"),t("./animation-manager"),t("./animation-state"),t("./animation-animator")}),{"./animation-animator":9,"./animation-clip":10,"./animation-curves":11,"./animation-manager":12,"./animation-state":13,"./bezier":14,"./easing":15,"./motion-path-helper":17,"./types":19}],17:[(function(t,e,i){"use strict";var n=t("./animation-curves").DynamicAnimCurve,r=t("./animation-curves").computeRatioByType,s=t("./bezier").bezier,o=t("../core/utils/binary-search").binarySearchEpsilon,a=cc.v2;function c(t){this.points=t||[],this.beziers=[],this.ratios=[],this.progresses=[],this.length=0,this.computeBeziers()}function l(){this.start=a(),this.end=a(),this.startCtrlPoint=a(),this.endCtrlPoint=a()}function h(t){if(!Array.isArray(t))return!1;for(var e=0,i=t.length;e0){f=!0;break}}if(f&&1!==_.length){for(var m=e.types,y=e.ratios,v=e.values=[],g=e.types=[],x=e.ratios=[],C=0,A=n.Linear,b=0,S=t.length;b0){var O=[];O.push(u(M));for(var V=0,F=w.length;V1e-6;){var z,U,W,j;if((T=r(T=D,R))<0)j=(0-T)*(U=G.beziers[0]).getLength(),W=U.start.sub(U.endCtrlPoint).normalize(),z=U.start.add(W.mul(j));else if(T>1)j=(T-1)*(U=G.beziers[G.beziers.length-1]).getLength(),W=U.end.sub(U.startCtrlPoint).normalize(),z=U.end.add(W.mul(j));else{var H=o(k,T);H<0&&(H=~H),T-=H>0?k[H-1]:0,T/=G.ratios[H],z=G.beziers[H].getPointAt(T)}P.push(z),D+=L}}else for(;1-D>1e-6;)T=r(T=D,R),P.push(M.lerp(I,T)),D+=L;A="constant"===R?R:n.Linear;for(V=0,F=P.length;V1e-6?(D-1)*B:0}y[y.length-1]!==x[x.length-1]&&X(_[_.length-1],A,y[y.length-1])}}function X(t,e,i){v.push(t),g.push(e),x.push(i)}}c.prototype.computeBeziers=function(){var t;this.beziers.length=0,this.ratios.length=0,this.progresses.length=0,this.length=0;for(var e=1;e0)){c=r;break}c=r-1}if(n[r=c]===i)return r/(s-1);var l=n[r];return(r+(i-l)/(n[r+1]-l))/(s-1)},e.exports={sampleMotionPaths:u,Curve:c,Bezier:l}}),{"../core/utils/binary-search":243,"./animation-curves":11,"./bezier":14}],18:[(function(t,e,i){"use strict";var n=cc.js,r=t("../core/CCDebug");function s(){this._isPlaying=!1,this._isPaused=!1,this._stepOnce=!1}var o=s.prototype;n.get(o,"isPlaying",(function(){return this._isPlaying}),!0),n.get(o,"isPaused",(function(){return this._isPaused}),!0);var a=function(){};o.onPlay=a,o.onPause=a,o.onResume=a,o.onStop=a,o.onError=a,o.play=function(){this._isPlaying?this._isPaused?(this._isPaused=!1,this.onResume()):this.onError(r.getError(3912)):(this._isPlaying=!0,this.onPlay())},o.stop=function(){this._isPlaying&&(this._isPlaying=!1,this.onStop(),this._isPaused=!1)},o.pause=function(){this._isPlaying&&!this._isPaused&&(this._isPaused=!0,this.onPause())},o.resume=function(){this._isPlaying&&this._isPaused&&(this._isPaused=!1,this.onResume())},o.step=function(){this.pause(),this._stepOnce=!0,this._isPlaying||this.play()},e.exports=s}),{"../core/CCDebug":27}],19:[(function(t,e,i){"use strict";var n={Loop:2,ShouldWrap:4,PingPong:22,Reverse:36},r=cc.Enum({Default:0,Normal:1,Reverse:n.Reverse,Loop:n.Loop,LoopReverse:n.Loop|n.Reverse,PingPong:n.PingPong,PingPongReverse:n.PingPong|n.Reverse});function s(t){t?this.set(t):(this.ratio=0,this.time=0,this.direction=1,this.stopped=!0,this.iterations=0,this.frameIndex=void 0)}cc.WrapMode=r,s.prototype.set=function(t){this.ratio=t.ratio,this.time=t.time,this.direction=t.direction,this.stopped=t.stopped,this.iterations=t.iterations,this.frameIndex=t.frameIndex},e.exports={WrapModeMask:n,WrapMode:r,WrappedInfo:s}}),{}],20:[(function(t,e,i){"use strict";var n=t("../core/event/event-target"),r=t("../core/platform/CCSys"),s=t("../core/assets/CCAudioClip").LoadMode,o=!1,a=[],c=function t(e){n.call(this),this._src=e,this._element=null,this.id=0,this._volume=1,this._loop=!1,this._nextTime=0,this._state=t.State.INITIALZING,this._onended=function(){this._state=t.State.STOPPED,this.emit("ended")}.bind(this)};cc.js.extend(c,n),c.State={ERROR:-1,INITIALZING:0,PLAYING:1,PAUSED:2,STOPPED:3},(function(t){t._bindEnded=function(t){t=t||this._onended;var e=this._element;this._src&&e instanceof HTMLAudioElement?e.addEventListener("ended",t):e.onended=t},t._unbindEnded=function(){var t=this._element;t instanceof HTMLAudioElement?t.removeEventListener("ended",this._onended):t&&(t.onended=null)},t._onLoaded=function(){this._createElement(),this.setVolume(this._volume),this.setLoop(this._loop),0!==this._nextTime&&this.setCurrentTime(this._nextTime),this.getState()===c.State.PLAYING?this.play():this._state=c.State.INITIALZING},t._createElement=function(){var t=this._src._nativeAsset;t instanceof HTMLAudioElement?(this._element||(this._element=document.createElement("audio")),this._element.src=t.src):this._element=new h(t,this)},t.play=function(){this._state=c.State.PLAYING,this._element&&(this._bindEnded(),this._element.play(),this._touchToPlay())},t._touchToPlay=function(){if(this._src&&this._src.loadMode===s.DOM_AUDIO&&this._element.paused&&a.push({instance:this,offset:0,audio:this._element}),!o){o=!0;var t="ontouchend"in window?"touchend":"mousedown";cc.game.canvas.addEventListener(t,(function(){for(var t=void 0;t=a.pop();)t.audio.play(t.offset)}))}},t.destroy=function(){this._element=null},t.pause=function(){this._element&&this.getState()===c.State.PLAYING&&(this._unbindEnded(),this._element.pause(),this._state=c.State.PAUSED)},t.resume=function(){this._element&&this.getState()===c.State.PAUSED&&(this._bindEnded(),this._element.play(),this._state=c.State.PLAYING)},t.stop=function(){if(this._element){this._element.pause();try{this._element.currentTime=0}catch(t){}for(var t=0;tthis._buffer.duration)},enumerable:!0,configurable:!0}),Object.defineProperty(t,"loop",{get:function(){return this._loop},set:function(t){return this._currentSource&&(this._currentSource.loop=t),this._loop=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"volume",{get:function(){return this._volume},set:function(t){if(this._volume=t,this._gainObj.gain.setTargetAtTime)try{this._gainObj.gain.setTargetAtTime(t,this._context.currentTime,l)}catch(e){this._gainObj.gain.setTargetAtTime(t,this._context.currentTime,.01)}else this._gainObj.gain.value=t;r.os===r.OS_IOS&&!this.paused&&this._currentSource&&(this._currentSource.onended=null,this.pause(),this.play())},enumerable:!0,configurable:!0}),Object.defineProperty(t,"currentTime",{get:function(){return this.paused?this.playedLength:(this.playedLength=this._context.currentTime-this._startTime,this.playedLength%=this._buffer.duration,this.playedLength)},set:function(t){return this.paused?this.playedLength=t:(this.pause(),this.playedLength=t,this.play()),t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"duration",{get:function(){return this._buffer.duration},enumerable:!0,configurable:!0})})(h.prototype),e.exports=cc.Audio=c}),{"../core/assets/CCAudioClip":35,"../core/event/event-target":98,"../core/platform/CCSys":169}],21:[(function(t,e,i){"use strict";var n=t("./CCAudio"),r=t("../core/assets/CCAudioClip"),s=cc.js,o=0,a=s.createMap(!0),c={},l=[],h=function(t){t._finishCallback=null,t.off("ended"),t.off("stop"),t.src=null,l.includes(t)||(l.length<32?l.push(t):t.destroy())},u=function(t){var e=o++,i=c[t];if(i||(i=c[t]=[]),d._maxAudioInstance<=i.length){var r=i.shift();_(r).stop()}var s=l.pop()||new n,u=function(){if(_(this.id)){delete a[this.id];var t=i.indexOf(this.id);cc.js.array.fastRemoveAt(i,t)}h(this)};return s.on("ended",(function(){this._finishCallback&&this._finishCallback(),u.call(this)}),s),s.on("stop",u,s),s.id=e,a[e]=s,i.push(e),s},_=function(t){return a[t]},f=function(t){return void 0===t?t=1:"string"==typeof t&&(t=Number.parseFloat(t)),t},d={AudioState:n.State,_maxWebAudioSize:2097152,_maxAudioInstance:24,_id2audio:a,play:function(t,e,i){var n,s=t;if("string"==typeof t)cc.warnID(8401,"cc.audioEngine","cc.AudioClip","AudioClip","cc.AudioClip","audio"),n=u(s=t),r._loadByUrl(s,(function(t,e){e&&(n.src=e)}));else{if(!t)return;s=t.nativeUrl,(n=u(s)).src=t}return n.setLoop(e||!1),i=f(i),n.setVolume(i),n.play(),n.id},setLoop:function(t,e){var i=_(t);i&&i.setLoop&&i.setLoop(e)},isLoop:function(t){var e=_(t);return!(!e||!e.getLoop)&&e.getLoop()},setVolume:function(t,e){var i=_(t);i&&i.setVolume(e)},getVolume:function(t){var e=_(t);return e?e.getVolume():1},setCurrentTime:function(t,e){var i=_(t);return!!i&&(i.setCurrentTime(e),!0)},getCurrentTime:function(t){var e=_(t);return e?e.getCurrentTime():0},getDuration:function(t){var e=_(t);return e?e.getDuration():0},getState:function(t){var e=_(t);return e?e.getState():this.AudioState.ERROR},setFinishCallback:function(t,e){var i=_(t);i&&(i._finishCallback=e)},pause:function(t){var e=_(t);return!!e&&(e.pause(),!0)},_pauseIDCache:[],pauseAll:function(){for(var t in a){var e=a[t];e.getState()===n.State.PLAYING&&(this._pauseIDCache.push(t),e.pause())}},resume:function(t){var e=_(t);e&&e.resume()},resumeAll:function(){for(var t=0;t0;){var n=i.pop(),r=a[n];r&&(r.stop(),delete a[n])}},uncacheAll:function(){this.stopAll();var t=void 0;for(var e in a)(t=a[e])&&t.destroy();for(;t=l.pop();)t.destroy();a=s.createMap(!0),c={}},getProfile:function(t){},preload:function(t,e){cc.loader.load(t,e&&function(t){t||e()})},setMaxWebAudioSize:function(t){this._maxWebAudioSize=1024*t},_breakCache:null,_break:function(){for(var t in this._breakCache=[],a){var e=a[t];e.getState()===n.State.PLAYING&&(this._breakCache.push(t),e.pause())}},_restore:function(){if(this._breakCache){for(;this._breakCache.length>0;){var t=this._breakCache.pop(),e=_(t);e&&e.resume&&e.resume()}this._breakCache=null}},_music:{id:-1,loop:!1,volume:1},_effect:{volume:1,pauseCache:[]},playMusic:function(t,e){var i=this._music;return this.stop(i.id),i.id=this.play(t,e,i.volume),i.loop=e,i.id},stopMusic:function(){this.stop(this._music.id)},pauseMusic:function(){return this.pause(this._music.id),this._music.id},resumeMusic:function(){return this.resume(this._music.id),this._music.id},getMusicVolume:function(){return this._music.volume},setMusicVolume:function(t){t=f(t);var e=this._music;return e.volume=t,this.setVolume(e.id,e.volume),e.volume},isMusicPlaying:function(){return this.getState(this._music.id)===this.AudioState.PLAYING},playEffect:function(t,e){return this.play(t,e||!1,this._effect.volume)},setEffectsVolume:function(t){t=f(t);var e=this._music.id;for(var i in this._effect.volume=t,a){var n=a[i];n&&n.id!==e&&d.setVolume(i,t)}},getEffectsVolume:function(){return this._effect.volume},pauseEffect:function(t){return this.pause(t)},pauseAllEffects:function(){var t=this._music.id,e=this._effect;for(var i in e.pauseCache.length=0,a){var n=a[i];if(n&&n.id!==t)n.getState()===this.AudioState.PLAYING&&(e.pauseCache.push(i),n.pause())}},resumeEffect:function(t){this.resume(t)},resumeAllEffects:function(){for(var t=this._effect.pauseCache,e=0;e=0;--n)o[i]+=s.charCodeAt(i*e+n)<<8*n;return o},n.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),o=[];for(i=0,r=s.length/e;i=0;--n)o[i]+=s.charCodeAt(i*e+n)<<8*n;return o},cc.codec=e.exports=n}),{"./base64":23,"./gzip":24}],23:[(function(t,e,i){"use strict";var n=t("../core/utils/misc").BASE64_VALUES,r={name:"Jacob__Codec__Base64",decode:function(t){var e,i,r,s,o,a,c=[],l=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");l>4,i=(15&s)<<4|(o=n[t.charCodeAt(l++)])>>2,r=(3&o)<<6|(a=n[t.charCodeAt(l++)]),c.push(String.fromCharCode(e)),64!==o&&c.push(String.fromCharCode(i)),64!==a&&c.push(String.fromCharCode(r));return c=c.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),o=[];for(i=0,r=s.length/e;i=0;--n)o[i]+=s.charCodeAt(i*e+n)<<8*n;return o}};e.exports=r}),{"../core/utils/misc":249}],24:[(function(t,e,i){"use strict";var n=function(t){this.data=t,this.debug=!1,this.gpflags=void 0,this.files=0,this.unzipped=[],this.buf32k=new Array(32768),this.bIdx=0,this.modeZIP=!1,this.bytepos=0,this.bb=1,this.bits=0,this.nameBuf=[],this.fileout=void 0,this.literalTree=new Array(n.LITERALS),this.distanceTree=new Array(32),this.treepos=0,this.Places=null,this.len=0,this.fpos=new Array(17),this.fpos[0]=0,this.flens=void 0,this.fmax=void 0};n.gunzip=function(t){return t.constructor===Array||(t.constructor,String),new n(t).gunzip()[0][0]},n.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},n.LITERALS=288,n.NAMEMAX=256,n.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],n.cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],n.cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],n.cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],n.cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],n.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],n.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},n.prototype.readByte=function(){return this.bits+=8,this.bytepos>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},n.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=n.bitReverse[e]>>8-t),e},n.prototype.flushBuffer=function(){this.bIdx=0},n.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},n.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}},n.prototype.Rec=function(){var t,e=this.Places[this.treepos];if(17===this.len)return-1;if(this.treepos++,this.len++,(t=this.IsPat())>=0)e.b0=t;else if(e.b0=32768,this.Rec())return-1;if((t=this.IsPat())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=this.Places[this.treepos],e.jumppos=this.treepos,this.Rec())return-1;return this.len--,0},n.prototype.CreateTree=function(t,e,i,n){var r;for(this.Places=t,this.treepos=0,this.flens=i,this.fmax=e,r=0;r<17;r++)this.fpos[r]=0;return this.len=0,this.Rec()?-1:0},n.prototype.DecodeValue=function(t){for(var e,i,n=0,r=t[n];;)if(this.readBit()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(a=a<<1|this.readBit())>199?a=(a-=128)<<1|this.readBit():(a-=48)>143&&(a+=136):a+=256,a<256)this.addBuffer(a);else{if(256===a)break;for(a-=257,p=this.readBits(n.cplext[a])+n.cplens[a],a=n.bitReverse[this.readBits(5)]>>3,n.cpdext[a]>8?(m=this.readBits(8),m|=this.readBits(n.cpdext[a]-8)<<8):m=this.readBits(n.cpdext[a]),m+=n.cpdist[a],a=0;ac)return this.flushBuffer(),1;for(f=i?_[i-1]:0;a--;)_[i++]=f}else{if(i+(a=17===a?3+this.readBits(3):11+this.readBits(7))>c)return this.flushBuffer(),1;for(;a--;)_[i++]=0}for(p=this.literalTree.length,i=0;i=256){var p,m;if(0===(a-=256))break;for(a--,p=this.readBits(n.cplext[a])+n.cplens[a],a=this.DecodeValue(this.distanceTree),n.cpdext[a]>8?(m=this.readBits(8),m|=this.readBits(n.cpdext[a]-8)<<8):m=this.readBits(n.cpdext[a]),m+=n.cpdist[a];p--;){o=this.buf32k[this.bIdx-m&32767];this.addBuffer(o)}}else this.addBuffer(a)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},n.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e>>0;t=n}for(var r,s=1,o=0,a=t.length,c=0;0>>0}function a(e,i){this.index="number"==typeof i?i:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,i=e.length,n=new(s?Uint8Array:Array)(i<<1);if(s)n.set(e);else for(t=0;t>>8&255]<<16|f[t>>>16&255]<<8|f[t>>>24&255])>>32-e:f[t]>>8-e),8>e+o)a=a<>e-n-1&1,8==++o&&(o=0,r[s++]=f[a],a=0,s===r.length&&(r=this.f()));r[s]=a,this.buffer=r,this.i=o,this.index=s},a.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0c;++c){for(var h=_=c,u=7,_=_>>>1;_;_>>>=1)h<<=1,h|=1&_,--u;l[c]=(h<>>0}var f=l;function d(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,o,a,c,l,h,u=t.length,_=0,f=Number.POSITIVE_INFINITY;for(l=0;l_&&(_=t[l]),t[l]>=1;for(h=a;hs[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},d.prototype.pop=function(){var t,e,i,n,r,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;!((n=2*r+2)>=this.length)&&(n+2s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:t,value:e,length:this.length}};var y,v=2,g={NONE:0,r:1,j:v,N:3},x=[];for(y=0;288>y;y++)switch(i){case 143>=y:x.push([y+48,8]);break;case 255>=y:x.push([y-144+400,9]);break;case 279>=y:x.push([y-256+0,7]);break;case 287>=y:x.push([y-280+192,8]);break;default:t("invalid literal: "+y)}function C(t,e){this.length=t,this.G=e}function A(){var e=b;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}m.prototype.n=function(){var n,r,o,c,l=this.input;switch(this.h){case 0:for(o=0,c=l.length;o>>8&255,y[g++]=255&_,y[g++]=_>>>8&255,s)y.set(f,g),g+=f.length,y=y.subarray(0,g);else{for(p=0,m=f.length;pJ)for(;0J?J:138)>J-3&&Q=Q?(it[K++]=17,it[K++]=Q-3,nt[17]++):(it[K++]=18,it[K++]=Q-11,nt[18]++),J-=Q;else if(it[K++]=et[X],nt[et[X]]++,3>--J)for(;0J?J:6)>J-3&&QU;U++)q[U]=N[H[U]];for(D=19;4=b;b++)S=A(),T[b]=S[2]<<24|S[1]<<16|S[0];var w=s?new Uint32Array(T):T;function E(n,r){function o(e,n){var r,s,o,a,c=e.G,l=[],h=0;switch(r=w[e.length],l[h++]=65535&r,l[h++]=r>>16&255,l[h++]=r>>24,i){case 1===c:s=[0,c-1,0];break;case 2===c:s=[1,c-2,0];break;case 3===c:s=[2,c-3,0];break;case 4===c:s=[3,c-4,0];break;case 6>=c:s=[4,c-5,1];break;case 8>=c:s=[5,c-7,1];break;case 12>=c:s=[6,c-9,2];break;case 16>=c:s=[7,c-13,2];break;case 24>=c:s=[8,c-17,3];break;case 32>=c:s=[9,c-25,3];break;case 48>=c:s=[10,c-33,4];break;case 64>=c:s=[11,c-49,4];break;case 96>=c:s=[12,c-65,5];break;case 128>=c:s=[13,c-97,5];break;case 192>=c:s=[14,c-129,6];break;case 256>=c:s=[15,c-193,6];break;case 384>=c:s=[16,c-257,7];break;case 512>=c:s=[17,c-385,7];break;case 768>=c:s=[18,c-513,8];break;case 1024>=c:s=[19,c-769,8];break;case 1536>=c:s=[20,c-1025,9];break;case 2048>=c:s=[21,c-1537,9];break;case 3072>=c:s=[22,c-2049,10];break;case 4096>=c:s=[23,c-3073,10];break;case 6144>=c:s=[24,c-4097,11];break;case 8192>=c:s=[25,c-6145,11];break;case 12288>=c:s=[26,c-8193,12];break;case 16384>=c:s=[27,c-12289,12];break;case 24576>=c:s=[28,c-16385,13];break;case 32768>=c:s=[29,c-24577,13];break;default:t("invalid distance")}for(r=s,l[h++]=r[0],l[h++]=r[1],l[h++]=r[2],o=0,a=l.length;o=l;)x[l++]=0;for(l=0;29>=l;)A[l++]=0}for(x[256]=1,a=0,c=r.length;a=c){for(d&&o(d,-1),l=0,h=c-a;lB&&a+BE&&(T=S,E=B),258===B)break}f=new C(E,a-T),d?d.length2*g[f-1]+x[f]&&(g[f]=2*g[f-1]+x[f]),A[f]=Array(g[f]),b[f]=Array(g[f]);for(_=0;_r[_]?(A[f][p]=m,b[f][p]=v,y+=2):(A[f][p]=r[_],b[f][p]=_,++_);S[f]=0,1===x[f]&&i(f)}for(o=C,a=0,c=n.length;a1<h&&t("undercommitted"),i=0,n=e.length;i>>=1;return a}function I(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=R.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new m(this.input,n)}var R=g;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=L,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case D:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case L:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}I.prototype.n=function(){var e,i,n,r,a,c,l,h=0;switch(l=this.a,e=ht){case ht:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,l[h++]=n,e){case ht:switch(this.h){case R.NONE:a=0;break;case R.r:a=1;break;case R.j:a=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=a<<6|0,l[h++]=r|31-(256*n+r)%31,c=o(this.input),this.z.b=h,h=(l=this.z.n()).length,s&&((l=new Uint8Array(l.buffer)).length<=h+4&&(this.a=new Uint8Array(l.length+4),this.a.set(l),l=this.a),l=l.subarray(0,h+4)),l[h++]=c>>24&255,l[h++]=c>>16&255,l[h++]=c>>8&255,l[h++]=255&c,l},r("Zlib.Deflate",I),r("Zlib.Deflate.compress",(function(t,e){return new I(t,e).n()})),r("Zlib.Deflate.CompressionType",R),r("Zlib.Deflate.CompressionType.NONE",R.NONE),r("Zlib.Deflate.CompressionType.FIXED",R.r),r("Zlib.Deflate.CompressionType.DYNAMIC",R.j);var D=0,L=1,O={D:D,C:L};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,o=this.c,a=this.a,c=this.b,l=e,h=e,u=e,_=a.length,f=e;switch(this.e=this.g=0,(l=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),h=l,(l=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),h|=l<<8,(l=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),u=l,(l=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),h===~(u|=l<<8)&&t(Error("invalid uncompressed block header: length verify")),o+h>r.length&&t(Error("input buffer is broken")),this.m){case D:for(;c+h>a.length;){if(h-=f=_-c,s)a.set(r.subarray(o,o+f),c),c+=f,o+=f;else for(;f--;)a[c++]=r[o++];this.b=c,a=this.f(),c=this.b}break;case L:for(;c+h>a.length;)a=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)a.set(r.subarray(o,o+h),c),c+=h,o+=h;else for(;h--;)a[c++]=r[o++];this.c=o,this.b=c,this.a=a;break;case 1:this.o(K,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var V,F,N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=s?new Uint16Array(N):N,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],z=s?new Uint16Array(k):k,U=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],W=s?new Uint8Array(U):U,j=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],H=s?new Uint16Array(j):j,q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],X=s?new Uint8Array(q):q,Y=new(s?Uint8Array:Array)(288);for(V=0,F=Y.length;V=V?8:255>=V?9:279>=V?7:8;var J,Z,K=p(Y),Q=new(s?Uint8Array:Array)(30);for(J=0,Z=Q.length;J>>n,i.e=o-n,i.c=c,r}function et(i,n){for(var r,s,o,a=i.g,c=i.e,l=i.input,h=i.c,u=n[0],_=n[1];c<_;)(r=l[h++])===e&&t(Error("input buffer is broken")),a|=r<>>16,i.g=a>>o,i.e=c-o,i.c=h,65535&s}function it(t){function e(t,e,i){var n,r,s,o;for(o=0;or)n>=c&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(a=z[s=r-257],0=c&&(this.b=n,i=this.f(),n=this.b);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,o,a,c=i.length;256!==(r=et(this,t));)if(256>r)n>=c&&(c=(i=this.f()).length),i[n++]=r;else for(a=z[s=r-257],0c&&(c=(i=this.f()).length);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;tt;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,o=this.input,a=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),2>r?i=(n=(o.length-this.c)/this.u[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&((i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==o(e)&&t(Error("invalid adler-32 checksum"))),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",O),O.ADAPTIVE=O.C,O.BLOCK=O.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);s&&new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);s&&new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]);s&&new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]);s&&new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]);s&&new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);var rt,st,ot=new(s?Uint8Array:Array)(288);for(rt=0,st=ot.length;rt=rt?8:255>=rt?9:279>=rt?7:8;p(ot);var at,ct,lt=new(s?Uint8Array:Array)(30);for(at=0,ct=lt.length;atu.ERROR){var e=function(t){if(cc.game.canvas){if(!s){var e=document.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",cc.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(s=document.createElement("textarea")).setAttribute("rows","20"),s.setAttribute("cols","30"),s.setAttribute("disabled","true");var n=s.style;n.backgroundColor="transparent",n.borderBottom="1px solid #cccccc",n.borderTopWidth=n.borderLeftWidth=n.borderRightWidth="0px",n.borderTopStyle=n.borderLeftStyle=n.borderRightStyle="none",n.padding="0px",n.margin=0,e.appendChild(s),cc.game.canvas.parentNode.appendChild(e)}s.value=s.value+t+"\r\n",s.scrollTop=s.scrollHeight}};cc.error=function(){e("ERROR : "+cc.js.formatStr.apply(null,arguments))},cc.assert=function(t,i){!t&&i&&(i=cc.js.formatStr.apply(null,cc.js.shiftArguments.apply(null,arguments)),e("ASSERT: "+i))},t!==u.ERROR_FOR_WEB_PAGE&&(cc.warn=function(){e("WARN : "+cc.js.formatStr.apply(null,arguments))}),t===u.INFO_FOR_WEB_PAGE&&(cc.log=function(){e(cc.js.formatStr.apply(null,arguments))})}else console&&console.log.apply&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),console.error.bind?cc.error=console.error.bind(console):cc.error=function(){return console.error.apply(console,arguments)},cc.assert=function(t,e){if(!t)throw e&&(e=cc.js.formatStr.apply(null,cc.js.shiftArguments.apply(null,arguments))),new Error(e)});t!==u.ERROR&&(console.warn.bind?cc.warn=console.warn.bind(console):cc.warn=function(){return console.warn.apply(console,arguments)}),t===u.INFO&&(console.log.bind?cc.log=console.log.bind(console):cc.log=function(){return console.log.apply(console,arguments)})}},getError:o("ERROR"),isDisplayStats:function(){return!!cc.profiler&&cc.profiler.isShowingStats()},setDisplayStats:function(t){cc.profiler&&(t?cc.profiler.showStats():cc.profiler.hideStats(),cc.game.config.showFPS=!!t)}}}),{"../../DebugInfos":void 0,"./platform/utils":184}],28:[(function(t,e,i){"use strict";var n=t("./event/event-target"),r=t("./load-pipeline/auto-release-utils"),s=t("./component-scheduler"),o=t("./node-activator"),a=t("./platform/CCObject"),c=t("./CCGame"),l=t("./renderer"),h=t("./event-manager"),u=t("./CCScheduler");cc.Director=function(){n.call(this),this._paused=!1,this._purgeDirectorInNextLoop=!1,this._winSizeInPoints=null,this._loadingScene="",this._scene=null,this._totalFrames=0,this._lastUpdate=0,this._deltaTime=0,this._scheduler=null,this._compScheduler=null,this._nodeActivator=null,this._actionManager=null;var t=this;c.on(c.EVENT_SHOW,(function(){t._lastUpdate=performance.now()})),c.once(c.EVENT_ENGINE_INITED,this.init,this)},cc.Director.prototype={constructor:cc.Director,init:function(){return this._totalFrames=0,this._lastUpdate=performance.now(),this._paused=!1,this._purgeDirectorInNextLoop=!1,this._winSizeInPoints=cc.size(0,0),this._scheduler=new u,cc.ActionManager?(this._actionManager=new cc.ActionManager,this._scheduler.scheduleUpdate(this._actionManager,u.PRIORITY_SYSTEM,!1)):this._actionManager=null,this.sharedInit(),!0},sharedInit:function(){this._compScheduler=new s,this._nodeActivator=new o,h&&h.setEnabled(!0),cc.AnimationManager?(this._animationManager=new cc.AnimationManager,this._scheduler.scheduleUpdate(this._animationManager,u.PRIORITY_SYSTEM,!1)):this._animationManager=null,cc.CollisionManager?(this._collisionManager=new cc.CollisionManager,this._scheduler.scheduleUpdate(this._collisionManager,u.PRIORITY_SYSTEM,!1)):this._collisionManager=null,cc.PhysicsManager?(this._physicsManager=new cc.PhysicsManager,this._scheduler.scheduleUpdate(this._physicsManager,u.PRIORITY_SYSTEM,!1)):this._physicsManager=null,cc._widgetManager&&cc._widgetManager.init(this),cc.loader.init(this)},calculateDeltaTime:function(t){t||(t=performance.now()),this._deltaTime=(t-this._lastUpdate)/1e3,this._lastUpdate=t},convertToGL:function(t){var e=c.container,i=cc.view,n=e.getBoundingClientRect(),r=n.left+window.pageXOffset-e.clientLeft,s=n.top+window.pageYOffset-e.clientTop,o=i._devicePixelRatio*(t.x-r),a=i._devicePixelRatio*(s+n.height-t.y);return i._isRotated?cc.v2(i._viewportRect.width-a,o):cc.v2(o,a)},convertToUI:function(t){var e=c.container,i=cc.view,n=e.getBoundingClientRect(),r=n.left+window.pageXOffset-e.clientLeft,s=n.top+window.pageYOffset-e.clientTop,o=cc.v2(0,0);return i._isRotated?(o.x=r+t.y/i._devicePixelRatio,o.y=s+n.height-(i._viewportRect.width-t.x)/i._devicePixelRatio):(o.x=r+t.x*i._devicePixelRatio,o.y=s+n.height-t.y*i._devicePixelRatio),o},end:function(){this._purgeDirectorInNextLoop=!0},getWinSize:function(){return cc.size(cc.winSize)},getWinSizeInPixels:function(){return cc.size(cc.winSize)},pause:function(){this._paused||(this._paused=!0)},purgeCachedData:function(){cc.loader.releaseAll()},purgeDirector:function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),h&&h.setEnabled(!1),cc.isValid(this._scene)&&this._scene.destroy(),this._scene=null,cc.renderer.clear(),cc.AssetLibrary.resetBuiltins(),cc.game.pause(),cc.loader.releaseAll()},reset:function(){this.purgeDirector(),h&&h.setEnabled(!0),this._actionManager&&this._scheduler.scheduleUpdate(this._actionManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._animationManager&&this._scheduler.scheduleUpdate(this._animationManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._collisionManager&&this._scheduler.scheduleUpdate(this._collisionManager,cc.Scheduler.PRIORITY_SYSTEM,!1),this._physicsManager&&this._scheduler.scheduleUpdate(this._physicsManager,cc.Scheduler.PRIORITY_SYSTEM,!1),cc.game.resume()},runSceneImmediate:function(t,e,i){cc.assertID(t instanceof cc.Scene,1216),t._load();for(var n=Object.keys(c._persistRootNodes).map((function(t){return c._persistRootNodes[t]})),s=0;s0){var i=this;cc.loader.load(e,(function(e){if(e)throw new Error(JSON.stringify(e));i._prepareFinished(t)}))}else this._prepareFinished(t)}},run:function(t,e){this._initConfig(t),this.onStart=e,this.prepare(a.onStart&&a.onStart.bind(a))},addPersistRootNode:function(t){if(cc.Node.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=cc.director._scene;if(cc.isValid(i))if(t.parent){if(!(t.parent instanceof cc.Scene))return void cc.warnID(3801);if(t.parent!==i)return void cc.warnID(3802)}else t.parent=i;this._persistRootNodes[e]=t,t._persistNode=!0}}else cc.warnID(3800)},removePersistRootNode:function(t){var e=t.uuid||"";t===this._persistRootNodes[e]&&(delete this._persistRootNodes[e],t._persistNode=!1)},isPersistRootNode:function(t){return t._persistNode},_setAnimFrame:function(){this._lastTime=performance.now();var t=a.config.frameRate;this._frameTime=1e3/t,60!==t&&30!==t?(window.requestAnimFrame=this._stTime,window.cancelAnimFrame=this._ctTime):(window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime,window.cancelAnimFrame=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.oCancelAnimationFrame||this._ctTime)},_stTime:function(t){var e=performance.now(),i=Math.max(0,a._frameTime-(e-a._lastTime)),n=window.setTimeout((function(){t()}),i);return a._lastTime=e+i,n},_ctTime:function(t){window.clearTimeout(t)},_runMainLoop:function(){if(this._prepared){var t,e=this,i=e.config,n=cc.director,s=!0,o=i.frameRate;r.setDisplayStats(i.showFPS),t=function(i){if(!e._paused){if(e._intervalId=window.requestAnimFrame(t),30===o&&(s=!s))return;n.mainLoop(i)}},e._intervalId=window.requestAnimFrame(t),e._paused=!1}},_initConfig:function(t){"number"!=typeof t.debugMode&&(t.debugMode=0),t.exposeClassName=!!t.exposeClassName,"number"!=typeof t.frameRate&&(t.frameRate=60);var e=t.renderMode;("number"!=typeof e||e>2||e<0)&&(t.renderMode=0),"boolean"!=typeof t.registerSystemEvent&&(t.registerSystemEvent=!0),t.showFPS=!!t.showFPS,this._sceneInfos=t.scenes||[],this.collisionMatrix=t.collisionMatrix||[],this.groupList=t.groupList||[],r._resetDebugSetting(t.debugMode),this.config=t,this._configLoaded=!0},_determineRenderType:function(){var t=this.config,e=parseInt(t.renderMode)||0;this.renderType=this.RENDER_TYPE_CANVAS;var i=!1;if(0===e?cc.sys.capabilities.opengl?(this.renderType=this.RENDER_TYPE_WEBGL,i=!0):cc.sys.capabilities.canvas&&(this.renderType=this.RENDER_TYPE_CANVAS,i=!0):1===e&&cc.sys.capabilities.canvas?(this.renderType=this.RENDER_TYPE_CANVAS,i=!0):2===e&&cc.sys.capabilities.opengl&&(this.renderType=this.RENDER_TYPE_WEBGL,i=!0),!i)throw new Error(r.getError(3820,e))},_initRenderer:function(){if(!this._rendererInitialized){var t=this.config.id,e=void 0,i=void 0,n=void 0,r=void 0,a=t instanceof HTMLElement?t:document.querySelector(t)||document.querySelector("#"+t);if("CANVAS"===a.tagName?(e=a.width,i=a.height,this.canvas=n=a,this.container=r=document.createElement("DIV"),n.parentNode&&n.parentNode.insertBefore(r,n)):("DIV"!==a.tagName&&cc.warnID(3819),e=a.clientWidth,i=a.clientHeight,this.canvas=n=document.createElement("CANVAS"),this.container=r=document.createElement("DIV"),a.appendChild(r)),r.setAttribute("id","Cocos2dGameContainer"),r.appendChild(n),this.frame=r.parentNode===document.body?document.documentElement:r.parentNode,(function(t,e){(" "+t.className+" ").indexOf(" "+e+" ")>-1||(t.className&&(t.className+=" "),t.className+=e)})(n,"gameCanvas"),n.setAttribute("width",e||480),n.setAttribute("height",i||320),n.setAttribute("tabindex",99),this._determineRenderType(),this.renderType===this.RENDER_TYPE_WEBGL){var c={stencil:!0,antialias:cc.macro.ENABLE_WEBGL_ANTIALIAS,alpha:cc.macro.ENABLE_TRANSPARENT_CANVAS};s.initWebGL(n,c),this._renderContext=s.device._gl,!cc.macro.CLEANUP_IMAGE_CACHE&&o&&(o.enabled=!0)}this._renderContext||(this.renderType=this.RENDER_TYPE_CANVAS,s.initCanvas(n),this._renderContext=s.device._ctx),this.canvas.oncontextmenu=function(){if(!cc._isContextMenuEnable)return!1},this._rendererInitialized=!0}},_initEvents:function(){var t,e=window;this.config.registerSystemEvent&&_cc.inputManager.registerSystemEvent(this.canvas),void 0!==document.hidden?t="hidden":void 0!==document.mozHidden?t="mozHidden":void 0!==document.msHidden?t="msHidden":void 0!==document.webkitHidden&&(t="webkitHidden");var i=!1;function n(){i||(i=!0,a.emit(a.EVENT_HIDE))}function r(t,e,n,r,s){i&&(i=!1,a.emit(a.EVENT_SHOW,t,e,n,r,s))}if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],o=0;o-1&&(e.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(e.addEventListener("pagehide",n),e.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r)),this.on(a.EVENT_HIDE,(function(){a.pause()})),this.on(a.EVENT_SHOW,(function(){a.resume()}))}};n.call(a),cc.js.addon(a,n.prototype),cc.game=e.exports=a}),{"../audio/CCAudioEngine":21,"../core/renderer/utils/dynamic-atlas/manager":210,"./CCDebug":27,"./event/event-target":98,"./renderer/index.js":207}],30:[(function(t,e,i){"use strict";var n=t("./vmath"),r=t("./utils/base-node"),s=t("./utils/prefab-helper"),o=t("./utils/trans-pool").NodeMemPool,a=t("./utils/affine-transform"),c=t("./event-manager"),l=t("./platform/CCMacro"),h=t("./platform/js"),u=(t("./event/event"),t("./event/event-target")),_=t("./renderer/render-flow"),f=cc.Object.Flags.Destroying,d=Math.PI/180,p=!!cc.ActionManager,m=function(){},y=cc.v3(),v=cc.quat(),g=cc.v3(),x=cc.v3(),C=cc.quat(),A=cc.quat(),b=cc.v3(),S=cc.v3(),T=cc.v3(),w=cc.v3(),E=cc.v3(),B=cc.quat(),M=cc.quat(),I=cc.v3(),R=n.quat.create(),P=cc.v3(),D=cc.v3(),L=cc.quat(),O=cc.quat(),V=(cc.quat(),n.mat4.create()),F=n.vec3.create(),N=new Array(16);N.length=0;var G=cc.Enum({DEBUG:31}),k=cc.Enum({POSITION:1,SCALE:2,ROTATION:4,SKEW:8,TRS:7,RS:6,ALL:65535}),z=cc.Enum({TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TOUCH_CANCEL:"touchcancel",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_UP:"mouseup",MOUSE_WHEEL:"mousewheel",POSITION_CHANGED:"position-changed",ROTATION_CHANGED:"rotation-changed",SCALE_CHANGED:"scale-changed",SIZE_CHANGED:"size-changed",ANCHOR_CHANGED:"anchor-changed",COLOR_CHANGED:"color-changed",CHILD_ADDED:"child-added",CHILD_REMOVED:"child-removed",CHILD_REORDER:"child-reorder",GROUP_CHANGED:"group-changed",SIBLING_ORDER_CHANGED:"sibling-order-changed"}),U=[z.TOUCH_START,z.TOUCH_MOVE,z.TOUCH_END,z.TOUCH_CANCEL],W=[z.MOUSE_DOWN,z.MOUSE_ENTER,z.MOUSE_MOVE,z.MOUSE_LEAVE,z.MOUSE_UP,z.MOUSE_WHEEL],j=null,H=function(t,e){var i=t.getLocation(),n=this.owner;return!!n._hitTest(i,this)&&(e.type=z.TOUCH_START,e.touch=t,e.bubbles=!0,n.dispatchEvent(e),!0)},q=function(t,e){var i=this.owner;e.type=z.TOUCH_MOVE,e.touch=t,e.bubbles=!0,i.dispatchEvent(e)},X=function(t,e){var i=t.getLocation(),n=this.owner;n._hitTest(i,this)?e.type=z.TOUCH_END:e.type=z.TOUCH_CANCEL,e.touch=t,e.bubbles=!0,n.dispatchEvent(e)},Y=function(t,e){t.getLocation();var i=this.owner;e.type=z.TOUCH_CANCEL,e.touch=t,e.bubbles=!0,i.dispatchEvent(e)},J=function(t){var e=t.getLocation(),i=this.owner;i._hitTest(e,this)&&(t.type=z.MOUSE_DOWN,t.bubbles=!0,i.dispatchEvent(t))},Z=function(t){var e=t.getLocation(),i=this.owner;if(i._hitTest(e,this))this._previousIn||(j&&j._mouseListener&&(t.type=z.MOUSE_LEAVE,j.dispatchEvent(t),j._mouseListener._previousIn=!1),j=this.owner,t.type=z.MOUSE_ENTER,i.dispatchEvent(t),this._previousIn=!0),t.type=z.MOUSE_MOVE,t.bubbles=!0,i.dispatchEvent(t);else{if(!this._previousIn)return;t.type=z.MOUSE_LEAVE,i.dispatchEvent(t),this._previousIn=!1,j=null}t.stopPropagation()},K=function(t){var e=t.getLocation(),i=this.owner;i._hitTest(e,this)&&(t.type=z.MOUSE_UP,t.bubbles=!0,i.dispatchEvent(t),t.stopPropagation())},Q=function(t){var e=t.getLocation(),i=this.owner;i._hitTest(e,this)&&(t.type=z.MOUSE_WHEEL,t.bubbles=!0,i.dispatchEvent(t),t.stopPropagation())};function $(t){var e=cc.Mask;if(e)for(var i=0,n=t;n&&cc.Node.isNode(n);n=n._parent,++i)if(n.getComponent(e))return{index:i,node:n};return null}function tt(t,e){if(!(t._objFlags&f)){var i=0;if(t._bubblingListeners)for(;i=0;--n)if((i=N[n])._capturingListeners&&(e.currentTarget=i,i._capturingListeners.emit(e.type,e,N),e._propagationStopped))return void(N.length=0);if(N.length=0,e.eventPhase=2,e.currentTarget=t,t._capturingListeners&&t._capturingListeners.emit(e.type,e),!e._propagationImmediateStopped&&t._bubblingListeners&&t._bubblingListeners.emit(e.type,e),!e._propagationStopped&&e.bubbles)for(t._getBubblingTargets(e.type,N),e.eventPhase=3,n=0;n>16},set:function(t){t>l.MAX_ZINDEX?(cc.warnID(1636),t=l.MAX_ZINDEX):t>16),this._color.a<255&&255===this._opacity&&(this._opacity=this._color.a,this._color.a=255)},_onBatchCreated:function(){var t=this._prefab;t&&t.sync&&t.root===this&&s.syncWithPrefab(this),this._upgrade_1x_to_2x(),this._updateOrderOfArrival(),this.groupIndex=it(this),this._activeInHierarchy||(p&&cc.director.getActionManager().pauseTarget(this),c.pauseTarget(this));for(var e=this._children,i=0,n=e.length;i0&&(this._renderFlag|=_.FLAG_CHILDREN)},_onBatchRestored:function(){if(this._upgrade_1x_to_2x(),this.groupIndex=it(this),!this._activeInHierarchy){var t=cc.director.getActionManager();t&&t.pauseTarget(this),c.pauseTarget(this)}for(var e=this._children,i=0,n=e.length;i0&&(this._renderFlag|=_.FLAG_CHILDREN)},_checknSetupSysEvent:function(t){var e=!1,i=!1;return-1!==U.indexOf(t)?(this._touchListener||(this._touchListener=cc.EventListener.create({event:cc.EventListener.TOUCH_ONE_BY_ONE,swallowTouches:!0,owner:this,mask:$(this),onTouchBegan:H,onTouchMoved:q,onTouchEnded:X,onTouchCancelled:Y}),c.addListener(this._touchListener,this),e=!0),i=!0):-1!==W.indexOf(t)&&(this._mouseListener||(this._mouseListener=cc.EventListener.create({event:cc.EventListener.MOUSE,_previousIn:!1,owner:this,mask:$(this),onMouseDown:J,onMouseMove:Z,onMouseUp:K,onMouseScroll:Q}),c.addListener(this._mouseListener,this),e=!0),i=!0),e&&!this._activeInHierarchy&&cc.director.getScheduler().schedule((function(){this._activeInHierarchy||c.pauseTarget(this)}),this,0,0,0,!1),i},on:function(t,e,i,n){if(this._checknSetupSysEvent(t))return this._onDispatch(t,e,i,n);switch(t){case z.POSITION_CHANGED:this._eventMask|=1;break;case z.SCALE_CHANGED:this._eventMask|=2;break;case z.ROTATION_CHANGED:this._eventMask|=4;break;case z.SIZE_CHANGED:this._eventMask|=8;break;case z.ANCHOR_CHANGED:this._eventMask|=16;break;case z.COLOR_CHANGED:this._eventMask|=32}return this._bubblingListeners||(this._bubblingListeners=new u),this._bubblingListeners.on(t,e,i)},once:function(t,e,i,n){(this._checknSetupSysEvent(t)&&n?this._capturingListeners=this._capturingListeners||new u:this._bubblingListeners=this._bubblingListeners||new u).once(t,e,i)},_onDispatch:function(t,e,i,n){if("boolean"==typeof i?(n=i,i=void 0):n=!!n,e){var r=null;return(r=n?this._capturingListeners=this._capturingListeners||new u:this._bubblingListeners=this._bubblingListeners||new u).hasEventListener(t,e,i)||(r.on(t,e,i),i&&i.__eventTargets&&i.__eventTargets.push(this)),e}cc.errorID(6800)},off:function(t,e,i,n){var r=-1!==U.indexOf(t),s=!r&&-1!==W.indexOf(t);if(r||s)this._offDispatch(t,e,i,n),r?this._touchListener&&!tt(this,U)&&(c.removeListener(this._touchListener),this._touchListener=null):s&&this._mouseListener&&!tt(this,W)&&(c.removeListener(this._mouseListener),this._mouseListener=null);else if(this._bubblingListeners){if(this._bubblingListeners.off(t,e,i),!this._bubblingListeners.hasEventListener(t))switch(t){case z.POSITION_CHANGED:this._eventMask&=-2;break;case z.SCALE_CHANGED:this._eventMask&=-3;break;case z.ROTATION_CHANGED:this._eventMask&=-5;break;case z.SIZE_CHANGED:this._eventMask&=-9;break;case z.ANCHOR_CHANGED:this._eventMask&=-17;break;case z.COLOR_CHANGED:this._eventMask&=-33}}},_offDispatch:function(t,e,i,n){if("boolean"==typeof i?(n=i,i=void 0):n=!!n,e){var r=n?this._capturingListeners:this._bubblingListeners;r&&(r.off(t,e,i),i&&i.__eventTargets&&h.array.fastRemove(i.__eventTargets,this))}else this._capturingListeners&&this._capturingListeners.removeAll(t),this._bubblingListeners&&this._bubblingListeners.removeAll(t)},targetOff:function(t){var e=this._bubblingListeners;e&&(e.targetOff(t),1&this._eventMask&&!e.hasEventListener(z.POSITION_CHANGED)&&(this._eventMask&=-2),2&this._eventMask&&!e.hasEventListener(z.SCALE_CHANGED)&&(this._eventMask&=-3),4&this._eventMask&&!e.hasEventListener(z.ROTATION_CHANGED)&&(this._eventMask&=-5),8&this._eventMask&&!e.hasEventListener(z.SIZE_CHANGED)&&(this._eventMask&=-9),16&this._eventMask&&!e.hasEventListener(z.ANCHOR_CHANGED)&&(this._eventMask&=-17),32&this._eventMask&&!e.hasEventListener(z.COLOR_CHANGED)&&(this._eventMask&=-33)),this._capturingListeners&&this._capturingListeners.targetOff(t),t&&t.__eventTargets&&h.array.fastRemove(t.__eventTargets,this),this._touchListener&&!tt(this,U)&&(c.removeListener(this._touchListener),this._touchListener=null),this._mouseListener&&!tt(this,W)&&(c.removeListener(this._mouseListener),this._mouseListener=null)},hasEventListener:function(t){var e=!1;return this._bubblingListeners&&(e=this._bubblingListeners.hasEventListener(t)),!e&&this._capturingListeners&&(e=this._capturingListeners.hasEventListener(t)),e},emit:function(t,e,i,n,r,s){this._bubblingListeners&&this._bubblingListeners.emit(t,e,i,n,r,s)},dispatchEvent:function(t){et(this,t),N.length=0},pauseSystemEvents:function(t){c.pauseTarget(this,t)},resumeSystemEvents:function(t){c.resumeTarget(this,t)},_hitTest:function(t,e){var i=this._contentSize.width,r=this._contentSize.height,s=P,o=D,a=cc.Camera.findCamera(this);if(a?a.getScreenToWorldPoint(t,s):s.set(t),this._updateWorldMatrix(),!n.mat4.invert(V,this._worldMatrix))return!1;if(n.vec2.transformMat4(o,s,V),o.x+=this._anchorPoint.x*i,o.y+=this._anchorPoint.y*r,o.x>=0&&o.y>=0&&o.x<=i&&o.y<=r){if(e&&e.mask){for(var c=e.mask,l=this,h=0;l&&h1){var e,i,n,r=t.length;for(e=1;e=0&&n._localZOrder0,this._repeat=r,this._runForever=this._repeat===cc.macro.REPEAT_FOREVER,!0},_.getInterval=function(){return this._interval},_.setInterval=function(t){this._interval=t},_.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},_.getCallback=function(){return this._callback},_.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},_.cancel=function(){this._scheduler.unschedule(this._callback,this._target)};var f=[];u.get=function(){return f.pop()||new u},u.put=function(t){f.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,f.push(t))},cc.Scheduler=function(){this._timeScale=1,this._updatesNegList=[],this._updates0List=[],this._updatesPosList=[],this._hashForUpdates=n.createMap(!0),this._hashForTimers=n.createMap(!0),this._currentTarget=null,this._currentTargetSalvaged=!1,this._updateHashLocked=!1,this._arrayForTimers=[]},cc.Scheduler.prototype={constructor:cc.Scheduler,_removeHashElement:function(t){delete this._hashForTimers[t.target._id];for(var e=this._arrayForTimers,i=0,n=e.length;i=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}},unscheduleUpdate:function(t){if(t){var e=t._id;e||(t.__instanceId?(cc.warnID(1513),e=t._id=t.__instanceId):cc.errorID(1510));var i=this._hashForUpdates[e];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}},unscheduleAllForTarget:function(t){if(t){var e=t._id;e||(t.__instanceId?(cc.warnID(1513),e=t._id=t.__instanceId):cc.errorID(1510));var i=this._hashForTimers[e];if(i){var n=i.timers;n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)i=r[e],this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s==this._updatesNegList.length&&e++;if(t<=0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s==this._updatesPosList.length&&e++},isScheduled:function(t,e){cc.assertID(t,1508),cc.assertID(e,1509);var i=e._id;i||(e.__instanceId?(cc.warnID(1513),i=e._id=e.__instanceId):cc.errorID(1510));var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s=t&&(r.paused=!0,s.push(r.target));if(t<=0)for(i=0;i=t&&(r.paused=!0,s.push(r.target));return s},resumeTargets:function(t){if(t)for(var e=0;e=r.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):(this.data._prefab._synced=!0,t=this.data._instantiate()),++this._instantiatedTimes,t},destroy:function(){this.data&&this.data.destroy(),this._super()}});cc.Prefab=e.exports=r,cc.js.obsolete(cc,"cc._Prefab","Prefab")}),{"../platform/instantiate-jit":178}],43:[(function(t,e,i){"use strict";var n=t("../platform/CCObject"),r=t("../platform/js");cc.RawAsset=cc.Class({name:"cc.RawAsset",extends:n,ctor:function(){Object.defineProperty(this,"_uuid",{value:"",writable:!0})}}),r.value(cc.RawAsset,"isRawAssetType",(function(t){return r.isChildClassOf(t,cc.RawAsset)&&!r.isChildClassOf(t,cc.Asset)})),r.value(cc.RawAsset,"wasRawAssetType",(function(t){return t===cc.Texture2D||t===cc.AudioClip||t===cc.ParticleAsset||t===cc.Asset})),e.exports=cc.RawAsset}),{"../platform/CCObject":166,"../platform/js":180}],44:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../renderer/gfx"));var r=t("../renderer"),s=t("./CCTexture2D"),o=cc.Class({name:"cc.RenderTexture",extends:s,ctor:function(){this._framebuffer=null},initWithSize:function(t,e,i){this.width=Math.floor(t||cc.visibleRect.width),this.height=Math.floor(e||cc.visibleRect.height),this._resetUnderlyingMipmaps();var s={colors:[this._texture]};this._depthStencilBuffer&&this._depthStencilBuffer.destroy();var o=void 0;i&&(o=new n.default.RenderBuffer(r.device,i,t,e),i===n.default.RB_FMT_D24S8?s.depthStencil=o:i===n.default.RB_FMT_S8?s.stencil=o:i===n.default.RB_FMT_D16&&(s.depth=o)),this._depthStencilBuffer=o,this._framebuffer&&this._framebuffer.destroy(),this._framebuffer=new n.default.FrameBuffer(r.device,t,e,s),this._packable=!1,this.loaded=!0,this.emit("load")},updateSize:function(t,e){this.width=Math.floor(t||cc.visibleRect.width),this.height=Math.floor(e||cc.visibleRect.height),this._resetUnderlyingMipmaps();var i=this._depthStencilBuffer;i&&i.update(this.width,this.height),this._framebuffer._width=t,this._framebuffer._height=e},drawTextureAt:function(t,e,i){t._image&&this._texture.updateSubImage({x:e,y:i,image:t._image,width:t.width,height:t.height,level:0,flipY:!1,premultiplyAlpha:t._premultiplyAlpha})},readPixels:function(t,e,i,n,r){if(!this._framebuffer||!this._texture)return t;e=e||0,i=i||0;var s=n||this.width,o=r||this.height;t=t||new Uint8Array(s*o*4);var a=cc.game._renderContext,c=a.getParameter(a.FRAMEBUFFER_BINDING);return a.bindFramebuffer(a.FRAMEBUFFER,this._framebuffer.getHandle()),a.readPixels(e,i,s,o,a.RGBA,a.UNSIGNED_BYTE,t),a.bindFramebuffer(a.FRAMEBUFFER,c),t},destroy:function(){this._super(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null)}});cc.RenderTexture=e.exports=o}),{"../../renderer/gfx":308,"../renderer":207,"./CCTexture2D":51}],45:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.SceneAsset",extends:cc.Asset,properties:{scene:null,asyncLoadAssets:void 0}});cc.SceneAsset=n,e.exports=n}),{}],46:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.Script",extends:cc.Asset});cc._Script=n;var r=cc.Class({name:"cc.JavaScript",extends:n});cc._JavaScript=r;var s=cc.Class({name:"cc.CoffeeScript",extends:n});cc._CoffeeScript=s;var o=cc.Class({name:"cc.TypeScript",extends:n});cc._TypeScript=o}),{}],47:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.SpriteAtlas",extends:cc.Asset,properties:{_spriteFrames:{default:{}}},getTexture:function(){var t=Object.keys(this._spriteFrames);if(t.length>0){var e=this._spriteFrames[t[0]];return e?e.getTexture():null}return null},getSpriteFrame:function(t){var e=this._spriteFrames[t];return e?(e.name||(e.name=t),e):null},getSpriteFrames:function(){var t=[],e=this._spriteFrames;for(var i in e)t.push(this.getSpriteFrame(i));return t}});cc.SpriteAtlas=n,e.exports=n}),{}],48:[(function(t,e,i){"use strict";var n=t("../event/event-target"),r=t("../utils/texture-util"),s=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],o=cc.Class({name:"cc.SpriteFrame",extends:t("../assets/CCAsset"),mixins:[n],properties:{_textureSetter:{set:function(t){t&&(this._texture!==t&&this._refreshTexture(t),this._textureFilename=t.url)}},insetTop:{get:function(){return this._capInsets[1]},set:function(t){this._capInsets[1]=t,this._texture&&this._calculateSlicedUV()}},insetBottom:{get:function(){return this._capInsets[3]},set:function(t){this._capInsets[3]=t,this._texture&&this._calculateSlicedUV()}},insetLeft:{get:function(){return this._capInsets[0]},set:function(t){this._capInsets[0]=t,this._texture&&this._calculateSlicedUV()}},insetRight:{get:function(){return this._capInsets[2]},set:function(t){this._capInsets[2]=t,this._texture&&this._calculateSlicedUV()}}},ctor:function(){n.call(this);var t=arguments[0],e=arguments[1],i=arguments[2],r=arguments[3],s=arguments[4];this._rect=null,this.uv=[],this._texture=null,this._original=null,this._offset=null,this._originalSize=null,this._rotated=!1,this.vertices=null,this._capInsets=[0,0,0,0],this.uvSliced=[],this._textureFilename="",void 0!==t&&this.setTexture(t,e,i,r,s)},textureLoaded:function(){return this._texture&&this._texture.loaded},isRotated:function(){return this._rotated},setRotated:function(t){this._rotated=t,this._texture&&this._calculateUV()},getRect:function(){return cc.rect(this._rect)},setRect:function(t){this._rect=t,this._texture&&this._calculateUV()},getOriginalSize:function(){return cc.size(this._originalSize)},setOriginalSize:function(t){this._originalSize?(this._originalSize.width=t.width,this._originalSize.height=t.height):this._originalSize=cc.size(t)},getTexture:function(){return this._texture},_textureLoadedCallback:function(){var t=this._texture;if(t){var e=t.width,i=t.height;this._rect?this._checkRect(this._texture):this._rect=cc.rect(0,0,e,i),this._originalSize||this.setOriginalSize(cc.size(e,i)),this._offset||this.setOffset(cc.v2(0,0)),this._calculateUV(),this.emit("load")}},_refreshTexture:function(t){this._texture=t,t.loaded?this._textureLoadedCallback():t.once("load",this._textureLoadedCallback,this)},getOffset:function(){return cc.v2(this._offset)},setOffset:function(t){this._offset=cc.v2(t)},clone:function(){return new o(this._texture||this._textureFilename,this._rect,this._rotated,this._offset,this._originalSize)},setTexture:function(t,e,i,n,r){this._rect=e||null,n?this.setOffset(n):this._offset=null,r?this.setOriginalSize(r):this._originalSize=null,this._rotated=i||!1;var s=t;return"string"==typeof s&&s&&(this._textureFilename=s,this._loadTexture()),s instanceof cc.Texture2D&&this._texture!==s&&this._refreshTexture(s),!0},_loadTexture:function(){if(this._textureFilename){var t=r.loadImage(this._textureFilename);this._refreshTexture(t)}},ensureLoadTexture:function(){this._texture?this._texture.loaded||(this._refreshTexture(this._texture),r.postLoadTexture(this._texture)):this._textureFilename&&this._loadTexture()},_checkRect:function(t){var e=this._rect,i=e.x,n=e.y;this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width&&cc.errorID(3300,t.url+"/"+this.name,i,t.width),n>t.height&&cc.errorID(3400,t.url+"/"+this.name,n,t.height)},_calculateSlicedUV:function(){var t=this._rect,e=this._texture.width,i=this._texture.height,n=this._capInsets[0],r=this._capInsets[2],o=t.width-n-r,a=this._capInsets[1],c=this._capInsets[3],l=t.height-a-c,h=this.uvSliced;if(h.length=0,this._rotated){s[0].u=t.x/e,s[1].u=(t.x+c)/e,s[2].u=(t.x+c+l)/e,s[3].u=(t.x+t.height)/e,s[3].v=t.y/i,s[2].v=(t.y+n)/i,s[1].v=(t.y+n+o)/i,s[0].v=(t.y+t.width)/i;for(var u=0;u<4;++u)for(var _=s[u],f=0;f<4;++f){var d=s[3-f];h.push({u:_.u,v:d.v})}}else{s[0].u=t.x/e,s[1].u=(t.x+n)/e,s[2].u=(t.x+n+o)/e,s[3].u=(t.x+t.width)/e,s[3].v=t.y/i,s[2].v=(t.y+a)/i,s[1].v=(t.y+a+l)/i,s[0].v=(t.y+t.height)/i;for(var p=0;p<4;++p)for(var m=s[p],y=0;y<4;++y){var v=s[y];h.push({u:v.u,v:m.v})}}},_setDynamicAtlasFrame:function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},_resetDynamicAtlasFrame:function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},_calculateUV:function(){var t=this._rect,e=this._texture,i=this.uv,n=e.width,r=e.height;if(this._rotated){var s=0===n?0:t.x/n,o=0===n?0:(t.x+t.height)/n,a=0===r?0:(t.y+t.width)/r,c=0===r?0:t.y/r;i[0]=s,i[1]=c,i[2]=s,i[3]=a,i[4]=o,i[5]=c,i[6]=o,i[7]=a}else{var l=0===n?0:t.x/n,h=0===n?0:(t.x+t.width)/n,u=0===r?0:(t.y+t.height)/r,_=0===r?0:t.y/r;i[0]=l,i[1]=u,i[2]=h,i[3]=u,i[4]=l,i[5]=_,i[6]=h,i[7]=_}var f=this.vertices;if(f){f.nu.length=0,f.nv.length=0;for(var d=0;d0?this._image=t.images[0]:void 0!==t.image&&(this._image=t.image,t.images||(_.length=0,t.images=_),t.images.push(t.image)),t.images&&t.images.length>0&&this._texture.update(t),this._hashDirty=!0}},initWithElement:function(t){if(t)if(this._image=t,t.complete||t instanceof HTMLCanvasElement)this.handleLoadedTexture();else{var e=this;t.addEventListener("load",(function(){e.handleLoadedTexture()})),t.addEventListener("error",(function(t){cc.warnID(3119,t.message)}))}},initWithData:function(t,e,i,n){var r=d();return r.image=t,r.images=[r.image],r.genMipmaps=this._genMipmaps,r.premultiplyAlpha=this._premultiplyAlpha,r.flipY=this._flipY,r.minFilter=u[this._minFilter],r.magFilter=u[this._magFilter],r.wrapS=this._wrapS,r.wrapT=this._wrapT,r.format=this._getGFXPixelFormat(e),r.width=i,r.height=n,this._texture?this._texture.update(r):this._texture=new s.Texture2D(s.device,r),this.width=i,this.height=n,this._checkPackable(),this.loaded=!0,this.emit("load"),!0},getHtmlElementObj:function(){return this._image},destroy:function(){this._image=null,this._texture&&this._texture.destroy(),this._super()},getPixelFormat:function(){return this._format},hasPremultipliedAlpha:function(){return this._premultiplyAlpha||!1},handleLoadedTexture:function(){if(this._image&&this._image.width&&this._image.height){this.width=this._image.width,this.height=this._image.height;var t=d();t.image=this._image,t.images=[t.image],t.width=this.width,t.height=this.height,t.genMipmaps=this._genMipmaps,t.format=this._getGFXPixelFormat(this._format),t.premultiplyAlpha=this._premultiplyAlpha,t.flipY=this._flipY,t.minFilter=u[this._minFilter],t.magFilter=u[this._magFilter],t.wrapS=this._wrapS,t.wrapT=this._wrapT,this._texture?this._texture.update(t):this._texture=new s.Texture2D(s.device,t),this._checkPackable(),this.loaded=!0,this.emit("load"),cc.macro.CLEANUP_IMAGE_CACHE&&this._image instanceof HTMLImageElement&&this._clearImage()}},description:function(){return""},releaseTexture:function(){this._image=null,this._texture&&this._texture.destroy()},setWrapMode:function(t,e){if(this._wrapS!==t||this._wrapT!==e){var i=d();i.wrapS=t,i.wrapT=e,this.update(i)}},setFilters:function(t,e){if(this._minFilter!==t||this._magFilter!==e){var i=d();i.minFilter=t,i.magFilter=e,this.update(i)}},setFlipY:function(t){if(this._flipY!==t){var e=d();e.flipY=t,this.update(e)}},setPremultiplyAlpha:function(t){if(this._premultiplyAlpha!==t){var e=d();e.premultiplyAlpha=t,this.update(e)}},_checkPackable:function(){var t=cc.dynamicAtlasManager;if(t)if(this._isCompressed())this._packable=!1;else{var e=this.width,i=this.height;!this._image||e>t.maxFrameSize||i>t.maxFrameSize||e<=t.minFrameSize||i<=t.minFrameSize||this._getHash()!==t.Atlas.DEFAULT_HASH?this._packable=!1:this._image&&this._image instanceof HTMLCanvasElement&&(this._packable=!0)}},_getOpts:function(){var t=d();return t.width=this.width,t.height=this.height,t.genMipmaps=this._genMipmaps,t.format=this._format,t.premultiplyAlpha=this._premultiplyAlpha,t.anisotropy=this._anisotropy,t.flipY=this._flipY,t.minFilter=u[this._minFilter],t.magFilter=u[this._magFilter],t.mipFilter=u[this._mipFilter],t.wrapS=this._wrapS,t.wrapT=this._wrapT,t},_getGFXPixelFormat:function(t){return t===c.RGBA_ETC1?t=c.RGB_ETC1:t===c.RGB_A_PVRTC_4BPPV1?t=c.RGB_PVRTC_4BPPV1:t===c.RGB_A_PVRTC_2BPPV1&&(t=c.RGB_PVRTC_2BPPV1),t},_resetUnderlyingMipmaps:function(t){var e=this._getOpts();e.images=t||[null],this._texture?this._texture.update(e):this._texture=new s.Texture2D(s.device,e)},_serialize:!1,_deserialize:function(t,e){var i=cc.renderer.device,n=t.split(","),r=n[0];if(r){for(var s=r.split("_"),o="",a="",l=999,h=this._format,u=cc.macro.SUPPORT_TEXTURE_FORMATS,_=0;_E&&(E=R),RB&&(B=P),P=0){e.splice(i,1);for(var n=this._contacts,o=n.length-1;o>=0;o--){var a=n[o];a.collider1!==t&&a.collider2!==t||(a.touching&&this._doCollide(r.CollisionExit,a),n.splice(o,1))}t.node.off(s.GROUP_CHANGED,this.onNodeGroupChanged,this)}else cc.errorID(6600)},onNodeGroupChanged:function(t){for(var e=t.getComponents(cc.Collider),i=0,n=e.length;i0){t.moveTo(s[0].x,s[0].y);for(var o=1;or!=u>r&&n<(h-c)*(r-l)/(u-l)+c&&(i=!i)}return i}function a(t,e,i,n){var r,s=i.x-e.x,o=i.y-e.y,a=s*s+o*o,c=((t.x-e.x)*s+(t.y-e.y)*o)/a;return r=n?a?c<0?e:c>1?i:cc.v2(e.x+c*s,e.y+c*o):e:cc.v2(e.x+c*s,e.y+c*o),s=t.x-r.x,o=t.y-r.y,Math.sqrt(s*s+o*o)}n.lineLine=r,n.lineRect=function(t,e,i){var n=new cc.Vec2(i.x,i.y),s=new cc.Vec2(i.x,i.yMax),o=new cc.Vec2(i.xMax,i.yMax),a=new cc.Vec2(i.xMax,i.y);return!!(r(t,e,n,s)||r(t,e,s,o)||r(t,e,o,a)||r(t,e,a,n))},n.linePolygon=s,n.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,o=e.x,a=e.y,c=e.x+e.width,l=e.y+e.height;return i<=c&&r>=o&&n<=l&&s>=a},n.rectPolygon=function(t,e){var i,n,r=new cc.Vec2(t.x,t.y),a=new cc.Vec2(t.x,t.yMax),c=new cc.Vec2(t.xMax,t.yMax),l=new cc.Vec2(t.xMax,t.y);if(s(r,a,e))return!0;if(s(a,c,e))return!0;if(s(c,l,e))return!0;if(s(l,r,e))return!0;for(i=0,n=e.length;i>>1;r<=s;o=r+s>>>1){var a=t[o],c=a.constructor._executionOrder;if(c>i)s=o-1;else if(cn)s=o-1;else{if(!(l0&&(t.array.sort(h),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(h),this._invoke(e),e.array.length=0)}}),_=cc.Class({extends:l,add:function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=a(i,t);n<0&&i.splice(~n,0,t)}},remove:function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=a(i.array,t);n>=0&&i.removeAt(n)}},invoke:function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)}});function f(t,e,i,n){var r="var a=it.array;for(it.i=0;it.i=0?r.fastRemoveAt(this.scheduleInNextFrame,e):(!t.start||t._objFlags&s||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},enableComp:function(t,e){if(!(t._objFlags&o)){if(t.onEnable){if(e)return void e.add(t);if(t.onEnable(),!t.node._activeInHierarchy)return}this._onEnabled(t)}},disableComp:function(t){t._objFlags&o&&(t.onDisable&&t.onDisable(),this._onDisabled(t))},_scheduleImmediate:function(t){!t.start||t._objFlags&s||this.startInvoker.add(t),t.update&&this.updateInvoker.add(t),t.lateUpdate&&this.lateUpdateInvoker.add(t)},_deferredSchedule:function(){for(var t=this.scheduleInNextFrame,e=0,i=t.length;e0&&this._deferredSchedule(),this.startInvoker.invoke()},updatePhase:function(t){this.updateInvoker.invoke(t)},lateUpdatePhase:function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1}});e.exports=v}),{"./platform/CCClass":160,"./platform/CCObject":166,"./platform/js":180,"./utils/misc":249}],66:[(function(t,e,i){"use strict";var n=t("../../animation/animation-animator"),r=t("../../animation/animation-clip"),s=t("../event/event-target"),o=t("../platform/js");function a(t,e){return t===e||t&&e&&(t.name===e.name||t._uuid===e._uuid)}var c=cc.Enum({PLAY:"play",STOP:"stop",PAUSE:"pause",RESUME:"resume",LASTFRAME:"lastframe",FINISHED:"finished"}),l=cc.Class({name:"cc.Animation",extends:t("./CCComponent"),mixins:[s],editor:!1,statics:{EventType:c},ctor:function(){cc.EventTarget.call(this),this._animator=null,this._nameToState=o.createMap(!0),this._didInit=!1,this._currentClip=null},properties:{_defaultClip:{default:null,type:r},defaultClip:{type:r,get:function(){return this._defaultClip},set:function(t){},tooltip:!1},currentClip:{get:function(){return this._currentClip},set:function(t){this._currentClip=t},type:r,visible:!1},_writableClips:{get:function(){return this._clips},set:function(t){this._didInit=!1,this._clips=t,this._init()},type:[r]},_clips:{default:[],type:[r],tooltip:!1,visible:!0},playOnLoad:{default:!1,tooltip:!1}},start:function(){if(this.playOnLoad&&this._defaultClip&&!(this._animator&&this._animator.isPlaying)){var t=this.getAnimationState(this._defaultClip.name);this._animator.playState(t)}},onEnable:function(){this._animator&&this._animator.resume()},onDisable:function(){this._animator&&this._animator.pause()},onDestroy:function(){this.stop()},getClips:function(){return this._clips},play:function(t,e){var i=this.playAdditive(t,e);return this._animator.stopStatesExcept(i),i},playAdditive:function(t,e){this._init();var i=this.getAnimationState(t||this._defaultClip&&this._defaultClip.name);if(i){this.enabled=!0;var n=this._animator;n.isPlaying&&i.isPlaying?i.isPaused?n.resumeState(i):(n.stopState(i),n.playState(i,e)):n.playState(i,e),this.enabledInHierarchy||n.pause(),this.currentClip=i.clip}return i},stop:function(t){if(this._didInit)if(t){var e=this._nameToState[t];e&&this._animator.stopState(e)}else this._animator.stop()},pause:function(t){if(this._didInit)if(t){var e=this._nameToState[t];e&&this._animator.pauseState(e)}else this.enabled=!1},resume:function(t){if(this._didInit)if(t){var e=this._nameToState[t];e&&this._animator.resumeState(e)}else this.enabled=!0},setCurrentTime:function(t,e){if(this._init(),e){var i=this._nameToState[e];i&&this._animator.setStateTime(i,t)}else this._animator.setStateTime(t)},getAnimationState:function(t){this._init();var e=this._nameToState[t];return e&&!e.curveLoaded&&this._animator._reloadClip(e),e||null},addClip:function(t,e){if(t){this._init(),cc.js.array.contains(this._clips,t)||this._clips.push(t),e=e||t.name;var i=this._nameToState[e];if(i){if(i.clip===t)return i;var n=this._clips.indexOf(i.clip);-1!==n&&this._clips.splice(n,1)}var r=new cc.AnimationState(t,e);return this._nameToState[e]=r,r}cc.warnID(3900)},removeClip:function(t,e){if(t){this._init();var i=void 0;for(var n in this._nameToState){if((i=this._nameToState[n]).clip===t)break}if(t===this._defaultClip){if(!e)return void cc.warnID(3902);this._defaultClip=null}if(i&&i.isPlaying){if(!e)return void cc.warnID(3903);this.stop(i.name)}this._clips=this._clips.filter((function(e){return e!==t})),i&&delete this._nameToState[i.name]}else cc.warnID(3901)},sample:function(t){if(this._init(),t){var e=this._nameToState[t];e&&e.sample()}else this._animator.sample()},on:function(t,e,i,n){this._init();var r=this._EventTargetOn(t,e,i,n);if("lastframe"===t){var s=this._nameToState;for(var o in s)s[o]._lastframeEventOn=!0}return r},off:function(t,e,i,n){if(this._init(),"lastframe"===t){var r=this._nameToState;for(var s in r)r[s]._lastframeEventOn=!1}this._EventTargetOff(t,e,i,n)},_init:function(){this._didInit||(this._didInit=!0,this._animator=new n(this.node,this),this._createStates())},_createStates:function(){this._nameToState=o.createMap(!0);for(var t=null,e=!1,i=0;i0&&(i=this.time/this.duration),i>=1&&(i=1),this.transition===s.COLOR){var n=this._fromColor.lerp(this._toColor,i);this._setTargetColor(n)}else this.transition===s.SCALE&&this._originalScale&&(e.scale=this._fromScale.lerp(this._toScale,i));1===i&&(this._transitionFinished=!0)}},_registerNodeEvent:function(){this.node.on(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this),this.node.on(cc.Node.EventType.TOUCH_MOVE,this._onTouchMove,this),this.node.on(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this),this.node.on(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(cc.Node.EventType.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(cc.Node.EventType.MOUSE_LEAVE,this._onMouseMoveOut,this)},_unregisterNodeEvent:function(){this.node.off(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this),this.node.off(cc.Node.EventType.TOUCH_MOVE,this._onTouchMove,this),this.node.off(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this),this.node.off(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(cc.Node.EventType.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(cc.Node.EventType.MOUSE_LEAVE,this._onMouseMoveOut,this)},_registerTargetEvent:function(t){t.on(cc.Node.EventType.SCALE_CHANGED,this._onTargetScaleChanged,this)},_unregisterTargetEvent:function(t){t.off(cc.Node.EventType.SCALE_CHANGED,this._onTargetScaleChanged,this)},_getTargetSprite:function(t){var e=null;return t&&(e=t.getComponent(cc.Sprite)),e},_applyTarget:function(){var t=this._getTarget();this._sprite=this._getTargetSprite(t),this._originalScale||(this._originalScale=cc.Vec2.ZERO),this._originalScale.x=t.scaleX,this._originalScale.y=t.scaleY,this._registerTargetEvent(t)},_onTouchBegan:function(t){this.interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t.stopPropagation())},_onTouchMove:function(t){if(this.interactable&&this.enabledInHierarchy&&this._pressed){var e=t.touch,i=this.node._hitTest(e.getLocation()),n=this._getTarget(),r=this._originalScale;if(this.transition===s.SCALE&&r)i?(this._fromScale.x=r.x,this._fromScale.y=r.y,this._toScale.x=r.x*this.zoomScale,this._toScale.y=r.y*this.zoomScale,this._transitionFinished=!1):(this.time=0,this._transitionFinished=!0,n.setScale(r.x,r.y));else{var a=void 0;a=i?o.PRESSED:o.NORMAL,this._applyTransition(a)}t.stopPropagation()}},_onTouchEnded:function(t){this.interactable&&this.enabledInHierarchy&&(this._pressed&&(cc.Component.EventHandler.emitEvents(this.clickEvents,t),this.node.emit("click",this)),this._pressed=!1,this._updateState(),t.stopPropagation())},_onTouchCancel:function(){this.interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},_onMouseMoveIn:function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this.transition!==s.SPRITE||this.hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},_onMouseMoveOut:function(){this._hovered&&(this._hovered=!1,this._updateState())},_updateState:function(){var t=this._getButtonState();this._applyTransition(t),this._updateDisabledState()},_getButtonState:function(){return this.interactable?this._pressed?o.PRESSED:this._hovered?o.HOVER:o.NORMAL:o.DISABLED},_updateColorTransitionImmediately:function(t){var e=this._getStateColor(t);this._setTargetColor(e)},_updateColorTransition:function(t){if(t===o.DISABLED)this._updateColorTransitionImmediately(t);else{var e=this._getTarget(),i=this._getStateColor(t);this._fromColor=e.color.clone(),this._toColor=i,this.time=0,this._transitionFinished=!1}},_updateSpriteTransition:function(t){var e=this._getStateSprite(t);this._sprite&&e&&(this._sprite.spriteFrame=e)},_updateScaleTransition:function(t){t===o.PRESSED?this._zoomUp():this._zoomBack()},_zoomUp:function(){this._originalScale&&(this._fromScale.x=this._originalScale.x,this._fromScale.y=this._originalScale.y,this._toScale.x=this._originalScale.x*this.zoomScale,this._toScale.y=this._originalScale.y*this.zoomScale,this.time=0,this._transitionFinished=!1)},_zoomBack:function(){if(this._originalScale){var t=this._getTarget();this._fromScale.x=t.scaleX,this._fromScale.y=t.scaleY,this._toScale.x=this._originalScale.x,this._toScale.y=this._originalScale.y,this.time=0,this._transitionFinished=!1}},_updateTransition:function(t){t===s.COLOR?this._updateColorTransitionImmediately(o.NORMAL):t===s.SPRITE&&this._updateSpriteTransition(o.NORMAL),this._updateState()},_applyTransition:function(t){var e=this.transition;e===s.COLOR?this._updateColorTransition(t):e===s.SPRITE?this._updateSpriteTransition(t):e===s.SCALE&&this._updateScaleTransition(t)},_resizeNodeToTargetNode:!1,_updateDisabledState:function(){if(this._sprite){var t=!1;this.enableAutoGrayEffect&&(this.transition===s.SPRITE&&this.disabledSprite||this.interactable||(t=!0)),this._switchGrayMaterial(t,this._sprite)}}});cc.Button=e.exports=a}),{"../utils/gray-sprite-state":247,"./CCComponent":71}],70:[(function(t,e,i){"use strict";var n=t("../camera/CCCamera"),r=t("./CCComponent"),s=cc.Class({name:"cc.Canvas",extends:r,editor:!1,resetInEditor:!1,statics:{instance:null},properties:{_designResolution:cc.size(960,640),designResolution:{get:function(){return cc.size(this._designResolution)},set:function(t){this._designResolution.width=t.width,this._designResolution.height=t.height,this.applySettings(),this.alignWithScreen()},tooltip:!1},_fitWidth:!1,_fitHeight:!0,fitHeight:{get:function(){return this._fitHeight},set:function(t){this._fitHeight!==t&&(this._fitHeight=t,this.applySettings(),this.alignWithScreen())},tooltip:!1},fitWidth:{get:function(){return this._fitWidth},set:function(t){this._fitWidth!==t&&(this._fitWidth=t,this.applySettings(),this.alignWithScreen())},tooltip:!1}},ctor:function(){this._thisOnResized=this.alignWithScreen.bind(this)},__preload:function(){if(s.instance)return cc.errorID(6700,this.node.name,s.instance.node.name);s.instance=this,cc.sys.isMobile?window.addEventListener("resize",this._thisOnResized):cc.view.on("canvas-resize",this._thisOnResized),this.applySettings(),this.alignWithScreen();var t=cc.find("Main Camera",this.node);t||((t=new cc.Node("Main Camera")).parent=this.node,t.setSiblingIndex(0));var e=t.getComponent(n);if(!e){e=t.addComponent(n);var i=n.ClearFlags;e.clearFlags=i.COLOR|i.DEPTH|i.STENCIL,e.depth=-1}n.main=e},onDestroy:function(){cc.sys.isMobile?window.removeEventListener("resize",this._thisOnResized):cc.view.off("canvas-resize",this._thisOnResized),s.instance===this&&(s.instance=null)},alignWithScreen:function(){var t,e,i=e=cc.visibleRect;t=cc.view.getDesignResolutionSize();var n=0,r=0;!this.fitHeight&&!this.fitWidth&&(n=.5*(t.width-i.width),r=.5*(t.height-i.height)),this.node.setPosition(.5*i.width+n,.5*i.height+r),this.node.width=e.width,this.node.height=e.height},applySettings:function(){var t,e=cc.ResolutionPolicy;t=this.fitHeight&&this.fitWidth?e.SHOW_ALL:this.fitHeight||this.fitWidth?this.fitWidth?e.FIXED_WIDTH:e.FIXED_HEIGHT:e.NO_BORDER;var i=this._designResolution;cc.view.setDesignResolutionSize(i.width,i.height,t)}});cc.Canvas=e.exports=s}),{"../camera/CCCamera":56,"./CCComponent":71}],71:[(function(t,e,i){"use strict";var n=t("../platform/CCObject"),r=t("../platform/js"),s=new(t("../platform/id-generater"))("Comp"),o=(n.Flags.IsOnEnableCalled,n.Flags.IsOnLoadCalled),a=cc.Class({name:"cc.Component",extends:n,ctor:function(){this._id=s.getNewId(),this.__eventTargets=[]},properties:{node:{default:null,visible:!1},name:{get:function(){if(this._name)return this._name;var t=cc.js.getClassName(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node.name+"<"+t+">"},set:function(t){this._name=t},visible:!1},uuid:{get:function(){return this._id},visible:!1},__scriptAsset:!1,_enabled:!0,enabled:{get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node._activeInHierarchy)){var e=cc.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}},visible:!1,animatable:!0},enabledInHierarchy:{get:function(){return this._enabled&&this.node._activeInHierarchy},visible:!1},_isOnLoadCalled:{get:function(){return this._objFlags&o}}},update:null,lateUpdate:null,__preload:null,onLoad:null,start:null,onEnable:null,onDisable:null,onDestroy:null,onFocusInEditor:null,onLostFocusInEditor:null,resetInEditor:null,addComponent:function(t){return this.node.addComponent(t)},getComponent:function(t){return this.node.getComponent(t)},getComponents:function(t){return this.node.getComponents(t)},getComponentInChildren:function(t){return this.node.getComponentInChildren(t)},getComponentsInChildren:function(t){return this.node.getComponentsInChildren(t)},_getLocalBounds:null,onRestore:null,destroy:function(){this._super()&&this._enabled&&this.node._activeInHierarchy&&cc.director._compScheduler.disableComp(this)},_onPreDestroy:function(){this.unscheduleAllCallbacks();for(var t=this.__eventTargets,e=0,i=t.length;e=0,1620),e=e||0,i=isNaN(i)?cc.macro.REPEAT_FOREVER:i,n=n||0;var r=cc.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},scheduleOnce:function(t,e){this.schedule(t,0,0,e)},unschedule:function(t){t&&cc.director.getScheduler().unschedule(t,this)},unscheduleAllCallbacks:function(){cc.director.getScheduler().unscheduleAllForTarget(this)}});a._requireComponent=null,a._executionOrder=0,r.value(a,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),a.prototype.__scriptUuid="",cc.Component=e.exports=a}),{"../platform/CCObject":166,"../platform/id-generater":176,"../platform/js":180}],72:[(function(t,e,i){"use strict";cc.Component.EventHandler=cc.Class({name:"cc.ClickEvent",properties:{target:{default:null,type:cc.Node},component:"",_componentId:"",_componentName:{get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(t){this._componentId=this._compName2Id(t)}},handler:{default:""},customEventData:{default:""}},statics:{emitEvents:function(t){var e=void 0;if(arguments.length>0)for(var i=0,n=(e=new Array(arguments.length-1)).length;ip&&(p=m),B>=p&&(m=p,p=B,g=b.getAnchorPoint().y),this.horizontalDirection===c.RIGHT_TO_LEFT&&(w=1-b.anchorX),f=f+h*w*E+h*this.spacingX;var M=h*(1-w)*E;if(e){var I=f+M+h*(h>0?this.paddingRight:this.paddingLeft),R=this.horizontalDirection===c.LEFT_TO_RIGHT&&I>(1-o.x)*t,P=this.horizontalDirection===c.RIGHT_TO_LEFT&&I<-o.x*t;(R||P)&&(B>=p?(0===m&&(m=p),d+=m,m=p):(d+=p,m=B,p=0),f=_+h*(u+w*E),y++)}var D=i(b,d,y);t>=E+this.paddingLeft+this.paddingRight&&n&&b.setPosition(cc.v2(f,D));var L,O=1,V=0===p?B:p;this.verticalDirection===a.TOP_TO_BOTTOM?(v=v||this.node._contentSize.height,(L=D+(O=-1)*(V*g+this.paddingBottom))v&&(v=L)),f+=M}}return v},_getVerticalBaseHeight:function(t){var e=0,i=0;if(this.resizeMode===s.CONTAINER){for(var n=0;np&&(p=m),E>=p&&(m=p,p=E,g=b.getAnchorPoint().x),this.verticalDirection===a.TOP_TO_BOTTOM&&(w=1-b.anchorY),f=f+h*w*B+h*this.spacingY;var M=h*(1-w)*B;if(e){var I=f+M+h*(h>0?this.paddingTop:this.paddingBottom),R=this.verticalDirection===a.BOTTOM_TO_TOP&&I>(1-o.y)*t,P=this.verticalDirection===a.TOP_TO_BOTTOM&&I<-o.y*t;(R||P)&&(E>=p?(0===m&&(m=p),d+=m,m=p):(d+=p,m=E,p=0),f=_+h*(u+w*B),y++)}var D=i(b,d,y);t>=B+(this.paddingTop+this.paddingBottom)&&n&&b.setPosition(cc.v2(D,f));var L,O=1,V=0===p?E:p;this.horizontalDirection===c.RIGHT_TO_LEFT?(O=-1,v=v||this.node._contentSize.width,(L=D+O*(V*g+this.paddingLeft))v&&(v=L)),f+=M}}return v},_doLayoutBasic:function(){for(var t=this.node.children,e=null,i=0;i0&&(this._doLayout(),this._layoutDirty=!1)}});Object.defineProperty(l.prototype,"padding",{get:function(){return cc.warnID(4100),this.paddingLeft},set:function(t){this._N$padding=t,this._migratePaddingData(),this._doLayoutDirty()}}),cc.Layout=e.exports=l}),{"../CCNode":30,"./CCComponent":71}],75:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../renderer/gfx")),r=t("../vmath");var s=t("../utils/misc"),o=t("../assets/material/CCMaterial"),a=t("./CCRenderComponent"),c=t("../renderer/render-flow"),l=t("../graphics/graphics"),h=t("../CCNode"),u=cc.v2(),_=r.mat4.create(),f=[];function d(t,e,i){f.length=0;for(var n=2*Math.PI/i,r=0;r=0&&o.y>=0&&o.x<=n&&o.y<=s;else if(this.type===p.ELLIPSE){var c=n/2,l=s/2,h=o.x-.5*n,f=o.y-.5*s;a=h*h/(c*c)+f*f/(l*l)<1}return this.inverted&&(a=!a),a},markForUpdateRenderData:function(t){t&&this.enabledInHierarchy?this.node._renderFlag|=c.FLAG_UPDATE_RENDER_DATA:t||(this.node._renderFlag&=~c.FLAG_UPDATE_RENDER_DATA)},markForRender:function(t){t&&this.enabledInHierarchy?this.node._renderFlag|=c.FLAG_RENDER|c.FLAG_UPDATE_RENDER_DATA|c.FLAG_POST_RENDER:t||(this.node._renderFlag&=~(c.FLAG_RENDER|c.FLAG_POST_RENDER))},disableRender:function(){this.node._renderFlag&=~(c.FLAG_RENDER|c.FLAG_UPDATE_RENDER_DATA|c.FLAG_POST_RENDER)}});cc.Mask=e.exports=m}),{"../../renderer/gfx":308,"../CCNode":30,"../assets/material/CCMaterial":53,"../graphics/graphics":107,"../renderer/render-flow":208,"../utils/misc":249,"../vmath":274,"./CCRenderComponent":80}],76:[(function(t,e,i){"use strict";var n=t("../components/CCRenderComponent"),r=t("../assets/material/CCMaterial"),s=t("../utils/texture-util"),o=t("../../core/utils/blend-func"),a=cc.Class({name:"cc.MotionStreak",extends:n,mixins:[o],editor:!1,ctor:function(){this._points=[]},properties:{preview:{default:!1,editorOnly:!0,notify:!1,animatable:!1},_fadeTime:1,fadeTime:{get:function(){return this._fadeTime},set:function(t){this._fadeTime=t,this.reset()},animatable:!1,tooltip:!1},_minSeg:1,minSeg:{get:function(){return this._minSeg},set:function(t){this._minSeg=t},animatable:!1,tooltip:!1},_stroke:64,stroke:{get:function(){return this._stroke},set:function(t){this._stroke=t},animatable:!1,tooltip:!1},_texture:{default:null,type:cc.Texture2D},texture:{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture=t,t&&t.loaded?this._activateMaterial():(this.disableRender(),this._ensureLoadTexture()))},type:cc.Texture2D,animatable:!1,tooltip:!1},_color:cc.Color.WHITE,color:{get:function(){return this._color},set:function(t){this._color=t},type:cc.Color,tooltip:!1},_fastMode:!1,fastMode:{get:function(){return this._fastMode},set:function(t){this._fastMode=t},animatable:!1,tooltip:!1}},onEnable:function(){this._super(),this._texture&&this._texture.loaded?this._activateMaterial():(this.disableRender(),this._ensureLoadTexture()),this.reset()},_ensureLoadTexture:function(){if(this._texture&&!this._texture.loaded){var t=this;s.postLoadTexture(this._texture,(function(){t._activateMaterial()}))}},_activateMaterial:function(){if(this._texture&&this._texture.loaded){var t=this.sharedMaterials[0];(t=t?r.getInstantiatedMaterial(t,this):r.getInstantiatedBuiltinMaterial("2d-sprite",this)).setProperty("texture",this._texture),this.setMaterial(0,t),this.markForRender(!0)}else this.disableRender()},onFocusInEditor:!1,onLostFocusInEditor:!1,reset:function(){this._points.length=0,this._assembler._renderData.clear()},update:function(t){this._assembler.update(this,t)}});cc.MotionStreak=e.exports=a}),{"../../core/utils/blend-func":244,"../assets/material/CCMaterial":53,"../components/CCRenderComponent":80,"../utils/texture-util":256}],77:[(function(t,e,i){"use strict";var n=cc.Enum({Unified:0,Free:1}),r=cc.Enum({Horizontal:0,Vertical:1}),s=cc.Enum({PAGE_TURNING:0}),o=cc.Class({name:"cc.PageView",extends:cc.ScrollView,editor:!1,ctor:function(){this._curPageIdx=0,this._lastPageIdx=0,this._pages=[],this._initContentPos=cc.v2(),this._scrollCenterOffsetX=[],this._scrollCenterOffsetY=[]},properties:{sizeMode:{default:n.Unified,type:n,tooltip:!1,notify:function(){this._syncSizeMode()}},direction:{default:r.Horizontal,type:r,tooltip:!1,notify:function(){this._syncScrollDirection()}},scrollThreshold:{default:.5,type:cc.Float,slide:!0,range:[0,1,.01],tooltip:!1},autoPageTurningThreshold:{default:100,type:cc.Float,tooltip:!1},pageTurningEventTiming:{default:.1,type:cc.Float,range:[0,1,.01],tooltip:!1},indicator:{default:null,type:cc.PageViewIndicator,tooltip:!1,notify:function(){this.indicator&&this.indicator.setPageView(this)}},pageTurningSpeed:{default:.3,type:cc.Float,tooltip:!1},pageEvents:{default:[],type:cc.Component.EventHandler,tooltip:!1}},statics:{SizeMode:n,Direction:r,EventType:s},__preload:function(){this.node.on(cc.Node.EventType.SIZE_CHANGED,this._updateAllPagesSize,this)},onEnable:function(){this._super(),this.node.on("scroll-ended-with-threshold",this._dispatchPageTurningEvent,this)},onDisable:function(){this._super(),this.node.off("scroll-ended-with-threshold",this._dispatchPageTurningEvent,this)},onLoad:function(){this._initPages(),this.indicator&&this.indicator.setPageView(this)},onDestroy:function(){this.node.off(cc.Node.EventType.SIZE_CHANGED,this._updateAllPagesSize,this)},getCurrentPageIndex:function(){return this._curPageIdx},setCurrentPageIndex:function(t){this.scrollToPage(t,!0)},getPages:function(){return this._pages},addPage:function(t){t&&-1===this._pages.indexOf(t)&&this.content&&(this.content.addChild(t),this._pages.push(t),this._updatePageView())},insertPage:function(t,e){e<0||!t||-1!==this._pages.indexOf(t)||!this.content||(e>=this._pages.length?this.addPage(t):(this._pages.splice(e,0,t),this.content.addChild(t),this._updatePageView()))},removePage:function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):cc.warnID(4300,t.name)}},removePageAtIndex:function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},removeAllPages:function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(e=void 0!==e?e:.3,this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},getScrollEndedEventTiming:function(){return this.pageTurningEventTiming},_syncScrollDirection:function(){this.horizontal=this.direction===r.Horizontal,this.vertical=this.direction===r.Vertical},_syncSizeMode:function(){if(this.content){var t=this.content.getComponent(cc.Layout);if(t){if(this.sizeMode===n.Free&&this._pages.length>0){var e=this._pages[this._pages.length-1];this.direction===r.Horizontal?(t.paddingLeft=(this._view.width-this._pages[0].width)/2,t.paddingRight=(this._view.width-e.width)/2):this.direction===r.Vertical&&(t.paddingTop=(this._view.height-this._pages[0].height)/2,t.paddingBottom=(this._view.height-e.height)/2)}t.updateLayout()}}},_updatePageView:function(){var t=this.content.getComponent(cc.Layout);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},_dispatchPageTurningEvent:function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,cc.Component.EventHandler.emitEvents(this.pageEvents,this,s.PAGE_TURNING),this.node.emit("page-turning",this))},_isScrollable:function(t,e,i){if(this.sizeMode===n.Free){var s,o;if(this.direction===r.Horizontal)return s=this._scrollCenterOffsetX[e],o=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(s-o)*this.scrollThreshold;if(this.direction===r.Vertical)return s=this._scrollCenterOffsetY[e],o=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(s-o)*this.scrollThreshold}else{if(this.direction===r.Horizontal)return Math.abs(t.x)>=this._view.width*this.scrollThreshold;if(this.direction===r.Vertical)return Math.abs(t.y)>=this._view.height*this.scrollThreshold}},_isQuicklyScrollable:function(t){if(this.direction===r.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===r.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},_moveOffsetValue:function(t){var e=cc.v2(0,0);return this.sizeMode===n.Free?this.direction===r.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===r.Vertical&&(e.y=this._scrollCenterOffsetY[t]):this.direction===r.Horizontal?e.x=t*this._view.width:this.direction===r.Vertical&&(e.y=t*this._view.height),e},_getDragDirection:function(t){return this.direction===r.Horizontal?0===t.x?0:t.x>0?1:-1:this.direction===r.Vertical?0===t.y?0:t.y<0?1:-1:void 0},_handleReleaseLogic:function(t){this._autoScrollToPage(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent("scroll-ended"))},_autoScrollToPage:function(){var t=this._startBounceBackIfNeeded(),e=this._touchBeganPosition.sub(this._touchEndPosition);if(t){var i=this._getDragDirection(e);if(0===i)return;this._curPageIdx=i>0?this._pages.length-1:0,this.indicator&&this.indicator._changedState()}else{var n=this._curPageIdx,r=n+this._getDragDirection(e),s=this.pageTurningSpeed*Math.abs(n-r);if(r=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}}});cc.PageViewIndicator=e.exports=r}),{"./CCComponent":71}],79:[(function(t,e,i){"use strict";var n=t("../utils/misc"),r=t("./CCComponent"),s=cc.Enum({HORIZONTAL:0,VERTICAL:1,FILLED:2}),o=cc.Class({name:"cc.ProgressBar",extends:r,editor:!1,_initBarSprite:function(){if(this.barSprite){var t=this.barSprite.node;if(!t)return;var e=this.node.getContentSize(),i=this.node.getAnchorPoint(),n=t.getContentSize();t.parent===this.node&&this.node.setContentSize(n),this.barSprite.fillType===cc.Sprite.FillType.RADIAL&&(this.mode=s.FILLED);var r=t.getContentSize();if(this.mode===s.HORIZONTAL?this.totalLength=r.width:this.mode===s.VERTICAL?this.totalLength=r.height:this.totalLength=this.barSprite.fillRange,t.parent===this.node){var o=-e.width*i.x;t.setPosition(cc.v2(o,0))}}},_updateBarStatus:function(){if(this.barSprite){var t=this.barSprite.node;if(!t)return;var e,i,r,o=t.getAnchorPoint(),a=t.getContentSize(),c=t.getPosition(),l=cc.v2(0,.5),h=n.clamp01(this.progress),u=this.totalLength*h;switch(this.mode){case s.HORIZONTAL:this.reverse&&(l=cc.v2(1,.5)),e=cc.size(u,a.height),i=this.totalLength,r=a.height;break;case s.VERTICAL:l=this.reverse?cc.v2(.5,1):cc.v2(.5,0),e=cc.size(a.width,u),i=a.width,r=this.totalLength}if(this.mode===s.FILLED)this.barSprite.type!==cc.Sprite.Type.FILLED?cc.warn("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"):(this.reverse&&(u*=-1),this.barSprite.fillRange=u);else if(this.barSprite.type!==cc.Sprite.Type.FILLED){var _=l.x-o.x,f=l.y-o.y,d=cc.v2(i*_,r*f);t.setPosition(c.x+d.x,c.y+d.y),t.setAnchorPoint(l),t.setContentSize(e)}else cc.warn("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")}},properties:{barSprite:{default:null,type:cc.Sprite,tooltip:!1,notify:function(){this._initBarSprite()},animatable:!1},mode:{default:s.HORIZONTAL,type:s,tooltip:!1,notify:function(){if(this.barSprite){var t=this.barSprite.node;if(!t)return;var e=t.getContentSize();this.mode===s.HORIZONTAL?this.totalLength=e.width:this.mode===s.VERTICAL?this.totalLength=e.height:this.mode===s.FILLED&&(this.totalLength=this.barSprite.fillRange)}},animatable:!1},_N$totalLength:1,totalLength:{range:[0,Number.MAX_VALUE],tooltip:!1,get:function(){return this._N$totalLength},set:function(t){this.mode===s.FILLED&&(t=n.clamp01(t)),this._N$totalLength=t,this._updateBarStatus()}},progress:{default:1,type:cc.Float,range:[0,1,.1],slide:!0,tooltip:!1,notify:function(){this._updateBarStatus()}},reverse:{default:!1,tooltip:!1,notify:function(){this.barSprite&&(this.barSprite.fillStart=1-this.barSprite.fillStart),this._updateBarStatus()},animatable:!1}},statics:{Mode:s}});cc.ProgressBar=e.exports=o}),{"../utils/misc":249,"./CCComponent":71}],80:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../renderer/assembler"));var r=t("./CCComponent"),s=t("../renderer/render-flow"),o=t("../assets/material/CCMaterial"),a=cc.Class({name:"RenderComponent",extends:r,editor:!1,properties:{_materials:{default:[],type:o},sharedMaterials:{get:function(){return this._materials},set:function(t){this._materials=t,this._activateMaterial(!0)},type:[o],displayName:"Materials",animatable:!1}},ctor:function(){this._vertsDirty=!0,this._material=null,this._assembler=null},_resetAssembler:function(){this.setVertsDirty(!0),n.default.init(this),this._updateColor()},__preload:function(){this._resetAssembler()},onEnable:function(){this.node._renderComponent&&(this.node._renderComponent.enabled=!1),this.node._renderComponent=this,this.node.on(cc.Node.EventType.SIZE_CHANGED,this._onNodeSizeDirty,this),this.node.on(cc.Node.EventType.ANCHOR_CHANGED,this._onNodeSizeDirty,this),this.node._renderFlag|=s.FLAG_RENDER|s.FLAG_UPDATE_RENDER_DATA|s.FLAG_OPACITY_COLOR},onDisable:function(){this.node._renderComponent=null,this.node.off(cc.Node.EventType.SIZE_CHANGED,this._onNodeSizeDirty,this),this.node.off(cc.Node.EventType.ANCHOR_CHANGED,this._onNodeSizeDirty,this),this.disableRender()},onDestroy:function(){this._materials.length=0},setVertsDirty:function(){this._vertsDirty=!0,this.markForUpdateRenderData(!0)},_onNodeSizeDirty:function(){this.setVertsDirty()},_on3DNodeChanged:function(){this.setVertsDirty()},_canRender:function(){return this._enabled&&this.node._activeInHierarchy},markForUpdateRenderData:function(t){t&&this._canRender()?this.node._renderFlag|=s.FLAG_UPDATE_RENDER_DATA:t||(this.node._renderFlag&=~s.FLAG_UPDATE_RENDER_DATA)},markForRender:function(t){t&&this._canRender()?this.node._renderFlag|=s.FLAG_RENDER:t||(this.node._renderFlag&=~s.FLAG_RENDER)},disableRender:function(){this.node._renderFlag&=~(s.FLAG_RENDER|s.FLAG_UPDATE_RENDER_DATA)},getMaterial:function(t){if(t<0||t>=this._materials.length)return null;var e=this._materials[t];if(!e)return null;var i=o.getInstantiatedMaterial(e,this);return i!==e&&this.setMaterial(t,i),this._materials[t]},setMaterial:function(t,e){this._materials[t]=e,e&&this.markForUpdateRenderData(!0)},_activateMaterial:function(t){},_updateColor:function(){this._assembler.updateColor&&this._assembler.updateColor(this)},_checkBacth:function(t,e){var i=this.sharedMaterials[0];(i&&i.getHash()!==t.material.getHash()||t.cullingMask!==e)&&(t._flush(),t.node=i.getDefine("CC_USE_MODEL")?this.node:t._dummyNode,t.material=i,t.cullingMask=e)}});cc.RenderComponent=e.exports=a}),{"../assets/material/CCMaterial":53,"../renderer/assembler":187,"../renderer/render-flow":208,"./CCComponent":71}],81:[(function(t,e,i){"use strict";var n=t("../utils/misc"),r=(t("./CCComponent"),cc.Enum({HORIZONTAL:0,VERTICAL:1})),s=cc.Class({name:"cc.Scrollbar",extends:t("./CCComponent"),editor:!1,properties:{_scrollView:null,_touching:!1,_autoHideRemainingTime:{default:0,serializable:!1},_opacity:255,handle:{default:null,type:cc.Sprite,tooltip:!1,notify:function(){this._onScroll(cc.v2(0,0))},animatable:!1},direction:{default:r.HORIZONTAL,type:r,tooltip:!1,notify:function(){this._onScroll(cc.v2(0,0))},animatable:!1},enableAutoHide:{default:!0,animatable:!1,tooltip:!1},autoHideTime:{default:1,animatable:!1,tooltip:!1}},statics:{Direction:r},setTargetScrollView:function(t){this._scrollView=t},_convertToScrollViewSpace:function(t){var e=this._scrollView.node,i=t.convertToWorldSpaceAR(cc.v2(-t.anchorX*t.width,-t.anchorY*t.height)),n=e.convertToNodeSpaceAR(i);return n.x+=e.anchorX*e.width,n.y+=e.anchorY*e.height,n},_setOpacity:function(t){this.handle&&(this.node.opacity=t,this.handle.node.opacity=t)},_onScroll:function(t){if(this._scrollView){var e=this._scrollView.content;if(e){var i=e.getContentSize(),n=this._scrollView.node.getContentSize(),s=this.node.getContentSize();if(this._conditionalDisableScrollBar(i,n))return;this.enableAutoHide&&(this._autoHideRemainingTime=this.autoHideTime,this._setOpacity(this._opacity));var o=0,a=0,c=0,l=0,h=0;this.direction===r.HORIZONTAL?(o=i.width,a=n.width,h=s.width,c=t.x,l=-this._convertToScrollViewSpace(e).x):this.direction===r.VERTICAL&&(o=i.height,a=n.height,h=s.height,c=t.y,l=-this._convertToScrollViewSpace(e).y);var u=this._calculateLength(o,a,h,c),_=this._calculatePosition(o,a,h,l,c,u);this._updateLength(u),this._updateHanlderPosition(_)}}},_updateHanlderPosition:function(t){if(this.handle){var e=this._fixupHandlerPosition();this.handle.node.setPosition(t.x+e.x,t.y+e.y)}},_fixupHandlerPosition:function(){var t=this.node.getContentSize(),e=this.node.getAnchorPoint(),i=this.handle.node.getContentSize(),n=this.handle.node.parent,s=this.node.convertToWorldSpaceAR(cc.v2(-t.width*e.x,-t.height*e.y)),o=n.convertToNodeSpaceAR(s);return this.direction===r.HORIZONTAL?o=cc.v2(o.x,o.y+(t.height-i.height)/2):this.direction===r.VERTICAL&&(o=cc.v2(o.x+(t.width-i.width)/2,o.y)),this.handle.node.setPosition(o),o},_onTouchBegan:function(){this.enableAutoHide&&(this._touching=!0)},_conditionalDisableScrollBar:function(t,e){return t.width<=e.width&&this.direction===r.HORIZONTAL||t.height<=e.height&&this.direction===r.VERTICAL},_onTouchEnded:function(){if(this.enableAutoHide&&(this._touching=!1,!(this.autoHideTime<=0))){if(this._scrollView){var t=this._scrollView.content;if(t){var e=t.getContentSize(),i=this._scrollView.node.getContentSize();if(this._conditionalDisableScrollBar(e,i))return}}this._autoHideRemainingTime=this.autoHideTime}},_calculateLength:function(t,e,i,n){var r=t;return n&&(r+=20*(n>0?n:-n)),i*(e/r)},_calculatePosition:function(t,e,i,s,o,a){var c=t-e;o&&(c+=Math.abs(o));var l=0;c&&(l=s/c,l=n.clamp01(l));var h=(i-a)*l;return this.direction===r.VERTICAL?cc.v2(0,h):cc.v2(h,0)},_updateLength:function(t){if(this.handle){var e=this.handle.node,i=e.getContentSize();e.setAnchorPoint(cc.v2(0,0)),this.direction===r.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},_processAutoHide:function(t){if(this.enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this.autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this.autoHideTime);this._setOpacity(e)}},start:function(){this.enableAutoHide&&this._setOpacity(0)},hide:function(){this._autoHideRemainingTime=0,this._setOpacity(0)},show:function(){this._autoHideRemainingTime=this.autoHideTime,this._setOpacity(this._opacity)},update:function(t){this._processAutoHide(t)}});cc.Scrollbar=e.exports=s}),{"../utils/misc":249,"./CCComponent":71}],82:[(function(t,e,i){"use strict";var n=t("../CCNode").EventType,r=function(t){return(t-=1)*t*t*t*t+1},s=function(){return(new Date).getMilliseconds()},o=cc.Enum({SCROLL_TO_TOP:0,SCROLL_TO_BOTTOM:1,SCROLL_TO_LEFT:2,SCROLL_TO_RIGHT:3,SCROLLING:4,BOUNCE_TOP:5,BOUNCE_BOTTOM:6,BOUNCE_LEFT:7,BOUNCE_RIGHT:8,SCROLL_ENDED:9,TOUCH_UP:10,AUTOSCROLL_ENDED_WITH_THRESHOLD:11,SCROLL_BEGAN:12}),a={"scroll-to-top":o.SCROLL_TO_TOP,"scroll-to-bottom":o.SCROLL_TO_BOTTOM,"scroll-to-left":o.SCROLL_TO_LEFT,"scroll-to-right":o.SCROLL_TO_RIGHT,scrolling:o.SCROLLING,"bounce-bottom":o.BOUNCE_BOTTOM,"bounce-left":o.BOUNCE_LEFT,"bounce-right":o.BOUNCE_RIGHT,"bounce-top":o.BOUNCE_TOP,"scroll-ended":o.SCROLL_ENDED,"touch-up":o.TOUCH_UP,"scroll-ended-with-threshold":o.AUTOSCROLL_ENDED_WITH_THRESHOLD,"scroll-began":o.SCROLL_BEGAN},c=cc.Class({name:"cc.ScrollView",extends:t("./CCViewGroup"),editor:!1,ctor:function(){this._topBoundary=0,this._bottomBoundary=0,this._leftBoundary=0,this._rightBoundary=0,this._touchMoveDisplacements=[],this._touchMoveTimeDeltas=[],this._touchMovePreviousTimestamp=0,this._touchMoved=!1,this._autoScrolling=!1,this._autoScrollAttenuate=!1,this._autoScrollStartPosition=cc.v2(0,0),this._autoScrollTargetDelta=cc.v2(0,0),this._autoScrollTotalTime=0,this._autoScrollAccumulatedTime=0,this._autoScrollCurrentlyOutOfBoundary=!1,this._autoScrollBraking=!1,this._autoScrollBrakingStartPosition=cc.v2(0,0),this._outOfBoundaryAmount=cc.v2(0,0),this._outOfBoundaryAmountDirty=!0,this._stopMouseWheel=!1,this._mouseWheelEventElapsedTime=0,this._isScrollEndedWithThresholdEventFired=!1,this._scrollEventEmitMask=0,this._isBouncing=!1,this._scrolling=!1},properties:{content:{default:void 0,type:cc.Node,tooltip:!1,formerlySerializedAs:"content",notify:function(t){this._calculateBoundary()}},horizontal:{default:!0,animatable:!1,tooltip:!1},vertical:{default:!0,animatable:!1,tooltip:!1},inertia:{default:!0,tooltip:!1},brake:{default:.5,type:cc.Float,range:[0,1,.1],tooltip:!1},elastic:{default:!0,animatable:!1,tooltip:!1},bounceDuration:{default:1,range:[0,10],tooltip:!1},horizontalScrollBar:{default:void 0,type:cc.Scrollbar,tooltip:!1,notify:function(){this.horizontalScrollBar&&(this.horizontalScrollBar.setTargetScrollView(this),this._updateScrollBar(0))},animatable:!1},verticalScrollBar:{default:void 0,type:cc.Scrollbar,tooltip:!1,notify:function(){this.verticalScrollBar&&(this.verticalScrollBar.setTargetScrollView(this),this._updateScrollBar(0))},animatable:!1},scrollEvents:{default:[],type:cc.Component.EventHandler,tooltip:!1},cancelInnerEvents:{default:!0,animatable:!1,tooltip:!1},_view:{get:function(){if(this.content)return this.content.parent}}},statics:{EventType:o},scrollToBottom:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,0),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i,!0)},scrollToTop:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,1),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToLeft:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToRight:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(1,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToTopLeft:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToTopRight:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(1,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToBottomLeft:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(0,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToBottomRight:function(t,e){var i=this._calculateMovePercentDelta({anchor:cc.v2(1,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},scrollToOffset:function(t,e,i){var n=this.getMaxScrollOffset(),r=cc.v2(0,0);0===n.x?r.x=0:r.x=t.x/n.x,0===n.y?r.y=1:r.y=(n.y-t.y)/n.y,this.scrollTo(r,e,i)},getScrollOffset:function(){var t=this._getContentTopBoundary()-this._topBoundary,e=this._getContentLeftBoundary()-this._leftBoundary;return cc.v2(e,t)},getMaxScrollOffset:function(){var t=this._view.getContentSize(),e=this.content.getContentSize(),i=e.width-t.width,n=e.height-t.height;return i=i>=0?i:0,n=n>=0?n:0,cc.v2(i,n)},scrollToPercentHorizontal:function(t,e,i){var n=this._calculateMovePercentDelta({anchor:cc.v2(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},scrollTo:function(t,e,i){var n=this._calculateMovePercentDelta({anchor:cc.v2(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},scrollToPercentVertical:function(t,e,i){var n=this._calculateMovePercentDelta({anchor:cc.v2(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},stopAutoScroll:function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},setContentPosition:function(t){t.fuzzyEquals(this.getContentPosition(),1e-4)||(this.content.setPosition(t),this._outOfBoundaryAmountDirty=!0)},getContentPosition:function(){return this.content.getPosition()},isScrolling:function(){return this._scrolling},isAutoScrolling:function(){return this._autoScrolling},_registerEvent:function(){this.node.on(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(cc.Node.EventType.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(cc.Node.EventType.MOUSE_WHEEL,this._onMouseWheel,this,!0)},_unregisterEvent:function(){this.node.off(cc.Node.EventType.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(cc.Node.EventType.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(cc.Node.EventType.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(cc.Node.EventType.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(cc.Node.EventType.MOUSE_WHEEL,this._onMouseWheel,this,!0)},_onMouseWheel:function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=cc.v2(0,0),n=-.1;0,this.vertical?i=cc.v2(0,t.getScrollY()*n):this.horizontal&&(i=cc.v2(t.getScrollY()*n,0)),this._mouseWheelEventElapsedTime=0,this._processDeltaMove(i),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60),this._stopMouseWheel=!0),this._stopPropagationIfTargetIsMe(t)}},_checkMouseWheel:function(t){if(!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0,0),1e-4))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._stopMouseWheel=!1)},_calculateMovePercentDelta:function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e=e.clampf(cc.v2(0,0),cc.v2(1,1));var r=this._view.getContentSize(),s=this.content.getContentSize(),o=this._getContentBottomBoundary()-this._bottomBoundary;o=-o;var a=this._getContentLeftBoundary()-this._leftBoundary;a=-a;var c=cc.v2(0,0),l=0;return i&&(l=s.width-r.width,c.x=a-l*e.x),n&&(l=s.height-r.height,c.y=o-l*e.y),c},_moveContentToTopLeft:function(t){var e=this.content.getContentSize(),i=this._getContentBottomBoundary()-this._bottomBoundary;i=-i;var n=cc.v2(0,0),r=0,s=this._getContentLeftBoundary()-this._leftBoundary;s=-s,e.height7&&!this._touchMoved&&t.target!==this.node){var n=new cc.Event.EventTouch(t.getTouches(),t.bubbles);n.type=cc.Node.EventType.TOUCH_CANCEL,n.touch=t.touch,n.simulate=!0,t.target.dispatchEvent(n),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},_onTouchEnded:function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent("touch-up");var i=t.touch;this.content&&this._handleReleaseLogic(i),this._touchMoved?t.stopPropagation():this._stopPropagationIfTargetIsMe(t)}},_onTouchCancelled:function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){if(!t.simulate){var i=t.touch;this.content&&this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},_processDeltaMove:function(t){this._scrollChildren(t),this._gatherTouchMove(t)},_handleMoveLogic:function(t){var e=t.getDelta();this._processDeltaMove(e)},_scrollChildren:function(t){var e=t=this._clampDelta(t),i=void 0;this.elastic&&(i=this._getHowMuchOutOfBoundary(),e.x*=0===i.x?1:.5,e.y*=0===i.y?1:.5),this.elastic||(i=this._getHowMuchOutOfBoundary(e),e=e.add(i));var n=-1;if(e.y>0)this.content.y-this.content.anchorY*this.content.height+e.y>this._bottomBoundary&&(n="scroll-to-bottom");else if(e.y<0){this.content.y-this.content.anchorY*this.content.height+this.content.height+e.y<=this._topBoundary&&(n="scroll-to-top")}if(e.x<0)this.content.x-this.content.anchorX*this.content.width+this.content.width+e.x<=this._rightBoundary&&(n="scroll-to-right");else if(e.x>0){this.content.x-this.content.anchorX*this.content.width+e.x>=this._leftBoundary&&(n="scroll-to-left")}this._moveContent(e,!1),0===e.x&&0===e.y||(this._scrolling||(this._scrolling=!0,this._dispatchEvent("scroll-began")),this._dispatchEvent("scrolling")),-1!==n&&this._dispatchEvent(n)},_handlePressLogic:function(){this._autoScrolling&&this._dispatchEvent("scroll-ended"),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=s(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},_clampDelta:function(t){var e=this.content.getContentSize(),i=this._view.getContentSize();return e.width=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(t);var e=s();this._touchMoveTimeDeltas.push((e-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=e},_startBounceBackIfNeeded:function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if((t=this._clampDelta(t)).fuzzyEquals(cc.v2(0,0),1e-4))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent("bounce-top"),t.y<0&&this._dispatchEvent("bounce-bottom"),t.x>0&&this._dispatchEvent("bounce-right"),t.x<0&&this._dispatchEvent("bounce-left"),this._isBouncing=!0),!0},_processInertiaScroll:function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.fuzzyEquals(cc.v2(0,0),1e-4)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},_handleReleaseLogic:function(t){var e=t.getDelta();this._gatherTouchMove(e),this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent("scroll-ended"))},_isOutOfBoundary:function(){return!this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0,0),1e-4)},_isNecessaryAutoScrollBrake:function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,this._autoScrollBrakingStartPosition=this.getContentPosition(),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},getScrollEndedEventTiming:function(){return 1e-4},_processAutoScrolling:function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r(n));var s=this._autoScrollStartPosition.add(this._autoScrollTargetDelta.mul(n)),o=Math.abs(n-1)<=1e-4;if(Math.abs(n-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent("scroll-ended-with-threshold"),this._isScrollEndedWithThresholdEventFired=!0),this.elastic&&!o){var a=s.sub(this._autoScrollBrakingStartPosition);e&&(a=a.mul(i)),s=this._autoScrollBrakingStartPosition.add(a)}else{var c=s.sub(this.getContentPosition()),l=this._getHowMuchOutOfBoundary(c);l.fuzzyEquals(cc.v2(0,0),1e-4)||(s=s.add(l),o=!0)}o&&(this._autoScrolling=!1);var h=s.sub(this.getContentPosition());this._moveContent(this._clampDelta(h),o),this._dispatchEvent("scrolling"),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent("scroll-ended"))},_startInertiaScroll:function(t){var e=t.mul(.7);this._startAttenuatingAutoScroll(e,t)},_calculateAttenuatedFactor:function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},_startAttenuatingAutoScroll:function(t,e){var i=this._calculateAutoScrollTimeByInitalSpeed(e.mag()),n=t.normalize(),r=this.content.getContentSize(),s=this._view.getContentSize(),o=r.width-s.width,a=r.height-s.height,c=this._calculateAttenuatedFactor(o),l=this._calculateAttenuatedFactor(a);n=cc.v2(n.x*o*(1-this.brake)*c,n.y*a*l*(1-this.brake));var h=t.mag(),u=n.mag()/h;n=n.add(t),this.brake>0&&u>7&&(u=Math.sqrt(u),n=t.mul(u).add(t)),this.brake>0&&u>3&&(i*=u=3),0===this.brake&&u>1&&(i*=u),this._startAutoScroll(n,i,!0)},_calculateAutoScrollTimeByInitalSpeed:function(t){return Math.sqrt(Math.sqrt(t/5))},_startAutoScroll:function(t,e,i){var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,this._autoScrollStartPosition=this.getContentPosition(),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition=cc.v2(0,0),this._getHowMuchOutOfBoundary().fuzzyEquals(cc.v2(0,0),1e-4)||(this._autoScrollCurrentlyOutOfBoundary=!0)},_calculateTouchMoveVelocity:function(){var t=0;if((t=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),t))<=0||t>=.5)return cc.v2(0,0);var e=cc.v2(0,0);return e=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e)}),e),cc.v2(e.x*(1-this.brake)/t,e.y*(1-this.brake)/t)},_flattenVectorByDirection:function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},_moveContent:function(t,e){var i=this._flattenVectorByDirection(t),n=this.getContentPosition().add(i);this.setContentPosition(n);var r=this._getHowMuchOutOfBoundary();this._updateScrollBar(r),this.elastic&&e&&this._startBounceBackIfNeeded()},_getContentLeftBoundary:function(){return this.getContentPosition().x-this.content.getAnchorPoint().x*this.content.getContentSize().width},_getContentRightBoundary:function(){var t=this.content.getContentSize();return this._getContentLeftBoundary()+t.width},_getContentTopBoundary:function(){var t=this.content.getContentSize();return this._getContentBottomBoundary()+t.height},_getContentBottomBoundary:function(){return this.getContentPosition().y-this.content.getAnchorPoint().y*this.content.getContentSize().height},_getHowMuchOutOfBoundary:function(t){if((t=t||cc.v2(0,0)).fuzzyEquals(cc.v2(0,0),1e-4)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=cc.v2(0,0);return this._getContentLeftBoundary()+t.x>this._leftBoundary?e.x=this._leftBoundary-(this._getContentLeftBoundary()+t.x):this._getContentRightBoundary()+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(this._getContentBottomBoundary()+t.y)),t.fuzzyEquals(cc.v2(0,0),1e-4)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),e=this._clampDelta(e)},_updateScrollBarState:function(){if(this.content){var t=this.content.getContentSize(),e=this._view.getContentSize();this.verticalScrollBar&&(t.height0&&t[0].check()}},onEnable:function(){this.node.on("child-added",this._allowOnlyOneToggleChecked,this),this.node.on("child-removed",this._makeAtLeastOneToggleChecked,this)},onDisable:function(){this.node.off("child-added",this._allowOnlyOneToggleChecked,this),this.node.off("child-removed",this._makeAtLeastOneToggleChecked,this)},start:function(){this._makeAtLeastOneToggleChecked()}});t("../platform/js").get(n.prototype,"toggleItems",(function(){return this.node.getComponentsInChildren(cc.Toggle)})),cc.ToggleContainer=e.exports=n}),{"../platform/js":180}],87:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.ToggleGroup",extends:cc.Component,ctor:function(){this._toggleItems=[]},editor:!1,properties:{allowSwitchOff:{tooltip:!1,default:!1},toggleItems:{get:function(){return this._toggleItems}}},updateToggles:function(t){this.enabledInHierarchy&&this._toggleItems.forEach((function(e){t.isChecked&&e!==t&&e.isChecked&&e.enabled&&e._hideCheckMark()}))},addToggle:function(t){-1===this._toggleItems.indexOf(t)&&this._toggleItems.push(t),this._allowOnlyOneToggleChecked()},removeToggle:function(t){var e=this._toggleItems.indexOf(t);e>-1&&this._toggleItems.splice(e,1),this._makeAtLeastOneToggleChecked()},_allowOnlyOneToggleChecked:function(){var t=!1;return this._toggleItems.forEach((function(e){t&&e.enabled&&e._hideCheckMark(),e.isChecked&&e.enabled&&(t=!0)})),t},_makeAtLeastOneToggleChecked:function(){this._allowOnlyOneToggleChecked()||this.allowSwitchOff||this._toggleItems.length>0&&(this._toggleItems[0].isChecked=!0)},start:function(){this._makeAtLeastOneToggleChecked()}}),r=!1;t("../platform/js").get(cc,"ToggleGroup",(function(){return r||(cc.logID(1405,"cc.ToggleGroup","cc.ToggleContainer"),r=!0),n})),e.exports=n}),{"../platform/js":180}],88:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.ViewGroup",extends:t("./CCComponent")});cc.ViewGroup=e.exports=n}),{"./CCComponent":71}],89:[(function(t,e,i){"use strict";var n=t("../base-ui/CCWidgetManager"),r=n.AlignMode,s=n._AlignFlags,o=s.TOP,a=s.MID,c=s.BOT,l=s.LEFT,h=s.CENTER,u=s.RIGHT,_=o|c,f=l|u,d=cc.Class({name:"cc.Widget",extends:t("./CCComponent"),editor:!1,properties:{target:{get:function(){return this._target},set:function(t){this._target=t},type:cc.Node,tooltip:!1},isAlignTop:{get:function(){return(this._alignFlags&o)>0},set:function(t){this._setAlign(o,t)},animatable:!1,tooltip:!1},isAlignVerticalCenter:{get:function(){return(this._alignFlags&a)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=a):this._alignFlags&=~a},animatable:!1,tooltip:!1},isAlignBottom:{get:function(){return(this._alignFlags&c)>0},set:function(t){this._setAlign(c,t)},animatable:!1,tooltip:!1},isAlignLeft:{get:function(){return(this._alignFlags&l)>0},set:function(t){this._setAlign(l,t)},animatable:!1,tooltip:!1},isAlignHorizontalCenter:{get:function(){return(this._alignFlags&h)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=h):this._alignFlags&=~h},animatable:!1,tooltip:!1},isAlignRight:{get:function(){return(this._alignFlags&u)>0},set:function(t){this._setAlign(u,t)},animatable:!1,tooltip:!1},isStretchWidth:{get:function(){return(this._alignFlags&f)===f},visible:!1},isStretchHeight:{get:function(){return(this._alignFlags&_)===_},visible:!1},top:{get:function(){return this._top},set:function(t){this._top=t},tooltip:!1},bottom:{get:function(){return this._bottom},set:function(t){this._bottom=t},tooltip:!1},left:{get:function(){return this._left},set:function(t){this._left=t},tooltip:!1},right:{get:function(){return this._right},set:function(t){this._right=t},tooltip:!1},horizontalCenter:{get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t},tooltip:!1},verticalCenter:{get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t},tooltip:!1},isAbsoluteHorizontalCenter:{get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter=t},animatable:!1},isAbsoluteVerticalCenter:{get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter=t},animatable:!1},isAbsoluteTop:{get:function(){return this._isAbsTop},set:function(t){this._isAbsTop=t},animatable:!1},isAbsoluteBottom:{get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom=t},animatable:!1},isAbsoluteLeft:{get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft=t},animatable:!1},isAbsoluteRight:{get:function(){return this._isAbsRight},set:function(t){this._isAbsRight=t},animatable:!1},alignMode:{default:r.ON_WINDOW_RESIZE,type:r,tooltip:!1},_wasAlignOnce:{default:void 0,formerlySerializedAs:"isAlignOnce"},_target:null,_alignFlags:0,_left:0,_right:0,_top:0,_bottom:0,_verticalCenter:0,_horizontalCenter:0,_isAbsLeft:!0,_isAbsRight:!0,_isAbsTop:!0,_isAbsBottom:!0,_isAbsHorizontalCenter:!0,_isAbsVerticalCenter:!0,_originalWidth:0,_originalHeight:0},statics:{AlignMode:r},onLoad:function(){void 0!==this._wasAlignOnce&&(this.alignMode=this._wasAlignOnce?r.ONCE:r.ALWAYS,this._wasAlignOnce=void 0)},onEnable:function(){n.add(this)},onDisable:function(){n.remove(this)},_validateTargetInDEV:!1,_setAlign:function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&f)>0;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=this.node.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=this.node.height))):(i?this.isStretchWidth&&(this.node.width=this._originalWidth):this.isStretchHeight&&(this.node.height=this._originalHeight),this._alignFlags&=~t)}},updateAlignment:function(){n.updateAlignment(this.node)}});Object.defineProperty(d.prototype,"isAlignOnce",{get:function(){return this.alignMode===r.ONCE},set:function(t){this.alignMode=t?r.ONCE:r.ALWAYS}}),cc.Widget=e.exports=d}),{"../base-ui/CCWidgetManager":55,"./CCComponent":71}],90:[(function(t,e,i){"use strict";t("./CCComponent"),t("./CCComponentEventHandler"),t("./missing-script");var n=t("./WXSubContextView"),r=t("./SwanSubContextView");n||(n=cc.Class({name:"cc.WXSubContextView",extends:cc.Component})),r||(r=cc.Class({name:"cc.SwanSubContextView",extends:cc.Component}));var s=[t("./CCSprite"),t("./CCWidget"),t("./CCCanvas"),t("./CCAudioSource"),t("./CCAnimation"),t("./CCButton"),t("./CCLabel"),t("./CCProgressBar"),t("./CCMask"),t("./CCScrollBar"),t("./CCScrollView"),t("./CCPageViewIndicator"),t("./CCPageView"),t("./CCSlider"),t("./CCLayout"),t("./editbox/CCEditBox"),t("./CCLabelOutline"),t("./CCLabelShadow"),t("./CCRichText"),t("./CCToggleContainer"),t("./CCToggleGroup"),t("./CCToggle"),t("./CCBlockInputEvents"),t("./CCMotionStreak"),n,r];e.exports=s}),{"./CCAnimation":66,"./CCAudioSource":67,"./CCBlockInputEvents":68,"./CCButton":69,"./CCCanvas":70,"./CCComponent":71,"./CCComponentEventHandler":72,"./CCLabel":73,"./CCLabelOutline":void 0,"./CCLabelShadow":void 0,"./CCLayout":74,"./CCMask":75,"./CCMotionStreak":76,"./CCPageView":77,"./CCPageViewIndicator":78,"./CCProgressBar":79,"./CCRichText":void 0,"./CCScrollBar":81,"./CCScrollView":82,"./CCSlider":83,"./CCSprite":84,"./CCToggle":85,"./CCToggleContainer":86,"./CCToggleGroup":87,"./CCWidget":89,"./SwanSubContextView":void 0,"./WXSubContextView":void 0,"./editbox/CCEditBox":void 0,"./missing-script":91}],91:[(function(t,e,i){"use strict";var n=cc.js,r=t("../utils/misc").BUILTIN_CLASSID_RE,s=cc.Class({name:"cc.MissingClass",properties:{_$erialized:{default:null,visible:!1,editorOnly:!0}}}),o=cc.Class({name:"cc.MissingScript",extends:cc.Component,editor:{inspector:"packages://inspector/inspectors/comps/missing-script.js"},properties:{compiled:{default:!1,serializable:!1},_$erialized:{default:null,visible:!1,editorOnly:!0}},ctor:!1,statics:{safeFindClass:function(t,e){var i=n._getClassById(t);return i||(t?(cc.deserialize.reportMissingClass(t),o.getMissingWrapper(t,e)):null)},getMissingWrapper:function(t,e){return e.node&&(/^[0-9a-zA-Z+/]{23}$/.test(t)||r.test(t))?o:s}},onLoad:function(){cc.warnID(4600,this.node.name)}});cc._MissingScript=e.exports=o}),{"../utils/misc":249}],92:[(function(t,e,i){"use strict";var n=cc.js;t("../event/event");var r=function(t,e){cc.Event.call(this,cc.Event.MOUSE,e),this._eventType=t,this._button=0,this._x=0,this._y=0,this._prevX=0,this._prevY=0,this._scrollX=0,this._scrollY=0};n.extend(r,cc.Event);var s=r.prototype;s.setScrollData=function(t,e){this._scrollX=t,this._scrollY=e},s.getScrollX=function(){return this._scrollX},s.getScrollY=function(){return this._scrollY},s.setLocation=function(t,e){this._x=t,this._y=e},s.getLocation=function(){return cc.v2(this._x,this._y)},s.getLocationInView=function(){return cc.v2(this._x,cc.view._designResolutionSize.height-this._y)},s._setPrevCursor=function(t,e){this._prevX=t,this._prevY=e},s.getPreviousLocation=function(){return cc.v2(this._prevX,this._prevY)},s.getDelta=function(){return cc.v2(this._x-this._prevX,this._y-this._prevY)},s.getDeltaX=function(){return this._x-this._prevX},s.getDeltaY=function(){return this._y-this._prevY},s.setButton=function(t){this._button=t},s.getButton=function(){return this._button},s.getLocationX=function(){return this._x},s.getLocationY=function(){return this._y},r.NONE=0,r.DOWN=1,r.UP=2,r.MOVE=3,r.SCROLL=4,r.BUTTON_LEFT=0,r.BUTTON_RIGHT=2,r.BUTTON_MIDDLE=1,r.BUTTON_4=3,r.BUTTON_5=4,r.BUTTON_6=5,r.BUTTON_7=6,r.BUTTON_8=7;var o=function(t,e){cc.Event.call(this,cc.Event.TOUCH,e),this._eventCode=0,this._touches=t||[],this.touch=null,this.currentTouch=null};n.extend(o,cc.Event),(s=o.prototype).getEventCode=function(){return this._eventCode},s.getTouches=function(){return this._touches},s._setEventCode=function(t){this._eventCode=t},s._setTouches=function(t){this._touches=t},s.setLocation=function(t,e){this.touch&&this.touch.setTouchInfo(this.touch.getID(),t,e)},s.getLocation=function(){return this.touch?this.touch.getLocation():cc.v2()},s.getLocationInView=function(){return this.touch?this.touch.getLocationInView():cc.v2()},s.getPreviousLocation=function(){return this.touch?this.touch.getPreviousLocation():cc.v2()},s.getStartLocation=function(){return this.touch?this.touch.getStartLocation():cc.v2()},s.getID=function(){return this.touch?this.touch.getID():null},s.getDelta=function(){return this.touch?this.touch.getDelta():cc.v2()},s.getDeltaX=function(){return this.touch?this.touch.getDelta().x:0},s.getDeltaY=function(){return this.touch?this.touch.getDelta().y:0},s.getLocationX=function(){return this.touch?this.touch.getLocationX():0},s.getLocationY=function(){return this.touch?this.touch.getLocationY():0},o.MAX_TOUCHES=5,o.BEGAN=0,o.MOVED=1,o.ENDED=2,o.CANCELED=3;var a=function(t,e){cc.Event.call(this,cc.Event.ACCELERATION,e),this.acc=t};n.extend(a,cc.Event);var c=function(t,e,i){cc.Event.call(this,cc.Event.KEYBOARD,i),this.keyCode=t,this.isPressed=e};n.extend(c,cc.Event),cc.Event.EventMouse=r,cc.Event.EventTouch=o,cc.Event.EventAcceleration=a,cc.Event.EventKeyboard=c,e.exports=cc.Event}),{"../event/event":99}],93:[(function(t,e,i){"use strict";var n=t("../platform/js");cc.EventListener=function(t,e,i){this._onEvent=i,this._type=t||0,this._listenerID=e||"",this._registered=!1,this._fixedPriority=0,this._node=null,this._target=null,this._paused=!0,this._isEnabled=!0},cc.EventListener.prototype={constructor:cc.EventListener,_setPaused:function(t){this._paused=t},_isPaused:function(){return this._paused},_setRegistered:function(t){this._registered=t},_isRegistered:function(){return this._registered},_getType:function(){return this._type},_getListenerID:function(){return this._listenerID},_setFixedPriority:function(t){this._fixedPriority=t},_getFixedPriority:function(){return this._fixedPriority},_setSceneGraphPriority:function(t){this._target=t,this._node=t},_getSceneGraphPriority:function(){return this._node},checkAvailable:function(){return null!==this._onEvent},clone:function(){return null},setEnabled:function(t){this._isEnabled=t},isEnabled:function(){return this._isEnabled},retain:function(){},release:function(){}},cc.EventListener.UNKNOWN=0,cc.EventListener.TOUCH_ONE_BY_ONE=1,cc.EventListener.TOUCH_ALL_AT_ONCE=2,cc.EventListener.KEYBOARD=3,cc.EventListener.MOUSE=4,cc.EventListener.ACCELERATION=6,cc.EventListener.CUSTOM=8;var r=cc.EventListener.ListenerID={MOUSE:"__cc_mouse",TOUCH_ONE_BY_ONE:"__cc_touch_one_by_one",TOUCH_ALL_AT_ONCE:"__cc_touch_all_at_once",KEYBOARD:"__cc_keyboard",ACCELERATION:"__cc_acceleration"},s=function(t,e){this._onCustomEvent=e,cc.EventListener.call(this,cc.EventListener.CUSTOM,t,this._callback)};n.extend(s,cc.EventListener),n.mixin(s.prototype,{_onCustomEvent:null,_callback:function(t){null!==this._onCustomEvent&&this._onCustomEvent(t)},checkAvailable:function(){return cc.EventListener.prototype.checkAvailable.call(this)&&null!==this._onCustomEvent},clone:function(){return new s(this._listenerID,this._onCustomEvent)}});var o=function(){cc.EventListener.call(this,cc.EventListener.MOUSE,r.MOUSE,this._callback)};n.extend(o,cc.EventListener),n.mixin(o.prototype,{onMouseDown:null,onMouseUp:null,onMouseMove:null,onMouseScroll:null,_callback:function(t){var e=cc.Event.EventMouse;switch(t._eventType){case e.DOWN:this.onMouseDown&&this.onMouseDown(t);break;case e.UP:this.onMouseUp&&this.onMouseUp(t);break;case e.MOVE:this.onMouseMove&&this.onMouseMove(t);break;case e.SCROLL:this.onMouseScroll&&this.onMouseScroll(t)}},clone:function(){var t=new o;return t.onMouseDown=this.onMouseDown,t.onMouseUp=this.onMouseUp,t.onMouseMove=this.onMouseMove,t.onMouseScroll=this.onMouseScroll,t},checkAvailable:function(){return!0}});var a=function(){cc.EventListener.call(this,cc.EventListener.TOUCH_ONE_BY_ONE,r.TOUCH_ONE_BY_ONE,null),this._claimedTouches=[]};n.extend(a,cc.EventListener),n.mixin(a.prototype,{constructor:a,_claimedTouches:null,swallowTouches:!1,onTouchBegan:null,onTouchMoved:null,onTouchEnded:null,onTouchCancelled:null,setSwallowTouches:function(t){this.swallowTouches=t},isSwallowTouches:function(){return this.swallowTouches},clone:function(){var t=new a;return t.onTouchBegan=this.onTouchBegan,t.onTouchMoved=this.onTouchMoved,t.onTouchEnded=this.onTouchEnded,t.onTouchCancelled=this.onTouchCancelled,t.swallowTouches=this.swallowTouches,t},checkAvailable:function(){return!!this.onTouchBegan||(cc.logID(1801),!1)}});var c=function(){cc.EventListener.call(this,cc.EventListener.TOUCH_ALL_AT_ONCE,r.TOUCH_ALL_AT_ONCE,null)};n.extend(c,cc.EventListener),n.mixin(c.prototype,{constructor:c,onTouchesBegan:null,onTouchesMoved:null,onTouchesEnded:null,onTouchesCancelled:null,clone:function(){var t=new c;return t.onTouchesBegan=this.onTouchesBegan,t.onTouchesMoved=this.onTouchesMoved,t.onTouchesEnded=this.onTouchesEnded,t.onTouchesCancelled=this.onTouchesCancelled,t},checkAvailable:function(){return null!==this.onTouchesBegan||null!==this.onTouchesMoved||null!==this.onTouchesEnded||null!==this.onTouchesCancelled||(cc.logID(1802),!1)}});var l=function(t){this._onAccelerationEvent=t,cc.EventListener.call(this,cc.EventListener.ACCELERATION,r.ACCELERATION,this._callback)};n.extend(l,cc.EventListener),n.mixin(l.prototype,{constructor:l,_onAccelerationEvent:null,_callback:function(t){this._onAccelerationEvent(t.acc,t)},checkAvailable:function(){return cc.assertID(this._onAccelerationEvent,1803),!0},clone:function(){return new l(this._onAccelerationEvent)}});var h=function(){cc.EventListener.call(this,cc.EventListener.KEYBOARD,r.KEYBOARD,this._callback)};n.extend(h,cc.EventListener),n.mixin(h.prototype,{constructor:h,onKeyPressed:null,onKeyReleased:null,_callback:function(t){t.isPressed?this.onKeyPressed&&this.onKeyPressed(t.keyCode,t):this.onKeyReleased&&this.onKeyReleased(t.keyCode,t)},clone:function(){var t=new h;return t.onKeyPressed=this.onKeyPressed,t.onKeyReleased=this.onKeyReleased,t},checkAvailable:function(){return null!==this.onKeyPressed||null!==this.onKeyReleased||(cc.logID(1800),!1)}}),cc.EventListener.create=function(t){cc.assertID(t&&t.event,1900);var e=t.event;delete t.event;var i=null;for(var n in e===cc.EventListener.TOUCH_ONE_BY_ONE?i=new a:e===cc.EventListener.TOUCH_ALL_AT_ONCE?i=new c:e===cc.EventListener.MOUSE?i=new o:e===cc.EventListener.CUSTOM?(i=new s(t.eventName,t.callback),delete t.eventName,delete t.callback):e===cc.EventListener.KEYBOARD?i=new h:e===cc.EventListener.ACCELERATION&&(i=new l(t.callback),delete t.callback),t)i[n]=t[n];return i},e.exports=cc.EventListener}),{"../platform/js":180}],94:[(function(t,e,i){"use strict";var n=t("../platform/js");t("./CCEventListener");var r=cc.EventListener.ListenerID,s=function(){this._fixedListeners=[],this._sceneGraphListeners=[],this.gt0Index=0};s.prototype={constructor:s,size:function(){return this._fixedListeners.length+this._sceneGraphListeners.length},empty:function(){return 0===this._fixedListeners.length&&0===this._sceneGraphListeners.length},push:function(t){0===t._getFixedPriority()?this._sceneGraphListeners.push(t):this._fixedListeners.push(t)},clearSceneGraphListeners:function(){this._sceneGraphListeners.length=0},clearFixedListeners:function(){this._fixedListeners.length=0},clear:function(){this._sceneGraphListeners.length=0,this._fixedListeners.length=0},getFixedPriorityListeners:function(){return this._fixedListeners},getSceneGraphPriorityListeners:function(){return this._sceneGraphListeners}};var o=function(t){var e=cc.Event,i=t.type;return i===e.ACCELERATION?r.ACCELERATION:i===e.KEYBOARD?r.KEYBOARD:i.startsWith(e.MOUSE)?r.MOUSE:(i.startsWith(e.TOUCH)&&cc.logID(2e3),"")},a={DIRTY_NONE:0,DIRTY_FIXED_PRIORITY:1,DIRTY_SCENE_GRAPH_PRIORITY:2,DIRTY_ALL:3,_listenersMap:{},_priorityDirtyFlagMap:{},_nodeListenersMap:{},_toAddedListeners:[],_toRemovedListeners:[],_dirtyListeners:{},_inDispatch:0,_isEnabled:!1,_internalCustomListenerIDs:[],_setDirtyForNode:function(t){var e=this._nodeListenersMap[t._id];if(void 0!==e)for(var i=0,n=e.length;i=0;i--)(e=t[i])._setRegistered(!1),null!=e._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(e._getSceneGraphPriority(),e),e._setSceneGraphPriority(null)),0===this._inDispatch&&cc.js.array.removeAt(t,i)},_removeListenersForListenerID:function(t){var e,i=this._listenersMap[t];if(i){var n=i.getFixedPriorityListeners(),r=i.getSceneGraphPriorityListeners();this._removeAllListenersInVector(r),this._removeAllListenersInVector(n),delete this._priorityDirtyFlagMap[t],this._inDispatch||(i.clear(),delete this._listenersMap[t])}var s,o=this._toAddedListeners;for(e=o.length-1;e>=0;e--)(s=o[e])&&s._getListenerID()===t&&cc.js.array.removeAt(o,e)},_sortEventListeners:function(t){var e=this.DIRTY_NONE,i=this._priorityDirtyFlagMap;(i[t]&&(e=i[t]),e!==this.DIRTY_NONE)&&(i[t]=this.DIRTY_NONE,e&this.DIRTY_FIXED_PRIORITY&&this._sortListenersOfFixedPriority(t),e&this.DIRTY_SCENE_GRAPH_PRIORITY&&cc.director.getScene()&&this._sortListenersOfSceneGraphPriority(t))},_sortListenersOfSceneGraphPriority:function(t){var e=this._getListeners(t);if(e){var i=e.getSceneGraphPriorityListeners();i&&0!==i.length&&e.getSceneGraphPriorityListeners().sort(this._sortEventListenersOfSceneGraphPriorityDes)}},_sortEventListenersOfSceneGraphPriorityDes:function(t,e){var i=t._getSceneGraphPriority(),n=e._getSceneGraphPriority();if(!(e&&n&&n._activeInHierarchy&&null!==n._parent))return-1;if(!t||!i||!i._activeInHierarchy||null===i._parent)return 1;for(var r=i,s=n,o=!1;r._parent._id!==s._parent._id;)r=null===r._parent._parent?(o=!0)&&n:r._parent,s=null===s._parent._parent?(o=!0)&&i:s._parent;if(r._id===s._id){if(r._id===n._id)return-1;if(r._id===i._id)return 1}return o?r._localZOrder-s._localZOrder:s._localZOrder-r._localZOrder},_sortListenersOfFixedPriority:function(t){var e=this._listenersMap[t];if(e){var i=e.getFixedPriorityListeners();if(i&&0!==i.length){i.sort(this._sortListenersOfFixedPriorityAsc);for(var n=0,r=i.length;n=0);)++n;e.gt0Index=n}}},_sortListenersOfFixedPriorityAsc:function(t,e){return t._getFixedPriority()-e._getFixedPriority()},_onUpdateListeners:function(t){var e,i,n,r=t.getFixedPriorityListeners(),s=t.getSceneGraphPriorityListeners(),o=this._toRemovedListeners;if(s)for(e=s.length-1;e>=0;e--)(i=s[e])._isRegistered()||(cc.js.array.removeAt(s,e),-1!==(n=o.indexOf(i))&&o.splice(n,1));if(r)for(e=r.length-1;e>=0;e--)(i=r[e])._isRegistered()||(cc.js.array.removeAt(r,e),-1!==(n=o.indexOf(i))&&o.splice(n,1));s&&0===s.length&&t.clearSceneGraphListeners(),r&&0===r.length&&t.clearFixedListeners()},frameUpdateListeners:function(){var t=this._listenersMap,e=this._priorityDirtyFlagMap;for(var i in t)t[i].empty()&&(delete e[i],delete t[i]);var n=this._toAddedListeners;if(0!==n.length){for(var r=0,s=n.length;r0,3508),!(e>1)){var i;(i=this._listenersMap[r.TOUCH_ONE_BY_ONE])&&this._onUpdateListeners(i),(i=this._listenersMap[r.TOUCH_ALL_AT_ONCE])&&this._onUpdateListeners(i),cc.assertID(1===e,3509);var n=this._toAddedListeners;if(0!==n.length){for(var s=0,o=n.length;s0&&-1!==(r=t._claimedTouches.indexOf(n))&&(s=!0,o===c.MOVED&&t.onTouchMoved?t.onTouchMoved(n,i):o===c.ENDED?(t.onTouchEnded&&t.onTouchEnded(n,i),t._registered&&t._claimedTouches.splice(r,1)):o===c.CANCELLED&&(t.onTouchCancelled&&t.onTouchCancelled(n,i),t._registered&&t._claimedTouches.splice(r,1))),i.isStopped()?(a._updateTouchListeners(i),!0):!(!s||!t.swallowTouches)&&(e.needsMutableSet&&e.touches.splice(n,1),!0)},_dispatchTouchEvent:function(t){this._sortEventListeners(r.TOUCH_ONE_BY_ONE),this._sortEventListeners(r.TOUCH_ALL_AT_ONCE);var e=this._getListeners(r.TOUCH_ONE_BY_ONE),i=this._getListeners(r.TOUCH_ALL_AT_ONCE);if(null!==e||null!==i){var n=t.getTouches(),s=cc.js.array.copy(n),o={event:t,needsMutableSet:e&&i,touches:s,selTouch:null};if(e)for(var a=0;a0&&(this._dispatchEventToListeners(i,this._onTouchesEventCallback,{event:t,touches:s}),t.isStopped())||this._updateTouchListeners(t)}},_onTouchesEventCallback:function(t,e){if(!t._registered)return!1;var i=cc.Event.EventTouch,n=e.event,r=e.touches,s=n.getEventCode();return n.currentTarget=t._node,s===i.BEGAN&&t.onTouchesBegan?t.onTouchesBegan(r,n):s===i.MOVED&&t.onTouchesMoved?t.onTouchesMoved(r,n):s===i.ENDED&&t.onTouchesEnded?t.onTouchesEnded(r,n):s===i.CANCELLED&&t.onTouchesCancelled&&t.onTouchesCancelled(r,n),!!n.isStopped()&&(a._updateTouchListeners(n),!0)},_associateNodeAndEventListener:function(t,e){var i=this._nodeListenersMap[t._id];i||(i=[],this._nodeListenersMap[t._id]=i),i.push(e)},_dissociateNodeAndEventListener:function(t,e){var i=this._nodeListenersMap[t._id];i&&(cc.js.array.remove(i,e),0===i.length&&delete this._nodeListenersMap[t._id])},_dispatchEventToListeners:function(t,e,i){var n,r,s=!1,o=t.getFixedPriorityListeners(),a=t.getSceneGraphPriorityListeners(),c=0;if(o&&0!==o.length)for(;c=0;c--){var l=a[c];if(l===t){cc.js.array.removeAt(a,c),l._setRegistered(!1);break}}}},_removeListenerInCallback:function(t,e){if(null==t)return!1;for(var i=t.length-1;i>=0;i--){var n=t[i];if(n._onCustomEvent===e||n._onEvent===e)return n._setRegistered(!1),null!=n._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(n._getSceneGraphPriority(),n),n._setSceneGraphPriority(null)),0===this._inDispatch?cc.js.array.removeAt(t,i):this._toRemovedListeners.push(n),!0}return!1},_removeListenerInVector:function(t,e){if(null==t)return!1;for(var i=t.length-1;i>=0;i--){var n=t[i];if(n===e)return n._setRegistered(!1),null!=n._getSceneGraphPriority()&&(this._dissociateNodeAndEventListener(n._getSceneGraphPriority(),n),n._setSceneGraphPriority(null)),0===this._inDispatch?cc.js.array.removeAt(t,i):this._toRemovedListeners.push(n),!0}return!1},removeListeners:function(t,e){var i=this;if(cc.js.isNumber(t)||t instanceof cc._BaseNode)if(void 0!==t._id){var n,s=i._nodeListenersMap[t._id];if(s){var o=cc.js.array.copy(s);for(n=0;ny?0:m}})(),u.rayTriangle=(function(){var t=h.create(0,0,0),e=h.create(0,0,0),i=h.create(0,0,0),n=h.create(0,0,0),r=h.create(0,0,0);return function(s,o){h.sub(t,o.b,o.a),h.sub(e,o.c,o.a),h.cross(i,s.d,e);var a=h.dot(t,i);if(a<=0)return 0;h.sub(n,s.o,o.a);var c=h.dot(n,i);if(c<0||c>a)return 0;h.cross(r,n,t);var l=h.dot(s.d,r);if(l<0||c+l>a)return 0;var u=h.dot(e,r)/a;return u<0?0:u}})(),u.rayMesh=(function(){var t=c.create(),e=1/0,i={5120:"getInt8",5121:"getUint8",5122:"getInt16",5123:"getUint16",5124:"getInt32",5125:"getUint32",5126:"getFloat32"},r=(function(){var t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]})();function s(t,e,i,n,s){h.set(t,e[i](s,r),e[i](s+=n,r),e[i](s+=n,r))}return function(r,o){e=1/0;for(var a=o._subMeshes,c=0;c0&&g=0;r--){t(n[r],i)}i(e)}function e(t,e){return t.distance-e.distance}function i(t,e,i){var n=i.m,r=e.x,s=e.y,o=e.z,a=n[3]*r+n[7]*s+n[11]*o;return a=a?1/a:1,t.x=(n[0]*r+n[4]*s+n[8]*o)*a,t.y=(n[1]*r+n[5]*s+n[9]*o)*a,t.z=(n[2]*r+n[6]*s+n[10]*o)*a,t}var n=new r.default(function(){return{distance:0,node:null}},1),s=[],c=o.create(),_=h.create(),f=h.create(),d=a.create(),p=l.create(),m=l.create(),y=h.create();function v(t){return t>0&&t<1/0}return function(r,a,g,x){return n.reset(),s.length=0,t(r=r||cc.director.getScene(),(function(t){if(!x||x(t)){l.invert(m,t.getWorldMatrix(p)),h.transformMat4(d.o,a.o,m),h.normalize(d.d,i(d.d,a.d,m));var e=1/0,r=t._renderComponent;if(r instanceof cc.MeshRenderer?e=u.rayAabb(d,r._boundingBox):t.width&&t.height&&(h.set(_,-t.width*t.anchorX,-t.height*t.anchorY,t.z),h.set(f,t.width*(1-t.anchorX),t.height*(1-t.anchorY),t.z),o.fromPoints(c,_,f),e=u.rayAabb(d,c)),v(e)&&(g&&(e=g(d,t,e)),v(e))){h.scale(y,d.d,e),i(y,y,p);var C=n.add();C.node=t,C.distance=cc.vmath.vec3.mag(y),s.push(C)}}})),s.sort(e),s}})(),e.exports=u}),{"../../renderer/gfx":308,"../../renderer/memop/recycle-pool":323,"./aabb":102,"./ray":105,"./triangle":106}],105:[(function(t,e,i){"use strict";var n=cc.vmath.vec3;function r(t,e,i,r,s,o){this.o=n.create(t,e,i),this.d=n.create(r,s,o)}r.create=function(t,e,i,n,s,o){return new r(t,e,i,n,s,o)},r.clone=function(t){return new r(t.o.x,t.o.y,t.o.z,t.d.x,t.d.y,t.d.z)},r.copy=function(t,e){return t.o.x=e.o.x,t.o.y=e.o.y,t.o.z=e.o.z,t.d.x=e.d.x,t.d.y=e.d.y,t.d.z=e.d.z,t},r.set=function(t,e,i,n,r,s,o){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=o,t},r.fromPoints=function(t,e,i){return n.copy(t.o,e),n.normalize(t.d,n.sub(t.d,i,e)),t},e.exports=r}),{}],106:[(function(t,e,i){"use strict";var n=cc.vmath.vec3;function r(t,e,i,r,s,o,a,c,l){this.a=n.create(t,e,i),this.b=n.create(r,s,o),this.c=n.create(a,c,l)}r.create=function(t,e,i,n,s,o,a,c,l){return new r(t,e,i,n,s,o,a,c,l)},r.clone=function(t){return new r(t.a.x,t.a.y,t.a.z,t.b.x,t.b.y,t.b.z,t.c.x,t.c.y,t.c.z)},r.copy=function(t,e){return n.copy(t.a,e.a),n.copy(t.b,e.b),n.copy(t.c,e.c),t},r.fromPoints=function(t,e,i,r){return n.copy(t.a,e),n.copy(t.b,i),n.copy(t.c,r),t},r.set=function(t,e,i,n,r,s,o,a,c,l){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=o,t.c.x=a,t.c.y=c,t.c.z=l,t},e.exports=r}),{}],107:[(function(t,e,i){"use strict";var n=t("../components/CCRenderComponent"),r=t("../assets/material/CCMaterial"),s=t("./types"),o=s.LineCap,a=s.LineJoin,c=cc.Class({name:"cc.Graphics",extends:n,editor:!1,ctor:function(){this._impl=new c._Impl(this)},properties:{_lineWidth:1,_strokeColor:cc.Color.BLACK,_lineJoin:a.MITER,_lineCap:o.BUTT,_fillColor:cc.Color.WHITE,_miterLimit:10,lineWidth:{get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this._impl.lineWidth=t}},lineJoin:{get:function(){return this._lineJoin},set:function(t){this._lineJoin=t,this._impl.lineJoin=t},type:a},lineCap:{get:function(){return this._lineCap},set:function(t){this._lineCap=t,this._impl.lineCap=t},type:o},strokeColor:{get:function(){return this._strokeColor},set:function(t){this._impl.strokeColor=this._strokeColor=cc.color(t)}},fillColor:{get:function(){return this._fillColor},set:function(t){this._impl.fillColor=this._fillColor=cc.color(t)}},miterLimit:{get:function(){return this._miterLimit},set:function(t){this._miterLimit=t,this._impl.miterLimit=t}}},statics:{LineJoin:a,LineCap:o},onRestore:function(){this._impl||(this._impl=new c._Impl(this))},onEnable:function(){this._super(),this._activateMaterial()},onDestroy:function(){this.clear(!0),this._super(),this._impl=null},_activateMaterial:function(){if(cc.game.renderType!==cc.game.RENDER_TYPE_CANVAS){var t=this.sharedMaterials[0];(t=t?r.getInstantiatedMaterial(t,this):r.getInstantiatedBuiltinMaterial("2d-base",this)).define("CC_USE_MODEL",!0),this.setMaterial(0,t)}else this.disableRender()},moveTo:function(t,e){this._impl.moveTo(t,e)},lineTo:function(t,e){this._impl.lineTo(t,e)},bezierCurveTo:function(t,e,i,n,r,s){this._impl.bezierCurveTo(t,e,i,n,r,s)},quadraticCurveTo:function(t,e,i,n){this._impl.quadraticCurveTo(t,e,i,n)},arc:function(t,e,i,n,r,s){this._impl.arc(t,e,i,n,r,s)},ellipse:function(t,e,i,n){this._impl.ellipse(t,e,i,n)},circle:function(t,e,i){this._impl.circle(t,e,i)},rect:function(t,e,i,n){this._impl.rect(t,e,i,n)},roundRect:function(t,e,i,n,r){this._impl.roundRect(t,e,i,n,r)},fillRect:function(t,e,i,n){this.rect(t,e,i,n),this.fill()},clear:function(t){this._impl.clear(t),this._assembler&&this._assembler.clear(t)},close:function(){this._impl.close()},stroke:function(){this._assembler||this._resetAssembler(),this._assembler.stroke(this)},fill:function(){this._assembler||this._resetAssembler(),this._assembler.fill(this)}});cc.Graphics=e.exports=c,cc.Graphics.Types=s,cc.Graphics.Helper=t("./helper")}),{"../assets/material/CCMaterial":53,"../components/CCRenderComponent":80,"./helper":108,"./types":110}],108:[(function(t,e,i){"use strict";var n=t("./types").PointFlags,r=Math.PI,s=Math.min,o=Math.max,a=Math.cos,c=Math.sin,l=Math.abs,h=Math.sign,u=.5522847493;e.exports={arc:function(t,e,i,n,h,u,_){var f,d,p,m=0,y=0,v=0,g=0,x=0,C=0,A=0,b=0,S=0,T=0,w=0,E=0,B=0;if(y=u-h,_=_||!1)if(l(y)>=2*r)y=2*r;else for(;y<0;)y+=2*r;else if(l(y)>=2*r)y=2*-r;else for(;y>0;)y-=2*r;for(p=0|o(1,s(l(y)/(.5*r)+.5,5)),v=l(4/3*(1-a(f=y/p/2))/c(f)),_||(v=-v),d=0;d<=p;d++)C=e+(g=a(m=h+y*(d/p)))*n,A=i+(x=c(m))*n,b=-x*n*v,S=g*n*v,0===d?t.moveTo(C,A):t.bezierCurveTo(T+E,w+B,C-b,A-S,C,A),T=C,w=A,E=b,B=S},ellipse:function(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*u,e-n*u,i+r,e,i+r),t.bezierCurveTo(e+n*u,i+r,e+n,i+r*u,e+n,i),t.bezierCurveTo(e+n,i-r*u,e+n*u,i-r,e,i-r),t.bezierCurveTo(e-n*u,i-r,e-n,i-r*u,e-n,i),t.close()},roundRect:function(t,e,i,n,r,o){if(o<.1)t.rect(e,i,n,r);else{var a=s(o,.5*l(n))*h(n),c=s(o,.5*l(r))*h(r);t.moveTo(e,i+c),t.lineTo(e,i+r-c),t.bezierCurveTo(e,i+r-c*(1-u),e+a*(1-u),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-u),i+r,e+n,i+r-c*(1-u),e+n,i+r-c),t.lineTo(e+n,i+c),t.bezierCurveTo(e+n,i+c*(1-u),e+n-a*(1-u),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-u),i,e,i+c*(1-u),e,i+c),t.close()}},tesselateBezier:function t(e,i,r,s,o,a,c,h,u,_,f){var d,p,m,y,v,g,x,C,A,b,S,T,w,E,B,M;_>10||(v=.5*(a+h),g=.5*(c+u),x=.5*((d=.5*(i+s))+(m=.5*(s+a))),C=.5*((p=.5*(r+o))+(y=.5*(o+c))),((B=l((s-h)*(E=u-r)-(o-u)*(w=h-i)))+(M=l((a-h)*E-(c-u)*w)))*(B+M)0){var r=this,s=t.map((function(t){return{type:"uuid",uuid:t}}));this.load(s,e,(function(t,e){if(i){for(var o=[],a=n&&[],c=0;ce.length){var i=t.charCodeAt(e.length);return 46===i||47===i}return!0}var c=o.prototype;c.getUuid=function(t,e){t=cc.url.normalize(t);var i=this._pathToUuid[t];if(i)if(Array.isArray(i)){if(!e)return i[0].uuid;for(var n=0;n0&&n.src===s)return n;var o=function i(){n.removeEventListener("load",i),n.removeEventListener("error",a),n.id=t.id,e(null,n)},a=function i(){n.removeEventListener("load",o),n.removeEventListener("error",i),"https:"!==window.location.protocol&&n.crossOrigin&&"anonymous"===n.crossOrigin.toLowerCase()?f(t,e,!1,n):e(new Error(r.getError(4930,s)))};n.addEventListener("load",o),n.addEventListener("error",a),n.src=s}var d={js:_,png:f,jpg:f,bmp:f,jpeg:f,gif:f,ico:f,tiff:f,webp:f,image:f,pvr:c,pkm:c,mp3:s=t("./audio-downloader"),ogg:s,wav:s,m4a:s,txt:l,xml:l,vsh:l,fsh:l,atlas:l,tmx:l,tsx:l,json:l,ExportJson:l,plist:l,fnt:l,font:u,eot:u,ttf:u,woff:u,svg:u,ttc:u,uuid:function(t,e){var i=a.load(t,e);return void 0===i?this.extMap.json(t,e):i||void 0},binary:c,bin:c,dbbin:c,default:l},p="Downloader",m=function(t){this.id=p,this.async=!0,this.pipeline=null,this._curConcurrent=0,this._loadQueue=[],this._subpackages={},this.extMap=n.mixin(t,d)};m.ID=p,m.PackDownloader=a,m.prototype.addHandlers=function(t){n.mixin(this.extMap,t)},m.prototype._handleLoadQueue=function(){for(;this._curConcurrent@123\u4e01\u3041\u1101",o={},a=-1,c=[],l=3e3,h=(function(){var t=void 0;return function(){if(void 0===t)if(window.FontFace){var e=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),i=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);t=e?parseInt(e[1],10)>42:!i}else t=!1;return t}})();function u(){for(var t=!0,e=Date.now(),i=c.length-1;i>=0;i--){var o=c[i],h=o.fontFamilyName;if(e-o.startTime>l)cc.warnID(4933,h),o.callback(null,h),c.splice(i,1);else{var u=o.refWidth;r.font="40px "+h,u!==n.safeMeasureText(r,s)?(c.splice(i,1),o.callback(null,h)):t=!1}}t&&(clearInterval(a),a=-1)}function _(t,e,i){var n=new Promise(function(i,n){(function r(){Date.now()-t>=l?n():document.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))})()}),r=null,s=new Promise(function(t,e){r=setTimeout(e,l)});Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){cc.warnID(4933,e),i(null,e)}))}var f={loadFont:function(t,e){var i=t.url,l=f._getFontFamily(i);if(o[l])return l;if(!r){var d=document.createElement("canvas");d.width=100,d.height=100,r=d.getContext("2d")}var p="40px "+l;r.font=p;var m=n.safeMeasureText(r,s),y=document.createElement("style");y.type="text/css";var v="";isNaN(l-0)?v+="@font-face { font-family:"+l+"; src:":v+="@font-face { font-family:'"+l+"'; src:",v+="url('"+i+"');",y.textContent=v+"}",document.body.appendChild(y);var g=document.createElement("div"),x=g.style;if(x.fontFamily=l,g.innerHTML=".",x.position="absolute",x.left="-100px",x.top="-100px",document.body.appendChild(g),h())_(Date.now(),l,e);else{var C={fontFamilyName:l,refWidth:m,callback:e,startTime:Date.now()};c.push(C),-1===a&&(a=setInterval(u,100))}o[l]=y},_getFontFamily:function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}};e.exports=f}),{"../utils/text-utils":255}],120:[(function(t,e,i){"use strict";t("./downloader"),t("./loader"),t("./loading-items"),t("./pipeline"),t("./CCLoader")}),{"./CCLoader":112,"./downloader":118,"./loader":121,"./loading-items":122,"./pipeline":125}],121:[(function(t,e,i){"use strict";var n=t("../platform/js"),r=t("../platform/CCSAXParser").plistParser,s=t("./pipeline"),o=t("../assets/CCTexture2D"),a=t("./uuid-loader"),c=t("./font-loader");function l(t){if("string"!=typeof t.content)return new Error("JSON Loader: Input item doesn't contain string content");try{return JSON.parse(t.content)}catch(e){return new Error("JSON Loader: Parse json ["+t.id+"] failed : "+e)}}function h(t){if(t._owner instanceof cc.Asset)return null;var e=t.content;if(cc.sys.platform!==cc.sys.FB_PLAYABLE_ADS&&!(e instanceof Image))return new Error("Image Loader: Input item doesn't contain Image content");var i=t.texture||new o;return i._uuid=t.uuid,i.url=t.url,i._setRawAsset(t.rawUrl,!1),i._nativeAsset=e,i}function u(t,e){if(t._owner instanceof cc.Asset)return null;var i=new cc.AudioClip;return i._setRawAsset(t.rawUrl,!1),i._nativeAsset=t.content,i.url=t.url,i}function _(t){return t.load?t.load(t.content):null}var f=13,d=55727696,p=0,m=6,y=7,v=12;var g=16,x=6,C=8,A=10,b=12,S=14,T=0,w=1,E=3;function B(t,e){return t[e]<<8|t[e+1]}var M={png:h,jpg:h,bmp:h,jpeg:h,gif:h,ico:h,tiff:h,webp:h,image:h,pvr:function(t){var e=t.content instanceof ArrayBuffer?t.content:t.content.buffer,i=new Int32Array(e,0,f);if(i[p]!=d)return new Error("Invalid magic number in PVR header");var n=i[y],r=i[m],s=i[v]+52;return{_data:new Uint8Array(e,s),_compressed:!0,width:n,height:r}},pkm:function(t){var e=t.content instanceof ArrayBuffer?t.content:t.content.buffer,i=new Uint8Array(e),n=B(i,x);if(n!==T&&n!==w&&n!==E)return new Error("Invalid magic number in ETC header");var r=B(i,b),s=B(i,S);return B(i,C),B(i,A),{_data:new Uint8Array(e,g),_compressed:!0,width:r,height:s}},mp3:u,ogg:u,wav:u,m4a:u,json:l,ExportJson:l,plist:function(t){if("string"!=typeof t.content)return new Error("Plist Loader: Input item doesn't contain string content");var e=r.parse(t.content);return e||new Error("Plist Loader: Parse ["+t.id+"] failed")},uuid:a,prefab:a,fire:a,scene:a,binary:_,dbbin:_,bin:_,font:c.loadFont,eot:c.loadFont,ttf:c.loadFont,woff:c.loadFont,svg:c.loadFont,ttc:c.loadFont,default:function(){return null}},I=function(t){this.id="Loader",this.async=!0,this.pipeline=null,this.extMap=n.mixin(t,M)};I.ID="Loader",I.prototype.addHandlers=function(t){this.extMap=n.mixin(this.extMap,t)},I.prototype.handle=function(t,e){return(this.extMap[t.type]||this.extMap.default).call(this,t,e)},s.Loader=e.exports=I}),{"../assets/CCTexture2D":51,"../platform/CCSAXParser":167,"../platform/js":180,"./font-loader":119,"./pipeline":125,"./uuid-loader":131}],122:[(function(t,e,i){"use strict";var n=t("../platform/callbacks-invoker");t("../utils/CCPath");var r=t("../platform/js"),s=0|998*Math.random(),o=r.createMap(!0),a=[],c={WORKING:1,COMPLETE:2,ERROR:3},l=r.createMap(!0);function h(t){return"string"==typeof(t.url||t)}function u(t){if(t){var e=t.split("?");if(e&&e[0]&&e[1]){var i={};return e[1].split("&").forEach((function(t){var e=t.split("=");i[e[0]]=e[1]})),i}}}function _(t,e){var i="object"==typeof t?t.url:t,n={queueId:e,id:i,url:i,rawUrl:void 0,urlParam:u(i),type:"",error:null,content:null,complete:!1,states:{},deps:null};if("object"==typeof t&&(r.mixin(n,t),t.skips))for(var s=0;s=0)&&(s.deps&&d(t,s,!0))){n=!0;break}}}return i||(f.length=0),n}var p=function(t,e,i,a){n.call(this),this._id=++s,o[this._id]=this,this._pipeline=t,this._errorUrls=r.createMap(!0),this._appending=!1,this._ownerQueue=null,this.onProgress=i,this.onComplete=a,this.map=r.createMap(!0),this.completed={},this.totalCount=0,this.completedCount=0,this._pipeline?this.active=!0:this.active=!1,e&&(e.length>0?this.append(e):this.allComplete())};p.ItemState=new cc.Enum(c),p.create=function(t,e,i,n){void 0===i?"function"==typeof e&&(n=e,e=i=null):void 0===n&&("function"==typeof e?(n=i,i=e,e=null):(n=i,i=null));var r=a.pop();return r?(r._pipeline=t,r.onProgress=i,r.onComplete=n,o[r._id]=r,r._pipeline&&(r.active=!0),e&&r.append(e)):r=new p(t,e,i,n),r},p.getQueue=function(t){return t.queueId?o[t.queueId]:null},p.itemComplete=function(t){var e=o[t.queueId];e&&e.itemComplete(t.id)},p.initQueueDeps=function(t){var e=l[t._id];e?(e.completed.length=0,e.deps.length=0):e=l[t._id]={completed:[],deps:[]}},p.registerQueueDep=function(t,e){var i=t.queueId||t;if(!i)return!1;var n=l[i];if(n)-1===n.deps.indexOf(e)&&n.deps.push(e);else if(t.id)for(var r in l){var s=l[r];-1!==s.deps.indexOf(t.id)&&-1===s.deps.indexOf(e)&&s.deps.push(e)}},p.finishDep=function(t){for(var e in l){var i=l[e];-1!==i.deps.indexOf(t)&&-1===i.completed.indexOf(t)&&i.completed.push(t)}};var m=p.prototype;r.mixin(m,n.prototype),m.append=function(t,e){if(!this.active)return[];e&&!e.deps&&(e.deps=[]),this._appending=!0;var i,n,r,s=[];for(i=0;i=this.totalCount},m.isItemCompleted=function(t){return!!this.completed[t]},m.exists=function(t){return!!this.map[t]},m.getContent=function(t){var e=this.map[t],i=null;return e&&(e.content?i=e.content:e.alias&&(i=e.alias.content)),i},m.getError=function(t){var e=this.map[t],i=null;return e&&(e.error?i=e.error:e.alias&&(i=e.alias.error)),i},m.addListener=n.prototype.on,m.hasListener=n.prototype.hasEventListener,m.removeListener=n.prototype.off,m.removeAllListeners=n.prototype.removeAll,m.removeItem=function(t){var e=this.map[t];e&&this.completed[e.alias||t]&&(delete this.completed[t],delete this.map[t],e.alias&&(delete this.completed[e.alias.id],delete this.map[e.alias.id]),this.completedCount--,this.totalCount--)},m.itemComplete=function(t){var e=this.map[t];if(e){var i=t in this._errorUrls;if(e.error instanceof Error||r.isString(e.error)?this._errorUrls[t]=e.error:e.error?r.mixin(this._errorUrls,e.error):!e.error&&i&&delete this._errorUrls[t],this.completed[t]=e,this.completedCount++,p.finishDep(e.id),this.onProgress){var n=l[this._id];this.onProgress(n?n.completed.length:this.completedCount,n?n.deps.length:this.totalCount,e)}this.emit(t,e),this.removeAll(t),!this._appending&&this.completedCount>=this.totalCount&&this.allComplete()}},m.destroy=function(){this.active=!1,this._appending=!1,this._pipeline=null,this._ownerQueue=null,r.clear(this._errorUrls),this.onProgress=null,this.onComplete=null,this.map=r.createMap(!0),this.completed={},this.totalCount=0,this.completedCount=0,n.call(this),l[this._id]&&(l[this._id].completed.length=0,l[this._id].deps.length=0),delete o[this._id],delete l[this._id],-1===a.indexOf(this)&&a.length<10&&a.push(this)},cc.LoadingItems=e.exports=p}),{"../platform/callbacks-invoker":173,"../platform/js":180,"../utils/CCPath":240}],123:[(function(t,e,i){"use strict";var n=t("./pipeline"),r="MD5Pipe",s=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-]{8,})/,o=function(t,e,i){this.id=r,this.async=!1,this.pipeline=null,this.md5AssetsMap=t,this.md5NativeAssetsMap=e,this.libraryBase=i};o.ID=r,o.prototype.handle=function(t){return t.url=this.transformURL(t.url),null},o.prototype.transformURL=function(t){var e=!t.startsWith(this.libraryBase)?this.md5NativeAssetsMap:this.md5AssetsMap;return t=t.replace(s,(function(t,i){var n=e[i];return n?t+"."+n:t}))},n.MD5Pipe=e.exports=o}),{"./pipeline":125}],124:[(function(t,e,i){"use strict";var n=t("./unpackers"),r=t("../utils/misc").pushToMap,s={Invalid:0,Removed:1,Downloading:2,Loaded:3};function o(){this.unpacker=null,this.state=s.Invalid}var a={},c={},l={};function h(t,e){return new Error("Can not retrieve "+t+" from packer "+e)}e.exports={initPacks:function(t){for(var e in c=t,a={},t)for(var i=t[e],n=0;ne&&(e=a,i=r)}}return e!==s.Invalid?i:t[0]},load:function(t,e){var i=t.uuid,n=a[i];if(n){Array.isArray(n)&&(n=this._selectLoadedPack(n));var r=l[n];if(r&&r.state===s.Loaded){var c=r.unpacker.retrieve(i);return c||h(i,n)}return r||(console.log("Create unpacker %s for %s",n,i),(r=l[n]=new o).state=s.Downloading),this._loadNewPack(i,n,e),null}}}}),{"../utils/misc":249,"./unpackers":129}],125:[(function(t,e,i){"use strict";var n=t("../platform/js"),r=t("./loading-items"),s=r.ItemState;function o(t,e){var i=t.id,n=e.states[i],r=t.next,a=t.pipeline;if(!e.error&&n!==s.WORKING&&n!==s.ERROR)if(n===s.COMPLETE)r?o(r,e):a.flowOut(e);else{e.states[i]=s.WORKING;var c=t.handle(e,(function(t,n){t?(e.error=t,e.states[i]=s.ERROR,a.flowOut(e)):(n&&(e.content=n),e.states[i]=s.COMPLETE,r?o(r,e):a.flowOut(e))}));c instanceof Error?(e.error=c,e.states[i]=s.ERROR,a.flowOut(e)):void 0!==c&&(null!==c&&(e.content=c),e.states[i]=s.COMPLETE,r?o(r,e):a.flowOut(e))}}var a=function(t){this._pipes=t,this._cache=n.createMap(!0);for(var e=0;ethis._pipes.length)cc.warnID(4921);else if(this._pipes.indexOf(t)>0)cc.warnID(4922);else{t.pipeline=this;var i=null;e0&&(n=this._pipes[e-1]),n&&(n.next=t),t.next=i,this._pipes.splice(e,0,t)}},c.insertPipeAfter=function(t,e){var i=this._pipes.indexOf(t);i<0||this.insertPipe(e,i+1)},c.appendPipe=function(t){t.handle&&t.id&&(t.pipeline=this,t.next=null,this._pipes.length>0&&(this._pipes[this._pipes.length-1].next=t),this._pipes.push(t))},c.flowIn=function(t){var e,i,n=this._pipes[0];if(n){for(e=0;es&&(this._accumulator=s);this._accumulator>r;)e.Step(r,i,n),this._accumulator-=r}else{var o=1/cc.game.config.frameRate;e.Step(o,i,n)}this.debugDrawFlags&&(this._checkDebugDrawValid(),this._debugDrawer.clear(),e.DrawDebugData()),this._steping=!1;for(var a=this._delayEvents,c=0,l=a.length;c0){for(var s=n.getPoints(),a=n.getNormals(),l=n.getFractions(),h=[],u=0,_=r.length;u<_;u++){var p=r[u],m=p.collider;if(i===o.AllClosest){var y=h.find((function(t){return t.collider===m}));if(y){l[u]0}function l(t,e,i){return v(t,e,i)>=0}function h(t,e,i){return v(t,e,i)<=0}function u(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function _(t){f(t)||t.reverse()}function f(t){return t.length<3||d(t)>0}function d(t){var e,i=0;for(e=0;eE&&(B=T,E=M)}y=r(S,B,e),v=r(B,S,e)}return g=(g=g.concat(t(y))).concat(t(v))}g.push(e);for(S=g.length-1;S>=0;S--)0==g[S].length&&g.splice(S,0);return g},ForceCounterClockWise:_,IsCounterClockWise:f}}),{}],137:[(function(t,e,i){"use strict";var n=t("../CCNode").EventType,r=t("./CCPhysicsTypes").PTM_RATIO,s=t("./CCPhysicsTypes").ANGLE_TO_PHYSICS_ANGLE,o=t("./CCPhysicsTypes").PHYSICS_ANGLE_TO_ANGLE,a=t("./utils").getWorldRotation,c=t("./CCPhysicsTypes").BodyType,l=new b2.Vec2,h=new b2.Vec2,u=cc.Vec2.ZERO,_=cc.Class({name:"cc.RigidBody",extends:cc.Component,editor:!1,properties:{_type:c.Dynamic,_allowSleep:!0,_gravityScale:1,_linearDamping:0,_angularDamping:0,_linearVelocity:cc.v2(0,0),_angularVelocity:0,_fixedRotation:!1,enabled:{get:function(){return this._enabled},set:function(){cc.warnID(8200)},visible:!1,override:!0},enabledContactListener:{default:!1,tooltip:!1},bullet:{default:!1,tooltip:!1},type:{type:c,tooltip:!1,get:function(){return this._type},set:function(t){this._type=t,this._b2Body&&(t===c.Animated?this._b2Body.SetType(c.Kinematic):this._b2Body.SetType(t))}},allowSleep:{tooltip:!1,get:function(){return this._b2Body?this._b2Body.IsSleepingAllowed():this._allowSleep},set:function(t){this._allowSleep=t,this._b2Body&&this._b2Body.SetSleepingAllowed(t)}},gravityScale:{tooltip:!1,get:function(){return this._gravityScale},set:function(t){this._gravityScale=t,this._b2Body&&this._b2Body.SetGravityScale(t)}},linearDamping:{tooltip:!1,get:function(){return this._linearDamping},set:function(t){this._linearDamping=t,this._b2Body&&this._b2Body.SetLinearDamping(this._linearDamping)}},angularDamping:{tooltip:!1,get:function(){return this._angularDamping},set:function(t){this._angularDamping=t,this._b2Body&&this._b2Body.SetAngularDamping(t)}},linearVelocity:{tooltip:!1,type:cc.Vec2,get:function(){var t=this._linearVelocity;if(this._b2Body){var e=this._b2Body.GetLinearVelocity();t.x=e.x*r,t.y=e.y*r}return t},set:function(t){this._linearVelocity=t;var e=this._b2Body;if(e){var i=e.m_linearVelocity;i.Set(t.x/r,t.y/r),e.SetLinearVelocity(i)}}},angularVelocity:{tooltip:!1,get:function(){return this._b2Body?this._b2Body.GetAngularVelocity()*o:this._angularVelocity},set:function(t){this._angularVelocity=t,this._b2Body&&this._b2Body.SetAngularVelocity(t*s)}},fixedRotation:{tooltip:!1,get:function(){return this._fixedRotation},set:function(t){this._fixedRotation=t,this._b2Body&&this._b2Body.SetFixedRotation(t)}},awake:{visible:!1,tooltip:!1,get:function(){return!!this._b2Body&&this._b2Body.IsAwake()},set:function(t){this._b2Body&&this._b2Body.SetAwake(t)}},awakeOnLoad:{default:!0,tooltip:!1,animatable:!1},active:{visible:!1,get:function(){return!!this._b2Body&&this._b2Body.IsActive()},set:function(t){this._b2Body&&this._b2Body.SetActive(t)}}},getLocalPoint:function(t,e){if(e=e||cc.v2(),this._b2Body){l.Set(t.x/r,t.y/r);var i=this._b2Body.GetLocalPoint(l,e);e.x=i.x*r,e.y=i.y*r}return e},getWorldPoint:function(t,e){if(e=e||cc.v2(),this._b2Body){l.Set(t.x/r,t.y/r);var i=this._b2Body.GetWorldPoint(l,e);e.x=i.x*r,e.y=i.y*r}return e},getWorldVector:function(t,e){if(e=e||cc.v2(),this._b2Body){l.Set(t.x/r,t.y/r);var i=this._b2Body.GetWorldVector(l,e);e.x=i.x*r,e.y=i.y*r}return e},getLocalVector:function(t,e){if(e=e||cc.v2(),this._b2Body){l.Set(t.x/r,t.y/r);var i=this._b2Body.GetLocalVector(l,e);e.x=i.x*r,e.y=i.y*r}return e},getWorldPosition:function(t){if(t=t||cc.v2(),this._b2Body){var e=this._b2Body.GetPosition();t.x=e.x*r,t.y=e.y*r}return t},getWorldRotation:function(){return this._b2Body?this._b2Body.GetAngle()*o:0},getLocalCenter:function(t){if(t=t||cc.v2(),this._b2Body){var e=this._b2Body.GetLocalCenter();t.x=e.x*r,t.y=e.y*r}return t},getWorldCenter:function(t){if(t=t||cc.v2(),this._b2Body){var e=this._b2Body.GetWorldCenter();t.x=e.x*r,t.y=e.y*r}return t},getLinearVelocityFromWorldPoint:function(t,e){if(e=e||cc.v2(),this._b2Body){l.Set(t.x/r,t.y/r);var i=this._b2Body.GetLinearVelocityFromWorldPoint(l,e);e.x=i.x*r,e.y=i.y*r}return e},getMass:function(){return this._b2Body?this._b2Body.GetMass():0},getInertia:function(){return this._b2Body?this._b2Body.GetInertia()*r*r:0},getJointList:function(){if(!this._b2Body)return[];var t=[],e=this._b2Body.GetJointList();if(!e)return[];t.push(e.joint._joint);for(var i=e.prev;i;)t.push(i.joint._joint),i=i.prev;for(var n=e.next;n;)t.push(n.joint._joint),n=n.next;return t},applyForce:function(t,e,i){this._b2Body&&(l.Set(t.x/r,t.y/r),h.Set(e.x/r,e.y/r),this._b2Body.ApplyForce(l,h,i))},applyForceToCenter:function(t,e){this._b2Body&&(l.Set(t.x/r,t.y/r),this._b2Body.ApplyForceToCenter(l,e))},applyTorque:function(t,e){this._b2Body&&this._b2Body.ApplyTorque(t/r,e)},applyLinearImpulse:function(t,e,i){this._b2Body&&(l.Set(t.x/r,t.y/r),h.Set(e.x/r,e.y/r),this._b2Body.ApplyLinearImpulse(l,h,i))},applyAngularImpulse:function(t,e){this._b2Body&&this._b2Body.ApplyAngularImpulse(t/r/r,e)},syncPosition:function(t){var e=this._b2Body;if(e){var i,n=this.node.convertToWorldSpaceAR(u);if((i=this.type===c.Animated?e.GetLinearVelocity():e.GetPosition()).x=n.x/r,i.y=n.y/r,this.type===c.Animated&&t){var s=e.GetPosition(),o=cc.game.config.frameRate;i.x=(i.x-s.x)*o,i.y=(i.y-s.y)*o,e.SetAwake(!0),e.SetLinearVelocity(i)}else e.SetTransformVec(i,e.GetAngle())}},syncRotation:function(t){var e=this._b2Body;if(e){var i=s*a(this.node);if(this.type===c.Animated&&t){var n=e.GetAngle(),r=cc.game.config.frameRate;e.SetAwake(!0),e.SetAngularVelocity((i-n)*r)}else e.SetTransformVec(e.GetPosition(),i)}},resetVelocity:function(){var t=this._b2Body;if(t){var e=t.m_linearVelocity;e.Set(0,0),t.SetLinearVelocity(e),t.SetAngularVelocity(0)}},onEnable:function(){this._init()},onDisable:function(){this._destroy()},_registerNodeEvents:function(){var t=this.node;t.on(n.POSITION_CHANGED,this._onNodePositionChanged,this),t.on(n.ROTATION_CHANGED,this._onNodeRotationChanged,this),t.on(n.SCALE_CHANGED,this._onNodeScaleChanged,this)},_unregisterNodeEvents:function(){var t=this.node;t.off(n.POSITION_CHANGED,this._onNodePositionChanged,this),t.off(n.ROTATION_CHANGED,this._onNodeRotationChanged,this),t.off(n.SCALE_CHANGED,this._onNodeScaleChanged,this)},_onNodePositionChanged:function(){this.syncPosition(!0)},_onNodeRotationChanged:function(t){this.syncRotation(!0)},_onNodeScaleChanged:function(t){if(this._b2Body)for(var e=this.getComponents(cc.PhysicsCollider),i=0;i=0;n--){var r=t[n];r.collider=null,i._unregisterContactFixture(r),e&&e.DestroyFixture(r)}this.body=null,this._fixtures.length=0,this._shapes.length=0,this._inited=!1}},_createShape:function(){},apply:function(){this._destroy(),this._init()},getAABB:function(){for(var t=1e7,e=1e7,i=-1e7,r=-1e7,s=this._fixtures,o=0;oi&&(i=h.upperBound.x),h.upperBound.y>r&&(r=h.upperBound.y)}t*=n,e*=n,i*=n,r*=n;var u=this._rect;return u.x=t,u.y=e,u.width=i-t,u.height=r-e,u}});cc.PhysicsCollider=e.exports=s}),{"../CCPhysicsTypes":135,"../utils":158}],143:[(function(t,e,i){"use strict";var n=t("../CCPhysicsTypes").PTM_RATIO,r=t("../CCPolygonSeparator"),s=cc.Class({name:"cc.PhysicsPolygonCollider",extends:cc.PhysicsCollider,mixins:[cc.Collider.Polygon],editor:{menu:!1,inspector:!1,requireComponent:cc.RigidBody},_createShape:function(t){var e=[],i=this.points;i.length>0&&i[0].equals(i[i.length-1])&&(i.length-=1);for(var s=r.ConvexPartition(i),o=this.offset,a=0;a=2?1:n)},n.prototype.getFixtures=function(){return this._fixtures},n.prototype.getPoints=function(){return this._points},n.prototype.getNormals=function(){return this._normals},n.prototype.getFractions=function(){return this._fractions},cc.PhysicsRayCastCallback=e.exports=n}),{}],158:[(function(t,e,i){"use strict";e.exports={getWorldRotation:function(t){for(var e=t.angle,i=t.parent;i.parent;)e+=i.angle,i=i.parent;return-e},getWorldScale:function(t){for(var e=t.scaleX,i=t.scaleY,n=t.parent;n.parent;)e*=n.scaleX,i*=n.scaleY,n=n.parent;return cc.v2(e,i)},convertToNodeRotation:function(t,e){e-=-t.angle;for(var i=t.parent;i.parent;)e-=-i.angle,i=i.parent;return e}}}),{}],159:[(function(t,e,i){"use strict";t("../assets/CCAsset");var n=t("./utils").callInNextTick,r=t("../load-pipeline/CCLoader"),s=t("../load-pipeline/asset-table"),o=t("../load-pipeline/pack-downloader"),a=t("../load-pipeline/auto-release-utils"),c=t("../utils/decode-uuid"),l=t("../load-pipeline/md5-pipe"),h=t("../load-pipeline/subpackage-pipe"),u=t("./js"),_="",f="",d=u.createMap(!0);function p(t){return t&&(t.constructor===cc.SceneAsset||t instanceof cc.Scene)}function m(t,e){this.url=t,this.type=e}var y={loadAsset:function(t,e,i){if("string"!=typeof t)return n(e,new Error("[AssetLibrary] uuid must be string"),null);var s={uuid:t,type:"uuid"};i&&i.existingAsset&&(s.existingAsset=i.existingAsset),r.load(s,(function(i,n){if(i||!n){var s="string"==typeof i?i:i?i.message||i.errorMessage||JSON.stringify(i):"Unknown error";i=new Error("[AssetLibrary] loading JSON or dependencies failed:"+s)}else{if(n.constructor===cc.SceneAsset){var o=cc.loader._getReferenceKey(t);n.scene.dependAssets=a.getDependsRecursively(o)}if(p(n)){var c=cc.loader._getReferenceKey(t);r.removeItem(c)}}e&&e(i,n)}))},getLibUrlNoExt:function(t,e){return t=c(t),(e?f+"assets/":_)+t.slice(0,2)+"/"+t},_queryAssetInfoInEditor:function(t,e){0},_getAssetInfoInRuntime:function(t,e){e=e||{url:null,raw:!1};var i=d[t];return i&&!u.isChildClassOf(i.type,cc.Asset)?(e.url=f+i.url,e.raw=!0):(e.url=this.getLibUrlNoExt(t)+".json",e.raw=!1),e},_uuidInSettings:function(t){return t in d},queryAssetInfo:function(t,e){var i=this._getAssetInfoInRuntime(t);e(null,i.url,i.raw)},parseUuidInEditor:function(t){},loadJson:function(t,e){var i=""+((new Date).getTime()+Math.random()),n={uuid:i,type:"uuid",content:t,skips:[r.assetLoader.id,r.downloader.id]};r.load(n,(function(t,n){if(t)t=new Error("[AssetLibrary] loading JSON or dependencies failed: "+t.message);else{if(n.constructor===cc.SceneAsset){var s=cc.loader._getReferenceKey(i);n.scene.dependAssets=a.getDependsRecursively(s)}if(p(n)){var o=cc.loader._getReferenceKey(i);r.removeItem(o)}}n._uuid="",e&&e(t,n)}))},getAssetByUuid:function(t){return y._uuidToAsset[t]||null},init:function(t){var e=t.libraryPath;if(e=e.replace(/\\/g,"/"),_=cc.path.stripSep(e)+"/",f=t.rawAssetsBase,t.subpackages){var i=new h(t.subpackages);cc.loader.insertPipeAfter(cc.loader.assetLoader,i),cc.loader.subPackPipe=i}var n=t.md5AssetsMap;if(n&&n.import){var a=0,p=0,y=u.createMap(!0),v=n.import;for(a=0;a0?s:null,!0);var u=a.prototype;if(e&&(h||(n.extend(a,e),u=a.prototype),a.$super=e),i){for(var _=i.length-1;_>=0;_--){var f=i[_];m(u,f.prototype),m(a,f,(function(t){return f.hasOwnProperty(t)&&!0})),M._isCCClass(f)&&m(o.getClassAttrs(a),o.getClassAttrs(f))}u.constructor=a}return h||(u.__initProps__=b),n.setClassName(t,a),a}function v(t,e,i,r){var s=cc.Component,o=cc._RF.peek();if(o&&n.isChildClassOf(e,s)){if(n.isChildClassOf(o.cls,s))return cc.errorID(3615),null;0,t=t||o.script}var a=y(t,e,i,r);if(o)if(n.isChildClassOf(e,s)){var c=o.uuid;c&&n._setClassId(c,a),o.cls=a}else n.isChildClassOf(o.cls,s)||(o.cls=a);return a}function g(t){for(var e=n.getClassName(t),i=t.constructor,r="new "+e+"(",s=0;s0){0;var o="].apply(this,arguments);\n";if(1===s)r+="CCClass.__ctors__[0"+o;else{r+="var cs=CCClass.__ctors__;\n";for(var a=0;a=0)){var o=e[s];if("function"==typeof o){var a=n.getPropertyDescriptor(t.prototype,s);if(a){var c=a.value;if("function"==typeof c){w.test(o)&&(r=!0,e[s]=(function(t,e){return function(){var i=this._super;this._super=t;var n=e.apply(this,arguments);return this._super=i,n}})(c,o));continue}}0}}return r}function B(t,e,i,n,r,s){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),r)for(var l=0;l=0)){var f=t[_];c.validateMethodWithProps(f,_,e,s,i)&&n.value(s.prototype,_,f,!0,!0)}var d=t.editor;return d&&n.isChildClassOf(i,cc.Component)&&cc.Component._registerEditorProps(s,d),s}M._isCCClass=function(t){return t&&t.hasOwnProperty("__ctors__")},M._fastDefine=function(t,e,i){n.setClassName(t,e);for(var r=e.__props__=e.__values__=Object.keys(i),s=o.getClassAttrs(e),c=0;c=2&&((c||h())[l+"min"]=d[0],c[l+"max"]=d[1],d.length>2&&(c[l+"step"]=d[2])),f("min","number"),f("max","number"),f("step","number")}cc.Class=M,e.exports={isArray:function(t){return t=p(t),Array.isArray(t)},fastDefine:M._fastDefine,getNewValueTypeCode:g,IDENTIFIER_RE:A,escapeForJS:x,getDefault:p}}),{"./CCEnum":162,"./attribute":172,"./js":180,"./preprocess-class":181,"./requiring-frame":182,"./utils":184}],161:[(function(t,e,i){"use strict";t("./CCClass");var n=t("./preprocess-class"),r=t("./js"),s="__ccclassCache__";function o(t){return t}function a(t,e){return t[e]||(t[e]={})}function c(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function l(t,e,i){return function(t){return function(i){return e(i,t)}}}var h=l.bind(null,!1);function u(t){return l.bind(null,!1)}var _=u(),f=u();function d(t,e){return a(t,s)}function p(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function m(t){var e;try{e=new t}catch(t){return{}}return e}function y(t,e,i,s,o,a){var c;s&&(c=n.getFullFormOfProperty(s));var l=e[i],h=r.mixin(l||{},c||s||{});if(o&&(o.get||o.set)){o.get&&(h.get=o.get),o.set&&(h.set=o.set)}else{0;var u=void 0;if(o)o.initializer&&(u=p(o.initializer),!0);else{var _=a.default||(a.default=m(t));_.hasOwnProperty(i)&&(u=_[i],!0)}0,h.default=u}e[i]=h}var v=c((function(t,e){var i=r.getSuper(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t,__ES6__:!0},o=t[s];if(o){var a=o.proto;a&&r.mixin(n,a),t[s]=void 0}return cc.Class(n)}));function g(t,e,i){return t((function(t,n){var r=d(t);if(r){var s=void 0!==i?i:n;a(a(r,"proto"),"editor")[e]=s}}),e)}function x(t){return t(o)}var C=x(c),A=g(h,"requireComponent"),b=x(_),S=g(f,"executionOrder"),T=x(c),w=x(c),E=x(_),B=x(_),M=x(_);cc._decorator=e.exports={ccclass:v,property:function(t,e,i){var n=null;function r(t,e,i){var r=d(t.constructor);if(r){var s=a(a(r,"proto"),"properties");y(t.constructor,s,e,n,i,r)}}if(void 0===e)return n=t,r;r(t,e,i)},executeInEditMode:C,requireComponent:A,menu:b,executionOrder:S,disallowMultiple:T,playOnFocus:w,inspector:E,icon:B,help:M,mixins:function(){for(var t=[],e=0;eo)return this._removeUsedIndexBit(i),delete this._touchesIntegerDict[n.getID()],i;t>>=1}return-1},_removeUsedIndexBit:function(t){if(!(t<0||t>=this._maxTouches)){var e=1<0){this._glView._convertTouchesWithScale(o);var _=new cc.Event.EventTouch(o);_._eventCode=cc.Event.EventTouch.BEGAN,s.dispatchEvent(_)}},handleTouchesMove:function(t){for(var e=void 0,i=void 0,n=void 0,o=[],a=this._touches,c=r.now(),l=0,h=t.length;l0){this._glView._convertTouchesWithScale(o);var u=new cc.Event.EventTouch(o);u._eventCode=cc.Event.EventTouch.MOVED,s.dispatchEvent(u)}},handleTouchesEnd:function(t){var e=this.getSetOfTouchesEndOrCancel(t);if(e.length>0){this._glView._convertTouchesWithScale(e);var i=new cc.Event.EventTouch(e);i._eventCode=cc.Event.EventTouch.ENDED,s.dispatchEvent(i)}this._preTouchPool.length=0},handleTouchesCancel:function(t){var e=this.getSetOfTouchesEndOrCancel(t);if(e.length>0){this._glView._convertTouchesWithScale(e);var i=new cc.Event.EventTouch(e);i._eventCode=cc.Event.EventTouch.CANCELLED,s.dispatchEvent(i)}this._preTouchPool.length=0},getSetOfTouchesEndOrCancel:function(t){for(var e=void 0,i=void 0,n=void 0,r=[],s=this._touches,o=this._touchesIntegerDict,a=0,c=t.length;a=0;r--)if(i[r].getID()===n){e=i[r];break}return e||(e=t),e},setPreTouch:function(t){for(var e=!1,i=this._preTouchPool,n=t.getID(),r=i.length-1;r>=0;r--)if(i[r].getID()===n){i[r]=t,e=!0;break}e||(i.length<=50?i.push(t):(i[this._preTouchPoolPointer]=t,this._preTouchPoolPointer=(this._preTouchPoolPointer+1)%50))},getTouchByXY:function(t,e,i){var n=this._preTouchPoint,r=this._glView.convertToLocationInView(t,e,i),s=new cc.Touch(r.x,r.y,0);return s._setPrevPoint(n.x,n.y),n.x=r.x,n.y=r.y,s},getMouseEvent:function(t,e,i){var n=this._prevMousePoint,r=new cc.Event.EventMouse(i);return r._setPrevCursor(n.x,n.y),n.x=t.x,n.y=t.y,this._glView._convertMouseToLocationInView(n,e),r.setLocation(n.x,n.y),r},getPointByEvent:function(t,e){return null!=t.pageX?{x:t.pageX,y:t.pageY}:(e.left-=document.body.scrollLeft,e.top-=document.body.scrollTop,{x:t.clientX,y:t.clientY})},getTouchesByEvent:function(t,e){for(var i=[],n=this._glView,s=void 0,o=void 0,c=void 0,l=this._preTouchPoint,h=t.changedTouches.length,u=0;uthis._accelInterval&&(this._accelCurTime-=this._accelInterval,s.dispatchEvent(new cc.Event.EventAcceleration(this._acceleration))),this._accelCurTime+=t}};e.exports=_cc.inputManager=c}),{"../event-manager":96,"./CCMacro":165,"./CCSys":169}],165:[(function(t,e,i){"use strict";cc.macro={RAD:Math.PI/180,DEG:180/Math.PI,REPEAT_FOREVER:Number.MAX_VALUE-1,FLT_EPSILON:1.192092896e-7,MIN_ZINDEX:-Math.pow(2,15),MAX_ZINDEX:Math.pow(2,15)-1,ONE:1,ZERO:0,SRC_ALPHA:770,SRC_ALPHA_SATURATE:776,SRC_COLOR:768,DST_ALPHA:772,DST_COLOR:774,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775,ONE_MINUS_CONSTANT_ALPHA:32772,ONE_MINUS_CONSTANT_COLOR:32770,ORIENTATION_PORTRAIT:1,ORIENTATION_LANDSCAPE:2,ORIENTATION_AUTO:3,DENSITYDPI_DEVICE:"device-dpi",DENSITYDPI_HIGH:"high-dpi",DENSITYDPI_MEDIUM:"medium-dpi",DENSITYDPI_LOW:"low-dpi",FIX_ARTIFACTS_BY_STRECHING_TEXEL_TMX:!0,DIRECTOR_STATS_POSITION:cc.v2(0,0),ENABLE_STACKABLE_ACTIONS:!0,TOUCH_TIMEOUT:5e3,BATCH_VERTEX_COUNT:2e4,ENABLE_TILEDMAP_CULLING:!0,DOWNLOAD_MAX_CONCURRENT:64,ENABLE_TRANSPARENT_CANVAS:!1,ENABLE_WEBGL_ANTIALIAS:!1,ENABLE_CULLING:!1,CLEANUP_IMAGE_CACHE:!1,SHOW_MESH_WIREFRAME:!1,ROTATE_ACTION_CCW:!1};cc.macro.SUPPORT_TEXTURE_FORMATS=[".pkm",".pvr",".webp",".jpg",".jpeg",".bmp",".png"],cc.macro.KEY={none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"=":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1e3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005},cc.macro.ImageFormat=cc.Enum({JPG:0,PNG:1,TIFF:2,WEBP:3,PVR:4,ETC:5,S3TC:6,ATITC:7,TGA:8,RAWDATA:9,UNKNOWN:10}),cc.macro.BlendFactor=cc.Enum({ONE:1,ZERO:0,SRC_ALPHA:770,SRC_COLOR:768,DST_ALPHA:772,DST_COLOR:774,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775}),cc.macro.TextAlignment=cc.Enum({LEFT:0,CENTER:1,RIGHT:2}),cc.macro.VerticalTextAlignment=cc.Enum({TOP:0,CENTER:1,BOTTOM:2}),e.exports=cc.macro}),{}],166:[(function(t,e,i){"use strict";var n=t("./js"),r=t("./CCClass"),s=1;function o(){this._name="",this._objFlags=0}r.fastDefine("cc.Object",o,{_name:"",_objFlags:0}),n.value(o,"Flags",{Destroyed:s,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20});var a=[];function c(){for(var t=a.length,e=0;e0)return void(t.webkitEnterFullscreen&&t.webkitEnterFullscreen());t.setAttribute("x5-video-player-fullscreen","true")}if(this._supportsFullScreen){if(t=t||document.documentElement,e){var n=this._fn.fullscreenchange;this._onfullscreenchange&&document.removeEventListener(n,this._onfullscreenchange),this._onfullscreenchange=e,document.addEventListener(n,e,!1)}if(i){var r=this._fn.fullscreenerror;this._onfullscreenerror&&document.removeEventListener(r,this._onfullscreenerror),this._onfullscreenerror=i,document.addEventListener(r,i,{once:!0})}t[this._fn.requestFullscreen]()}},exitFullScreen:function(t){if(t&&"video"===t.tagName.toLowerCase()){if(cc.sys.os===cc.sys.OS_IOS&&cc.sys.isBrowser)return void(t.webkitExitFullscreen&&t.webkitExitFullscreen());t.setAttribute("x5-video-player-fullscreen","false")}return!this._supportsFullScreen||document[this._fn.exitFullscreen]()},autoFullScreen:function(t,e){t=t||document.body,this._ensureFullScreen(t,e),this.requestFullScreen(t,e)},disableAutoFullScreen:function(t){var e=cc.game.canvas||t,i=this._touchEvent;this._preOnTouch&&(e.removeEventListener(i,this._preOnTouch),this._preOnTouch=null)},_ensureFullScreen:function(t,e){var i=this,n=cc.game.canvas||t,r=this._fn.fullscreenerror,s=this._touchEvent;function o(){i._preOnFullScreenError=null,i._preOnTouch&&n.removeEventListener(s,i._preOnTouch),i._preOnTouch=function(){i._preOnTouch=null,i.requestFullScreen(t,e)},n.addEventListener(s,i._preOnTouch,{once:!0})}this._preOnFullScreenError&&t.removeEventListener(r,this._preOnFullScreenError),this._preOnFullScreenError=o,t.addEventListener(r,o,{once:!0})}},cc.screen.init()}),{}],169:[(function(t,e,i){"use strict";window._CCSettings&&_CCSettings.platform;var n="undefined"==typeof window?global:window;var r=cc&&cc.sys?cc.sys:(function(){cc.sys={};var t=cc.sys;if(t.LANGUAGE_ENGLISH="en",t.LANGUAGE_CHINESE="zh",t.LANGUAGE_FRENCH="fr",t.LANGUAGE_ITALIAN="it",t.LANGUAGE_GERMAN="de",t.LANGUAGE_SPANISH="es",t.LANGUAGE_DUTCH="du",t.LANGUAGE_RUSSIAN="ru",t.LANGUAGE_KOREAN="ko",t.LANGUAGE_JAPANESE="ja",t.LANGUAGE_HUNGARIAN="hu",t.LANGUAGE_PORTUGUESE="pt",t.LANGUAGE_ARABIC="ar",t.LANGUAGE_NORWEGIAN="no",t.LANGUAGE_POLISH="pl",t.LANGUAGE_TURKISH="tr",t.LANGUAGE_UKRAINIAN="uk",t.LANGUAGE_ROMANIAN="ro",t.LANGUAGE_BULGARIAN="bg",t.LANGUAGE_UNKNOWN="unknown",t.OS_IOS="iOS",t.OS_ANDROID="Android",t.OS_WINDOWS="Windows",t.OS_MARMALADE="Marmalade",t.OS_LINUX="Linux",t.OS_BADA="Bada",t.OS_BLACKBERRY="Blackberry",t.OS_OSX="OS X",t.OS_WP8="WP8",t.OS_WINRT="WINRT",t.OS_UNKNOWN="Unknown",t.UNKNOWN=-1,t.WIN32=0,t.LINUX=1,t.MACOS=2,t.ANDROID=3,t.IPHONE=4,t.IPAD=5,t.BLACKBERRY=6,t.NACL=7,t.EMSCRIPTEN=8,t.TIZEN=9,t.WINRT=10,t.WP8=11,t.MOBILE_BROWSER=100,t.DESKTOP_BROWSER=101,t.EDITOR_PAGE=102,t.EDITOR_CORE=103,t.WECHAT_GAME=104,t.QQ_PLAY=105,t.FB_PLAYABLE_ADS=106,t.BAIDU_GAME=107,t.VIVO_GAME=108,t.OPPO_GAME=109,t.HUAWEI_GAME=110,t.XIAOMI_GAME=111,t.JKW_GAME=112,t.ALIPAY_GAME=113,t.WECHAT_GAME_SUB=114,t.BAIDU_GAME_SUB=115,t.BROWSER_TYPE_WECHAT="wechat",t.BROWSER_TYPE_WECHAT_GAME="wechatgame",t.BROWSER_TYPE_WECHAT_GAME_SUB="wechatgamesub",t.BROWSER_TYPE_BAIDU_GAME="baidugame",t.BROWSER_TYPE_BAIDU_GAME_SUB="baidugamesub",t.BROWSER_TYPE_XIAOMI_GAME="xiaomigame",t.BROWSER_TYPE_ALIPAY_GAME="alipaygame",t.BROWSER_TYPE_QQ_PLAY="qqplay",t.BROWSER_TYPE_ANDROID="androidbrowser",t.BROWSER_TYPE_IE="ie",t.BROWSER_TYPE_EDGE="edge",t.BROWSER_TYPE_QQ="qqbrowser",t.BROWSER_TYPE_MOBILE_QQ="mqqbrowser",t.BROWSER_TYPE_UC="ucbrowser",t.BROWSER_TYPE_UCBS="ucbs",t.BROWSER_TYPE_360="360browser",t.BROWSER_TYPE_BAIDU_APP="baiduboxapp",t.BROWSER_TYPE_BAIDU="baidubrowser",t.BROWSER_TYPE_MAXTHON="maxthon",t.BROWSER_TYPE_OPERA="opera",t.BROWSER_TYPE_OUPENG="oupeng",t.BROWSER_TYPE_MIUI="miuibrowser",t.BROWSER_TYPE_FIREFOX="firefox",t.BROWSER_TYPE_SAFARI="safari",t.BROWSER_TYPE_CHROME="chrome",t.BROWSER_TYPE_LIEBAO="liebao",t.BROWSER_TYPE_QZONE="qzone",t.BROWSER_TYPE_SOUGOU="sogou",t.BROWSER_TYPE_UNKNOWN="unknown",t.isNative=!1,t.isBrowser="object"==typeof window&&"object"==typeof document&&!0,t.glExtension=function(t){return!!cc.renderer.device.ext(t)},t.getMaxJointMatrixSize=function(){if(!t._maxJointMatrixSize){var e=cc.game._renderContext,i=Math.floor(e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)/4)-10;t._maxJointMatrixSize=i<50?0:50}return t._maxJointMatrixSize},n.__globalAdapter&&n.__globalAdapter.adaptSys)n.__globalAdapter.adaptSys(t);else{var e=window,i=e.navigator,r=document,s=r.documentElement,o=i.userAgent.toLowerCase();t.isMobile=/mobile|android|iphone|ipad/.test(o),"undefined"!=typeof FbPlayableAd?t.platform=t.FB_PLAYABLE_ADS:t.platform=t.isMobile?t.MOBILE_BROWSER:t.DESKTOP_BROWSER;var a=i.language;a=a||i.browserLanguage,t.languageCode=a.toLowerCase(),a=a?a.split("-")[0]:t.LANGUAGE_ENGLISH,t.language=a;var c=!1,l=!1,h="",u=0,_=/android (\d+(?:\.\d+)*)/i.exec(o)||/android (\d+(?:\.\d+)*)/i.exec(i.platform);_&&(c=!0,h=_[1]||"",u=parseInt(h)||0),(_=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(o))?(l=!0,h=_[2]||"",u=parseInt(h)||0):/(iPhone|iPad|iPod)/.exec(i.platform)&&(l=!0,h="",u=0);var f=t.OS_UNKNOWN;-1!==i.appVersion.indexOf("Win")?f=t.OS_WINDOWS:l?f=t.OS_IOS:-1!==i.appVersion.indexOf("Mac")?f=t.OS_OSX:-1!==i.appVersion.indexOf("X11")&&-1===i.appVersion.indexOf("Linux")?f=t.OS_UNIX:c?f=t.OS_ANDROID:-1===i.appVersion.indexOf("Linux")&&-1===o.indexOf("ubuntu")||(f=t.OS_LINUX),t.os=f,t.osVersion=h,t.osMainVersion=u,t.browserType=t.BROWSER_TYPE_UNKNOWN,(function(){var e=/mqqbrowser|micromessenger|qq|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o)||/qqbrowser|ucbrowser|ubrowser|edge/i.exec(o)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),i=e?e[0].toLowerCase():t.BROWSER_TYPE_UNKNOWN;"safari"===i&&c?i=t.BROWSER_TYPE_ANDROID:"qq"===i&&o.match(/android.*applewebkit/i)&&(i=t.BROWSER_TYPE_ANDROID);var n={micromessenger:t.BROWSER_TYPE_WECHAT,trident:t.BROWSER_TYPE_IE,edge:t.BROWSER_TYPE_EDGE,"360 aphone":t.BROWSER_TYPE_360,mxbrowser:t.BROWSER_TYPE_MAXTHON,"opr/":t.BROWSER_TYPE_OPERA,ubrowser:t.BROWSER_TYPE_UC};t.browserType=n[i]||i})(),t.browserVersion="",(function(){var e=o.match(/(mqqbrowser|micromessenger|qq|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i);e||(e=o.match(/(qqbrowser|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i)),t.browserVersion=e?e[4]:""})();var d=window.innerWidth||document.documentElement.clientWidth,p=window.innerHeight||document.documentElement.clientHeight,m=window.devicePixelRatio||1;t.windowPixelResolution={width:m*d,height:m*p},t._checkWebGLRenderMode=function(){if(cc.game.renderType!==cc.game.RENDER_TYPE_WEBGL)throw new Error("This feature supports WebGL render mode only.")};var y=document.createElement("canvas");try{var v=t.localStorage=e.localStorage;v.setItem("storage",""),v.removeItem("storage"),v=null}catch(e){var g=function(){cc.warnID(5200)};t.localStorage={getItem:g,setItem:g,removeItem:g,clear:g}}var x=y.toDataURL("image/webp").startsWith("data:image/webp"),C=!!y.getContext("2d"),A=!1;e.WebGLRenderingContext&&(A=!0);var b,S=t.capabilities={canvas:C,opengl:A,webp:x};(void 0!==s.ontouchstart||void 0!==r.ontouchstart||i.msPointerEnabled)&&(S.touches=!0),void 0!==s.onmouseup&&(S.mouse=!0),void 0!==s.onkeyup&&(S.keyboard=!0),(e.DeviceMotionEvent||e.DeviceOrientationEvent)&&(S.accelerometer=!0),(function(){t.browserVersion;var e=!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext);b={ONLY_ONE:!1,WEB_AUDIO:e,DELAY_CREATE_CTX:!1},t.os===t.OS_IOS&&(b.USE_LOADER_EVENT="loadedmetadata"),t.browserType===t.BROWSER_TYPE_FIREFOX&&(b.DELAY_CREATE_CTX=!0,b.USE_LOADER_EVENT="canplay"),t.os===t.OS_ANDROID&&t.browserType===t.BROWSER_TYPE_UC&&(b.ONE_SOURCE=!0)})();try{b.WEB_AUDIO&&(b.context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),b.DELAY_CREATE_CTX&&setTimeout((function(){b.context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext)}),0))}catch(t){b.WEB_AUDIO=!1,cc.logID(5201)}var T=[];(function(){var t=document.createElement("audio");t.canPlayType&&(t.canPlayType('audio/ogg; codecs="vorbis"')&&T.push(".ogg"),t.canPlayType("audio/mpeg")&&T.push(".mp3"),t.canPlayType('audio/wav; codecs="1"')&&T.push(".wav"),t.canPlayType("audio/mp4")&&T.push(".mp4"),t.canPlayType("audio/x-m4a")&&T.push(".m4a"))})(),b.format=T,t.__audioSupport=b}return t.NetworkType={NONE:0,LAN:1,WWAN:2},t.getNetworkType=function(){return t.NetworkType.LAN},t.getBatteryLevel=function(){return 1},t.garbageCollect=function(){},t.restartVM=function(){},t.getSafeAreaRect=function(){var t=cc.view.getVisibleSize();return cc.rect(0,0,t.width,t.height)},t.isObjectValid=function(t){return!!t},t.dump=function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",t+="Using "+(cc.game.renderType===cc.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n",cc.log(t)},t.openURL=function(t){window.open(t)},t.now=function(){return Date.now?Date.now():+new Date},t})();e.exports=r}),{}],170:[(function(t,e,i){"use strict";var n=t("../event/event-target"),r=t("../platform/js"),s=t("../renderer");t("../platform/CCClass");var o={init:function(){this.html=document.getElementsByTagName("html")[0]},availWidth:function(t){return t&&t!==this.html?t.clientWidth:window.innerWidth},availHeight:function(t){return t&&t!==this.html?t.clientHeight:window.innerHeight},meta:{width:"device-width"},adaptationType:cc.sys.browserType};switch(cc.sys.os===cc.sys.OS_IOS&&(o.adaptationType=cc.sys.BROWSER_TYPE_SAFARI),o.adaptationType){case cc.sys.BROWSER_TYPE_SAFARI:o.meta["minimal-ui"]="true";case cc.sys.BROWSER_TYPE_SOUGOU:case cc.sys.BROWSER_TYPE_UC:o.availWidth=function(t){return t.clientWidth},o.availHeight=function(t){return t.clientHeight}}var a=null,c=function(){n.call(this);var t=this,e=cc.ContainerStrategy,i=cc.ContentStrategy;o.init(this),t._frameSize=cc.size(0,0),t._designResolutionSize=cc.size(0,0),t._originalDesignResolutionSize=cc.size(0,0),t._scaleX=1,t._scaleY=1,t._viewportRect=cc.rect(0,0,0,0),t._visibleRect=cc.rect(0,0,0,0),t._autoFullScreen=!1,t._devicePixelRatio=1,t._maxPixelRatio=2,t._retinaEnabled=!1,t._resizeCallback=null,t._resizing=!1,t._resizeWithBrowserSize=!1,t._orientationChanging=!0,t._isRotated=!1,t._orientation=cc.macro.ORIENTATION_AUTO,t._isAdjustViewport=!0,t._antiAliasEnabled=!1,t._resolutionPolicy=null,t._rpExactFit=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.EXACT_FIT),t._rpShowAll=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.SHOW_ALL),t._rpNoBorder=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.NO_BORDER),t._rpFixedHeight=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.FIXED_HEIGHT),t._rpFixedWidth=new cc.ResolutionPolicy(e.EQUAL_TO_FRAME,i.FIXED_WIDTH),cc.game.once(cc.game.EVENT_ENGINE_INITED,this.init,this)};cc.js.extend(c,n),cc.js.mixin(c.prototype,{init:function(){this._initFrameSize(),this.enableAntiAlias(!0);var t=cc.game.canvas.width,e=cc.game.canvas.height;this._designResolutionSize.width=t,this._designResolutionSize.height=e,this._originalDesignResolutionSize.width=t,this._originalDesignResolutionSize.height=e,this._viewportRect.width=t,this._viewportRect.height=e,this._visibleRect.width=t,this._visibleRect.height=e,cc.winSize.width=this._visibleRect.width,cc.winSize.height=this._visibleRect.height,cc.visibleRect&&cc.visibleRect.init(this._visibleRect)},_resizeEvent:function(t){var e,i=(e=this.setDesignResolutionSize?this:cc.view)._frameSize.width,n=e._frameSize.height,r=e._isRotated;if(cc.sys.isMobile){var s=cc.game.container.style,o=s.margin;s.margin="0",s.display="none",e._initFrameSize(),s.margin=o,s.display="block"}else e._initFrameSize();if(!0===t||e._isRotated!==r||e._frameSize.width!==i||e._frameSize.height!==n){var a=e._originalDesignResolutionSize.width,c=e._originalDesignResolutionSize.height;e._resizing=!0,a>0&&e.setDesignResolutionSize(a,c,e._resolutionPolicy),e._resizing=!1,e.emit("canvas-resize"),e._resizeCallback&&e._resizeCallback.call()}},_orientationChange:function(){cc.view._orientationChanging=!0,cc.view._resizeEvent()},resizeWithBrowserSize:function(t){t?this._resizeWithBrowserSize||(this._resizeWithBrowserSize=!0,window.addEventListener("resize",this._resizeEvent),window.addEventListener("orientationchange",this._orientationChange)):this._resizeWithBrowserSize&&(this._resizeWithBrowserSize=!1,window.removeEventListener("resize",this._resizeEvent),window.removeEventListener("orientationchange",this._orientationChange))},setResizeCallback:function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},setOrientation:function(t){if((t&=cc.macro.ORIENTATION_AUTO)&&this._orientation!==t){this._orientation=t;var e=this._originalDesignResolutionSize.width,i=this._originalDesignResolutionSize.height;this.setDesignResolutionSize(e,i,this._resolutionPolicy)}},_initFrameSize:function(){var t=this._frameSize,e=o.availWidth(cc.game.frame),i=o.availHeight(cc.game.frame),n=e>=i;!cc.sys.isMobile||n&&this._orientation&cc.macro.ORIENTATION_LANDSCAPE||!n&&this._orientation&cc.macro.ORIENTATION_PORTRAIT?(t.width=e,t.height=i,cc.game.container.style["-webkit-transform"]="rotate(0deg)",cc.game.container.style.transform="rotate(0deg)",this._isRotated=!1):(t.width=i,t.height=e,cc.game.container.style["-webkit-transform"]="rotate(90deg)",cc.game.container.style.transform="rotate(90deg)",cc.game.container.style["-webkit-transform-origin"]="0px 0px 0px",cc.game.container.style.transformOrigin="0px 0px 0px",this._isRotated=!0),this._orientationChanging&&setTimeout((function(){cc.view._orientationChanging=!1}),1e3)},_setViewportMeta:function(t,e){var i=document.getElementById("cocosMetaElement");i&&e&&document.head.removeChild(i);var n,r,s,o=document.getElementsByName("viewport"),a=o?o[0]:null;for(r in n=a?a.content:"",(i=i||document.createElement("meta")).id="cocosMetaElement",i.name="viewport",i.content="",t)-1==n.indexOf(r)?n+=","+r+"="+t[r]:e&&(s=new RegExp(r+"s*=s*[^,]+"),n.replace(s,r+"="+t[r]));/^,/.test(n)&&(n=n.substr(1)),i.content=n,a&&(a.content=n),document.head.appendChild(i)},_adjustViewportMeta:function(){this._isAdjustViewport&&(this._setViewportMeta(o.meta,!1),this._isAdjustViewport=!1)},adjustViewportMeta:function(t){this._isAdjustViewport=t},enableRetina:function(t){this._retinaEnabled=!!t},isRetinaEnabled:function(){return this._retinaEnabled},enableAntiAlias:function(t){if(this._antiAliasEnabled!==t)if(this._antiAliasEnabled=t,cc.game.renderType===cc.game.RENDER_TYPE_WEBGL){var e=cc.loader._cache;for(var i in e){var n=e[i],r=n&&n.content instanceof cc.Texture2D?n.content:null;if(r){var s=cc.Texture2D.Filter;t?r.setFilters(s.LINEAR,s.LINEAR):r.setFilters(s.NEAREST,s.NEAREST)}}}else if(cc.game.renderType===cc.game.RENDER_TYPE_CANVAS){var o=cc.game.canvas.getContext("2d");o.imageSmoothingEnabled=t,o.mozImageSmoothingEnabled=t}},isAntiAliasEnabled:function(){return this._antiAliasEnabled},enableAutoFullScreen:function(t){t&&t!==this._autoFullScreen&&cc.sys.isMobile?(this._autoFullScreen=!0,cc.screen.autoFullScreen(cc.game.frame)):(this._autoFullScreen=!1,cc.screen.disableAutoFullScreen(cc.game.frame))},isAutoFullScreenEnabled:function(){return this._autoFullScreen},setCanvasSize:function(t,e){var i=cc.game.canvas,n=cc.game.container;i.width=t*this._devicePixelRatio,i.height=e*this._devicePixelRatio,i.style.width=t+"px",i.style.height=e+"px",n.style.width=t+"px",n.style.height=e+"px",this._resizeEvent()},getCanvasSize:function(){return cc.size(cc.game.canvas.width,cc.game.canvas.height)},getFrameSize:function(){return cc.size(this._frameSize.width,this._frameSize.height)},setFrameSize:function(t,e){this._frameSize.width=t,this._frameSize.height=e,cc.game.frame.style.width=t+"px",cc.game.frame.style.height=e+"px",this._resizeEvent(!0)},getVisibleSize:function(){return cc.size(this._visibleRect.width,this._visibleRect.height)},getVisibleSizeInPixel:function(){return cc.size(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},getVisibleOrigin:function(){return cc.v2(this._visibleRect.x,this._visibleRect.y)},getVisibleOriginInPixel:function(){return cc.v2(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},getResolutionPolicy:function(){return this._resolutionPolicy},setResolutionPolicy:function(t){var e=this;if(t instanceof cc.ResolutionPolicy)e._resolutionPolicy=t;else{var i=cc.ResolutionPolicy;t===i.EXACT_FIT&&(e._resolutionPolicy=e._rpExactFit),t===i.SHOW_ALL&&(e._resolutionPolicy=e._rpShowAll),t===i.NO_BORDER&&(e._resolutionPolicy=e._rpNoBorder),t===i.FIXED_HEIGHT&&(e._resolutionPolicy=e._rpFixedHeight),t===i.FIXED_WIDTH&&(e._resolutionPolicy=e._rpFixedWidth)}},setDesignResolutionSize:function(t,e,i){if(t>0||e>0){this.setResolutionPolicy(i);var n=this._resolutionPolicy;if(n&&n.preApply(this),cc.sys.isMobile&&this._adjustViewportMeta(),this._orientationChanging=!0,this._resizing||this._initFrameSize(),n){this._originalDesignResolutionSize.width=this._designResolutionSize.width=t,this._originalDesignResolutionSize.height=this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var o=this._viewportRect,a=this._visibleRect,c=r.viewport;o.x=c.x,o.y=c.y,o.width=c.width,o.height=c.height,a.x=0,a.y=0,a.width=c.width/this._scaleX,a.height=c.height/this._scaleY}n.postApply(this),cc.winSize.width=this._visibleRect.width,cc.winSize.height=this._visibleRect.height,cc.visibleRect&&cc.visibleRect.init(this._visibleRect),s.updateCameraViewport(),_cc.inputManager._updateCanvasBoundingRect(),this.emit("design-resolution-changed")}else cc.logID(2201)}else cc.logID(2200)},getDesignResolutionSize:function(){return cc.size(this._designResolutionSize.width,this._designResolutionSize.height)},setRealPixelResolution:function(t,e,i){this._setViewportMeta({width:t},!0),document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},setViewportInPoints:function(t,e,i,n){var r=this._scaleX,s=this._scaleY;cc.game._renderContext.viewport(t*r+this._viewportRect.x,e*s+this._viewportRect.y,i*r,n*s)},setScissorInPoints:function(t,e,i,n){var r=this._scaleX,s=this._scaleY,o=Math.ceil(t*r+this._viewportRect.x),c=Math.ceil(e*s+this._viewportRect.y),l=Math.ceil(i*r),h=Math.ceil(n*s),u=cc.game._renderContext;if(!a){var _=u.getParameter(u.SCISSOR_BOX);a=cc.rect(_[0],_[1],_[2],_[3])}a.x===o&&a.y===c&&a.width===l&&a.height===h||(a.x=o,a.y=c,a.width=l,a.height=h,u.scissor(o,c,l,h))},isScissorEnabled:function(){return cc.game._renderContext.isEnabled(gl.SCISSOR_TEST)},getScissorRect:function(){if(!a){var t=gl.getParameter(gl.SCISSOR_BOX);a=cc.rect(t[0],t[1],t[2],t[3])}var e=1/this._scaleX,i=1/this._scaleY;return cc.rect((a.x-this._viewportRect.x)*e,(a.y-this._viewportRect.y)*i,a.width*e,a.height*i)},getViewportRect:function(){return this._viewportRect},getScaleX:function(){return this._scaleX},getScaleY:function(){return this._scaleY},getDevicePixelRatio:function(){return this._devicePixelRatio},convertToLocationInView:function(t,e,i,n){var r=n||cc.v2(),s=i.adjustedLeft?i.adjustedLeft:i.left,o=i.adjustedTop?i.adjustedTop:i.top,a=this._devicePixelRatio*(t-s),c=this._devicePixelRatio*(o+i.height-e);return this._isRotated?(r.x=cc.game.canvas.width-c,r.y=a):(r.x=a,r.y=c),r},_convertMouseToLocationInView:function(t,e){var i=this._viewportRect;t.x=(this._devicePixelRatio*(t.x-e.left)-i.x)/this._scaleX,t.y=(this._devicePixelRatio*(e.top+e.height-t.y)-i.y)/this._scaleY},_convertPointWithScale:function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},_convertTouchesWithScale:function(t){for(var e,i,n,r=this._viewportRect,s=this._scaleX,o=this._scaleY,a=0;a=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||s(r,(e=i[n+1])&&e.__attrs__)}return s(t,(e=i[0])&&e.__attrs__),t.__attrs__}function a(t,e,i){var n=c(t),s=e+r,o={};for(var a in n)a.startsWith(s)&&(o[a.slice(s.length)]=n[a]);return o}function c(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||o(t)}function l(t,e){this.name=t,this.default=e}l.prototype.toString=function(){return this.name},cc.Integer=new l("Integer",0),cc.Float=new l("Float",0),cc.Boolean=new l("Boolean",!1),cc.String=new l("String",""),e.exports={PrimitiveType:l,attr:a,getClassAttrs:c,setClassAttr:function(t,e,i,n){c(t)[e+r+i]=n},DELIMETER:r,getTypeChecker_ET:!1,getObjTypeChecker_ET:!1,ScriptUuid:{}}}),{"./CCClass":160,"./js":180,"./utils":184}],173:[(function(t,e,i){"use strict";var n=t("./js"),r=n.array.fastRemoveAt;function s(){}function o(){this.callback=s,this.target=void 0,this.once=!1}o.prototype.set=function(t,e,i){this.callback=t,this.target=e,this.once=!!i};var a=new n.Pool(function(t){return t.callback=s,t.target=void 0,t.once=!1,!0},32);function c(){this.callbackInfos=[],this.isInvoking=!1,this.containCanceled=!1}a.get=function(){return this._get()||new o};var l=c.prototype;l.removeByCallback=function(t){for(var e=0;e=0;--t){this.callbackInfos[t]||r(this.callbackInfos,t)}this.containCanceled=!1},l.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1};var h=new n.Pool(function(t){return t.callback=s,t.target=void 0,t.once=!1,!0},16);function u(){this._callbackTable=n.createMap(!0)}h.get=function(){return this._get()||new c},(l=u.prototype).on=function(t,e,i,n){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=h.get());var s=a.get();s.set(e,i,n),r.callbackInfos.push(s)},l.hasEventListener=function(t,e,i){var n=this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var o=0;o0?this.deserializedList[0]:[]}else this.deserializedList.length=1,this.deserializedData=t?this._deserializeObject(t,!1):null,this.deserializedList[0]=this.deserializedData;return e(this),this.deserializedData},i._deserializeObject=function(t,e,i,r,s){var o,a=null,c=null,h=t.__type__;if("TypedArray"===h){var u=t.array;a=new window[t.ctor](u.length);for(var _=0;_0&&(i=f+this.globalVariables.join(",")+";");var n=l.flattenCodeArray(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r1)t.push(p+"="+this._targetExp+";"),e=p;else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i=0&&(f(t,i),!0)}o.formatStr=function(){var t=arguments.length;if(0===t)return"";var e=arguments[0];if(1===t)return""+e;if("string"==typeof e&&u.test(e))for(var i=1;i=0&&(t[i]=t[t.length-1],--t.length)},removeAt:f,fastRemoveAt:function(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)},contains:function(t,e){return t.indexOf(e)>=0},verifyType:function(t,e){if(t&&t.length>0)for(var i=0;i0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},m.prototype.put=function(t){var e=this._pool;if(this.count=0&&(this._pool.length=t,this.count>t&&(this.count=t))},o.Pool=m,cc.js=o,e.exports=o}),{"../utils/mutable-forward-iterator":250,"./id-generater":176}],181:[(function(t,e,i){"use strict";var n=t("./js"),r=t("./attribute"),s={url:{canUsedInGet:!0},default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function o(t,e,i,n){if(!t.get&&!t.set)if(t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var o={};for(var a in n[r]=o,s){var c=s[a];t.hasOwnProperty(a)&&(o[a]=t[a],c.canUsedInGet||delete t[a])}}else 0}function a(t,e,i,n){Array.isArray(n)&&n.length>0&&(n=n[0]),t.type=n}function c(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return cc.errorID(5508,i,n);if(cc.RawAsset.isRawAssetType(e[0]))return t.url=e[0],void delete t.type;t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=cc.String:e===Boolean?t.type=cc.Boolean:e===Number&&(t.type=cc.Float))}i.getFullFormOfProperty=function(t,e,i){if(t&&t.constructor===Object)return null;if(Array.isArray(t)&&t.length>0){t[0];return{default:[],type:t,_short:!0}}if("function"==typeof t){var s=t;return cc.RawAsset.isRawAssetType(s)||cc.RawAsset.wasRawAssetType(s)?{default:"",url:s,_short:!0}:{default:n.isChildClassOf(s,cc.ValueType)?new s:null,type:s,_short:!0}}return t instanceof r.PrimitiveType?{default:t.default,_short:!0}:{default:t,_short:!0}},i.preprocessAttrs=function(t,e,n,r){for(var s in t){var l=t[s],h=i.getFullFormOfProperty(l,s,e);if(h&&(l=t[s]=h),l){var u=l.notify;u&&o(l,s,u,t),"type"in l&&c(l,l.type,e,s),"url"in l&&a(l,0,0,l.url),"type"in l&&l.type}}},i.validateMethodWithProps=function(t,e,i,n,r){return"function"==typeof t||null===t}}),{"./CCClass":160,"./attribute":172,"./js":180}],182:[(function(t,e,i){"use strict";var n=[];cc._RF={push:function(t,e,i){void 0===i&&(i=e,e=""),n.push({uuid:e,script:i,module:t,exports:t.exports,beh:null})},pop:function(){var t=n.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var r in i)return;e.exports=i=t.cls}},peek:function(){return n[n.length-1]}}}),{}],183:[(function(t,e,i){"use strict";cc.url={_rawAssets:"",normalize:function(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t},raw:function(t){if((t=this.normalize(t)).startsWith("resources/")){var e=cc.loader._getResUuid(t.slice(10),cc.Asset,null,!0);if(e)return cc.AssetLibrary.getLibUrlNoExt(e,!0)+cc.path.extname(t)}else cc.errorID(7002,t);return this._rawAssets+t},_init:function(t){this._rawAssets=cc.path.stripSep(t)+"/"}},e.exports=cc.url}),{}],184:[(function(t,e,i){"use strict";t("./js");e.exports={contains:function(t,e){if("function"==typeof t.contains)return t.contains(e);if("function"==typeof t.compareDocumentPosition)return!!(16&t.compareDocumentPosition(e));var i=e.parentNode;if(i)do{if(i===t)return!0;i=i.parentNode}while(null!==i);return!1},isDomNode:"object"==typeof window&&("function"==typeof Node?function(t){return t instanceof Node}:function(t){return t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}),callInNextTick:function(t,e,i){t&&setTimeout((function(){t(e,i)}),0)}}}),{"./js":180}],185:[(function(t,e,i){"use strict";t("./platform/js"),t("./value-types"),t("./utils"),t("./platform/CCInputManager"),t("./platform/CCInputExtension"),t("./event"),t("./platform/CCSys"),t("./platform/CCMacro"),t("./load-pipeline"),t("./CCDirector"),t("./renderer"),t("./platform/CCView"),t("./platform/CCScreen"),t("./CCScheduler"),t("./event-manager")}),{"./CCDirector":28,"./CCScheduler":33,"./event":100,"./event-manager":96,"./load-pipeline":120,"./platform/CCInputExtension":163,"./platform/CCInputManager":164,"./platform/CCMacro":165,"./platform/CCScreen":168,"./platform/CCSys":169,"./platform/CCView":170,"./platform/js":180,"./renderer":207,"./utils":248,"./value-types":263}],186:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(){function t(t,e){for(var i=0;i>2,c=s._vData;n.length+a>c.length?c.set(n.subarray(0,c.length-a),a):c.set(n,a);for(var l=s._iData,h=o.indiceOffset,u=o.vertexOffset,_=0,f=r.length;_=32||this.pool.push(t)}};r.default._canvasPool=c,n.default.register(r.default,{getConstructor:function(t){var e=s.default;return t.font instanceof cc.BitmapFont?e=o.default:t.cacheMode===r.default.CacheMode.CHAR&&cc.warn("sorry, canvas mode does not support CHAR mode currently!"),e},TTF:s.default,Bmfont:o.default})}),{"../../../../components/CCLabel":73,"../../../assembler":187,"./bmfont":197,"./ttf":199}],199:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=o(t("../../../utils/label/ttf")),r=o(t("../render-data")),s=o(t("../utils"));function o(t){return t&&t.__esModule?t:{default:t}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var h=(function(t){function e(){return a(this,e),c(this,t.apply(this,arguments))}return l(e,t),e.prototype.init=function(){this._renderData=new r.default,this._renderData.dataLength=2},e.prototype.updateColor=function(){},e.prototype.updateVerts=function(t){var e=this._renderData,i=t.node,n=i.width,r=i.height,s=i.anchorX*n,o=i.anchorY*r,a=e.vertices;a[0].x=-s,a[0].y=-o,a[1].x=n-s,a[1].y=r-o},e.prototype._updateTexture=function(t){n.default.prototype._updateTexture.call(this,t);var e=t._frame._texture;s.default.dropColorizedImage(e,t.node.color)},e.prototype.draw=function(t,e){var i=e.node,n=i._worldMatrix.m,r=n[0],o=n[1],a=n[4],c=n[5],l=n[12],h=n[13];t.transform(r,o,a,c,l,h),t.scale(1,-1),s.default.context.setGlobalAlpha(t,i.opacity/255);var u=e._frame._texture,_=this._renderData.vertices,f=u.getHtmlElementObj(),d=_[0].x,p=_[0].y,m=_[1].x-d,y=_[1].y-p;return p=-p-y,t.drawImage(f,d,p,m,y),1},e})(n.default);i.default=h,e.exports=i.default}),{"../../../utils/label/ttf":214,"../render-data":201,"../utils":206}],200:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../assembler"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=t("../../../components/CCMask"),c=(t("./graphics"),(function(t){function e(){return r(this,e),s(this,t.apply(this,arguments))}return o(e,t),e.prototype.draw=function(t,e){t.save(),e._graphics._assembler.draw(t,e._graphics),t.clip()},e.prototype.postDraw=function(t,e){t.restore()},e})(n.default));i.default=c,n.default.register(a,c),e.exports=i.default}),{"../../../components/CCMask":75,"../../assembler":187,"./graphics":195}],201:[(function(t,e,i){"use strict";i.__esModule=!0;var n=(function(){function t(t,e){for(var i=0;i1?1:d,p=isNaN(p)||p>1?1:p,_=_<0?0:_,f=f<0?0:f,a._rotated?(e[0].y=-s,e[0].x=-o,e[1].y=l*d-s,e[1].x=u*p-o,e[2].y=e[1].y+_,e[2].x=e[1].x+f,e[3].y=n-s,e[3].x=r-o):(e[0].x=-s,e[0].y=-o,e[1].x=c*d-s,e[1].y=u*p-o,e[2].x=e[1].x+_,e[2].y=e[1].y+f,e[3].x=n-s,e[3].y=r-o),t._vertsDirty=!1},e.prototype.draw=function(t,e){var i=e.node,n=e._spriteFrame,r=i._worldMatrix.m,s=r[0],o=r[1],a=r[4],c=r[5],h=r[12],u=r[13];t.transform(s,o,a,c,h,u),t.scale(1,-1),n._rotated&&t.rotate(-Math.PI/2),l.context.setGlobalAlpha(t,i.opacity/255);for(var _=n._texture,f=this._renderData.vertices,d=l.getColorizedImage(_,i._color),p=0,m=void 0,y=void 0,v=void 0,g=void 0,x=void 0,C=void 0,A=void 0,b=void 0,S=void 0,T=void 0,w=void 0,E=void 0,B=0;B<3;++B){g=f[B],v=f[B+1];for(var M=0;M<3;++M)m=f[M],y=f[M+1],x=m.x,C=g.y,A=y.x-x,C=-C-(b=v.y-C),S=m.u,T=v.v,w=y.u-S,E=g.v-T,w>0&&E>0&&A>0&&b>0&&(t.drawImage(d,S,T,w,E,x,C,A,b),p++)}return p},e})(r.default);i.default=h,e.exports=i.default}),{"../../../assembler":187,"../render-data":201,"../utils":206,"./simple":203}],205:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../../assembler"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=t("../utils"),c=(function(t){function e(){return r(this,e),s(this,t.apply(this,arguments))}return o(e,t),e.prototype.draw=function(t,e){var i=e.node,n=i._worldMatrix.m,r=n[0],s=n[1],o=n[4],c=n[5],l=n[12],h=n[13];t.transform(r,s,o,c,l,h),t.scale(1,-1),a.context.setGlobalAlpha(t,i.opacity/255);var u=e.spriteFrame,_=u._rect,f=u._texture,d=_.x,p=_.y,m=u._rotated?_.height:_.width,y=u._rotated?_.width:_.height,v=a.getFrameCache(f,i._color,d,p,m,y),g=i.width,x=i.height,C=-i.anchorX*g,A=-i.anchorY*x;return A=-A-x,t.translate(C,A),t.fillStyle=t.createPattern(v,"repeat"),t.fillRect(0,0,g,x),1},e})(n.default);i.default=c,e.exports=i.default}),{"../../../assembler":187,"../utils":206}],206:[(function(t,e,i){"use strict";function n(t,e,i,n,r,s,o){var a=e._image,c=t.getContext("2d");return t.width=s,t.height=o,c.globalCompositeOperation="source-over",c.fillStyle="rgb("+i.r+","+i.g+","+i.b+")",c.fillRect(0,0,s,o),c.globalCompositeOperation="multiply",c.drawImage(a,n,r,s,o,0,0,s,o),c.globalCompositeOperation="destination-atop",c.drawImage(a,n,r,s,o,0,0,s,o),t}var r={canvasMap:{},canvasUsed:{},canvasPool:[],checking:!1,check:function(){var t=!1;for(var e in this.canvasUsed)if(t=!0,this.canvasUsed[e])this.canvasUsed[e]=!1;else{var i=this.canvasMap[e];i.width=0,i.height=0,this.canvasPool.length<32&&this.canvasPool.push(i),delete this.canvasMap[e],delete this.canvasUsed[e]}t||(cc.director.off(cc.Director.EVENT_AFTER_DRAW,this.check,this),this.checking=!1)},startCheck:function(){cc.director.on(cc.Director.EVENT_AFTER_DRAW,this.check,this),this.checking=!0},getCanvas:function(t){return this.canvasUsed[t]=!0,this.canvasMap[t]},cacheCanvas:function(t,e){this.canvasMap[e]=t,this.canvasUsed[e]=!0,this.checking||this.startCheck()},dropImage:function(t){this.canvasMap[t]&&delete this.canvasMap[t]}};e.exports={getColorizedImage:function(t,e){if(!t)return null;if(0===t.width||0===t.height)return t._image;var i=16777215&e._val;if(16777215===i)return t._image;var s=t.url+i,o=r.getCanvas(s);return o||(n(o=r.canvasPool.pop()||document.createElement("canvas"),t,e,0,0,t.width,t.height),r.cacheCanvas(o,s)),o},getFrameCache:function(t,e,i,s,o,a){if(!t||!t.url||i<0||s<0||o<=0||a<=0)return null;var c=t.url,l=!1,h=16777215&e._val;if(16777215!==h&&(c+=h,l=!0),(0!==i||0!==s&&o!==t.width&&a!==t.height)&&(c+="_"+i+"_"+s+"_"+o+"_"+a,l=!0),!l)return t._image;var u=r.getCanvas(c);return u||(n(u=r.canvasPool.pop()||document.createElement("canvas"),t,e,i,s,o,a),r.cacheCanvas(u,c)),u},dropColorizedImage:function(t,e){var i=t.url+(16777215&e._val);r.dropImage(i)}};var s=-1,o={setGlobalAlpha:function(t,e){s!==e&&(s=e,t.globalAlpha=s)},reset:function(){s=-1}};e.exports.context=o}),{}],207:[(function(t,e,i){"use strict";var n=a(t("../../renderer/config")),r=a(t("../../renderer/gfx")),s=a(t("../../renderer/core/input-assembler")),o=a(t("../../renderer/core/pass"));function a(t){return t&&t.__esModule?t:{default:t}}function c(t){return{defaultTexture:new r.default.Texture2D(t,{images:[],width:128,height:128,wrapS:r.default.WRAP_REPEAT,wrapT:r.default.WRAP_REPEAT,format:r.default.TEXTURE_FMT_RGB8,mipmap:!1}),programTemplates:[],programChunks:{}}}cc.renderer=e.exports={Texture2D:null,InputAssembler:s.default,Pass:o.default,renderEngine:null,canvas:null,device:null,scene:null,drawCalls:0,_handle:null,_cameraNode:null,_camera:null,_forward:null,_flow:null,initWebGL:function(e,i){t("./webgl/assemblers");var s=t("./webgl/model-batcher");this.Texture2D=r.default.Texture2D,this.canvas=e,this._flow=cc.RenderFlow;var o=t("../../renderer/scene/scene"),a=t("../../renderer/renderers/forward-renderer");this.device=new r.default.Device(e,i),this.scene=new o;var l=c(this.device);this._forward=new a(this.device,l),this._handle=new s(this.device,this.scene),this._flow.init(this._handle,this._forward),n.default.addStage("shadowcast"),n.default.addStage("opaque"),n.default.addStage("transparent")},initCanvas:function(e){var i=t("./canvas"),n=t("./canvas/Texture2D"),r=t("./canvas/Device");this.Device=r,this.Texture2D=n,this.canvas=e,this.device=new r(e),this._camera={a:1,b:0,c:0,d:1,tx:0,ty:0},this._handle=new i.RenderComponentHandle(this.device,this._camera),this._forward=new i.ForwardRenderer,this._flow=cc.RenderFlow,this._flow.init(this._handle,this._forward)},updateCameraViewport:function(){if(cc.director){var t=cc.director.getScene();t&&t.setScale(1,1,1)}if(cc.game.renderType===cc.game.RENDER_TYPE_CANVAS){var e=cc.view.getViewportRect();this.device.setViewport(e.x,e.y,e.width,e.height),this._camera.a=cc.view.getScaleX(),this._camera.d=cc.view.getScaleY(),this._camera.tx=e.x,this._camera.ty=e.y+e.height}},render:function(t,e){this.device.resetDrawCalls(),t&&(this._flow.render(t,e),this.drawCalls=this.device.getDrawCalls())},clear:function(){this._handle.reset(),this._forward.clear()}}}),{"../../renderer/config":295,"../../renderer/core/input-assembler":298,"../../renderer/core/pass":299,"../../renderer/gfx":308,"../../renderer/renderers/forward-renderer":327,"../../renderer/scene/scene":330,"./canvas":191,"./canvas/Device":188,"./canvas/Texture2D":189,"./webgl/assemblers":219,"./webgl/model-batcher":235}],208:[(function(t,e,i){"use strict";var n=0,r=1<0;)i&t&&(e=S(i,e)),i>>=1;return e}function w(t){var e=t._renderFlag;(b[e]=T(e))._func(t)}x.flows=b,x.createFlow=S,x.visitRootNode=function(t){g=1<this._width&&(this._x=r,this._y=this._nexty),this._y+c+r>this._nexty&&(this._nexty=this._y+c+r),this._nexty>this._height)return null;cc.dynamicAtlasManager.textureBleeding&&(this._texture.drawTextureAt(i,this._x-1,this._y),this._texture.drawTextureAt(i,this._x+1,this._y),this._texture.drawTextureAt(i,this._x,this._y-1),this._texture.drawTextureAt(i,this._x,this._y+1)),this._texture.drawTextureAt(i,this._x,this._y),this._innerTextureInfos[i._id]={x:this._x,y:this._y,texture:i},s+=this._x,o+=this._y,this._x+=a+r,this._dirty=!0}var l={x:s,y:o,texture:this._texture};return this._innerSpriteFrames.push(t),l},update:function(){this._dirty&&(this._texture.update(),this._dirty=!1)},deleteInnerTexture:function(t){t&&delete this._innerTextureInfos[t._id]},reset:function(){this._x=r,this._y=r,this._nexty=r;for(var t=this._innerSpriteFrames,e=0,i=t.length;e0&&n>0&&G+u.w*S>N&&!a.isUnicodeSpace(p)){m.push(o),o=0,i++,n=0,r-=D*S+0,I=!0;break}_.x=G,_.y=r-u.offsetY*S+h.margin,this._recordLetterInfo(_,p,L,i),L+1_.y-u.h*S&&(T=_.y-u.h*S)}else this._recordPlaceholderInfo(L,p),console.log("Can't find letter definition in texture atlas "+v.atlasName+" for letter:"+p);else this._recordPlaceholderInfo(L,p)}I||(n=M,o=B,cT&&(l=T),s1&&(x+=0*(g-1)),w.width=V,w.height=F,V<=0&&(w.width=parseFloat(s.toFixed(2))+2*h.margin),F<=0&&(w.height=parseFloat(x.toFixed(2))+2*h.margin),A=w.height,b=0,c>0&&(A=w.height+c),l<-x&&(b=x+l),!0},e.prototype._getFirstCharLen=function(){return 1},e.prototype._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(a.isUnicodeCJK(n)||"\n"===n||a.isUnicodeSpace(n))return 1;var r=1,s=h.fontAtlas.getLetterDefinitionForChar(n,h);if(!s)return r;for(var o=s.xAdvance*S+P,c=e+1;cN&&!a.isUnicodeSpace(n)&&N>0)return r;if(o+=s.xAdvance*S+P,"\n"===n||a.isUnicodeSpace(n)||a.isUnicodeCJK(n))break;r++}return r},e.prototype._multilineTextWrapByWord=function(){return this._multilineTextWrap(this._getFirstWordLen)},e.prototype._multilineTextWrapByChar=function(){return this._multilineTextWrap(this._getFirstCharLen)},e.prototype._recordPlaceholderInfo=function(t,e){if(t>=p.length){var i=new u;p.push(i)}p[t].char=e,p[t].hash=e.charCodeAt(0)+h.hash,p[t].valid=!1},e.prototype._recordLetterInfo=function(t,e,i,n){if(i>=p.length){var r=new u;p.push(r)}var s=e.charCodeAt(0)+h.hash;p[i].line=n,p[i].char=e,p[i].hash=s,p[i].valid=h.fontAtlas.getLetter(s).valid,p[i].x=t.x,p[i].y=t.y},e.prototype._alignText=function(){x=0,m.length=0,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),L===l.SHRINK&&B>0&&this._isVerticalClamp()&&this._shrinkLabelToContentSize(this._isVerticalClamp),this._updateQuads()||L===l.SHRINK&&this._shrinkLabelToContentSize(this._isHorizontalClamp)},e.prototype._scaleFontSizeDown=function(t){var e=!0;t||(t=.1,e=!1),B=t,e&&this._updateContent()},e.prototype._shrinkLabelToContentSize=function(t){for(var e=B,i=0,n=!0;t();){var r=e-++i;if(n=!1,r<=0)break;S=r/M,this._multilineTextWrapByWord(),this._computeAlignmentOffset()}n||e-i>=0&&this._scaleFontSizeDown(e-i)},e.prototype._isVerticalClamp=function(){return x>w.height},e.prototype._isHorizontalClamp=function(){for(var t=!1,e=0,i=E.length;e0)if(O){if(m[o]>w.width&&(s>w.width||s<0)){t=!0;break}}else if(s>w.width){t=!0;break}}}return t},e.prototype._isHorizontalClamped=function(t,e){var i=m[e],n=t>w.width||t<0;return O?i>w.width&&n:n},e.prototype._updateQuads=function(){var t=h.fontAtlas.getTexture(),e=f.node;this.verticesCount=this.indicesCount=0;for(var i=w,n=e._anchorPoint.x*i.width,r=e._anchorPoint.y*i.height,s=!0,o=0,a=E.length;o0){if(d>A){var m=d-A;_.y+=m,_.height-=m,d-=m}d-u.h*S0&&this._isHorizontalClamped(g,v))if(L===l.CLAMP)_.width=0;else if(L===l.SHRINK){if(w.width>u.w){s=!1;break}_.width=0}if(_.height>0&&_.width>0){var x=this._determineRect(_),T=c.x+y[c.line];this.appendQuad(f,t,_,x,T-n,d-r,S)}}}return this._quadsUpdated(f),s},e.prototype._determineRect=function(t){var e=T.isRotated(),i=T._originalSize,n=T._rect,r=T._offset,s=r.x+(i.width-n.width)/2,o=r.y-(i.height-n.height)/2;if(e){var a=t.x;t.x=n.x+n.height-t.y-t.height-o,t.y=a+n.y-s,t.y<0&&(t.height=t.height+o)}else t.x+=n.x-s,t.y+=n.y+o;return e},e.prototype._computeAlignmentOffset=function(){switch(y.length=0,I){case c.TextAlignment.LEFT:for(var t=0;tthis._width&&(this._x=v,this._y=this._nexty),this._y+n>this._nexty&&(this._nexty=this._y+n+v),this._nexty>this._height)return null;this._fontDefDictionary._texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var r=new p;return r.u=this._x,r.v=this._y,r.texture=this._fontDefDictionary._texture,r.valid=!0,r.w=t._width,r.h=t._height,r.xAdvance=t._width,r.offsetY=t._offsetY,this._x+=i+v,this._fontDefDictionary.addLetterDefinitions(t._hash,r),r},update:function(){this._dirty&&(this._fontDefDictionary._texture.update(),this._dirty=!1)},reset:function(){this._x=v,this._y=v,this._nexty=v;for(var t=this._fontDefDictionary._letterDefinitions,e=0,i=t.length;e0?P:null)&&D.set(P.color),(L=(L=u&&t.getComponent(u))&&L.enabled?L:null)&&(O.set(L.color),O.a=O.a*t.node.color.a/255),this._updatePaddingRect()},e.prototype._calculateFillTextStartPosition=function(){var t=0;w===c.TextAlignment.RIGHT?t=S.width-V.width:w===c.TextAlignment.CENTER&&(t=(S.width-V.width)/2);var e=0,i=this._getLineHeight()*(b.length-1);return e=E===c.VerticalTextAlignment.TOP?C:E===c.VerticalTextAlignment.CENTER?.5*(S.height-i)+C*a.MIDDLE_RATIO-V.height/2:S.height-i-C*a.BASELINE_RATIO-V.height,cc.v2(t+V.x,e+V.y)},e.prototype._setupOutline=function(){m.strokeStyle="rgba("+D.r+", "+D.g+", "+D.b+", "+D.a/255+")",m.lineWidth=2*P.width},e.prototype._setupShadow=function(){m.shadowColor="rgba("+O.r+", "+O.g+", "+O.b+", "+O.a/255+")",m.shadowBlur=L.blur,m.shadowOffsetX=L.offset.x,m.shadowOffsetY=-L.offset.y},e.prototype._drawUnderline=function(t){P&&(this._setupOutline(),m.strokeRect(W.x,W.y,t,U)),m.lineWidth=U,m.fillStyle="rgba("+B.r+", "+B.g+", "+B.b+", "+B.a/255+")",m.fillRect(W.x,W.y,t,U)},e.prototype._updateTexture=function(){m.clearRect(0,0,y.width,y.height);var t=P?D:B;m.fillStyle="rgba("+t.r+", "+t.g+", "+t.b+", "+p+")",m.fillRect(0,0,y.width,y.height),m.font=g;var e=this._calculateFillTextStartPosition(),i=this._getLineHeight();m.lineJoin="round",m.fillStyle="rgba("+B.r+", "+B.g+", "+B.b+", 1)";var n=b.length>1,r=this._measureText(m),s=0,o=0;L&&this._setupShadow(),P&&this._setupOutline();for(var a=0;as?i:s}n=(b.length+a.BASELINE_RATIO)*this._getLineHeight();var o=parseFloat(i.toFixed(2)),c=parseFloat(n.toFixed(2));S.width=o+V.width,S.height=c+V.height,N.width=o+F.width,N.height=c+F.height}S.width=Math.min(S.width,2048),S.height=Math.min(S.height,2048),y.width!==S.width&&(y.width=S.width),y.height!==S.height&&(y.height=S.height)},e.prototype._calculateTextBaseline=function(){var t=void 0;t=w===c.TextAlignment.RIGHT?"right":w===c.TextAlignment.CENTER?"center":"left",m.textAlign=t,m.textBaseline="alphabetic"},e.prototype._calculateSplitedStrings=function(){var t=x.split("\n");if(R){b=[];for(var e=N.width,i=0;io||r>s;){if(h?c=u/2|0:u=c=u-1,c<=0){cc.logID(4003);break}for(C=c,g=this._getFontDesc(),m.font=g,n=0,i=0;io?u=0|c:(h=!1,n=o+1))}}else{for(n=t.length*this._getLineHeight(),i=0;i80*i){n=a=t[0],s=c=t[1];for(var y=i;ya&&(a=l),h>c&&(c=h);_=Math.max(a-n,c-s)}return o(p,m,i,n,s,_),m}function r(t,e,i,n,r){var s,o;if(r===R(t,e,i,n)>0)for(s=e;s=e;s-=n)o=B(s,t[s],t[s+1],o);return o&&A(o,o.next)&&(M(o),o=o.next),o}function s(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!A(n,n.next)&&0!==C(n.prev,n,n.next))n=n.next;else{if(M(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function o(t,e,i,n,r,u,_){if(t){!_&&u&&p(t,n,r,u);for(var f,d,m=t;t.prev!==t.next;)if(f=t.prev,d=t.next,u?c(t,n,r,u):a(t))e.push(f.i/i),e.push(t.i/i),e.push(d.i/i),M(t),t=d.next,m=d.next;else if((t=d)===m){_?1===_?o(t=l(t,e,i),e,i,n,r,u,2):2===_&&h(t,e,i,n,r,u):o(s(t),e,i,n,r,u,1);break}}}function a(t){var e=t.prev,i=t,n=t.next;if(C(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(g(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&C(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function c(t,e,i,n){var r=t.prev,s=t,o=t.next;if(C(r,s,o)>=0)return!1;for(var a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,h=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=y(a,c,e,i,n),_=y(l,h,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&g(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&C(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=u;){if(f!==t.prev&&f!==t.next&&g(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&C(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function l(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!A(r,s)&&b(r,n,n.next,s)&&T(r,s)&&T(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),M(n),M(n.next),n=t=s),n=n.next}while(n!==t);return n}function h(t,e,i,n,r,a){var c=t;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&x(c,l)){var h=E(c,l);return c=s(c,c.next),h=s(h,h.next),o(c,e,i,n,r,a),void o(h,e,i,n,r,a)}l=l.next}c=c.next}while(c!==t)}function u(t,e,i,n){var o,a,c,l=[];for(o=0,a=e.length;o=n.next.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o){if(o=a,a===r){if(s===n.y)return n;if(s===n.next.y)return n.next}i=n.x=n.x&&n.x>=h&&g(si.x)&&T(n,t)&&(i=n,_=c),n=n.next;return i}function p(t,e,i,n){var r=t;do{null===r.z&&(r.z=y(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,m(r)}function m(t){var e,i,n,r,s,o,a,c,l=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||c>0&&n;)0===a?(r=n,n=n.nextZ,c--):0!==c&&n?i.z<=n.z?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,c--):(r=i,i=i.nextZ,a--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,l*=2}while(o>1);return t}function y(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function v(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function x(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!S(t,e)&&T(t,e)&&T(e,t)&&w(t,e)}function C(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function A(t,e){return t.x===e.x&&t.y===e.y}function b(t,e,i,n){return!!(A(t,e)&&A(i,n)||A(t,n)&&A(i,e))||C(t,e,i)>0!=C(t,e,n)>0&&C(i,n,t)>0!=C(i,n,e)>0}function S(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&b(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}function T(t,e){return C(t.prev,t,t.next)<0?C(t,e,t.next)>=0&&C(t,t.prev,e)>=0:C(t,e,t.prev)<0||C(t,t.next,e)<0}function w(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}function E(t,e){var i=new I(t.i,t.x,t.y),n=new I(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function B(t,e,i,n){var r=new I(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function I(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function R(t,e,i,n){for(var r=0,s=e,o=i-n;s0&&(n+=t[r-1].length,i.holes.push(n))}return i}}),{}],217:[(function(t,e,i){"use strict";var n=t("../../../../graphics/helper"),r=t("../../../../graphics/types").PointFlags,s=cc.Graphics.Point=cc.Class({name:"cc.GraphicsPoint",extends:cc.Vec2,ctor:function(t,e){this.reset()},reset:function(){this.dx=0,this.dy=0,this.dmx=0,this.dmy=0,this.flags=0,this.len=0}});function o(){this.reset()}function a(t){this._tessTol=.25,this._distTol=.01,this._updatePathOffset=!1,this._paths=null,this._pathLength=0,this._pathOffset=0,this._points=null,this._pointsOffset=0,this._commandx=0,this._commandy=0,this._paths=[],this._points=[]}cc.js.mixin(o.prototype,{reset:function(){this.closed=!1,this.nbevel=0,this.complex=!0,this.points?this.points.length=0:this.points=[]}}),cc.js.mixin(a.prototype,{moveTo:function(t,e){this._updatePathOffset&&(this._pathOffset=this._pathLength,this._updatePathOffset=!1),this._addPath(),this._addPoint(t,e,r.PT_CORNER),this._commandx=t,this._commandy=e},lineTo:function(t,e){this._addPoint(t,e,r.PT_CORNER),this._commandx=t,this._commandy=e},bezierCurveTo:function(t,e,i,s,o,a){var c=this._curPath,l=c.points[c.points.length-1];l.x!==t||l.y!==e||i!==o||s!==a?(n.tesselateBezier(this,l.x,l.y,t,e,i,s,o,a,0,r.PT_CORNER),this._commandx=o,this._commandy=a):this.lineTo(o,a)},quadraticCurveTo:function(t,e,i,n){var r=this._commandx,s=this._commandy;this.bezierCurveTo(r+2/3*(t-r),s+2/3*(e-s),i+2/3*(t-i),n+2/3*(e-n),i,n)},arc:function(t,e,i,r,s,o){n.arc(this,t,e,i,r,s,o)},ellipse:function(t,e,i,r){n.ellipse(this,t,e,i,r),this._curPath.complex=!1},circle:function(t,e,i){n.ellipse(this,t,e,i,i),this._curPath.complex=!1},rect:function(t,e,i,n){this.moveTo(t,e),this.lineTo(t,e+n),this.lineTo(t+i,e+n),this.lineTo(t+i,e),this.close(),this._curPath.complex=!1},roundRect:function(t,e,i,r,s){n.roundRect(this,t,e,i,r,s),this._curPath.complex=!1},clear:function(t){this._pathLength=0,this._pathOffset=0,this._pointsOffset=0,this._curPath=null,t&&(this._paths.length=0,this._points.length=0)},close:function(){this._curPath.closed=!0},_addPath:function(){var t=this._pathLength,e=this._paths[t];return e?e.reset():(e=new o,this._paths.push(e)),this._pathLength++,this._curPath=e,e},_addPoint:function(t,e,i){var n=this._curPath;if(n){var r,o=this._points,a=n.points;(r=o[this._pointsOffset++])?(r.x=t,r.y=e):(r=new s(t,e),o.push(r)),r.flags=i,a.push(r)}}}),cc.Graphics._Impl=a,e.exports=a}),{"../../../../graphics/helper":108,"../../../../graphics/types":110}],218:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=s(t("../../../assembler")),r=s(t("../../../../../renderer/core/input-assembler"));function s(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=t("../../mesh-buffer"),h=t("../../vertex-format").vfmtPosColor,u=t("../../../index"),_=t("../../../../graphics/graphics"),f=t("../../../../graphics/types").PointFlags,d=_.LineJoin,p=_.LineCap,m=t("./earcut"),y=(t("./impl"),Math.PI),v=Math.min,g=Math.max,x=Math.ceil,C=Math.acos,A=Math.cos,b=Math.sin,S=Math.atan2;function T(t,e,i){var n=2*C(t/(t+i));return g(2,x(e/n))}function w(t,e,i){return ti?i:t}var E=(function(t){function e(i){o(this,e);var n=a(this,t.call(this,i));return n._buffer=null,n._buffers=[],n._bufferOffset=0,n}return c(e,t),e.prototype.getVfmt=function(){return h},e.prototype.requestBuffer=function(){var t={indiceStart:0,vertexStart:0},e=new l(u._handle,h);t.meshbuffer=e;var i=new r.default(e._vb,e._ib);return t.ia=i,this._buffers.push(t),t},e.prototype.getBuffers=function(){return 0===this._buffers.length&&this.requestBuffer(),this._buffers},e.prototype.clear=function(t){this._bufferOffset=0;var e=this._buffers;if(t){for(var i=0,n=e.length;i65535||3*s>131070)&&(++this._bufferOffset,s=e,this._bufferOffsetr.vertexOffset&&r.requestStatic(e,3*e),this._buffer=n,n},e.prototype.stroke=function(t){this._curColor=t._strokeColor._val,this._flattenPaths(t._impl),this._expandStroke(t),t._impl._updatePathOffset=!0},e.prototype.fill=function(t){this._curColor=t._fillColor._val,this._expandFill(t),t._impl._updatePathOffset=!0},e.prototype._expandStroke=function(t){var e=.5*t.lineWidth,i=t.lineCap,n=t.lineJoin,r=t.miterLimit,s=t._impl,o=T(e,y,s._tessTol);this._calculateJoins(s,e,n,r);for(var a=s._paths,c=0,l=s._pathOffset,h=s._pathLength;l0&&(r=1/e);for(var s=t._paths,o=t._pathOffset,a=t._pathLength;o1e-6){var S=1/m;S>600&&(S=600),_.dmx*=S,_.dmy*=S}_.dx*u.dy-u.dx*_.dy>0&&(0,_.flags|=f.PT_LEFT),m*(y=g(11,v(u.len,_.len)*r))*y<1&&(_.flags|=f.PT_INNERBEVEL),_.flags&f.PT_CORNER&&(m*n*n<1||i===d.BEVEL||i===d.ROUND)&&(_.flags|=f.PT_BEVEL),0!=(_.flags&(f.PT_BEVEL|f.PT_INNERBEVEL))&&c.nbevel++,u=_,_=l[p+1]}}},e.prototype._flattenPaths=function(t){for(var e=t._paths,i=t._pathOffset,n=t._pathLength;iv&&(g-=2*y),this._vset(_,d),this._vset(l-s*n,e.y-o*n);for(var C=w(x((v-g)/y)*r,2,r),T=0;Tc?r+=i-e.width:c>h.x&&(r+=c-h.x),-h.y>l?s+=n-e.height:l>h.y&&(s+=l-h.y)}var u=this._local;u[0]=-r,u[1]=-s,u[2]=i-r,u[3]=n-s,this.updateUVs(t),this.updateWorldVerts(t)},e})(n.default);i.default=l,e.exports=i.default}),{"../../../../../components/CCLabelShadow":void 0,"../../../../utils/label/ttf":214}],223:[(function(t,e,i){"use strict";var n=u(t("../../../assembler")),r=u(t("../../../../components/CCLabel")),s=u(t("./2d/ttf")),o=u(t("./2d/bmfont")),a=u(t("./2d/letter")),c=u(t("./3d/ttf")),l=u(t("./3d/bmfont")),h=u(t("./3d/letter"));function u(t){return t&&t.__esModule?t:{default:t}}r.default._canvasPool={pool:[],get:function(){var t=this.pool.pop();if(!t){var e=document.createElement("canvas");t={canvas:e,context:e.getContext("2d")}}return t},put:function(t){this.pool.length>=32||this.pool.push(t)}},n.default.register(cc.Label,{getConstructor:function(t){var e=t.node.is3DNode,i=e?c.default:s.default;return t.font instanceof cc.BitmapFont?i=e?l.default:o.default:t.cacheMode===r.default.CacheMode.CHAR&&(cc.sys.browserType===cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB?cc.warn("sorry, subdomain does not support CHAR mode currently!"):i=e?h.default:a.default),i},TTF:s.default,Bmfont:o.default,Letter:a.default,TTF3D:c.default,Bmfont3D:l.default,Letter3D:h.default})}),{"../../../../components/CCLabel":73,"../../../assembler":187,"./2d/bmfont":220,"./2d/letter":221,"./2d/ttf":222,"./3d/bmfont":void 0,"./3d/letter":void 0,"./3d/ttf":void 0}],224:[(function(t,e,i){"use strict";i.__esModule=!0,i.MaskAssembler=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../assembler"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=t("../../../components/CCMask"),c=t("../../render-flow"),l=t("./sprite/2d/simple"),h=t("./graphics"),u=t("../../../../renderer/gfx"),_=t("../vertex-format").vfmtPos,f=8,d=[];function p(){return 1<f&&cc.errorID(9e3,f),d.push(t)}function g(t,e){0===d.length&&cc.errorID(9001),d.pop(),0===d.length?e._flushMaterial(t._exitMaterial):A(e)}function x(t,e){var i=u.DS_FUNC_NEVER,n=p(),r=n,s=n,o=t.inverted?u.STENCIL_OP_REPLACE:u.STENCIL_OP_ZERO;y(t._clearMaterial,i,o,n,r,s);var a=e.getBuffer("mesh",_),c=a.request(4,6),l=c.indiceOffset,h=c.byteOffset>>2,f=c.vertexOffset,d=a._vData,m=a._iData;d[h++]=-1,d[h++]=-1,d[h++]=-1,d[h++]=1,d[h++]=1,d[h++]=1,d[h++]=1,d[h++]=-1,m[l++]=f,m[l++]=f+3,m[l++]=f+1,m[l++]=f+1,m[l++]=f+3,m[l++]=f+2,e.node=e._dummyNode,e.material=t._clearMaterial,e._flush()}function C(t,e){var i=u.DS_FUNC_NEVER,n=p(),r=n,s=n,o=t.inverted?u.STENCIL_OP_ZERO:u.STENCIL_OP_REPLACE;y(t.sharedMaterials[0],i,o,n,r,s),e.material=t.sharedMaterials[0],t._type===a.Type.IMAGE_STENCIL?(e.node=e._dummyNode,l.prototype.fillBuffers.call(t._assembler,t,e),e._flush()):(e.node=t.node,h.prototype.fillBuffers.call(t._graphics._assembler,t._graphics,e))}function A(t){var e=u.DS_FUNC_EQUAL,i=u.STENCIL_OP_KEEP,n=m(),r=n,s=p(),o=d[d.length-1];y(o._enableMaterial,e,i,n,r,s),t._flushMaterial(o._enableMaterial)}var b=i.MaskAssembler=(function(t){function e(){return r(this,e),s(this,t.apply(this,arguments))}return o(e,t),e.prototype.updateRenderData=function(t){t._type===a.Type.IMAGE_STENCIL?t.spriteFrame?l.prototype.updateRenderData.call(this,t):t.setMaterial(0,null):(t._graphics.setMaterial(0,t.sharedMaterials[0]),h.prototype.updateRenderData.call(t._graphics._assembler,t._graphics,t._graphics))},e.prototype.fillBuffers=function(t,e){(t._type!==a.Type.IMAGE_STENCIL||t.spriteFrame)&&(v(t),x(t,e),C(t,e),A(e)),t.node._renderFlag|=c.FLAG_UPDATE_RENDER_DATA},e.prototype.postFillBuffers=function(t,e){(t._type!==a.Type.IMAGE_STENCIL||t.spriteFrame)&&g(t,e),t.node._renderFlag|=c.FLAG_UPDATE_RENDER_DATA},e})(l);n.default.register(a,b)}),{"../../../../renderer/gfx":308,"../../../components/CCMask":75,"../../assembler":187,"../../render-flow":208,"../vertex-format":239,"./graphics":218,"./sprite/2d/simple":229}],225:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../assembler-2d"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=t("../../../components/CCMotionStreak"),c=t("../../render-flow");function l(t,e){this.point=t||cc.v2(),this.dir=e||cc.v2(),this.distance=0,this.time=0}l.prototype.setPoint=function(t,e){this.point.x=t,this.point.y=e},l.prototype.setDir=function(t,e){this.dir.x=t,this.dir.y=e};cc.v2(),cc.v2();var h=cc.v2(),u=cc.v2();function _(t,e){return t.x=-e.y,t.y=e.x,t}var f=(function(t){function e(){return r(this,e),s(this,t.apply(this,arguments))}return o(e,t),e.prototype.initData=function(){this._renderData.createFlexData(0,16,42)},e.prototype.update=function(t,e){var i=t._stroke/2,n=t.node._worldMatrix.m,r=n[12],s=n[13],o=t._points,a=void 0;if(o.length>1){var c=o[0].point.x-r,f=o[0].point.y-s;c*c+f*f=0;E--){var B=o[E],M=B.point,I=B.dir;if(B.time-=e,B.time<0)o.splice(E,1);else{var R=B.time/T,P=o[E-1];if(!w){if(!P){o.splice(E,1);continue}M.x=P.point.x-I.x*R,M.y=P.point.y-I.y*R}w=!0,_(h,I);var D=(R*x<<24>>>0)+(g<<16)+(v<<8)+y,L=5*p;b[L]=M.x+h.x*i,b[L+1]=M.y+h.y*i,b[L+2]=1,b[L+3]=R,S[L+4]=D,b[L+=5]=M.x-h.x*i,b[L+1]=M.y-h.y*i,b[L+2]=0,b[L+3]=R,S[L+4]=D,p+=2}}d=p<=2?0:3*(p-2),A.used(p,d)}},e.prototype.fillBuffers=function(t,e){var i=this._renderData._flexBuffer,n=i.vData,r=i.usedVertices,s=i.usedIndices,o=i.usedVerticesFloats,a=e._meshBuffer,l=a.request(r,s),h=l.byteOffset>>2,u=a._vData;n.length+h>u.length?u.set(n.subarray(0,o),h):u.set(n,h);for(var _=a._iData,f=l.indiceOffset,d=l.vertexOffset,p=0,m=r;p1?1:i)<0?0:i,n=(n=n>1?1:n)<0?0:n;var r=i+(n=(n-=i)<0?0:n);r=r>1?1:r,this.updateUVs(t,i,r),this.updateVerts(t,i,r),t._vertsDirty=!1}},e.prototype.updateUVs=function(t,e,i){var n=t._spriteFrame,r=n._texture.width,s=n._texture.height,o=n._rect,c=void 0,l=void 0,h=void 0,u=void 0,_=void 0,f=void 0,d=void 0,p=void 0,m=void 0,y=void 0;n._rotated?(c=o.x/r,l=(o.y+o.width)/s,h=_=c,d=m=(o.x+o.height)/r,f=y=l,u=p=o.y/s):(c=o.x/r,l=(o.y+o.height)/s,h=d=c,_=m=(o.x+o.width)/r,u=f=l,p=y=o.y/s);var v=this._renderData.vDatas[0],g=this.uvOffset,x=this.floatsPerVert;switch(t._fillType){case a.HORIZONTAL:v[g]=h+(_-h)*e,v[g+1]=u+(f-u)*e,v[g+x]=h+(_-h)*i,v[g+x+1]=u+(f-u)*i,v[g+2*x]=d+(m-d)*e,v[g+2*x+1]=p+(y-p)*e,v[g+3*x]=d+(m-d)*i,v[g+3*x+1]=p+(y-p)*i;break;case a.VERTICAL:v[g]=h+(d-h)*e,v[g+1]=u+(p-u)*e,v[g+x]=_+(m-_)*e,v[g+x+1]=f+(y-f)*e,v[g+2*x]=h+(d-h)*i,v[g+2*x+1]=u+(p-u)*i,v[g+3*x]=_+(m-_)*i,v[g+3*x+1]=f+(y-f)*i;break;default:cc.errorID(2626)}},e.prototype.updateVerts=function(t,e,i){var n=t.node,r=n.width,s=n.height,o=n.anchorX*r,c=n.anchorY*s,l=-o,h=-c,u=r-o,_=s-c,f=void 0;switch(t._fillType){case a.HORIZONTAL:f=l+(u-l)*i,l=l+(u-l)*e,u=f;break;case a.VERTICAL:f=h+(_-h)*i,h=h+(_-h)*e,_=f;break;default:cc.errorID(2626)}var d=this._local;d[0]=l,d[1]=h,d[2]=u,d[3]=_,this.updateWorldVerts(t)},e})(n.default);i.default=c,e.exports=i.default}),{"../../../../../components/CCSprite":84,"../../../../assembler-2d":186}],227:[(function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}i.__esModule=!0,i.default=void 0;var o=(function(t){function e(){return n(this,e),r(this,t.apply(this,arguments))}return s(e,t),e.prototype.initData=function(t){this._local=[],this._renderData.createFlexData(0,4,6,this.getVfmt())},e.prototype.updateRenderData=function(t){this.packToDynamicAtlas(t,t._spriteFrame);var e=t.spriteFrame;if(e){var i=e.vertices;if(i){this.verticesCount=i.x.length,this.indicesCount=i.triangles.length;var n=this._renderData._flexBuffer;n.reserve(this.verticesCount,this.indicesCount)&&(this.updateIndices(i.triangles),this.updateColor(t),t._vertsDirty=!0),n.used(this.verticesCount,this.indicesCount),t._vertsDirty&&(this.updateUVs(t),this.updateVerts(t),this.updateWorldVerts(t),t._vertsDirty=!1)}}},e.prototype.updateIndices=function(t){for(var e=this._renderData.iDatas[0],i=0;i0){var u=r.y+l*(t-r.x);o[0].x=t,o[0].y=u}if((e-r.x)*c>0){var _=r.y+l*(e-r.x);o[2].x=e,o[2].y=_}}if(0!==Math.sin(s)){if(h=c/a,(n-r.y)*a>0){var f=r.x+h*(n-r.y);o[3].x=f,o[3].y=n}if((i-r.y)*a>0){var d=r.x+h*(i-r.y);o[1].x=d,o[1].y=i}}}function m(t){var e=t.node,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,o=-r,a=-s,h=i-r,u=n-s,_=l;_[0]=o,_[1]=a,_[2]=h,_[3]=u;var p=t._fillCenter,m=f.x=Math.min(Math.max(0,p.x),1)*(h-o)+o,y=f.y=Math.min(Math.max(0,p.y),1)*(u-a)+a;c[0].x=c[3].x=o,c[1].x=c[2].x=h,c[0].y=c[1].y=a,c[2].y=c[3].y=u,d.length=0,m!==_[0]&&(d[0]=[3,0]),m!==_[2]&&(d[2]=[1,2]),y!==_[1]&&(d[1]=[0,1]),y!==_[3]&&(d[3]=[2,3])}function y(t){var e=t._texture.width,i=t._texture.height,n=t._rect,r=void 0,s=void 0,o=void 0,a=void 0,c=h;t._rotated?(r=n.x/e,s=(n.x+n.height)/e,o=n.y/i,a=(n.y+n.width)/i,c[0]=c[2]=r,c[4]=c[6]=s,c[3]=c[7]=a,c[1]=c[5]=o):(r=n.x/e,s=(n.x+n.width)/e,o=n.y/i,a=(n.y+n.height)/i,c[0]=c[4]=r,c[2]=c[6]=s,c[1]=c[3]=a,c[5]=c[7]=o)}function v(t,e){var i,n;if(i=e.x-t.x,n=e.y-t.y,0!==i||0!==n){if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}}var g=(function(t){function e(){return r(this,e),s(this,t.apply(this,arguments))}return o(e,t),e.prototype.initData=function(t){this._renderData.createFlexData(0,4,6,this.getVfmt())},e.prototype.updateRenderData=function(e){t.prototype.updateRenderData.call(this,e);var i=e.spriteFrame;if(i&&(this.packToDynamicAtlas(e,i),e._vertsDirty)){var n=e._fillStart,r=e._fillRange;for(r<0&&(n+=r,r=-r);n>=1;)n-=1;for(;n<0;)n+=1;n*=a,r*=a,m(e),y(i),p(l[0],l[2],l[1],l[3],f,n,u),p(l[0],l[2],l[1],l[3],f,n+r,_),this.updateVerts(e,n,r),e._vertsDirty=!1}},e.prototype.updateVerts=function(t,e,i){for(var n=e+i,r=this._local,s=0,o=3*this.floatsPerVert,l=0;l<4;++l){var h=d[l];if(h)if(i>=a)r.length=s+o,this._generateTriangle(r,s,f,c[h[0]],c[h[1]]),s+=o;else{var p=v(f,c[h[0]]),m=v(f,c[h[1]]);m=n||(p>=e?(r.length=s+o,m>=n?this._generateTriangle(r,s,f,c[h[0]],_[l]):this._generateTriangle(r,s,f,c[h[0]],c[h[1]]),s+=o):m<=e||(m<=n?(r.length=s+o,this._generateTriangle(r,s,f,u[l],c[h[1]]),s+=o):(r.length=s+o,this._generateTriangle(r,s,f,u[l],_[l]),s+=o))),p+=a,m+=a}}this.allocWorldVerts(t),this.updateWorldVerts(t)},e.prototype.allocWorldVerts=function(t){var e=t.node._color._val,i=this._renderData,n=this.floatsPerVert,r=this._local,s=r.length/n;this.verticesCount=this.indicesCount=s;var o=i._flexBuffer;if(o.reserve(s,s))for(var a=i.iDatas[0],c=0;c0)){this._renderData.createData(0,this.verticesFloats,this.indicesCount);for(var e=this._renderData.iDatas[0],i=0,n=0;n<3;++n)for(var r=0;r<3;++r){var s=4*n+r;e[i++]=s,e[i++]=s+1,e[i++]=s+4,e[i++]=s+1,e[i++]=s+5,e[i++]=s+4}}},e.prototype.initLocal=function(){this._local=[],this._local.length=8},e.prototype.updateRenderData=function(t){var e=t._spriteFrame;e&&(this.packToDynamicAtlas(t,e),t._vertsDirty&&(this.updateUVs(t),this.updateVerts(t),t._vertsDirty=!1))},e.prototype.updateVerts=function(t){var e=t.node,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,o=t.spriteFrame,a=o.insetLeft,c=o.insetRight,l=o.insetTop,h=o.insetBottom,u=i-a-c,_=n-l-h,f=i/(a+c),d=n/(l+h);f=isNaN(f)||f>1?1:f,d=isNaN(d)||d>1?1:d,u=u<0?0:u,_=_<0?0:_;var p=this._local;p[0]=-r,p[1]=-s,p[2]=a*f-r,p[3]=h*d-s,p[4]=p[2]+u,p[5]=p[3]+_,p[6]=i-r,p[7]=n-s,this.updateWorldVerts(t)},e.prototype.updateUVs=function(t){for(var e=this._renderData.vDatas[0],i=t.spriteFrame.uvSliced,n=this.uvOffset,r=this.floatsPerVert,s=0;s<4;++s)for(var o=0;o<4;++o){var a=4*s+o,c=i[a],l=a*r;e[l+n]=c.u,e[l+n+1]=c.v}},e.prototype.updateWorldVerts=function(t){for(var e=t.node._worldMatrix.m,i=e[0],n=e[1],r=e[4],s=e[5],o=e[12],a=e[13],c=this._local,l=this._renderData.vDatas[0],h=this.floatsPerVert,u=0;u<4;++u)for(var _=c[2*u+1],f=0;f<4;++f){var d=c[2*f],p=(4*u+f)*h;l[p]=d*i+_*r+o,l[p+1]=d*n+_*s+a}},e})(function(t){return t&&t.__esModule?t:{default:t}}(t("../../../../assembler-2d")).default);i.default=o,Object.assign(o.prototype,{verticesCount:16,indicesCount:54}),e.exports=i.default}),{"../../../../assembler-2d":186}],231:[(function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}i.__esModule=!0,i.default=void 0;var o=(function(t){function e(){return n(this,e),r(this,t.apply(this,arguments))}return s(e,t),e.prototype.initData=function(t){this.verticesCount=0,this.contentWidth=0,this.contentHeight=0,this.rectWidth=0,this.rectHeight=0,this.hRepeat=0,this.vRepeat=0,this.row=0,this.col=0,this._local={x:[],y:[]},this._renderData.createFlexData(0,4,6,this.getVfmt()),this._updateIndices()},e.prototype._updateIndices=function(){for(var t=this._renderData.iDatas[0],e=0,i=0,n=t.length;e>2,n=this.vData.length,r=!1;if(i>n){for(;ns){for(;s>2,this._handler.updateMeshRange(t,e)},t.prototype.reset=function(){var t=this._initVerticesCount*this._verticesBytes>>2;this._reallocVData(t),this._reallocIData(this._initIndicesCount),this.usedVertices=0,this.usedVerticesFloats=0,this.usedIndices=0},t})();i.default=r,cc.FlexBuffer=r,e.exports=i.default}),{}],234:[(function(t,e,i){"use strict";var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../../../renderer/gfx"));var r=cc.Class({name:"cc.MeshBuffer",ctor:function(t,e){this.init(t,e)},init:function(t,e){this.byteOffset=0,this.indiceOffset=0,this.vertexOffset=0,this.indiceStart=0,this._dirty=!1,this._vertexFormat=e,this._vertexBytes=this._vertexFormat._bytes,this._arrOffset=0,this._vbArr=[],this._vb=new n.default.VertexBuffer(t._device,e,n.default.USAGE_DYNAMIC,new ArrayBuffer,0),this._vbArr[0]=this._vb,this._ibArr=[],this._ib=new n.default.IndexBuffer(t._device,n.default.INDEX_FMT_UINT16,n.default.USAGE_STATIC,new ArrayBuffer,0),this._ibArr[0]=this._ib,this._vData=null,this._uintVData=null,this._iData=null,this._batcher=t,this._initVDataCount=256*e._bytes,this._initIDataCount=1536,this._offsetInfo={byteOffset:0,vertexOffset:0,indiceOffset:0},this._reallocBuffer()},uploadData:function(){if(0!==this.byteOffset&&this._dirty){var t=new Float32Array(this._vData.buffer,0,this.byteOffset>>2),e=new Uint16Array(this._iData.buffer,0,this.indiceOffset);this._vb.update(0,t),this._ib.update(0,e),this._dirty=!1}},switchBuffer:function(){var t=++this._arrOffset;this.byteOffset=0,this.vertexOffset=0,this.indiceOffset=0,this.indiceStart=0,t65535&&(this.uploadData(),this._batcher._flush(),this.switchBuffer())},requestStatic:function(t,e){this.checkAndSwitchBuffer(t);var i=this.byteOffset+t*this._vertexBytes,n=this.indiceOffset+e,r=this._vData.byteLength,s=this._iData.length;if(i>r||n>s){for(;r>2);this._vb.update(0,t),this._dirty=!1}},switchBuffer:function(){this._super();var t=new Uint16Array(this._iData.buffer,0,this._initIDataCount);this._ib.update(0,t)},_reallocBuffer:function(){this._reallocVData(!0),this._reallocIData(),this._fillQuadBuffer()}});cc.QuadBuffer=e.exports=r}),{"./mesh-buffer":234}],237:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=s;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("./flex-buffer")),r=t("./vertex-format");function s(){this.vDatas=[],this.uintVDatas=[],this.iDatas=[],this.meshCount=0,this._infos=null,this._flexBuffer=null}cc.js.mixin(s.prototype,{init:function(t){},clear:function(){this.vDatas.length=0,this.iDatas.length=0,this.uintVDatas.length=0,this.meshCount=0,this._infos=null,this._flexBuffer&&this._flexBuffer.reset()},updateMesh:function(t,e,i){this.vDatas[t]=e,this.uintVDatas[t]=new Uint32Array(e.buffer,0,e.length),this.iDatas[t]=i,this.meshCount=this.vDatas.length},updateMeshRange:function(t,e){},createData:function(t,e,i){var n=new Float32Array(e),r=new Uint16Array(i);this.updateMesh(t,n,r)},createQuadData:function(t,e,i){this.createData(t,e,i),this.initQuadIndices(this.iDatas[t])},createFlexData:function(t,e,i,s){s=s||r.vfmtPosUvColor,this._flexBuffer=new n.default(this,t,e,i,s)},initQuadIndices:function(t){for(var e=t.length/6,i=0,n=0;ir||n>s){for(;r0&&(t=t.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return null;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r},dirname:function(t){var e=r.exec(t);return e?e[2]:""},changeExtname:function(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n},changeBasename:function(t,e,i){if(0===e.indexOf("."))return this.changeExtname(t,e);var n=t.indexOf("?"),r="",s=i?this.extname(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r},_normalize:function(t){var e=t=String(t);do{e=t,t=t.replace(s,"")}while(e.length!==t.length);return t},sep:cc.sys.os===cc.sys.OS_WINDOWS?"\\":"/",stripSep:function(t){return t.replace(/[\/\\]$/,"")}},e.exports=cc.path}),{"../platform/CCSys":169}],241:[(function(t,e,i){"use strict";var n=function(t,e,i,n,r,s){this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s};n.create=function(t,e,i,n,r,s){return{a:t,b:e,c:i,d:n,tx:r,ty:s}},n.identity=function(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}},n.clone=function(t){return{a:t.a,b:t.b,c:t.c,d:t.d,tx:t.tx,ty:t.ty}},n.concat=function(t,e,i){var n=e.a,r=e.b,s=e.c,o=e.d,a=e.tx,c=e.ty;return t.a=n*i.a+r*i.c,t.b=n*i.b+r*i.d,t.c=s*i.a+o*i.c,t.d=s*i.b+o*i.d,t.tx=a*i.a+c*i.c+i.tx,t.ty=a*i.b+c*i.d+i.ty,t},n.invert=function(t,e){var i=e.a,n=e.b,r=e.c,s=e.d,o=1/(i*s-n*r),a=e.tx,c=e.ty;return t.a=o*s,t.b=-o*n,t.c=-o*r,t.d=o*i,t.tx=o*(r*c-s*a),t.ty=o*(n*a-i*c),t},n.fromMat4=function(t,e){var i=e.m;return t.a=i[0],t.b=i[1],t.c=i[4],t.d=i[5],t.tx=i[12],t.ty=i[13],t},n.transformVec2=function(t,e,i,n){var r,s;return void 0===n?(n=i,r=e.x,s=e.y):(r=e,s=i),t.x=n.a*r+n.c*s+n.tx,t.y=n.b*r+n.d*s+n.ty,t},n.transformSize=function(t,e,i){return t.width=i.a*e.width+i.c*e.height,t.height=i.b*e.width+i.d*e.height,t},n.transformRect=function(t,e,i){var n=e.x,r=e.y,s=n+e.width,o=r+e.height,a=i.a*n+i.c*r+i.tx,c=i.b*n+i.d*r+i.ty,l=i.a*s+i.c*r+i.tx,h=i.b*s+i.d*r+i.ty,u=i.a*n+i.c*o+i.tx,_=i.b*n+i.d*o+i.ty,f=i.a*s+i.c*o+i.tx,d=i.b*s+i.d*o+i.ty,p=Math.min(a,l,u,f),m=Math.max(a,l,u,f),y=Math.min(c,h,_,d),v=Math.max(c,h,_,d);return t.x=p,t.y=y,t.width=m-p,t.height=v-y,t},n.transformObb=function(t,e,i,n,r,s){var o=r.x,a=r.y,c=r.width,l=r.height,h=s.a*o+s.c*a+s.tx,u=s.b*o+s.d*a+s.ty,_=s.a*c,f=s.b*c,d=s.c*l,p=s.d*l;e.x=h,e.y=u,i.x=_+h,i.y=f+u,t.x=d+h,t.y=p+u,n.x=_+d+h,n.y=f+p+u},cc.AffineTransform=e.exports=n}),{}],242:[(function(t,e,i){"use strict";var n=t("../platform/CCObject").Flags,r=t("./misc"),s=t("../platform/js"),o=t("../platform/id-generater"),a=t("../event-manager"),c=t("../renderer/render-flow"),l=n.Destroying,h=n.DontDestroy,u=n.Deactivating,_=new o("Node");function f(t){return t?"string"==typeof t?s.getClassByName(t):t:(cc.errorID(3804),null)}function d(t,e){if(e._sealed)for(var i=0;i0&&(r=m(n._children,e)))return r}return null}function y(t,e,i){for(var n=0;n0&&y(r._children,e,i)}}var v=cc.Class({name:"cc._BaseNode",extends:cc.Object,properties:{_parent:null,_children:[],_active:!0,_components:[],_prefab:null,_persistNode:{get:function(){return(this._objFlags&h)>0},set:function(t){t?this._objFlags|=h:this._objFlags&=~h}},name:{get:function(){return this._name},set:function(t){this._name=t}},uuid:{get:function(){return this._id}},children:{get:function(){return this._children}},childrenCount:{get:function(){return this._children.length}},active:{get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;if(e)e._activeInHierarchy&&cc.director._nodeActivator.activateNode(this,t)}}},activeInHierarchy:{get:function(){return this._activeInHierarchy}}},ctor:function(t){this._name=void 0!==t?t:"New Node",this._activeInHierarchy=!1,this._id=_.getNewId(),cc.director._scheduler&&cc.director._scheduler.enableForTarget(this),this.__eventTargets=[]},getParent:function(){return this._parent},setParent:function(t){if(this._parent!==t){0;var e=this._parent;if(this._parent=t||null,this._onSetParent(t),t&&(a._setDirtyForNode(this),t._children.push(this),t.emit&&t.emit("child-added",this),t._renderFlag|=c.FLAG_CHILDREN),e){if(!(e._objFlags&l)){var i=e._children.indexOf(this);0,e._children.splice(i,1),e.emit&&e.emit("child-removed",this),this._onHierarchyChanged(e),0===e._children.length&&(e._renderFlag&=~c.FLAG_CHILDREN)}}else t&&this._onHierarchyChanged(null)}},attr:function(t){s.mixin(this,t)},getChildByUuid:function(t){if(!t)return cc.log("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i0?(l=n,i=n._children,r=0,c[a]=i[r],a++):(c[a]=n,a++,s=!0);c.length=0,o._stackId--},cleanup:function(){},removeFromParent:function(t){this._parent&&(void 0===t&&(t=!0),this._parent.removeChild(this,t))},removeChild:function(t,e){this._children.indexOf(t)>-1&&((e||void 0===e)&&t.cleanup(),t.parent=null)},removeAllChildren:function(t){var e=this._children;void 0===t&&(t=!0);for(var i=e.length-1;i>=0;i--){var n=e[i];n&&(t&&n.cleanup(),n.parent=null)}this._children.length=0},isChildOf:function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},getComponent:function(t){var e=f(t);return e?d(this,e):null},getComponents:function(t){var e=f(t),i=[];return e&&p(this,e,i),i},getComponentInChildren:function(t){var e=f(t);return e?m(this._children,e):null},getComponentsInChildren:function(t){var e=f(t),i=[];return e&&(p(this,e,i),y(this._children,e,i)),i},_checkMultipleComp:!1,addComponent:function(t){var e;if("string"==typeof t){if(!(e=s.getClassByName(t)))return cc.errorID(3807,t),cc._RFpeek()&&cc.errorID(3808,t),null}else{if(!t)return cc.errorID(3804),null;e=t}if("function"!=typeof e)return cc.errorID(3809),null;if(!s.isChildClassOf(e,cc.Component))return cc.errorID(3810),null;var i=e._requireComponent;if(i&&!this.getComponent(i)&&!this.addComponent(i))return null;var n=new e;return n.node=this,this._components.push(n),this._activeInHierarchy&&cc.director._nodeActivator.activateComp(n),n},_addComponentAt:!1,removeComponent:function(t){t?(t instanceof cc.Component||(t=this.getComponent(t)),t&&t.destroy()):cc.errorID(3813)},_getDependComponent:!1,_removeComponent:function(t){if(t){if(!(this._objFlags&l)){var e=this._components.indexOf(t);-1!==e?this._components.splice(e,1):t.node!==this&&cc.errorID(3815)}}else cc.errorID(3814)},destroy:function(){cc.Object.prototype.destroy.call(this)&&(this.active=!1)},destroyAllChildren:function(){for(var t=this._children,e=0;e>>1;i<=r;s=i+r>>>1){var o=t[s];if(o>e+n)r=s-1;else{if(!(o>2],o[a[i++]]=r[(3&s)<<2|c>>4],o[a[i++]]=r[15&c]}return o.join("")}}),{"./misc":249}],246:[(function(t,e,i){"use strict";cc.find=e.exports=function(t,e){if(null==t)return cc.errorID(5600),null;if(e)0;else{var i=cc.director.getScene();if(!i)return null;e=i}for(var n=e,r="/"!==t[0]?0:1,s=t.split("/"),o=r;o>1,t|=t>>2,t|=t>>4,t|=t>>8,(t|=t>>16)+1},BUILTIN_CLASSID_RE:/^(?:cc|dragonBones|sp|ccsg)\..+/},s=new Array(123),o=0;o<123;++o)s[o]=64;for(var a=0;a<64;++a)s["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(a)]=a;r.BASE64_VALUES=s,r.pushToMap=function(t,e,i,n){var r=t[e];r?Array.isArray(r)?n?(r.push(r[0]),r[0]=i):r.push(i):t[e]=n?[i,r]:[r,i]:t[e]=i},r.clampf=function(t,e,i){if(e>i){var n=e;e=i,i=n}return t=0&&this.removeAt(e)},r.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},r.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},r.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},r.push=function(t){this.array.push(t)},e.exports=n}),{}],251:[(function(t,e,i){"use strict";t("../vmath");cc._PrefabInfo=cc.Class({name:"cc.PrefabInfo",properties:{root:null,asset:null,fileId:"",sync:!1,_synced:{default:!1,serializable:!1}}}),e.exports={syncWithPrefab:function(t){var e=t._prefab;if(e._synced=!0,!e.asset)return cc.errorID(3701,t.name),void(t._prefab=null);var i=t._objFlags,n=t._parent,r=t._id,s=t._name,o=t._active,a=t._eulerAngles.x,c=t._eulerAngles.y,l=t._eulerAngles.z,h=t._localZOrder,u=t._globalZOrder,_=t._trs,f=_[0],d=_[1],p=_[2];cc.game._isCloning=!0,e.asset._doInstantiate(t),cc.game._isCloning=!1,t._objFlags=i,t._parent=n,t._id=r,t._prefab=e,t._name=s,t._active=o,t._localZOrder=h,t._globalZOrder=u,(_=t._trs)[0]=f,_[1]=d,_[2]=p,t._eulerAngles.x=a,t._eulerAngles.y=c,t._eulerAngles.z=l}}}),{"../vmath":274}],252:[(function(t,e,i){"use strict";var n=t("../../platform/CCMacro"),r=t("./perf-counter"),s=!1,o=15,a=null,c=null,l=null;function h(){if(!a){a={frame:{desc:"Frame time (ms)",min:0,max:50,average:500},fps:{desc:"Framerate (FPS)",below:30,average:500},draws:{desc:"Draw call"},logic:{desc:"Game Logic (ms)",min:0,max:50,average:500,color:"#080"},render:{desc:"Renderer (ms)",min:0,max:50,average:500,color:"#f90"},mode:{desc:cc.game.renderType===cc.game.RENDER_TYPE_WEBGL?"WebGL":"Canvas",min:1}};var t=performance.now();for(var e in a)a[e]._counter=new r(e,a[e],t)}}function u(){if(!c||!c.isValid){(c=new cc.Node("PROFILER-NODE")).x=c.y=10,c.groupIndex=cc.Node.BuiltinGroupIndex.DEBUG,cc.Camera._setupDebugCamera(),c.zIndex=n.MAX_ZINDEX,cc.game.addPersistRootNode(c);var t=new cc.Node("LEFT-PANEL");t.anchorX=t.anchorY=0;var e=t.addComponent(cc.Label);e.fontSize=o,e.lineHeight=o,t.parent=c;var i=new cc.Node("RIGHT-PANEL");i.anchorX=1,i.anchorY=0,i.x=200;var r=i.addComponent(cc.Label);r.horizontalAlign=cc.Label.HorizontalAlign.RIGHT,r.fontSize=o,r.lineHeight=o,i.parent=c,cc.sys.browserType!==cc.sys.BROWSER_TYPE_BAIDU_GAME_SUB&&cc.sys.browserType!==cc.sys.BROWSER_TYPE_WECHAT_GAME_SUB&&(e.cacheMode=cc.Label.CacheMode.CHAR,r.cacheMode=cc.Label.CacheMode.CHAR),l={left:e,right:r}}}function _(){u();var t=cc.director._lastUpdate;a.frame._counter.start(t),a.logic._counter.start(t)}function f(){var t=performance.now();cc.director.isPaused()?a.frame._counter.start(t):a.logic._counter.end(t),a.render._counter.start(t)}function d(){var t=performance.now();a.render._counter.end(t),a.draws._counter.value=cc.renderer.drawCalls,a.frame._counter.end(t),a.fps._counter.frame(t);var e="",i="";for(var n in a){var r=a[n];r._counter.sample(t),e+=r.desc+"\n",i+=r._counter.human()+"\n"}l&&(l.left.string=e,l.right.string=i)}cc.profiler=e.exports={isShowingStats:function(){return s},hideStats:function(){s&&(c&&(c.active=!1),cc.director.off(cc.Director.EVENT_BEFORE_UPDATE,_),cc.director.off(cc.Director.EVENT_AFTER_UPDATE,f),cc.director.off(cc.Director.EVENT_AFTER_DRAW,d),s=!1)},showStats:function(){s||(h(),c&&(c.active=!0),cc.director.on(cc.Director.EVENT_BEFORE_UPDATE,_),cc.director.on(cc.Director.EVENT_AFTER_UPDATE,f),cc.director.on(cc.Director.EVENT_AFTER_DRAW,d),s=!0)}}}),{"../../platform/CCMacro":165,"./perf-counter":254}],253:[(function(t,e,i){"use strict";var n=cc.Class({name:"cc.Counter",ctor:function(t,e,i){this._id=t,this._opts=e||{},this._value=0,this._total=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._accumStart=i},properties:{value:{get:function(){return this._value},set:function(t){this._value=t}}},_average:function(t,e){if(this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},sample:function(t){this._average(this._value,t)},human:function(){var t=this._opts.average?this._averageValue:this._value;return Math.round(100*t)/100},alarm:function(){return this._opts.below&&this._valuethis._opts.over}});e.exports=n}),{}],254:[(function(t,e,i){"use strict";var n=t("./counter"),r=cc.Class({name:"cc.PerfCounter",extends:n,ctor:function(t,e,i){this._time=i},start:function(t){this._time=t},end:function(t){this._value=t-this._time,this._average(this._value)},tick:function(){this.end(),this.start()},frame:function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))}});e.exports=r}),{"./counter":253}],255:[(function(t,e,i){"use strict";var n=.26;var r={BASELINE_RATIO:n,MIDDLE_RATIO:(n+1)/2-n,label_wordRex:/([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430-\u044f\u0410-\u042f\u0401\u0451]+|\S)/,label_symbolRex:/^[!,.:;'}\]%\?>\u3001\u2018\u201c\u300b\uff1f\u3002\uff0c\uff01]/,label_lastWordRex:/([a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+|\S)$/,label_lastEnglish:/[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]+$/,label_firstEnglish:/^[a-zA-Z0-9\xc4\xd6\xdc\xe4\xf6\xfc\xdf\xe9\xe8\xe7\xe0\xf9\xea\xe2\xee\xf4\xfb\u0430\xed\xec\xcd\xcc\xef\xc1\xc0\xe1\xe0\xc9\xc8\xd2\xd3\xf2\xf3\u0150\u0151\xd9\xda\u0170\xfa\u0171\xf1\xd1\xe6\xc6\u0153\u0152\xc3\xc2\xe3\xd4\xf5\u011b\u0161\u010d\u0159\u017e\xfd\xe1\xed\xe9\xf3\xfa\u016f\u0165\u010f\u0148\u011a\u0160\u010c\u0158\u017d\xc1\xcd\xc9\xd3\xda\u0164\u017c\u017a\u015b\xf3\u0144\u0142\u0119\u0107\u0105\u017b\u0179\u015a\xd3\u0143\u0141\u0118\u0106\u0104-\u044f\u0410-\u042f\u0401\u0451]/,label_firstEmoji:/^[\uD83C\uDF00-\uDFFF\uDC00-\uDE4F]/,label_lastEmoji:/([\uDF00-\uDFFF\uDC00-\uDE4F]+|\S)$/,label_wrapinspection:!0,__CHINESE_REG:/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/,__JAPANESE_REG:/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g,__KOREAN_REG:/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/,isUnicodeCJK:function(t){return this.__CHINESE_REG.test(t)||this.__JAPANESE_REG.test(t)||this.__KOREAN_REG.test(t)},isUnicodeSpace:function(t){return(t=t.charCodeAt(0))>=9&&t<=13||32===t||133===t||160===t||5760===t||t>=8192&&t<=8202||8232===t||8233===t||8239===t||8287===t||12288===t},safeMeasureText:function(t,e){var i=t.measureText(e);return i&&i.width||0},fragmentText:function(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var o=s.length*(i/e)|0,a=s.substring(o),c=e-n(a),l=a,h=0,u=0;c>i&&u++<10;)o*=i/c,o|=0,c=e-n(a=s.substring(o));for(u=0;c<=i&&u++<10;){if(a){var _=this.label_wordRex.exec(a);h=_?_[0].length:1,l=a}o+=h,c=e-n(a=s.substring(o))}0===(o-=h)&&(o=1,l=l.substring(1));var f,d=s.substring(0,0+o);this.label_wrapinspection&&this.label_symbolRex.test(l||a)&&(0===(o-=(f=this.label_lastWordRex.exec(d))?f[0].length:0)&&(o=1),l=s.substring(o),d=s.substring(0,0+o)),this.label_firstEmoji.test(l)&&(f=this.label_lastEmoji.exec(d))&&d!==f[0]&&(o-=f[0].length,l=s.substring(o),d=s.substring(0,0+o)),this.label_firstEnglish.test(l)&&(f=this.label_lastEnglish.exec(d))&&d!==f[0]&&(o-=f[0].length,l=s.substring(o),d=s.substring(0,0+o)),0===r.length?r.push(d):(d=d.trimLeft()).length>0&&r.push(d),e=n(s=l||a)}return 0===r.length?r.push(s):(s=s.trimLeft()).length>0&&r.push(s),r}};cc.textUtils=e.exports=r}),{}],256:[(function(t,e,i){"use strict";var n=t("../assets/CCTexture2D"),r={loadImage:function(t,e,i){cc.assertID(t,3103);var r=cc.loader.getRes(t);return r?r.loaded?(e&&e.call(i,null,r),r):(r.once("load",(function(){e&&e.call(i,null,r)}),i),r):((r=new n).url=t,cc.loader.load({url:t,texture:r},(function(t,n){if(t)return e&&e.call(i,t||new Error("Unknown error"));n.handleLoadedTexture(),e&&e.call(i,null,n)})),r)},cacheImage:function(t,e){if(t&&e){var i=new n;i.initWithElement(e);var r={id:t,url:t,error:null,content:i,complete:!1};return cc.loader.flowOut(r),i}},postLoadTexture:function(t,e){t.loaded?e&&e():t.url?cc.loader.load({url:t.url,skips:["Loader"]},(function(i,n){n&&(t.loaded||(t._nativeAsset=n)),e&&e(i)})):e&&e()}};cc.textureUtil=e.exports=r}),{"../assets/CCTexture2D":51}],257:[(function(t,e,i){"use strict";var n=t("./node-unit"),r=t("./node-mem-pool");e.exports={NodeMemPool:new r(n)}}),{"./node-mem-pool":259,"./node-unit":260}],258:[(function(t,e,i){"use strict";var n=function(t){this._unitClass=t,this._pool=[],this._findOrder=[]},r=n.prototype;r._initNative=function(){this._nativeMemPool=new renderer.MemPool},r._buildUnit=function(t){var e=new this._unitClass(t,this);return e},r._destroyUnit=function(t){this._pool[t]=null;for(var e=0,i=this._findOrder.length;e1&&e.isAllFree()&&this._destroyUnit(t.unitID),e},e.exports=n}),{}],259:[(function(t,e,i){"use strict";var n=t("./mem-pool"),r=function(t){n.call(this,t)};(function(){var t=function(){};t.prototype=n.prototype,r.prototype=new t})();var s=r.prototype;s._initNative=function(){this._nativeMemPool=new renderer.NodeMemPool},s._destroyUnit=function(t){n.prototype._destroyUnit.call(this,t)},e.exports=r}),{"./mem-pool":258}],260:[(function(t,e,i){"use strict";Uint32Array;var n=Float32Array,r=Float32Array,s=Float32Array,o=(Uint32Array,Uint32Array,Int32Array,Uint8Array,Uint8Array,Uint32Array,t("./unit-base")),a=function(t,e){o.call(this,t,e);var i=this._contentNum;this.trsList=new n(10*i),this.localMatList=new r(16*i),this.worldMatList=new s(16*i);for(var a=0;a",e=this._signData[2*e+0];for(var n=0,r="",s=this._contentNum,o=0;o")}var a=t+n;console.log("unitID:",this.unitID,"spaceNum:",t,"calc using num:",n,"store using num:",this._data[1],"calc total num:",a,"actually total num:",this._contentNum),console.log("free info:",i),console.log("using info:",r),n!=this._data[1]&&cc.error("using num error","calc using num:",n,"store using num:",this._data[1]),t+n!=this._contentNum&&cc.error("total num error","calc total num:",a,"actually total num:",this._contentNum)},e.exports=n}),{}],262:[(function(t,e,i){"use strict";var n=t("../vmath"),r=t("./value-type"),s=t("../platform/js"),o=(function(){function e(t,e,i,n){"object"==typeof t&&(e=t.g,i=t.b,n=t.a,t=t.r),t=t||0,e=e||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+t}s.extend(e,r),t("../platform/CCClass").fastDefine("cc.Color",e,{r:0,g:0,b:0,a:255});var i={WHITE:[255,255,255,255],BLACK:[0,0,0,255],TRANSPARENT:[0,0,0,0],GRAY:[127.5,127.5,127.5],RED:[255,0,0],GREEN:[0,255,0],BLUE:[0,0,255],YELLOW:[255,235,4],ORANGE:[255,127,0],CYAN:[0,255,255],MAGENTA:[255,0,255]};for(var o in i)s.get(e,o,(function(t){return function(){return new e(t[0],t[1],t[2],t[3])}})(i[o]));var a=e.prototype;return a.clone=function(){var t=new e;return t._val=this._val,t},a.equals=function(t){return t&&this._val===t._val},a.lerp=function(t,i,n){n=n||new e;var r=this.r,s=this.g,o=this.b,a=this.a;return n.r=r+(t.r-r)*i,n.g=s+(t.g-s)*i,n.b=o+(t.b-o)*i,n.a=a+(t.a-a)*i,n},a.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},a.getR=function(){return 255&this._val},a.setR=function(t){return t=~~cc.misc.clampf(t,0,255),this._val=(4294967040&this._val|t)>>>0,this},a.getG=function(){return(65280&this._val)>>8},a.setG=function(t){return t=~~cc.misc.clampf(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0,this},a.getB=function(){return(16711680&this._val)>>16},a.setB=function(t){return t=~~cc.misc.clampf(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0,this},a.getA=function(){return(4278190080&this._val)>>>24},a.setA=function(t){return t=~~cc.misc.clampf(t,0,255),this._val=(16777215&this._val|t<<24)>>>0,this},a._fastSetA=function(t){this._val=(16777215&this._val|t<<24)>>>0},s.getset(a,"r",a.getR,a.setR,!0),s.getset(a,"g",a.getG,a.setG,!0),s.getset(a,"b",a.getB,a.setB,!0),s.getset(a,"a",a.getA,a.setA,!0),a.toCSS=function(t){return"rgba"===t?"rgba("+(0|this.r)+","+(0|this.g)+","+(0|this.b)+","+(this.a/255).toFixed(2)+")":"rgb"===t?"rgb("+(0|this.r)+","+(0|this.g)+","+(0|this.b)+")":"#"+this.toHEX(t)},a.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16)||255;return this._val=(r<<24>>>0)+(n<<16)+(i<<8)+e,this},a.toHEX=function(t){var e=[(this.r<16?"0":"")+(0|this.r).toString(16),(this.g<16?"0":"")+(0|this.g).toString(16),(this.b<16?"0":"")+(0|this.b).toString(16)],i=-1;if("#rgb"===t)for(i=0;i1&&(e[i]=e[i][0]);else if("#rrggbb"===t)for(i=0;i>>0)+(s<<16)+(r<<8)+n,this},a.toHSV=function(){var t=this.r/255,e=this.g/255,i=this.b/255,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),o=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(o=r-s,n.h=t===r?(e-i)/o:e===r?2+(i-t)/o:4+(t-e)/o,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},a.set=function(t){t._val?this._val=t._val:(this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a)},a.array=function(t){n.color4.array(t,this)},e})();cc.Color=o,cc.color=function(t,e,i,n){return"string"==typeof t?(new cc.Color).fromHEX(t):"object"==typeof t?new cc.Color(t.r,t.g,t.b,t.a):new cc.Color(t,e,i,n)},e.exports=cc.Color}),{"../platform/CCClass":160,"../platform/js":180,"../vmath":274,"./value-type":268}],263:[(function(t,e,i){"use strict";t("./value-type"),cc.vmath=t("../vmath").default,e.exports={Vec2:t("./vec2"),Vec3:t("./vec3"),Vec4:t("./vec4"),Quat:t("./quat"),Mat4:t("./mat4"),Size:t("./size"),Rect:t("./rect"),Color:t("./color")}}),{"../vmath":274,"./color":262,"./mat4":264,"./quat":265,"./rect":266,"./size":267,"./value-type":268,"./vec2":269,"./vec3":270,"./vec4":271}],264:[(function(t,e,i){"use strict";var n=t("../vmath"),r=t("./value-type"),s=t("../platform/js"),o=t("../platform/CCClass");function a(t,e,i,n,r,s,o,a,c,l,h,u,_,f,d,p){this.m=new Float32Array(16);var m=this.m;m[0]=t,m[1]=e,m[2]=i,m[3]=n,m[4]=r,m[5]=s,m[6]=o,m[7]=a,m[8]=c,m[9]=l,m[10]=h,m[11]=u,m[12]=_,m[13]=f,m[14]=d,m[15]=p}s.extend(a,r),o.fastDefine("cc.Mat4",a,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1});for(var c=function(t){Object.defineProperty(a.prototype,"m"+t,{get:function(){return this.m[t]},set:function(e){this.m[t]=e}})},l=0;l<16;l++)c(l);s.mixin(a.prototype,{clone:function(){var t=this.m;return new a(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},set:function(t){var e=this.m,i=t.m;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},equals:function(t){return n.mat4.exactEquals(this,t)},fuzzyEquals:function(t){return n.mat4.equals(this,t)},toString:function(){var t=this.m;return t?"[\n"+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+",\n"+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+",\n"+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+",\n"+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+"\n]":"[\n1, 0, 0, 0\n0, 1, 0, 0\n0, 0, 1, 0\n0, 0, 0, 1\n]"},identity:function(){return n.mat4.identity(this)},transpose:function(t){return t=t||new cc.Mat4,n.mat4.transpose(t,this)},invert:function(t){return t=t||new cc.Mat4,n.mat4.invert(t,this)},adjoint:function(t){return t=t||new cc.Mat4,n.mat4.adjoint(t,this)},determinant:function(){return n.mat4.determinant(this)},add:function(t,e){return e=e||new cc.Mat4,n.mat4.add(e,this,t)},sub:function(t,e){return e=e||new cc.Mat4,n.mat4.subtract(e,this,t)},mul:function(t,e){return e=e||new cc.Mat4,n.mat4.multiply(e,this,t)},mulScalar:function(t,e){return e=e||new cc.Mat4,n.mat4.mulScalar(e,this,t)},translate:function(t,e){return e=e||new cc.Mat4,n.mat4.translate(e,this,t)},scale:function(t,e){return e=e||new cc.Mat4,n.mat4.scale(e,this,t)},rotate:function(t,e,i){return i=i||new cc.Mat4,n.mat4.rotate(i,this,t,e)},getTranslation:function(t){return t=t||new cc.Vec3,n.mat4.getTranslation(t,this)},getScale:function(t){return t=t||new cc.Vec3,n.mat4.getScaling(t,this)},getRotation:function(t){return t=t||new cc.Quat,n.mat4.getRotation(t,this)},fromRTS:function(t,e,i){return n.mat4.fromRTS(this,t,e,i)},fromQuat:function(t){return n.mat4.fromQuat(this,t)},array:function(t){return n.mat4.array(t,this)}}),cc.mat4=function(t,e,i,r,s,o,c,l,h,u,_,f,d,p,m,y){var v=new a(t,e,i,r,s,o,c,l,h,u,_,f,d,p,m,y);return void 0===t&&n.mat4.identity(v),v},e.exports=cc.Mat4=a}),{"../platform/CCClass":160,"../platform/js":180,"../vmath":274,"./value-type":268}],265:[(function(t,e,i){"use strict";var n=t("./value-type"),r=t("../platform/js"),s=t("../platform/CCClass"),o=t("../vmath/quat");function a(t,e,i,n){t&&"object"==typeof t&&(i=t.z,e=t.y,n=t.w,t=t.x),this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||1}r.extend(a,n),s.fastDefine("cc.Quat",a,{x:0,y:0,z:0,w:1});var c=a.prototype;c.clone=function(){return new a(this.x,this.y,this.z,this.w)},c.set=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},c.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},c.toEuler=function(t){return o.toEuler(t,this),t},c.fromEuler=function(t){return o.fromEuler(this,t.x,t.y,t.z),this},c.lerp=function(t,e,i){return i=i||new cc.Quat,o.slerp(i,this,t,e),i},c.mul=function(t,e){return e=e||new cc.Quat,o.mul(e,this,t),e},c.array=function(t){o.array(t,this)},c.rotateAround=function(t,e,i,n){return n=n||new cc.Quat,o.rotateAround(n,t,e,i)},cc.quat=function(t,e,i,n){return new a(t,e,i,n)},e.exports=cc.Quat=a}),{"../platform/CCClass":160,"../platform/js":180,"../vmath/quat":279,"./value-type":268}],266:[(function(t,e,i){"use strict";var n=t("./value-type"),r=t("../platform/js");function s(t,e,i,n){t&&"object"==typeof t&&(e=t.y,i=t.width,n=t.height,t=t.x),this.x=t||0,this.y=e||0,this.width=i||0,this.height=n||0}r.extend(s,n),t("../platform/CCClass").fastDefine("cc.Rect",s,{x:0,y:0,width:0,height:0}),s.fromMinMax=function(t,e){var i=Math.min(t.x,e.x),n=Math.min(t.y,e.y);return new s(i,n,Math.max(t.x,e.x)-i,Math.max(t.y,e.y)-n)};var o=s.prototype;o.clone=function(){return new s(this.x,this.y,this.width,this.height)},o.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height},o.lerp=function(t,e,i){i=i||new s;var n=this.x,r=this.y,o=this.width,a=this.height;return i.x=n+(t.x-n)*e,i.y=r+(t.y-r)*e,i.width=o+(t.width-o)*e,i.height=a+(t.height-a)*e,i},o.set=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},o.intersects=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,r=t.y+t.height;return!(e=t.x&&this.y<=t.y&&this.y+this.height>=t.y},o.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},o.union=function(t,e){var i=this.x,n=this.y,r=this.width,s=this.height,o=e.x,a=e.y,c=e.width,l=e.height;return t.x=Math.min(i,o),t.y=Math.min(n,a),t.width=Math.max(i+r,o+c)-t.x,t.height=Math.max(n+s,a+l)-t.y,t},o.transformMat4=function(t,e){var i=this.x,n=this.y,r=i+this.width,s=n+this.height,o=e.m,a=o[0]*i+o[4]*n+o[12],c=o[1]*i+o[5]*n+o[13],l=o[0]*r+o[4]*n+o[12],h=o[1]*r+o[5]*n+o[13],u=o[0]*i+o[4]*s+o[12],_=o[1]*i+o[5]*s+o[13],f=o[0]*r+o[4]*s+o[12],d=o[1]*r+o[5]*s+o[13],p=Math.min(a,l,u,f),m=Math.max(a,l,u,f),y=Math.min(c,h,_,d),v=Math.max(c,h,_,d);return t.x=p,t.y=y,t.width=m-p,t.height=v-y,t},o.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},r.getset(o,"xMin",(function(){return this.x}),(function(t){this.width+=this.x-t,this.x=t})),r.getset(o,"yMin",(function(){return this.y}),(function(t){this.height+=this.y-t,this.y=t})),r.getset(o,"xMax",(function(){return this.x+this.width}),(function(t){this.width=t-this.x})),r.getset(o,"yMax",(function(){return this.y+this.height}),(function(t){this.height=t-this.y})),r.getset(o,"center",(function(){return new cc.Vec2(this.x+.5*this.width,this.y+.5*this.height)}),(function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height})),r.getset(o,"origin",(function(){return new cc.Vec2(this.x,this.y)}),(function(t){this.x=t.x,this.y=t.y})),r.getset(o,"size",(function(){return new cc.Size(this.width,this.height)}),(function(t){this.width=t.width,this.height=t.height})),cc.Rect=s,cc.rect=function(t,e,i,n){return new s(t,e,i,n)},e.exports=cc.Rect}),{"../platform/CCClass":160,"../platform/js":180,"./value-type":268}],267:[(function(t,e,i){"use strict";var n=t("./value-type"),r=t("../platform/js");function s(t,e){t&&"object"==typeof t&&(e=t.height,t=t.width),this.width=t||0,this.height=e||0}r.extend(s,n),t("../platform/CCClass").fastDefine("cc.Size",s,{width:0,height:0}),r.get(s,"ZERO",(function(){return new s(0,0)}));var o=s.prototype;o.clone=function(){return new s(this.width,this.height)},o.equals=function(t){return t&&this.width===t.width&&this.height===t.height},o.lerp=function(t,e,i){i=i||new s;var n=this.width,r=this.height;return i.width=n+(t.width-n)*e,i.height=r+(t.height-r)*e,i},o.set=function(t){this.width=t.width,this.height=t.height},o.toString=function(){return"("+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},cc.size=function(t,e){return new s(t,e)},cc.Size=e.exports=s}),{"../platform/CCClass":160,"../platform/js":180,"./value-type":268}],268:[(function(t,e,i){"use strict";var n=t("../platform/js");function r(){}n.setClassName("cc.ValueType",r);var s=r.prototype;s.toString=function(){return""+{}},cc.ValueType=e.exports=r}),{"../platform/js":180}],269:[(function(t,e,i){"use strict";var n=t("../vmath"),r=t("./value-type"),s=t("../platform/js"),o=t("../platform/CCClass"),a=t("../utils/misc");function c(t,e){t&&"object"==typeof t&&(e=t.y,t=t.x),this.x=t||0,this.y=e||0}s.extend(c,r),o.fastDefine("cc.Vec2",c,{x:0,y:0});var l=c.prototype;s.value(l,"z",0,!0),l.clone=function(){return new c(this.x,this.y)},l.set=function(t){return this.x=t.x,this.y=t.y,this},l.equals=function(t){return t&&this.x===t.x&&this.y===t.y},l.fuzzyEquals=function(t,e){return this.x-e<=t.x&&t.x<=this.x+e&&this.y-e<=t.y&&t.y<=this.y+e},l.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},l.lerp=function(t,e,i){i=i||new c;var n=this.x,r=this.y;return i.x=n+(t.x-n)*e,i.y=r+(t.y-r)*e,i},l.clampf=function(t,e){return this.x=a.clampf(this.x,t.x,e.x),this.y=a.clampf(this.y,t.y,e.y),this},l.addSelf=function(t){return this.x+=t.x,this.y+=t.y,this},l.add=function(t,e){return(e=e||new c).x=this.x+t.x,e.y=this.y+t.y,e},l.subSelf=function(t){return this.x-=t.x,this.y-=t.y,this},l.sub=function(t,e){return(e=e||new c).x=this.x-t.x,e.y=this.y-t.y,e},l.mulSelf=function(t){return this.x*=t,this.y*=t,this},l.mul=function(t,e){return(e=e||new c).x=this.x*t,e.y=this.y*t,e},l.scaleSelf=function(t){return this.x*=t.x,this.y*=t.y,this},l.scale=function(t,e){return(e=e||new c).x=this.x*t.x,e.y=this.y*t.y,e},l.divSelf=function(t){return this.x/=t,this.y/=t,this},l.div=function(t,e){return(e=e||new c).x=this.x/t,e.y=this.y/t,e},l.negSelf=function(){return this.x=-this.x,this.y=-this.y,this},l.neg=function(t){return(t=t||new c).x=-this.x,t.y=-this.y,t},l.dot=function(t){return this.x*t.x+this.y*t.y},l.cross=function(t){return this.x*t.y-this.y*t.x},l.mag=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},l.magSqr=function(){return this.x*this.x+this.y*this.y},l.normalizeSelf=function(){var t=this.x*this.x+this.y*this.y;if(1===t)return this;if(0===t)return this;var e=1/Math.sqrt(t);return this.x*=e,this.y*=e,this},l.normalize=function(t){return(t=t||new c).x=this.x,t.y=this.y,t.normalizeSelf(),t},l.angle=function(t){var e=this.magSqr(),i=t.magSqr();if(0===e||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(t)/Math.sqrt(e*i);return n=a.clampf(n,-1,1),Math.acos(n)},l.signAngle=function(t){var e=this.angle(t);return this.cross(t)<0?-e:e},l.rotate=function(t,e){return(e=e||new c).x=this.x,e.y=this.y,e.rotateSelf(t)},l.rotateSelf=function(t){var e=Math.sin(t),i=Math.cos(t),n=this.x;return this.x=i*n-e*this.y,this.y=e*n+i*this.y,this},l.project=function(t){return t.mul(this.dot(t)/t.dot(t))},l.transformMat4=function(t,e){e=e||new c,n.vec2.transformMat4(e,this,t)},l.fromTranslation=function(t){return this.x=t[0],this.y=t[1],this},l.toTranslation=function(t){t[0]=this.x,t[1]=this.y},l.fromScale=function(t){return this.x=t[7],this.y=t[8],this},l.toScale=function(t){t[7]=this.x,t[8]=this.y},l.array=function(t){n.vec2.array(t,this)},s.get(c,"ONE",(function(){return new c(1,1)})),s.get(c,"ZERO",(function(){return new c(0,0)})),s.get(c,"UP",(function(){return new c(0,1)})),s.get(c,"RIGHT",(function(){return new c(1,0)})),cc.Vec2=c,cc.v2=function(t,e){return new c(t,e)},cc.p=cc.v2,e.exports=cc.Vec2}),{"../platform/CCClass":160,"../platform/js":180,"../utils/misc":249,"../vmath":274,"./value-type":268}],270:[(function(t,e,i){"use strict";var n=t("../vmath"),r=t("./value-type"),s=t("../platform/js"),o=t("../platform/CCClass"),a=t("../utils/misc"),c=t("./vec2").prototype;function l(t,e,i){t&&"object"==typeof t&&(i=t.z,e=t.y,t=t.x),this.x=t||0,this.y=e||0,this.z=i||0}s.extend(l,r),o.fastDefine("cc.Vec3",l,{x:0,y:0,z:0});var h=l.prototype;h.clone=function(){return new l(this.x,this.y,this.z)},h.set=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},h.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z},h.fuzzyEquals=function(t,e){return this.x-e<=t.x&&t.x<=this.x+e&&this.y-e<=t.y&&t.y<=this.y+e&&this.z-e<=t.z&&t.z<=this.z+e},h.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},h.lerp=function(t,e,i){return i=i||new l,n.vec3.lerp(i,this,t,e),i},h.clampf=function(t,e){return this.x=a.clampf(this.x,t.x,e.x),this.y=a.clampf(this.y,t.y,e.y),this.z=a.clampf(this.z,t.z,e.z),this},h.addSelf=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},h.add=function(t,e){return(e=e||new l).x=this.x+t.x,e.y=this.y+t.y,e.z=this.z+t.z,e},h.subSelf=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},h.sub=function(t,e){return(e=e||new l).x=this.x-t.x,e.y=this.y-t.y,e.z=this.z-t.z,e},h.mulSelf=function(t){return this.x*=t,this.y*=t,this.z*=t,this},h.mul=function(t,e){return(e=e||new l).x=this.x*t,e.y=this.y*t,e.z=this.z*t,e},h.scaleSelf=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},h.scale=function(t,e){return(e=e||new l).x=this.x*t.x,e.y=this.y*t.y,e.z=this.z*t.z,e},h.divSelf=function(t){return this.x/=t,this.y/=t,this.z/=t,this},h.div=function(t,e){return(e=e||new l).x=this.x/t,e.y=this.y/t,e.z=this.z/t,e},h.negSelf=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},h.neg=function(t){return(t=t||new l).x=-this.x,t.y=-this.y,t.z=-this.z,t},h.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},h.cross=function(t,e){return e=e||new l,n.vec3.cross(e,this,t),e},h.mag=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},h.magSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},h.normalizeSelf=function(){return n.vec3.normalize(this,this),this},h.normalize=function(t){return t=t||new l,n.vec3.normalize(t,this),t},h.transformMat4=function(t,e){e=e||new l,n.vec3.transformMat4(e,this,t)},h.angle=c.angle,h.project=c.project,h.signAngle=function(t){cc.warnID(1408,"vec3.signAngle","v2.1","cc.v2(selfVector).signAngle(vector)");var e=new cc.Vec2(this.x,this.y),i=new cc.Vec2(t.x,t.y);return e.signAngle(i)},h.rotate=function(t,e){return cc.warnID(1408,"vec3.rotate","v2.1","cc.v2(selfVector).rotate(radians, out)"),c.rotate.call(this,t,e)},h.rotateSelf=function(t){return cc.warnID(1408,"vec3.rotateSelf","v2.1","cc.v2(selfVector).rotateSelf(radians)"),c.rotateSelf.call(this,t)},h.array=function(t){n.vec3.array(t,this)},s.get(l,"ONE",(function(){return new l(1,1,1)})),s.get(l,"ZERO",(function(){return new l(0,0,0)})),s.get(l,"UP",(function(){return new l(0,1,0)})),s.get(l,"RIGHT",(function(){return new l(1,0,0)})),s.get(l,"FRONT",(function(){return new l(0,0,1)})),cc.v3=function(t,e,i){return new l(t,e,i)},e.exports=cc.Vec3=l}),{"../platform/CCClass":160,"../platform/js":180,"../utils/misc":249,"../vmath":274,"./value-type":268,"./vec2":269}],271:[(function(t,e,i){"use strict";var n=a(t("./value-type")),r=a(t("../platform/CCClass")),s=t("../vmath"),o=t("../utils/misc");function a(t){return t&&t.__esModule?t:{default:t}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=(function(t){function e(i,n,r,s){c(this,e);var o=l(this,t.call(this));return i&&"object"==typeof i&&(s=i.w,r=i.z,n=i.y,i=i.x),o.x=i||0,o.y=n||0,o.z=r||0,o.w=s||0,o}return h(e,t),e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.set=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.prototype.equals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.prototype.fuzzyEquals=function(t,e){return this.x-e<=t.x&&t.x<=this.x+e&&this.y-e<=t.y&&t.y<=this.y+e&&this.z-e<=t.z&&t.z<=this.z+e&&this.w-e<=t.w&&t.w<=this.w+e},e.prototype.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},e.prototype.lerp=function(t,i,n){return n=n||new e,s.vec4.lerp(n,this,t,i),n},e.prototype.clampf=function(t,e){return this.x=(0,o.clampf)(this.x,t.x,e.x),this.y=(0,o.clampf)(this.y,t.y,e.y),this.z=(0,o.clampf)(this.z,t.z,e.z),this.w=(0,o.clampf)(this.w,t.w,e.w),this},e.prototype.addSelf=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},e.prototype.add=function(t,i){return(i=i||new e).x=this.x+t.x,i.y=this.y+t.y,i.z=this.z+t.z,i.w=this.w+t.w,i},e.prototype.subSelf=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},e.prototype.sub=function(t,i){return(i=i||new e).x=this.x-t.x,i.y=this.y-t.y,i.z=this.z-t.z,i.w=this.w-t.w,i},e.prototype.mulSelf=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.prototype.mul=function(t,i){return(i=i||new e).x=this.x*t,i.y=this.y*t,i.z=this.z*t,i.w=this.w*t,i},e.prototype.scaleSelf=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.prototype.scale=function(t,i){return(i=i||new e).x=this.x*t.x,i.y=this.y*t.y,i.z=this.z*t.z,i.w=this.w*t.w,i},e.prototype.divSelf=function(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this},e.prototype.div=function(t,i){return(i=i||new e).x=this.x/t,i.y=this.y/t,i.z=this.z/t,i.w=this.w/t,i},e.prototype.negSelf=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.prototype.neg=function(t){return(t=t||new e).x=-this.x,t.y=-this.y,t.z=-this.z,t.w=-this.w,t},e.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.prototype.cross=function(t,i){return i=i||new e,s.vec4.cross(i,this,t),i},e.prototype.mag=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},e.prototype.magSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},e.prototype.normalizeSelf=function(){return s.vec4.normalize(this,this),this},e.prototype.normalize=function(t){return t=t||new e,s.vec4.normalize(t,this),t},e.prototype.transformMat4=function(t,i){return i=i||new e,s.vec4.transformMat4(i,this,t),i},e.prototype.array=function(t){s.vec4.array(t,this)},e})(n.default);r.default.fastDefine("cc.Vec4",u,{x:0,y:0,z:0,w:0}),cc.v4=function(t,e,i,n){return new u(t,e,i,n)},e.exports=cc.Vec4=u}),{"../platform/CCClass":160,"../utils/misc":249,"../vmath":274,"./value-type":268}],272:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;r(this,t),this.r=e,this.g=i,this.b=n}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)},t.clone=function(e){return new t(e.r,e.g,e.b)},t.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t},t.set=function(t,e,i,n){return t.r=e,t.g=i,t.b=n,t},t.fromHex=function(t,e){var i=(e>>16)/255,n=(e>>8&255)/255,r=(255&e)/255;return t.r=i,t.g=n,t.b=r,t},t.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t},t.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t},t.div=function(e,i,n){return t.divide(e,i,n)},t.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t},t.lerp=function(t,e,i,n){var r=e.r,s=e.g,o=e.b;return t.r=r+n*(i.r-r),t.g=s+n*(i.g-s),t.b=o+n*(i.b-o),t},t.str=function(t){return"color3("+t.r+", "+t.g+", "+t.b+")"},t.array=function(t,e){var i=e instanceof cc.Color?1/255:1;return t[0]=e.r*i,t[1]=e.g*i,t[2]=e.b*i,t},t.exactEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b},t.equals=function(t,e){var i=t.r,r=t.g,s=t.b,o=e.r,a=e.g,c=e.b;return Math.abs(i-o)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(s-c)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))},t.hex=function(t){return 255*t.r<<16|255*t.g<<8|255*t.b},t})();i.default=s,e.exports=i.default}),{"./utils":281}],273:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;r(this,t),this.r=e,this.g=i,this.b=n,this.a=s}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:1)},t.clone=function(e){return new t(e.r,e.g,e.b,e.a)},t.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},t.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},t.fromHex=function(t,e){var i=(e>>24)/255,n=(e>>16&255)/255,r=(e>>8&255)/255,s=(255&e)/255;return t.r=i,t.g=n,t.b=r,t.a=s,t},t.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},t.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},t.div=function(e,i,n){return t.divide(e,i,n)},t.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},t.lerp=function(t,e,i,n){var r=e.r,s=e.g,o=e.b,a=e.a;return t.r=r+n*(i.r-r),t.g=s+n*(i.g-s),t.b=o+n*(i.b-o),t.a=a+n*(i.a-a),t},t.str=function(t){return"color4("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},t.array=function(t,e){var i=e instanceof cc.Color||e.a>1?1/255:1;return t[0]=e.r*i,t[1]=e.g*i,t[2]=e.b*i,t[3]=e.a*i,t},t.exactEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},t.equals=function(t,e){var i=t.r,r=t.g,s=t.b,o=t.a,a=e.r,c=e.g,l=e.b,h=e.a;return Math.abs(i-a)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-c)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-h)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))},t.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0},t})();i.default=s,e.exports=i.default}),{"./utils":281}],274:[(function(t,e,i){"use strict";i.__esModule=!0,i.color4=i.color3=i.mat4=i.mat3=i.mat23=i.mat2=i.trs=i.quat=i.vec4=i.vec3=i.vec2=void 0;var n=t("./utils");Object.keys(n).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(i,t,{enumerable:!0,get:function(){return n[t]}})}));var r=p(t("./vec2")),s=p(t("./vec3")),o=p(t("./vec4")),a=p(t("./quat")),c=p(t("./trs")),l=p(t("./mat2")),h=p(t("./mat23")),u=p(t("./mat3")),_=p(t("./mat4")),f=p(t("./color3")),d=p(t("./color4"));function p(t){return t&&t.__esModule?t:{default:t}}i.vec2=r.default,i.vec3=s.default,i.vec4=o.default,i.quat=a.default,i.trs=c.default,i.mat2=l.default,i.mat23=h.default,i.mat3=u.default,i.mat4=_.default,i.color3=f.default,i.color4=d.default,i.default={vec2:r.default,vec3:s.default,vec4:o.default,quat:a.default,trs:c.default,mat2:l.default,mat23:h.default,mat3:u.default,mat4:_.default,color3:f.default,color4:d.default}}),{"./color3":272,"./color4":273,"./mat2":275,"./mat23":276,"./mat3":277,"./mat4":278,"./quat":279,"./trs":280,"./utils":281,"./vec2":282,"./vec3":283,"./vec4":284}],275:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(r(this,t),e instanceof Float32Array)i?(this.m=new Float32Array(4),this.m.set(e)):this.m=e;else{this.m=new Float32Array(4);var o=this.m;o[0]=e,o[1]=i,o[2]=n,o[3]=s}}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:1)},t.clone=function(e){var i=e.m;return new t(i[0],i[1],i[2],i[3])},t.copy=function(t,e){return t.m.set(e.m),t},t.identity=function(t){var e=t.m;return e[0]=1,e[1]=0,e[2]=0,e[3]=1,t},t.set=function(t,e,i,n,r){var s=t.m;return s[0]=e,s[1]=i,s[2]=n,s[3]=r,t},t.transpose=function(t,e){var i=t.m,n=e.m;if(t===e){var r=n[1];i[1]=n[2],i[2]=r}else i[0]=n[0],i[1]=n[2],i[2]=n[1],i[3]=n[3];return t},t.invert=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],o=i[2],a=i[3],c=r*a-o*s;return c?(c=1/c,n[0]=a*c,n[1]=-s*c,n[2]=-o*c,n[3]=r*c,t):null},t.adjoint=function(t,e){var i=t.m,n=e.m,r=n[0];return i[0]=n[3],i[1]=-n[1],i[2]=-n[2],i[3]=r,t},t.determinant=function(t){var e=t.m;return e[0]*e[3]-e[2]*e[1]},t.multiply=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=bm[0],h=bm[1],u=bm[2],_=bm[3];return r[0]=s*l+a*h,r[1]=o*l+c*h,r[2]=s*u+a*_,r[3]=o*u+c*_,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.rotate=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=Math.sin(i),h=Math.cos(i);return r[0]=s*h+a*l,r[1]=o*h+c*l,r[2]=s*-l+a*h,r[3]=o*-l+c*h,t},t.scale=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=i.x,h=i.y;return r[0]=s*l,r[1]=o*l,r[2]=a*h,r[3]=c*h,t},t.fromRotation=function(t,e){var i=t.m,n=Math.sin(e),r=Math.cos(e);return i[0]=r,i[1]=n,i[2]=-n,i[3]=r,t},t.fromScaling=function(t,e){var i=t.m;return i[0]=e.x,i[1]=0,i[2]=0,i[3]=e.y,t},t.str=function(t){var e=t.m;return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},t.array=function(t,e){var i=e.m;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t},t.frob=function(t){var e=t.m;return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2))},t.LDU=function(t,e,i,n){var r=t.m,s=i.m,o=n.m;r[2]=o[2]/o[0],s[0]=o[0],s[1]=o[1],s[3]=o[3]-r[2]*s[1]},t.add=function(t,e,i){var n=e.m,r=i.m,s=t.m;return s[0]=n[0]+r[0],s[1]=n[1]+r[1],s[2]=n[2]+r[2],s[3]=n[3]+r[3],t},t.subtract=function(t,e,i){var n=e.m,r=i.m,s=t.m;return s[0]=n[0]-r[0],s[1]=n[1]-r[1],s[2]=n[2]-r[2],s[3]=n[3]-r[3],t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.exactEquals=function(t,e){var i=t.m,n=e.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]},t.equals=function(t,e){var i=t.m,r=e.m,s=i[0],o=i[1],a=i[2],c=i[3],l=r[0],h=r[1],u=r[2],_=r[3];return Math.abs(s-l)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-h)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(a-u)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(c-_)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(_))},t.multiplyScalar=function(t,e,i){var n=e.m,r=t.m;return r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[3]=n[3]*i,t},t.multiplyScalarAndAdd=function(t,e,i,n){var r=e.m,s=i.m,o=t.m;return o[0]=r[0]+s[0]*n,o[1]=r[1]+s[1]*n,o[2]=r[2]+s[2]*n,o[3]=r[3]+s[3]*n,t},t})();i.default=s,e.exports=i.default}),{"./utils":281}],276:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(r(this,t),e instanceof Float32Array)i?(this.m=new Float32Array(6),this.m.set(e)):this.m=e;else{this.m=new Float32Array(6);var c=this.m;c[0]=e,c[1]=i,c[2]=n,c[3]=s,c[4]=o,c[5]=a}}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)},t.clone=function(e){var i=e.m;return new t(i[0],i[1],i[2],i[3],i[4],i[5])},t.copy=function(t,e){return t.m.set(e.m),t},t.identity=function(t){var e=t.m;return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,t},t.set=function(t,e,i,n,r,s,o){var a=t.m;return a[0]=e,a[1]=i,a[2]=n,a[3]=r,a[4]=s,a[5]=o,t},t.invert=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],l=i[5],h=r*a-s*o;return h?(h=1/h,n[0]=a*h,n[1]=-s*h,n[2]=-o*h,n[3]=r*h,n[4]=(o*l-a*c)*h,n[5]=(s*c-r*l)*h,t):null},t.determinant=function(t){var e=t.m;return e[0]*e[3]-e[1]*e[2]},t.multiply=function(t,e,i){var n=e.m,r=i.m,s=t.m,o=n[0],a=n[1],c=n[2],l=n[3],h=n[4],u=n[5],_=r[0],f=r[1],d=r[2],p=r[3],m=r[4],y=r[5];return s[0]=o*_+c*f,s[1]=a*_+l*f,s[2]=o*d+c*p,s[3]=a*d+l*p,s[4]=o*m+c*y+h,s[5]=a*m+l*y+u,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.rotate=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=Math.sin(i),_=Math.cos(i);return r[0]=s*_+a*u,r[1]=o*_+c*u,r[2]=s*-u+a*_,r[3]=o*-u+c*_,r[4]=l,r[5]=h,t},t.scale=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=i.x,_=i.y;return r[0]=s*u,r[1]=o*u,r[2]=a*_,r[3]=c*_,r[4]=l,r[5]=h,t},t.translate=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=i.x,_=i.y;return r[0]=s,r[1]=o,r[2]=a,r[3]=c,r[4]=s*u+a*_+l,r[5]=o*u+c*_+h,t},t.fromRotation=function(t,e){var i=t.m,n=Math.sin(e),r=Math.cos(e);return i[0]=r,i[1]=n,i[2]=-n,i[3]=r,i[4]=0,i[5]=0,t},t.fromScaling=function(t,e){var i=e.m,n=t.m;return n[0]=i[0],n[1]=0,n[2]=0,n[3]=i[1],n[4]=0,n[5]=0,t},t.fromTranslation=function(t,e){var i=t.m;return i[0]=1,i[1]=0,i[2]=0,i[3]=1,i[4]=e.x,i[5]=e.y,t},t.fromRTS=function(t,e,i,n){var r=t.m,s=Math.sin(e),o=Math.cos(e);return r[0]=o*n.x,r[1]=s*n.x,r[2]=-s*n.y,r[3]=o*n.y,r[4]=i.x,r[5]=i.y,t},t.str=function(t){var e=t.m;return"mat23("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},t.array=function(t,e){var i=e.m;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t},t.array4x4=function(t,e){var i=e.m;return t[0]=i[0],t[1]=i[1],t[2]=0,t[3]=0,t[4]=i[2],t[5]=i[3],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=i[4],t[13]=i[5],t[14]=0,t[15]=1,t},t.frob=function(t){var e=t.m;return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+1)},t.add=function(t,e,i){var n=e.m,r=i.m,s=t.m;return s[0]=n[0]+r[0],s[1]=n[1]+r[1],s[2]=n[2]+r[2],s[3]=n[3]+r[3],s[4]=n[4]+r[4],s[5]=n[5]+r[5],t},t.subtract=function(t,e,i){var n=e.m,r=i.m,s=t.m;return s[0]=n[0]-r[0],s[1]=n[1]-r[1],s[2]=n[2]-r[2],s[3]=n[3]-r[3],s[4]=n[4]-r[4],s[5]=n[5]-r[5],t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiplyScalar=function(t,e,i){var n=e.m,r=t.m;return r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[3]=n[3]*i,r[4]=n[4]*i,r[5]=n[5]*i,t},t.multiplyScalarAndAdd=function(t,e,i,n){var r=e.m,s=i.m,o=t.m;return o[0]=r[0]+s[0]*n,o[1]=r[1]+s[1]*n,o[2]=r[2]+s[2]*n,o[3]=r[3]+s[3]*n,o[4]=r[4]+s[4]*n,o[5]=r[5]+s[5]*n,t},t.exactEquals=function(t,e){var i=t.m,n=e.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]},t.equals=function(t,e){var i=t.m,r=e.m,s=i[0],o=i[1],a=i[2],c=i[3],l=i[4],h=i[5],u=r[0],_=r[1],f=r[2],d=r[3],p=r[4],m=r[5];return Math.abs(s-u)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(o-_)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-f)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(c-d)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(l-p)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(p))&&Math.abs(h-m)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(m))},t})();i.default=s,e.exports=i.default}),{"./utils":281}],277:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("./vec3"));function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1;if(s(this,t),e instanceof Float32Array)i?(this.m=new Float32Array(9),this.m.set(e)):this.m=e;else{this.m=new Float32Array(9);var u=this.m;u[0]=e,u[1]=i,u[2]=n,u[3]=r,u[4]=o,u[5]=a,u[6]=c,u[7]=l,u[8]=h}}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:1)},t.clone=function(e){var i=e.m;return new t(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},t.copy=function(t,e){return t.m.set(e.m),t},t.set=function(t,e,i,n,r,s,o,a,c,l){var h=t.m;return h[0]=e,h[1]=i,h[2]=n,h[3]=r,h[4]=s,h[5]=o,h[6]=a,h[7]=c,h[8]=l,t},t.identity=function(t){var e=t.m;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,t},t.transpose=function(t,e){var i=e.m,n=t.m;if(t===e){var r=i[1],s=i[2],o=i[5];n[1]=i[3],n[2]=i[6],n[3]=r,n[5]=i[7],n[6]=s,n[7]=o}else n[0]=i[0],n[1]=i[3],n[2]=i[6],n[3]=i[1],n[4]=i[4],n[5]=i[7],n[6]=i[2],n[7]=i[5],n[8]=i[8];return t},t.invert=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],l=i[5],h=i[6],u=i[7],_=i[8],f=_*c-l*u,d=-_*a+l*h,p=u*a-c*h,m=r*f+s*d+o*p;return m?(m=1/m,n[0]=f*m,n[1]=(-_*s+o*u)*m,n[2]=(l*s-o*c)*m,n[3]=d*m,n[4]=(_*r-o*h)*m,n[5]=(-l*r+o*a)*m,n[6]=p*m,n[7]=(-u*r+s*h)*m,n[8]=(c*r-s*a)*m,t):null},t.adjoint=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],l=i[5],h=i[6],u=i[7],_=i[8];return n[0]=c*_-l*u,n[1]=o*u-s*_,n[2]=s*l-o*c,n[3]=l*h-a*_,n[4]=r*_-o*h,n[5]=o*a-r*l,n[6]=a*u-c*h,n[7]=s*h-r*u,n[8]=r*c-s*a,t},t.determinant=function(t){var e=t.m,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8];return i*(h*o-a*l)+n*(-h*s+a*c)+r*(l*s-o*c)},t.multiply=function(t,e,i){var n=e.m,r=i.m,s=t.m,o=n[0],a=n[1],c=n[2],l=n[3],h=n[4],u=n[5],_=n[6],f=n[7],d=n[8],p=r[0],m=r[1],y=r[2],v=r[3],g=r[4],x=r[5],C=r[6],A=r[7],b=r[8];return s[0]=p*o+m*l+y*_,s[1]=p*a+m*h+y*f,s[2]=p*c+m*u+y*d,s[3]=v*o+g*l+x*_,s[4]=v*a+g*h+x*f,s[5]=v*c+g*u+x*d,s[6]=C*o+A*l+b*_,s[7]=C*a+A*h+b*f,s[8]=C*c+A*u+b*d,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.translate=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=n[6],_=n[7],f=n[8],d=i.x,p=i.y;return r[0]=s,r[1]=o,r[2]=a,r[3]=c,r[4]=l,r[5]=h,r[6]=d*s+p*c+u,r[7]=d*o+p*l+_,r[8]=d*a+p*h+f,t},t.rotate=function(t,e,i){var n=e.m,r=t.m,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=n[6],_=n[7],f=n[8],d=Math.sin(i),p=Math.cos(i);return r[0]=p*s+d*c,r[1]=p*o+d*l,r[2]=p*a+d*h,r[3]=p*c-d*s,r[4]=p*l-d*o,r[5]=p*h-d*a,r[6]=u,r[7]=_,r[8]=f,t},t.scale=function(t,e,i){var n=i.x,r=i.y,s=e.m,o=t.m;return o[0]=n*s[0],o[1]=n*s[1],o[2]=n*s[2],o[3]=r*s[3],o[4]=r*s[4],o[5]=r*s[5],o[6]=s[6],o[7]=s[7],o[8]=s[8],t},t.fromMat4=function(t,e){var i=e.m,n=t.m;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[4],n[4]=i[5],n[5]=i[6],n[6]=i[8],n[7]=i[9],n[8]=i[10],t},t.fromTranslation=function(t,e){var i=t.m;return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=1,i[5]=0,i[6]=e.x,i[7]=e.y,i[8]=1,t},t.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e),r=t.m;return r[0]=n,r[1]=i,r[2]=0,r[3]=-i,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,t},t.fromScaling=function(t,e){var i=t.m;return i[0]=e.x,i[1]=0,i[2]=0,i[3]=0,i[4]=e.y,i[5]=0,i[6]=0,i[7]=0,i[8]=1,t},t.fromMat2d=function(t,e){var i=e.m,n=t.m;return n[0]=i[0],n[1]=i[1],n[2]=0,n[3]=i[2],n[4]=i[3],n[5]=0,n[6]=i[4],n[7]=i[5],n[8]=1,t},t.fromQuat=function(t,e){var i=t.m,n=e.x,r=e.y,s=e.z,o=e.w,a=n+n,c=r+r,l=s+s,h=n*a,u=r*a,_=r*c,f=s*a,d=s*c,p=s*l,m=o*a,y=o*c,v=o*l;return i[0]=1-_-p,i[3]=u-v,i[6]=f+y,i[1]=u+v,i[4]=1-h-p,i[7]=d-m,i[2]=f-y,i[5]=d+m,i[8]=1-h-_,t},t.fromViewUp=function(e,i,s){return (function(){var e=r.default.create(0,1,0),i=r.default.create(0,0,0),s=r.default.create(0,0,0);return function(o,a,c){return r.default.sqrMag(a)0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,u=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,_=arguments.length>10&&void 0!==arguments[10]?arguments[10]:1,f=arguments.length>11&&void 0!==arguments[11]?arguments[11]:0,d=arguments.length>12&&void 0!==arguments[12]?arguments[12]:0,p=arguments.length>13&&void 0!==arguments[13]?arguments[13]:0,m=arguments.length>14&&void 0!==arguments[14]?arguments[14]:0,y=arguments.length>15&&void 0!==arguments[15]?arguments[15]:1;if(r(this,t),e instanceof Float32Array)i?(this.m=new Float32Array(16),this.m.set(e)):this.m=e;else{this.m=new Float32Array(16);var v=this.m;v[0]=e,v[1]=i,v[2]=n,v[3]=s,v[4]=o,v[5]=a,v[6]=c,v[7]=l,v[8]=h,v[9]=u,v[10]=_,v[11]=f,v[12]=d,v[13]=p,v[14]=m,v[15]=y}}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,arguments.length>10&&void 0!==arguments[10]?arguments[10]:1,arguments.length>11&&void 0!==arguments[11]?arguments[11]:0,arguments.length>12&&void 0!==arguments[12]?arguments[12]:0,arguments.length>13&&void 0!==arguments[13]?arguments[13]:0,arguments.length>14&&void 0!==arguments[14]?arguments[14]:0,arguments.length>15&&void 0!==arguments[15]?arguments[15]:1)},t.clone=function(e){var i=e.m;return new t(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9],i[10],i[11],i[12],i[13],i[14],i[15])},t.copy=function(t,e){return t.m.set(e.m),t},t.set=function(t,e,i,n,r,s,o,a,c,l,h,u,_,f,d,p,m){var y=t.m;return y[0]=e,y[1]=i,y[2]=n,y[3]=r,y[4]=s,y[5]=o,y[6]=a,y[7]=c,y[8]=l,y[9]=h,y[10]=u,y[11]=_,y[12]=f,y[13]=d,y[14]=p,y[15]=m,t},t.identity=function(t){var e=t.m;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.transpose=function(t,e){var i=e.m,n=t.m;if(t===e){var r=i[1],s=i[2],o=i[3],a=i[6],c=i[7],l=i[11];n[1]=i[4],n[2]=i[8],n[3]=i[12],n[4]=r,n[6]=i[9],n[7]=i[13],n[8]=s,n[9]=a,n[11]=i[14],n[12]=o,n[13]=c,n[14]=l}else n[0]=i[0],n[1]=i[4],n[2]=i[8],n[3]=i[12],n[4]=i[1],n[5]=i[5],n[6]=i[9],n[7]=i[13],n[8]=i[2],n[9]=i[6],n[10]=i[10],n[11]=i[14],n[12]=i[3],n[13]=i[7],n[14]=i[11],n[15]=i[15];return t},t.invert=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],l=i[5],h=i[6],u=i[7],_=i[8],f=i[9],d=i[10],p=i[11],m=i[12],y=i[13],v=i[14],g=i[15],x=r*l-s*c,C=r*h-o*c,A=r*u-a*c,b=s*h-o*l,S=s*u-a*l,T=o*u-a*h,w=_*y-f*m,E=_*v-d*m,B=_*g-p*m,M=f*v-d*y,I=f*g-p*y,R=d*g-p*v,P=x*R-C*I+A*M+b*B-S*E+T*w;return P?(P=1/P,n[0]=(l*R-h*I+u*M)*P,n[1]=(o*I-s*R-a*M)*P,n[2]=(y*T-v*S+g*b)*P,n[3]=(d*S-f*T-p*b)*P,n[4]=(h*B-c*R-u*E)*P,n[5]=(r*R-o*B+a*E)*P,n[6]=(v*A-m*T-g*C)*P,n[7]=(_*T-d*A+p*C)*P,n[8]=(c*I-l*B+u*w)*P,n[9]=(s*B-r*I-a*w)*P,n[10]=(m*S-y*A+g*x)*P,n[11]=(f*A-_*S-p*x)*P,n[12]=(l*E-c*M-h*w)*P,n[13]=(r*M-s*E+o*w)*P,n[14]=(y*C-m*b-v*x)*P,n[15]=(_*b-f*C+d*x)*P,t):null},t.adjoint=function(t,e){var i=e.m,n=t.m,r=i[0],s=i[1],o=i[2],a=i[3],c=i[4],l=i[5],h=i[6],u=i[7],_=i[8],f=i[9],d=i[10],p=i[11],m=i[12],y=i[13],v=i[14],g=i[15];return n[0]=l*(d*g-p*v)-f*(h*g-u*v)+y*(h*p-u*d),n[1]=-(s*(d*g-p*v)-f*(o*g-a*v)+y*(o*p-a*d)),n[2]=s*(h*g-u*v)-l*(o*g-a*v)+y*(o*u-a*h),n[3]=-(s*(h*p-u*d)-l*(o*p-a*d)+f*(o*u-a*h)),n[4]=-(c*(d*g-p*v)-_*(h*g-u*v)+m*(h*p-u*d)),n[5]=r*(d*g-p*v)-_*(o*g-a*v)+m*(o*p-a*d),n[6]=-(r*(h*g-u*v)-c*(o*g-a*v)+m*(o*u-a*h)),n[7]=r*(h*p-u*d)-c*(o*p-a*d)+_*(o*u-a*h),n[8]=c*(f*g-p*y)-_*(l*g-u*y)+m*(l*p-u*f),n[9]=-(r*(f*g-p*y)-_*(s*g-a*y)+m*(s*p-a*f)),n[10]=r*(l*g-u*y)-c*(s*g-a*y)+m*(s*u-a*l),n[11]=-(r*(l*p-u*f)-c*(s*p-a*f)+_*(s*u-a*l)),n[12]=-(c*(f*v-d*y)-_*(l*v-h*y)+m*(l*d-h*f)),n[13]=r*(f*v-d*y)-_*(s*v-o*y)+m*(s*d-o*f),n[14]=-(r*(l*v-h*y)-c*(s*v-o*y)+m*(s*h-o*l)),n[15]=r*(l*d-h*f)-c*(s*d-o*f)+_*(s*h-o*l),t},t.determinant=function(t){var e=t.m,i=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],h=e[8],u=e[9],_=e[10],f=e[11],d=e[12],p=e[13],m=e[14],y=e[15];return(i*a-n*o)*(_*y-f*m)-(i*c-r*o)*(u*y-f*p)+(i*l-s*o)*(u*m-_*p)+(n*c-r*a)*(h*y-f*d)-(n*l-s*a)*(h*m-_*d)+(r*l-s*c)*(h*p-u*d)},t.multiply=function(t,e,i){var n=e.m,r=i.m,s=t.m,o=n[0],a=n[1],c=n[2],l=n[3],h=n[4],u=n[5],_=n[6],f=n[7],d=n[8],p=n[9],m=n[10],y=n[11],v=n[12],g=n[13],x=n[14],C=n[15],A=r[0],b=r[1],S=r[2],T=r[3];return s[0]=A*o+b*h+S*d+T*v,s[1]=A*a+b*u+S*p+T*g,s[2]=A*c+b*_+S*m+T*x,s[3]=A*l+b*f+S*y+T*C,A=r[4],b=r[5],S=r[6],T=r[7],s[4]=A*o+b*h+S*d+T*v,s[5]=A*a+b*u+S*p+T*g,s[6]=A*c+b*_+S*m+T*x,s[7]=A*l+b*f+S*y+T*C,A=r[8],b=r[9],S=r[10],T=r[11],s[8]=A*o+b*h+S*d+T*v,s[9]=A*a+b*u+S*p+T*g,s[10]=A*c+b*_+S*m+T*x,s[11]=A*l+b*f+S*y+T*C,A=r[12],b=r[13],S=r[14],T=r[15],s[12]=A*o+b*h+S*d+T*v,s[13]=A*a+b*u+S*p+T*g,s[14]=A*c+b*_+S*m+T*x,s[15]=A*l+b*f+S*y+T*C,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.translate=function(t,e,i){var n=e.m,r=t.m,s=i.x,o=i.y,a=i.z,c=void 0,l=void 0,h=void 0,u=void 0,_=void 0,f=void 0,d=void 0,p=void 0,m=void 0,y=void 0,v=void 0,g=void 0;return e===t?(r[12]=n[0]*s+n[4]*o+n[8]*a+n[12],r[13]=n[1]*s+n[5]*o+n[9]*a+n[13],r[14]=n[2]*s+n[6]*o+n[10]*a+n[14],r[15]=n[3]*s+n[7]*o+n[11]*a+n[15]):(c=n[0],l=n[1],h=n[2],u=n[3],_=n[4],f=n[5],d=n[6],p=n[7],m=n[8],y=n[9],v=n[10],g=n[11],r[0]=c,r[1]=l,r[2]=h,r[3]=u,r[4]=_,r[5]=f,r[6]=d,r[7]=p,r[8]=m,r[9]=y,r[10]=v,r[11]=g,r[12]=c*s+_*o+m*a+n[12],r[13]=l*s+f*o+y*a+n[13],r[14]=h*s+d*o+v*a+n[14],r[15]=u*s+p*o+g*a+n[15]),t},t.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z,o=e.m,a=t.m;return a[0]=o[0]*n,a[1]=o[1]*n,a[2]=o[2]*n,a[3]=o[3]*n,a[4]=o[4]*r,a[5]=o[5]*r,a[6]=o[6]*r,a[7]=o[7]*r,a[8]=o[8]*s,a[9]=o[9]*s,a[10]=o[10]*s,a[11]=o[11]*s,a[12]=o[12],a[13]=o[13],a[14]=o[14],a[15]=o[15],t},t.rotate=function(t,e,i,r){var s,o,a,c,l,h,u,_,f,d,p,m,y,v,g,x,C,A,b,S,T,w,E,B,M=e.m,I=t.m,R=r.x,P=r.y,D=r.z,L=Math.sqrt(R*R+P*P+D*D);return Math.abs(L)0?(r=2*Math.sqrt(n+1),t.w=.25*r,t.x=(i[6]-i[9])/r,t.y=(i[8]-i[2])/r,t.z=(i[1]-i[4])/r):i[0]>i[5]&i[0]>i[10]?(r=2*Math.sqrt(1+i[0]-i[5]-i[10]),t.w=(i[6]-i[9])/r,t.x=.25*r,t.y=(i[1]+i[4])/r,t.z=(i[8]+i[2])/r):i[5]>i[10]?(r=2*Math.sqrt(1+i[5]-i[0]-i[10]),t.w=(i[8]-i[2])/r,t.x=(i[1]+i[4])/r,t.y=.25*r,t.z=(i[6]+i[9])/r):(r=2*Math.sqrt(1+i[10]-i[0]-i[5]),t.w=(i[1]-i[4])/r,t.x=(i[8]+i[2])/r,t.y=(i[6]+i[9])/r,t.z=.25*r),t},t.fromRTS=function(t,e,i,n){var r=t.m,s=e.x,o=e.y,a=e.z,c=e.w,l=s+s,h=o+o,u=a+a,_=s*l,f=s*h,d=s*u,p=o*h,m=o*u,y=a*u,v=c*l,g=c*h,x=c*u,C=n.x,A=n.y,b=n.z;return r[0]=(1-(p+y))*C,r[1]=(f+x)*C,r[2]=(d-g)*C,r[3]=0,r[4]=(f-x)*A,r[5]=(1-(_+y))*A,r[6]=(m+v)*A,r[7]=0,r[8]=(d+g)*b,r[9]=(m-v)*b,r[10]=(1-(_+p))*b,r[11]=0,r[12]=i.x,r[13]=i.y,r[14]=i.z,r[15]=1,t},t.fromRTSOrigin=function(t,e,i,n,r){var s=t.m,o=e.x,a=e.y,c=e.z,l=e.w,h=o+o,u=a+a,_=c+c,f=o*h,d=o*u,p=o*_,m=a*u,y=a*_,v=c*_,g=l*h,x=l*u,C=l*_,A=n.x,b=n.y,S=n.z,T=r.x,w=r.y,E=r.z;return s[0]=(1-(m+v))*A,s[1]=(d+C)*A,s[2]=(p-x)*A,s[3]=0,s[4]=(d-C)*b,s[5]=(1-(f+v))*b,s[6]=(y+g)*b,s[7]=0,s[8]=(p+x)*S,s[9]=(y-g)*S,s[10]=(1-(f+m))*S,s[11]=0,s[12]=i.x+T-(s[0]*T+s[4]*w+s[8]*E),s[13]=i.y+w-(s[1]*T+s[5]*w+s[9]*E),s[14]=i.z+E-(s[2]*T+s[6]*w+s[10]*E),s[15]=1,t},t.fromQuat=function(t,e){var i=t.m,n=e.x,r=e.y,s=e.z,o=e.w,a=n+n,c=r+r,l=s+s,h=n*a,u=r*a,_=r*c,f=s*a,d=s*c,p=s*l,m=o*a,y=o*c,v=o*l;return i[0]=1-_-p,i[1]=u+v,i[2]=f-y,i[3]=0,i[4]=u-v,i[5]=1-h-p,i[6]=d+m,i[7]=0,i[8]=f+y,i[9]=d-m,i[10]=1-h-_,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,t},t.frustum=function(t,e,i,n,r,s,o){var a=t.m,c=1/(i-e),l=1/(r-n),h=1/(s-o);return a[0]=2*s*c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*s*l,a[6]=0,a[7]=0,a[8]=(i+e)*c,a[9]=(r+n)*l,a[10]=(o+s)*h,a[11]=-1,a[12]=0,a[13]=0,a[14]=o*s*2*h,a[15]=0,t},t.perspective=function(t,e,i,n,r){var s=t.m,o=1/Math.tan(e/2),a=1/(n-r);return s[0]=o/i,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+n)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*n*a,s[15]=0,t},t.perspectiveFromFieldOfView=function(t,e,i,n){var r=t.m,s=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),c=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+c),h=2/(s+o);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=-(a-c)*l*.5,r[9]=(s-o)*h*.5,r[10]=n/(i-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*i/(i-n),r[15]=0,t},t.ortho=function(t,e,i,n,r,s,o){var a=t.m,c=1/(e-i),l=1/(n-r),h=1/(s-o);return a[0]=-2*c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*l,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*h,a[11]=0,a[12]=(e+i)*c,a[13]=(r+n)*l,a[14]=(o+s)*h,a[15]=1,t},t.lookAt=function(t,e,i,n){var r,s,o,a=t.m,c=void 0,l=void 0,h=void 0,u=void 0,_=void 0,f=void 0,d=void 0,p=e.x,m=e.y,y=e.z,v=n.x,g=n.y,x=n.z;return u=p-i.x,_=m-i.y,f=y-i.z,c=g*(f*=d=1/Math.sqrt(u*u+_*_+f*f))-x*(_*=d),l=x*(u*=d)-v*f,h=v*_-g*u,r=_*(h*=d=1/Math.sqrt(c*c+l*l+h*h))-f*(l*=d),s=f*(c*=d)-u*h,o=u*l-_*c,a[0]=c,a[1]=r,a[2]=u,a[3]=0,a[4]=l,a[5]=s,a[6]=_,a[7]=0,a[8]=h,a[9]=o,a[10]=f,a[11]=0,a[12]=-(c*p+l*m+h*y),a[13]=-(r*p+s*m+o*y),a[14]=-(u*p+_*m+f*y),a[15]=1,t},t.str=function(t){var e=t.m;return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},t.array=function(t,e){var i=e.m;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},t.frob=function(t){var e=t.m;return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2)+Math.pow(e[9],2)+Math.pow(e[10],2)+Math.pow(e[11],2)+Math.pow(e[12],2)+Math.pow(e[13],2)+Math.pow(e[14],2)+Math.pow(e[15],2))},t.add=function(t,e,i){var n=e.m,r=i.m,s=t.m;return s[0]=n[0]+r[0],s[1]=n[1]+r[1],s[2]=n[2]+r[2],s[3]=n[3]+r[3],s[4]=n[4]+r[4],s[5]=n[5]+r[5],s[6]=n[6]+r[6],s[7]=n[7]+r[7],s[8]=n[8]+r[8],s[9]=n[9]+r[9],s[10]=n[10]+r[10],s[11]=n[11]+r[11],s[12]=n[12]+r[12],s[13]=n[13]+r[13],s[14]=n[14]+r[14],s[15]=n[15]+r[15],t},t.subtract=function(t,e,i){var n=e.m,r=i.m,s=t.m;return s[0]=n[0]-r[0],s[1]=n[1]-r[1],s[2]=n[2]-r[2],s[3]=n[3]-r[3],s[4]=n[4]-r[4],s[5]=n[5]-r[5],s[6]=n[6]-r[6],s[7]=n[7]-r[7],s[8]=n[8]-r[8],s[9]=n[9]-r[9],s[10]=n[10]-r[10],s[11]=n[11]-r[11],s[12]=n[12]-r[12],s[13]=n[13]-r[13],s[14]=n[14]-r[14],s[15]=n[15]-r[15],t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiplyScalar=function(t,e,i){var n=e.m,r=t.m;return r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[3]=n[3]*i,r[4]=n[4]*i,r[5]=n[5]*i,r[6]=n[6]*i,r[7]=n[7]*i,r[8]=n[8]*i,r[9]=n[9]*i,r[10]=n[10]*i,r[11]=n[11]*i,r[12]=n[12]*i,r[13]=n[13]*i,r[14]=n[14]*i,r[15]=n[15]*i,t},t.multiplyScalarAndAdd=function(t,e,i,n){var r=e.m,s=i.m,o=t.m;return o[0]=r[0]+s[0]*n,o[1]=r[1]+s[1]*n,o[2]=r[2]+s[2]*n,o[3]=r[3]+s[3]*n,o[4]=r[4]+s[4]*n,o[5]=r[5]+s[5]*n,o[6]=r[6]+s[6]*n,o[7]=r[7]+s[7]*n,o[8]=r[8]+s[8]*n,o[9]=r[9]+s[9]*n,o[10]=r[10]+s[10]*n,o[11]=r[11]+s[11]*n,o[12]=r[12]+s[12]*n,o[13]=r[13]+s[13]*n,o[14]=r[14]+s[14]*n,o[15]=r[15]+s[15]*n,t},t.exactEquals=function(t,e){var i=t.m,n=e.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]},t.equals=function(t,e){var i=t.m,r=e.m,s=i[0],o=i[1],a=i[2],c=i[3],l=i[4],h=i[5],u=i[6],_=i[7],f=i[8],d=i[9],p=i[10],m=i[11],y=i[12],v=i[13],g=i[14],x=i[15],C=r[0],A=r[1],b=r[2],S=r[3],T=r[4],w=r[5],E=r[6],B=r[7],M=r[8],I=r[9],R=r[10],P=r[11],D=r[12],L=r[13],O=r[14],V=r[15];return Math.abs(s-C)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(o-A)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(A))&&Math.abs(a-b)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(c-S)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(l-T)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(h-w)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(w))&&Math.abs(u-E)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(_-B)<=n.EPSILON*Math.max(1,Math.abs(_),Math.abs(B))&&Math.abs(f-M)<=n.EPSILON*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(d-I)<=n.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-R)<=n.EPSILON*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(m-P)<=n.EPSILON*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(y-D)<=n.EPSILON*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(v-L)<=n.EPSILON*Math.max(1,Math.abs(v),Math.abs(L))&&Math.abs(g-O)<=n.EPSILON*Math.max(1,Math.abs(g),Math.abs(O))&&Math.abs(x-V)<=n.EPSILON*Math.max(1,Math.abs(x),Math.abs(V))},t})();i.default=s,e.exports=i.default}),{"./utils":281}],279:[(function(t,e,i){"use strict";i.__esModule=!0;var n=a(t("./vec3")),r=a(t("./vec4")),s=a(t("./mat3")),o=t("./utils");function a(t){return t&&t.__esModule?t:{default:t}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=.5*Math.PI/180,h=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;c(this,t),this.x=e,this.y=i,this.z=n,this.w=r}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:1)},t.clone=function(e){return new t(e.x,e.y,e.z,e.w)},t.copy=function(t,e){return r.default.copy(t,e)},t.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},t.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},t.rotationTo=function(e,i,r){return (function(){var e=n.default.create(0,0,0),i=n.default.create(1,0,0),r=n.default.create(0,1,0);return function(s,o,a){var c=n.default.dot(o,a);return c<-.999999?(n.default.cross(e,i,o),n.default.magnitude(e)<1e-6&&n.default.cross(e,r,o),n.default.normalize(e,e),t.fromAxisAngle(s,e,Math.PI),s):c>.999999?(s.x=0,s.y=0,s.z=0,s.w=1,s):(n.default.cross(e,o,a),s.x=e.x,s.y=e.y,s.z=e.z,s.w=1+c,t.normalize(s,s))}})()(e,i,r)},t.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!=n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},t.multiply=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w,a=i.x,c=i.y,l=i.z,h=i.w;return t.x=n*h+o*a+r*l-s*c,t.y=r*h+o*c+s*a-n*l,t.z=s*h+o*l+n*c-r*a,t.w=o*h-n*a-r*c-s*l,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},t.rotateX=function(t,e,i){i*=.5;var n=e.x,r=e.y,s=e.z,o=e.w,a=Math.sin(i),c=Math.cos(i);return t.x=n*c+o*a,t.y=r*c+s*a,t.z=s*c-r*a,t.w=o*c-n*a,t},t.rotateY=function(t,e,i){i*=.5;var n=e.x,r=e.y,s=e.z,o=e.w,a=Math.sin(i),c=Math.cos(i);return t.x=n*c-s*a,t.y=r*c+o*a,t.z=s*c+n*a,t.w=o*c-r*a,t},t.rotateZ=function(t,e,i){i*=.5;var n=e.x,r=e.y,s=e.z,o=e.w,a=Math.sin(i),c=Math.cos(i);return t.x=n*c+r*a,t.y=r*c-n*a,t.z=s*c+o*a,t.w=o*c-s*a,t},t.rotateAround=function(e,i,r,s){return (function(){var e=n.default.create(0,0,0),i=t.create();return function(r,s,o,a){return t.invert(i,s),n.default.transformQuat(e,o,i),t.fromAxisAngle(i,e,a),t.mul(r,s,i),r}})()(e,i,r,s)},t.rotateAroundLocal=function(e,i,n,r){return (function(){var e=t.create();return function(i,n,r,s){return t.fromAxisAngle(e,r,s),t.mul(i,n,e),i}})()(e,i,n,r)},t.calculateW=function(t,e){var i=e.x,n=e.y,r=e.z;return t.x=i,t.y=n,t.z=r,t.w=Math.sqrt(Math.abs(1-i*i-n*n-r*r)),t},t.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},t.lerp=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=e.w;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t.z=o+n*(i.z-o),t.w=a+n*(i.w-a),t},t.slerp=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=e.w,c=i.x,l=i.y,h=i.z,u=i.w,_=void 0,f=void 0,d=void 0,p=void 0,m=void 0;return(f=r*c+s*l+o*h+a*u)<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(_=Math.acos(f),d=Math.sin(_),p=Math.sin((1-n)*_)/d,m=Math.sin(n*_)/d):(p=1-n,m=n),t.x=p*r+m*c,t.y=p*s+m*l,t.z=p*o+m*h,t.w=p*a+m*u,t},t.sqlerp=function(e,i,n,r,s,o){return (function(){var e=t.create(),i=t.create();return function(n,r,s,o,a,c){return t.slerp(e,r,a,c),t.slerp(i,s,o,c),t.slerp(n,e,i,2*c*(1-c)),n}})()(e,i,n,r,s,o)},t.invert=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,o=i*i+n*n+r*r+s*s,a=o?1/o:0;return t.x=-i*a,t.y=-n*a,t.z=-r*a,t.w=s*a,t},t.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},t.magnitude=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},t.mag=function(e){return t.magnitude(e)},t.squaredMagnitude=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},t.sqrMag=function(e){return t.squaredMagnitude(e)},t.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,o=i*i+n*n+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t.x=i*o,t.y=n*o,t.z=r*o,t.w=s*o),t},t.fromAxes=function(e,i,n,r){return (function(){var e=s.default.create();return function(i,n,r,o){return s.default.set(e,n.x,n.y,n.z,r.x,r.y,r.z,o.x,o.y,o.z),t.normalize(i,t.fromMat3(i,e))}})()(e,i,n,r)},t.fromViewUp=function(e,i,n){return (function(){var e=s.default.create();return function(i,n,r){return s.default.fromViewUp(e,n,r),e?t.normalize(i,t.fromMat3(i,e)):null}})()(e,i,n)},t.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},t.fromMat3=function(t,e){var i=e.m,n=i[0],r=i[3],s=i[6],o=i[1],a=i[4],c=i[7],l=i[2],h=i[5],u=i[8],_=n+a+u;if(_>0){var f=.5/Math.sqrt(_+1);t.w=.25/f,t.x=(h-c)*f,t.y=(s-l)*f,t.z=(o-r)*f}else if(n>a&&n>u){var d=2*Math.sqrt(1+n-a-u);t.w=(h-c)/d,t.x=.25*d,t.y=(r+o)/d,t.z=(s+l)/d}else if(a>u){var p=2*Math.sqrt(1+a-n-u);t.w=(s-l)/p,t.x=(r+o)/p,t.y=.25*p,t.z=(c+h)/p}else{var m=2*Math.sqrt(1+u-n-a);t.w=(o-r)/m,t.x=(s+l)/m,t.y=(c+h)/m,t.z=.25*m}return t},t.fromEuler=function(t,e,i,n){e*=l,i*=l,n*=l;var r=Math.sin(e),s=Math.cos(e),o=Math.sin(i),a=Math.cos(i),c=Math.sin(n),h=Math.cos(n);return t.x=r*a*h+s*o*c,t.y=s*o*h+r*a*c,t.z=s*a*c-r*o*h,t.w=s*a*h-r*o*c,t},t.fromAngleZ=function(t,e){e*=l,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e)},t.toEuler=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=void 0,c=void 0,l=void 0,h=i*n+r*s;if(h>.499&&(a=2*Math.atan2(i,s),c=Math.PI/2,l=0),h<-.499&&(a=-2*Math.atan2(i,s),c=-Math.PI/2,l=0),isNaN(a)){var u=i*i,_=n*n,f=r*r;a=Math.atan2(2*n*s-2*i*r,1-2*_-2*f),c=Math.asin(2*h),l=Math.atan2(2*i*s-2*n*r,1-2*u-2*f)}return t.y=(0,o.toDegree)(a),t.z=(0,o.toDegree)(c),t.x=(0,o.toDegree)(l),t},t.str=function(t){return"quat("+t.x+", "+t.y+", "+t.z+", "+t.w+")"},t.array=function(t,e){return t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w,t},t.exactEquals=function(t,e){return r.default.exactEquals(t,e)},t.equals=function(t,e){return r.default.equals(t,e)},t})();i.default=h,e.exports=i.default}),{"./mat3":277,"./utils":281,"./vec3":283,"./vec4":284}],280:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("./quat"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=n.default.create(),o=(function(){function t(){r(this,t)}return t.toRotation=function(t,e){return t.x=e[3],t.y=e[4],t.z=e[5],t.w=e[6],t},t.fromRotation=function(t,e){return t[3]=e.x,t[4]=e.y,t[5]=e.z,t[6]=e.w,t},t.toEuler=function(e,i){return t.toRotation(s,i),n.default.toEuler(e,s),e},t.fromEuler=function(e,i){return n.default.fromEuler(s,i.x,i.y,i.z),t.fromRotation(e,s),e},t.fromEulerNumber=function(e,i,r,o){return n.default.fromEuler(s,i,r,o),t.fromRotation(e,s),e},t.toScale=function(t,e){return t.x=e[7],t.y=e[8],t.z=e[9],t},t.fromScale=function(t,e){return t[7]=e.x,t[8]=e.y,t[9]=e.z,t},t.toPosition=function(t,e){return t.x=e[0],t.y=e[1],t.z=e[2],t},t.fromPosition=function(t,e){return t[0]=e.x,t[1]=e.y,t[2]=e.z,t},t.fromAngleZ=function(e,i){return n.default.fromAngleZ(s,i),t.fromRotation(e,s),e},t})();i.default=o,e.exports=i.default}),{"./quat":279}],281:[(function(t,e,i){"use strict";i.__esModule=!0,i.equals=function(t,e){return Math.abs(t-e)<=s*Math.max(1,Math.abs(t),Math.abs(e))},i.approx=function(t,e,i){return i=i||s,Math.abs(t-e)<=i},i.clamp=function(t,e,i){return ti?i:t},i.clamp01=function(t){return t<0?0:t>1?1:t},i.lerp=function(t,e,i){return t+(e-t)*i},i.toRadian=function(t){return t*n},i.toDegree=function(t){return t*r},i.randomRange=o,i.randomRangeInt=function(t,e){return Math.floor(o(t,e))},i.pseudoRandom=a,i.pseudoRandomRange=c,i.pseudoRandomRangeInt=function(t,e,i){return Math.floor(c(t,e,i))},i.nextPow2=function(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},i.repeat=l,i.pingPong=function(t,e){return t=l(t,2*e),t=e-Math.abs(t-e)},i.inverseLerp=function(t,e,i){return(i-t)/(e-t)};var n=Math.PI/180,r=180/Math.PI,s=i.EPSILON=1e-6;i.random=Math.random;function o(t,e){return Math.random()*(e-t)+t}function a(t){return(t=(9301*t+49297)%233280)/233280}function c(t,e,i){return a(t)*(i-e)+e}function l(t,e){return t-Math.floor(t/e)*e}}),{}],282:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;r(this,t),this.x=e,this.y=i}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)},t.zero=function(t){return t.x=0,t.y=0,t},t.clone=function(e){return new t(e.x,e.y)},t.copy=function(t,e){return t.x=e.x,t.y=e.y,t},t.set=function(t,e,i){return t.x=e,t.y=i,t},t.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t},t.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t},t.div=function(e,i,n){return t.divide(e,i,n)},t.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t},t.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t},t.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t},t.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t},t.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t},t.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t},t.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t},t.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},t.dist=function(e,i){return t.distance(e,i)},t.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},t.sqrDist=function(e,i){return t.squaredDistance(e,i)},t.magnitude=function(t){var e=t.x,i=t.y;return Math.sqrt(e*e+i*i)},t.mag=function(e){return t.magnitude(e)},t.squaredMagnitude=function(t){var e=t.x,i=t.y;return e*e+i*i},t.sqrMag=function(e){return t.squaredMagnitude(e)},t.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t},t.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t},t.inverseSafe=function(t,e){var i=e.x,r=e.y;return Math.abs(i)0&&(r=1/Math.sqrt(r),t.x=e.x*r,t.y=e.y*r),t},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.cross=function(t,e,i){var n=e.x*i.y-e.y*i.x;return t.x=t.y=0,t.z=n,t},t.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},t.random=function(t,e){e=e||1;var i=2*(0,n.random)()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},t.transformMat2=function(t,e,i){var n=i.m,r=e.x,s=e.y;return t.x=n[0]*r+n[2]*s,t.y=n[1]*r+n[3]*s,t},t.transformMat23=function(t,e,i){var n=i.m,r=e.x,s=e.y;return t.x=n[0]*r+n[2]*s+n[4],t.y=n[1]*r+n[3]*s+n[5],t},t.transformMat3=function(t,e,i){var n=i.m,r=e.x,s=e.y;return t.x=n[0]*r+n[3]*s+n[6],t.y=n[1]*r+n[4]*s+n[7],t},t.transformMat4=function(t,e,i){var n=i.m,r=e.x,s=e.y;return t.x=n[0]*r+n[4]*s+n[12],t.y=n[1]*r+n[5]*s+n[13],t},t.forEach=function(e,i,n,r,s,o){return t._forEach(e,i,n,r,s,o)},t.str=function(t){return"vec2("+t.x+", "+t.y+")"},t.array=function(t,e){return t[0]=e.x,t[1]=e.y,t},t.exactEquals=function(t,e){return t.x===e.x&&t.y===e.y},t.equals=function(t,e){var i=t.x,r=t.y,s=e.x,o=e.y;return Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))},t.angle=function(e,i){return t._angle(e,i)},t})();s._forEach=(function(){var t=s.create(0,0);return function(e,i,n,r,s,o){var a=void 0,c=void 0;for(i||(i=2),n||(n=0),c=r?Math.min(r*i+n,e.length):e.length,a=n;a1?0:r<-1?Math.PI:Math.acos(r)}})(),i.default=s,e.exports=i.default}),{"./utils":281}],283:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r(this,t),this.x=e,this.y=i,this.z=n}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)},t.zero=function(t){return t.x=0,t.y=0,t.z=0,t},t.clone=function(e){return new t(e.x,e.y,e.z)},t.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},t.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},t.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},t.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},t.div=function(e,i,n){return t.divide(e,i,n)},t.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t},t.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t},t.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t},t.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t},t.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t},t.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},t.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},t.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return Math.sqrt(i*i+n*n+r*r)},t.dist=function(e,i){return t.distance(e,i)},t.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},t.sqrDist=function(e,i){return t.squaredDistance(e,i)},t.magnitude=function(t){var e=t.x,i=t.y,n=t.z;return Math.sqrt(e*e+i*i+n*n)},t.mag=function(e){return t.magnitude(e)},t.squaredMagnitude=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},t.sqrMag=function(e){return t.squaredMagnitude(e)},t.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},t.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},t.inverseSafe=function(t,e){var i=e.x,r=e.y,s=e.z;return Math.abs(i)0&&(s=1/Math.sqrt(s),t.x=i*s,t.y=n*s,t.z=r*s),t},t.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,c=i.z;return t.x=r*c-s*a,t.y=s*o-n*c,t.z=n*a-r*o,t},t.lerp=function(t,e,i,n){var r=e.x,s=e.y,o=e.z;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t.z=o+n*(i.z-o),t},t.hermite=function(t,e,i,n,r,s){var o=s*s,a=o*(2*s-3)+1,c=o*(s-2)+s,l=o*(s-1),h=o*(3-2*s);return t.x=e.x*a+i.x*c+n.x*l+r.x*h,t.y=e.y*a+i.y*c+n.y*l+r.y*h,t.z=e.z*a+i.z*c+n.z*l+r.z*h,t},t.bezier=function(t,e,i,n,r,s){var o=1-s,a=o*o,c=s*s,l=a*o,h=3*s*a,u=3*c*o,_=c*s;return t.x=e.x*l+i.x*h+n.x*u+r.x*_,t.y=e.y*l+i.y*h+n.y*u+r.y*_,t.z=e.z*l+i.z*h+n.z*u+r.z*_,t},t.random=function(t,e){e=e||1;var i=2*(0,n.random)()*Math.PI,r=Math.acos(2*(0,n.random)()-1);return t.x=Math.sin(r)*Math.cos(i)*e,t.y=Math.sin(r)*Math.sin(i)*e,t.z=Math.cos(r)*e,t},t.transformMat4=function(t,e,i){var n=i.m,r=e.x,s=e.y,o=e.z,a=n[3]*r+n[7]*s+n[11]*o+n[15];return a=a?1/a:1,t.x=(n[0]*r+n[4]*s+n[8]*o+n[12])*a,t.y=(n[1]*r+n[5]*s+n[9]*o+n[13])*a,t.z=(n[2]*r+n[6]*s+n[10]*o+n[14])*a,t},t.transformMat4Normal=function(t,e,i){var n=i.m,r=e.x,s=e.y,o=e.z,a=n[3]*r+n[7]*s+n[11]*o;return a=a?1/a:1,t.x=(n[0]*r+n[4]*s+n[8]*o)*a,t.y=(n[1]*r+n[5]*s+n[9]*o)*a,t.z=(n[2]*r+n[6]*s+n[10]*o)*a,t},t.transformMat3=function(t,e,i){var n=i.m,r=e.x,s=e.y,o=e.z;return t.x=r*n[0]+s*n[3]+o*n[6],t.y=r*n[1]+s*n[4]+o*n[7],t.z=r*n[2]+s*n[5]+o*n[8],t},t.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,c=i.z,l=i.w,h=l*n+a*s-c*r,u=l*r+c*n-o*s,_=l*s+o*r-a*n,f=-o*n-a*r-c*s;return t.x=h*l+f*-o+u*-c-_*-a,t.y=u*l+f*-a+_*-o-h*-c,t.z=_*l+f*-c+h*-a-u*-o,t},t.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,o=e.z-i.z,a=r,c=s*Math.cos(n)-o*Math.sin(n),l=s*Math.sin(n)+o*Math.cos(n);return t.x=a+i.x,t.y=c+i.y,t.z=l+i.z,t},t.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,o=e.z-i.z,a=o*Math.sin(n)+r*Math.cos(n),c=s,l=o*Math.cos(n)-r*Math.sin(n);return t.x=a+i.x,t.y=c+i.y,t.z=l+i.z,t},t.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,o=e.z-i.z,a=r*Math.cos(n)-s*Math.sin(n),c=r*Math.sin(n)+s*Math.cos(n),l=o;return t.x=a+i.x,t.y=c+i.y,t.z=l+i.z,t},t.str=function(t){return"vec3("+t.x+", "+t.y+", "+t.z+")"},t.array=function(t,e){return t[0]=e.x,t[1]=e.y,t[2]=e.z,t},t.exactEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},t.equals=function(t,e){var i=t.x,r=t.y,s=t.z,o=e.x,a=e.y,c=e.z;return Math.abs(i-o)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(s-c)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))},t.forEach=function(e,i,n,r,s,o){return t._forEach(e,i,n,r,s,o)},t.angle=function(e,i){return t._angle(e,i)},t.projectOnPlane=function(e,i,n){return t.sub(e,i,t.project(e,i,n))},t.project=function(e,i,n){var r=t.squaredMagnitude(n);return r<1e-6?t.set(e,0,0,0):t.scale(e,n,t.dot(i,n)/r)},t})();s._forEach=(function(){var t=s.create(0,0,0);return function(e,i,n,r,s,o){var a=void 0,c=void 0;for(i||(i=3),n||(n=0),c=r?Math.min(r*i+n,e.length):e.length,a=n;a1?0:r<-1?Math.PI:Math.acos(r)}})(),i.default=s,e.exports=i.default}),{"./utils":281}],284:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./utils");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;r(this,t),this.x=e,this.y=i,this.z=n,this.w=s}return t.create=function(){return new t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:1)},t.zero=function(t){return t.x=0,t.y=0,t.z=0,t.w=0,t},t.clone=function(e){return new t(e.x,e.y,e.z,e.w)},t.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},t.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},t.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},t.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},t.sub=function(e,i,n){return t.subtract(e,i,n)},t.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},t.mul=function(e,i,n){return t.multiply(e,i,n)},t.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},t.div=function(e,i,n){return t.divide(e,i,n)},t.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},t.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},t.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},t.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},t.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(e.w),t},t.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},t.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},t.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Math.sqrt(i*i+n*n+r*r+s*s)},t.dist=function(e,i){return t.distance(e,i)},t.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},t.sqrDist=function(e,i){return t.squaredDistance(e,i)},t.magnitude=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},t.mag=function(e){return t.magnitude(e)},t.squaredMagnitude=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},t.sqrMag=function(e){return t.squaredMagnitude(e)},t.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},t.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},t.inverseSafe=function(t,e){var i=e.x,r=e.y,s=e.z,o=e.w;return Math.abs(i)0&&(o=1/Math.sqrt(o),t.x=i*o,t.y=n*o,t.z=r*o,t.w=s*o),t},t.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},t.lerp=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=e.w;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t.z=o+n*(i.z-o),t.w=a+n*(i.w-a),t},t.random=function(t,e){e=e||1;var i=2*(0,n.random)()*Math.PI,r=Math.acos(2*(0,n.random)()-1);return t.x=Math.sin(r)*Math.cos(i)*e,t.y=Math.sin(r)*Math.sin(i)*e,t.z=Math.cos(r)*e,t.w=0,t},t.transformMat4=function(t,e,i){var n=i.m,r=e.x,s=e.y,o=e.z,a=e.w;return t.x=n[0]*r+n[4]*s+n[8]*o+n[12]*a,t.y=n[1]*r+n[5]*s+n[9]*o+n[13]*a,t.z=n[2]*r+n[6]*s+n[10]*o+n[14]*a,t.w=n[3]*r+n[7]*s+n[11]*o+n[15]*a,t},t.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,c=i.z,l=i.w,h=l*n+a*s-c*r,u=l*r+c*n-o*s,_=l*s+o*r-a*n,f=-o*n-a*r-c*s;return t.x=h*l+f*-o+u*-c-_*-a,t.y=u*l+f*-a+_*-o-h*-c,t.z=_*l+f*-c+h*-a-u*-o,t.w=e.w,t},t.str=function(t){return"vec4("+t.x+", "+t.y+", "+t.z+", "+t.w+")"},t.array=function(t,e){return t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w,t},t.exactEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},t.equals=function(t,e){var i=t.x,r=t.y,s=t.z,o=t.w,a=e.x,c=e.y,l=e.z,h=e.w;return Math.abs(i-a)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-c)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-h)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))},t.forEach=function(e,i,n,r,s,o){return t._forEach(e,i,n,r,s,o)},t})();s._forEach=(function(){var t=s.create(0,0,0,0);return function(e,i,n,r,s,o){var a=void 0,c=void 0;for(i||(i=4),n||(n=0),c=r?Math.min(r*i+n,e.length):e.length,a=n;ae;0<=e?++_:--_)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(h=255-this.transparency.indexed.length)>0)for(f=0;0<=h?fh;0<=h?++f:--f)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":a=(u=this.read(e)).indexOf(0),c=String.fromCharCode.apply(String,u.slice(0,a)),this.text[c]=String.fromCharCode.apply(String,u.slice(a+1));break;case"IEND":return o&&this.animation.frames.push(o),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(d=this.colorType)||6===d,i=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*i,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(Uint8Array!=Array&&(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error(r.getError(6017))}};s.prototype={constructor:s,read:function(t){var e,i;for(i=[],e=0;0<=t?et;0<=t?++e:--e)i.push(this.data[this.pos++]);return i},readUInt32:function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},readUInt16:function(){return this.data[this.pos++]<<8|this.data[this.pos++]},decodePixels:function(t){var e,i,s,o,a,c,l,h,u,_,f,d,p,m,y,v,g,x,C,A,b,S,T;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=new n.Inflate(t,{index:0,verify:!1}).decompress(),v=(d=this.pixelBitlength/8)*this.width,p=new Uint8Array(v*this.height),c=t.length,y=0,m=0,i=0;m8&&137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]?n.ImageFormat.PNG:t.length>2&&(73===t[0]&&73===t[1]||77===t[0]&&77===t[1]||255===t[0]&&216===t[1])?n.ImageFormat.TIFF:n.ImageFormat.UNKNOWN}var d=cc.Enum({GRAVITY:0,RADIUS:1}),p=cc.Enum({FREE:0,RELATIVE:1,GROUPED:2}),m={preview:{default:!0,editorOnly:!0,notify:!1,animatable:!1,tooltip:!1},_custom:!1,custom:{get:function(){return this._custom},set:function(t){this._custom!==t&&(this._custom=t,this._applyFile())},animatable:!1,tooltip:!1},_file:{default:null,type:r},file:{get:function(){return this._file},set:function(t,e){this._file!==t&&(this._file=t,t?this._applyFile():this.custom=!0)},animatable:!1,type:r,tooltip:!1},_spriteFrame:{default:null,type:cc.SpriteFrame},spriteFrame:{get:function(){return this._spriteFrame},set:function(t,e){var i=this._renderSpriteFrame;i!==t&&(this._renderSpriteFrame=t,t&&!t._uuid||(this._spriteFrame=t),(i&&i.getTexture())!==(t&&t.getTexture())&&(this._texture=null,this._applySpriteFrame(i)))},type:cc.SpriteFrame,tooltip:!1},_texture:{default:null,type:cc.Texture2D,editorOnly:!0},texture:{get:function(){return this._texture},set:function(t){t&&cc.warnID(6017)},type:cc.Texture2D,tooltip:!1,readonly:!0,visible:!1,animatable:!1},particleCount:{visible:!1,get:function(){return this._simulator.particles.length},readonly:!0},_stopped:!0,stopped:{get:function(){return this._stopped},animatable:!1,visible:!1},playOnLoad:!0,autoRemoveOnFinish:{default:!1,animatable:!1,tooltip:!1},active:{get:function(){return this._simulator.active},visible:!1},totalParticles:150,duration:-1,emissionRate:10,life:1,lifeVar:0,_startColor:null,startColor:{type:cc.Color,get:function(){return this._startColor},set:function(t){this._startColor.r=t.r,this._startColor.g=t.g,this._startColor.b=t.b,this._startColor.a=t.a}},_startColorVar:null,startColorVar:{type:cc.Color,get:function(){return this._startColorVar},set:function(t){this._startColorVar.r=t.r,this._startColorVar.g=t.g,this._startColorVar.b=t.b,this._startColorVar.a=t.a}},_endColor:null,endColor:{type:cc.Color,get:function(){return this._endColor},set:function(t){this._endColor.r=t.r,this._endColor.g=t.g,this._endColor.b=t.b,this._endColor.a=t.a}},_endColorVar:null,endColorVar:{type:cc.Color,get:function(){return this._endColorVar},set:function(t){this._endColorVar.r=t.r,this._endColorVar.g=t.g,this._endColorVar.b=t.b,this._endColorVar.a=t.a}},angle:90,angleVar:20,startSize:50,startSizeVar:0,endSize:0,endSizeVar:0,startSpin:0,startSpinVar:0,endSpin:0,endSpinVar:0,sourcePos:cc.Vec2.ZERO,posVar:cc.Vec2.ZERO,_positionType:{default:p.FREE,formerlySerializedAs:"positionType"},positionType:{type:p,get:function(){return this._positionType},set:function(t){var e=this.getMaterial(0);e&&e.define("CC_USE_MODEL",t!==p.FREE),this._positionType=t}},emitterMode:{default:d.GRAVITY,type:d},gravity:cc.Vec2.ZERO,speed:180,speedVar:50,tangentialAccel:80,tangentialAccelVar:0,radialAccel:0,radialAccelVar:0,rotationIsDir:!1,startRadius:0,startRadiusVar:0,endRadius:0,endRadiusVar:0,rotatePerS:0,rotatePerSVar:0},y=cc.Class({name:"cc.ParticleSystem",extends:s,mixins:[_],editor:!1,ctor:function(){this.initProperties()},initProperties:function(){this._previewTimer=null,this._focused=!1,this._simulator=new h(this),this._texture=null,this._startColor=cc.color(255,255,255,255),this._startColorVar=cc.color(0,0,0,0),this._endColor=cc.color(255,255,255,0),this._endColorVar=cc.color(0,0,0,0),this._renderSpriteFrame=null},properties:m,statics:{DURATION_INFINITY:-1,START_SIZE_EQUAL_TO_END_SIZE:-1,START_RADIUS_EQUAL_TO_END_RADIUS:-1,EmitterMode:d,PositionType:p,_PNGReader:a,_TIFFReader:c},onFocusInEditor:!1,onLostFocusInEditor:!1,_startPreview:!1,_stopPreview:!1,_convertTextureToSpriteFrame:!1,__preload:function(){if(this._super(),this._custom&&this.spriteFrame&&!this._renderSpriteFrame)this._applySpriteFrame(this.spriteFrame);else if(this._file){if(this._custom)!this._texture&&this._applyFile();else this._applyFile()}this.playOnLoad&&this.resetSystem()},onEnable:function(){this._super(),this._activateMaterial()},onDestroy:function(){this.autoRemoveOnFinish&&(this.autoRemoveOnFinish=!1),this._buffer&&(this._buffer.destroy(),this._buffer=null),this._simulator._uvFilled=0,this._super()},lateUpdate:function(t){this._simulator.finished||this._simulator.step(t)},addParticle:function(){},stopSystem:function(){this._stopped=!0,this._simulator.stop()},resetSystem:function(){this._stopped=!1,this._simulator.reset(),this._activateMaterial()},isFull:function(){return this.particleCount>=this.totalParticles},setTextureWithRect:function(t,e){t instanceof cc.Texture2D&&(this.spriteFrame=new cc.SpriteFrame(t,e))},_applyFile:function(){var t=this._file;if(t){var e=this;cc.loader.load(t.nativeUrl,(function(i,n){!i&&n?e.isValid&&(e._plistFile=t.nativeUrl,e._custom||e._initWithDictionary(n),e._spriteFrame?!e._renderSpriteFrame&&e._spriteFrame&&e._applySpriteFrame(e.spriteFrame):t.spriteFrame?e.spriteFrame=t.spriteFrame:e._custom&&e._initTextureWithDictionary(n)):cc.errorID(6029)}))}},_initTextureWithDictionary:function(t){var e=cc.path.changeBasename(this._plistFile,t.textureFileName||"");if(t.textureFileName)l.loadImage(e,(function(e,i){e?(t.textureFileName=void 0,this._initTextureWithDictionary(t)):this.spriteFrame=new cc.SpriteFrame(i)}),this);else if(t.textureImageData){var i=t.textureImageData;if(!(i&&i.length>0))return!1;var r=cc.loader.getRes(e);if(!r){var s=o.unzipBase64AsArray(i,1);if(!s)return cc.logID(6030),!1;var h=f(s);if(h!==n.ImageFormat.TIFF&&h!==n.ImageFormat.PNG)return cc.logID(6031),!1;var u=document.createElement("canvas");if(h===n.ImageFormat.PNG)new a(s).render(u);else c.parseTIFF(s,u);r=l.cacheImage(e,u)}r||cc.logID(6032),this.spriteFrame=new cc.SpriteFrame(r)}return!0},_initWithDictionary:function(t){this.totalParticles=parseInt(t.maxParticles||0),this.life=parseFloat(t.particleLifespan||0),this.lifeVar=parseFloat(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=parseFloat(t.duration||0),this.srcBlendFactor=parseInt(t.blendFuncSource||n.SRC_ALPHA),this.dstBlendFactor=parseInt(t.blendFuncDestination||n.ONE_MINUS_SRC_ALPHA);var i=this._startColor;i.r=255*parseFloat(t.startColorRed||0),i.g=255*parseFloat(t.startColorGreen||0),i.b=255*parseFloat(t.startColorBlue||0),i.a=255*parseFloat(t.startColorAlpha||0);var r=this._startColorVar;r.r=255*parseFloat(t.startColorVarianceRed||0),r.g=255*parseFloat(t.startColorVarianceGreen||0),r.b=255*parseFloat(t.startColorVarianceBlue||0),r.a=255*parseFloat(t.startColorVarianceAlpha||0);var s=this._endColor;s.r=255*parseFloat(t.finishColorRed||0),s.g=255*parseFloat(t.finishColorGreen||0),s.b=255*parseFloat(t.finishColorBlue||0),s.a=255*parseFloat(t.finishColorAlpha||0);var o=this._endColorVar;if(o.r=255*parseFloat(t.finishColorVarianceRed||0),o.g=255*parseFloat(t.finishColorVarianceGreen||0),o.b=255*parseFloat(t.finishColorVarianceBlue||0),o.a=255*parseFloat(t.finishColorVarianceAlpha||0),this.startSize=parseFloat(t.startParticleSize||0),this.startSizeVar=parseFloat(t.startParticleSizeVariance||0),this.endSize=parseFloat(t.finishParticleSize||0),this.endSizeVar=parseFloat(t.finishParticleSizeVariance||0),this.positionType=parseFloat(t.positionType||p.RELATIVE),this.sourcePos.x=0,this.sourcePos.y=0,this.posVar.x=parseFloat(t.sourcePositionVariancex||0),this.posVar.y=parseFloat(t.sourcePositionVariancey||0),this.angle=parseFloat(t.angle||0),this.angleVar=parseFloat(t.angleVariance||0),this.startSpin=parseFloat(t.rotationStart||0),this.startSpinVar=parseFloat(t.rotationStartVariance||0),this.endSpin=parseFloat(t.rotationEnd||0),this.endSpinVar=parseFloat(t.rotationEndVariance||0),this.emitterMode=parseInt(t.emitterType||d.GRAVITY),this.emitterMode===d.GRAVITY){this.gravity.x=parseFloat(t.gravityx||0),this.gravity.y=parseFloat(t.gravityy||0),this.speed=parseFloat(t.speed||0),this.speedVar=parseFloat(t.speedVariance||0),this.radialAccel=parseFloat(t.radialAcceleration||0),this.radialAccelVar=parseFloat(t.radialAccelVariance||0),this.tangentialAccel=parseFloat(t.tangentialAcceleration||0),this.tangentialAccelVar=parseFloat(t.tangentialAccelVariance||0);var a=t.rotationIsDir||"";null!==a?(a=a.toString().toLowerCase(),this.rotationIsDir="true"===a||"1"===a):this.rotationIsDir=!1}else{if(this.emitterMode!==d.RADIUS)return cc.warnID(6009),!1;this.startRadius=parseFloat(t.maxRadius||0),this.startRadiusVar=parseFloat(t.maxRadiusVariance||0),this.endRadius=parseFloat(t.minRadius||0),this.endRadiusVar=parseFloat(t.minRadiusVariance||0),this.rotatePerS=parseFloat(t.rotatePerSecond||0),this.rotatePerSVar=parseFloat(t.rotatePerSecondVariance||0)}return this._initTextureWithDictionary(t),!0},_onTextureLoaded:function(){this._texture=this._renderSpriteFrame.getTexture(),this._simulator.updateUVs(!0),this._activateMaterial()},_applySpriteFrame:function(t){t&&t.off&&t.off("load",this._onTextureLoaded,this);var e=this._renderSpriteFrame=this._renderSpriteFrame||this._spriteFrame;e&&(e.textureLoaded()?this._onTextureLoaded(null):(e.once("load",this._onTextureLoaded,this),e.ensureLoadTexture()))},_activateMaterial:function(){if(!this._texture||!this._texture.loaded)return this.markForUpdateRenderData(!1),this.markForRender(!1),void(this._renderSpriteFrame&&this._applySpriteFrame());var t=this.sharedMaterials[0];(t=t?u.getInstantiatedMaterial(t,this):u.getInstantiatedBuiltinMaterial("2d-sprite",this)).define("CC_USE_MODEL",this._positionType!==p.FREE),t.setProperty("texture",this._texture),this.setMaterial(0,t),this.markForRender(!0)},_finishedSimulation:function(){this.resetSystem(),this.stopSystem(),this.disableRender(),this.autoRemoveOnFinish&&this._stopped&&this.node.destroy()}});cc.ParticleSystem=e.exports=y}),{"../compression/ZipUtils":22,"../core/assets/material/CCMaterial":53,"../core/components/CCRenderComponent":80,"../core/platform/CCMacro":165,"../core/renderer/render-flow":208,"../core/utils/blend-func":244,"../core/utils/texture-util":256,"./CCPNGReader":287,"./CCParticleAsset":288,"./CCTIFFReader":290,"./particle-simulator":292,"fire-url":void 0}],290:[(function(t,e,i){"use strict";var n=t("../core/CCDebug"),r={_littleEndian:!1,_tiffData:null,_fileDirectories:[],getUint8:function(t){return this._tiffData[t]},getUint16:function(t){return this._littleEndian?this._tiffData[t+1]<<8|this._tiffData[t]:this._tiffData[t]<<8|this._tiffData[t+1]},getUint32:function(t){var e=this._tiffData;return this._littleEndian?e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]:e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},checkLittleEndian:function(){var t=this.getUint16(0);if(18761===t)this.littleEndian=!0;else{if(19789!==t)throw console.log(t),TypeError(n.getError(6019));this.littleEndian=!1}return this.littleEndian},hasTowel:function(){if(42!==this.getUint16(2))throw RangeError(n.getError(6020));return!0},getFieldTypeName:function(t){var e=this.fieldTypeNames;return t in e?e[t]:null},getFieldTagName:function(t){var e=this.fieldTagNames;return t in e?e[t]:(cc.logID(6021,t),"Tag"+t)},getFieldTypeLength:function(t){return-1!==["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(t)?1:-1!==["SHORT","SSHORT"].indexOf(t)?2:-1!==["LONG","SLONG","FLOAT"].indexOf(t)?4:-1!==["RATIONAL","SRATIONAL","DOUBLE"].indexOf(t)?8:null},getFieldValues:function(t,e,i,n){var r=[],s=this.getFieldTypeLength(e);if(s*i<=4)!1===this.littleEndian?r.push(n>>>8*(4-s)):r.push(n);else for(var o=0;o=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+a)),r.push(this.getUint32(n+a+4))):cc.logID(8e3):r.push(this.getBytes(s,n+a))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},getBytes:function(t,e){if(t<=0)cc.logID(8001);else{if(t<=1)return this.getUint8(e);if(t<=2)return this.getUint16(e);if(t<=3)return this.getUint32(e)>>>8;if(t<=4)return this.getUint32(e);cc.logID(8002)}},getBits:function(t,e,i){i=i||0;var n,r,s=e+Math.floor(i/8),o=i+t,a=32-t;return o<=0?cc.logID(6023):o<=8?(n=24+i,r=this.getUint8(s)):o<=16?(n=16+i,r=this.getUint16(s)):o<=32?(n=i,r=this.getUint32(s)):cc.logID(6022),{bits:r<>>a,byteOffset:s+Math.floor(o/8),bitOffset:o%8}},parseFileDirectory:function(t){for(var e=this.getUint16(t),i=[],n=t+2,r=0;r=0&&D<=127?R=D+1:D>=-127&&D<=-1?P=1-D:b=!0}else{var L=this.getUint8(v+x);for(B=0;B0)for(var nt=0;ntg;)this.emitParticle(c),this.emitCounter-=g;this.elapsed+=t,-1!==e.duration&&e.durationthis._uvFilled&&this.updateUVs();for(var A=0;A0){if(e.emitterMode===cc.ParticleSystem.EmitterMode.GRAVITY){var S=u,T=l,w=h;(b.pos.x||b.pos.y)&&(T.set(b.pos),T.normalizeSelf()),w.set(T),T.mulSelf(b.radialAccel);var E=w.x;w.x=-w.y,w.y=E,w.mulSelf(b.tangentialAccel),S.set(T),S.addSelf(w),S.addSelf(e.gravity),S.mulSelf(t),b.dir.addSelf(S),S.set(b.dir),S.mulSelf(t),b.pos.addSelf(S)}else b.angle+=b.degreesPerSecond*t,b.radius+=b.deltaRadius*t,b.pos.x=-Math.cos(b.angle)*b.radius,b.pos.y=-Math.sin(b.angle)*b.radius;b.color.r+=b.deltaColor.r*t,b.color.g+=b.deltaColor.g*t,b.color.b+=b.deltaColor.b*t,b.color.a+=b.deltaColor.a*t,b.size+=b.deltaSize*t,b.size<0&&(b.size=0),b.rotation+=b.deltaRotation*t;var B=l,M=h;if(e.positionType===cc.ParticleSystem.PositionType.FREE)M.set(b.startPos),M.negSelf(),B.set(b.pos),B.subSelf(M);else if(e.positionType===cc.ParticleSystem.PositionType.RELATIVE){var I=u;n.transformVec2(M,c,v),n.transformVec2(I,b.startPos,v),M.subSelf(I),B.set(b.pos),B.subSelf(M)}else B.set(b.pos);var R=_*A;this.updateParticleBuffer(b,B,x,R),++A}else{var P=r[A];A!==r.length-1&&(r[A]=r[r.length-1]),f.put(P),r.length--}}r.length>0?(x.uploadData(),e._assembler._ia._count=6*r.length):this.active||(this.finished=!0,e._finishedSimulation())},e.exports=d}),{"../core/platform/js":180,"../core/utils/affine-transform":241,"../core/utils/misc":249}],293:[(function(t,e,i){"use strict";var n=s(t("../core/renderer/assembler")),r=s(t("../renderer/core/input-assembler"));function s(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=t("./CCParticleSystem"),h=t("../core/renderer/"),u=t("../core/renderer/webgl/quad-buffer"),_=t("../core/renderer/webgl/vertex-format").vfmtPosUvColor,f=(function(t){function e(i){o(this,e);var n=a(this,t.call(this,i));return n._buffer=null,n._ia=null,n._vfmt=_,n}return c(e,t),e.prototype.getBuffer=function(){return this._buffer||(this._buffer=new u(h._handle,_),this._ia=new r.default,this._ia._vertexBuffer=this._buffer._vb,this._ia._indexBuffer=this._buffer._ib,this._ia._start=0,this._ia._count=0),this._buffer},e.prototype.fillBuffers=function(t,e){this._ia&&(e.node=t.node,e.material=t.sharedMaterials[0],e._flushIA(this._ia))},e})(n.default);n.default.register(l,f),e.exports=f}),{"../core/renderer/":207,"../core/renderer/assembler":187,"../core/renderer/webgl/quad-buffer":236,"../core/renderer/webgl/vertex-format":239,"../renderer/core/input-assembler":298,"./CCParticleSystem":289}],294:[(function(t,e,i){"use strict";var n,r,s,o=512,a=513,c=514,l=515,h=516,u=517,_=518,f=519,d=32774,p=32778,m=32779,y=0,v=1,g=768,x=769,C=774,A=775,b=770,S=771,T=772,w=773,E=32769,B=32770,M=32771,I=32772,R=776,P=7680,D=7681,L=7682,O=34055,V=7683,F=34056,N=5386,G=0,k=1028,z=1029;(function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL"})(n||(n={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.BUFFER=1]="BUFFER",t[t.TEXTURE=2]="TEXTURE",t[t.TEXTURE_VIEW=3]="TEXTURE_VIEW",t[t.RENDER_PASS=4]="RENDER_PASS",t[t.FRAMEBUFFER=5]="FRAMEBUFFER",t[t.SAMPLER=6]="SAMPLER",t[t.SHADER=7]="SHADER",t[t.PIPELINE_LAYOUT=8]="PIPELINE_LAYOUT",t[t.PIPELINE_STATE=9]="PIPELINE_STATE",t[t.BINDING_LAYOUT=10]="BINDING_LAYOUT",t[t.INPUT_ASSEMBLER=11]="INPUT_ASSEMBLER",t[t.COMMAND_ALLOCATOR=12]="COMMAND_ALLOCATOR",t[t.COMMAND_BUFFER=13]="COMMAND_BUFFER",t[t.QUEUE=14]="QUEUE",t[t.WINDOW=15]="WINDOW"})(r||(r={})),(function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"})(s||(s={}));var U,W,j,H,q,X,Y,J,Z,K,Q,$,tt,et,it,nt,rt,st,ot,at,ct,lt,ht,ut,_t,ft,dt,pt,mt,yt,vt,gt,xt,Ct,At;(function(){function t(t){this._gfxType=r.UNKNOWN,this._status=s.UNREADY,this._gfxType=t}Object.defineProperty(t.prototype,"gfxType",{get:function(){return this._gfxType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!0,configurable:!0})})();(function(t){t.ATTR_POSITION="a_position",t.ATTR_NORMAL="a_normal",t.ATTR_TANGENT="a_tangent",t.ATTR_BITANGENT="a_bitangent",t.ATTR_WEIGHTS="a_weights",t.ATTR_JOINTS="a_joints",t.ATTR_COLOR="a_color",t.ATTR_COLOR1="a_color1",t.ATTR_COLOR2="a_color2",t.ATTR_TEX_COORD="a_texCoord",t.ATTR_TEX_COORD1="a_texCoord1",t.ATTR_TEX_COORD2="a_texCoord2",t.ATTR_TEX_COORD3="a_texCoord3",t.ATTR_TEX_COORD4="a_texCoord4",t.ATTR_TEX_COORD5="a_texCoord5",t.ATTR_TEX_COORD6="a_texCoord6",t.ATTR_TEX_COORD7="a_texCoord7",t.ATTR_TEX_COORD8="a_texCoord8"})(U||(U={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.BOOL=1]="BOOL",t[t.BOOL2=2]="BOOL2",t[t.BOOL3=3]="BOOL3",t[t.BOOL4=4]="BOOL4",t[t.INT=5]="INT",t[t.INT2=6]="INT2",t[t.INT3=7]="INT3",t[t.INT4=8]="INT4",t[t.UINT=9]="UINT",t[t.UINT2=10]="UINT2",t[t.UINT3=11]="UINT3",t[t.UINT4=12]="UINT4",t[t.FLOAT=13]="FLOAT",t[t.FLOAT2=14]="FLOAT2",t[t.FLOAT3=15]="FLOAT3",t[t.FLOAT4=16]="FLOAT4",t[t.COLOR4=17]="COLOR4",t[t.MAT2=18]="MAT2",t[t.MAT2X3=19]="MAT2X3",t[t.MAT2X4=20]="MAT2X4",t[t.MAT3X2=21]="MAT3X2",t[t.MAT3=22]="MAT3",t[t.MAT3X4=23]="MAT3X4",t[t.MAT4X2=24]="MAT4X2",t[t.MAT4X3=25]="MAT4X3",t[t.MAT4=26]="MAT4",t[t.SAMPLER1D=27]="SAMPLER1D",t[t.SAMPLER1D_ARRAY=28]="SAMPLER1D_ARRAY",t[t.SAMPLER2D=29]="SAMPLER2D",t[t.SAMPLER2D_ARRAY=30]="SAMPLER2D_ARRAY",t[t.SAMPLER3D=31]="SAMPLER3D",t[t.SAMPLER_CUBE=32]="SAMPLER_CUBE",t[t.COUNT=33]="COUNT"})(W||(W={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A8=1]="A8",t[t.L8=2]="L8",t[t.LA8=3]="LA8",t[t.R8=4]="R8",t[t.R8SN=5]="R8SN",t[t.R8UI=6]="R8UI",t[t.R8I=7]="R8I",t[t.R16F=8]="R16F",t[t.R16UI=9]="R16UI",t[t.R16I=10]="R16I",t[t.R32F=11]="R32F",t[t.R32UI=12]="R32UI",t[t.R32I=13]="R32I",t[t.RG8=14]="RG8",t[t.RG8SN=15]="RG8SN",t[t.RG8UI=16]="RG8UI",t[t.RG8I=17]="RG8I",t[t.RG16F=18]="RG16F",t[t.RG16UI=19]="RG16UI",t[t.RG16I=20]="RG16I",t[t.RG32F=21]="RG32F",t[t.RG32UI=22]="RG32UI",t[t.RG32I=23]="RG32I",t[t.RGB8=24]="RGB8",t[t.SRGB8=25]="SRGB8",t[t.RGB8SN=26]="RGB8SN",t[t.RGB8UI=27]="RGB8UI",t[t.RGB8I=28]="RGB8I",t[t.RGB16F=29]="RGB16F",t[t.RGB16UI=30]="RGB16UI",t[t.RGB16I=31]="RGB16I",t[t.RGB32F=32]="RGB32F",t[t.RGB32UI=33]="RGB32UI",t[t.RGB32I=34]="RGB32I",t[t.RGBA8=35]="RGBA8",t[t.SRGB8_A8=36]="SRGB8_A8",t[t.RGBA8SN=37]="RGBA8SN",t[t.RGBA8UI=38]="RGBA8UI",t[t.RGBA8I=39]="RGBA8I",t[t.RGBA16F=40]="RGBA16F",t[t.RGBA16UI=41]="RGBA16UI",t[t.RGBA16I=42]="RGBA16I",t[t.RGBA32F=43]="RGBA32F",t[t.RGBA32UI=44]="RGBA32UI",t[t.RGBA32I=45]="RGBA32I",t[t.R5G6B5=46]="R5G6B5",t[t.R11G11B10F=47]="R11G11B10F",t[t.RGB5A1=48]="RGB5A1",t[t.RGBA4=49]="RGBA4",t[t.RGB10A2=50]="RGB10A2",t[t.RGB10A2UI=51]="RGB10A2UI",t[t.RGB9E5=52]="RGB9E5",t[t.D16=53]="D16",t[t.D16S8=54]="D16S8",t[t.D24=55]="D24",t[t.D24S8=56]="D24S8",t[t.D32F=57]="D32F",t[t.D32F_S8=58]="D32F_S8",t[t.BC1=59]="BC1",t[t.BC1_ALPHA=60]="BC1_ALPHA",t[t.BC1_SRGB=61]="BC1_SRGB",t[t.BC1_SRGB_ALPHA=62]="BC1_SRGB_ALPHA",t[t.BC2=63]="BC2",t[t.BC2_SRGB=64]="BC2_SRGB",t[t.BC3=65]="BC3",t[t.BC3_SRGB=66]="BC3_SRGB",t[t.BC4=67]="BC4",t[t.BC4_SNORM=68]="BC4_SNORM",t[t.BC5=69]="BC5",t[t.BC5_SNORM=70]="BC5_SNORM",t[t.BC6H_UF16=71]="BC6H_UF16",t[t.BC6H_SF16=72]="BC6H_SF16",t[t.BC7=73]="BC7",t[t.BC7_SRGB=74]="BC7_SRGB",t[t.ETC_RGB8=75]="ETC_RGB8",t[t.ETC2_RGB8=76]="ETC2_RGB8",t[t.ETC2_SRGB8=77]="ETC2_SRGB8",t[t.ETC2_RGB8_A1=78]="ETC2_RGB8_A1",t[t.ETC2_SRGB8_A1=79]="ETC2_SRGB8_A1",t[t.ETC2_RGBA8=80]="ETC2_RGBA8",t[t.ETC2_SRGB8_A8=81]="ETC2_SRGB8_A8",t[t.EAC_R11=82]="EAC_R11",t[t.EAC_R11SN=83]="EAC_R11SN",t[t.EAC_RG11=84]="EAC_RG11",t[t.EAC_RG11SN=85]="EAC_RG11SN",t[t.PVRTC_RGB2=86]="PVRTC_RGB2",t[t.PVRTC_RGBA2=87]="PVRTC_RGBA2",t[t.PVRTC_RGB4=88]="PVRTC_RGB4",t[t.PVRTC_RGBA4=89]="PVRTC_RGBA4",t[t.PVRTC2_2BPP=90]="PVRTC2_2BPP",t[t.PVRTC2_4BPP=91]="PVRTC2_4BPP"})(j||(j={})),(function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.INDEX=4]="INDEX",t[t.VERTEX=8]="VERTEX",t[t.UNIFORM=16]="UNIFORM",t[t.STORAGE=32]="STORAGE",t[t.INDIRECT=64]="INDIRECT"})(H||(H={})),(function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"})(q||(q={})),(function(t){t[t.NONE=0]="NONE",t[t.READ=1]="READ",t[t.WRITE=2]="WRITE"})(X||(X={})),(function(t){t[t.POINT_LIST=0]="POINT_LIST",t[t.LINE_LIST=1]="LINE_LIST",t[t.LINE_STRIP=2]="LINE_STRIP",t[t.LINE_LOOP=3]="LINE_LOOP",t[t.LINE_LIST_ADJACENCY=4]="LINE_LIST_ADJACENCY",t[t.LINE_STRIP_ADJACENCY=5]="LINE_STRIP_ADJACENCY",t[t.ISO_LINE_LIST=6]="ISO_LINE_LIST",t[t.TRIANGLE_LIST=7]="TRIANGLE_LIST",t[t.TRIANGLE_STRIP=8]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=9]="TRIANGLE_FAN",t[t.TRIANGLE_LIST_ADJACENCY=10]="TRIANGLE_LIST_ADJACENCY",t[t.TRIANGLE_STRIP_ADJACENCY=11]="TRIANGLE_STRIP_ADJACENCY",t[t.TRIANGLE_PATCH_ADJACENCY=12]="TRIANGLE_PATCH_ADJACENCY",t[t.QUAD_PATCH_LIST=13]="QUAD_PATCH_LIST"})(Y||(Y={})),(function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"})(J||(J={})),(function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"})(Z||(Z={})),(function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"})(K||(K={})),(function(t){t[t.NEVER=0]="NEVER",t[t.LESS=1]="LESS",t[t.EQUAL=2]="EQUAL",t[t.LESS_EQUAL=3]="LESS_EQUAL",t[t.GREATER=4]="GREATER",t[t.NOT_EQUAL=5]="NOT_EQUAL",t[t.GREATER_EQUAL=6]="GREATER_EQUAL",t[t.ALWAYS=7]="ALWAYS"})(Q||(Q={})),(function(t){t[t.ZERO=0]="ZERO",t[t.KEEP=1]="KEEP",t[t.REPLACE=2]="REPLACE",t[t.INCR=3]="INCR",t[t.DECR=4]="DECR",t[t.INVERT=5]="INVERT",t[t.INCR_WRAP=6]="INCR_WRAP",t[t.DECR_WRAP=7]="DECR_WRAP"})($||($={})),(function(t){t[t.ADD=0]="ADD",t[t.SUB=1]="SUB",t[t.REV_SUB=2]="REV_SUB",t[t.MIN=3]="MIN",t[t.MAX=4]="MAX"})(tt||(tt={})),(function(t){t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=2]="SRC_ALPHA",t[t.DST_ALPHA=3]="DST_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=4]="ONE_MINUS_SRC_ALPHA",t[t.ONE_MINUS_DST_ALPHA=5]="ONE_MINUS_DST_ALPHA",t[t.SRC_COLOR=6]="SRC_COLOR",t[t.DST_COLOR=7]="DST_COLOR",t[t.ONE_MINUS_SRC_COLOR=8]="ONE_MINUS_SRC_COLOR",t[t.ONE_MINUS_DST_COLOR=9]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=10]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=11]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=12]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=13]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=14]="ONE_MINUS_CONSTANT_ALPHA"})(et||(et={})),(function(t){t[t.NONE=0]="NONE",t[t.R=1]="R",t[t.G=2]="G",t[t.B=4]="B",t[t.A=8]="A",t[t.ALL=15]="ALL"})(it||(it={})),(function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"})(nt||(nt={})),(function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"})(rt||(rt={})),(function(t){t[t.TEX1D=0]="TEX1D",t[t.TEX2D=1]="TEX2D",t[t.TEX3D=2]="TEX3D"})(st||(st={})),(function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.TRANSIENT_ATTACHMENT=64]="TRANSIENT_ATTACHMENT",t[t.INPUT_ATTACHMENT=128]="INPUT_ATTACHMENT"})(ot||(ot={})),(function(t){t[t.X1=0]="X1",t[t.X2=1]="X2",t[t.X4=2]="X4",t[t.X8=3]="X8",t[t.X16=4]="X16",t[t.X32=5]="X32",t[t.X64=6]="X64"})(at||(at={})),(function(t){t[t.NONE=0]="NONE",t[t.GEN_MIPMAP=1]="GEN_MIPMAP",t[t.CUBEMAP=2]="CUBEMAP",t[t.BAKUP_BUFFER=4]="BAKUP_BUFFER"})(ct||(ct={})),(function(t){t[t.TV1D=0]="TV1D",t[t.TV2D=1]="TV2D",t[t.TV3D=2]="TV3D",t[t.CUBE=3]="CUBE",t[t.TV1D_ARRAY=4]="TV1D_ARRAY",t[t.TV2D_ARRAY=5]="TV2D_ARRAY"})(lt||(lt={})),(function(t){t[t.VERTEX=0]="VERTEX",t[t.HULL=1]="HULL",t[t.DOMAIN=2]="DOMAIN",t[t.GEOMETRY=3]="GEOMETRY",t[t.FRAGMENT=4]="FRAGMENT",t[t.COMPUTE=5]="COMPUTE",t[t.COUNT=6]="COUNT"})(ht||(ht={})),(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.UNIFORM_BUFFER=1]="UNIFORM_BUFFER",t[t.SAMPLER=2]="SAMPLER",t[t.STORAGE_BUFFER=3]="STORAGE_BUFFER"})(ut||(ut={})),(function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"})(_t||(_t={})),(function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"})(ft||(ft={})),(function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"})(dt||(dt={})),(function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.GENERAL=1]="GENERAL",t[t.COLOR_ATTACHMENT_OPTIMAL=2]="COLOR_ATTACHMENT_OPTIMAL",t[t.DEPTH_STENCIL_ATTACHMENT_OPTIMAL=3]="DEPTH_STENCIL_ATTACHMENT_OPTIMAL",t[t.DEPTH_STENCIL_READONLY_OPTIMAL=4]="DEPTH_STENCIL_READONLY_OPTIMAL",t[t.SHADER_READONLY_OPTIMAL=5]="SHADER_READONLY_OPTIMAL",t[t.TRANSFER_SRC_OPTIMAL=6]="TRANSFER_SRC_OPTIMAL",t[t.TRANSFER_DST_OPTIMAL=7]="TRANSFER_DST_OPTIMAL",t[t.PREINITIALIZED=8]="PREINITIALIZED",t[t.PRESENT_SRC=9]="PRESENT_SRC"})(pt||(pt={})),(function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"})(mt||(mt={})),(function(t){t[t.VIEWPORT=0]="VIEWPORT",t[t.SCISSOR=1]="SCISSOR",t[t.LINE_WIDTH=2]="LINE_WIDTH",t[t.DEPTH_BIAS=3]="DEPTH_BIAS",t[t.BLEND_CONSTANTS=4]="BLEND_CONSTANTS",t[t.DEPTH_BOUNDS=5]="DEPTH_BOUNDS",t[t.STENCIL_WRITE_MASK=6]="STENCIL_WRITE_MASK",t[t.STENCIL_COMPARE_MASK=7]="STENCIL_COMPARE_MASK"})(yt||(yt={})),(function(t){t[t.FRONT=0]="FRONT",t[t.BACK=1]="BACK",t[t.ALL=2]="ALL"})(vt||(vt={})),(function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"})(gt||(gt={})),(function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL",t[t.DEPTH_STENCIL=6]="DEPTH_STENCIL",t[t.ALL=7]="ALL"})(xt||(xt={})),(function(t){t[t.DEFAULT=100]="DEFAULT"})(Ct||(Ct={})),(function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"})(At||(At={}));var bt,St,Tt,wt;(function(t){t[t.UBO_GLOBAL=23]="UBO_GLOBAL",t[t.UBO_SHADOW=22]="UBO_SHADOW",t[t.UBO_LOCAL=21]="UBO_LOCAL",t[t.UBO_FORWARD_LIGHTS=20]="UBO_FORWARD_LIGHTS",t[t.UBO_SKINNING=19]="UBO_SKINNING",t[t.UBO_SKINNING_TEXTURE=18]="UBO_SKINNING_TEXTURE",t[t.UBO_UI=17]="UBO_UI",t[t.SAMPLER_JOINTS=25]="SAMPLER_JOINTS",t[t.SAMPLER_ENVIRONMENT=26]="SAMPLER_ENVIRONMENT",t[t.CUSTUM_UBO_BINDING_END_POINT=17]="CUSTUM_UBO_BINDING_END_POINT",t[t.CUSTOM_SAMPLER_BINDING_START_POINT=30]="CUSTOM_SAMPLER_BINDING_START_POINT"})(bt||(bt={})),(function(t){t[t.minFilter=0]="minFilter",t[t.magFilter=1]="magFilter",t[t.mipFilter=2]="mipFilter",t[t.addressU=3]="addressU",t[t.addressV=4]="addressV",t[t.addressW=5]="addressW",t[t.maxAnisotropy=6]="maxAnisotropy",t[t.cmpFunc=7]="cmpFunc",t[t.minLOD=8]="minLOD",t[t.maxLOD=9]="maxLOD",t[t.mipLODBias=10]="mipLODBias",t[t.borderColor=11]="borderColor",t[t.total=15]="total"})(wt||(wt={}));var Et={};Et[Et.bool=W.BOOL]="bool",Et[Et.int=W.INT]="int",Et[Et.ivec2=W.INT2]="ivec2invTypeParams",Et[Et.ivec3=W.INT3]="ivec3",Et[Et.ivec4=W.INT4]="ivec4",Et[Et.float=W.FLOAT]="float",Et[Et.vec2=W.FLOAT2]="vec2",Et[Et.vec3=W.FLOAT3]="vec3",Et[Et.vec4=W.FLOAT4]="vec4",Et[Et.mat2=W.MAT2]="mat2",Et[Et.mat3=W.MAT3]="mat3",Et[Et.mat4=W.MAT4]="mat4",Et[Et.sampler2D=W.SAMPLER2D]="sampler2D",Et[Et.samplerCube=W.SAMPLER_CUBE]="samplerCube";var Bt=((St={})[W.BOOL]=4,St[W.INT]=4,St[W.INT2]=8,St[W.INT3]=12,St[W.INT4]=16,St[W.FLOAT]=4,St[W.FLOAT2]=8,St[W.FLOAT3]=12,St[W.FLOAT4]=16,St[W.MAT2]=16,St[W.MAT3]=36,St[W.MAT4]=64,St[W.SAMPLER2D]=4,St[W.SAMPLER_CUBE]=4,St),Mt=((Tt={})[W.BOOL]=j.R32I,Tt[W.INT]=j.R32I,Tt[W.INT2]=j.RG32I,Tt[W.INT3]=j.RGB32I,Tt[W.INT4]=j.RGBA32I,Tt[W.FLOAT]=j.R32F,Tt[W.FLOAT2]=j.RG32F,Tt[W.FLOAT3]=j.RGB32F,Tt[W.FLOAT4]=j.RGBA32F,Tt),It={BACK:z,FRONT:k,NONE:G,ADD:d,SUB:p,REV_SUB:m,ZERO:y,ONE:v,SRC_COLOR:g,ONE_MINUS_SRC_COLOR:x,DST_COLOR:C,ONE_MINUS_DST_COLOR:A,SRC_ALPHA:b,ONE_MINUS_SRC_ALPHA:S,DST_ALPHA:T,ONE_MINUS_DST_ALPHA:w,CONSTANT_COLOR:E,ONE_MINUS_CONSTANT_COLOR:B,CONSTANT_ALPHA:M,ONE_MINUS_CONSTANT_ALPHA:I,SRC_ALPHA_SATURATE:R,NEVER:o,LESS:a,EQUAL:c,LEQUAL:l,GREATER:h,NOTEQUAL:u,GEQUAL:_,ALWAYS:f,KEEP:P,REPLACE:D,INCR:L,INCR_WRAP:O,DECR:V,DECR_WRAP:F,INVERT:N};Object.assign(It,Ct);var Rt={murmurhash2_32_gc:function(t,e){for(var i,n=t.length,r=e^n,s=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:r^=(255&t.charCodeAt(s+2))<<16;case 2:r^=(255&t.charCodeAt(s+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(s)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0},SamplerInfoIndex:wt,effectStructure:{$techniques:[{$passes:[{depthStencilState:{},rasterizerState:{},blendState:{targets:[{}]},properties:{any:{sampler:{},inspector:{}}}}]}]},typeMap:Et,sizeMap:Bt,formatMap:Mt,passParams:It,RenderQueue:{OPAQUE:0,TRANSPARENT:1,OVERLAY:2},RenderPriority:At,GFXGetTypeSize:function(t){switch(t){case W.BOOL:case W.INT:case W.UINT:case W.FLOAT:return 4;case W.BOOL2:case W.INT2:case W.UINT2:case W.FLOAT2:return 8;case W.BOOL3:case W.INT3:case W.UINT3:case W.FLOAT3:return 12;case W.BOOL4:case W.INT4:case W.UINT4:case W.FLOAT4:case W.MAT2:return 16;case W.MAT2X3:return 24;case W.MAT2X4:return 32;case W.MAT3X2:return 24;case W.MAT3:return 36;case W.MAT3X4:return 48;case W.MAT4X2:case W.MAT4X2:return 32;case W.MAT4:return 64;case W.SAMPLER1D:case W.SAMPLER1D_ARRAY:case W.SAMPLER2D:case W.SAMPLER2D_ARRAY:case W.SAMPLER3D:case W.SAMPLER_CUBE:return 4;default:return 0}},UniformBinding:bt};e.exports=Rt}),{}],295:[(function(t,e,i){"use strict";i.__esModule=!0;var n=0,r={};i.default={addStage:function(t){if(void 0===r[t]){var e=1<=t._caps.maxTextureUnits&&console.warn("Trying to use "+e+" texture units while this GPU supports only "+t._caps.maxTextureUnits),this._usedTextureUnits+=1,e},t.prototype._registerStage=function(t,e){this._stage2fn[t]=e},t.prototype.clear=function(){this._programLib.clear(),this.reset()},t.prototype.reset=function(){this._viewPools.reset(),this._stageItemsPools.reset()},t.prototype._requestView=function(){return this._viewPools.add()},t.prototype._render=function(t,e){var i=this._device;i.setFrameBuffer(t._framebuffer),i.setViewport(t._rect.x,t._rect.y,t._rect.w,t._rect.h);var n={};t._clearFlags&o.default.CLEAR_COLOR&&(n.color=[t._color.r,t._color.g,t._color.b,t._color.a]),t._clearFlags&o.default.CLEAR_DEPTH&&(n.depth=t._depth),t._clearFlags&o.default.CLEAR_STENCIL&&(n.stencil=t._stencil),i.clear(n),this._drawItemsPools.reset();for(var r=0;rt.count)return void console.error("Failed to set property ["+t.name+"] : The length of texture array ["+i.length+"] is bigger than ["+t.count+"].");for(var n=S.add(),r=0;r2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];l(this,t),this._name=e,this._techniques=i,this._properties=n,this._defines=r,this._dependencies=s}return t.prototype.clear=function(){this._techniques.length=0,this._properties={},this._defines={}},t.prototype.setCullMode=function(t){for(var e=this._techniques[0].passes,i=0;i0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(t,this._properties),t},t.prototype.extractDefines=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(t,this._defines),t},t.prototype.extractDependencies=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=0;e2&&void 0!==arguments[2]?arguments[2]:r.default.PT_TRIANGLES;s(this,t),this._vertexBuffer=e,this._indexBuffer=i,this._primitiveType=n,this._start=0,this._count=-1}return n(t,[{key:"count",get:function(){return-1!==this._count?this._count:this._indexBuffer?this._indexBuffer.count:this._vertexBuffer.count}}]),t})();i.default=o,e.exports=i.default}),{"../gfx":308}],299:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../gfx"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=(function(){function t(e){r(this,t),this._programName=e,this._cullMode=n.default.CULL_BACK,this._blend=!1,this._blendEq=n.default.BLEND_FUNC_ADD,this._blendAlphaEq=n.default.BLEND_FUNC_ADD,this._blendSrc=n.default.BLEND_SRC_ALPHA,this._blendDst=n.default.BLEND_ONE_MINUS_SRC_ALPHA,this._blendSrcAlpha=n.default.BLEND_SRC_ALPHA,this._blendDstAlpha=n.default.BLEND_ONE_MINUS_SRC_ALPHA,this._blendColor=4294967295,this._depthTest=!1,this._depthWrite=!1,this._depthFunc=n.default.DS_FUNC_LESS,this._stencilTest=n.default.STENCIL_INHERIT,this._stencilFuncFront=n.default.DS_FUNC_ALWAYS,this._stencilRefFront=0,this._stencilMaskFront=255,this._stencilFailOpFront=n.default.STENCIL_OP_KEEP,this._stencilZFailOpFront=n.default.STENCIL_OP_KEEP,this._stencilZPassOpFront=n.default.STENCIL_OP_KEEP,this._stencilWriteMaskFront=255,this._stencilFuncBack=n.default.DS_FUNC_ALWAYS,this._stencilRefBack=0,this._stencilMaskBack=255,this._stencilFailOpBack=n.default.STENCIL_OP_KEEP,this._stencilZFailOpBack=n.default.STENCIL_OP_KEEP,this._stencilZPassOpBack=n.default.STENCIL_OP_KEEP,this._stencilWriteMaskBack=255}return t.prototype.setCullMode=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.default.CULL_BACK;this._cullMode=t},t.prototype.setBlend=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.default.BLEND_FUNC_ADD,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.default.BLEND_SRC_ALPHA,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.default.BLEND_ONE_MINUS_SRC_ALPHA,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.default.BLEND_FUNC_ADD,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:n.default.BLEND_SRC_ALPHA,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:n.default.BLEND_ONE_MINUS_SRC_ALPHA,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:4294967295;this._blend=t,this._blendEq=e,this._blendSrc=i,this._blendDst=r,this._blendAlphaEq=s,this._blendSrcAlpha=o,this._blendDstAlpha=a,this._blendColor=c},t.prototype.setDepth=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.default.DS_FUNC_LESS;this._depthTest=t,this._depthWrite=e,this._depthFunc=i},t.prototype.setStencilFront=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.default.STENCIL_INHERIT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.default.DS_FUNC_ALWAYS,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:255,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.default.STENCIL_OP_KEEP,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:n.default.STENCIL_OP_KEEP,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:n.default.STENCIL_OP_KEEP,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:255;this._stencilTest=t,this._stencilFuncFront=e,this._stencilRefFront=i,this._stencilMaskFront=r,this._stencilFailOpFront=s,this._stencilZFailOpFront=o,this._stencilZPassOpFront=a,this._stencilWriteMaskFront=c},t.prototype.setStencilEnabled=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.default.STENCIL_INHERIT;this._stencilTest=t},t.prototype.setStencilBack=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.default.STENCIL_INHERIT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.default.DS_FUNC_ALWAYS,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:255,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.default.STENCIL_OP_KEEP,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:n.default.STENCIL_OP_KEEP,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:n.default.STENCIL_OP_KEEP,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:255;this._stencilTest=t,this._stencilFuncBack=e,this._stencilRefBack=i,this._stencilMaskBack=r,this._stencilFailOpBack=s,this._stencilZFailOpBack=o,this._stencilZPassOpBack=a,this._stencilWriteMaskBack=c},t.prototype.clone=function(){var e=new t(this._programName);return Object.assign(e,this),e},t})();i.default=s,e.exports=i.default}),{"../gfx":308}],300:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("../gfx"));function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=0;function o(t){for(var e=[],i={},n=t.length-1;n>=0;n--){var r=t[n];for(var s in r){var o=r[s];void 0!==o&&(void 0===i[s]&&("number"!=typeof o&&(o=o?1:0),i[s]=o,e.push("#define "+s+" "+o)))}}return e.join("\n")+"\n"}function a(t,e){for(var i={},n=t,r=e.length-1;r>=0;r--){var s=e[r];for(var o in s){var a=s[o];void 0!==a&&(void 0===i[o]&&Number.isInteger(a)&&(i[o]=a))}}for(var c in i){var l=new RegExp(c,"g");n=n.replace(l,i[c])}return n}function c(t){return t.replace(/#pragma for (\w+) in range\(\s*(\d+)\s*,\s*(\d+)\s*\)([\s\S]+?)#pragma endFor/g,(function(t,e,i,n,r){var s="",o=parseInt(i),a=parseInt(n);(o.isNaN||a.isNaN)&&console.error("Unroll For Loops Error: begin and end of range must be an int num.");for(var c=o;c=0;n--)if(void 0!==(i=e[n][t]))return i},t})();i.default=l,e.exports=i.default}),{"../gfx":308}],301:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(){function t(t,e){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0;s(this,t),this._id=o++,this._stages=e,this._stageIDs=r.default.stageIDs(e),this._passes=i,this._layer=n}return t.prototype.setStages=function(t){this._stageIDs=r.default.stageIDs(t)},t.prototype.clone=function(){for(var e=[],i=0;i>24)/255,(i.blendColor>>16&255)/255,(i.blendColor>>8&255)/255,(255&i.blendColor)/255),void(i.blendSep?(t.blendFuncSeparate(i.blendSrc,i.blendDst,i.blendSrcAlpha,i.blendDstAlpha),t.blendEquationSeparate(i.blendEq,i.blendAlphaEq)):(t.blendFunc(i.blendSrc,i.blendDst),t.blendEquation(i.blendEq)))):void t.disable(t.BLEND);!1!==i.blend&&(e.blendColor!==i.blendColor&&t.blendColor((i.blendColor>>24)/255,(i.blendColor>>16&255)/255,(i.blendColor>>8&255)/255,(255&i.blendColor)/255),e.blendSep===i.blendSep?i.blendSep?(e.blendSrc===i.blendSrc&&e.blendDst===i.blendDst&&e.blendSrcAlpha===i.blendSrcAlpha&&e.blendDstAlpha===i.blendDstAlpha||t.blendFuncSeparate(i.blendSrc,i.blendDst,i.blendSrcAlpha,i.blendDstAlpha),e.blendEq===i.blendEq&&e.blendAlphaEq===i.blendAlphaEq||t.blendEquationSeparate(i.blendEq,i.blendAlphaEq)):(e.blendSrc===i.blendSrc&&e.blendDst===i.blendDst||t.blendFunc(i.blendSrc,i.blendDst),e.blendEq!==i.blendEq&&t.blendEquation(i.blendEq)):i.blendSep?(t.blendFuncSeparate(i.blendSrc,i.blendDst,i.blendSrcAlpha,i.blendDstAlpha),t.blendEquationSeparate(i.blendEq,i.blendAlphaEq)):(t.blendFunc(i.blendSrc,i.blendDst),t.blendEquation(i.blendEq)))}function p(t,e,i){if(e.depthTest!==i.depthTest)return i.depthTest?(t.enable(t.DEPTH_TEST),t.depthFunc(i.depthFunc),void t.depthMask(i.depthWrite)):void t.disable(t.DEPTH_TEST);e.depthWrite!==i.depthWrite&&t.depthMask(i.depthWrite),!1!==i.depthTest?e.depthFunc!==i.depthFunc&&t.depthFunc(i.depthFunc):i.depthWrite&&(i.depthTest=!0,i.depthFunc=a.enums.DS_FUNC_ALWAYS,t.enable(t.DEPTH_TEST),t.depthFunc(i.depthFunc))}function m(t,e,i){if(i.stencilTest!==a.enums.STENCIL_INHERIT)return i.stencilTest!==e.stencilTest?i.stencilTest===a.enums.STENCIL_DISABLE?void t.disable(t.STENCIL_TEST):(t.enable(t.STENCIL_TEST),void(i.stencilSep?(t.stencilFuncSeparate(t.FRONT,i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMaskSeparate(t.FRONT,i.stencilWriteMaskFront),t.stencilOpSeparate(t.FRONT,i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront),t.stencilFuncSeparate(t.BACK,i.stencilFuncBack,i.stencilRefBack,i.stencilMaskBack),t.stencilMaskSeparate(t.BACK,i.stencilWriteMaskBack),t.stencilOpSeparate(t.BACK,i.stencilFailOpBack,i.stencilZFailOpBack,i.stencilZPassOpBack)):(t.stencilFunc(i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMask(i.stencilWriteMaskFront),t.stencilOp(i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront)))):void(i.stencilTest!==a.enums.STENCIL_DISABLE&&(e.stencilSep===i.stencilSep?i.stencilSep?(e.stencilFuncFront===i.stencilFuncFront&&e.stencilRefFront===i.stencilRefFront&&e.stencilMaskFront===i.stencilMaskFront||t.stencilFuncSeparate(t.FRONT,i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),e.stencilWriteMaskFront!==i.stencilWriteMaskFront&&t.stencilMaskSeparate(t.FRONT,i.stencilWriteMaskFront),e.stencilFailOpFront===i.stencilFailOpFront&&e.stencilZFailOpFront===i.stencilZFailOpFront&&e.stencilZPassOpFront===i.stencilZPassOpFront||t.stencilOpSeparate(t.FRONT,i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront),e.stencilFuncBack===i.stencilFuncBack&&e.stencilRefBack===i.stencilRefBack&&e.stencilMaskBack===i.stencilMaskBack||t.stencilFuncSeparate(t.BACK,i.stencilFuncBack,i.stencilRefBack,i.stencilMaskBack),e.stencilWriteMaskBack!==i.stencilWriteMaskBack&&t.stencilMaskSeparate(t.BACK,i.stencilWriteMaskBack),e.stencilFailOpBack===i.stencilFailOpBack&&e.stencilZFailOpBack===i.stencilZFailOpBack&&e.stencilZPassOpBack===i.stencilZPassOpBack||t.stencilOpSeparate(t.BACK,i.stencilFailOpBack,i.stencilZFailOpBack,i.stencilZPassOpBack)):(e.stencilFuncFront===i.stencilFuncFront&&e.stencilRefFront===i.stencilRefFront&&e.stencilMaskFront===i.stencilMaskFront||t.stencilFunc(i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),e.stencilWriteMaskFront!==i.stencilWriteMaskFront&&t.stencilMask(i.stencilWriteMaskFront),e.stencilFailOpFront===i.stencilFailOpFront&&e.stencilZFailOpFront===i.stencilZFailOpFront&&e.stencilZPassOpFront===i.stencilZPassOpFront||t.stencilOp(i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront)):i.stencilSep?(t.stencilFuncSeparate(t.FRONT,i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMaskSeparate(t.FRONT,i.stencilWriteMaskFront),t.stencilOpSeparate(t.FRONT,i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront),t.stencilFuncSeparate(t.BACK,i.stencilFuncBack,i.stencilRefBack,i.stencilMaskBack),t.stencilMaskSeparate(t.BACK,i.stencilWriteMaskBack),t.stencilOpSeparate(t.BACK,i.stencilFailOpBack,i.stencilZFailOpBack,i.stencilZPassOpBack)):(t.stencilFunc(i.stencilFuncFront,i.stencilRefFront,i.stencilMaskFront),t.stencilMask(i.stencilWriteMaskFront),t.stencilOp(i.stencilFailOpFront,i.stencilZFailOpFront,i.stencilZPassOpFront))))}function y(t,e,i){e.cullMode!==i.cullMode&&(i.cullMode!==a.enums.CULL_NONE?(t.enable(t.CULL_FACE),t.cullFace(i.cullMode)):t.disable(t.CULL_FACE))}function v(t,e,i,n){var r=!1;if(-1!==n.maxStream){if(i.maxStream!==n.maxStream)r=!0;else if(i.program!==n.program)r=!0;else for(var s=0;s3&&void 0!==arguments[3]?arguments[3]:0;i instanceof c.default?t.framebufferTexture2D(t.FRAMEBUFFER,e,t.TEXTURE_2D,i._glID,0):i instanceof l.default?t.framebufferTexture2D(t.FRAMEBUFFER,e,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i._glID,0):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,i._glID)}var C=(function(){function t(e,i){u(this,t);var n=void 0;void 0===(i=i||{}).alpha&&(i.alpha=!1),void 0===i.stencil&&(i.stencil=!0),void 0===i.depth&&(i.depth=!0),void 0===i.antialias&&(i.antialias=!1),void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1);try{n=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)||e.getContext("webkit-3d",i)||e.getContext("moz-webgl",i)}catch(t){return void console.error(t)}n||console.error("This device does not support webgl"),this._gl=n,this._extensions={},this._caps={},this._stats={texture:0,vb:0,ib:0,drawcalls:0},this._initExtensions(["EXT_texture_filter_anisotropic","EXT_shader_texture_lod","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_depth_texture","WEBGL_draw_buffers"]),this._initCaps(),this._initStates(),o.default.initDefault(this),this._current=new o.default(this),this._next=new o.default(this),this._uniforms={},this._vx=this._vy=this._vw=this._vh=0,this._sx=this._sy=this._sw=this._sh=0,this._framebuffer=null,this._enabledAttributes=new Array(this._caps.maxVertexAttribs),this._newAttributes=new Array(this._caps.maxVertexAttribs);for(var r=0;r>>0},t.prototype.setBlendFunc=function(t,e){this._next.blendSep=!1,this._next.blendSrc=t,this._next.blendDst=e},t.prototype.setBlendFuncSep=function(t,e,i,n){this._next.blendSep=!0,this._next.blendSrc=t,this._next.blendDst=e,this._next.blendSrcAlpha=i,this._next.blendDstAlpha=n},t.prototype.setBlendEq=function(t){this._next.blendSep=!1,this._next.blendEq=t},t.prototype.setBlendEqSep=function(t,e){this._next.blendSep=!0,this._next.blendEq=t,this._next.blendAlphaEq=e},t.prototype.setCullMode=function(t){this._next.cullMode=t},t.prototype.setVertexBuffer=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this._next.vertexBuffers[t]=e,this._next.vertexBufferOffsets[t]=i,this._next.maxStream=this._caps.maxTextureUnits?console.warn("Can not set texture "+t+" at stage "+i+", max texture exceed: "+this._caps.maxTextureUnits):(this._next.textureUnits[i]=e,this.setUniform(t,i),this._next.maxTextureSlot=this._caps.maxTextureUnits)console.warn("Can not set "+n+" textures for "+t+", max texture exceed: "+this._caps.maxTextureUnits);else{for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:-1,r=n[e][i+1];if(void 0===r)return console.warn("Unknown FILTER: "+e),-1===i?t.LINEAR:t.LINEAR_MIPMAP_LINEAR;return r},i.glTextureFmt=function(t){var e=r[t];if(void 0===e)return console.warn("Unknown TEXTURE_FMT: "+t),r[s.TEXTURE_FMT_RGBA8];return e};var n=[[9728,9984,9986],[9729,9985,9987]],r=[{format:6407,internalFormat:33776,pixelType:null},{format:6408,internalFormat:33777,pixelType:null},{format:6408,internalFormat:33778,pixelType:null},{format:6408,internalFormat:33779,pixelType:null},{format:6407,internalFormat:36196,pixelType:null},{format:6407,internalFormat:35841,pixelType:null},{format:6408,internalFormat:35843,pixelType:null},{format:6407,internalFormat:35840,pixelType:null},{format:6408,internalFormat:35842,pixelType:null},{format:6406,internalFormat:6406,pixelType:5121},{format:6409,internalFormat:6409,pixelType:5121},{format:6410,internalFormat:6410,pixelType:5121},{format:6407,internalFormat:6407,pixelType:33635},{format:6408,internalFormat:6408,pixelType:32820},{format:6408,internalFormat:6408,pixelType:32819},{format:6407,internalFormat:6407,pixelType:5121},{format:6408,internalFormat:6408,pixelType:5121},{format:6407,internalFormat:6407,pixelType:36193},{format:6408,internalFormat:6408,pixelType:36193},{format:6407,internalFormat:6407,pixelType:5126},{format:6408,internalFormat:6408,pixelType:5126},{format:null,internalFormat:null,pixelType:null},{format:null,internalFormat:null,pixelType:null},{format:null,internalFormat:null,pixelType:null},{format:null,internalFormat:null,pixelType:null},{format:6402,internalFormat:6402,pixelType:5123},{format:6402,internalFormat:6402,pixelType:5125},{format:6402,internalFormat:6402,pixelType:5125},{format:6407,internalFormat:37492,pixelType:null},{format:6408,internalFormat:37496,pixelType:null}],s=i.enums={USAGE_STATIC:35044,USAGE_DYNAMIC:35048,USAGE_STREAM:35040,INDEX_FMT_UINT8:5121,INDEX_FMT_UINT16:5123,INDEX_FMT_UINT32:5125,ATTR_POSITION:"a_position",ATTR_NORMAL:"a_normal",ATTR_TANGENT:"a_tangent",ATTR_BITANGENT:"a_bitangent",ATTR_WEIGHTS:"a_weights",ATTR_JOINTS:"a_joints",ATTR_COLOR:"a_color",ATTR_COLOR0:"a_color0",ATTR_COLOR1:"a_color1",ATTR_UV:"a_uv",ATTR_UV0:"a_uv0",ATTR_UV1:"a_uv1",ATTR_UV2:"a_uv2",ATTR_UV3:"a_uv3",ATTR_UV4:"a_uv4",ATTR_UV5:"a_uv5",ATTR_UV6:"a_uv6",ATTR_UV7:"a_uv7",ATTR_TYPE_INT8:5120,ATTR_TYPE_UINT8:5121,ATTR_TYPE_INT16:5122,ATTR_TYPE_UINT16:5123,ATTR_TYPE_INT32:5124,ATTR_TYPE_UINT32:5125,ATTR_TYPE_FLOAT32:5126,FILTER_NEAREST:0,FILTER_LINEAR:1,WRAP_REPEAT:10497,WRAP_CLAMP:33071,WRAP_MIRROR:33648,TEXTURE_FMT_RGB_DXT1:0,TEXTURE_FMT_RGBA_DXT1:1,TEXTURE_FMT_RGBA_DXT3:2,TEXTURE_FMT_RGBA_DXT5:3,TEXTURE_FMT_RGB_ETC1:4,TEXTURE_FMT_RGB_PVRTC_2BPPV1:5,TEXTURE_FMT_RGBA_PVRTC_2BPPV1:6,TEXTURE_FMT_RGB_PVRTC_4BPPV1:7,TEXTURE_FMT_RGBA_PVRTC_4BPPV1:8,TEXTURE_FMT_A8:9,TEXTURE_FMT_L8:10,TEXTURE_FMT_L8_A8:11,TEXTURE_FMT_R5_G6_B5:12,TEXTURE_FMT_R5_G5_B5_A1:13,TEXTURE_FMT_R4_G4_B4_A4:14,TEXTURE_FMT_RGB8:15,TEXTURE_FMT_RGBA8:16,TEXTURE_FMT_RGB16F:17,TEXTURE_FMT_RGBA16F:18,TEXTURE_FMT_RGB32F:19,TEXTURE_FMT_RGBA32F:20,TEXTURE_FMT_R32F:21,TEXTURE_FMT_111110F:22,TEXTURE_FMT_SRGB:23,TEXTURE_FMT_SRGBA:24,TEXTURE_FMT_D16:25,TEXTURE_FMT_D32:26,TEXTURE_FMT_D24S8:27,TEXTURE_FMT_RGB_ETC2:28,TEXTURE_FMT_RGBA_ETC2:29,DS_FUNC_NEVER:512,DS_FUNC_LESS:513,DS_FUNC_EQUAL:514,DS_FUNC_LEQUAL:515,DS_FUNC_GREATER:516,DS_FUNC_NOTEQUAL:517,DS_FUNC_GEQUAL:518,DS_FUNC_ALWAYS:519,RB_FMT_RGBA4:32854,RB_FMT_RGB5_A1:32855,RB_FMT_RGB565:36194,RB_FMT_D16:33189,RB_FMT_S8:36168,RB_FMT_D24S8:34041,BLEND_FUNC_ADD:32774,BLEND_FUNC_SUBTRACT:32778,BLEND_FUNC_REVERSE_SUBTRACT:32779,BLEND_ZERO:0,BLEND_ONE:1,BLEND_SRC_COLOR:768,BLEND_ONE_MINUS_SRC_COLOR:769,BLEND_DST_COLOR:774,BLEND_ONE_MINUS_DST_COLOR:775,BLEND_SRC_ALPHA:770,BLEND_ONE_MINUS_SRC_ALPHA:771,BLEND_DST_ALPHA:772,BLEND_ONE_MINUS_DST_ALPHA:773,BLEND_CONSTANT_COLOR:32769,BLEND_ONE_MINUS_CONSTANT_COLOR:32770,BLEND_CONSTANT_ALPHA:32771,BLEND_ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_SRC_ALPHA_SATURATE:776,STENCIL_DISABLE:0,STENCIL_ENABLE:1,STENCIL_INHERIT:2,STENCIL_OP_KEEP:7680,STENCIL_OP_ZERO:0,STENCIL_OP_REPLACE:7681,STENCIL_OP_INCR:7682,STENCIL_OP_INCR_WRAP:34055,STENCIL_OP_DECR:7683,STENCIL_OP_DECR_WRAP:34056,STENCIL_OP_INVERT:5386,CULL_NONE:0,CULL_FRONT:1028,CULL_BACK:1029,CULL_FRONT_AND_BACK:1032,PT_POINTS:0,PT_LINES:1,PT_LINE_LOOP:2,PT_LINE_STRIP:3,PT_TRIANGLES:4,PT_TRIANGLE_STRIP:5,PT_TRIANGLE_FAN:6}}),{}],306:[(function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}i.__esModule=!0;var r=(function(){function t(e,i,r,s){n(this,t),this._device=e,this._width=i,this._height=r,this._colors=s.colors||[],this._depth=s.depth||null,this._stencil=s.stencil||null,this._depthStencil=s.depthStencil||null,this._glID=e._gl.createFramebuffer()}return t.prototype.destroy=function(){null!==this._glID?(this._device._gl.deleteFramebuffer(this._glID),this._glID=null):console.error("The frame-buffer already destroyed")},t.prototype.getHandle=function(){return this._glID},t})();i.default=r,e.exports=i.default}),{}],307:[(function(t,e,i){"use strict";i.__esModule=!0;var n,r=(function(){function t(t,e){for(var i=0;ithis._bytes){if(t)return void console.error("Failed to update data, bytes exceed.");this._needExpandDataStore=!0,this._bytes=t+e.byteLength,this._numIndices=this._bytes/this._bytesPerIndex}var i=this._device._gl,n=this._usage;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this._glID),this._needExpandDataStore?(i.bufferData(i.ELEMENT_ARRAY_BUFFER,e,n),this._needExpandDataStore=!1):i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,t,e),this._device._restoreIndexBuffer()}}else console.error("The buffer is destroyed")},t.prototype.setUsage=function(t){this._usage=t},r(t,[{key:"count",get:function(){return this._numIndices}}]),t})();c.BYTES_PER_INDEX=a,i.default=c,e.exports=i.default}),{"./enums":305}],308:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./enums"),r=null;r={VertexFormat:t("./vertex-format"),IndexBuffer:t("./index-buffer"),VertexBuffer:t("./vertex-buffer"),Program:t("./program"),Texture:t("./texture"),Texture2D:t("./texture-2d"),TextureCube:t("./texture-cube"),RenderBuffer:t("./render-buffer"),FrameBuffer:t("./frame-buffer"),Device:t("./device"),attrTypeBytes:n.attrTypeBytes,glFilter:n.glFilter,glTextureFmt:n.glTextureFmt},Object.assign(r,n.enums),i.default=r,cc.gfx=r,e.exports=i.default}),{"./device":304,"./enums":305,"./frame-buffer":306,"./index-buffer":307,"./program":310,"./render-buffer":311,"./texture":315,"./texture-2d":313,"./texture-cube":314,"./vertex-buffer":316,"./vertex-format":317}],309:[(function(t,e,i){"use strict";i.__esModule=!0,i.isPow2=function(t){return!(t&t-1||!t)}}),{}],310:[(function(t,e,i){"use strict";i.__esModule=!0;var n=(function(){function t(t,e){for(var i=0;i0&&t.push({type:e,fileID:-1,line:0,message:i})}}))}var a=(function(){function t(e,i){r(this,t),this._device=e,this._attributes=[],this._uniforms=[],this._samplers=[],this._errors=[],this._linked=!1,this._vertSource=i.vert,this._fragSource=i.frag,this._glID=null,this._id=s++}return t.prototype.link=function(){if(!this._linked){var t=this._device._gl,e=c(t,t.VERTEX_SHADER,this._vertSource),i=c(t,t.FRAGMENT_SHADER,this._fragSource),n=t.createProgram();t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n);var r=!1,s=this._errors;if(t.getShaderParameter(e,t.COMPILE_STATUS)||(o(s,"vs",t.getShaderInfoLog(e)),r=!0),t.getShaderParameter(i,t.COMPILE_STATUS)||(o(s,"fs",t.getShaderInfoLog(i)),r=!0),t.deleteShader(e),t.deleteShader(i),r)return s;if(!t.getProgramParameter(n,t.LINK_STATUS))return s.push({info:"Failed to link shader program: "+t.getProgramInfoLog(n)}),s;this._glID=n;for(var a=t.getProgramParameter(n,t.ACTIVE_ATTRIBUTES),l=0;l=r.enums.TEXTURE_FMT_RGB_DXT1&&this._format<=r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1||this._format>=r.enums.TEXTURE_FMT_RGB_ETC2&&this._format<=r.enums.TEXTURE_FMT_RGBA_ETC2),void 0!==t.genMipmaps&&(this._genMipmap=t.genMipmaps,i=t.genMipmaps);var n=this._device.caps.maxTextureSize||Number.MAX_VALUE,o=Math.max(t.width||0,t.height||0);if(n1)i=!1,(t.width>t.height?t.width:t.height)>>t.images.length-1!=1&&console.error("texture-2d mipmap is invalid, should have a 1x1 mipmap.")}(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height)||(i=!1),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._glID),void 0!==t.images&&t.images.length>0&&(this._setMipmap(t.images,t.flipY,t.premultiplyAlpha),t.images.length>1&&(this._genMipmap=!0)),i&&(e.hint(e.GENERATE_MIPMAP_HINT,e.NICEST),e.generateMipmap(e.TEXTURE_2D),this._genMipmap=!0),this._setTexInfo(),this._device._restoreTexture(0)},e.prototype.updateSubImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._glID),this._setSubImage(i,t),this._device._restoreTexture(0)},e.prototype.updateImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._glID),this._setImage(i,t),this._device._restoreTexture(0)},e.prototype._setSubImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.image;!s||ArrayBuffer.isView(s)||s instanceof ArrayBuffer?(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this._compressed?i.compressedTexSubImage2D(i.TEXTURE_2D,e.level,e.x,e.y,e.width,e.height,t.format,s):i.texSubImage2D(i.TEXTURE_2D,e.level,e.x,e.y,e.width,e.height,t.format,t.pixelType,s)):(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),i.texSubImage2D(i.TEXTURE_2D,e.level,e.x,e.y,t.format,t.pixelType,s))},e.prototype._setImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.image;!s||ArrayBuffer.isView(s)||s instanceof ArrayBuffer?(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this._compressed?i.compressedTexImage2D(i.TEXTURE_2D,e.level,t.internalFormat,e.width,e.height,0,s):i.texImage2D(i.TEXTURE_2D,e.level,t.internalFormat,e.width,e.height,0,t.format,t.pixelType,s)):(void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),i.texImage2D(i.TEXTURE_2D,e.level,t.internalFormat,t.format,t.pixelType,s))},e.prototype._setMipmap=function(t,e,i){for(var n=(0,r.glTextureFmt)(this._format),s={width:this._width,height:this._height,flipY:e,premultiplyAlpha:i,level:0,image:null},o=0;o>o,s.height=this._height>>o,s.image=t[o],this._setImage(n,s)},e.prototype._setTexInfo=function(){var t=this._device._gl,e=(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height);e||this._wrapS===r.enums.WRAP_CLAMP&&this._wrapT===r.enums.WRAP_CLAMP||(console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"),this._wrapS=r.enums.WRAP_CLAMP,this._wrapT=r.enums.WRAP_CLAMP);var i=this._genMipmap?this._mipFilter:-1;e||-1===i||(console.warn("NPOT textures do not support mipmap filter"),i=-1),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,(0,r.glFilter)(t,this._minFilter,i)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,(0,r.glFilter)(t,this._magFilter,-1)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._wrapT);var n=this._device.ext("EXT_texture_filter_anisotropic");n&&t.texParameteri(t.TEXTURE_2D,n.TEXTURE_MAX_ANISOTROPY_EXT,this._anisotropy)},e})(n.default);i.default=l,e.exports=i.default}),{"./enums":305,"./misc":309,"./texture":315}],314:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(t){return t&&t.__esModule?t:{default:t}})(t("./texture")),r=t("./enums"),s=t("./misc");function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var l=(function(t){function e(i,n){o(this,e);var r=a(this,t.call(this,i)),s=r._device._gl;return r._target=s.TEXTURE_CUBE_MAP,r._glID=s.createTexture(),r.update(n),r}return c(e,t),e.prototype.update=function(t){var e=this._device._gl,i=this._genMipmaps;t&&(void 0!==t.width&&(this._width=t.width),void 0!==t.height&&(this._height=t.height),void 0!==t.anisotropy&&(this._anisotropy=t.anisotropy),void 0!==t.minFilter&&(this._minFilter=t.minFilter),void 0!==t.magFilter&&(this._magFilter=t.magFilter),void 0!==t.mipFilter&&(this._mipFilter=t.mipFilter),void 0!==t.wrapS&&(this._wrapS=t.wrapS),void 0!==t.wrapT&&(this._wrapT=t.wrapT),void 0!==t.format&&(this._format=t.format,this._compressed=this._format>=r.enums.TEXTURE_FMT_RGB_DXT1&&this._format<=r.enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1||this._format>=r.enums.TEXTURE_FMT_RGB_ETC2&&this._format<=r.enums.TEXTURE_FMT_RGBA_ETC2),void 0!==t.genMipmaps&&(this._genMipmaps=t.genMipmaps,i=t.genMipmaps),void 0!==t.images&&t.images.length>1&&(i=!1,t.width!==t.height&&console.warn("texture-cube width and height should be identical."),t.width>>t.images.length-1!=1&&console.error("texture-cube mipmap is invalid. please set mipmap as 1x1, 2x2, 4x4 ... nxn"))),(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height)||(i=!1),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._glID),void 0!==t.images&&t.images.length>0&&(this._setMipmap(t.images,t.flipY,t.premultiplyAlpha),t.images.length>1&&(this._genMipmaps=!0)),i&&(e.hint(e.GENERATE_MIPMAP_HINT,e.NICEST),e.generateMipmap(e.TEXTURE_CUBE_MAP),this._genMipmaps=!0),this._setTexInfo(),this._device._restoreTexture(0)},e.prototype.updateSubImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._glID),this._setSubImage(i,t),this._device._restoreTexture(0)},e.prototype.updateImage=function(t){var e=this._device._gl,i=(0,r.glTextureFmt)(this._format);e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this._glID),this._setImage(i,t),this._device._restoreTexture(0)},e.prototype._setSubImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.faceIndex,o=e.image;void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),!o||ArrayBuffer.isView(o)||o instanceof ArrayBuffer?this._compressed?i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,e.x,e.y,e.width,e.height,t.format,o):i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,e.x,e.y,e.width,e.height,t.format,t.pixelType,o):i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,e.x,e.y,t.format,t.pixelType,o)},e.prototype._setImage=function(t,e){var i=this._device._gl,n=e.flipY,r=e.premultiplyAlpha,s=e.faceIndex,o=e.image;void 0===n?i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1):i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,n),void 0===r?i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1):i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),!o||ArrayBuffer.isView(o)||o instanceof ArrayBuffer?this._compressed?i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,t.internalFormat,e.width,e.height,0,o):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,t.internalFormat,e.width,e.height,0,t.format,t.pixelType,o):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+s,e.level,t.internalFormat,t.format,t.pixelType,o)},e.prototype._setMipmap=function(t,e,i){for(var n=(0,r.glTextureFmt)(this._format),s={width:this._width,height:this._height,faceIndex:0,flipY:e,premultiplyAlpha:i,level:0,image:null},o=0;o>o,s.height=this._height>>o;for(var c=0;c<6;++c)s.faceIndex=c,s.image=a[c],this._setImage(n,s)}},e.prototype._setTexInfo=function(){var t=this._device._gl,e=(0,s.isPow2)(this._width)&&(0,s.isPow2)(this._height);e||this._wrapS===r.enums.WRAP_CLAMP&&this._wrapT===r.enums.WRAP_CLAMP||(console.warn("WebGL1 doesn't support all wrap modes with NPOT textures"),this._wrapS=r.enums.WRAP_CLAMP,this._wrapT=r.enums.WRAP_CLAMP);var i=this._genMipmaps?this._mipFilter:-1;e||-1===i||(console.warn("NPOT textures do not support mipmap filter"),i=-1),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,(0,r.glFilter)(t,this._minFilter,i)),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,(0,r.glFilter)(t,this._magFilter,-1)),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,this._wrapT);var n=this._device.ext("EXT_texture_filter_anisotropic");n&&t.texParameteri(t.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this._anisotropy)},e})(n.default);i.default=l,e.exports=i.default}),{"./enums":305,"./misc":309,"./texture":315}],315:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("./enums");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var s=0,o=(function(){function t(e){r(this,t),this._device=e,this._width=4,this._height=4,this._genMipmaps=!1,this._compressed=!1,this._anisotropy=1,this._minFilter=n.enums.FILTER_LINEAR,this._magFilter=n.enums.FILTER_LINEAR,this._mipFilter=n.enums.FILTER_LINEAR,this._wrapS=n.enums.WRAP_REPEAT,this._wrapT=n.enums.WRAP_REPEAT,this._format=n.enums.TEXTURE_FMT_RGBA8,this._target=-1,this._id=s++}return t.prototype.destroy=function(){null!==this._glID?(this._device._gl.deleteTexture(this._glID),this._device._stats.tex-=this.bytes,this._glID=null):console.error("The texture already destroyed")},t})();i.default=o,e.exports=i.default}),{"./enums":305}],316:[(function(t,e,i){"use strict";i.__esModule=!0;var n=(function(){function t(t,e){for(var i=0;ithis._bytes){if(t)return void console.error("Failed to update data, bytes exceed.");this._needExpandDataStore=!0,this._bytes=t+e.byteLength,this._numVertices=this._bytes/this._bytesPerVertex}var i=this._device._gl,n=this._usage;i.bindBuffer(i.ARRAY_BUFFER,this._glID),this._needExpandDataStore?(i.bufferData(i.ARRAY_BUFFER,e,n),this._needExpandDataStore=!1):i.bufferSubData(i.ARRAY_BUFFER,t,e),i.bindBuffer(i.ARRAY_BUFFER,null)}}else console.error("The buffer is destroyed")},t.prototype.getFormat=function(t){return this._format.element(t)},t.prototype.setUsage=function(t){this._usage=t},n(t,[{key:"count",get:function(){return this._numVertices}}]),t})();i.default=s,e.exports=i.default}),{"./enums":305}],317:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("./enums"),r=(function(t){return t&&t.__esModule?t:{default:t}})(t("../murmurhash2_gc"));function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=(function(){function t(e){s(this,t),this._attr2el={},this._elements=[],this._bytes=0;for(var i="",o=0,a=e.length;othis._data.length)for(var e=this._data.length;e=this._data.length&&this._resize(2*this._data.length),this._data[this._count]=t,++this._count},t.prototype.pop=function(){--this._count,this._count<0&&(this._count=0);var t=this._data[this._count];return this._data[this._count]=void 0,t},t.prototype.fastRemove=function(t){if(!(t>=this._count||t<0)){var e=this._count-1;this._data[t]=this._data[e],this._data[e]=void 0,this._count-=1}},t.prototype.indexOf=function(t){return this._data.indexOf(t)},t.prototype.sort=function(t){return(0,r.default)(this._data,0,this._count,t)},n(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t})();i.default=o,e.exports=i.default}),{"./timsort":324}],320:[(function(t,e,i){"use strict";i.__esModule=!0;var n=t("./circular-pool");Object.defineProperty(i,"CircularPool",{enumerable:!0,get:function(){return l(n).default}});var r=t("./fixed-array");Object.defineProperty(i,"FixedArray",{enumerable:!0,get:function(){return l(r).default}});var s=t("./linked-array");Object.defineProperty(i,"LinkedArray",{enumerable:!0,get:function(){return l(s).default}});var o=t("./pool");Object.defineProperty(i,"Pool",{enumerable:!0,get:function(){return l(o).default}});var a=t("./recycle-pool");Object.defineProperty(i,"RecyclePool",{enumerable:!0,get:function(){return l(a).default}});var c=t("./typed-array-pool");function l(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(i,"TypedArrayPool",{enumerable:!0,get:function(){return l(c).default}})}),{"./circular-pool":318,"./fixed-array":319,"./linked-array":321,"./pool":322,"./recycle-pool":323,"./typed-array-pool":325}],321:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=(function(){function t(t,e){for(var i=0;ithis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(2*this._data.length),this._data[this._count++]},t.prototype.remove=function(t){if(!(t>=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},t.prototype.sort=function(t){return(0,r.default)(this._data,0,this._count,t)},n(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t})();i.default=o,e.exports=i.default}),{"./timsort":324}],324:[(function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}i.__esModule=!0,i.default=function(t,e,i,n){if(!Array.isArray(t))throw new TypeError("Can only sort arrays");void 0===e&&(e=0),void 0===i&&(i=t.length),void 0===n&&(n=l);var s=i-e;if(!(s<2)){var o=0;if(sc&&(_=c),f(t,e,e+_,e+o,n),o=_}a.pushRun(e,o),a.mergeRuns(),s-=o,e+=o}while(0!==s);a.forceMergeRuns()}}};var r=32,s=7,o=256,a=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9];function c(t){return t<1e5?t<100?t<10?0:1:t<1e4?t<1e3?2:3:4:t<1e7?t<1e6?5:6:t<1e9?t<1e8?7:8:9}function l(t,e){if(t===e)return 0;if(~~t===t&&~~e===e){if(0===t||0===e)return t=0)return-1;if(t>=0)return 1;t=-t,e=-e}var i=c(t),n=c(e),r=0;return in&&(e*=a[i-n-1],t/=10,r=1),t===e?r:t=r;)e|=1&t,t>>=1;return t+e}function u(t,e,i,n){var r=e+1;if(r===i)return 1;if(n(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function _(t,e,i){for(i--;e>>1;r(s,t[c])<0?a=c:o=c+1}var l=n-o;switch(l){case 3:t[o+3]=t[o+2];case 2:t[o+2]=t[o+1];case 1:t[o+1]=t[o];break;default:for(;l>0;)t[o+l]=t[o+l-1],l--}t[o]=s}}function d(t,e,i,n,r,s){var o=0,a=0,c=1;if(s(t,e[i+r])>0){for(a=n-r;c0;)o=c,(c=1+(c<<1))<=0&&(c=a);c>a&&(c=a),o+=r,c+=r}else{for(a=r+1;ca&&(c=a);var l=o;o=r-c,c=r-l}for(o++;o>>1);s(t,e[i+h])>0?o=h+1:c=h}return c}function p(t,e,i,n,r,s){var o=0,a=0,c=1;if(s(t,e[i+r])<0){for(a=r+1;ca&&(c=a);var l=o;o=r-c,c=r-l}else{for(a=n-r;c=0;)o=c,(c=1+(c<<1))<=0&&(c=a);c>a&&(c=a),o+=r,c+=r}for(o++;o>>1);s(t,e[i+h])<0?c=h:o=h+1}return c}var m=(function(){function t(e,i){n(this,t),this.array=e,this.compare=i,this.minGallop=s,this.length=e.length,this.tmpStorageLength=o,this.length<2*o&&(this.tmpStorageLength=this.length>>>1),this.tmp=new Array(this.tmpStorageLength),this.stackLength=this.length<120?5:this.length<1542?10:this.length<119151?19:40,this.runStart=new Array(this.stackLength),this.runLength=new Array(this.stackLength),this.stackSize=0}return t.prototype.pushRun=function(t,e){this.runStart[this.stackSize]=t,this.runLength[this.stackSize]=e,this.stackSize+=1},t.prototype.mergeRuns=function(){for(;this.stackSize>1;){var t=this.stackSize-2;if(t>=1&&this.runLength[t-1]<=this.runLength[t]+this.runLength[t+1]||t>=2&&this.runLength[t-2]<=this.runLength[t]+this.runLength[t-1])this.runLength[t-1]this.runLength[t+1])break;this.mergeAt(t)}},t.prototype.forceMergeRuns=function(){for(;this.stackSize>1;){var t=this.stackSize-2;t>0&&this.runLength[t-1]=s||m>=s);if(y)break;_<0&&(_=0),_+=2}if(this.minGallop=_,_<1&&(this.minGallop=1),1===e){for(c=0;c=0;c--)o[f+c]=o[_+c];if(0===e){g=!0;break}}if(o[u--]=a[h--],1==--n){g=!0;break}if(0!==(v=n-d(o[l],a,0,n,n-1,r))){for(n-=v,f=(u-=v)+1,_=(h-=v)+1,c=0;c=s||v>=s);if(g)break;m<0&&(m=0),m+=2}if(this.minGallop=m,m<1&&(this.minGallop=1),1===n){for(f=(u-=e)+1,_=(l-=e)+1,c=e-1;c>=0;c--)o[f+c]=o[_+c];o[u]=a[h]}else{if(0===n)throw new Error("mergeHigh preconditions were not respected");for(_=u-(n-1),c=0;c=0;c--)o[f+c]=o[_+c];o[u]=a[h]}else for(_=u-(n-1),c=0;c65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function a(t){var e=s(t),i=n[o(e)>>2];return i.length>0?i.pop():new ArrayBuffer(e)}function c(t){n[o(t.byteLength)>>2].push(t)}i.default={alloc_int8:function(t){var e=new Int8Array(a(t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_uint8:function(t){var e=new Uint8Array(a(t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_int16:function(t){var e=new Int16Array(a(2*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_uint16:function(t){var e=new Uint16Array(a(2*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_int32:function(t){var e=new Int32Array(a(4*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_uint32:function(t){var e=new Uint32Array(a(4*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_float32:function(t){var e=new Float32Array(a(4*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_float64:function(t){var e=new Float64Array(a(8*t),0,t);return e.length!==t?e.subarray(0,t):e},alloc_dataview:function(t){var e=new DataView(a(t),0,t);return e.length!==t?e.subarray(0,t):e},free:function(t){c(t.buffer)},reset:function(){for(var t=Array(8),e=0;e<8;++e)t[e]=[]}},e.exports=i.default}),{}],326:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=function(t,e){var i,n=t.length,r=e^n,s=0;for(;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:r^=(255&t.charCodeAt(s+2))<<16;case 2:r^=(255&t.charCodeAt(s+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(s)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0},e.exports=i.default}),{}],327:[(function(t,e,i){"use strict";i.__esModule=!0,i.default=void 0;var n=t("../../core/vmath"),r=a(t("../core/base-renderer")),s=a(t("../enums")),o=t("../memop");function a(t){return t&&t.__esModule?t:{default:t}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=new Float32Array(16),_=new Float32Array(16),f=new Float32Array(16),d=new Float32Array(4),p=new Float32Array(64),m=[],y=new Float32Array(4),v=cc.v4(0,0,0,0),g=cc.v3(0,0,0),x=cc.v3(0,0,0),C=new o.RecyclePool(function(){return new Float32Array(16)},8),A=(function(t){function e(i,n){c(this,e);var r=l(this,t.call(this,i,n));return r._time=new Float32Array(4),r._directionalLights=[],r._pointLights=[],r._spotLights=[],r._shadowLights=[],r._ambientLights=[],r._shadowMaps=[],r._shadowMapSlots=new Int32Array(4),r._numLights=0,r._defines={},r._registerStage("shadowcast",r._shadowStage.bind(r)),r._registerStage("opaque",r._opaqueStage.bind(r)),r._registerStage("transparent",r._transparentStage.bind(r)),r}return h(e,t),e.prototype.reset=function(){C.reset(),t.prototype.reset.call(this)},e.prototype.render=function(t,e){this.reset(),this._time[0]+=e,this._device.setUniform("cc_time",this._time),this._updateLights(t);for(var i=this._device._gl.canvas,n=0;n0){for(var e=C.add(),i=C.add(),n=0;n0){for(var o=C.add(),a=C.add(),c=0;c0){for(var u=C.add(),_=C.add(),f=C.add(),d=0;d0){for(var y=C.add(),v=0;vi?i:t}var A=isFinite;function b(t){return t*t}function S(t){return 1/Math.sqrt(t)}var T=Math.sqrt,w=Math.pow;var E=Math.cos,B=Math.sin,M=Math.acos,I=Math.asin,R=Math.atan2;var P=(function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.Clone=function(){return new t(this.x,this.y)},t.prototype.SetZero=function(){return this.x=0,this.y=0,this},t.prototype.Set=function(t,e){return this.x=t,this.y=e,this},t.prototype.Copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.SelfAddXY=function(t,e){return this.x+=t,this.y+=e,this},t.prototype.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.SelfSubXY=function(t,e){return this.x-=t,this.y-=e,this},t.prototype.SelfMul=function(t){return this.x*=t,this.y*=t,this},t.prototype.SelfMulAdd=function(t,e){return this.x+=t*e.x,this.y+=t*e.y,this},t.prototype.SelfMulSub=function(t,e){return this.x-=t*e.x,this.y-=t*e.y,this},t.prototype.Dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.Cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.Length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},t.prototype.LengthSquared=function(){var t=this.x,e=this.y;return t*t+e*e},t.prototype.Normalize=function(){var t=this.Length();if(t>=n){var e=1/t;this.x*=e,this.y*=e}return t},t.prototype.SelfNormalize=function(){var t=this.Length();if(t>=n){var e=1/t;this.x*=e,this.y*=e}return this},t.prototype.SelfRotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.x;return this.x=e*n-i*this.y,this.y=i*n+e*this.y,this},t.prototype.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)},t.prototype.SelfCrossVS=function(t){var e=this.x;return this.x=t*this.y,this.y=-t*e,this},t.prototype.SelfCrossSV=function(t){var e=this.x;return this.x=-t*this.y,this.y=t*e,this},t.prototype.SelfMinV=function(t){return this.x=g(this.x,t.x),this.y=g(this.y,t.y),this},t.prototype.SelfMaxV=function(t){return this.x=x(this.x,t.x),this.y=x(this.y,t.y),this},t.prototype.SelfAbs=function(){return this.x=v(this.x),this.y=v(this.y),this},t.prototype.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.SelfSkew=function(){var t=this.x;return this.x=-this.y,this.y=t,this},t.MakeArray=function(e){return d(e,(function(e){return new t}))},t.AbsV=function(t,e){return e.x=v(t.x),e.y=v(t.y),e},t.MinV=function(t,e,i){return i.x=g(t.x,e.x),i.y=g(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=x(t.x,e.x),i.y=x(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=C(t.x,e.x,i.x),n.y=C(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),o=Math.sin(e);return i.x=s*n-o*r,i.y=o*n+s*r,i},t.DotVV=function(t,e){return t.x*e.x+t.y*e.y},t.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},t.CrossVS=function(t,e,i){var n=t.x;return i.x=e*t.y,i.y=-e*n,i},t.CrossVOne=function(t,e){var i=t.x;return e.x=t.y,e.y=-i,e},t.CrossSV=function(t,e,i){var n=e.x;return i.x=-t*e.y,i.y=t*n,i},t.CrossOneV=function(t,e){var i=t.x;return e.x=-t.y,e.y=i,e},t.AddVV=function(t,e,i){return i.x=t.x+e.x,i.y=t.y+e.y,i},t.SubVV=function(t,e,i){return i.x=t.x-e.x,i.y=t.y-e.y,i},t.MulSV=function(t,e,i){return i.x=e.x*t,i.y=e.y*t,i},t.MulVS=function(t,e,i){return i.x=t.x*e,i.y=t.y*e,i},t.AddVMulSV=function(t,e,i,n){return n.x=t.x+e*i.x,n.y=t.y+e*i.y,n},t.SubVMulSV=function(t,e,i,n){return n.x=t.x-e*i.x,n.y=t.y-e*i.y,n},t.AddVCrossSV=function(t,e,i,n){var r=i.x;return n.x=t.x-e*i.y,n.y=t.y+e*r,n},t.MidVV=function(t,e,i){return i.x=.5*(t.x+e.x),i.y=.5*(t.y+e.y),i},t.ExtVV=function(t,e,i){return i.x=.5*(e.x-t.x),i.y=.5*(e.y-t.y),i},t.IsEqualToV=function(t,e){return t.x===e.x&&t.y===e.y},t.DistanceVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.DistanceSquaredVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.NegV=function(t,e){return e.x=-t.x,e.y=-t.y,e},t.ZERO=new t(0,0),t.UNITX=new t(1,0),t.UNITY=new t(0,1),t.s_t0=new t,t.s_t1=new t,t.s_t2=new t,t.s_t3=new t,t})(),D=new P(0,0),L=(function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}return t.prototype.Clone=function(){return new t(this.x,this.y,this.z)},t.prototype.SetZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.SetXYZ=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},t.prototype.Copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.SelfAddXYZ=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},t.prototype.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},t.prototype.SelfSubXYZ=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},t.prototype.SelfMul=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.DotV3V3=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.CrossV3V3=function(t,e,i){var n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,c=e.z;return i.x=r*c-s*a,i.y=s*o-n*c,i.z=n*a-r*o,i},t.ZERO=new t(0,0,0),t.s_t0=new t,t})(),O=(function(){function t(){this.ex=new P(1,0),this.ey=new P(0,1)}return t.prototype.Clone=function(){return(new t).Copy(this)},t.FromVV=function(e,i){return(new t).SetVV(e,i)},t.FromSSSS=function(e,i,n,r){return(new t).SetSSSS(e,i,n,r)},t.FromAngle=function(e){return(new t).SetAngle(e)},t.prototype.SetSSSS=function(t,e,i,n){return this.ex.Set(t,i),this.ey.Set(e,n),this},t.prototype.SetVV=function(t,e){return this.ex.Copy(t),this.ey.Copy(e),this},t.prototype.SetAngle=function(t){var e=Math.cos(t),i=Math.sin(t);return this.ex.Set(e,i),this.ey.Set(-i,e),this},t.prototype.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this},t.prototype.SetIdentity=function(){return this.ex.Set(1,0),this.ey.Set(0,1),this},t.prototype.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this},t.prototype.GetAngle=function(){return Math.atan2(this.ex.y,this.ex.x)},t.prototype.GetInverse=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;return 0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.y=-s*n,t.ey.y=s*e,t},t.prototype.Solve=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,o=this.ey.y,a=n*o-r*s;return 0!==a&&(a=1/a),i.x=a*(o*t-r*e),i.y=a*(n*e-s*t),i},t.prototype.SelfAbs=function(){return this.ex.SelfAbs(),this.ey.SelfAbs(),this},t.prototype.SelfInv=function(){return this.GetInverse(this),this},t.prototype.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this},t.prototype.SelfSubM=function(t){return this.ex.SelfSub(t.ex),this.ey.SelfSub(t.ey),this},t.AbsM=function(t,e){var i=t.ex,n=t.ey;return e.ex.x=v(i.x),e.ex.y=v(i.y),e.ey.x=v(n.x),e.ey.y=v(n.y),e},t.MulMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,o=e.y;return i.x=n.x*s+r.x*o,i.y=n.y*s+r.y*o,i},t.MulTMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,o=e.y;return i.x=n.x*s+n.y*o,i.y=r.x*s+r.y*o,i},t.AddMM=function(t,e,i){var n=t.ex,r=t.ey,s=e.ex,o=e.ey;return i.ex.x=n.x+s.x,i.ex.y=n.y+s.y,i.ey.x=r.x+o.x,i.ey.y=r.y+o.y,i},t.MulMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,o=t.ey.y,a=e.ex.x,c=e.ex.y,l=e.ey.x,h=e.ey.y;return i.ex.x=n*a+s*c,i.ex.y=r*a+o*c,i.ey.x=n*l+s*h,i.ey.y=r*l+o*h,i},t.MulTMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,o=t.ey.y,a=e.ex.x,c=e.ex.y,l=e.ey.x,h=e.ey.y;return i.ex.x=n*a+r*c,i.ex.y=s*a+o*c,i.ey.x=n*l+r*h,i.ey.y=s*l+o*h,i},t.IDENTITY=new t,t})(),V=(function(){function t(){this.ex=new L(1,0,0),this.ey=new L(0,1,0),this.ez=new L(0,0,1)}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.SetVVV=function(t,e,i){return this.ex.Copy(t),this.ey.Copy(e),this.ez.Copy(i),this},t.prototype.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this.ez.Copy(t.ez),this},t.prototype.SetIdentity=function(){return this.ex.SetXYZ(1,0,0),this.ey.SetXYZ(0,1,0),this.ez.SetXYZ(0,0,1),this},t.prototype.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this.ez.SetZero(),this},t.prototype.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this.ez.SelfAdd(t.ez),this},t.prototype.Solve33=function(t,e,i,n){var r=this.ex.x,s=this.ex.y,o=this.ex.z,a=this.ey.x,c=this.ey.y,l=this.ey.z,h=this.ez.x,u=this.ez.y,_=this.ez.z,f=r*(c*_-l*u)+s*(l*h-a*_)+o*(a*u-c*h);return 0!==f&&(f=1/f),n.x=f*(t*(c*_-l*u)+e*(l*h-a*_)+i*(a*u-c*h)),n.y=f*(r*(e*_-i*u)+s*(i*h-t*_)+o*(t*u-e*h)),n.z=f*(r*(c*i-l*e)+s*(l*t-a*i)+o*(a*e-c*t)),n},t.prototype.Solve22=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,o=this.ey.y,a=n*o-r*s;return 0!==a&&(a=1/a),i.x=a*(o*t-r*e),i.y=a*(n*e-s*t),i},t.prototype.GetInverse22=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.z=0,t.ex.y=-s*n,t.ey.y=s*e,t.ey.z=0,t.ez.x=0,t.ez.y=0,t.ez.z=0},t.prototype.GetSymInverse33=function(t){var e=L.DotV3V3(this.ex,L.CrossV3V3(this.ey,this.ez,L.s_t0));0!==e&&(e=1/e);var i=this.ex.x,n=this.ey.x,r=this.ez.x,s=this.ey.y,o=this.ez.y,a=this.ez.z;t.ex.x=e*(s*a-o*o),t.ex.y=e*(r*o-n*a),t.ex.z=e*(n*o-r*s),t.ey.x=t.ex.y,t.ey.y=e*(i*a-r*r),t.ey.z=e*(r*n-i*o),t.ez.x=t.ex.z,t.ez.y=t.ey.z,t.ez.z=e*(i*s-n*n)},t.MulM33V3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return i.x=t.ex.x*n+t.ey.x*r+t.ez.x*s,i.y=t.ex.y*n+t.ey.y*r+t.ez.y*s,i.z=t.ex.z*n+t.ey.z*r+t.ez.z*s,i},t.MulM33XYZ=function(t,e,i,n,r){return r.x=t.ex.x*e+t.ey.x*i+t.ez.x*n,r.y=t.ex.y*e+t.ey.y*i+t.ez.y*n,r.z=t.ex.z*e+t.ey.z*i+t.ez.z*n,r},t.MulM33V2=function(t,e,i){var n=e.x,r=e.y;return i.x=t.ex.x*n+t.ey.x*r,i.y=t.ex.y*n+t.ey.y*r,i},t.MulM33XY=function(t,e,i,n){return n.x=t.ex.x*e+t.ey.x*i,n.y=t.ex.y*e+t.ey.y*i,n},t.IDENTITY=new t,t})(),F=(function(){function t(t){void 0===t&&(t=0),this.s=0,this.c=1,t&&(this.s=Math.sin(t),this.c=Math.cos(t))}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.s=t.s,this.c=t.c,this},t.prototype.SetAngle=function(t){return this.s=Math.sin(t),this.c=Math.cos(t),this},t.prototype.SetIdentity=function(){return this.s=0,this.c=1,this},t.prototype.GetAngle=function(){return Math.atan2(this.s,this.c)},t.prototype.GetXAxis=function(t){return t.x=this.c,t.y=this.s,t},t.prototype.GetYAxis=function(t){return t.x=-this.s,t.y=this.c,t},t.MulRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,o=e.s;return i.s=r*s+n*o,i.c=n*s-r*o,i},t.MulTRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,o=e.s;return i.s=n*o-r*s,i.c=n*s+r*o,i},t.MulRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,o=e.y;return i.x=n*s-r*o,i.y=r*s+n*o,i},t.MulTRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,o=e.y;return i.x=n*s+r*o,i.y=-r*s+n*o,i},t.IDENTITY=new t,t})(),N=(function(){function t(){this.p=new P,this.q=new F}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.p.Copy(t.p),this.q.Copy(t.q),this},t.prototype.SetIdentity=function(){return this.p.SetZero(),this.q.SetIdentity(),this},t.prototype.SetPositionRotation=function(t,e){return this.p.Copy(t),this.q.Copy(e),this},t.prototype.SetPositionAngle=function(t,e){return this.p.Copy(t),this.q.SetAngle(e),this},t.prototype.SetPosition=function(t){return this.p.Copy(t),this},t.prototype.SetPositionXY=function(t,e){return this.p.Set(t,e),this},t.prototype.SetRotation=function(t){return this.q.Copy(t),this},t.prototype.SetRotationAngle=function(t){return this.q.SetAngle(t),this},t.prototype.GetPosition=function(){return this.p},t.prototype.GetRotation=function(){return this.q},t.prototype.GetRotationAngle=function(){return this.q.GetAngle()},t.prototype.GetAngle=function(){return this.q.GetAngle()},t.MulXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x,o=e.y;return i.x=n*s-r*o+t.p.x,i.y=r*s+n*o+t.p.y,i},t.MulTXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x-t.p.x,o=e.y-t.p.y;return i.x=n*s+r*o,i.y=-r*s+n*o,i},t.MulXX=function(t,e,i){return F.MulRR(t.q,e.q,i.q),P.AddVV(F.MulRV(t.q,e.p,i.p),t.p,i.p),i},t.MulTXX=function(t,e,i){return F.MulTRR(t.q,e.q,i.q),F.MulTRV(t.q,P.SubVV(e.p,t.p,i.p),i.p),i},t.IDENTITY=new t,t})(),G=(function(){function t(){this.localCenter=new P,this.c0=new P,this.c=new P,this.a0=0,this.a=0,this.alpha0=0}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.localCenter.Copy(t.localCenter),this.c0.Copy(t.c0),this.c.Copy(t.c),this.a0=t.a0,this.a=t.a,this.alpha0=t.alpha0,this},t.prototype.GetTransform=function(t,e){var i=1-e;t.p.x=i*this.c0.x+e*this.c.x,t.p.y=i*this.c0.y+e*this.c.y;var n=i*this.a0+e*this.a;return t.q.SetAngle(n),t.p.SelfSub(F.MulRV(t.q,this.localCenter,P.s_t0)),t},t.prototype.Advance=function(t){var e=(t-this.alpha0)/(1-this.alpha0),i=1-e;this.c0.x=i*this.c0.x+e*this.c.x,this.c0.y=i*this.c0.y+e*this.c.y,this.a0=i*this.a0+e*this.a,this.alpha0=t},t.prototype.Normalize=function(){var t=6.28318530718*Math.floor(this.a0/6.28318530718);this.a0-=t,this.a-=t},t})(),k=(function(){function t(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=.5),void 0===n&&(n=1),this.r=t,this.g=e,this.b=i,this.a=n}return t.prototype.Clone=function(){return(new t).Copy(this)},t.prototype.Copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.IsEqual=function(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},t.prototype.IsZero=function(){return 0===this.r&&0===this.g&&0===this.b&&0===this.a},t.prototype.Set=function(t,e,i,n){void 0===n&&(n=this.a),this.SetRGBA(t,e,i,n)},t.prototype.SetByteRGB=function(t,e,i){return this.r=t/255,this.g=e/255,this.b=i/255,this},t.prototype.SetByteRGBA=function(t,e,i,n){return this.r=t/255,this.g=e/255,this.b=i/255,this.a=n/255,this},t.prototype.SetRGB=function(t,e,i){return this.r=t,this.g=e,this.b=i,this},t.prototype.SetRGBA=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this},t.prototype.SelfAdd=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this},t.prototype.Add=function(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,e.a=this.a+t.a,e},t.prototype.SelfSub=function(t){return this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a,this},t.prototype.Sub=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,e},t.prototype.SelfMul=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.Mul=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,e},t.prototype.Mix=function(e,i){t.MixColors(this,e,i)},t.MixColors=function(t,e,i){var n=i*(e.r-t.r),r=i*(e.g-t.g),s=i*(e.b-t.b),o=i*(e.a-t.a);t.r+=n,t.g+=r,t.b+=s,t.a+=o,e.r-=n,e.g-=r,e.b-=s,e.a-=o},t.prototype.MakeStyleString=function(e){return void 0===e&&(e=this.a),t.MakeStyleString(this.r,this.g,this.b,e)},t.MakeStyleString=function(t,e,i,n){return void 0===n&&(n=1),t*=255,e*=255,i*=255,n<1?"rgba("+t+","+e+","+i+","+n+")":"rgb("+t+","+e+","+i+")"},t.ZERO=new t(0,0,0,0),t.RED=new t(1,0,0),t.GREEN=new t(0,1,0),t.BLUE=new t(0,0,1),t})();(function(t){t[t.e_none=0]="e_none",t[t.e_shapeBit=1]="e_shapeBit",t[t.e_jointBit=2]="e_jointBit",t[t.e_aabbBit=4]="e_aabbBit",t[t.e_pairBit=8]="e_pairBit",t[t.e_centerOfMassBit=16]="e_centerOfMassBit",t[t.e_particleBit=32]="e_particleBit",t[t.e_controllerBit=64]="e_controllerBit",t[t.e_all=63]="e_all"})(t.b2DrawFlags||(t.b2DrawFlags={}));var z=(function(){function t(){this.m_drawFlags=0}return t.prototype.SetFlags=function(t){this.m_drawFlags=t},t.prototype.GetFlags=function(){return this.m_drawFlags},t.prototype.AppendFlags=function(t){this.m_drawFlags|=t},t.prototype.ClearFlags=function(t){this.m_drawFlags&=~t},t})(),U=(function(){function t(){this.m_start=Date.now()}return t.prototype.Reset=function(){return this.m_start=Date.now(),this},t.prototype.GetMilliseconds=function(){return Date.now()-this.m_start},t})(),W=(function(){function t(){this.m_count=0,this.m_min_count=0,this.m_max_count=0}return t.prototype.GetCount=function(){return this.m_count},t.prototype.GetMinCount=function(){return this.m_min_count},t.prototype.GetMaxCount=function(){return this.m_max_count},t.prototype.ResetCount=function(){var t=this.m_count;return this.m_count=0,t},t.prototype.ResetMinCount=function(){this.m_min_count=0},t.prototype.ResetMaxCount=function(){this.m_max_count=0},t.prototype.Increment=function(){this.m_count++,this.m_max_countthis.m_count&&(this.m_min_count=this.m_count)},t})(),j=(function(){function t(t){this.m_stack=[],this.m_count=0,this.m_stack=d(t,(function(t){return null})),this.m_count=0}return t.prototype.Reset=function(){return this.m_count=0,this},t.prototype.Push=function(t){this.m_stack[this.m_count]=t,this.m_count++},t.prototype.Pop=function(){this.m_count--;var t=this.m_stack[this.m_count];if(this.m_stack[this.m_count]=null,null===t)throw new Error;return t},t.prototype.GetCount=function(){return this.m_count},t})(),H=(function(){return function(){}})(),q=(function(){return function(){}})(),X=(function(){function t(){this.m_buffer=P.MakeArray(2),this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0}return t.prototype.Copy=function(t){return t.m_vertices===t.m_buffer?(this.m_vertices=this.m_buffer,this.m_buffer[0].Copy(t.m_buffer[0]),this.m_buffer[1].Copy(t.m_buffer[1])):this.m_vertices=t.m_vertices,this.m_count=t.m_count,this.m_radius=t.m_radius,this},t.prototype.Reset=function(){return this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0,this},t.prototype.SetShape=function(t,e){t.SetupDistanceProxy(this,e)},t.prototype.SetVerticesRadius=function(t,e,i){this.m_vertices=t,this.m_count=e,this.m_radius=i},t.prototype.GetSupport=function(t){for(var e=0,i=P.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return e},t.prototype.GetSupportVertex=function(t){for(var e=0,i=P.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return this.m_vertices[e]},t.prototype.GetVertexCount=function(){return this.m_count},t.prototype.GetVertex=function(t){return this.m_vertices[t]},t})(),Y=(function(){function t(){this.metric=0,this.count=0,this.indexA=[0,0,0],this.indexB=[0,0,0]}return t.prototype.Reset=function(){return this.metric=0,this.count=0,this},t})(),J=(function(){function t(){this.proxyA=new X,this.proxyB=new X,this.transformA=new N,this.transformB=new N,this.useRadii=!1}return t.prototype.Reset=function(){return this.proxyA.Reset(),this.proxyB.Reset(),this.transformA.SetIdentity(),this.transformB.SetIdentity(),this.useRadii=!1,this},t})(),Z=(function(){function t(){this.pointA=new P,this.pointB=new P,this.distance=0,this.iterations=0}return t.prototype.Reset=function(){return this.pointA.SetZero(),this.pointB.SetZero(),this.distance=0,this.iterations=0,this},t})(),K=(function(){return function(){this.proxyA=new X,this.proxyB=new X,this.transformA=new N,this.transformB=new N,this.translationB=new P}})(),Q=(function(){return function(){this.point=new P,this.normal=new P,this.lambda=0,this.iterations=0}})();t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0;var $=(function(){function t(){this.wA=new P,this.wB=new P,this.w=new P,this.a=0,this.indexA=0,this.indexB=0}return t.prototype.Copy=function(t){return this.wA.Copy(t.wA),this.wB.Copy(t.wB),this.w.Copy(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB,this},t})(),tt=(function(){function t(){this.m_v1=new $,this.m_v2=new $,this.m_v3=new $,this.m_vertices=[],this.m_count=0,this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}return t.prototype.ReadCache=function(t,e,i,r,s){this.m_count=t.count;for(var o=this.m_vertices,a=0;a1){var h=t.metric,u=this.GetMetric();(u<.5*h||2*h0?P.CrossOneV(e,t):P.CrossVOne(e,t);default:return t.SetZero()}},t.prototype.GetClosestPoint=function(t){switch(this.m_count){case 0:return t.SetZero();case 1:return t.Copy(this.m_v1.w);case 2:return t.Set(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);case 3:default:return t.SetZero()}},t.prototype.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.Copy(this.m_v1.wA),e.Copy(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,e.y=t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y}},t.prototype.GetMetric=function(){switch(this.m_count){case 0:case 1:return 0;case 2:return P.DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return P.CrossVV(P.SubVV(this.m_v2.w,this.m_v1.w,P.s_t0),P.SubVV(this.m_v3.w,this.m_v1.w,P.s_t1));default:return 0}},t.prototype.Solve2=function(){var e=this.m_v1.w,i=this.m_v2.w,n=P.SubVV(i,e,t.s_e12),r=-P.DotVV(e,n);if(r<=0)return this.m_v1.a=1,void(this.m_count=1);var s=P.DotVV(i,n);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);var o=1/(s+r);this.m_v1.a=s*o,this.m_v2.a=r*o,this.m_count=2},t.prototype.Solve3=function(){var e=this.m_v1.w,i=this.m_v2.w,n=this.m_v3.w,r=P.SubVV(i,e,t.s_e12),s=P.DotVV(e,r),o=P.DotVV(i,r),a=-s,c=P.SubVV(n,e,t.s_e13),l=P.DotVV(e,c),h=P.DotVV(n,c),u=-l,_=P.SubVV(n,i,t.s_e23),f=P.DotVV(i,_),d=P.DotVV(n,_),p=-f,m=P.CrossVV(r,c),y=m*P.CrossVV(i,n),v=m*P.CrossVV(n,e),g=m*P.CrossVV(e,i);if(a<=0&&u<=0)return this.m_v1.a=1,void(this.m_count=1);if(o>0&&a>0&&g<=0){var x=1/(o+a);return this.m_v1.a=o*x,this.m_v2.a=a*x,void(this.m_count=2)}if(h>0&&u>0&&v<=0){var C=1/(h+u);return this.m_v1.a=h*C,this.m_v3.a=u*C,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(o<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(h<=0&&d<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(d>0&&p>0&&y<=0){var A=1/(d+p);return this.m_v2.a=d*A,this.m_v3.a=p*A,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var b=1/(y+v+g);this.m_v1.a=y*b,this.m_v2.a=v*b,this.m_v3.a=g*b,this.m_count=3},t.s_e12=new P,t.s_e13=new P,t.s_e23=new P,t})(),et=new tt,it=[0,0,0],nt=[0,0,0],rt=new P,st=new P,ot=new P,at=new P,ct=new P;function lt(e,i,s){++t.b2_gjkCalls;var o=s.proxyA,a=s.proxyB,c=s.transformA,l=s.transformB,h=et;h.ReadCache(i,o,c,a,l);for(var u=h.m_vertices,_=it,f=nt,d=0,p=0;p<20;){d=h.m_count;for(var m=0;mC+A&&e.distance>n){e.distance-=C+A;var b=P.SubVV(e.pointB,e.pointA,ot);b.Normalize(),e.pointA.SelfMulAdd(C,b),e.pointB.SelfMulSub(A,b)}else{var S=P.MidVV(e.pointA,e.pointB,rt);e.pointA.Copy(S),e.pointB.Copy(S),e.distance=0}}}var ht=new P,ut=new tt,_t=new P,ft=new P,dt=new P,pt=new P,mt=new P,yt=new P;(function(t){t[t.e_vertex=0]="e_vertex",t[t.e_face=1]="e_face"})(t.b2ContactFeatureType||(t.b2ContactFeatureType={}));var vt=(function(){function t(){this._key=0,this._key_invalid=!1,this._indexA=0,this._indexB=0,this._typeA=0,this._typeB=0}return Object.defineProperty(t.prototype,"key",{get:function(){return this._key_invalid&&(this._key_invalid=!1,this._key=this._indexA|this._indexB<<8|this._typeA<<16|this._typeB<<24),this._key},set:function(t){this._key=t,this._key_invalid=!1,this._indexA=255&this._key,this._indexB=this._key>>8&255,this._typeA=this._key>>16&255,this._typeB=this._key>>24&255},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indexA",{get:function(){return this._indexA},set:function(t){this._indexA=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indexB",{get:function(){return this._indexB},set:function(t){this._indexB=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"typeA",{get:function(){return this._typeA},set:function(t){this._typeA=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"typeB",{get:function(){return this._typeB},set:function(t){this._typeB=t,this._key_invalid=!0},enumerable:!0,configurable:!0}),t})(),gt=(function(){function t(){this.cf=new vt}return t.prototype.Copy=function(t){return this.key=t.key,this},t.prototype.Clone=function(){return(new t).Copy(this)},Object.defineProperty(t.prototype,"key",{get:function(){return this.cf.key},set:function(t){this.cf.key=t},enumerable:!0,configurable:!0}),t})(),xt=(function(){function t(){this.localPoint=new P,this.normalImpulse=0,this.tangentImpulse=0,this.id=new gt}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t.prototype.Reset=function(){this.localPoint.SetZero(),this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},t.prototype.Copy=function(t){return this.localPoint.Copy(t.localPoint),this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.Copy(t.id),this},t})();(function(t){t[t.e_unknown=-1]="e_unknown",t[t.e_circles=0]="e_circles",t[t.e_faceA=1]="e_faceA",t[t.e_faceB=2]="e_faceB"})(t.b2ManifoldType||(t.b2ManifoldType={}));var Ct=(function(){function e(){this.points=xt.MakeArray(o),this.localNormal=new P,this.localPoint=new P,this.type=t.b2ManifoldType.e_unknown,this.pointCount=0}return e.prototype.Reset=function(){for(var e=0;er&&P.SubVV(l,c,this.normal).SelfNormalize();var h=P.AddVMulSV(c,s,this.normal,e.Initialize_s_cA),u=P.SubVMulSV(l,a,this.normal,e.Initialize_s_cB);P.MidVV(h,u,this.points[0]),this.separations[0]=P.DotVV(P.SubVV(u,h,P.s_t0),this.normal);break;case t.b2ManifoldType.e_faceA:F.MulRV(n.q,i.localNormal,this.normal);for(var _=N.MulXV(n,i.localPoint,e.Initialize_s_planePoint),f=0;f=0&&e>=0;return i=i&&this.lowerBound.IsValid()&&this.upperBound.IsValid()},t.prototype.GetCenter=function(){return P.MidVV(this.lowerBound,this.upperBound,this.m_cache_center)},t.prototype.GetExtents=function(){return P.ExtVV(this.lowerBound,this.upperBound,this.m_cache_extent)},t.prototype.GetPerimeter=function(){return 2*(this.upperBound.x-this.lowerBound.x+(this.upperBound.y-this.lowerBound.y))},t.prototype.Combine1=function(t){return this.lowerBound.x=g(this.lowerBound.x,t.lowerBound.x),this.lowerBound.y=g(this.lowerBound.y,t.lowerBound.y),this.upperBound.x=x(this.upperBound.x,t.upperBound.x),this.upperBound.y=x(this.upperBound.y,t.upperBound.y),this},t.prototype.Combine2=function(t,e){return this.lowerBound.x=g(t.lowerBound.x,e.lowerBound.x),this.lowerBound.y=g(t.lowerBound.y,e.lowerBound.y),this.upperBound.x=x(t.upperBound.x,e.upperBound.x),this.upperBound.y=x(t.upperBound.y,e.upperBound.y),this},t.Combine=function(t,e,i){return i.Combine2(t,e),i},t.prototype.Contains=function(t){var e=!0;return e=(e=(e=(e=e&&this.lowerBound.x<=t.lowerBound.x)&&this.lowerBound.y<=t.lowerBound.y)&&t.upperBound.x<=this.upperBound.x)&&t.upperBound.y<=this.upperBound.y},t.prototype.RayCast=function(t,e){var r=-i,s=i,o=e.p1.x,a=e.p1.y,c=e.p2.x-e.p1.x,l=e.p2.y-e.p1.y,h=v(c),u=v(l),_=t.normal;if(h(y=(this.upperBound.x-o)*f)){var p=m;m=y,y=p,d=1}if(m>r&&(_.x=d,_.y=0,r=m),r>(s=g(s,y)))return!1}if(u(y=(this.upperBound.y-a)*f)){p=m;m=y,y=p,d=1}if(m>r&&(_.x=0,_.y=d,r=m),r>(s=g(s,y)))return!1}return!(r<0||e.maxFraction0||i>0)&&!(n>0||r>0)},t})();function Et(t,e){var i=e.lowerBound.x-t.upperBound.x,n=e.lowerBound.y-t.upperBound.y,r=t.lowerBound.x-e.upperBound.x,s=t.lowerBound.y-e.upperBound.y;return!(i>0||n>0)&&!(r>0||s>0)}function Bt(e,i,n,r,s){var o=0,a=i[0],c=i[1],l=P.DotVV(n,a.v)-r,h=P.DotVV(n,c.v)-r;if(l<=0&&e[o++].Copy(a),h<=0&&e[o++].Copy(c),l*h<0){var u=l/(l-h),_=e[o].v;_.x=a.v.x+u*(c.v.x-a.v.x),_.y=a.v.y+u*(c.v.y-a.v.y);var f=e[o].id;f.cf.indexA=s,f.cf.indexB=a.id.cf.indexB,f.cf.typeA=t.b2ContactFeatureType.e_vertex,f.cf.typeB=t.b2ContactFeatureType.e_face,++o}return o}var Mt=new J,It=new Y,Rt=new Z;function Pt(t,e,i,r,s,o){var a=Mt.Reset();a.proxyA.SetShape(t,e),a.proxyB.SetShape(i,r),a.transformA.Copy(s),a.transformB.Copy(o),a.useRadii=!0;var c=It.Reset();c.count=0;var l=Rt.Reset();return lt(l,c,a),l.distance<10*n}function Dt(t){if(null===t)throw new Error;return t}var Lt=(function(){function t(t){void 0===t&&(t=0),this.m_id=0,this.aabb=new wt,this.parent=null,this.child1=null,this.child2=null,this.height=0,this.m_id=t}return t.prototype.IsLeaf=function(){return null===this.child1},t})(),Ot=(function(){function t(){this.m_root=null,this.m_freeList=null,this.m_path=0,this.m_insertionCount=0,this.m_stack=new j(256)}return t.prototype.Query=function(t,e){if(null!==this.m_root){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(n.aabb.TestOverlap(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(Dt(n.child1)),i.Push(Dt(n.child2))}}},t.prototype.QueryPoint=function(t,e){if(null!==this.m_root){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(n.aabb.TestContain(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(Dt(n.child1)),i.Push(Dt(n.child2))}}},t.prototype.RayCast=function(e,i){if(null!==this.m_root){var n=e.p1,r=e.p2,s=P.SubVV(r,n,t.s_r);s.Normalize();var o=P.CrossOneV(s,t.s_v),a=P.AbsV(o,t.s_abs_v),c=e.maxFraction,l=t.s_segmentAABB,h=n.x+c*(r.x-n.x),u=n.y+c*(r.y-n.y);l.lowerBound.x=g(n.x,h),l.lowerBound.y=g(n.y,u),l.upperBound.x=x(n.x,h),l.upperBound.y=x(n.y,u);var _=this.m_stack.Reset();for(_.Push(this.m_root);_.GetCount()>0;){var f=_.Pop();if(Et(f.aabb,l)){var d=f.aabb.GetCenter(),p=f.aabb.GetExtents();if(!(v(P.DotVV(o,P.SubVV(n,d,P.s_t0)))-P.DotVV(a,p)>0))if(f.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=c;var y=i(m,f);if(0===y)return;y>0&&(c=y,h=n.x+c*(r.x-n.x),u=n.y+c*(r.y-n.y),l.lowerBound.x=g(n.x,h),l.lowerBound.y=g(n.y,u),l.upperBound.x=x(n.x,h),l.upperBound.y=x(n.y,u))}else _.Push(Dt(f.child1)),_.Push(Dt(f.child2))}}}},t.prototype.AllocateNode=function(){if(this.m_freeList){var e=this.m_freeList;return this.m_freeList=e.parent,e.parent=null,e.child1=null,e.child2=null,e.height=0,delete e.userData,e}return new Lt(t.s_node_id++)},t.prototype.FreeNode=function(t){t.parent=this.m_freeList,t.child1=null,t.child2=null,t.height=-1,delete t.userData,this.m_freeList=t},t.prototype.CreateProxy=function(t,e){var i=this.AllocateNode();return i.aabb.lowerBound.x=t.lowerBound.x-.1,i.aabb.lowerBound.y=t.lowerBound.y-.1,i.aabb.upperBound.x=t.upperBound.x+.1,i.aabb.upperBound.y=t.upperBound.y+.1,i.userData=e,i.height=0,this.InsertLeaf(i),i},t.prototype.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},t.prototype.MoveProxy=function(t,e,i){if(t.aabb.Contains(e))return!1;this.RemoveLeaf(t);var n=.1+2*(i.x>0?i.x:-i.x),r=.1+2*(i.y>0?i.y:-i.y);return t.aabb.lowerBound.x=e.lowerBound.x-n,t.aabb.lowerBound.y=e.lowerBound.y-r,t.aabb.upperBound.x=e.upperBound.x+n,t.aabb.upperBound.y=e.upperBound.y+r,this.InsertLeaf(t),!0},t.prototype.InsertLeaf=function(e){if(++this.m_insertionCount,null===this.m_root)return this.m_root=e,void(this.m_root.parent=null);for(var i=e.aabb,n=this.m_root;!n.IsLeaf();){var r=Dt(n.child1),s=Dt(n.child2),o=n.aabb.GetPerimeter(),a=t.s_combinedAABB;a.Combine2(n.aabb,i);var c=a.GetPerimeter(),l=2*c,h=2*(c-o),u=void 0,_=t.s_aabb,f=void 0;r.IsLeaf()?(_.Combine2(i,r.aabb),u=_.GetPerimeter()+h):(_.Combine2(i,r.aabb),f=r.aabb.GetPerimeter(),u=_.GetPerimeter()-f+h);var d=void 0;if(s.IsLeaf()?(_.Combine2(i,s.aabb),d=_.GetPerimeter()+h):(_.Combine2(i,s.aabb),f=s.aabb.GetPerimeter(),d=_.GetPerimeter()-f+h),l1){var r=Dt(i.child1),s=Dt(i.child2);return i.child1=t,i.parent=t.parent,t.parent=i,null!==i.parent?i.parent.child1===t?i.parent.child1=i:i.parent.child2=i:this.m_root=i,r.height>s.height?(i.child2=r,t.child2=s,s.parent=t,t.aabb.Combine2(e.aabb,s.aabb),i.aabb.Combine2(t.aabb,r.aabb),t.height=1+x(e.height,s.height),i.height=1+x(t.height,r.height)):(i.child2=s,t.child2=r,r.parent=t,t.aabb.Combine2(e.aabb,r.aabb),i.aabb.Combine2(t.aabb,s.aabb),t.height=1+x(e.height,r.height),i.height=1+x(t.height,s.height)),i}if(n<-1){var o=Dt(e.child1),a=Dt(e.child2);return e.child1=t,e.parent=t.parent,t.parent=e,null!==e.parent?e.parent.child1===t?e.parent.child1=e:e.parent.child2=e:this.m_root=e,o.height>a.height?(e.child2=o,t.child1=a,a.parent=t,t.aabb.Combine2(i.aabb,a.aabb),e.aabb.Combine2(t.aabb,o.aabb),t.height=1+x(i.height,a.height),e.height=1+x(t.height,o.height)):(e.child2=a,t.child1=o,o.parent=t,t.aabb.Combine2(i.aabb,o.aabb),e.aabb.Combine2(t.aabb,a.aabb),t.height=1+x(i.height,o.height),e.height=1+x(t.height,a.height)),e}return t},t.prototype.GetHeight=function(){return null===this.m_root?0:this.m_root.height},t.GetAreaNode=function(e){if(null===e)return 0;if(e.IsLeaf())return 0;var i=e.aabb.GetPerimeter();return i+=t.GetAreaNode(e.child1),i+=t.GetAreaNode(e.child2)},t.prototype.GetAreaRatio=function(){if(null===this.m_root)return 0;var e=this.m_root.aabb.GetPerimeter();return t.GetAreaNode(this.m_root)/e},t.prototype.ComputeHeightNode=function(t){if(!t||t.IsLeaf())return 0;var e=this.ComputeHeightNode(t.child1),i=this.ComputeHeightNode(t.child2);return 1+x(e,i)},t.prototype.ComputeHeight=function(){return this.ComputeHeightNode(this.m_root)},t.prototype.ValidateStructure=function(t){if(null!==t){this.m_root;var e=t;if(!e.IsLeaf()){var i=Dt(e.child1),n=Dt(e.child2);this.ValidateStructure(i),this.ValidateStructure(n)}}},t.prototype.ValidateMetrics=function(e){if(null!==e){var i=e;if(!i.IsLeaf()){var n=Dt(i.child1),r=Dt(i.child2);t.s_aabb.Combine2(n.aabb,r.aabb),this.ValidateMetrics(n),this.ValidateMetrics(r)}}},t.prototype.Validate=function(){},t.GetMaxBalanceNode=function(t,e){if(null===t)return e;if(t.height<=1)return e;var i=Dt(t.child1),n=Dt(t.child2),r=v(n.height-i.height);return x(e,r)},t.prototype.GetMaxBalance=function(){return t.GetMaxBalanceNode(this.m_root,0)},t.prototype.RebuildBottomUp=function(){this.Validate()},t.ShiftOriginNode=function(e,i){if(null!==e&&!(e.height<=1)){var n=e.child1,r=e.child2;t.ShiftOriginNode(n,i),t.ShiftOriginNode(r,i),e.aabb.lowerBound.SelfSub(i),e.aabb.upperBound.SelfSub(i)}},t.prototype.ShiftOrigin=function(e){t.ShiftOriginNode(this.m_root,e)},t.s_r=new P,t.s_v=new P,t.s_abs_v=new P,t.s_segmentAABB=new wt,t.s_subInput=new St,t.s_combinedAABB=new wt,t.s_aabb=new wt,t.s_node_id=0,t})(),Vt=(function(){return function(t,e){this.proxyA=t,this.proxyB=e}})(),Ft=(function(){function t(){this.m_tree=new Ot,this.m_proxyCount=0,this.m_moveCount=0,this.m_moveBuffer=[],this.m_pairCount=0,this.m_pairBuffer=[]}return t.prototype.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},t.prototype.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},t.prototype.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},t.prototype.TouchProxy=function(t){this.BufferMove(t)},t.prototype.GetProxyCount=function(){return this.m_proxyCount},t.prototype.UpdatePairs=function(t){var e=this;this.m_pairCount=0;for(var i=function(t){var i=n.m_moveBuffer[t];if(null===i)return"continue";var r=i.aabb;n.m_tree.Query(r,(function(t){if(t.m_id===i.m_id)return!0;var n,r;if(t.m_id_+f){e.state=t.b2TOIOutputState.e_separated,e.t=h,S=!0;break}if(M>_-f){d=T;break}var I=b.Evaluate(E[0],B[0],d);if(I<_-f){e.state=t.b2TOIOutputState.e_failed,e.t=d,S=!0;break}if(I<=_+f){e.state=t.b2TOIOutputState.e_touching,e.t=d,S=!0;break}for(var R=0,P=d,D=T;;){var L=0;L=1&R?P+(_-I)*(D-P)/(M-I):.5*(P+D),++R,++t.b2_toiRootIters;var O=b.Evaluate(E[0],B[0],L);if(v(O-_)_?(P=L,I=O):(D=L,M=O),50===R)break}if(t.b2_toiMaxRootIters=x(t.b2_toiMaxRootIters,R),++w===a)break}if(++p,++t.b2_toiIters,S)break;if(20===p){e.state=t.b2TOIOutputState.e_failed,e.t=d;break}}t.b2_toiMaxIters=x(t.b2_toiMaxIters,p);var V=n.GetMilliseconds();t.b2_toiMaxTime=x(t.b2_toiMaxTime,V),t.b2_toiTime+=V}var se=new P,oe=new P;function ae(e,i,n,r,s){e.pointCount=0;var o=N.MulXV(n,i.m_p,se),a=N.MulXV(s,r.m_p,oe),c=P.DistanceSquaredVV(o,a),l=i.m_radius+r.m_radius;c>l*l||(e.type=t.b2ManifoldType.e_circles,e.localPoint.Copy(i.m_p),e.localNormal.SetZero(),e.pointCount=1,e.points[0].localPoint.Copy(r.m_p),e.points[0].id.key=0)}var ce=new P,le=new P,he=new P;function ue(e,r,s,o,a){e.pointCount=0;for(var c=N.MulXV(a,o.m_p,ce),l=N.MulTXV(s,c,le),h=0,u=-i,_=r.m_radius+o.m_radius,f=r.m_count,d=r.m_vertices,p=r.m_normals,m=0;m_)return;y>u&&(u=y,h=m)}var v=h,g=(v+1)%f,x=d[v],C=d[g];if(u_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,P.SubVV(l,x,e.localNormal).SelfNormalize(),e.localPoint.Copy(x),e.points[0].localPoint.Copy(o.m_p),e.points[0].id.key=0}else if(b<=0){if(P.DistanceSquaredVV(l,C)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,P.SubVV(l,C,e.localNormal).SelfNormalize(),e.localPoint.Copy(C),e.points[0].localPoint.Copy(o.m_p),e.points[0].id.key=0}else{var S=P.MidVV(x,C,he);if(P.DotVV(P.SubVV(l,S,P.s_t1),p[v])>_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[v]).SelfNormalize(),e.localPoint.Copy(S),e.points[0].localPoint.Copy(o.m_p),e.points[0].id.key=0}}var _e=new P,fe=new P,de=new P,pe=new P;function me(t,e,n,r,s){for(var o=t.m_vertices,a=t.m_normals,c=r.m_count,l=r.m_vertices,h=F.MulRV(e.q,a[n],_e),u=F.MulTRV(s.q,h,fe),_=0,f=i,d=0;du&&(u=f,h=_)}var d=me(e,n,h,r,s),p=(h+o-1)%o,m=me(e,n,p,r,s),y=(h+1)%o,v=me(e,n,y,r,s),g=0,x=0,C=0;if(m>d&&m>v)C=-1,g=p,x=m;else{if(!(v>d))return t[0]=h,d;C=1,g=y,x=v}for(;(d=me(e,n,h=-1===C?(g+o-1)%o:(g+1)%o,r,s))>x;)g=h,x=d;return t[0]=g,x}var xe=new P;function Ce(e,n,r,s,o,a){for(var c=n.m_normals,l=o.m_count,h=o.m_vertices,u=o.m_normals,_=F.MulTRV(a.q,F.MulRV(r.q,c[s],P.s_t0),xe),f=0,d=i,p=0;pa)){var h=we;h[0]=0;var u=ge(h,r,s,i,n);if(!(u>a)){var _,f,d,p,m=0,y=0;u>.98*l+.001?(_=r,f=i,d=s,p=n,m=h[0],e.type=t.b2ManifoldType.e_faceB,y=1):(_=i,f=r,d=n,p=s,m=c[0],e.type=t.b2ManifoldType.e_faceA,y=0);var v=Ae;Ce(v,_,d,m,f,p);var g=_.m_count,x=_.m_vertices,C=m,A=(m+1)%g,b=x[C],S=x[A],T=P.SubVV(S,b,Ee);T.Normalize();var w=P.CrossVOne(T,Be),E=P.MidVV(b,S,Me),B=F.MulRV(d.q,T,Re),M=P.CrossVOne(B,Ie),I=N.MulXV(d,b,De),R=N.MulXV(d,S,Le),D=P.DotVV(M,I),L=-P.DotVV(B,I)+a,O=P.DotVV(B,R)+a,V=be,G=Se;if(!(Bt(V,v,P.NegV(B,Pe),L,C)<2||Bt(G,V,B,O,A)<2)){e.localNormal.Copy(w),e.localPoint.Copy(E);for(var k=0,z=0;z_*_)return;if(i.m_hasVertex0){var m=i.m_vertex0,y=a,v=P.SubVV(y,m,Ge);if(P.DotVV(v,P.SubVV(y,o,P.s_t0))>0)return}return f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(d),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}if(h<=0){var g=c,x=P.SubVV(o,g,Ne);if(P.DotVV(x,x)>_*_)return;if(i.m_hasVertex3){var C=i.m_vertex3,A=c,b=P.SubVV(C,A,ke);if(P.DotVV(b,P.SubVV(o,A,P.s_t0))>0)return}return f.cf.indexA=1,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(g),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}var S=P.DotVV(l,l),T=ze;T.x=1/S*(h*a.x+u*c.x),T.y=1/S*(h*a.y+u*c.y);var w=P.SubVV(o,T,Ne);if(!(P.DotVV(w,w)>_*_)){var E=Ue.Set(-l.y,l.x);P.DotVV(E,P.SubVV(o,a,P.s_t0))<0&&E.Set(-E.x,-E.y),E.Normalize(),f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(E),e.localPoint.Copy(a),e.points[0].id.Copy(f),e.points[0].localPoint.Copy(r.m_p)}}var He=(function(){return function(){this.type=0,this.index=0,this.separation=0}})(),qe=(function(){return function(){this.vertices=P.MakeArray(a),this.normals=P.MakeArray(a),this.count=0}})(),Xe=(function(){return function(){this.i1=0,this.i2=0,this.v1=new P,this.v2=new P,this.normal=new P,this.sideNormal1=new P,this.sideOffset1=0,this.sideNormal2=new P,this.sideOffset2=0}})(),Ye=new(function(){function e(){this.m_polygonB=new qe,this.m_xf=new N,this.m_centroidB=new P,this.m_v0=new P,this.m_v1=new P,this.m_v2=new P,this.m_v3=new P,this.m_normal0=new P,this.m_normal1=new P,this.m_normal2=new P,this.m_normal=new P,this.m_type1=0,this.m_type2=0,this.m_lowerLimit=new P,this.m_upperLimit=new P,this.m_radius=0,this.m_front=!1}return e.prototype.Collide=function(i,n,r,s,a){N.MulTXX(r,a,this.m_xf),N.MulXV(this.m_xf,s.m_centroid,this.m_centroidB),this.m_v0.Copy(n.m_vertex0),this.m_v1.Copy(n.m_vertex1),this.m_v2.Copy(n.m_vertex2),this.m_v3.Copy(n.m_vertex3);var c=n.m_hasVertex0,l=n.m_hasVertex3,h=P.SubVV(this.m_v2,this.m_v1,e.s_edge1);h.Normalize(),this.m_normal1.Set(h.y,-h.x);var u=P.DotVV(this.m_normal1,P.SubVV(this.m_centroidB,this.m_v1,P.s_t0)),_=0,f=0,d=!1,p=!1;if(c){var m=P.SubVV(this.m_v1,this.m_v0,e.s_edge0);m.Normalize(),this.m_normal0.Set(m.y,-m.x),d=P.CrossVV(m,h)>=0,_=P.DotVV(this.m_normal0,P.SubVV(this.m_centroidB,this.m_v0,P.s_t0))}if(l){var y=P.SubVV(this.m_v3,this.m_v2,e.s_edge2);y.Normalize(),this.m_normal2.Set(y.y,-y.x),p=P.CrossVV(h,y)>0,f=P.DotVV(this.m_normal2,P.SubVV(this.m_centroidB,this.m_v2,P.s_t0))}c&&l?d&&p?(this.m_front=_>=0||u>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):d?(this.m_front=_>=0||u>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):p?(this.m_front=f>=0||_>=0&&u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):(this.m_front=_>=0&&u>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):c?d?(this.m_front=_>=0||u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):(this.m_front=_>=0&&u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):l?p?(this.m_front=u>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=u>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=u>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1))),this.m_polygonB.count=s.m_count;for(var v=0;vthis.m_radius)){var x=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(0!==x.type&&x.separation>this.m_radius)){var C;C=0===x.type?g:x.separation>.98*g.separation+.001?x:g;var A=e.s_ie,b=e.s_rf;if(1===C.type){i.type=t.b2ManifoldType.e_faceA;var S=0,T=P.DotVV(this.m_normal,this.m_polygonB.normals[0]);for(v=1;vthis.m_radius)return n.type=2,n.index=s,n.separation=h,n;if(P.DotVV(o,r)>=0){if(P.DotVV(P.SubVV(o,this.m_upperLimit,P.s_t0),this.m_normal)<-l)continue}else if(P.DotVV(P.SubVV(o,this.m_lowerLimit,P.s_t0),this.m_normal)<-l)continue;h>n.separation&&(n.type=2,n.index=s,n.separation=h)}return n},e.s_edge1=new P,e.s_edge0=new P,e.s_edge2=new P,e.s_ie=bt.MakeArray(2),e.s_rf=new Xe,e.s_clipPoints1=bt.MakeArray(2),e.s_clipPoints2=bt.MakeArray(2),e.s_edgeAxis=new He,e.s_polygonAxis=new He,e.s_n=new P,e.s_perp=new P,e}());function Je(t,e,i,n,r){Ye.Collide(t,e,i,n,r)}var Ze=(function(){return function(){this.mass=0,this.center=new P(0,0),this.I=0}})();(function(t){t[t.e_unknown=-1]="e_unknown",t[t.e_circleShape=0]="e_circleShape",t[t.e_edgeShape=1]="e_edgeShape",t[t.e_polygonShape=2]="e_polygonShape",t[t.e_chainShape=3]="e_chainShape",t[t.e_shapeTypeCount=4]="e_shapeTypeCount"})(t.b2ShapeType||(t.b2ShapeType={}));var Ke=(function(){function e(e,i){this.m_type=t.b2ShapeType.e_unknown,this.m_radius=0,this.m_type=e,this.m_radius=i}return e.prototype.Copy=function(t){return this.m_radius=t.m_radius,this},e.prototype.GetType=function(){return this.m_type},e})(),Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};function $e(t,e){function i(){this.constructor=t}Qe(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var ti=(function(e){function i(i){void 0===i&&(i=0);var n=e.call(this,t.b2ShapeType.e_circleShape,i)||this;return n.m_p=new P,n}return $e(i,e),i.prototype.Set=function(t,e){return void 0===e&&(e=this.m_radius),this.m_p.Copy(t),this.m_radius=e,this},i.prototype.Clone=function(){return(new i).Copy(this)},i.prototype.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_p.Copy(t.m_p),this},i.prototype.GetChildCount=function(){return 1},i.prototype.TestPoint=function(t,e){var n=N.MulXV(t,this.m_p,i.TestPoint_s_center),r=P.SubVV(e,n,i.TestPoint_s_d);return P.DotVV(r,r)<=b(this.m_radius)},i.prototype.ComputeDistance=function(t,e,n,r){var s=N.MulXV(t,this.m_p,i.ComputeDistance_s_center);return P.SubVV(e,s,n),n.Normalize()-this.m_radius},i.prototype.RayCast=function(t,e,r,s){var o=N.MulXV(r,this.m_p,i.RayCast_s_position),a=P.SubVV(e.p1,o,i.RayCast_s_s),c=P.DotVV(a,a)-b(this.m_radius),l=P.SubVV(e.p2,e.p1,i.RayCast_s_r),h=P.DotVV(a,l),u=P.DotVV(l,l),_=h*h-u*c;if(_<0||uthis.m_radius)return r.Copy(o),s*this.m_radius*this.m_radius;var c=this.m_radius*this.m_radius,l=a*a,h=c*(I(a/this.m_radius)+s/2)+a*T(c-l),u=-2/3*w(c-l,1.5)/h;return r.x=o.x+t.x*u,r.y=o.y+t.y*u,h},i.prototype.Dump=function(t){t(" const shape: b2CircleShape = new b2CircleShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_p.Set(%.15f, %.15f);\n",this.m_p.x,this.m_p.y)},i.TestPoint_s_center=new P,i.TestPoint_s_d=new P,i.ComputeDistance_s_center=new P,i.RayCast_s_position=new P,i.RayCast_s_s=new P,i.RayCast_s_r=new P,i.ComputeAABB_s_p=new P,i})(Ke),ei=(function(e){function r(){var i=e.call(this,t.b2ShapeType.e_polygonShape,h)||this;return i.m_centroid=new P(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}return $e(r,e),r.prototype.Clone=function(){return(new r).Copy(this)},r.prototype.Copy=function(t){e.prototype.Copy.call(this,t),this.m_centroid.Copy(t.m_centroid),this.m_count=t.m_count,this.m_vertices=P.MakeArray(this.m_count),this.m_normals=P.MakeArray(this.m_count);for(var i=0;id||p===d&&s[l].yC.LengthSquared()&&(x=_)}else x=_;if(++y,v=x,x===f)break}this.m_count=y,this.m_vertices=P.MakeArray(this.m_count),this.m_normals=P.MakeArray(this.m_count);for(l=0;l0)return!1}return!0},r.prototype.ComputeDistance=function(t,e,n,s){for(var o=N.MulTXV(t,e,r.ComputeDistance_s_pLocal),a=-i,c=r.ComputeDistance_s_normalForMaxDistance.Copy(o),l=0;la&&(a=h,c.Copy(this.m_normals[l]))}if(a>0){var u=r.ComputeDistance_s_minDistance.Copy(c),_=a*a;for(l=0;ld&&(u.Copy(f),_=d)}return F.MulRV(t.q,u,n),n.Normalize(),Math.sqrt(_)}return F.MulRV(t.q,c,n),a},r.prototype.RayCast=function(t,e,i,n){for(var s=N.MulTXV(i,e.p1,r.RayCast_s_p1),o=N.MulTXV(i,e.p2,r.RayCast_s_p2),a=P.SubVV(o,s,r.RayCast_s_d),c=0,l=e.maxFraction,h=-1,u=0;u0&&_=0&&(t.fraction=c,F.MulRV(i.q,this.m_normals[h],t.normal),!0)},r.prototype.ComputeAABB=function(t,e,i){for(var n=N.MulXV(e,this.m_vertices[0],t.lowerBound),s=t.upperBound.Copy(n),o=0;o0&&(d?_||(h=f-1,l++):_&&(u=f-1,l++)),_=d}switch(l){case 0:if(_){var p=r.ComputeSubmergedArea_s_md;return this.ComputeMass(p,1),N.MulXV(i,p.center,s),p.mass}return 0;case 1:-1===h?h=this.m_count-1:u=this.m_count-1}for(var m,y=(h+1)%this.m_count,v=(u+1)%this.m_count,g=(0-c[h])/(c[y]-c[h]),x=(0-c[u])/(c[v]-c[u]),C=r.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[h].x*(1-g)+this.m_vertices[y].x*g,this.m_vertices[h].y*(1-g)+this.m_vertices[y].y*g),A=r.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[u].x*(1-x)+this.m_vertices[v].x*x,this.m_vertices[u].y*(1-x)+this.m_vertices[v].y*x),b=0,S=r.ComputeSubmergedArea_s_center.SetZero(),T=this.m_vertices[y],w=y;w!==v;){m=(w=(w+1)%this.m_count)===v?A:this.m_vertices[w];var E=.5*((T.x-C.x)*(m.y-C.y)-(T.y-C.y)*(m.x-C.x));b+=E,S.x+=E*(C.x+T.x+m.x)/3,S.y+=E*(C.y+T.y+m.y)/3,T=m}return S.SelfMul(1/b),N.MulXV(i,S,s),b},r.prototype.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = b2Vec2.MakeArray(%d);\n",a);for(var e=0;e0){var h=P.DotVV(c,c);l>h?P.SubVV(e,o,a):a.SelfMulSub(l/h,c)}return n.Copy(a),n.Normalize()},i.prototype.RayCast=function(t,e,n,r){var s=N.MulTXV(n,e.p1,i.RayCast_s_p1),o=N.MulTXV(n,e.p2,i.RayCast_s_p2),a=P.SubVV(o,s,i.RayCast_s_d),c=this.m_vertex1,l=this.m_vertex2,h=P.SubVV(l,c,i.RayCast_s_e),u=t.normal.Set(h.y,-h.x).SelfNormalize(),_=P.DotVV(u,P.SubVV(c,s,P.s_t0)),f=P.DotVV(u,a);if(0===f)return!1;var d=_/f;if(d<0||e.maxFraction0&&t.normal.SelfNeg(),!0)},i.prototype.ComputeAABB=function(t,e,n){var r=N.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),s=N.MulXV(e,this.m_vertex2,i.ComputeAABB_s_v2);P.MinV(r,s,t.lowerBound),P.MaxV(r,s,t.upperBound);var o=this.m_radius;t.lowerBound.SelfSubXY(o,o),t.upperBound.SelfAddXY(o,o)},i.prototype.ComputeMass=function(t,e){t.mass=0,P.MidVV(this.m_vertex1,this.m_vertex2,t.center),t.I=0},i.prototype.SetupDistanceProxy=function(t,e){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertex1),t.m_vertices[1].Copy(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},i.prototype.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},i.prototype.Dump=function(t){t(" const shape: b2EdgeShape = new b2EdgeShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_vertex0.Set(%.15f, %.15f);\n",this.m_vertex0.x,this.m_vertex0.y),t(" shape.m_vertex1.Set(%.15f, %.15f);\n",this.m_vertex1.x,this.m_vertex1.y),t(" shape.m_vertex2.Set(%.15f, %.15f);\n",this.m_vertex2.x,this.m_vertex2.y),t(" shape.m_vertex3.Set(%.15f, %.15f);\n",this.m_vertex3.x,this.m_vertex3.y),t(" shape.m_hasVertex0 = %s;\n",this.m_hasVertex0),t(" shape.m_hasVertex3 = %s;\n",this.m_hasVertex3)},i.ComputeDistance_s_v1=new P,i.ComputeDistance_s_v2=new P,i.ComputeDistance_s_d=new P,i.ComputeDistance_s_s=new P,i.RayCast_s_p1=new P,i.RayCast_s_p2=new P,i.RayCast_s_d=new P,i.RayCast_s_e=new P,i.RayCast_s_q=new P,i.RayCast_s_r=new P,i.ComputeAABB_s_v1=new P,i.ComputeAABB_s_v2=new P,i})(Ke),ni=(function(e){function i(){var i=e.call(this,t.b2ShapeType.e_chainShape,h)||this;return i.m_vertices=[],i.m_count=0,i.m_prevVertex=new P,i.m_nextVertex=new P,i.m_hasPrevVertex=!1,i.m_hasNextVertex=!1,i}return $e(i,e),i.prototype.CreateLoop=function(t,e,i){if(void 0===e&&(e=t.length),void 0===i&&(i=0),e<3)return this;this.m_count=e+1,this.m_vertices=P.MakeArray(this.m_count);for(var n=0;n0?(e.m_vertex0.Copy(this.m_vertices[i-1]),e.m_hasVertex0=!0):(e.m_vertex0.Copy(this.m_prevVertex),e.m_hasVertex0=this.m_hasPrevVertex),i0&&this.ResetMassData(),this.m_world.m_newFixture=!0,e},i.prototype.CreateFixtureShapeDensity=function(t,e){void 0===e&&(e=0);var n=i.CreateFixtureShapeDensity_s_def;return n.shape=t,n.density=e,this.CreateFixtureDef(n)},i.prototype.DestroyFixture=function(t){if(this.m_world.IsLocked())throw new Error;for(var e=this.m_fixtureList,i=null;null!==e;){if(e===t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}i=e,e=e.m_next}for(var n=this.m_contactList;n;){var r=n.contact;n=n.next;var s=r.GetFixtureA(),o=r.GetFixtureB();t!==s&&t!==o||this.m_world.m_contactManager.Destroy(r)}this.m_activeFlag&&t.DestroyProxies(),t.m_next=null,t.Destroy(),--this.m_fixtureCount,this.ResetMassData()},i.prototype.SetTransformVec=function(t,e){this.SetTransformXY(t.x,t.y,e)},i.prototype.SetTransformXY=function(t,e,i){if(this.m_world.IsLocked())throw new Error;this.m_xf.q.SetAngle(i),this.m_xf.p.Set(t,e),this.m_xf0.Copy(this.m_xf),N.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.a=i,this.m_sweep.c0.Copy(this.m_sweep.c),this.m_sweep.a0=i;for(var n=this.m_fixtureList;n;n=n.m_next)n.Synchronize(this.m_xf,this.m_xf);this.m_world.m_contactManager.FindNewContacts()},i.prototype.SetTransform=function(t){this.SetTransformVec(t.p,t.GetAngle())},i.prototype.GetTransform=function(){return this.m_xf},i.prototype.GetPosition=function(){return this.m_xf.p},i.prototype.SetPosition=function(t){this.SetTransformVec(t,this.GetAngle())},i.prototype.SetPositionXY=function(t,e){this.SetTransformXY(t,e,this.GetAngle())},i.prototype.GetAngle=function(){return this.m_sweep.a},i.prototype.SetAngle=function(t){this.SetTransformVec(this.GetPosition(),t)},i.prototype.GetWorldCenter=function(){return this.m_sweep.c},i.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter},i.prototype.SetLinearVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(P.DotVV(e,e)>0&&this.SetAwake(!0),this.m_linearVelocity.Copy(e))},i.prototype.GetLinearVelocity=function(){return this.m_linearVelocity},i.prototype.SetAngularVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(e*e>0&&this.SetAwake(!0),this.m_angularVelocity=e)},i.prototype.GetAngularVelocity=function(){return this.m_angularVelocity},i.prototype.GetDefinition=function(t){return t.type=this.GetType(),t.allowSleep=this.m_autoSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.gravityScale=this.m_gravityScale,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=this.m_fixedRotationFlag,t.bullet=this.m_bulletFlag,t.awake=this.m_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.Copy(this.GetLinearVelocity()),t.position.Copy(this.GetPosition()),t.userData=this.GetUserData(),t},i.prototype.ApplyForce=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y,this.m_torque+=(i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x))},i.prototype.ApplyForceToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y))},i.prototype.ApplyTorque=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_torque+=e))},i.prototype.ApplyLinearImpulse=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y,this.m_angularVelocity+=this.m_invI*((i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x)))},i.prototype.ApplyLinearImpulseToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y))},i.prototype.ApplyAngularImpulse=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*e))},i.prototype.GetMass=function(){return this.m_mass},i.prototype.GetInertia=function(){return this.m_I+this.m_mass*P.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter)},i.prototype.GetMassData=function(t){return t.mass=this.m_mass,t.I=this.m_I+this.m_mass*P.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter),t.center.Copy(this.m_sweep.localCenter),t},i.prototype.SetMassData=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type===t.b2BodyType.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=e.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,e.I>0&&!this.m_fixedRotationFlag&&(this.m_I=e.I-this.m_mass*P.DotVV(e.center,e.center),this.m_invI=1/this.m_I);var n=i.SetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e.center),N.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),P.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,P.SubVV(this.m_sweep.c,n,P.s_t0),this.m_linearVelocity)}},i.prototype.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type===t.b2BodyType.b2_staticBody||this.m_type===t.b2BodyType.b2_kinematicBody)return this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var e=i.ResetMassData_s_localCenter.SetZero(),n=this.m_fixtureList;n;n=n.m_next)if(0!==n.m_density){var r=n.GetMassData(i.ResetMassData_s_massData);this.m_mass+=r.mass,e.x+=r.center.x*r.mass,e.y+=r.center.y*r.mass,this.m_I+=r.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,e.x*=this.m_invMass,e.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&!this.m_fixedRotationFlag?(this.m_I-=this.m_mass*P.DotVV(e,e),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var s=i.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(e),N.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),P.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,P.SubVV(this.m_sweep.c,s,P.s_t0),this.m_linearVelocity)},i.prototype.GetWorldPoint=function(t,e){return N.MulXV(this.m_xf,t,e)},i.prototype.GetWorldVector=function(t,e){return F.MulRV(this.m_xf.q,t,e)},i.prototype.GetLocalPoint=function(t,e){return N.MulTXV(this.m_xf,t,e)},i.prototype.GetLocalVector=function(t,e){return F.MulTRV(this.m_xf.q,t,e)},i.prototype.GetLinearVelocityFromWorldPoint=function(t,e){return P.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,P.SubVV(t,this.m_sweep.c,P.s_t0),e)},i.prototype.GetLinearVelocityFromLocalPoint=function(t,e){return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t,e),e)},i.prototype.GetLinearDamping=function(){return this.m_linearDamping},i.prototype.SetLinearDamping=function(t){this.m_linearDamping=t},i.prototype.GetAngularDamping=function(){return this.m_angularDamping},i.prototype.SetAngularDamping=function(t){this.m_angularDamping=t},i.prototype.GetGravityScale=function(){return this.m_gravityScale},i.prototype.SetGravityScale=function(t){this.m_gravityScale=t},i.prototype.SetType=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type!==e){this.m_type=e,this.ResetMassData(),this.m_type===t.b2BodyType.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sweep.a0=this.m_sweep.a,this.m_sweep.c0.Copy(this.m_sweep.c),this.SynchronizeFixtures()),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null;for(var r=this.m_fixtureList;r;r=r.m_next)r.TouchProxies()}},i.prototype.GetType=function(){return this.m_type},i.prototype.SetBullet=function(t){this.m_bulletFlag=t},i.prototype.IsBullet=function(){return this.m_bulletFlag},i.prototype.SetSleepingAllowed=function(t){this.m_autoSleepFlag=t,t||this.SetAwake(!0)},i.prototype.IsSleepingAllowed=function(){return this.m_autoSleepFlag},i.prototype.SetAwake=function(t){t?(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},i.prototype.IsAwake=function(){return this.m_awakeFlag},i.prototype.SetActive=function(t){if(this.m_world.IsLocked())throw new Error;if(t!==this.IsActive())if(this.m_activeFlag=t,t)for(var e=this.m_fixtureList;e;e=e.m_next)e.CreateProxies(this.m_xf);else{for(e=this.m_fixtureList;e;e=e.m_next)e.DestroyProxies();for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null}},i.prototype.IsActive=function(){return this.m_activeFlag},i.prototype.SetFixedRotation=function(t){this.m_fixedRotationFlag!==t&&(this.m_fixedRotationFlag=t,this.m_angularVelocity=0,this.ResetMassData())},i.prototype.IsFixedRotation=function(){return this.m_fixedRotationFlag},i.prototype.GetFixtureList=function(){return this.m_fixtureList},i.prototype.GetJointList=function(){return this.m_jointList},i.prototype.GetContactList=function(){return this.m_contactList},i.prototype.GetNext=function(){return this.m_next},i.prototype.GetUserData=function(){return this.m_userData},i.prototype.SetUserData=function(t){this.m_userData=t},i.prototype.GetWorld=function(){return this.m_world},i.prototype.Dump=function(e){var i=this.m_islandIndex;e("{\n"),e(" const bd: b2BodyDef = new b2BodyDef();\n");var n="";switch(this.m_type){case t.b2BodyType.b2_staticBody:n="b2BodyType.b2_staticBody";break;case t.b2BodyType.b2_kinematicBody:n="b2BodyType.b2_kinematicBody";break;case t.b2BodyType.b2_dynamicBody:n="b2BodyType.b2_dynamicBody"}e(" bd.type = %s;\n",n),e(" bd.position.Set(%.15f, %.15f);\n",this.m_xf.p.x,this.m_xf.p.y),e(" bd.angle = %.15f;\n",this.m_sweep.a),e(" bd.linearVelocity.Set(%.15f, %.15f);\n",this.m_linearVelocity.x,this.m_linearVelocity.y),e(" bd.angularVelocity = %.15f;\n",this.m_angularVelocity),e(" bd.linearDamping = %.15f;\n",this.m_linearDamping),e(" bd.angularDamping = %.15f;\n",this.m_angularDamping),e(" bd.allowSleep = %s;\n",this.m_autoSleepFlag?"true":"false"),e(" bd.awake = %s;\n",this.m_awakeFlag?"true":"false"),e(" bd.fixedRotation = %s;\n",this.m_fixedRotationFlag?"true":"false"),e(" bd.bullet = %s;\n",this.m_bulletFlag?"true":"false"),e(" bd.active = %s;\n",this.m_activeFlag?"true":"false"),e(" bd.gravityScale = %.15f;\n",this.m_gravityScale),e("\n"),e(" bodies[%d] = this.m_world.CreateBody(bd);\n",this.m_islandIndex),e("\n");for(var r=this.m_fixtureList;r;r=r.m_next)e(" {\n"),r.Dump(e,i),e(" }\n");e("}\n")},i.prototype.SynchronizeFixtures=function(){var t=i.SynchronizeFixtures_s_xf1;t.q.SetAngle(this.m_sweep.a0),F.MulRV(t.q,this.m_sweep.localCenter,t.p),P.SubVV(this.m_sweep.c0,t.p,t.p);for(var e=this.m_fixtureList;e;e=e.m_next)e.Synchronize(t,this.m_xf)},i.prototype.SynchronizeTransform=function(){this.m_xf.q.SetAngle(this.m_sweep.a),F.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),P.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},i.prototype.ShouldCollide=function(e){return(this.m_type!==t.b2BodyType.b2_staticBody||e.m_type!==t.b2BodyType.b2_staticBody)&&this.ShouldCollideConnected(e)},i.prototype.ShouldCollideConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other===t&&!e.joint.m_collideConnected)return!1;return!0},i.prototype.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.Copy(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_xf.q.SetAngle(this.m_sweep.a),F.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),P.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},i.prototype.GetControllerList=function(){return this.m_controllerList},i.prototype.GetControllerCount=function(){return this.m_controllerCount},i.CreateFixtureShapeDensity_s_def=new si,i.SetMassData_s_oldCenter=new P,i.ResetMassData_s_localCenter=new P,i.ResetMassData_s_oldCenter=new P,i.ResetMassData_s_massData=new Ze,i.SynchronizeFixtures_s_xf1=new N,i})();(function(t){t[t.e_unknownJoint=0]="e_unknownJoint",t[t.e_revoluteJoint=1]="e_revoluteJoint",t[t.e_prismaticJoint=2]="e_prismaticJoint",t[t.e_distanceJoint=3]="e_distanceJoint",t[t.e_pulleyJoint=4]="e_pulleyJoint",t[t.e_mouseJoint=5]="e_mouseJoint",t[t.e_gearJoint=6]="e_gearJoint",t[t.e_wheelJoint=7]="e_wheelJoint",t[t.e_weldJoint=8]="e_weldJoint",t[t.e_frictionJoint=9]="e_frictionJoint",t[t.e_ropeJoint=10]="e_ropeJoint",t[t.e_motorJoint=11]="e_motorJoint",t[t.e_areaJoint=12]="e_areaJoint"})(t.b2JointType||(t.b2JointType={})),(function(t){t[t.e_inactiveLimit=0]="e_inactiveLimit",t[t.e_atLowerLimit=1]="e_atLowerLimit",t[t.e_atUpperLimit=2]="e_atUpperLimit",t[t.e_equalLimits=3]="e_equalLimits"})(t.b2LimitState||(t.b2LimitState={}));var hi=(function(){function t(){this.linear=new P,this.angularA=0,this.angularB=0}return t.prototype.SetZero=function(){return this.linear.SetZero(),this.angularA=0,this.angularB=0,this},t.prototype.Set=function(t,e,i){return this.linear.Copy(t),this.angularA=e,this.angularB=i,this},t})(),ui=(function(){return function(t,e){this.prev=null,this.next=null,this.joint=t,this.other=e}})(),_i=(function(){return function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e}})(),fi=(function(){function i(i){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_index=0,this.m_islandFlag=!1,this.m_collideConnected=!1,this.m_userData=null,this.m_type=i.type,this.m_edgeA=new ui(this,i.bodyB),this.m_edgeB=new ui(this,i.bodyA),this.m_bodyA=i.bodyA,this.m_bodyB=i.bodyB,this.m_collideConnected=e(i.collideConnected,!1),this.m_userData=i.userData}return i.prototype.GetType=function(){return this.m_type},i.prototype.GetBodyA=function(){return this.m_bodyA},i.prototype.GetBodyB=function(){return this.m_bodyB},i.prototype.GetNext=function(){return this.m_next},i.prototype.GetUserData=function(){return this.m_userData},i.prototype.SetUserData=function(t){this.m_userData=t},i.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},i.prototype.GetCollideConnected=function(){return this.m_collideConnected},i.prototype.Dump=function(t){t("// Dump is not supported for this joint type.\n")},i.prototype.ShiftOrigin=function(t){},i})(),di=(function(e){function i(){var i=e.call(this,t.b2JointType.e_distanceJoint)||this;return i.localAnchorA=new P,i.localAnchorB=new P,i.length=1,i.frequencyHz=0,i.dampingRatio=0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(n,this.localAnchorB),this.length=P.DistanceVV(i,n),this.frequencyHz=0,this.dampingRatio=0},i})(_i),pi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_gamma=0,n.m_impulse=0,n.m_length=0,n.m_indexA=0,n.m_indexB=0,n.m_u=new P,n.m_rA=new P,n.m_rB=new P,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new F,n.m_qB=new F,n.m_lalcA=new P,n.m_lalcB=new P,n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_length=i.length,n}return $e(i,t),i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_u.x,e.y=t*this.m_impulse*this.m_u.y,e},i.prototype.GetReactionTorque=function(t){return 0},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.SetLength=function(t){this.m_length=t},i.prototype.Length=function(){return this.m_length},i.prototype.SetFrequency=function(t){this.m_frequencyHz=t},i.prototype.GetFrequency=function(){return this.m_frequencyHz},i.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetDampingRatio=function(){return this.m_dampingRatio},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.length = %.15f;\n",this.m_length),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,o=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,l=t.positions[this.m_indexB].a,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,_=this.m_qA.SetAngle(n),f=this.m_qB.SetAngle(l);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),F.MulRV(_,this.m_lalcA,this.m_rA),P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),F.MulRV(f,this.m_lalcB,this.m_rB),this.m_u.x=a.x+this.m_rB.x-e.x-this.m_rA.x,this.m_u.y=a.y+this.m_rB.y-e.y-this.m_rA.y;var d=this.m_u.Length();d>c?this.m_u.SelfMul(1/d):this.m_u.SetZero();var p=P.CrossVV(this.m_rA,this.m_u),m=P.CrossVV(this.m_rB,this.m_u),y=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==y?1/y:0,this.m_frequencyHz>0){var v=d-this.m_length,g=2*s*this.m_frequencyHz,x=2*this.m_mass*this.m_dampingRatio*g,C=this.m_mass*g*g,A=t.step.dt;this.m_gamma=A*(x+A*C),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*A*C*this.m_gamma,y+=this.m_gamma,this.m_mass=0!==y?1/y:0}else this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var b=P.MulSV(this.m_impulse,this.m_u,i.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,b),o-=this.m_invIA*P.CrossVV(this.m_rA,b),h.SelfMulAdd(this.m_invMassB,b),u+=this.m_invIB*P.CrossVV(this.m_rB,b)}else this.m_impulse=0;t.velocities[this.m_indexA].w=o,t.velocities[this.m_indexB].w=u},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,o=P.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),a=P.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),c=P.DotVV(this.m_u,P.SubVV(a,o,P.s_t0)),l=-this.m_mass*(c+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=l;var h=P.MulSV(l,this.m_u,i.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,h),n-=this.m_invIA*P.CrossVV(this.m_rA,h),r.SelfMulAdd(this.m_invMassB,h),s+=this.m_invIB*P.CrossVV(this.m_rB,h),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s),l=F.MulRV(o,this.m_lalcA,this.m_rA),h=F.MulRV(a,this.m_lalcB,this.m_rB),u=this.m_u;u.x=r.x+h.x-e.x-l.x,u.y=r.y+h.y-e.y-l.y;var _=this.m_u.Normalize()-this.m_length;_=C(_,-.2,.2);var f=-this.m_mass*_,d=P.MulSV(f,u,i.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,d),n-=this.m_invIA*P.CrossVV(l,d),r.SelfMulAdd(this.m_invMassB,d),s+=this.m_invIB*P.CrossVV(h,d),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,v(_)b(.2)&&f.SelfMul(.2/T(p)),p>b(c)&&(_=!1),a.x+=f.x,a.y+=f.y}return _},i})(fi),vi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_frictionJoint)||this;return i.localAnchorA=new P,i.localAnchorB=new P,i.maxForce=0,i.maxTorque=0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB)},i})(_i),gi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_linearImpulse=new P,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_indexA=0,n.m_indexB=0,n.m_rA=new P,n.m_rB=new P,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new O,n.m_angularMass=0,n.m_qA=new F,n.m_qB=new F,n.m_lalcA=new P,n.m_lalcB=new P,n.m_K=new O,n.m_localAnchorA.Copy(i.localAnchorA),n.m_localAnchorB.Copy(i.localAnchorB),n.m_linearImpulse.SetZero(),n.m_maxForce=e(i.maxForce,0),n.m_maxTorque=e(i.maxTorque,0),n.m_linearMass.SetZero(),n}return $e(i,t),i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].a,i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.positions[this.m_indexB].a,s=t.velocities[this.m_indexB].v,o=t.velocities[this.m_indexB].w,a=this.m_qA.SetAngle(e),c=this.m_qB.SetAngle(r);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var l=F.MulRV(a,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var h=F.MulRV(c,this.m_lalcB,this.m_rB),u=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=u+_+f*l.y*l.y+d*h.y*h.y,p.ex.y=-f*l.x*l.y-d*h.x*h.y,p.ey.x=p.ex.y,p.ey.y=u+_+f*l.x*l.x+d*h.x*h.x,p.GetInverse(this.m_linearMass),this.m_angularMass=f+d,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var m=this.m_linearImpulse;i.SelfMulSub(u,m),n-=f*(P.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(_,m),o+=d*(P.CrossVV(this.m_rB,m)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=o},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,o=this.m_invMassA,a=this.m_invMassB,c=this.m_invIA,l=this.m_invIB,h=t.step.dt,u=s-n,_=-this.m_angularMass*u,f=this.m_angularImpulse,d=h*this.m_maxTorque;this.m_angularImpulse=C(this.m_angularImpulse+_,-d,d),n-=c*(_=this.m_angularImpulse-f),s+=l*_;var p=P.SubVV(P.AddVCrossSV(r,s,this.m_rB,P.s_t0),P.AddVCrossSV(e,n,this.m_rA,P.s_t1),i.SolveVelocityConstraints_s_Cdot_v2),m=O.MulMV(this.m_linearMass,p,i.SolveVelocityConstraints_s_impulseV).SelfNeg(),y=i.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(m);d=h*this.m_maxForce;this.m_linearImpulse.LengthSquared()>d*d&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(d)),P.SubVV(this.m_linearImpulse,y,m),e.SelfMulSub(o,m),n-=c*P.CrossVV(this.m_rA,m),r.SelfMulAdd(a,m),s+=l*P.CrossVV(this.m_rB,m),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){return!0},i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_linearImpulse.x,e.y=t*this.m_linearImpulse.y,e},i.prototype.GetReactionTorque=function(t){return t*this.m_angularImpulse},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.SetMaxForce=function(t){this.m_maxForce=t},i.prototype.GetMaxForce=function(){return this.m_maxForce},i.prototype.SetMaxTorque=function(t){this.m_maxTorque=t},i.prototype.GetMaxTorque=function(){return this.m_maxTorque},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.SolveVelocityConstraints_s_Cdot_v2=new P,i.SolveVelocityConstraints_s_impulseV=new P,i.SolveVelocityConstraints_s_oldImpulseV=new P,i})(fi),xi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_gearJoint)||this;return i.ratio=1,i}return $e(i,e),i})(_i),Ci=(function(i){function n(n){var r,s,o=i.call(this,n)||this;o.m_typeA=t.b2JointType.e_unknownJoint,o.m_typeB=t.b2JointType.e_unknownJoint,o.m_localAnchorA=new P,o.m_localAnchorB=new P,o.m_localAnchorC=new P,o.m_localAnchorD=new P,o.m_localAxisC=new P,o.m_localAxisD=new P,o.m_referenceAngleA=0,o.m_referenceAngleB=0,o.m_constant=0,o.m_ratio=0,o.m_impulse=0,o.m_indexA=0,o.m_indexB=0,o.m_indexC=0,o.m_indexD=0,o.m_lcA=new P,o.m_lcB=new P,o.m_lcC=new P,o.m_lcD=new P,o.m_mA=0,o.m_mB=0,o.m_mC=0,o.m_mD=0,o.m_iA=0,o.m_iB=0,o.m_iC=0,o.m_iD=0,o.m_JvAC=new P,o.m_JvBD=new P,o.m_JwA=0,o.m_JwB=0,o.m_JwC=0,o.m_JwD=0,o.m_mass=0,o.m_qA=new F,o.m_qB=new F,o.m_qC=new F,o.m_qD=new F,o.m_lalcA=new P,o.m_lalcB=new P,o.m_lalcC=new P,o.m_lalcD=new P,o.m_joint1=n.joint1,o.m_joint2=n.joint2,o.m_typeA=o.m_joint1.GetType(),o.m_typeB=o.m_joint2.GetType(),o.m_bodyC=o.m_joint1.GetBodyA(),o.m_bodyA=o.m_joint1.GetBodyB();var a=o.m_bodyA.m_xf,c=o.m_bodyA.m_sweep.a,l=o.m_bodyC.m_xf,h=o.m_bodyC.m_sweep.a;if(o.m_typeA===t.b2JointType.e_revoluteJoint){var u=n.joint1;o.m_localAnchorC.Copy(u.m_localAnchorA),o.m_localAnchorA.Copy(u.m_localAnchorB),o.m_referenceAngleA=u.m_referenceAngle,o.m_localAxisC.SetZero(),r=c-h-o.m_referenceAngleA}else{var _=n.joint1;o.m_localAnchorC.Copy(_.m_localAnchorA),o.m_localAnchorA.Copy(_.m_localAnchorB),o.m_referenceAngleA=_.m_referenceAngle,o.m_localAxisC.Copy(_.m_localXAxisA);var f=o.m_localAnchorC,d=F.MulTRV(l.q,P.AddVV(F.MulRV(a.q,o.m_localAnchorA,P.s_t0),P.SubVV(a.p,l.p,P.s_t1),P.s_t0),P.s_t0);r=P.DotVV(P.SubVV(d,f,P.s_t0),o.m_localAxisC)}o.m_bodyD=o.m_joint2.GetBodyA(),o.m_bodyB=o.m_joint2.GetBodyB();var p=o.m_bodyB.m_xf,m=o.m_bodyB.m_sweep.a,y=o.m_bodyD.m_xf,v=o.m_bodyD.m_sweep.a;if(o.m_typeB===t.b2JointType.e_revoluteJoint){u=n.joint2;o.m_localAnchorD.Copy(u.m_localAnchorA),o.m_localAnchorB.Copy(u.m_localAnchorB),o.m_referenceAngleB=u.m_referenceAngle,o.m_localAxisD.SetZero(),s=m-v-o.m_referenceAngleB}else{_=n.joint2;o.m_localAnchorD.Copy(_.m_localAnchorA),o.m_localAnchorB.Copy(_.m_localAnchorB),o.m_referenceAngleB=_.m_referenceAngle,o.m_localAxisD.Copy(_.m_localXAxisA);var g=o.m_localAnchorD,x=F.MulTRV(y.q,P.AddVV(F.MulRV(p.q,o.m_localAnchorB,P.s_t0),P.SubVV(p.p,y.p,P.s_t1),P.s_t0),P.s_t0);s=P.DotVV(P.SubVV(x,g,P.s_t0),o.m_localAxisD)}return o.m_ratio=e(n.ratio,1),o.m_constant=r+o.m_ratio*s,o.m_impulse=0,o}return $e(n,i),n.prototype.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_indexC=this.m_bodyC.m_islandIndex,this.m_indexD=this.m_bodyD.m_islandIndex,this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter),this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter),this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].a,a=e.velocities[this.m_indexB].v,c=e.velocities[this.m_indexB].w,l=e.positions[this.m_indexC].a,h=e.velocities[this.m_indexC].v,u=e.velocities[this.m_indexC].w,_=e.positions[this.m_indexD].a,f=e.velocities[this.m_indexD].v,d=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(o),y=this.m_qC.SetAngle(l),v=this.m_qD.SetAngle(_);if(this.m_mass=0,this.m_typeA===t.b2JointType.e_revoluteJoint)this.m_JvAC.SetZero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var g=F.MulRV(y,this.m_localAxisC,n.InitVelocityConstraints_s_u);P.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var x=F.MulRV(y,this.m_lalcC,n.InitVelocityConstraints_s_rC);P.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var C=F.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(g),this.m_JwC=P.CrossVV(x,g),this.m_JwA=P.CrossVV(C,g),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{g=F.MulRV(v,this.m_localAxisD,n.InitVelocityConstraints_s_u);P.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var A=F.MulRV(v,this.m_lalcD,n.InitVelocityConstraints_s_rD);P.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var b=F.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);P.MulSV(this.m_ratio,g,this.m_JvBD),this.m_JwD=this.m_ratio*P.CrossVV(A,g),this.m_JwB=this.m_ratio*P.CrossVV(b,g),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB}this.m_mass=this.m_mass>0?1/this.m_mass:0,e.step.warmStarting?(r.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),s+=this.m_iA*this.m_impulse*this.m_JwA,a.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),c+=this.m_iB*this.m_impulse*this.m_JwB,h.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),u-=this.m_iC*this.m_impulse*this.m_JwC,f.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),d-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=c,e.velocities[this.m_indexC].w=u,e.velocities[this.m_indexD].w=d},n.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,o=t.velocities[this.m_indexC].w,a=t.velocities[this.m_indexD].v,c=t.velocities[this.m_indexD].w,l=P.DotVV(this.m_JvAC,P.SubVV(e,s,P.s_t0))+P.DotVV(this.m_JvBD,P.SubVV(n,a,P.s_t0));l+=this.m_JwA*i-this.m_JwC*o+(this.m_JwB*r-this.m_JwD*c);var h=-this.m_mass*l;this.m_impulse+=h,e.SelfMulAdd(this.m_mA*h,this.m_JvAC),i+=this.m_iA*h*this.m_JwA,n.SelfMulAdd(this.m_mB*h,this.m_JvBD),r+=this.m_iB*h*this.m_JwB,s.SelfMulSub(this.m_mC*h,this.m_JvAC),o-=this.m_iC*h*this.m_JwC,a.SelfMulSub(this.m_mD*h,this.m_JvBD),c-=this.m_iD*h*this.m_JwD,t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=r,t.velocities[this.m_indexC].w=o,t.velocities[this.m_indexD].w=c},n.prototype.SolvePositionConstraints=function(e){var i,r,s,o,a,l,h=e.positions[this.m_indexA].c,u=e.positions[this.m_indexA].a,_=e.positions[this.m_indexB].c,f=e.positions[this.m_indexB].a,d=e.positions[this.m_indexC].c,p=e.positions[this.m_indexC].a,m=e.positions[this.m_indexD].c,y=e.positions[this.m_indexD].a,v=this.m_qA.SetAngle(u),g=this.m_qB.SetAngle(f),x=this.m_qC.SetAngle(p),C=this.m_qD.SetAngle(y),A=this.m_JvAC,b=this.m_JvBD,S=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)A.SetZero(),s=1,a=1,S+=this.m_iA+this.m_iC,i=u-p-this.m_referenceAngleA;else{var T=F.MulRV(x,this.m_localAxisC,n.SolvePositionConstraints_s_u),w=F.MulRV(x,this.m_lalcC,n.SolvePositionConstraints_s_rC),E=F.MulRV(v,this.m_lalcA,n.SolvePositionConstraints_s_rA);A.Copy(T),a=P.CrossVV(w,T),s=P.CrossVV(E,T),S+=this.m_mC+this.m_mA+this.m_iC*a*a+this.m_iA*s*s;var B=this.m_lalcC,M=F.MulTRV(x,P.AddVV(E,P.SubVV(h,d,P.s_t0),P.s_t0),P.s_t0);i=P.DotVV(P.SubVV(M,B,P.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)b.SetZero(),o=this.m_ratio,l=this.m_ratio,S+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=f-y-this.m_referenceAngleB;else{T=F.MulRV(C,this.m_localAxisD,n.SolvePositionConstraints_s_u);var I=F.MulRV(C,this.m_lalcD,n.SolvePositionConstraints_s_rD),R=F.MulRV(g,this.m_lalcB,n.SolvePositionConstraints_s_rB);P.MulSV(this.m_ratio,T,b),l=this.m_ratio*P.CrossVV(I,T),o=this.m_ratio*P.CrossVV(R,T),S+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*l*l+this.m_iB*o*o;var D=this.m_lalcD,L=F.MulTRV(C,P.AddVV(R,P.SubVV(_,m,P.s_t0),P.s_t0),P.s_t0);r=P.DotVV(P.SubVV(L,D,P.s_t0),this.m_localAxisD)}var O=i+this.m_ratio*r-this.m_constant,V=0;return S>0&&(V=-O/S),h.SelfMulAdd(this.m_mA*V,A),u+=this.m_iA*V*s,_.SelfMulAdd(this.m_mB*V,b),f+=this.m_iB*V*o,d.SelfMulSub(this.m_mC*V,A),p-=this.m_iC*V*a,m.SelfMulSub(this.m_mD*V,b),y-=this.m_iD*V*l,e.positions[this.m_indexA].a=u,e.positions[this.m_indexB].a=f,e.positions[this.m_indexC].a=p,e.positions[this.m_indexD].a=y,00&&(this.m_angularMass=1/this.m_angularMass),P.SubVV(P.AddVV(s,_,P.s_t0),P.AddVV(e,u,P.s_t1),this.m_linearError),this.m_angularError=o-i-this.m_angularOffset,t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var v=this.m_linearImpulse;n.SelfMulSub(f,v),r-=p*(P.CrossVV(u,v)+this.m_angularImpulse),a.SelfMulAdd(d,v),c+=m*(P.CrossVV(_,v)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=c},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,o=this.m_invMassA,a=this.m_invMassB,c=this.m_invIA,l=this.m_invIB,h=t.step.dt,u=t.step.inv_dt,_=s-n+u*this.m_correctionFactor*this.m_angularError,f=-this.m_angularMass*_,d=this.m_angularImpulse,p=h*this.m_maxTorque;this.m_angularImpulse=C(this.m_angularImpulse+f,-p,p),n-=c*(f=this.m_angularImpulse-d),s+=l*f;var m=this.m_rA,y=this.m_rB,v=P.AddVV(P.SubVV(P.AddVV(r,P.CrossSV(s,y,P.s_t0),P.s_t0),P.AddVV(e,P.CrossSV(n,m,P.s_t1),P.s_t1),P.s_t2),P.MulSV(u*this.m_correctionFactor,this.m_linearError,P.s_t3),i.SolveVelocityConstraints_s_Cdot_v2),g=O.MulMV(this.m_linearMass,v,i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),x=i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(g);p=h*this.m_maxForce;this.m_linearImpulse.LengthSquared()>p*p&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(p)),P.SubVV(this.m_linearImpulse,x,g),e.SelfMulSub(o,g),n-=c*P.CrossVV(m,g),r.SelfMulAdd(a,g),s+=l*P.CrossVV(y,g),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){return!0},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.SolveVelocityConstraints_s_Cdot_v2=new P,i.SolveVelocityConstraints_s_impulse_v2=new P,i.SolveVelocityConstraints_s_oldImpulse_v2=new P,i})(fi),Si=(function(e){function i(){var i=e.call(this,t.b2JointType.e_mouseJoint)||this;return i.target=new P,i.maxForce=0,i.frequencyHz=5,i.dampingRatio=.7,i}return $e(i,e),i})(_i),Ti=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_localAnchorB=new P,n.m_targetA=new P,n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_beta=0,n.m_impulse=new P,n.m_maxForce=0,n.m_gamma=0,n.m_indexA=0,n.m_indexB=0,n.m_rB=new P,n.m_localCenterB=new P,n.m_invMassB=0,n.m_invIB=0,n.m_mass=new O,n.m_C=new P,n.m_qB=new F,n.m_lalcB=new P,n.m_K=new O,n.m_targetA.Copy(e(i.target,P.ZERO)),N.MulTXV(n.m_bodyB.GetTransform(),n.m_targetA,n.m_localAnchorB),n.m_maxForce=e(i.maxForce,0),n.m_impulse.SetZero(),n.m_frequencyHz=e(i.frequencyHz,0),n.m_dampingRatio=e(i.dampingRatio,0),n.m_beta=0,n.m_gamma=0,n}return $e(i,t),i.prototype.SetTarget=function(t){this.m_bodyB.IsAwake()||this.m_bodyB.SetAwake(!0),this.m_targetA.Copy(t)},i.prototype.GetTarget=function(){return this.m_targetA},i.prototype.SetMaxForce=function(t){this.m_maxForce=t},i.prototype.GetMaxForce=function(){return this.m_maxForce},i.prototype.SetFrequency=function(t){this.m_frequencyHz=t},i.prototype.GetFrequency=function(){return this.m_frequencyHz},i.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetDampingRatio=function(){return this.m_dampingRatio},i.prototype.InitVelocityConstraints=function(t){this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexB].c,i=t.positions[this.m_indexB].a,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,o=this.m_qB.SetAngle(i),a=this.m_bodyB.GetMass(),c=2*s*this.m_frequencyHz,l=2*a*this.m_dampingRatio*c,h=a*(c*c),u=t.step.dt;this.m_gamma=u*(l+u*h),0!==this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=u*h*this.m_gamma,P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),F.MulRV(o,this.m_lalcB,this.m_rB);var _=this.m_K;_.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,_.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,_.ey.x=_.ex.y,_.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,_.GetInverse(this.m_mass),this.m_C.x=e.x+this.m_rB.x-this.m_targetA.x,this.m_C.y=e.y+this.m_rB.y-this.m_targetA.y,this.m_C.SelfMul(this.m_beta),r*=.98,t.step.warmStarting?(this.m_impulse.SelfMul(t.step.dtRatio),n.x+=this.m_invMassB*this.m_impulse.x,n.y+=this.m_invMassB*this.m_impulse.y,r+=this.m_invIB*P.CrossVV(this.m_rB,this.m_impulse)):this.m_impulse.SetZero(),t.velocities[this.m_indexB].w=r},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexB].v,n=t.velocities[this.m_indexB].w,r=P.AddVCrossSV(e,n,this.m_rB,i.SolveVelocityConstraints_s_Cdot),s=O.MulMV(this.m_mass,P.AddVV(r,P.AddVV(this.m_C,P.MulSV(this.m_gamma,this.m_impulse,P.s_t0),P.s_t0),P.s_t0).SelfNeg(),i.SolveVelocityConstraints_s_impulse),o=i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var a=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>a*a&&this.m_impulse.SelfMul(a/this.m_impulse.Length()),P.SubVV(this.m_impulse,o,s),e.SelfMulAdd(this.m_invMassB,s),n+=this.m_invIB*P.CrossVV(this.m_rB,s),t.velocities[this.m_indexB].w=n},i.prototype.SolvePositionConstraints=function(t){return!0},i.prototype.GetAnchorA=function(t){return t.x=this.m_targetA.x,t.y=this.m_targetA.y,t},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return P.MulSV(t,this.m_impulse,e)},i.prototype.GetReactionTorque=function(t){return 0},i.prototype.Dump=function(t){t("Mouse joint dumping is not supported.\n")},i.prototype.ShiftOrigin=function(t){this.m_targetA.SelfSub(t)},i.SolveVelocityConstraints_s_Cdot=new P,i.SolveVelocityConstraints_s_impulse=new P,i.SolveVelocityConstraints_s_oldImpulse=new P,i})(fi),wi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_prismaticJoint)||this;return i.localAnchorA=new P,i.localAnchorB=new P,i.localAxisA=new P(1,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerTranslation=0,i.upperTranslation=0,i.enableMotor=!1,i.maxMotorForce=0,i.motorSpeed=0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i})(_i),Ei=(function(i){function n(n){var r=i.call(this,n)||this;return r.m_localAnchorA=new P,r.m_localAnchorB=new P,r.m_localXAxisA=new P,r.m_localYAxisA=new P,r.m_referenceAngle=0,r.m_impulse=new L(0,0,0),r.m_motorImpulse=0,r.m_lowerTranslation=0,r.m_upperTranslation=0,r.m_maxMotorForce=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_enableMotor=!1,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_indexA=0,r.m_indexB=0,r.m_localCenterA=new P,r.m_localCenterB=new P,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_axis=new P(0,0),r.m_perp=new P(0,0),r.m_s1=0,r.m_s2=0,r.m_a1=0,r.m_a2=0,r.m_K=new V,r.m_K3=new V,r.m_K2=new O,r.m_motorMass=0,r.m_qA=new F,r.m_qB=new F,r.m_lalcA=new P,r.m_lalcB=new P,r.m_rA=new P,r.m_rB=new P,r.m_localAnchorA.Copy(e(n.localAnchorA,P.ZERO)),r.m_localAnchorB.Copy(e(n.localAnchorB,P.ZERO)),r.m_localXAxisA.Copy(e(n.localAxisA,new P(1,0))).SelfNormalize(),P.CrossOneV(r.m_localXAxisA,r.m_localYAxisA),r.m_referenceAngle=e(n.referenceAngle,0),r.m_lowerTranslation=e(n.lowerTranslation,0),r.m_upperTranslation=e(n.upperTranslation,0),r.m_maxMotorForce=e(n.maxMotorForce,0),r.m_motorSpeed=e(n.motorSpeed,0),r.m_enableLimit=e(n.enableLimit,!1),r.m_enableMotor=e(n.enableMotor,!1),r}return $e(n,i),n.prototype.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,o=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].c,l=e.positions[this.m_indexB].a,h=e.velocities[this.m_indexB].v,u=e.velocities[this.m_indexB].w,_=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(l);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=F.MulRV(_,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p=F.MulRV(f,this.m_lalcB,this.m_rB),m=P.AddVV(P.SubVV(a,i,P.s_t0),P.SubVV(p,d,P.s_t1),n.InitVelocityConstraints_s_d),y=this.m_invMassA,g=this.m_invMassB,x=this.m_invIA,C=this.m_invIB;if(F.MulRV(_,this.m_localXAxisA,this.m_axis),this.m_a1=P.CrossVV(P.AddVV(m,d,P.s_t0),this.m_axis),this.m_a2=P.CrossVV(p,this.m_axis),this.m_motorMass=y+g+x*this.m_a1*this.m_a1+C*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),F.MulRV(_,this.m_localYAxisA,this.m_perp),this.m_s1=P.CrossVV(P.AddVV(m,d,P.s_t0),this.m_perp),this.m_s2=P.CrossVV(p,this.m_perp),this.m_K.ex.x=y+g+x*this.m_s1*this.m_s1+C*this.m_s2*this.m_s2,this.m_K.ex.y=x*this.m_s1+C*this.m_s2,this.m_K.ex.z=x*this.m_s1*this.m_a1+C*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=x+C,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=x*this.m_a1+C*this.m_a2,this.m_K.ez.x=this.m_K.ex.z,this.m_K.ez.y=this.m_K.ey.z,this.m_K.ez.z=y+g+x*this.m_a1*this.m_a1+C*this.m_a2*this.m_a2,this.m_enableLimit){var A=P.DotVV(this.m_axis,m);v(this.m_upperTranslation-this.m_lowerTranslation)<2*c?this.m_limitState=t.b2LimitState.e_equalLimits:A<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):A>=this.m_upperTranslation?this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_limitState=t.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0;if(this.m_enableMotor||(this.m_motorImpulse=0),e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var b=P.AddVV(P.MulSV(this.m_impulse.x,this.m_perp,P.s_t0),P.MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,P.s_t1),n.InitVelocityConstraints_s_P),S=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,T=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(y,b),o-=x*S,h.SelfMulAdd(g,b),u+=C*T}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=o,e.velocities[this.m_indexB].w=u},n.prototype.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,o=e.velocities[this.m_indexB].w,a=this.m_invMassA,c=this.m_invMassB,l=this.m_invIA,h=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits){var u=P.DotVV(this.m_axis,P.SubVV(s,i,P.s_t0))+this.m_a2*o-this.m_a1*r,_=this.m_motorMass*(this.m_motorSpeed-u),f=this.m_motorImpulse,d=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=C(this.m_motorImpulse+_,-d,d),_=this.m_motorImpulse-f;var p=P.MulSV(_,this.m_axis,n.SolveVelocityConstraints_s_P),m=_*this.m_a1,y=_*this.m_a2;i.SelfMulSub(a,p),r-=l*m,s.SelfMulAdd(c,p),o+=h*y}var v=P.DotVV(this.m_perp,P.SubVV(s,i,P.s_t0))+this.m_s2*o-this.m_s1*r,A=o-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var b=P.DotVV(this.m_axis,P.SubVV(s,i,P.s_t0))+this.m_a2*o-this.m_a1*r,S=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),T=this.m_K.Solve33(-v,-A,-b,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(T),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=x(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=g(this.m_impulse.z,0));var w=-v-(this.m_impulse.z-S.z)*this.m_K.ez.x,E=-A-(this.m_impulse.z-S.z)*this.m_K.ez.y,B=this.m_K.Solve22(w,E,n.SolveVelocityConstraints_s_f2r);B.x+=S.x,B.y+=S.y,this.m_impulse.x=B.x,this.m_impulse.y=B.y,T.x=this.m_impulse.x-S.x,T.y=this.m_impulse.y-S.y,T.z=this.m_impulse.z-S.z;p=P.AddVV(P.MulSV(T.x,this.m_perp,P.s_t0),P.MulSV(T.z,this.m_axis,P.s_t1),n.SolveVelocityConstraints_s_P),m=T.x*this.m_s1+T.y+T.z*this.m_a1,y=T.x*this.m_s2+T.y+T.z*this.m_a2;i.SelfMulSub(a,p),r-=l*m,s.SelfMulAdd(c,p),o+=h*y}else{var M=this.m_K.Solve22(-v,-A,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=M.x,this.m_impulse.y+=M.y;p=P.MulSV(M.x,this.m_perp,n.SolveVelocityConstraints_s_P),m=M.x*this.m_s1+M.y,y=M.x*this.m_s2+M.y;i.SelfMulSub(a,p),r-=l*m,s.SelfMulAdd(c,p),o+=h*y}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=o},n.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,o=this.m_qA.SetAngle(i),a=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,_=this.m_invIA,f=this.m_invIB,d=F.MulRV(o,this.m_lalcA,this.m_rA),p=F.MulRV(a,this.m_lalcB,this.m_rB),m=P.SubVV(P.AddVV(r,p,P.s_t0),P.AddVV(e,d,P.s_t1),n.SolvePositionConstraints_s_d),y=F.MulRV(o,this.m_localXAxisA,this.m_axis),g=P.CrossVV(P.AddVV(m,d,P.s_t0),y),A=P.CrossVV(p,y),b=F.MulRV(o,this.m_localYAxisA,this.m_perp),S=P.CrossVV(P.AddVV(m,d,P.s_t0),b),T=P.CrossVV(p,b),w=n.SolvePositionConstraints_s_impulse,E=P.DotVV(b,m),B=s-i-this.m_referenceAngle,M=v(E),I=v(B),R=!1,D=0;if(this.m_enableLimit){var L=P.DotVV(y,m);v(this.m_upperTranslation-this.m_lowerTranslation)<2*c?(D=C(L,-.2,.2),M=x(M,v(L)),R=!0):L<=this.m_lowerTranslation?(D=C(L-this.m_lowerTranslation+c,-.2,0),M=x(M,this.m_lowerTranslation-L),R=!0):L>=this.m_upperTranslation&&(D=C(L-this.m_upperTranslation-c,0,.2),M=x(M,L-this.m_upperTranslation),R=!0)}if(R){var O=h+u+_*S*S+f*T*T,V=_*S+f*T,N=_*S*g+f*T*A;0===(U=_+f)&&(U=1);var G=_*g+f*A,k=h+u+_*g*g+f*A*A,z=this.m_K3;z.ex.SetXYZ(O,V,N),z.ey.SetXYZ(V,U,G),z.ez.SetXYZ(N,G,k),w=z.Solve33(-E,-B,-D,w)}else{var U;O=h+u+_*S*S+f*T*T,V=_*S+f*T;0===(U=_+f)&&(U=1);var W=this.m_K2;W.ex.Set(O,V),W.ey.Set(V,U);var j=W.Solve(-E,-B,n.SolvePositionConstraints_s_impulse1);w.x=j.x,w.y=j.y,w.z=0}var H=P.AddVV(P.MulSV(w.x,b,P.s_t0),P.MulSV(w.z,y,P.s_t1),n.SolvePositionConstraints_s_P),q=w.x*S+w.y+w.z*g,X=w.x*T+w.y+w.z*A;return e.SelfMulSub(h,H),i-=_*q,r.SelfMulAdd(u,H),s+=f*X,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,M<=c&&I<=l},n.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.prototype.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),e.y=t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y),e},n.prototype.GetReactionTorque=function(t){return t*this.m_impulse.y},n.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},n.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},n.prototype.GetLocalAxisA=function(){return this.m_localXAxisA},n.prototype.GetReferenceAngle=function(){return this.m_referenceAngle},n.prototype.GetJointTranslation=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,n.GetJointTranslation_s_pA),e=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,n.GetJointTranslation_s_pB),i=P.SubVV(e,t,n.GetJointTranslation_s_d),r=this.m_bodyA.GetWorldVector(this.m_localXAxisA,n.GetJointTranslation_s_axis);return P.DotVV(i,r)},n.prototype.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;P.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=F.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=F.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=P.AddVV(t.m_sweep.c,i,P.s_t0),s=P.AddVV(e.m_sweep.c,n,P.s_t1),o=P.SubVV(s,r,P.s_t2),a=t.GetWorldVector(this.m_localXAxisA,this.m_axis),c=t.m_linearVelocity,l=e.m_linearVelocity,h=t.m_angularVelocity,u=e.m_angularVelocity;return P.DotVV(o,P.CrossSV(h,a,P.s_t0))+P.DotVV(a,P.SubVV(P.AddVCrossSV(l,u,n,P.s_t0),P.AddVCrossSV(c,h,i,P.s_t1),P.s_t0))},n.prototype.IsLimitEnabled=function(){return this.m_enableLimit},n.prototype.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},n.prototype.GetLowerLimit=function(){return this.m_lowerTranslation},n.prototype.GetUpperLimit=function(){return this.m_upperTranslation},n.prototype.SetLimits=function(t,e){t===this.m_lowerTranslation&&e===this.m_upperTranslation||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},n.prototype.IsMotorEnabled=function(){return this.m_enableMotor},n.prototype.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.prototype.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},n.prototype.SetMaxMotorForce=function(t){t!==this.m_maxMotorForce&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t)},n.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce},n.prototype.GetMotorForce=function(t){return t*this.m_motorImpulse},n.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation),t(" jd.upperTranslation = %.15f;\n",this.m_upperTranslation),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints_s_d=new P,n.InitVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_f2r=new P,n.SolveVelocityConstraints_s_f1=new L,n.SolveVelocityConstraints_s_df3=new L,n.SolveVelocityConstraints_s_df2=new P,n.SolvePositionConstraints_s_d=new P,n.SolvePositionConstraints_s_impulse=new L,n.SolvePositionConstraints_s_impulse1=new P,n.SolvePositionConstraints_s_P=new P,n.GetJointTranslation_s_pA=new P,n.GetJointTranslation_s_pB=new P,n.GetJointTranslation_s_d=new P,n.GetJointTranslation_s_axis=new P,n})(fi),Bi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_pulleyJoint)||this;return i.groundAnchorA=new P(-1,1),i.groundAnchorB=new P(1,1),i.localAnchorA=new P(-1,0),i.localAnchorB=new P(1,0),i.lengthA=0,i.lengthB=0,i.ratio=1,i.collideConnected=!0,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n,r,s,o){this.bodyA=t,this.bodyB=e,this.groundAnchorA.Copy(i),this.groundAnchorB.Copy(n),this.bodyA.GetLocalPoint(r,this.localAnchorA),this.bodyB.GetLocalPoint(s,this.localAnchorB),this.lengthA=P.DistanceVV(r,i),this.lengthB=P.DistanceVV(s,n),this.ratio=o},i})(_i),Mi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_groundAnchorA=new P,n.m_groundAnchorB=new P,n.m_lengthA=0,n.m_lengthB=0,n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_constant=0,n.m_ratio=0,n.m_impulse=0,n.m_indexA=0,n.m_indexB=0,n.m_uA=new P,n.m_uB=new P,n.m_rA=new P,n.m_rB=new P,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new F,n.m_qB=new F,n.m_lalcA=new P,n.m_lalcB=new P,n.m_groundAnchorA.Copy(e(i.groundAnchorA,new P(-1,1))),n.m_groundAnchorB.Copy(e(i.groundAnchorB,new P(1,0))),n.m_localAnchorA.Copy(e(i.localAnchorA,new P(-1,0))),n.m_localAnchorB.Copy(e(i.localAnchorB,new P(1,0))),n.m_lengthA=e(i.lengthA,0),n.m_lengthB=e(i.lengthB,0),n.m_ratio=e(i.ratio,1),n.m_constant=e(i.lengthA,0)+n.m_ratio*e(i.lengthB,0),n.m_impulse=0,n}return $e(i,t),i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,o=t.positions[this.m_indexB].c,a=t.positions[this.m_indexB].a,l=t.velocities[this.m_indexB].v,h=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(n),_=this.m_qB.SetAngle(a);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),F.MulRV(u,this.m_lalcA,this.m_rA),P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),F.MulRV(_,this.m_lalcB,this.m_rB),this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA),this.m_uB.Copy(o).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var f=this.m_uA.Length(),d=this.m_uB.Length();f>10*c?this.m_uA.SelfMul(1/f):this.m_uA.SetZero(),d>10*c?this.m_uB.SelfMul(1/d):this.m_uB.SetZero();var p=P.CrossVV(this.m_rA,this.m_uA),m=P.CrossVV(this.m_rB,this.m_uB),y=this.m_invMassA+this.m_invIA*p*p,v=this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=y+this.m_ratio*this.m_ratio*v,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var g=P.MulSV(-this.m_impulse,this.m_uA,i.InitVelocityConstraints_s_PA),x=P.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,i.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,g),s+=this.m_invIA*P.CrossVV(this.m_rA,g),l.SelfMulAdd(this.m_invMassB,x),h+=this.m_invIB*P.CrossVV(this.m_rB,x)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=h},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,o=P.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),a=P.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),c=-P.DotVV(this.m_uA,o)-this.m_ratio*P.DotVV(this.m_uB,a),l=-this.m_mass*c;this.m_impulse+=l;var h=P.MulSV(-l,this.m_uA,i.SolveVelocityConstraints_s_PA),u=P.MulSV(-this.m_ratio*l,this.m_uB,i.SolveVelocityConstraints_s_PB);e.SelfMulAdd(this.m_invMassA,h),n+=this.m_invIA*P.CrossVV(this.m_rA,h),r.SelfMulAdd(this.m_invMassB,u),s+=this.m_invIB*P.CrossVV(this.m_rB,u),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var l=F.MulRV(o,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var h=F.MulRV(a,this.m_lalcB,this.m_rB),u=this.m_uA.Copy(e).SelfAdd(l).SelfSub(this.m_groundAnchorA),_=this.m_uB.Copy(r).SelfAdd(h).SelfSub(this.m_groundAnchorB),f=u.Length(),d=_.Length();f>10*c?u.SelfMul(1/f):u.SetZero(),d>10*c?_.SelfMul(1/d):_.SetZero();var p=P.CrossVV(l,u),m=P.CrossVV(h,_),y=this.m_invMassA+this.m_invIA*p*p,g=this.m_invMassB+this.m_invIB*m*m,x=y+this.m_ratio*this.m_ratio*g;x>0&&(x=1/x);var C=this.m_constant-f-this.m_ratio*d,A=v(C),b=-x*C,S=P.MulSV(-b,u,i.SolvePositionConstraints_s_PA),T=P.MulSV(-this.m_ratio*b,_,i.SolvePositionConstraints_s_PB);return e.SelfMulAdd(this.m_invMassA,S),n+=this.m_invIA*P.CrossVV(l,S),r.SelfMulAdd(this.m_invMassB,T),s+=this.m_invIB*P.CrossVV(h,T),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,A0&&(this.m_motorMass=1/this.m_motorMass),this.m_enableMotor&&!m||(this.m_motorImpulse=0),this.m_enableLimit&&!m){var y=o-i-this.m_referenceAngle;v(this.m_upperAngle-this.m_lowerAngle)<2*l?this.m_limitState=t.b2LimitState.e_equalLimits:y<=this.m_lowerAngle?(this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atLowerLimit):y>=this.m_upperAngle?(this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atUpperLimit):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit;if(e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var g=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(_,g),s-=d*(P.CrossVV(this.m_rA,g)+this.m_motorImpulse+this.m_impulse.z),a.SelfMulAdd(f,g),c+=p*(P.CrossVV(this.m_rB,g)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=c},n.prototype.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,o=e.velocities[this.m_indexB].w,a=this.m_invMassA,c=this.m_invMassB,l=this.m_invIA,h=this.m_invIB,u=l+h===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!u){var _=o-r-this.m_motorSpeed,f=-this.m_motorMass*_,d=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=C(this.m_motorImpulse+f,-p,p),r-=l*(f=this.m_motorImpulse-d),o+=h*f}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!u){var m=P.SubVV(P.AddVCrossSV(s,o,this.m_rB,P.s_t0),P.AddVCrossSV(i,r,this.m_rA,P.s_t1),n.SolveVelocityConstraints_s_Cdot1),y=o-r,v=this.m_mass.Solve33(m.x,m.y,y,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(v);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){if(this.m_impulse.z+v.z<0){var g=-m.x+this.m_impulse.z*this.m_mass.ez.x,x=-m.y+this.m_impulse.z*this.m_mass.ez.y,A=this.m_mass.Solve22(g,x,n.SolveVelocityConstraints_s_reduced_v2);v.x=A.x,v.y=A.y,v.z=-this.m_impulse.z,this.m_impulse.x+=A.x,this.m_impulse.y+=A.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v)}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){if(this.m_impulse.z+v.z>0){g=-m.x+this.m_impulse.z*this.m_mass.ez.x,x=-m.y+this.m_impulse.z*this.m_mass.ez.y,A=this.m_mass.Solve22(g,x,n.SolveVelocityConstraints_s_reduced_v2);v.x=A.x,v.y=A.y,v.z=-this.m_impulse.z,this.m_impulse.x+=A.x,this.m_impulse.y+=A.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(v)}var b=n.SolveVelocityConstraints_s_P.Set(v.x,v.y);i.SelfMulSub(a,b),r-=l*(P.CrossVV(this.m_rA,b)+v.z),s.SelfMulAdd(c,b),o+=h*(P.CrossVV(this.m_rB,b)+v.z)}else{var S=P.SubVV(P.AddVCrossSV(s,o,this.m_rB,P.s_t0),P.AddVCrossSV(i,r,this.m_rA,P.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),T=this.m_mass.Solve22(-S.x,-S.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=T.x,this.m_impulse.y+=T.y,i.SelfMulSub(a,T),r-=l*P.CrossVV(this.m_rA,T),s.SelfMulAdd(c,T),o+=h*P.CrossVV(this.m_rB,T)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=o},n.prototype.SolvePositionConstraints=function(e){var i,r=e.positions[this.m_indexA].c,s=e.positions[this.m_indexA].a,o=e.positions[this.m_indexB].c,a=e.positions[this.m_indexB].a,h=this.m_qA.SetAngle(s),u=this.m_qB.SetAngle(a),_=0,f=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!f){var d=a-s-this.m_referenceAngle,p=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var m=C(d-this.m_lowerAngle,-.13962634015955555,.13962634015955555);p=-this.m_motorMass*m,_=v(m)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){_=-(m=d-this.m_lowerAngle),m=C(m+l,-.13962634015955555,0),p=-this.m_motorMass*m}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){_=m=d-this.m_upperAngle,m=C(m-l,0,.13962634015955555),p=-this.m_motorMass*m}s-=this.m_invIA*p,a+=this.m_invIB*p}h.SetAngle(s),u.SetAngle(a),P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var y=F.MulRV(h,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var g=F.MulRV(u,this.m_lalcB,this.m_rB),x=P.SubVV(P.AddVV(o,g,P.s_t0),P.AddVV(r,y,P.s_t1),n.SolvePositionConstraints_s_C_v2);i=x.Length();var A=this.m_invMassA,b=this.m_invMassB,S=this.m_invIA,T=this.m_invIB,w=this.m_K;w.ex.x=A+b+S*y.y*y.y+T*g.y*g.y,w.ex.y=-S*y.x*y.y-T*g.x*g.y,w.ey.x=w.ex.y,w.ey.y=A+b+S*y.x*y.x+T*g.x*g.x;var E=w.Solve(x.x,x.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return r.SelfMulSub(A,E),s-=S*P.CrossVV(y,E),o.SelfMulAdd(b,E),a+=T*P.CrossVV(g,E),e.positions[this.m_indexA].a=s,e.positions[this.m_indexB].a=a,i<=c&&_<=l},n.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},n.prototype.GetReactionTorque=function(t){return t*this.m_impulse.z},n.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},n.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},n.prototype.GetReferenceAngle=function(){return this.m_referenceAngle},n.prototype.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},n.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},n.prototype.IsMotorEnabled=function(){return this.m_enableMotor},n.prototype.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.prototype.GetMotorTorque=function(t){return t*this.m_motorImpulse},n.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},n.prototype.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},n.prototype.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},n.prototype.IsLimitEnabled=function(){return this.m_enableLimit},n.prototype.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},n.prototype.GetLowerLimit=function(){return this.m_lowerAngle},n.prototype.GetUpperLimit=function(){return this.m_upperAngle},n.prototype.SetLimits=function(t,e){t===this.m_lowerAngle&&e===this.m_upperAngle||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},n.prototype.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerAngle = %.15f;\n",this.m_lowerAngle),t(" jd.upperAngle = %.15f;\n",this.m_upperAngle),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_P=new P,n.SolveVelocityConstraints_s_Cdot_v2=new P,n.SolveVelocityConstraints_s_Cdot1=new P,n.SolveVelocityConstraints_s_impulse_v3=new L,n.SolveVelocityConstraints_s_reduced_v2=new P,n.SolveVelocityConstraints_s_impulse_v2=new P,n.SolvePositionConstraints_s_C_v2=new P,n.SolvePositionConstraints_s_impulse=new P,n})(fi),Pi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_ropeJoint)||this;return i.localAnchorA=new P(-1,0),i.localAnchorB=new P(1,0),i.maxLength=0,i}return $e(i,e),i})(_i),Di=(function(i){function n(n){var r=i.call(this,n)||this;return r.m_localAnchorA=new P,r.m_localAnchorB=new P,r.m_maxLength=0,r.m_length=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_u=new P,r.m_rA=new P,r.m_rB=new P,r.m_localCenterA=new P,r.m_localCenterB=new P,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=0,r.m_state=t.b2LimitState.e_inactiveLimit,r.m_qA=new F,r.m_qB=new F,r.m_lalcA=new P,r.m_lalcB=new P,r.m_localAnchorA.Copy(e(n.localAnchorA,new P(-1,0))),r.m_localAnchorB.Copy(e(n.localAnchorB,new P(1,0))),r.m_maxLength=e(n.maxLength,0),r}return $e(n,i),n.prototype.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,o=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].c,l=e.positions[this.m_indexB].a,h=e.velocities[this.m_indexB].v,u=e.velocities[this.m_indexB].w,_=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(l);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),F.MulRV(_,this.m_lalcA,this.m_rA),P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),F.MulRV(f,this.m_lalcB,this.m_rB),this.m_u.Copy(a).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var d=this.m_length-this.m_maxLength;if(this.m_state=d>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>c))return this.m_u.SetZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.SelfMul(1/this.m_length);var p=P.CrossVV(this.m_rA,this.m_u),m=P.CrossVV(this.m_rB,this.m_u),y=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==y?1/y:0,e.step.warmStarting){this.m_impulse*=e.step.dtRatio;var v=P.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,v),o-=this.m_invIA*P.CrossVV(this.m_rA,v),h.SelfMulAdd(this.m_invMassB,v),u+=this.m_invIB*P.CrossVV(this.m_rB,v)}else this.m_impulse=0;e.velocities[this.m_indexA].w=o,e.velocities[this.m_indexB].w=u},n.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,o=P.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),a=P.AddVCrossSV(r,s,this.m_rB,n.SolveVelocityConstraints_s_vpB),c=this.m_length-this.m_maxLength,l=P.DotVV(this.m_u,P.SubVV(a,o,P.s_t0));c<0&&(l+=t.step.inv_dt*c);var h=-this.m_mass*l,u=this.m_impulse;this.m_impulse=g(0,this.m_impulse+h),h=this.m_impulse-u;var _=P.MulSV(h,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,_),i-=this.m_invIA*P.CrossVV(this.m_rA,_),r.SelfMulAdd(this.m_invMassB,_),s+=this.m_invIB*P.CrossVV(this.m_rB,_),t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=s},n.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,o=this.m_qA.SetAngle(i),a=this.m_qB.SetAngle(s);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var l=F.MulRV(o,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var h=F.MulRV(a,this.m_lalcB,this.m_rB),u=this.m_u.Copy(r).SelfAdd(h).SelfSub(e).SelfSub(l),_=u.Normalize(),f=_-this.m_maxLength;f=C(f,0,.2);var d=-this.m_mass*f,p=P.MulSV(d,u,n.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,p),i-=this.m_invIA*P.CrossVV(l,p),r.SelfMulAdd(this.m_invMassB,p),s+=this.m_invIB*P.CrossVV(h,p),t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,_-this.m_maxLength0){p.GetInverse22(this.m_mass);var m=f+d,y=m>0?1/m:0,v=o-e-this.m_referenceAngle,g=2*s*this.m_frequencyHz,x=2*y*this.m_dampingRatio*g,C=y*g*g,A=t.step.dt;this.m_gamma=A*(x+A*C),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=v*A*C*this.m_gamma,m+=this.m_gamma,this.m_mass.ez.z=0!==m?1/m:0}else p.GetSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse.SelfMul(t.step.dtRatio);var b=i.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(u,b),r-=f*(P.CrossVV(this.m_rA,b)+this.m_impulse.z),a.SelfMulAdd(_,b),c+=d*(P.CrossVV(this.m_rB,b)+this.m_impulse.z)}else this.m_impulse.SetZero();t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=c},i.prototype.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,o=this.m_invMassA,a=this.m_invMassB,c=this.m_invIA,l=this.m_invIB;if(this.m_frequencyHz>0){var h=s-n,u=-this.m_mass.ez.z*(h+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=u,n-=c*u,s+=l*u;var _=P.SubVV(P.AddVCrossSV(r,s,this.m_rB,P.s_t0),P.AddVCrossSV(e,n,this.m_rA,P.s_t1),i.SolveVelocityConstraints_s_Cdot1),f=V.MulM33XY(this.m_mass,_.x,_.y,i.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=f.x,this.m_impulse.y+=f.y;var d=f;e.SelfMulSub(o,d),n-=c*P.CrossVV(this.m_rA,d),r.SelfMulAdd(a,d),s+=l*P.CrossVV(this.m_rB,d)}else{_=P.SubVV(P.AddVCrossSV(r,s,this.m_rB,P.s_t0),P.AddVCrossSV(e,n,this.m_rA,P.s_t1),i.SolveVelocityConstraints_s_Cdot1),h=s-n;var p=V.MulM33XYZ(this.m_mass,_.x,_.y,h,i.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(p);d=i.SolveVelocityConstraints_s_P.Set(p.x,p.y);e.SelfMulSub(o,d),n-=c*(P.CrossVV(this.m_rA,d)+p.z),r.SelfMulAdd(a,d),s+=l*(P.CrossVV(this.m_rB,d)+p.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},i.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,_=this.m_invIA,f=this.m_invIB;P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=F.MulRV(o,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,y=F.MulRV(a,this.m_lalcB,this.m_rB),g=this.m_K;if(g.ex.x=h+u+d.y*d.y*_+y.y*y.y*f,g.ey.x=-d.y*d.x*_-y.y*y.x*f,g.ez.x=-d.y*_-y.y*f,g.ex.y=g.ey.x,g.ey.y=h+u+d.x*d.x*_+y.x*y.x*f,g.ez.y=d.x*_+y.x*f,g.ex.z=g.ez.x,g.ey.z=g.ez.y,g.ez.z=_+f,this.m_frequencyHz>0){p=(C=P.SubVV(P.AddVV(r,y,P.s_t0),P.AddVV(e,d,P.s_t1),i.SolvePositionConstraints_s_C1)).Length(),m=0;var x=g.Solve22(C.x,C.y,i.SolvePositionConstraints_s_P).SelfNeg();e.SelfMulSub(h,x),n-=_*P.CrossVV(d,x),r.SelfMulAdd(u,x),s+=f*P.CrossVV(y,x)}else{var C=P.SubVV(P.AddVV(r,y,P.s_t0),P.AddVV(e,d,P.s_t1),i.SolvePositionConstraints_s_C1),A=s-n-this.m_referenceAngle;p=C.Length(),m=v(A);var b=g.Solve33(C.x,C.y,A,i.SolvePositionConstraints_s_impulse).SelfNeg();x=i.SolvePositionConstraints_s_P.Set(b.x,b.y);e.SelfMulSub(h,x),n-=_*(P.CrossVV(this.m_rA,x)+b.z),r.SelfMulAdd(u,x),s+=f*(P.CrossVV(this.m_rB,x)+b.z)}return t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,p<=c&&m<=l},i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},i.prototype.GetReactionTorque=function(t){return t*this.m_impulse.z},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.GetReferenceAngle=function(){return this.m_referenceAngle},i.prototype.SetFrequency=function(t){this.m_frequencyHz=t},i.prototype.GetFrequency=function(){return this.m_frequencyHz},i.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetDampingRatio=function(){return this.m_dampingRatio},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.InitVelocityConstraints_s_P=new P,i.SolveVelocityConstraints_s_Cdot1=new P,i.SolveVelocityConstraints_s_impulse1=new P,i.SolveVelocityConstraints_s_impulse=new L,i.SolveVelocityConstraints_s_P=new P,i.SolvePositionConstraints_s_C1=new P,i.SolvePositionConstraints_s_P=new P,i.SolvePositionConstraints_s_impulse=new L,i})(fi),Vi=(function(e){function i(){var i=e.call(this,t.b2JointType.e_wheelJoint)||this;return i.localAnchorA=new P(0,0),i.localAnchorB=new P(0,0),i.localAxisA=new P(1,0),i.enableMotor=!1,i.maxMotorTorque=0,i.motorSpeed=0,i.frequencyHz=2,i.dampingRatio=.7,i}return $e(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA)},i})(_i),Fi=(function(t){function i(i){var n=t.call(this,i)||this;return n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_localAnchorA=new P,n.m_localAnchorB=new P,n.m_localXAxisA=new P,n.m_localYAxisA=new P,n.m_impulse=0,n.m_motorImpulse=0,n.m_springImpulse=0,n.m_maxMotorTorque=0,n.m_motorSpeed=0,n.m_enableMotor=!1,n.m_indexA=0,n.m_indexB=0,n.m_localCenterA=new P,n.m_localCenterB=new P,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_ax=new P,n.m_ay=new P,n.m_sAx=0,n.m_sBx=0,n.m_sAy=0,n.m_sBy=0,n.m_mass=0,n.m_motorMass=0,n.m_springMass=0,n.m_bias=0,n.m_gamma=0,n.m_qA=new F,n.m_qB=new F,n.m_lalcA=new P,n.m_lalcB=new P,n.m_rA=new P,n.m_rB=new P,n.m_frequencyHz=e(i.frequencyHz,2),n.m_dampingRatio=e(i.dampingRatio,.7),n.m_localAnchorA.Copy(e(i.localAnchorA,P.ZERO)),n.m_localAnchorB.Copy(e(i.localAnchorB,P.ZERO)),n.m_localXAxisA.Copy(e(i.localAxisA,P.UNITX)),P.CrossOneV(n.m_localXAxisA,n.m_localYAxisA),n.m_maxMotorTorque=e(i.maxMotorTorque,0),n.m_motorSpeed=e(i.motorSpeed,0),n.m_enableMotor=e(i.enableMotor,!1),n.m_ax.SetZero(),n.m_ay.SetZero(),n}return $e(i,t),i.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},i.prototype.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},i.prototype.SetSpringFrequencyHz=function(t){this.m_frequencyHz=t},i.prototype.GetSpringFrequencyHz=function(){return this.m_frequencyHz},i.prototype.SetSpringDampingRatio=function(t){this.m_dampingRatio=t},i.prototype.GetSpringDampingRatio=function(){return this.m_dampingRatio},i.prototype.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,o=this.m_invIB,a=t.positions[this.m_indexA].c,c=t.positions[this.m_indexA].a,l=t.velocities[this.m_indexA].v,h=t.velocities[this.m_indexA].w,u=t.positions[this.m_indexB].c,_=t.positions[this.m_indexB].a,f=t.velocities[this.m_indexB].v,d=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(c),m=this.m_qB.SetAngle(_);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var y=F.MulRV(p,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var v=F.MulRV(m,this.m_lalcB,this.m_rB),g=P.SubVV(P.AddVV(u,v,P.s_t0),P.AddVV(a,y,P.s_t1),i.InitVelocityConstraints_s_d);if(F.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=P.CrossVV(P.AddVV(g,y,P.s_t0),this.m_ay),this.m_sBy=P.CrossVV(v,this.m_ay),this.m_mass=e+n+r*this.m_sAy*this.m_sAy+o*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){F.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=P.CrossVV(P.AddVV(g,y,P.s_t0),this.m_ax),this.m_sBx=P.CrossVV(v,this.m_ax);var x=e+n+r*this.m_sAx*this.m_sAx+o*this.m_sBx*this.m_sBx;if(x>0){this.m_springMass=1/x;var C=P.DotVV(g,this.m_ax),A=2*s*this.m_frequencyHz,b=2*this.m_springMass*this.m_dampingRatio*A,S=this.m_springMass*A*A,T=t.step.dt;this.m_gamma=T*(b+T*S),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=C*T*S*this.m_gamma,this.m_springMass=x+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=r+o,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.step.warmStarting){this.m_impulse*=t.step.dtRatio,this.m_springImpulse*=t.step.dtRatio,this.m_motorImpulse*=t.step.dtRatio;var w=P.AddVV(P.MulSV(this.m_impulse,this.m_ay,P.s_t0),P.MulSV(this.m_springImpulse,this.m_ax,P.s_t1),i.InitVelocityConstraints_s_P),E=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,B=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;l.SelfMulSub(this.m_invMassA,w),h-=this.m_invIA*E,f.SelfMulAdd(this.m_invMassB,w),d+=this.m_invIB*B}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=h,t.velocities[this.m_indexB].w=d},i.prototype.SolveVelocityConstraints=function(t){var e=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,o=t.velocities[this.m_indexA].v,a=t.velocities[this.m_indexA].w,c=t.velocities[this.m_indexB].v,l=t.velocities[this.m_indexB].w,h=P.DotVV(this.m_ax,P.SubVV(c,o,P.s_t0))+this.m_sBx*l-this.m_sAx*a,u=-this.m_springMass*(h+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=u;var _=P.MulSV(u,this.m_ax,i.SolveVelocityConstraints_s_P),f=u*this.m_sAx,d=u*this.m_sBx;o.SelfMulSub(e,_),a-=r*f,c.SelfMulAdd(n,_);h=(l+=s*d)-a-this.m_motorSpeed,u=-this.m_motorMass*h;var p=this.m_motorImpulse,m=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=C(this.m_motorImpulse+u,-m,m),a-=r*(u=this.m_motorImpulse-p),l+=s*u;h=P.DotVV(this.m_ay,P.SubVV(c,o,P.s_t0))+this.m_sBy*l-this.m_sAy*a,u=-this.m_mass*h;this.m_impulse+=u;_=P.MulSV(u,this.m_ay,i.SolveVelocityConstraints_s_P),f=u*this.m_sAy,d=u*this.m_sBy;o.SelfMulSub(e,_),a-=r*f,c.SelfMulAdd(n,_),l+=s*d,t.velocities[this.m_indexA].w=a,t.velocities[this.m_indexB].w=l},i.prototype.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s);P.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var l=F.MulRV(o,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var h,u=F.MulRV(a,this.m_lalcB,this.m_rB),_=P.AddVV(P.SubVV(r,e,P.s_t0),P.SubVV(u,l,P.s_t1),i.SolvePositionConstraints_s_d),f=F.MulRV(o,this.m_localYAxisA,this.m_ay),d=P.CrossVV(P.AddVV(_,l,P.s_t0),f),p=P.CrossVV(u,f),m=P.DotVV(_,this.m_ay),y=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;h=0!==y?-m/y:0;var g=P.MulSV(h,f,i.SolvePositionConstraints_s_P),x=h*d,C=h*p;return e.SelfMulSub(this.m_invMassA,g),n-=this.m_invIA*x,r.SelfMulAdd(this.m_invMassB,g),s+=this.m_invIB*C,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,v(m)<=c},i.prototype.GetDefinition=function(t){return t},i.prototype.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},i.prototype.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},i.prototype.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse*this.m_ay.x+this.m_springImpulse*this.m_ax.x),e.y=t*(this.m_impulse*this.m_ay.y+this.m_springImpulse*this.m_ax.y),e},i.prototype.GetReactionTorque=function(t){return t*this.m_motorImpulse},i.prototype.GetLocalAnchorA=function(){return this.m_localAnchorA},i.prototype.GetLocalAnchorB=function(){return this.m_localAnchorB},i.prototype.GetLocalAxisA=function(){return this.m_localXAxisA},i.prototype.GetJointTranslation=function(){return this.GetPrismaticJointTranslation()},i.prototype.GetJointLinearSpeed=function(){return this.GetPrismaticJointSpeed()},i.prototype.GetJointAngle=function(){return this.GetRevoluteJointAngle()},i.prototype.GetJointAngularSpeed=function(){return this.GetRevoluteJointSpeed()},i.prototype.GetPrismaticJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchorA,new P),n=e.GetWorldPoint(this.m_localAnchorB,new P),r=P.SubVV(n,i,new P),s=t.GetWorldVector(this.m_localXAxisA,new P);return P.DotVV(r,s)},i.prototype.GetPrismaticJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;P.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=F.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);P.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=F.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=P.AddVV(t.m_sweep.c,i,P.s_t0),s=P.AddVV(e.m_sweep.c,n,P.s_t1),o=P.SubVV(s,r,P.s_t2),a=t.GetWorldVector(this.m_localXAxisA,new P),c=t.m_linearVelocity,l=e.m_linearVelocity,h=t.m_angularVelocity,u=e.m_angularVelocity;return P.DotVV(o,P.CrossSV(h,a,P.s_t0))+P.DotVV(a,P.SubVV(P.AddVCrossSV(l,u,n,P.s_t0),P.AddVCrossSV(c,h,i,P.s_t1),P.s_t0))},i.prototype.GetRevoluteJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a},i.prototype.GetRevoluteJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},i.prototype.IsMotorEnabled=function(){return this.m_enableMotor},i.prototype.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},i.prototype.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},i.prototype.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},i.prototype.GetMotorTorque=function(t){return t*this.m_motorImpulse},i.prototype.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},i.InitVelocityConstraints_s_d=new P,i.InitVelocityConstraints_s_P=new P,i.SolveVelocityConstraints_s_P=new P,i.SolvePositionConstraints_s_d=new P,i.SolvePositionConstraints_s_P=new P,i})(fi);function Ni(t,e){return T(t*e)}function Gi(t,e){return t>e?t:e}var ki=(function(){return function(t){this.prev=null,this.next=null,this.contact=t}})(),zi=(function(){function t(){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_prev=null,this.m_next=null,this.m_indexA=0,this.m_indexB=0,this.m_manifold=new Ct,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new Ct,this.m_nodeA=new ki(this),this.m_nodeB=new ki(this)}return t.prototype.GetManifold=function(){return this.m_manifold},t.prototype.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.m_fixtureA.GetShape(),r=this.m_fixtureB.GetShape();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},t.prototype.IsTouching=function(){return this.m_touchingFlag},t.prototype.SetEnabled=function(t){this.m_enabledFlag=t},t.prototype.IsEnabled=function(){return this.m_enabledFlag},t.prototype.GetNext=function(){return this.m_next},t.prototype.GetFixtureA=function(){return this.m_fixtureA},t.prototype.GetChildIndexA=function(){return this.m_indexA},t.prototype.GetFixtureB=function(){return this.m_fixtureB},t.prototype.GetChildIndexB=function(){return this.m_indexB},t.prototype.FlagForFiltering=function(){this.m_filterFlag=!0},t.prototype.SetFriction=function(t){this.m_friction=t},t.prototype.GetFriction=function(){return this.m_friction},t.prototype.ResetFriction=function(){this.m_friction=Ni(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},t.prototype.SetRestitution=function(t){this.m_restitution=t},t.prototype.GetRestitution=function(){return this.m_restitution},t.prototype.ResetRestitution=function(){this.m_restitution=Gi(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},t.prototype.SetTangentSpeed=function(t){this.m_tangentSpeed=t},t.prototype.GetTangentSpeed=function(){return this.m_tangentSpeed},t.prototype.Reset=function(t,e,i,n){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!0,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=n,this.m_manifold.pointCount=0,this.m_prev=null,this.m_next=null,delete this.m_nodeA.contact,this.m_nodeA.prev=null,this.m_nodeA.next=null,delete this.m_nodeA.other,delete this.m_nodeB.contact,this.m_nodeB.prev=null,this.m_nodeB.next=null,delete this.m_nodeB.other,this.m_toiCount=0,this.m_friction=Ni(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=Gi(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},t.prototype.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_enabledFlag=!0;var i=!1,n=this.m_touchingFlag,r=this.m_fixtureA.IsSensor(),s=this.m_fixtureB.IsSensor(),o=r||s,a=this.m_fixtureA.GetBody(),c=this.m_fixtureB.GetBody(),l=a.GetTransform(),h=c.GetTransform();if(o){var u=this.m_fixtureA.GetShape(),_=this.m_fixtureB.GetShape();i=Pt(u,this.m_indexA,_,this.m_indexB,l,h),this.m_manifold.pointCount=0}else{this.Evaluate(this.m_manifold,l,h),i=this.m_manifold.pointCount>0;for(var f=0;f0&&!e.IsSensor()&&!i.IsSensor()&&(e.GetBody().SetAwake(!0),i.GetBody().SetAwake(!0));var n=e.GetType(),r=i.GetType(),s=this.m_registers[n][r];s.destroyFcn&&s.destroyFcn(t,this.m_allocator)},e})(),Ki=(function(){function t(){}return t.prototype.SayGoodbyeJoint=function(t){},t.prototype.SayGoodbyeFixture=function(t){},t.prototype.SayGoodbyeParticleGroup=function(t){},t.prototype.SayGoodbyeParticle=function(t,e){},t})(),Qi=(function(){function e(){}return e.prototype.ShouldCollide=function(e,i){var n=e.GetBody(),r=i.GetBody();if(r.GetType()===t.b2BodyType.b2_staticBody&&n.GetType()===t.b2BodyType.b2_staticBody)return!1;if(!r.ShouldCollideConnected(n))return!1;var s=e.GetFilterData(),o=i.GetFilterData();return s.groupIndex===o.groupIndex&&0!==s.groupIndex?s.groupIndex>0:0!=(s.maskBits&o.categoryBits)&&0!=(s.categoryBits&o.maskBits)},e.prototype.ShouldCollideFixtureParticle=function(t,e,i){return!0},e.prototype.ShouldCollideParticleParticle=function(t,e,i){return!0},e.b2_defaultFilter=new e,e})(),$i=(function(){return function(){this.normalImpulses=p(o),this.tangentImpulses=p(o),this.count=0}})(),tn=(function(){function t(){}return t.prototype.BeginContact=function(t){},t.prototype.EndContact=function(t){},t.prototype.BeginContactFixtureParticle=function(t,e){},t.prototype.EndContactFixtureParticle=function(t,e){},t.prototype.BeginContactParticleParticle=function(t,e){},t.prototype.EndContactParticleParticle=function(t,e){},t.prototype.PreSolve=function(t,e){},t.prototype.PostSolve=function(t,e){},t.b2_defaultListener=new t,t})(),en=(function(){function t(){}return t.prototype.ReportFixture=function(t){return!0},t.prototype.ReportParticle=function(t,e){return!1},t.prototype.ShouldQueryParticleSystem=function(t){return!0},t})(),nn=(function(){function t(){}return t.prototype.ReportFixture=function(t,e,i,n){return n},t.prototype.ReportParticle=function(t,e,i,n,r){return 0},t.prototype.ShouldQueryParticleSystem=function(t){return!0},t})(),rn=(function(){function e(){this.m_broadPhase=new Ft,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=Qi.b2_defaultFilter,this.m_contactListener=tn.b2_defaultListener,this.m_allocator=null,this.m_contactFactory=new Zi(this.m_allocator)}return e.prototype.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,o=i.GetBody(),a=n.GetBody();if(o!==a){for(var c=a.GetContactList();c;){if(c.other===o){var l=c.contact.GetFixtureA(),h=c.contact.GetFixtureB(),u=c.contact.GetChildIndexA(),_=c.contact.GetChildIndexB();if(l===i&&h===n&&u===r&&_===s)return;if(l===n&&h===i&&u===s&&_===r)return}c=c.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var f=this.m_contactFactory.Create(i,r,n,s);null!==f&&(i=f.GetFixtureA(),n=f.GetFixtureB(),r=f.GetChildIndexA(),s=f.GetChildIndexB(),o=i.m_body,a=n.m_body,f.m_prev=null,f.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=f),this.m_contactList=f,f.m_nodeA.contact=f,f.m_nodeA.other=a,f.m_nodeA.prev=null,f.m_nodeA.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=f.m_nodeA),o.m_contactList=f.m_nodeA,f.m_nodeB.contact=f,f.m_nodeB.other=o,f.m_nodeB.prev=null,f.m_nodeB.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=f.m_nodeB),a.m_contactList=f.m_nodeB,i.IsSensor()||n.IsSensor()||(o.SetAwake(!0),a.SetAwake(!0)),++this.m_contactCount)}}},e.prototype.FindNewContacts=function(){var t=this;this.m_broadPhase.UpdatePairs((function(e,i){t.AddPair(e,i)}))},e.prototype.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();this.m_contactListener&&t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_contactList&&(this.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA===n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB===r.m_contactList&&(r.m_contactList=t.m_nodeB.next),this.m_contactFactory.Destroy(t),--this.m_contactCount},e.prototype.Collide=function(){for(var e=this.m_contactList;e;){var i=e.GetFixtureA(),n=e.GetFixtureB(),r=e.GetChildIndexA(),s=e.GetChildIndexB(),o=i.GetBody(),a=n.GetBody();if(e.m_filterFlag){if(this.m_contactFilter&&!this.m_contactFilter.ShouldCollide(i,n)){e=(h=e).m_next,this.Destroy(h);continue}e.m_filterFlag=!1}var c=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody,l=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody;if(c||l){var h,u=i.m_proxies[r].treeNode,_=n.m_proxies[s].treeNode;if(Et(u.aabb,_.aabb))e.Update(this.m_contactListener),e=e.m_next;else e=(h=e).m_next,this.Destroy(h)}else e=e.m_next}},e})(),sn=(function(){function t(){this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0}return t.prototype.Reset=function(){return this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0,this},t})(),on=(function(){function t(){this.dt=0,this.inv_dt=0,this.dtRatio=0,this.velocityIterations=0,this.positionIterations=0,this.particleIterations=0,this.warmStarting=!1}return t.prototype.Copy=function(t){return this.dt=t.dt,this.inv_dt=t.inv_dt,this.dtRatio=t.dtRatio,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.particleIterations=t.particleIterations,this.warmStarting=t.warmStarting,this},t})(),an=(function(){function t(){this.c=new P,this.a=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),cn=(function(){function t(){this.v=new P,this.w=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),ln=(function(){return function(){this.step=new on}})(),hn=(function(){function t(){this.rA=new P,this.rB=new P,this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),un=(function(){function t(){this.points=hn.MakeArray(o),this.normal=new P,this.tangent=new P,this.normalMass=new O,this.K=new O,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.invIA=0,this.invIB=0,this.friction=0,this.restitution=0,this.tangentSpeed=0,this.pointCount=0,this.contactIndex=0}return t.MakeArray=function(e){return d(e,(function(e){return new t}))},t})(),_n=(function(){function e(){this.localPoints=P.MakeArray(o),this.localNormal=new P,this.localPoint=new P,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.localCenterA=new P,this.localCenterB=new P,this.invIA=0,this.invIB=0,this.type=t.b2ManifoldType.e_unknown,this.radiusA=0,this.radiusB=0,this.pointCount=0}return e.MakeArray=function(t){return d(t,(function(t){return new e}))},e})(),fn=(function(){return function(){this.step=new on,this.count=0,this.allocator=null}})(),dn=(function(){function e(){this.normal=new P,this.point=new P,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var o=e.Initialize_s_pointA,a=e.Initialize_s_pointB,c=e.Initialize_s_planePoint,l=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:N.MulXV(n,i.localPoint,o),N.MulXV(r,i.localPoints[0],a),P.SubVV(a,o,this.normal).SelfNormalize(),P.MidVV(o,a,this.point),this.separation=P.DotVV(P.SubVV(a,o,P.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:F.MulRV(n.q,i.localNormal,this.normal),N.MulXV(n,i.localPoint,c),N.MulXV(r,i.localPoints[s],l),this.separation=P.DotVV(P.SubVV(l,c,P.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(l);break;case t.b2ManifoldType.e_faceB:F.MulRV(r.q,i.localNormal,this.normal),N.MulXV(r,i.localPoint,c),N.MulXV(n,i.localPoints[s],l),this.separation=P.DotVV(P.SubVV(l,c,P.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(l),this.normal.SelfNeg()}},e.Initialize_s_pointA=new P,e.Initialize_s_pointB=new P,e.Initialize_s_planePoint=new P,e.Initialize_s_clipPoint=new P,e})(),pn=(function(){function t(){this.m_step=new on,this.m_allocator=null,this.m_positionConstraints=_n.MakeArray(1024),this.m_velocityConstraints=un.MakeArray(1024),this.m_count=0}return t.prototype.Initialize=function(t){if(this.m_step.Copy(t.step),this.m_allocator=t.allocator,this.m_count=t.count,this.m_positionConstraints.length0?1/R:0;var D=s.tangent,L=P.CrossVV(B.rA,D),O=P.CrossVV(B.rB,D),V=_+f+d*L*L+p*O*O;B.tangentMass=V>0?1/V:0,B.velocityBias=0;var N=P.DotVV(s.normal,P.SubVV(P.AddVCrossSV(S,T,B.rB,P.s_t0),P.AddVCrossSV(x,C,B.rA,P.s_t1),P.s_t0));N<-1&&(B.velocityBias+=-s.restitution*N)}s.pointCount}},t.prototype.WarmStart=function(){for(var e=t.WarmStart_s_P,i=0;i0?-I/L:0;P.MulSV(O,E,o),A.SelfMulSub(d,o),b-=p*P.CrossVV(r,o),S.SelfMulAdd(y,o),T+=v*P.CrossVV(s,o)}this.m_positions[u].a=b,this.m_positions[_].a=T}return a>-3*c},t.prototype.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,o=t.SolveTOIPositionConstraints_s_rA,a=t.SolveTOIPositionConstraints_s_rB,l=t.SolveTOIPositionConstraints_s_P,h=0,u=0;u0?-D/V:0;P.MulSV(N,M,l),S.SelfMulSub(v,l),T-=x*P.CrossVV(o,l),w.SelfMulAdd(A,l),E+=b*P.CrossVV(a,l)}this.m_positions[f].a=T,this.m_positions[d].a=E}return h>=-1.5*c},t.InitializeVelocityConstraints_s_xfA=new N,t.InitializeVelocityConstraints_s_xfB=new N,t.InitializeVelocityConstraints_s_worldManifold=new At,t.WarmStart_s_P=new P,t.SolveVelocityConstraints_s_dv=new P,t.SolveVelocityConstraints_s_dv1=new P,t.SolveVelocityConstraints_s_dv2=new P,t.SolveVelocityConstraints_s_P=new P,t.SolveVelocityConstraints_s_a=new P,t.SolveVelocityConstraints_s_b=new P,t.SolveVelocityConstraints_s_x=new P,t.SolveVelocityConstraints_s_d=new P,t.SolveVelocityConstraints_s_P1=new P,t.SolveVelocityConstraints_s_P2=new P,t.SolveVelocityConstraints_s_P1P2=new P,t.SolvePositionConstraints_s_xfA=new N,t.SolvePositionConstraints_s_xfB=new N,t.SolvePositionConstraints_s_psm=new dn,t.SolvePositionConstraints_s_rA=new P,t.SolvePositionConstraints_s_rB=new P,t.SolvePositionConstraints_s_P=new P,t.SolveTOIPositionConstraints_s_xfA=new N,t.SolveTOIPositionConstraints_s_xfB=new N,t.SolveTOIPositionConstraints_s_psm=new dn,t.SolveTOIPositionConstraints_s_rA=new P,t.SolveTOIPositionConstraints_s_rB=new P,t.SolveTOIPositionConstraints_s_P=new P,t})(),mn=(function(){function e(){this.m_allocator=null,this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=an.MakeArray(1024),this.m_velocities=cn.MakeArray(1024),this.m_bodyCount=0,this.m_jointCount=0,this.m_contactCount=0,this.m_bodyCapacity=0,this.m_contactCapacity=0,this.m_jointCapacity=0}return e.prototype.Initialize=function(t,e,i,n,r){if(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_allocator=n,this.m_listener=r,this.m_positions.length4){var A=2/C.Length();_.SelfMul(A)}var b=c*f;if(b*b>2.4674011002726646)f*=A=1.570796326795/v(b);x.x+=c*_.x,x.y+=c*_.y,u+=c*f,this.m_positions[l].a=u,this.m_velocities[l].w=f}a.Reset();var S=!1;for(l=0;l.0012184696791469947||P.DotVV(h.m_linearVelocity,h.m_linearVelocity)>1e-4?(h.m_sleepTime=0,M=0):(h.m_sleepTime+=c,M=g(M,h.m_sleepTime)))}if(M>=.5&&S)for(l=0;l4){var d=2/f.Length();u.SelfMul(d)}var p=c*_;if(p*p>2.4674011002726646)_*=d=1.570796326795/v(p);l.SelfMulAdd(c,u),h+=c*_,this.m_positions[r].a=h,this.m_velocities[r].w=_;var m=this.m_bodies[r];m.m_sweep.c.Copy(l),m.m_sweep.a=h,m.m_linearVelocity.Copy(u),m.m_angularVelocity=_,m.SynchronizeTransform()}this.Report(a.m_velocityConstraints)},e.prototype.Report=function(t){if(null!==this.m_listener)for(var i=0;i0){var r=1/this.m_mass;this.m_center.SelfMul(r),this.m_linearVelocity.SelfMul(r)}this.m_inertia=0,this.m_angularVelocity=0;for(n=this.m_firstIndex;n0&&(this.m_angularVelocity*=1/this.m_inertia),this.m_timestamp=this.m_system.m_timestamp}},e.GetLinearVelocityFromWorldPoint_s_t0=new P,e})(),An=(function(){function t(t){this.m_front=0,this.m_back=0,this.m_capacity=0,this.m_buffer=d(t,(function(t){return null})),this.m_capacity=t}return t.prototype.Push=function(t){if(this.m_back>=this.m_capacity){for(var e=this.m_front;e=this.m_capacity&&(this.m_capacity>0?(this.m_buffer.concat(d(this.m_capacity,(function(t){return null}))),this.m_capacity*=2):(this.m_buffer.concat(d(1,(function(t){return null}))),this.m_capacity=1))}this.m_buffer[this.m_back]=t,this.m_back++},t.prototype.Pop=function(){this.m_buffer[this.m_front]=null,this.m_front++},t.prototype.Empty=function(){return this.m_front===this.m_back},t.prototype.Front=function(){var t=this.m_buffer[this.m_front];if(!t)throw new Error;return t},t})(),bn=(function(){function t(e){this.m_generatorCapacity=0,this.m_generatorCount=0,this.m_countX=0,this.m_countY=0,this.m_diagram=[],this.m_generatorBuffer=d(e,(function(e){return new t.Generator})),this.m_generatorCapacity=e}return t.prototype.AddGenerator=function(t,e,i){var n=this.m_generatorBuffer[this.m_generatorCount++];n.center.Copy(t),n.tag=e,n.necessary=i},t.prototype.Generate=function(e,n){for(var r=1/e,s=new P(+i,+i),o=new P(-i,-i),a=0,c=0;c=0&&u>=0&&h0&&l.Push(new t.Task(h-1,u,_-1,f)),u>0&&l.Push(new t.Task(h,u-1,_-this.m_countX,f)),hg*g+x*x&&(this.m_diagram[_]=m,h>0&&l.Push(new t.Task(h-1,u,_-1,m)),u>0&&l.Push(new t.Task(h,u-1,_-this.m_countX,m)),h=i)break;Sn(t,c,i)}}if(0===o)break;r=i,i=s[--o]}return t}function En(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Tn),wn(t,e,i,n)}function Bn(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r0;){var o=Math.floor(s/2),a=e+o;r(t[a],n)?(e=++a,s-=o+1):s=o}return e}function In(t,e,i,n,r){void 0===r&&(r=Tn);for(var s=i-e;s>0;){var o=Math.floor(s/2),a=e+o;r(n,t[a])?s=o:(e=++a,s-=o+1)}return e}function Rn(t,e,i,n){for(var r=i;e!==r;)Sn(t,e++,r++),r===n?r=i:e===i&&(i=r)}function Pn(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||Sn(t,++r,e);return++r}(function(t){var e=(function(){return function(){this.center=new P,this.tag=0,this.necessary=!1}})();t.Generator=e;var i=(function(){return function(t,e,i,n){this.m_x=t,this.m_y=e,this.m_i=i,this.m_generator=n}})();t.Task=i})(bn||(bn={}));var Dn=(function(){function t(t){this.data=[],this.count=0,this.capacity=0,this.allocator=t}return t.prototype.Append=function(){return this.count>=this.capacity&&this.Grow(),this.count++},t.prototype.Reserve=function(t){if(!(this.capacity>=t)){for(var e=this.capacity;e=0;)this.ReportFixtureAndParticle(t,i,s);return!0},e.prototype.ReportParticle=function(t,e){return!1},e.prototype.ReportFixtureAndParticle=function(t,e,i){},e})(en),On=(function(){function t(){this.indexA=0,this.indexB=0,this.weight=0,this.normal=new P,this.flags=0}return t.prototype.SetIndices=function(t,e){this.indexA=t,this.indexB=e},t.prototype.SetWeight=function(t){this.weight=t},t.prototype.SetNormal=function(t){this.normal.Copy(t)},t.prototype.SetFlags=function(t){this.flags=t},t.prototype.GetIndexA=function(){return this.indexA},t.prototype.GetIndexB=function(){return this.indexB},t.prototype.GetWeight=function(){return this.weight},t.prototype.GetNormal=function(){return this.normal},t.prototype.GetFlags=function(){return this.flags},t.prototype.IsEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&this.weight===t.weight&&this.normal.x===t.normal.x&&this.normal.y===t.normal.y},t.prototype.IsNotEqual=function(t){return!this.IsEqual(t)},t.prototype.ApproximatelyEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&v(this.weight-t.weight)<.01&&P.DistanceSquaredVV(this.normal,t.normal)<1e-4},t})(),Vn=(function(){return function(){this.index=0,this.weight=0,this.normal=new P,this.mass=0}})(),Fn=(function(){return function(){this.indexA=0,this.indexB=0,this.flags=0,this.strength=0,this.distance=0}})(),Nn=(function(){return function(){this.indexA=0,this.indexB=0,this.indexC=0,this.flags=0,this.strength=0,this.pa=new P(0,0),this.pb=new P(0,0),this.pc=new P(0,0),this.ka=0,this.kb=0,this.kc=0,this.s=0}})(),Gn=(function(){function t(){this.strictContactCheck=!1,this.density=1,this.gravityScale=1,this.radius=1,this.maxCount=0,this.pressureStrength=.005,this.dampingStrength=1,this.elasticStrength=.25,this.springStrength=.25,this.viscousStrength=.25,this.surfaceTensionPressureStrength=.2,this.surfaceTensionNormalStrength=.2,this.repulsiveStrength=1,this.powderStrength=.5,this.ejectionStrength=.5,this.staticPressureStrength=.2,this.staticPressureRelaxation=.2,this.staticPressureIterations=8,this.colorMixingStrength=.5,this.destroyByAge=!0,this.lifetimeGranularity=1/60}return t.prototype.Copy=function(t){return this.strictContactCheck=t.strictContactCheck,this.density=t.density,this.gravityScale=t.gravityScale,this.radius=t.radius,this.maxCount=t.maxCount,this.pressureStrength=t.pressureStrength,this.dampingStrength=t.dampingStrength,this.elasticStrength=t.elasticStrength,this.springStrength=t.springStrength,this.viscousStrength=t.viscousStrength,this.surfaceTensionPressureStrength=t.surfaceTensionPressureStrength,this.surfaceTensionNormalStrength=t.surfaceTensionNormalStrength,this.repulsiveStrength=t.repulsiveStrength,this.powderStrength=t.powderStrength,this.ejectionStrength=t.ejectionStrength,this.staticPressureStrength=t.staticPressureStrength,this.staticPressureRelaxation=t.staticPressureRelaxation,this.staticPressureIterations=t.staticPressureIterations,this.colorMixingStrength=t.colorMixingStrength,this.destroyByAge=t.destroyByAge,this.lifetimeGranularity=t.lifetimeGranularity,this},t.prototype.Clone=function(){return(new t).Copy(this)},t})();t.b2ParticleSystem=(function(){function n(t,e){this.m_paused=!1,this.m_timestamp=0,this.m_allParticleFlags=0,this.m_needsUpdateAllParticleFlags=!1,this.m_allGroupFlags=0,this.m_needsUpdateAllGroupFlags=!1,this.m_hasForce=!1,this.m_iterationIndex=0,this.m_inverseDensity=0,this.m_particleDiameter=0,this.m_inverseDiameter=0,this.m_squaredDiameter=0,this.m_count=0,this.m_internalAllocatedCapacity=0,this.m_handleIndexBuffer=new n.UserOverridableBuffer,this.m_flagsBuffer=new n.UserOverridableBuffer,this.m_positionBuffer=new n.UserOverridableBuffer,this.m_velocityBuffer=new n.UserOverridableBuffer,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new n.UserOverridableBuffer,this.m_groupBuffer=[],this.m_userDataBuffer=new n.UserOverridableBuffer,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new n.UserOverridableBuffer,this.m_bodyContactCountBuffer=new n.UserOverridableBuffer,this.m_consecutiveContactStepsBuffer=new n.UserOverridableBuffer,this.m_stuckParticleBuffer=new Dn(function(){return 0}),this.m_proxyBuffer=new Dn(function(){return new n.Proxy}),this.m_contactBuffer=new Dn(function(){return new On}),this.m_bodyContactBuffer=new Dn(function(){return new Vn}),this.m_pairBuffer=new Dn(function(){return new Fn}),this.m_triadBuffer=new Dn(function(){return new Nn}),this.m_expirationTimeBuffer=new n.UserOverridableBuffer,this.m_indexByExpirationTimeBuffer=new n.UserOverridableBuffer,this.m_timeElapsed=0,this.m_expirationTimeBufferRequiresSorting=!1,this.m_groupCount=0,this.m_groupList=null,this.m_def=new Gn,this.m_prev=null,this.m_next=null,this.SetStrictContactCheck(t.strictContactCheck),this.SetDensity(t.density),this.SetGravityScale(t.gravityScale),this.SetRadius(t.radius),this.SetMaxParticleCount(t.maxCount),this.m_def=t.Clone(),this.m_world=e,this.SetDestructionByAge(this.m_def.destroyByAge)}return n.computeTag=function(t,e){return(e+n.yOffset>>>0<>>0)>>>0},n.computeRelativeTag=function(t,e,i){return t+(i<>>0},n.prototype.Drop=function(){for(;this.m_groupList;)this.DestroyParticleGroup(this.m_groupList);this.FreeUserOverridableBuffer(this.m_handleIndexBuffer),this.FreeUserOverridableBuffer(this.m_flagsBuffer),this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer),this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer),this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer),this.FreeUserOverridableBuffer(this.m_positionBuffer),this.FreeUserOverridableBuffer(this.m_velocityBuffer),this.FreeUserOverridableBuffer(this.m_colorBuffer),this.FreeUserOverridableBuffer(this.m_userDataBuffer),this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer),this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer),this.FreeBuffer(this.m_forceBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_weightBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_staticPressureBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulationBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulation2Buffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_depthBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_groupBuffer,this.m_internalAllocatedCapacity)},n.prototype.CreateParticle=function(t){if(this.m_world.IsLocked())throw new Error;if(this.m_count>=this.m_internalAllocatedCapacity){var i=this.m_count?2*this.m_count:256;this.ReallocateInternalAllocatedBuffers(i)}if(this.m_count>=this.m_internalAllocatedCapacity){if(!this.m_def.destroyByAge)return u;this.DestroyOldestParticle(0,!1),this.SolveZombie()}var n=this.m_count++;if(!this.m_flagsBuffer.data)throw new Error;if(this.m_flagsBuffer.data[n]=0,this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=0),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=0),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=0),!this.m_positionBuffer.data)throw new Error;if(!this.m_velocityBuffer.data)throw new Error;this.m_positionBuffer.data[n]=(this.m_positionBuffer.data[n]||new P).Copy(e(t.position,P.ZERO)),this.m_velocityBuffer.data[n]=(this.m_velocityBuffer.data[n]||new P).Copy(e(t.velocity,P.ZERO)),this.m_weightBuffer[n]=0,this.m_forceBuffer[n]=(this.m_forceBuffer[n]||new P).SetZero(),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=0),this.m_depthBuffer&&(this.m_depthBuffer[n]=0);var r=(new k).Copy(e(t.color,k.ZERO));!this.m_colorBuffer.data&&r.IsZero()||(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data[n]=(this.m_colorBuffer.data[n]||new k).Copy(r)),(this.m_userDataBuffer.data||t.userData)&&(this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data[n]=t.userData),this.m_handleIndexBuffer.data&&(this.m_handleIndexBuffer.data[n]=null);var s=this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],o=e(t.lifetime,0),a=o>0;if(this.m_expirationTimeBuffer.data||a){if(this.SetParticleLifetime(n,a?o:this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())),!this.m_indexByExpirationTimeBuffer.data)throw new Error;this.m_indexByExpirationTimeBuffer.data[n]=n}s.index=n;var c=e(t.group,null);return this.m_groupBuffer[n]=c,c&&(c.m_firstIndex0?n:r,e)},n.prototype.DestroyParticlesInShape=function(t,e,i){void 0===i&&(i=!1);var r=n.DestroyParticlesInShape_s_aabb;if(this.m_world.IsLocked())throw new Error;var s=new n.DestroyParticlesInShapeCallback(this,t,e,i),o=r;return t.ComputeAABB(o,e,0),this.m_world.QueryAABB(s,o),s.Destroyed()},n.prototype.CreateParticleGroup=function(t){var i=n.CreateParticleGroup_s_transform;if(this.m_world.IsLocked())throw new Error;var r=i;r.SetPositionAngle(e(t.position,P.ZERO),e(t.angle,0));var s=this.m_count;if(t.shape&&this.CreateParticlesWithShapeForGroup(t.shape,t,r),t.shapes&&this.CreateParticlesWithShapesForGroup(t.shapes,e(t.shapeCount,t.shapes.length),t,r),t.positionData)for(var o=e(t.particleCount,t.positionData.length),a=0;a0&&(this.m_lastBodyContactStepBuffer.data=this.RequestBuffer(this.m_lastBodyContactStepBuffer.data),this.m_bodyContactCountBuffer.data=this.RequestBuffer(this.m_bodyContactCountBuffer.data),this.m_consecutiveContactStepsBuffer.data=this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))},n.prototype.GetStuckCandidates=function(){return this.m_stuckParticleBuffer.Data()},n.prototype.GetStuckCandidateCount=function(){return this.m_stuckParticleBuffer.GetCount()},n.prototype.ComputeCollisionEnergy=function(){if(!this.m_velocityBuffer.data)throw new Error;for(var t=n.ComputeCollisionEnergy_s_v,e=this.m_velocityBuffer.data,i=0,r=0;r0?this.GetQuantizedTimeElapsed()+s:s;o!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=o,this.m_expirationTimeBufferRequiresSorting=!0)},n.prototype.GetParticleLifetime=function(t){return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])},n.prototype.SetDestructionByAge=function(t){t&&this.GetExpirationTimeBuffer(),this.m_def.destroyByAge=t},n.prototype.GetDestructionByAge=function(){return this.m_def.destroyByAge},n.prototype.GetExpirationTimeBuffer=function(){return this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_expirationTimeBuffer.data},n.prototype.ExpirationTimeToLifetime=function(t){return(t>0?t-this.GetQuantizedTimeElapsed():t)*this.m_def.lifetimeGranularity},n.prototype.GetIndexByExpirationTimeBuffer=function(){if(this.GetParticleCount()?this.SetParticleLifetime(0,this.GetParticleLifetime(0)):this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),!this.m_indexByExpirationTimeBuffer.data)throw new Error;return this.m_indexByExpirationTimeBuffer.data},n.prototype.ParticleApplyLinearImpulse=function(t,e){this.ApplyLinearImpulse(t,t+1,e)},n.prototype.ApplyLinearImpulse=function(t,e,i){if(!this.m_velocityBuffer.data)throw new Error;for(var n=this.m_velocityBuffer.data,r=(e-t)*this.GetParticleMass(),s=(new P).Copy(i).SelfMul(1/r),o=t;o=0;){var m=P.SubVV(e,l[u],s),y=P.DotVV(m,f),v=y*y-d*(P.DotVV(m,m)-this.m_squaredDiameter);if(v>=0){var x=T(v),C=(-y-x)/d;if(C>_)continue;if(C<0&&((C=(-y+x)/d)<0||C>_))continue;var A=P.AddVMulSV(m,C,f,a);A.Normalize();var b=t.ReportParticle(this,u,P.AddVMulSV(e,C,f,c),A,C);if((_=g(_,b))<=0)break}}}},n.prototype.ComputeAABB=function(t){var e=this.GetParticleCount();if(t.lowerBound.x=+i,t.lowerBound.y=+i,t.upperBound.x=-i,t.upperBound.y=-i,!this.m_positionBuffer.data)throw new Error;for(var n=this.m_positionBuffer.data,r=0;re?e:t}if(t=e(t=e(t=e(t=e(t=e(t=e(t,this.m_def.maxCount),this.m_flagsBuffer.userSuppliedCapacity),this.m_positionBuffer.userSuppliedCapacity),this.m_velocityBuffer.userSuppliedCapacity),this.m_colorBuffer.userSuppliedCapacity),this.m_userDataBuffer.userSuppliedCapacity),this.m_internalAllocatedCapacity0;this.m_lastBodyContactStepBuffer.data=this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer,this.m_internalAllocatedCapacity,t,i),this.m_bodyContactCountBuffer.data=this.ReallocateBuffer4(this.m_bodyContactCountBuffer,this.m_internalAllocatedCapacity,t,i),this.m_consecutiveContactStepsBuffer.data=this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer,this.m_internalAllocatedCapacity,t,i),this.m_positionBuffer.data=this.ReallocateBuffer4(this.m_positionBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_velocityBuffer.data=this.ReallocateBuffer4(this.m_velocityBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_forceBuffer=this.ReallocateBuffer5(this.m_forceBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_weightBuffer=this.ReallocateBuffer5(this.m_weightBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_staticPressureBuffer=this.ReallocateBuffer5(this.m_staticPressureBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_accumulationBuffer=this.ReallocateBuffer5(this.m_accumulationBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_accumulation2Buffer=this.ReallocateBuffer5(this.m_accumulation2Buffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_depthBuffer=this.ReallocateBuffer5(this.m_depthBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_colorBuffer.data=this.ReallocateBuffer4(this.m_colorBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_groupBuffer=this.ReallocateBuffer5(this.m_groupBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_userDataBuffer.data=this.ReallocateBuffer4(this.m_userDataBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_expirationTimeBuffer.data=this.ReallocateBuffer4(this.m_expirationTimeBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_indexByExpirationTimeBuffer.data=this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_internalAllocatedCapacity=t}},n.prototype.CreateParticleForGroup=function(t,i,n){var r=new yn;r.flags=e(t.flags,0),N.MulXV(i,n,r.position),P.AddVV(e(t.linearVelocity,P.ZERO),P.CrossSV(e(t.angularVelocity,0),P.SubVV(r.position,e(t.position,P.ZERO),P.s_t0),P.s_t0),r.velocity),r.color.Copy(e(t.color,k.ZERO)),r.lifetime=e(t.lifetime,0),r.userData=t.userData,this.CreateParticle(r)},n.prototype.CreateParticlesStrokeShapeForGroup=function(i,r,s){var o=n.CreateParticlesStrokeShapeForGroup_s_edge,a=n.CreateParticlesStrokeShapeForGroup_s_d,c=n.CreateParticlesStrokeShapeForGroup_s_p,l=e(r.stride,0);0===l&&(l=this.GetParticleStride());for(var h=0,u=i.GetChildCount(),_=0;_=e&&f=e&&dv||P.DotVV(m,m)>v||P.DotVV(y,y)>v)return;var x=T.m_groupBuffer[t],C=T.m_groupBuffer[e],A=T.m_groupBuffer[i],b=T.m_triadBuffer.data[T.m_triadBuffer.Append()];b.indexA=t,b.indexB=e,b.indexC=i,b.flags=l|h|u,b.strength=g(g(x?x.m_strength:1,C?C.m_strength:1),A?A.m_strength:1);var S=(_.x+f.x+d.x)/3,w=(_.y+f.y+d.y)/3;b.pa.x=_.x-S,b.pa.y=_.y-w,b.pb.x=f.x-S,b.pb.y=f.y-w,b.pc.x=d.x-S,b.pc.y=d.y-w,b.ka=-P.DotVV(y,p),b.kb=-P.DotVV(p,m),b.kc=-P.DotVV(m,y),b.s=P.CrossVV(_,f)+P.CrossVV(f,d)+P.CrossVV(d,_)}})),En(this.m_triadBuffer.data,0,this.m_triadBuffer.count,n.CompareTriadIndices),this.m_triadBuffer.Unique(n.MatchTriadIndices)}},n.prototype.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new n.ReactiveFilter(this.m_flagsBuffer);if(this.UpdatePairsAndTriads(0,this.m_count,e),!this.m_flagsBuffer.data)throw new Error;for(var i=0;i>0,m=0;mA&&(this.m_depthBuffer[s]=A,y=!0),C>b&&(this.m_depthBuffer[o]=b,y=!0)}if(!y)break}for(_=0;_0){if(!this.m_bodyContactCountBuffer.data)throw new Error;if(!this.m_lastBodyContactStepBuffer.data)throw new Error;if(!this.m_consecutiveContactStepsBuffer.data)throw new Error;for(var i=this.GetParticleCount(),r=0;rthis.m_lastBodyContactStepBuffer.data[r]+1&&(this.m_consecutiveContactStepsBuffer.data[r]=0)}this.m_bodyContactBuffer.SetCount(0),this.m_stuckParticleBuffer.SetCount(0);var s=t;this.ComputeAABB(s);var o=new n.UpdateBodyContactsCallback(this,this.GetFixtureContactFilter());this.m_world.QueryAABB(o,s),this.m_def.strictContactCheck&&this.RemoveSpuriousBodyContacts(),this.NotifyBodyContactListenerPostContact(e)},n.prototype.Solve=function(e){var i=n.Solve_s_subStep;if(0!==this.m_count&&(this.m_expirationTimeBuffer.data&&this.SolveLifetimes(e),this.m_allParticleFlags&t.b2ParticleFlag.b2_zombieParticle&&this.SolveZombie(),this.m_needsUpdateAllParticleFlags&&this.UpdateAllParticleFlags(),this.m_needsUpdateAllGroupFlags&&this.UpdateAllGroupFlags(),!this.m_paused))for(this.m_iterationIndex=0;this.m_iterationIndexi&&r.SelfMul(T(i/s))}},n.prototype.SolveGravity=function(t){if(!this.m_velocityBuffer.data)throw new Error;for(var e=n.SolveGravity_s_gravity,i=this.m_velocityBuffer.data,r=P.MulSV(t.dt*this.m_def.gravityScale,this.m_world.GetGravity(),e),s=0;s=0;){var F=p[V],N=this.m_groupBuffer[V];if(B!==N&&M!==N){var G=this.GetLinearVelocity(N,V,F,c),k=P.SubVV(F,S,l),z=P.SubVV(G,I,h),U=P.CrossVV(L,z),W=P.CrossVV(D,z)-P.CrossVV(k,L),j=P.CrossVV(D,k),H=void 0,q=void 0,X=u,Y=_;if(0===U){if(0===W)continue;if(!((q=-j/W)>=0&&q=0&&H<=1))continue}else{var J=W*W-4*j*U;if(J<0)continue;var Z=T(J),K=(-W-Z)/(2*U),Q=(-W+Z)/(2*U);if(K>Q){var $=K;K=Q,Q=$}if(q=K,P.AddVMulSV(D,q,L,X),P.AddVMulSV(k,q,z,Y),H=P.DotVV(X,Y)/P.DotVV(X,X),!(q>=0&&q=0&&H<=1)){if(!((q=Q)>=0&&q=0&&H<=1))continue}}var tt=f;tt.x=I.x+H*L.x-G.x,tt.y=I.y+H*L.y-G.y;var et=P.MulSV(g,tt,d);if(N&&this.IsRigidGroup(N)){var it=N.GetMass(),nt=N.GetInertia();it>0&&N.m_linearVelocity.SelfMulAdd(1/it,et),nt>0&&(N.m_angularVelocity+=P.CrossVV(P.SubVV(F,N.GetCenter(),P.s_t0),et)/nt)}else m[V].SelfAdd(tt);this.ParticleApplyForce(V,et.SelfMul(-e.inv_dt))}}}}},n.prototype.SolveStaticPressure=function(e){if(!this.m_flagsBuffer.data)throw new Error;this.m_staticPressureBuffer=this.RequestBuffer(this.m_staticPressureBuffer);for(var i=this.GetCriticalPressure(e),n=this.m_def.staticPressureStrength*i,r=.25*i,s=this.m_def.staticPressureRelaxation,o=0;o.25){var h=p.body,u=p.mass,_=r[l],f=p.normal,d=P.MulSV(o*u*(m-.25),f,i);s[l].SelfMulSub(a,d),h.ApplyLinearImpulse(d,_,!0)}}for(c=0;c.25){l=p.indexA,h=p.indexB,f=p.normal,d=P.MulSV(o*(m-.25),f,i);s[l].SelfSub(d),s[h].SelfAdd(d)}}},n.prototype.SolveSolid=function(t){var e=n.SolveSolid_s_f;if(!this.m_velocityBuffer.data)throw new Error;var i=this.m_velocityBuffer.data;this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer);for(var r=t.inv_dt*this.m_def.ejectionStrength,s=0;s=0?(T=g(T,B),w=x(w,B+1)):E=!0}Tr:s})),this.m_expirationTimeBufferRequiresSorting=!1}for(var s=r-1;s>=0;--s){var o=n[s],a=i[o];if(ee.weight:t.index3)return!0;var a=t.Copy(n.normal);if(a.SelfMul(r.m_particleDiameter*(1-n.weight)),!r.m_positionBuffer.data)throw new Error;var l=P.AddVV(r.m_positionBuffer.data[n.index],a,e);if(!n.fixture.TestPoint(l)){for(var h=n.fixture.GetShape().GetChildCount(),u=0;uthis.m_stuckThreshold&&(this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()]=t)),this.m_lastBodyContactStepBuffer.data[t]=this.m_timestamp}},n.prototype.ValidateParticleIndex=function(t){return t>=0&&t0?1/n:0,e[0]=r>0?1/r:0,i[0]=P.CrossVV(P.SubVV(o,s,P.s_t0),a)},n.prototype.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,o,a,c){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),a,c);else{if(!this.m_flagsBuffer.data)throw new Error;var l=this.m_flagsBuffer.data[o];this.InitDampingParameter(e,i,n,l&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,a,a,c)}},n.prototype.ComputeDampingImpulse=function(t,e,i,n,r,s,o){var a=t+e*i*i+n+r*s*s;return a>0?o/a:0},n.prototype.ApplyDamping=function(t,e,i,n,r,s,o,a){if(r&&n)r.m_linearVelocity.SelfMulAdd(o*t,a),r.m_angularVelocity+=o*i*e;else{if(!this.m_velocityBuffer.data)throw new Error;this.m_velocityBuffer.data[s].SelfMulAdd(o*t,a)}},n.xTruncBits=12,n.yTruncBits=12,n.tagBits=32,n.yOffset=1<>>0,this.m_xUpper=(n&e.xMask)>>>0,this.m_yLower=(i&e.yMask)>>>0,this.m_yUpper=(n&e.yMask)>>>0,this.m_first=r,this.m_last=s}return t.prototype.GetNext=function(){for(;this.m_first>>0;if(t>=this.m_xLower&&t<=this.m_xUpper)return this.m_system.m_proxyBuffer.data[this.m_first++].index;this.m_first++}return u},t})();e.InsideBoundsEnumerator=s;var o=(function(){return function(){this.next=null,this.count=0,this.index=0}})();e.ParticleListNode=o;var a=(function(){function t(){}return t.prototype.Allocate=function(t,e){return e},t.prototype.Clear=function(){},t.prototype.GetCount=function(){return 0},t.prototype.Invalidate=function(t){},t.prototype.GetValidBuffer=function(){return[]},t.prototype.GetBuffer=function(){return[]},t.prototype.SetCount=function(t){},t})();e.FixedSetAllocator=a;var l=(function(){return function(t,e){this.second=u,this.first=t,this.second=e}})();e.FixtureParticle=l;var h=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return $e(e,t),e.prototype.Initialize=function(t,e){},e.prototype.Find=function(t){return u},e})(e.FixedSetAllocator);e.FixtureParticleSet=h;var _=(function(){return function(t,e){this.first=u,this.second=u,this.first=t,this.second=e}})();e.ParticlePair=_;var f=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return $e(e,t),e.prototype.Initialize=function(t,e){},e.prototype.Find=function(t){return u},e})(e.FixedSetAllocator);e.b2ParticlePairSet=f;var d=(function(){function t(){}return t.prototype.IsNecessary=function(t){return!0},t.prototype.ShouldCreatePair=function(t,e){return!0},t.prototype.ShouldCreateTriad=function(t,e,i){return!0},t})();e.ConnectionFilter=d;var p=(function(t){function e(e,i,n,r){var s=t.call(this)||this;return s.m_callDestructionListener=!1,s.m_destroyed=0,s.m_system=e,s.m_shape=i,s.m_xf=n,s.m_callDestructionListener=r,s.m_destroyed=0,s}return $e(e,t),e.prototype.ReportFixture=function(t){return!1},e.prototype.ReportParticle=function(t,e){if(t!==this.m_system)return!1;if(!this.m_system.m_positionBuffer.data)throw new Error;return this.m_shape.TestPoint(this.m_xf,this.m_system.m_positionBuffer.data[e])&&(this.m_system.DestroyParticle(e,this.m_callDestructionListener),this.m_destroyed++),!0},e.prototype.Destroyed=function(){return this.m_destroyed},e})(en);e.DestroyParticlesInShapeCallback=p;var m=(function(t){function e(e){var i=t.call(this)||this;return i.m_threshold=0,i.m_threshold=e,i}return $e(e,t),e.prototype.ShouldCreatePair=function(t,e){return t0?1/_:0,p=f>0?1/f:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),y=P.SubVV(a,u,o),v=P.CrossVV(y,c),g=m+d+p*v*v,x=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];x.index=r,x.body=h,x.fixture=i,x.weight=1-l*this.m_system.m_inverseDiameter,x.normal.Copy(c.SelfNeg()),x.mass=g>0?1/g:0,this.m_system.DetectStuckParticle(r)}},n.ReportFixtureAndParticle_s_n=new P,n.ReportFixtureAndParticle_s_rp=new P,n})(Ln);e.UpdateBodyContactsCallback=g;var x=(function(i){function n(t,e){var n=i.call(this,t)||this;return n.m_step=e,n}return $e(n,i),n.prototype.ReportFixtureAndParticle=function(i,n,r){var s=e.SolveCollisionCallback.ReportFixtureAndParticle_s_p1,o=e.SolveCollisionCallback.ReportFixtureAndParticle_s_output,a=e.SolveCollisionCallback.ReportFixtureAndParticle_s_input,l=e.SolveCollisionCallback.ReportFixtureAndParticle_s_p,h=e.SolveCollisionCallback.ReportFixtureAndParticle_s_v,u=e.SolveCollisionCallback.ReportFixtureAndParticle_s_f,_=i.GetBody();if(!this.m_system.m_positionBuffer.data)throw new Error;if(!this.m_system.m_velocityBuffer.data)throw new Error;var f=this.m_system.m_positionBuffer.data[r],d=this.m_system.m_velocityBuffer.data[r],p=o,m=a;if(0===this.m_system.m_iterationIndex){var y=N.MulTXV(_.m_xf0,f,s);i.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(y.SelfSub(_.GetLocalCenter()),F.MulRV(_.m_xf0.q,y,y),F.MulTRV(_.m_xf.q,y,y),y.SelfAdd(_.GetLocalCenter())),N.MulXV(_.m_xf,y,m.p1)}else m.p1.Copy(f);if(P.AddVMulSV(f,this.m_step.dt,d,m.p2),m.maxFraction=1,i.RayCast(p,m,n)){var v=p.normal,g=l;g.x=(1-p.fraction)*m.p1.x+p.fraction*m.p2.x+c*v.x,g.y=(1-p.fraction)*m.p1.y+p.fraction*m.p2.y+c*v.y;var x=h;x.x=this.m_step.inv_dt*(g.x-f.x),x.y=this.m_step.inv_dt*(g.y-f.y),this.m_system.m_velocityBuffer.data[r].Copy(x);var C=u;C.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.x-x.x),C.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.y-x.y),this.m_system.ParticleApplyForce(r,C)}},n.prototype.ReportParticle=function(t,e){return!1},n.ReportFixtureAndParticle_s_p1=new P,n.ReportFixtureAndParticle_s_output=new Tt,n.ReportFixtureAndParticle_s_input=new St,n.ReportFixtureAndParticle_s_p=new P,n.ReportFixtureAndParticle_s_v=new P,n.ReportFixtureAndParticle_s_f=new P,n})(Ln);e.SolveCollisionCallback=x})(t.b2ParticleSystem||(t.b2ParticleSystem={}));var kn=(function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new rn,this.m_bodyList=null,this.m_jointList=null,this.m_particleSystemList=null,this.m_bodyCount=0,this.m_jointCount=0,this.m_gravity=new P,this.m_allowSleep=!0,this.m_destructionListener=null,this.m_debugDraw=null,this.m_inv_dt0=0,this.m_warmStarting=!0,this.m_continuousPhysics=!0,this.m_subStepping=!1,this.m_stepComplete=!0,this.m_profile=new sn,this.m_island=new mn,this.s_stack=[],this.m_controllerList=null,this.m_controllerCount=0,this.m_gravity.Copy(t)}return e.prototype.SetDestructionListener=function(t){this.m_destructionListener=t},e.prototype.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=t},e.prototype.SetContactListener=function(t){this.m_contactManager.m_contactListener=t},e.prototype.SetDebugDraw=function(t){this.m_debugDraw=t},e.prototype.CreateBody=function(t){if(void 0===t&&(t={}),this.IsLocked())throw new Error;var e=new li(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},e.prototype.DestroyBody=function(t){if(this.IsLocked())throw new Error;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var n=t.m_controllerList;n;){var r=n;n=n.nextController,r.controller.RemoveBody(t)}for(var s=t.m_contactList;s;){var o=s;s=s.next,this.m_contactManager.Destroy(o.contact)}t.m_contactList=null;for(var a=t.m_fixtureList;a;){var c=a;a=a.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(c),c.DestroyProxies(),c.Destroy(),t.m_fixtureList=a,t.m_fixtureCount-=1}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount},e._Joint_Create=function(e,i){switch(e.type){case t.b2JointType.e_distanceJoint:return new pi(e);case t.b2JointType.e_mouseJoint:return new Ti(e);case t.b2JointType.e_prismaticJoint:return new Ei(e);case t.b2JointType.e_revoluteJoint:return new Ri(e);case t.b2JointType.e_pulleyJoint:return new Mi(e);case t.b2JointType.e_gearJoint:return new Ci(e);case t.b2JointType.e_wheelJoint:return new Fi(e);case t.b2JointType.e_weldJoint:return new Oi(e);case t.b2JointType.e_frictionJoint:return new gi(e);case t.b2JointType.e_ropeJoint:return new Di(e);case t.b2JointType.e_motorJoint:return new bi(e);case t.b2JointType.e_areaJoint:return new yi(e)}throw new Error},e._Joint_Destroy=function(t,e){},e.prototype.CreateJoint=function(t){if(this.IsLocked())throw new Error;var i=e._Joint_Create(t,null);i.m_prev=null,i.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=i),this.m_jointList=i,++this.m_jointCount,i.m_edgeA.prev=null,i.m_edgeA.next=i.m_bodyA.m_jointList,i.m_bodyA.m_jointList&&(i.m_bodyA.m_jointList.prev=i.m_edgeA),i.m_bodyA.m_jointList=i.m_edgeA,i.m_edgeB.prev=null,i.m_edgeB.next=i.m_bodyB.m_jointList,i.m_bodyB.m_jointList&&(i.m_bodyB.m_jointList.prev=i.m_edgeB),i.m_bodyB.m_jointList=i.m_edgeB;var n=t.bodyA,r=t.bodyB;if(!t.collideConnected)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next;return i},e.prototype.DestroyJoint=function(t){if(this.IsLocked())throw new Error;var i=t.m_collideConnected;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_jointList&&(this.m_jointList=t.m_next);var n=t.m_bodyA,r=t.m_bodyB;if(n.SetAwake(!0),r.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA===n.m_jointList&&(n.m_jointList=t.m_edgeA.next),t.m_edgeA.prev=null,t.m_edgeA.next=null,t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB===r.m_jointList&&(r.m_jointList=t.m_edgeB.next),t.m_edgeB.prev=null,t.m_edgeB.next=null,e._Joint_Destroy(t,null),--this.m_jointCount,!i)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next},e.prototype.CreateParticleSystem=function(e){if(this.IsLocked())throw new Error;var i=new t.b2ParticleSystem(e,this);return i.m_prev=null,i.m_next=this.m_particleSystemList,this.m_particleSystemList&&(this.m_particleSystemList.m_prev=i),this.m_particleSystemList=i,i},e.prototype.DestroyParticleSystem=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_particleSystemList&&(this.m_particleSystemList=t.m_next)},e.prototype.CalculateReasonableParticleIterations=function(t){if(null===this.m_particleSystemList)return 1;return vn(this.m_gravity.Length(),(function(t){for(var e=i,n=t.GetParticleSystemList();null!==n;n=n.m_next)e=g(e,n.GetRadius());return e})(this),t)},e.prototype.Step=function(t,i,n,r){void 0===r&&(r=this.CalculateReasonableParticleIterations(t));var s=e.Step_s_stepTimer.Reset();this.m_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_newFixture=!1),this.m_locked=!0;var o=e.Step_s_step;o.dt=t,o.velocityIterations=i,o.positionIterations=n,o.particleIterations=r,o.inv_dt=t>0?1/t:0,o.dtRatio=this.m_inv_dt0*t,o.warmStarting=this.m_warmStarting;var a=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=a.GetMilliseconds(),this.m_stepComplete&&o.dt>0){for(var c=e.Step_s_timer.Reset(),l=this.m_particleSystemList;l;l=l.m_next)l.Solve(o);this.Solve(o),this.m_profile.solve=c.GetMilliseconds()}if(this.m_continuousPhysics&&o.dt>0){var h=e.Step_s_timer.Reset();this.SolveTOI(o),this.m_profile.solveTOI=h.GetMilliseconds()}o.dt>0&&(this.m_inv_dt0=o.inv_dt),this.m_clearForces&&this.ClearForces(),this.m_locked=!1,this.m_profile.step=s.GetMilliseconds()},e.prototype.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},e.prototype.DrawParticleSystem=function(t){if(null!==this.m_debugDraw){var e=t.GetParticleCount();if(e){var i=t.GetRadius(),n=t.GetPositionBuffer();if(t.m_colorBuffer.data){var r=t.GetColorBuffer();this.m_debugDraw.DrawParticles(n,i,r,e)}else this.m_debugDraw.DrawParticles(n,i,null,e)}}},e.prototype.DrawDebugData=function(){if(null!==this.m_debugDraw){var i=this.m_debugDraw.GetFlags(),n=e.DrawDebugData_s_color.SetRGB(0,0,0);if(i&t.b2DrawFlags.e_shapeBit)for(var r=this.m_bodyList;r;r=r.m_next){var s=r.m_xf;this.m_debugDraw.PushTransform(s);for(var o=r.GetFixtureList();o;o=o.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(o,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(o,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(o,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(o,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(o,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var a=this.m_particleSystemList;a;a=a.m_next)this.DrawParticleSystem(a);if(i&t.b2DrawFlags.e_jointBit)for(var c=this.m_jointList;c;c=c.m_next)this.DrawJoint(c);if(i&t.b2DrawFlags.e_aabbBit){n.SetRGB(.9,.3,.9);var l=e.DrawDebugData_s_vs;for(r=this.m_bodyList;r;r=r.m_next)if(r.IsActive())for(o=r.GetFixtureList();o;o=o.m_next)for(var h=0;h0;){if(!(i=a[--l]))throw new Error;if(r.AddBody(i),i.m_awakeFlag=!0,i.GetType()!==t.b2BodyType.b2_staticBody){for(var h=i.m_contactList;h;h=h.next){var u=h.contact;if(!u.m_islandFlag&&(u.IsEnabled()&&u.IsTouching())){var _=u.m_fixtureA.m_isSensor,f=u.m_fixtureB.m_isSensor;if(!_&&!f){if(r.AddContact(u),u.m_islandFlag=!0,!(p=h.other))throw new Error;p.m_islandFlag||(a[l++]=p,p.m_islandFlag=!0)}}}for(var d=i.m_jointList;d;d=d.next){var p;if(!d.joint.m_islandFlag)(p=d.other).IsActive()&&(r.AddJoint(d.joint),d.joint.m_islandFlag=!0,p.m_islandFlag||(a[l++]=p,p.m_islandFlag=!0))}}}var m=new sn;r.Solve(m,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=m.solveInit,this.m_profile.solveVelocity+=m.solveVelocity,this.m_profile.solvePosition+=m.solvePosition;for(var y=0;y8)){var l=1;if(o.m_toiFlag)l=o.m_toi;else{var h=o.GetFixtureA(),u=o.GetFixtureB();if(h.IsSensor()||u.IsSensor())continue;var _=h.GetBody(),f=u.GetBody(),d=_.m_type,p=f.m_type,m=_.IsAwake()&&d!==t.b2BodyType.b2_staticBody,y=f.IsAwake()&&p!==t.b2BodyType.b2_staticBody;if(!m&&!y)continue;var v=_.IsBullet()||d!==t.b2BodyType.b2_dynamicBody,x=f.IsBullet()||p!==t.b2BodyType.b2_dynamicBody;if(!v&&!x)continue;var C=_.m_sweep.alpha0;_.m_sweep.alpha0this.maxTimestep&&this.maxTimestep>0&&(i=this.maxTimestep);for(var r=this.m_bodyList;r;r=r.nextBody){var s=r.body;if(s.IsAwake()){var o=s.GetWorldVector(O.MulMV(this.T,s.GetLocalVector(s.GetLinearVelocity(),P.s_t0),P.s_t1),e.Step_s_damping);s.SetLinearVelocity(P.AddVV(s.GetLinearVelocity(),P.MulSV(i,o,P.s_t0),P.s_t1))}}}},e.prototype.Draw=function(t){},e.prototype.SetAxisAligned=function(t,e){this.T.ex.x=-t,this.T.ex.y=0,this.T.ey.x=0,this.T.ey.y=-e,this.maxTimestep=t>0||e>0?1/x(t,e):0},e.Step_s_damping=new P,e})(Un),Yn=(function(){return function(){this.vertices=[],this.count=0,this.masses=[],this.gravity=new P(0,0),this.damping=.1,this.k2=.9,this.k3=.1}})(),Jn=(function(){function t(){this.m_count=0,this.m_ps=[],this.m_p0s=[],this.m_vs=[],this.m_ims=[],this.m_Ls=[],this.m_as=[],this.m_gravity=new P,this.m_damping=0,this.m_k2=1,this.m_k3=.1}return t.prototype.GetVertexCount=function(){return this.m_count},t.prototype.GetVertices=function(){return this.m_ps},t.prototype.Initialize=function(t){this.m_count=t.count,this.m_ps=P.MakeArray(this.m_count),this.m_p0s=P.MakeArray(this.m_count),this.m_vs=P.MakeArray(this.m_count),this.m_ims=p(this.m_count);for(var e=0;e0?1/i:0}var n=this.m_count-1,r=this.m_count-2;this.m_Ls=p(n),this.m_as=p(r);for(e=0;e0&&this.m_vs[n].SelfMulAdd(t,this.m_gravity),this.m_vs[n].SelfMul(i),this.m_ps[n].SelfMulAdd(t,this.m_vs[n]);for(n=0;ns;)b=(m-=2*s)-this.m_as[i];for(;b<-s;)b=(m+=2*s)-this.m_as[i];var S=-this.m_k3*A*b;n.SelfMulAdd(a*S,g),r.SelfMulAdd(c*S,x),o.SelfMulAdd(l*S,C)}}}},t.prototype.Draw=function(t){for(var e=new k(.4,.5,.7),i=0;i>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,t|=t>>8&16777215,1+(t|=t>>16&65535)},t.b2IsPowerOfTwo=function(t){return t>0&&0==(t&t-1)},t.b2Random=function(){return 2*Math.random()-1},t.b2RandomRange=function(t,e){return(e-t)*Math.random()+t},t.b2Vec2=P,t.b2Vec2_zero=D,t.b2Vec3=L,t.b2Mat22=O,t.b2Mat33=V,t.b2Rot=F,t.b2Transform=N,t.b2Sweep=G,t.b2Color=k,t.b2Draw=z,t.b2Timer=U,t.b2Counter=W,t.b2GrowableStack=j,t.b2BlockAllocator=H,t.b2StackAllocator=q,t.b2ContactFeature=vt,t.b2ContactID=gt,t.b2ManifoldPoint=xt,t.b2Manifold=Ct,t.b2WorldManifold=At,t.b2GetPointStates=function(e,i,n,r){var s;for(s=0;sA;){t.iterations+=1,d=i.GetSupport(F.MulTRV(s.q,P.NegV(g,P.s_t1),P.s_t0)),p=N.MulXV(s,i.GetVertex(d),_t),m=n.GetSupport(F.MulTRV(o.q,g,P.s_t0)),y=N.MulXV(o,n.GetVertex(m),ft);var S=P.SubVV(p,y,pt);g.Normalize();var T=P.DotVV(g,S),w=P.DotVV(g,a);if(T-C>u*w){if(w<=0)return!1;if((u=(T-C)/w)>1)return!1;l.Copy(g).SelfNeg(),_.m_count=0}var E=f[_.m_count];switch(E.indexA=m,E.wA.Copy(y).SelfMulAdd(u,a),E.indexB=d,E.wB.Copy(p),E.w.Copy(E.wB).SelfSub(E.wA),E.a=1,_.m_count+=1,_.m_count){case 1:break;case 2:_.Solve2();break;case 3:_.Solve3()}if(3===_.m_count)return!1;_.GetClosestPoint(g),++b}var B=mt,M=yt;return _.GetWitnessPoints(B,M),g.LengthSquared()>0&&(l.Copy(g).SelfNeg(),l.Normalize()),t.normal.Copy(l),t.lambda=u,t.iterations=b,!0},t.b2Pair=Vt,t.b2BroadPhase=Ft,t.b2PairLessThan=Nt,t.b2TreeNode=Lt,t.b2DynamicTree=Ot,t.b2_toi_reset=function(){t.b2_toiTime=0,t.b2_toiMaxTime=0,t.b2_toiCalls=0,t.b2_toiIters=0,t.b2_toiMaxIters=0,t.b2_toiRootIters=0,t.b2_toiMaxRootIters=0},t.b2TOIInput=qt,t.b2TOIOutput=Xt,t.b2SeparationFunction=Yt,t.b2TimeOfImpact=re,t.b2CollideCircles=ae,t.b2CollidePolygonAndCircle=ue,t.b2CollidePolygons=Oe,t.b2CollideEdgeAndCircle=je,t.b2CollideEdgeAndPolygon=Je,t.b2MassData=Ze,t.b2Shape=Ke,t.b2CircleShape=ti,t.b2PolygonShape=ei,t.b2EdgeShape=ii,t.b2ChainShape=ni,t.b2Filter=ri,t.b2FixtureDef=si,t.b2FixtureProxy=oi,t.b2Fixture=ai,t.b2BodyDef=ci,t.b2Body=li,t.b2World=kn,t.b2DestructionListener=Ki,t.b2ContactFilter=Qi,t.b2ContactImpulse=$i,t.b2ContactListener=tn,t.b2QueryCallback=en,t.b2RayCastCallback=nn,t.b2Island=mn,t.b2Profile=sn,t.b2TimeStep=on,t.b2Position=an,t.b2Velocity=cn,t.b2SolverData=ln,t.b2ContactManager=rn,t.b2MixFriction=Ni,t.b2MixRestitution=Gi,t.b2ContactEdge=ki,t.b2Contact=zi,t.b2ContactRegister=Ji,t.b2ContactFactory=Zi,t.g_blockSolve=!1,t.b2VelocityConstraintPoint=hn,t.b2ContactVelocityConstraint=un,t.b2ContactPositionConstraint=_n,t.b2ContactSolverDef=fn,t.b2PositionSolverManifold=dn,t.b2ContactSolver=pn,t.b2CircleContact=Ui,t.b2PolygonContact=Wi,t.b2PolygonAndCircleContact=ji,t.b2EdgeAndCircleContact=Hi,t.b2EdgeAndPolygonContact=qi,t.b2ChainAndCircleContact=Xi,t.b2ChainAndPolygonContact=Yi,t.b2Jacobian=hi,t.b2JointEdge=ui,t.b2JointDef=_i,t.b2Joint=fi,t.b2AreaJointDef=mi,t.b2AreaJoint=yi,t.b2DistanceJointDef=di,t.b2DistanceJoint=pi,t.b2FrictionJointDef=vi,t.b2FrictionJoint=gi,t.b2GearJointDef=xi,t.b2GearJoint=Ci,t.b2MotorJointDef=Ai,t.b2MotorJoint=bi,t.b2MouseJointDef=Si,t.b2MouseJoint=Ti,t.b2PrismaticJointDef=wi,t.b2PrismaticJoint=Ei,t.b2_minPulleyLength=2,t.b2PulleyJointDef=Bi,t.b2PulleyJoint=Mi,t.b2RevoluteJointDef=Ii,t.b2RevoluteJoint=Ri,t.b2RopeJointDef=Pi,t.b2RopeJoint=Di,t.b2WeldJointDef=Li,t.b2WeldJoint=Oi,t.b2WheelJointDef=Vi,t.b2WheelJoint=Fi,t.b2ControllerEdge=zn,t.b2Controller=Un,t.b2BuoyancyController=Wn,t.b2ConstantAccelController=jn,t.b2ConstantForceController=Hn,t.b2GravityController=qn,t.b2TensorDampingController=Xn,t.b2ParticleDef=yn,t.b2CalculateParticleIterations=vn,t.b2ParticleHandle=gn,t.b2ParticleGroupDef=xn,t.b2ParticleGroup=Cn,t.b2GrowableBuffer=Dn,t.b2FixtureParticleQueryCallback=Ln,t.b2ParticleContact=On,t.b2ParticleBodyContact=Vn,t.b2ParticlePair=Fn,t.b2ParticleTriad=Nn,t.b2ParticleSystemDef=Gn,t.b2RopeDef=Yn,t.b2Rope=Jn,Object.defineProperty(t,"__esModule",{value:!0})}))}),{}],336:[(function(t,e,i){"use strict";var n="undefined"==typeof window?global:window;n.cc=n.cc||{},n._cc=n._cc||{},t("./predefine"),t("./polyfill/string"),t("./polyfill/misc"),t("./polyfill/array"),t("./polyfill/object"),t("./polyfill/array-buffer"),t("./polyfill/number"),t("./polyfill/typescript"),t("./cocos2d/core/predefine"),t("./cocos2d"),t("./extends"),e.exports=n.cc}),{"./cocos2d":286,"./cocos2d/core/predefine":185,"./extends":333,"./package":void 0,"./polyfill/array":338,"./polyfill/array-buffer":337,"./polyfill/misc":339,"./polyfill/number":340,"./polyfill/object":341,"./polyfill/string":342,"./polyfill/typescript":343,"./predefine":344}],337:[(function(t,e,i){"use strict";if(!ArrayBuffer.isView){var n=Object.getPrototypeOf(Int8Array);ArrayBuffer.isView="function"==typeof n?function(t){return t instanceof n}:function(t){var e=t.constructor;return e===Float32Array||e===Uint8Array||e===Uint32Array||e===Int8Array}}}),{}],338:[(function(t,e,i){"use strict";Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.find||(Array.prototype.find=function(t){for(var e=this.length,i=0;i0?1:-1}),Math.log2||(Math.log2=function(t){return Math.log(t)*Math.LOG2E}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),!console.time){var n=window.performance||Date,r=Object.create(null);console.time=function(t){r[t]=n.now()},console.timeEnd=function(t){var e=r[t],i=n.now()-e;console.log(t+": "+i+"ms")}}}),{}],340:[(function(t,e,i){"use strict";Number.parseFloat=Number.parseFloat||parseFloat,Number.parseInt=Number.parseInt||parseInt}),{}],341:[(function(t,e,i){"use strict";Object.assign||(Object.assign=function(t,e){return cc.js.mixin(t,e)}),Object.getOwnPropertyDescriptors||(Object.getOwnPropertyDescriptors=function(t){var e={},i=Object.getOwnPropertyNames(t);Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(t)));for(var n=0;nthis.length)&&(e=this.length),e-=t.length;var i=this.indexOf(t,e);return-1!==i&&i===e}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/,"")})}),{}],343:[(function(t,e,i){"use strict";var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};window.__extends=function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},window.__assign=Object.assign||function(t){for(var e,i=1,n=arguments.length;i=0;a--)(r=t[a])&&(o=(s<3?r(o):s>3?r(e,i,o):r(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o},window.__param=function(t,e){return function(i,n){e(i,n,t)}},window.__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},window.__awaiter=function(t,e,i,n){return new(i||(i=Promise))(function(r,s){function o(t){try{c(n.next(t))}catch(t){s(t)}}function a(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){t.done?r(t.value):new i(function(e){e(t.value)}).then(o,a)}c((n=n.apply(t,e||[])).next())})},window.__generator=function(t,e){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return c([t,e])}}function c(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=(r=o.trys).length>0&&r[r.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}},window.__read=function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,s=i.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},window.__spread=function(){for(var t=[],e=0;e1||a(t,e)})})}function a(t,e){try{c(r[t](e))}catch(t){u(s[0][3],t)}}function c(t){t.value instanceof __await?Promise.resolve(t.value.v).then(l,h):u(s[0][2],t)}function l(t){a("next",t)}function h(t){a("throw",t)}function u(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}},window.__asyncDelegator=function(t){var e,i;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,r){e[n]=t[n]?function(e){return(i=!i)?{value:__await(t[n](e)),done:"return"===n}:r?r(e):e}:r}},window.__asyncValues=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,i=t[Symbol.asyncIterator];return i?i.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=t[i]&&function(e){return new Promise(function(n,s){r(n,s,(e=t[i](e)).done,e.value)})}}function r(t,e,i,n){Promise.resolve(n).then((function(e){t({value:e,done:i})}),e)}},window.__makeTemplateObject=function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},window.__importStar=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e},window.__importDefault=function(t){return t&&t.__esModule?t:{default:t}}}),{}],344:[(function(t,e,i){"use strict";var n="undefined"==typeof window?global:window;function r(t,e){void 0===n[t]&&(n[t]=e)}function s(t,e){void 0===n[t]&&Object.defineProperty(n,t,{get:function(){var i=void 0;return"CC_WECHATGAMESUB"===t?i="cc.sys.platform === cc.sys.WECHAT_GAME_SUB":"CC_WECHATGAME"===t?i="cc.sys.platform === cc.sys.WECHAT_GAME":"CC_QQPLAY"===t&&(i="cc.sys.platform === cc.sys.QQ_PLAY"),cc.warnID(1400,t,i),e}})}function o(t){return"object"==typeof n[t]}r("CC_BUILD",!1),n.CC_BUILD=!0,n.CC_DEV=!1,n.CC_DEBUG=!1,n.CC_JSB=!1,n.CC_NATIVERENDERER=!1,n.CC_SUPPORT_JIT=!0,r("CC_TEST",o("tap")||o("QUnit")),r("CC_EDITOR",o("Editor")&&o("process")&&"electron"in process.versions),r("CC_PREVIEW",!0),r("CC_RUNTIME","function"==typeof loadRuntime),r("CC_JSB",o("jsb")&&!0);var a=!(!o("wx")||!wx.getSharedCanvas),c=!(!o("wx")||!wx.getSystemInfoSync&&!wx.getSharedCanvas),l=o("bk");s("CC_WECHATGAMESUB",a),s("CC_WECHATGAME",c),s("CC_QQPLAY",l);n.CocosEngine=cc.ENGINE_VERSION="2.2.0"}),{}]},{},[336]);