var _STRINGS={Ad:{Mobile:{Preroll:{ReadyIn:"The game is ready in ",Loading:"Your game is loading...",Close:"Close"},Header:{ReadyIn:"The game is ready in ",Loading:"Your game is loading...",Close:"Close"},End:{ReadyIn:"Advertisement ends in ",Loading:"Please wait ...",Close:"Close"}}},Splash:{Loading:"LOADING ...",LogoLine1:"Some text here",LogoLine2:"powered by MarketJS",LogoLine3:"none",TapToStart:"TAP TO START"},Game:{SelectPlayer:"Select Player",Win:"You win!",Lose:"You lose!",Score:"SCORE: ", Time:"Time",HighScore:"HIGH SCORE: ",MangoBonus:"MANGO BONUS: ",ShotsBonus:"SHOTS BONUS: ",Paused:"PAUSED",Settings:"SETTINGS",LevelComplete:"LEVEL COMPLETE!",LevelFailed:"LEVEL FAILED!",TutLine1:"LAUNCH ALL PIGGIES",TutLine2:"INTO THE BASKET",TutLine3:"DRAG THE PIGGY TO AIM",TutLine4:"RELEASE TO LAUNCH",TutLine5:"COLLECT YELLOW MANGO",TutLine6:"TO SCORE AND EARN STARS",TutLine7:"AVOID RED MANGOES",TutLine8:"YOU WILL LOSE ONE SHOT",TutLine9:"AVOID ROTTEN MANGOES",TutLine10:"YOU WILL LOSE THE GAME"}, Results:{Title:"High score"}};var _SETTINGS={API:{Enabled:!0,Log:{Events:{InitializeGame:!0,EndGame:!0,Level:{Begin:!0,End:!0,Win:!0,Lose:!0,Draw:!0}}}},Ad:{Mobile:{Preroll:{Enabled:!1,Duration:5,Width:300,Height:250,Rotation:{Enabled:!1,Weight:{MobileAdInGamePreroll:40,MobileAdInGamePreroll2:40,MobileAdInGamePreroll3:20}}},Header:{Enabled:!1,Duration:5,Width:320,Height:50,Rotation:{Enabled:!1,Weight:{MobileAdInGameHeader:40,MobileAdInGameHeader2:40,MobileAdInGameHeader3:20}}},Footer:{Enabled:!1,Duration:5,Width:320,Height:50, Rotation:{Enabled:!1,Weight:{MobileAdInGameFooter:40,MobileAdInGameFooter2:40,MobileAdInGameFooter3:20}}},End:{Enabled:!1,Duration:1,Width:300,Height:250,Rotation:{Enabled:!1,Weight:{MobileAdInGameEnd:40,MobileAdInGameEnd2:40,MobileAdInGameEnd3:20}}}}},Language:{Default:"en"},DeveloperBranding:{Splash:{Enabled:!1},Logo:{Enabled:!1,Link:"http://google.com",LinkEnabled:!1,NewWindow:!0,Width:166,Height:61}},Branding:{Splash:{Enabled:!0},Logo:{Enabled:!0,Link:"http://google.com",LinkEnabled:!1,NewWindow:!0, Width:166,Height:61}},MoreGames:{Enabled:!1,Link:"http://www.marketjs.com/game/links/mobile",NewWindow:!0},TapToStartAudioUnlock:{Enabled:!1}};var MobileAdInGamePreroll={ad_duration:_SETTINGS.Ad.Mobile.Preroll.Duration,ad_width:_SETTINGS.Ad.Mobile.Preroll.Width,ad_height:_SETTINGS.Ad.Mobile.Preroll.Height,ready_in:_STRINGS.Ad.Mobile.Preroll.ReadyIn,loading:_STRINGS.Ad.Mobile.Preroll.Loading,close:_STRINGS.Ad.Mobile.Preroll.Close+"          ",Initialize:function(){if(_SETTINGS.Ad.Mobile.Preroll.Rotation.Enabled){var b=_SETTINGS.Ad.Mobile.Preroll.Rotation.Weight,c=b.MobileAdInGamePreroll,d= c+b.MobileAdInGamePreroll2,b=d+b.MobileAdInGamePreroll3,e=Math.floor(100*Math.random());console.log("seed: ",e);e<=c?this.selectedOverlayName="MobileAdInGamePreroll":e<=d?this.selectedOverlayName="MobileAdInGamePreroll2":e<=b&&(this.selectedOverlayName="MobileAdInGamePreroll3");console.log("Ad rotating preroll enabled")}else this.selectedOverlayName="MobileAdInGamePreroll",console.log("Ad rotating preroll disabled");console.log("selected:",this.selectedOverlayName);this.overlay=$("#"+this.selectedOverlayName); this.box=$("#"+this.selectedOverlayName+"-Box");this.game=$("#game");this.boxContents={footer:$("#"+this.selectedOverlayName+"-Box-Footer"),header:$("#"+this.selectedOverlayName+"-Box-Header"),close:$("#"+this.selectedOverlayName+"-Box-Close"),body:$("#"+this.selectedOverlayName+"-Box-Body")};this.box.width(this.ad_width);this.box.height(this.ad_height);this.box.css("left",(this.overlay.width()-this.box.width())/2);this.box.css("top",(this.overlay.height()-this.box.height()-this.boxContents.header.height()- this.boxContents.footer.height())/2);this.overlay.show(this.Timer(this.ad_duration))},Timer:function(b){var c=b,d=setInterval(function(){MobileAdInGamePreroll.boxContents.header.text(MobileAdInGamePreroll.ready_in+c+"...");MobileAdInGamePreroll.boxContents.footer.text(MobileAdInGamePreroll.loading);c--;0>c&&(clearInterval(d),MobileAdInGamePreroll.boxContents.close.css("left",MobileAdInGamePreroll.boxContents.body.width()-23),MobileAdInGamePreroll.boxContents.close.show(),MobileAdInGamePreroll.boxContents.header.html(MobileAdInGamePreroll.close), MobileAdInGamePreroll.boxContents.footer.text(""))},1E3)},Close:function(){this.boxContents.close.hide();this.overlay.hide()}};var MobileAdInGameHeader={ad_duration:_SETTINGS.Ad.Mobile.Header.Duration,ad_width:_SETTINGS.Ad.Mobile.Header.Width,ad_height:_SETTINGS.Ad.Mobile.Header.Height,Initialize:function(){if(_SETTINGS.Ad.Mobile.Header.Rotation.Enabled){var b=_SETTINGS.Ad.Mobile.Header.Rotation.Weight,c=b.MobileAdInGameHeader,d=c+b.MobileAdInGameHeader2,b=d+b.MobileAdInGameHeader3,e=Math.floor(100*Math.random());console.log("seed: ",e);e<=c?this.selectedOverlayName="MobileAdInGameHeader":e<=d?this.selectedOverlayName="MobileAdInGameHeader2": e<=b&&(this.selectedOverlayName="MobileAdInGameHeader3");console.log("Ad rotating header enabled")}else this.selectedOverlayName="MobileAdInGameHeader",console.log("Ad rotating header disabled");this.div=$("#"+this.selectedOverlayName);this.game=$("#game");this.div.width(this.ad_width);this.div.height(this.ad_height);this.div.css("left",this.game.position().left+(this.game.width()-this.div.width())/2);this.div.css("top",0);this.div.show(this.Timer(this.ad_duration))},Timer:function(b){var c=setInterval(function(){b--; 0>b&&(MobileAdInGameHeader.div.hide(),clearInterval(c))},1E3)}};var MobileAdInGameFooter={ad_duration:_SETTINGS.Ad.Mobile.Footer.Duration,ad_width:_SETTINGS.Ad.Mobile.Footer.Width,ad_height:_SETTINGS.Ad.Mobile.Footer.Height,Initialize:function(){if(_SETTINGS.Ad.Mobile.Footer.Rotation.Enabled){var b=_SETTINGS.Ad.Mobile.Footer.Rotation.Weight,c=b.MobileAdInGameFooter,d=c+b.MobileAdInGameFooter2,b=d+b.MobileAdInGameFooter3,e=Math.floor(100*Math.random());console.log("seed: ",e);e<=c?this.selectedOverlayName="MobileAdInGameFooter":e<=d?this.selectedOverlayName="MobileAdInGameFooter2": e<=b&&(this.selectedOverlayName="MobileAdInGameFooter3");console.log("Ad rotating footer enabled")}else this.selectedOverlayName="MobileAdInGameFooter",console.log("Ad rotating footer disabled");this.div=$("#"+this.selectedOverlayName);this.game=$("#game");this.div.width(this.ad_width);this.div.height(this.ad_height);this.div.css("left",this.game.position().left+(this.game.width()-this.div.width())/2);this.div.css("top",this.game.height()-this.div.height()-5);this.div.show(this.Timer(this.ad_duration))}, Timer:function(b){var c=setInterval(function(){b--;0>b&&(MobileAdInGameFooter.div.hide(),clearInterval(c))},1E3)}};var MobileAdInGameEnd={ad_duration:_SETTINGS.Ad.Mobile.End.Duration,ad_width:_SETTINGS.Ad.Mobile.End.Width,ad_height:_SETTINGS.Ad.Mobile.End.Height,ready_in:_STRINGS.Ad.Mobile.End.ReadyIn,loading:_STRINGS.Ad.Mobile.End.Loading,close:_STRINGS.Ad.Mobile.End.Close+"          ",Initialize:function(){if(_SETTINGS.Ad.Mobile.End.Rotation.Enabled){var b=_SETTINGS.Ad.Mobile.End.Rotation.Weight,c=b.MobileAdInGameEnd,d=c+b.MobileAdInGameEnd2,b=d+b.MobileAdInGameEnd3, e=Math.floor(100*Math.random());console.log("seed: ",e);e<=c?this.selectedOverlayName="MobileAdInGameEnd":e<=d?this.selectedOverlayName="MobileAdInGameEnd2":e<=b&&(this.selectedOverlayName="MobileAdInGameEnd3");console.log("Ad rotating end enabled")}else this.selectedOverlayName="MobileAdInGameEnd",console.log("Ad rotating end disabled");console.log("selected:",this.selectedOverlayName);this.overlay=$("#"+this.selectedOverlayName);this.box=$("#"+this.selectedOverlayName+"-Box");this.game=$("#game"); this.boxContents={footer:$("#"+this.selectedOverlayName+"-Box-Footer"),header:$("#"+this.selectedOverlayName+"-Box-Header"),close:$("#"+this.selectedOverlayName+"-Box-Close"),body:$("#"+this.selectedOverlayName+"-Box-Body")};this.box.width(this.ad_width);this.box.height(this.ad_height);this.box.css("left",(this.overlay.width()-this.box.width())/2);this.box.css("top",(this.overlay.height()-this.box.height()-this.boxContents.header.height()-this.boxContents.footer.height())/2);this.overlay.show(this.Timer(this.ad_duration))}, Timer:function(b){var c=b,d=setInterval(function(){MobileAdInGameEnd.boxContents.header.text(MobileAdInGameEnd.ready_in+c+"...");MobileAdInGameEnd.boxContents.footer.text(MobileAdInGameEnd.loading);c--;0>c&&(clearInterval(d),MobileAdInGameEnd.boxContents.close.css("left",MobileAdInGameEnd.boxContents.body.width()-23),MobileAdInGameEnd.boxContents.close.show(),MobileAdInGameEnd.boxContents.header.html(MobileAdInGameEnd.close),MobileAdInGameEnd.boxContents.footer.text(""))},1E3)},Close:function(){this.boxContents.close.hide(); this.overlay.hide()}};!function(b,c){"object"==typeof module&&"object"==typeof module.exports?module.exports=b.document?c(b,!0):function(b){if(!b.document)throw Error("jQuery requires a window with a document");return c(b)}:c(b)}("undefined"!=typeof window?window:this,function(b,c){function d(b,c){c=c||X;var d=c.createElement("script");d.text=b;c.head.appendChild(d).parentNode.removeChild(d)}function e(b){var c=!!b&&"length"in b&&b.length,d=q.type(b);return"function"!==d&&!q.isWindow(b)&&("array"===d||0===c||"number"== typeof c&&0tbody",b)[0]||b:b}function ea(b){return b.type=(null!==b.getAttribute("type"))+"/"+b.type,b}function O(b){var c=Kc.exec(b.type);return c?b.type=c[1]:b.removeAttribute("type"),b}function P(b,c){var d,g,l,e,f,x;if(1===c.nodeType){if(S.hasData(b)&&(d=S.access(b),g=S.set(c,d),x=d.events))for(l in delete g.handle,g.events={},x){d=0;for(g=x[l].length;dc;c+=2)"margin"===d&&(e+=q.css(b,d+Sa[c],!0,l)),g?("content"===d&&(e-=q.css(b,"padding"+Sa[c],!0,l)),"margin"!==d&&(e-=q.css(b,"border"+Sa[c]+"Width",!0,l))):(e+=q.css(b,"padding"+Sa[c],!0,l),"padding"!==d&&(e+=q.css(b,"border"+Sa[c]+"Width",!0,l)));return e}function Z(b,c,d){var g,l=Bb(b),e=s(b,c,l),f="border-box"===q.css(b,"boxSizing",!1, l);return Qb.test(e)?e:(g=f&&(ca.boxSizingReliable()||e===b.style[c]),"auto"===e&&(e=b["offset"+c[0].toUpperCase()+c.slice(1)]),e=parseFloat(e)||0,e+H(b,c,d||(f?"border":"content"),g,l)+"px")}function R(b,c,d,g,l){return new R.prototype.init(b,c,d,g,l)}function l(){Cb&&(!1===X.hidden&&b.requestAnimationFrame?b.requestAnimationFrame(l):b.setTimeout(l,q.fx.interval),q.fx.tick())}function p(){return b.setTimeout(function(){bb=void 0}),bb=q.now()}function J(b,c){var d,g=0,l={height:b};for(c=c?1:0;4>g;g+= 2-c)d=Sa[g],l["margin"+d]=l["padding"+d]=b;return c&&(l.opacity=l.width=b),l}function x(b,c,d){for(var g,l=(M.tweeners[c]||[]).concat(M.tweeners["*"]),e=0,f=l.length;ed&&e?c: (e||j.notifyWith(b,[m,1,0]),j.resolveWith(b,[m]),!1)},m=j.promise({elem:b,props:q.extend({},c),opts:q.extend(!0,{specialEasing:{},easing:q.easing._default},d),originalProperties:c,originalOptions:d,startTime:bb||p(),duration:d.duration,tweens:[],createTween:function(c,d){var g=q.Tween(b,m.opts,c,d,m.opts.specialEasing[c]||m.opts.easing);return m.tweens.push(g),g},stop:function(c){var d=0,g=c?m.tweens.length:0;if(l)return this;for(l=!0;db?this[b+this.length]:this[b]},pushStack:function(b){b=q.merge(this.constructor(),b);return b.prevObject=this,b},each:function(b){return q.each(this,b)},map:function(b){return this.pushStack(q.map(this,function(c,d){return b.call(c,d,c)}))},slice:function(){return this.pushStack(ya.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(b){var c=this.length;b= +b+(0>b?c:0);return this.pushStack(0<=b&&bW.cacheLength&&delete b[c.shift()],b[d+" "]=g}var c=[];return b},oa=function(b){return b[ha]=!0,b},ra=function(b){var c=Y.createElement("fieldset");try{return!!b(c)}catch(d){return!1}finally{c.parentNode&&c.parentNode.removeChild(c)}},ib=function(b,c){for(var d=b.split("|"),g=d.length;g--;)W.attrHandle[d[g]]=c},sb=function(b,c){var d=c&&b,g=d&&1===b.nodeType&&1===c.nodeType&&b.sourceIndex-c.sourceIndex;if(g)return g;if(d)for(;d=d.nextSibling;)if(d=== c)return-1;return b?1:-1},tb=function(b){return function(c){return"input"===c.nodeName.toLowerCase()&&c.type===b}},Ib=function(b){return function(c){var d=c.nodeName.toLowerCase();return("input"===d||"button"===d)&&c.type===b}},ub=function(b){return function(c){return"form"in c?c.parentNode&&!1===c.disabled?"label"in c?"label"in c.parentNode?c.parentNode.disabled===b:c.disabled===b:c.isDisabled===b||c.isDisabled!==!b&&Qc(c)===b:c.disabled===b:"label"in c&&c.disabled===b}},Ca=function(b){return oa(function(c){return c= +c,oa(function(d,g){for(var l,e=b([],d.length,c),f=e.length;f--;)d[l=e[f]]&&(d[l]=!(g[l]=d[l]))})})},fb=function(b){return b&&"undefined"!=typeof b.getElementsByTagName&&b},vb=function(){},Ta=function(b){for(var c=0,d=b.length,g="";c+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,Yc=/=[\x20\t\r\n\f]*([^\]'"]*?)[\x20\t\r\n\f]*\]/g,Zc=RegExp(":((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"), $c=/^(?:\\.|[\w-]|[^\x00-\xa0])+$/,Jb={ID:/^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,TAG:/^((?:\\.|[\w-]|[^\x00-\xa0])+|[*])/,ATTR:RegExp("^\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\]"),PSEUDO:RegExp("^:((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)"), CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$","i"),needsContext:RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)", "i")},ad=/^(?:input|select|textarea|button)$/i,bd=/^h\d$/i,wb=/^[^{]+\{\s*\[native \w/,Pc=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Sb=/[+~]/,Ga=/\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/ig,Ha=function(b,c,d){b="0x"+c-65536;return b!==b||d?c:0>b?String.fromCharCode(b+65536):String.fromCharCode(b>>10|55296,1023&b|56320)},dc=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ec=function(b,c){return c?"\x00"===b?"\ufffd":b.slice(0,-1)+"\\"+b.charCodeAt(b.length-1).toString(16)+" ":"\\"+b},ic=function(){wa()}, Qc=Ua(function(b){return!0===b.disabled&&("form"in b||"label"in b)},{dir:"parentNode",next:"legend"});try{Ma.apply($a=hc.call(va.childNodes),va.childNodes),$a[va.childNodes.length].nodeType}catch(Ed){Ma={apply:$a.length?function(b,c){Uc.apply(b,hc.call(c))}:function(b,c){for(var d=b.length,g=0;b[d++]=c[g++];);b.length=d-1}}}da=ba.support={};jb=ba.isXML=function(b){b=b&&(b.ownerDocument||b).documentElement;return!!b&&"HTML"!==b.nodeName};wa=ba.setDocument=function(b){var c,d;b=b?b.ownerDocument||b: va;return b!==Y&&9===b.nodeType&&b.documentElement?(Y=b,ma=Y.documentElement,la=!jb(Y),va!==Y&&(d=Y.defaultView)&&d.top!==d&&(d.addEventListener?d.addEventListener("unload",ic,!1):d.attachEvent&&d.attachEvent("onunload",ic)),da.attributes=ra(function(b){return b.className="i",!b.getAttribute("className")}),da.getElementsByTagName=ra(function(b){return b.appendChild(Y.createComment("")),!b.getElementsByTagName("*").length}),da.getElementsByClassName=wb.test(Y.getElementsByClassName),da.getById=ra(function(b){return ma.appendChild(b).id= ha,!Y.getElementsByName||!Y.getElementsByName(ha).length}),da.getById?(W.filter.ID=function(b){var c=b.replace(Ga,Ha);return function(b){return b.getAttribute("id")===c}},W.find.ID=function(b,c){if("undefined"!=typeof c.getElementById&&la){var d=c.getElementById(b);return d?[d]:[]}}):(W.filter.ID=function(b){var c=b.replace(Ga,Ha);return function(b){return(b="undefined"!=typeof b.getAttributeNode&&b.getAttributeNode("id"))&&b.value===c}},W.find.ID=function(b,c){if("undefined"!=typeof c.getElementById&& la){var d,g,l,e=c.getElementById(b);if(e){if(d=e.getAttributeNode("id"),d&&d.value===b)return[e];l=c.getElementsByName(b);for(g=0;e=l[g++];)if(d=e.getAttributeNode("id"),d&&d.value===b)return[e]}return[]}}),W.find.TAG=da.getElementsByTagName?function(b,c){return"undefined"!=typeof c.getElementsByTagName?c.getElementsByTagName(b):da.qsa?c.querySelectorAll(b):void 0}:function(b,c){var d,g=[],l=0,e=c.getElementsByTagName(b);if("*"===b){for(;d=e[l++];)1===d.nodeType&&g.push(d);return g}return e},W.find.CLASS= da.getElementsByClassName&&function(b,c){if("undefined"!=typeof c.getElementsByClassName&&la)return c.getElementsByClassName(b)},Aa=[],ia=[],(da.qsa=wb.test(Y.querySelectorAll))&&(ra(function(b){ma.appendChild(b).innerHTML="";b.querySelectorAll("[msallowcapture^='']").length&&ia.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")");b.querySelectorAll("[selected]").length||ia.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)"); b.querySelectorAll("[id~="+ha+"-]").length||ia.push("~=");b.querySelectorAll(":checked").length||ia.push(":checked");b.querySelectorAll("a#"+ha+"+*").length||ia.push(".#.+[+~]")}),ra(function(b){b.innerHTML="";var c=Y.createElement("input");c.setAttribute("type","hidden");b.appendChild(c).setAttribute("name","D");b.querySelectorAll("[name=d]").length&&ia.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?=");2!==b.querySelectorAll(":enabled").length&& ia.push(":enabled",":disabled");ma.appendChild(b).disabled=!0;2!==b.querySelectorAll(":disabled").length&&ia.push(":enabled",":disabled");b.querySelectorAll("*,:x");ia.push(",.*:")})),(da.matchesSelector=wb.test(Ra=ma.matches||ma.webkitMatchesSelector||ma.mozMatchesSelector||ma.oMatchesSelector||ma.msMatchesSelector))&&ra(function(b){da.disconnectedMatch=Ra.call(b,"*");Ra.call(b,"[s!='']:x");Aa.push("!=",":((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\x00-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\x00-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)")}), ia=ia.length&&RegExp(ia.join("|")),Aa=Aa.length&&RegExp(Aa.join("|")),c=wb.test(ma.compareDocumentPosition),rb=c||wb.test(ma.contains)?function(b,c){var d=9===b.nodeType?b.documentElement:b,g=c&&c.parentNode;return b===g||!(!g||1!==g.nodeType||!(d.contains?d.contains(g):b.compareDocumentPosition&&16&b.compareDocumentPosition(g)))}:function(b,c){if(c)for(;c=c.parentNode;)if(c===b)return!0;return!1},Tb=c?function(b,c){if(b===c)return Fa=!0,0;var d=!b.compareDocumentPosition-!c.compareDocumentPosition; return d?d:(d=(b.ownerDocument||b)===(c.ownerDocument||c)?b.compareDocumentPosition(c):1,1&d||!da.sortDetached&&c.compareDocumentPosition(b)===d?b===Y||b.ownerDocument===va&&rb(va,b)?-1:c===Y||c.ownerDocument===va&&rb(va,c)?1:xa?Xa(xa,b)-Xa(xa,c):0:4&d?-1:1)}:function(b,c){if(b===c)return Fa=!0,0;var d,g=0;d=b.parentNode;var l=c.parentNode,e=[b],ja=[c];if(!d||!l)return b===Y?-1:c===Y?1:d?-1:l?1:xa?Xa(xa,b)-Xa(xa,c):0;if(d===l)return sb(b,c);for(d=b;d=d.parentNode;)e.unshift(d);for(d=c;d=d.parentNode;)ja.unshift(d); for(;e[g]===ja[g];)g++;return g?sb(e[g],ja[g]):e[g]===va?-1:ja[g]===va?1:0},Y):Y};ba.matches=function(b,c){return ba(b,null,null,c)};ba.matchesSelector=function(b,c){if((b.ownerDocument||b)!==Y&&wa(b),c=c.replace(Yc,"='$1']"),da.matchesSelector&&la&&!Gb[c+" "]&&(!Aa||!Aa.test(c))&&(!ia||!ia.test(c)))try{var d=Ra.call(b,c);if(d||da.disconnectedMatch||b.document&&11!==b.document.nodeType)return d}catch(g){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"}, "+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(b){return b[1]=b[1].replace(Ga,Ha),b[3]=(b[3]||b[4]||b[5]||"").replace(Ga,Ha),"~="===b[2]&&(b[3]=" "+b[3]+" "),b.slice(0,4)},CHILD:function(b){return b[1]=b[1].toLowerCase(),"nth"===b[1].slice(0,3)?(b[3]||ba.error(b[0]),b[4]=+(b[4]?b[5]+(b[6]||1):2*("even"===b[3]||"odd"===b[3])),b[5]=+(b[7]+b[8]||"odd"===b[3])):b[3]&&ba.error(b[0]),b},PSEUDO:function(b){var c,d=!b[6]&&b[2];return Jb.CHILD.test(b[0])?null:(b[3]? b[2]=b[4]||b[5]||"":d&&Zc.test(d)&&(c=Na(d,!0))&&(c=d.indexOf(")",d.length-c)-d.length)&&(b[0]=b[0].slice(0,c),b[2]=d.slice(0,c)),b.slice(0,3))}},filter:{TAG:function(b){var c=b.replace(Ga,Ha).toLowerCase();return"*"===b?function(){return!0}:function(b){return b.nodeName&&b.nodeName.toLowerCase()===c}},CLASS:function(b){var c=fc[b+" "];return c||(c=RegExp("(^|[\\x20\\t\\r\\n\\f])"+b+"([\\x20\\t\\r\\n\\f]|$)"))&&fc(b,function(b){return c.test("string"==typeof b.className&&b.className||"undefined"!= typeof b.getAttribute&&b.getAttribute("class")||"")})},ATTR:function(b,c,d){return function(g){g=ba.attr(g,b);return null==g?"!="===c:!c||(g+="","="===c?g===d:"!="===c?g!==d:"^="===c?d&&0===g.indexOf(d):"*="===c?d&&-1b.nodeType)return!1;return!0},parent:function(b){return!W.pseudos.empty(b)},header:function(b){return bd.test(b.nodeName)}, input:function(b){return ad.test(b.nodeName)},button:function(b){var c=b.nodeName.toLowerCase();return"input"===c&&"button"===b.type||"button"===c},text:function(b){var c;return"input"===b.nodeName.toLowerCase()&&"text"===b.type&&(null==(c=b.getAttribute("type"))||"text"===c.toLowerCase())},first:Ca(function(){return[0]}),last:Ca(function(b,c){return[c-1]}),eq:Ca(function(b,c,d){return[0>d?d+c:d]}),even:Ca(function(b,c){for(var d=0;dd?d+c:d;0<=--c;)b.push(c);return b}),gt:Ca(function(b,c,d){for(d=0>d?d+c:d;++d:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Gc=/^.[^:#\[\.,]*$/;q.filter=function(b,c,d){var g=c[0];return d&&(b=":not("+b+")"),1===c.length&&1===g.nodeType?q.find.matchesSelector(g,b)?[g]:[]:q.find.matches(b,q.grep(c,function(b){return 1===b.nodeType}))};q.fn.extend({find:function(b){var c,d,g=this.length,l=this;if("string"!=typeof b)return this.pushStack(q(b).filter(function(){for(c=0;c)[^>]*|#([\w-]+))$/;(q.fn.init=function(b,c,d){var g,l;if(!b)return this;if(d=d||mc,"string"==typeof b){if(g="<"===b[0]&&">"===b[b.length-1]&&3<=b.length?[null,b,null]:cd.exec(b),!g||!g[1]&& c)return!c||c.jquery?(c||d).find(b):this.constructor(c).find(b);if(g[1]){if(c=c instanceof q?c[0]:c,q.merge(this,q.parseHTML(g[1],c&&c.nodeType?c.ownerDocument||c:X,!0)),lc.test(g[1])&&q.isPlainObject(c))for(g in c)q.isFunction(this[g])?this[g](c[g]):this.attr(g,c[g]);return this}return l=X.getElementById(g[2]),l&&(this[0]=l,this.length=1),this}return b.nodeType?(this[0]=b,this.length=1,this):q.isFunction(b)?void 0!==d.ready?d.ready(b):b(q):q.makeArray(b,this)}).prototype=q.fn;mc=q(X);var dd=/^(?:parents|prev(?:Until|All))/, ed={children:!0,contents:!0,next:!0,prev:!0};q.fn.extend({has:function(b){var c=q(b,this),d=c.length;return this.filter(function(){for(var b=0;bd.nodeType&&(f?-1=x&&(l!==g&&(j=void 0,p=[b]),d.rejectWith(j,p))}};c?ja():(q.Deferred.getStackHook&&(ja.stackTrace=q.Deferred.getStackHook()),b.setTimeout(ja))}}var x=0;return q.Deferred(function(b){d[0][3].add(f(0,b,q.isFunction(e)?e:m,b.notifyWith));d[1][3].add(f(0,b,q.isFunction(c)?c:m));d[2][3].add(f(0,b,q.isFunction(l)?l:g))}).promise()},promise:function(b){return null!=b?q.extend(b,e):e}},f={};return q.each(d,function(b,c){var g=c[2],x=c[5];e[c[1]]=g.add;x&&g.add(function(){l= x},d[3-b][2].disable,d[0][2].lock);g.add(c[3].fire);f[c[0]]=function(){return f[c[0]+"With"](this===f?void 0:this,arguments),this};f[c[0]+"With"]=g.fireWith}),e.promise(f),c&&c.call(f,f),f},when:function(b){var c=arguments.length,d=c,g=Array(d),l=ya.call(arguments),e=q.Deferred(),f=function(b){return function(d){g[b]=this;l[b]=1=c&&(r(b,e.done(f(d)).resolve,e.reject,!c),"pending"===e.state()||q.isFunction(l[d]&&l[d].then)))return e.then(); for(;d--;)r(l[d],f(d),e.reject);return e.promise()}});var fd=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;q.Deferred.exceptionHook=function(c,d){b.console&&b.console.warn&&c&&fd.test(c.name)&&b.console.warn("jQuery.Deferred exception: "+c.message,c.stack,d)};q.readyException=function(c){b.setTimeout(function(){throw c;})};var Ub=q.Deferred();q.fn.ready=function(b){return Ub.then(b)["catch"](function(b){q.readyException(b)}),this};q.extend({isReady:!1,readyWait:1,ready:function(b){(!0=== b?--q.readyWait:q.isReady)||(q.isReady=!0,!0!==b&&0<--q.readyWait||Ub.resolveWith(X,[q]))}});q.ready.then=Ub.then;"complete"===X.readyState||"loading"!==X.readyState&&!X.documentElement.doScroll?b.setTimeout(q.ready):(X.addEventListener("DOMContentLoaded",y),b.addEventListener("load",y));var Ia=function(b,c,d,g,l,e,f){var x=0,j=b.length,p=null==d;if("object"===q.type(d))for(x in l=!0,d)Ia(b,c,x,d[x],!0,e,f);else if(void 0!==g&&(l=!0,q.isFunction(g)||(f=!0),p&&(f?(c.call(b,g),c=null):(p=c,c=function(b, c,d){return p.call(q(b),d)})),c))for(;x\x20\t\r\n\f]+)/i,$b=/^$|\/(?:java|ecma)script/i,sa={option:[1,""],thead:[1,"","
"],col:[2,"","
"], tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};sa.optgroup=sa.option;sa.tbody=sa.tfoot=sa.colgroup=sa.caption=sa.thead;sa.th=sa.td;var Jc=/<|&#?\w+;/,Lb=X.createDocumentFragment().appendChild(X.createElement("div")),Mb=X.createElement("input");Mb.setAttribute("type","radio");Mb.setAttribute("checked","checked");Mb.setAttribute("name","t");Lb.appendChild(Mb);ca.checkClone=Lb.cloneNode(!0).cloneNode(!0).lastChild.checked;Lb.innerHTML= "";ca.noCloneChecked=!!Lb.cloneNode(!0).lastChild.defaultValue;!0;var Nb=X.documentElement,gd=/^key/,hd=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,qc=/^([^.]*)(?:\.(.+)|)/;q.event={global:{},add:function(b,c,d,g,l){var e,f,x,j,p,m,s,M,r,u;if(p=S.get(b)){d.handler&&(e=d,d=e.handler,l=e.selector);l&&q.find.matchesSelector(Nb,l);d.guid||(d.guid=q.guid++);(j=p.events)||(j=p.events={});(f=p.handle)||(f=p.handle=function(c){return"undefined"!=typeof q&&q.event.triggered!==c.type? q.event.dispatch.apply(b,arguments):void 0});c=(c||"").match(ta)||[""];for(p=c.length;p--;)x=qc.exec(c[p])||[],r=u=x[1],x=(x[2]||"").split(".").sort(),r&&(s=q.event.special[r]||{},r=(l?s.delegateType:s.bindType)||r,s=q.event.special[r]||{},m=q.extend({type:r,origType:u,data:g,handler:d,guid:d.guid,selector:l,needsContext:l&&q.expr.match.needsContext.test(l),namespace:x.join(".")},e),(M=j[r])||(M=j[r]=[],M.delegateCount=0,s.setup&&!1!==s.setup.call(b,g,x,f)||b.addEventListener&&b.addEventListener(r, f)),s.add&&(s.add.call(b,m),m.handler.guid||(m.handler.guid=d.guid)),l?M.splice(M.delegateCount++,0,m):M.push(m),q.event.global[r]=!0)}},remove:function(b,c,d,g,l){var e,f,x,j,p,m,s,M,r,u,C,V=S.hasData(b)&&S.get(b);if(V&&(j=V.events)){c=(c||"").match(ta)||[""];for(p=c.length;p--;)if(x=qc.exec(c[p])||[],r=C=x[1],u=(x[2]||"").split(".").sort(),r){s=q.event.special[r]||{};r=(g?s.delegateType:s.bindType)||r;M=j[r]||[];x=x[2]&&RegExp("(^|\\.)"+u.join("\\.(?:.*\\.|)")+"(\\.|$)");for(f=e=M.length;e--;)m= M[e],!l&&C!==m.origType||d&&d.guid!==m.guid||x&&!x.test(m.namespace)||g&&g!==m.selector&&("**"!==g||!m.selector)||(M.splice(e,1),m.selector&&M.delegateCount--,s.remove&&s.remove.call(b,m));f&&!M.length&&(s.teardown&&!1!==s.teardown.call(b,u,V.handle)||q.removeEvent(b,r,V.handle),delete j[r])}else for(r in j)q.event.remove(b,r+c[p],d,g,!0);q.isEmptyObject(j)&&S.remove(b,"handle events")}},dispatch:function(b){var c=q.event.fix(b),d,g,l,e,f,x,j=Array(arguments.length);g=(S.get(this,"events")||{})[c.type]|| [];var p=q.event.special[c.type]||{};j[0]=c;for(d=1;d\x20\t\r\n\f]*)[^>]*)\/>/gi,jd=/\s*$/g;q.extend({htmlPrefilter:function(b){return b.replace(id,"<$1>")},clone:function(b,c,d){var g,l,e,f,x=b.cloneNode(!0),p=q.contains(b.ownerDocument,b);if(!ca.noCloneChecked&&!(1!==b.nodeType&&11!==b.nodeType||q.isXMLDoc(b))){f=D(x);e=D(b);g=0;for(l=e.length;gq.inArray(this,b)&&(q.cleanData(D(this)),d&&d.replaceChild(c,this))},b)}});q.each({appendTo:"append",prependTo:"prepend", insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(b,c){q.fn[b]=function(b){for(var d=[],g=q(b),l=g.length-1,e=0;e<=l;e++)b=e===l?this:this.clone(!0),q(g[e])[c](b),cb.apply(d,b.get());return this.pushStack(d)}});var ac=/^margin/,Qb=RegExp("^("+nc+")(?!px)[a-z%]+$","i"),Bb=function(c){var d=c.ownerDocument.defaultView;return d&&d.opener||(d=b),d.getComputedStyle(c)},Pb=function(){if(Ba){Ba.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%"; Ba.innerHTML="";Nb.appendChild(Ob);var c=b.getComputedStyle(Ba);rc="1%"!==c.top;sc="2px"===c.marginLeft;tc="4px"===c.width;Ba.style.marginRight="50%";uc="4px"===c.marginRight;Nb.removeChild(Ob);Ba=null}},rc,tc,uc,sc,Ob=X.createElement("div"),Ba=X.createElement("div");Ba.style&&(Ba.style.backgroundClip="content-box",Ba.cloneNode(!0).style.backgroundClip="",ca.clearCloneStyle="content-box"===Ba.style.backgroundClip,Ob.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute", Ob.appendChild(Ba),q.extend(ca,{pixelPosition:function(){return Pb(),rc},boxSizingReliable:function(){return Pb(),tc},pixelMarginRight:function(){return Pb(),uc},reliableMarginLeft:function(){return Pb(),sc}}));!0;var kd=/^(none|table(?!-c[ea]).+)/,vc=/^--/,ld={position:"absolute",visibility:"hidden",display:"block"},wc={letterSpacing:"0",fontWeight:"400"},cc=["Webkit","Moz","ms"],bc=X.createElement("div").style;q.extend({cssHooks:{opacity:{get:function(b,c){if(c){var d=s(b,"opacity");return""=== d?"1":d}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(b,c,d,g){if(b&&3!==b.nodeType&&8!==b.nodeType&&b.style){var l,e,f,x=q.camelCase(c),p=vc.test(c),j=b.style;return p||(c=G(x)),f=q.cssHooks[c]||q.cssHooks[x],void 0===d?f&&"get"in f&&void 0!==(l=f.get(b,!1,g))?l:j[c]:(e=typeof d,"string"===e&&(l=mb.exec(d))&&l[1]&& (d=B(b,c,l),e="number"),null!=d&&d===d&&("number"===e&&(d+=l&&l[3]||(q.cssNumber[x]?"":"px")),ca.clearCloneStyle||""!==d||0!==c.indexOf("background")||(j[c]="inherit"),f&&"set"in f&&void 0===(d=f.set(b,d,g))||(p?j.setProperty(c,d):j[c]=d)),void 0)}},css:function(b,c,d,g){var l,e,f,x=q.camelCase(c);return vc.test(c)||(c=G(x)),f=q.cssHooks[c]||q.cssHooks[x],f&&"get"in f&&(l=f.get(b,!0,d)),void 0===l&&(l=s(b,c,g)),"normal"===l&&c in wc&&(l=wc[c]),""===d||d?(e=parseFloat(l),!0===d||isFinite(e)?e||0:l): l}});q.each(["height","width"],function(b,c){q.cssHooks[c]={get:function(b,d,g){if(d)return!kd.test(q.css(b,"display"))||b.getClientRects().length&&b.getBoundingClientRect().width?Z(b,c,g):oc(b,ld,function(){return Z(b,c,g)})},set:function(b,d,g){var l,e=g&&Bb(b);g=g&&H(b,c,g,"border-box"===q.css(b,"boxSizing",!1,e),e);return g&&(l=mb.exec(d))&&"px"!==(l[3]||"px")&&(b.style[c]=d,d=q.css(b,c)),C(b,d,g)}}});q.cssHooks.marginLeft=u(ca.reliableMarginLeft,function(b,c){if(c)return(parseFloat(s(b,"marginLeft"))|| b.getBoundingClientRect().left-oc(b,{marginLeft:0},function(){return b.getBoundingClientRect().left}))+"px"});q.each({margin:"",padding:"",border:"Width"},function(b,c){q.cssHooks[b+c]={expand:function(d){var g=0,l={};for(d="string"==typeof d?d.split(" "):[d];4>g;g++)l[b+Sa[g]+c]=d[g]||d[g-2]||d[0];return l}};ac.test(b)||(q.cssHooks[b+c].set=C)});q.fn.extend({css:function(b,c){return Ia(this,function(b,c,d){var g,l={},e=0;if(Array.isArray(c)){d=Bb(b);for(g=c.length;eg.indexOf(" "+e+" ")&&(g+=e+" ");g=V(g);l!==g&&d.setAttribute("class",g)}return this},removeClass:function(b){var c,d,g,l,e,f,x=0;if(q.isFunction(b))return this.each(function(c){q(this).removeClass(b.call(this, c,fa(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof b&&b)for(c=b.match(ta)||[];d=this[x++];)if(l=fa(d),g=1===d.nodeType&&" "+V(l)+" "){for(f=0;e=c[f++];)for(;-1l?j:e?l:0;dr.indexOf(":")&&"on"+r,c=c[q.expando]?c:new q.Event(r,"object"==typeof c&&c),c.isTrigger=l?2:3,c.namespace=e.join("."),c.rnamespace=c.namespace?RegExp("(^|\\.)"+e.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=void 0,c.target||(c.target=g),d=null==d?[c]:q.makeArray(d,[c]),s=q.event.special[r]||{},l||!s.trigger||!1!==s.trigger.apply(g, d))){if(!l&&!s.noBubble&&!q.isWindow(g)){j=s.delegateType||r;for(yc.test(j+r)||(f=f.parentNode);f;f=f.parentNode)M.push(f),x=f;x===(g.ownerDocument||X)&&M.push(x.defaultView||x.parentWindow||b)}for(e=0;(f=M[e++])&&!c.isPropagationStopped();)c.type=1c||304===c;if(x){G=u;for(var n=H,z,A,Z,ga,B=G.contents,K=G.dataTypes;"*"===K[0];)K.shift(),void 0===z&&(z=G.mimeType||n.getResponseHeader("Content-Type")); if(z)for(A in B)if(B[A]&&B[A].test(z)){K.unshift(A);break}if(K[0]in x)Z=K[0];else{for(A in x){if(!K[0]||G.converters[A+" "+K[0]]){Z=A;break}ga||(ga=A)}Z=Z||ga}G=x=Z?(Z!==K[0]&&K.unshift(Z),x[Z]):void 0}var na;a:{x=u;z=G;A=H;Z=p;var ka,qa,F;G={};n=x.dataTypes.slice();if(n[1])for(ka in x.converters)G[ka.toLowerCase()]=x.converters[ka];for(ga=n.shift();ga;)if(x.responseFields[ga]&&(A[x.responseFields[ga]]=z),!F&&Z&&x.dataFilter&&(z=x.dataFilter(z,x.dataType)),F=ga,ga=n.shift())if("*"===ga)ga=F;else if("*"!== F&&F!==ga){if(ka=G[F+" "+ga]||G["* "+ga],!ka)for(na in G)if(qa=na.split(" "),qa[1]===ga&&(ka=G[F+" "+qa[0]]||G["* "+qa[0]])){!0===ka?ka=G[na]:!0!==G[na]&&(ga=qa[0],n.unshift(qa[1]));break}if(!0!==ka)if(ka&&x["throws"])z=ka(z);else try{z=ka(z)}catch(ua){na={state:"parsererror",error:ka?ua:"No conversion from "+F+" to "+ga};break a}}na={state:"success",data:z}}G=na;p?(u.ifModified&&(R=H.getResponseHeader("Last-Modified"),R&&(q.lastModified[e]=R),R=H.getResponseHeader("etag"),R&&(q.etag[e]=R)),204=== c||"HEAD"===u.type?fa="nocontent":304===c?fa="notmodified":(fa=G.state,M=G.data,r=G.error,p=!r)):(r=fa,!c&&fa||(fa="error",0>c&&(c=0)));H.status=c;H.statusText=(d||fa)+"";p?J.resolveWith(C,[M,fa,H]):J.rejectWith(C,[H,fa,r]);H.statusCode(y);y=void 0;s&&V.trigger(p?"ajaxSuccess":"ajaxError",[H,u,p?M:r]);t.fireWith(C,[H,fa]);s&&(V.trigger("ajaxComplete",[H,u]),--q.active||q.event.trigger("ajaxStop"))}}"object"==typeof c&&(d=c,c=void 0);d=d||{};var l,e,f,x,j,p,m,s,M,r,u=q.ajaxSetup({},d),C=u.context|| u,V=u.context&&(C.nodeType||C.jquery)?q(C):q.event,J=q.Deferred(),t=q.Callbacks("once memory"),y=u.statusCode||{},G={},R={},fa="canceled",H={readyState:0,getResponseHeader:function(b){var c;if(m){if(!x)for(x={};c=xd.exec(f);)x[c[1].toLowerCase()]=c[2];c=x[b.toLowerCase()]}return null==c?null:c},getAllResponseHeaders:function(){return m?f:null},setRequestHeader:function(b,c){return null==m&&(b=R[b.toLowerCase()]=R[b.toLowerCase()]||b,G[b]=c),this},overrideMimeType:function(b){return null==m&&(u.mimeType= b),this},statusCode:function(b){var c;if(b)if(m)H.always(b[H.status]);else for(c in b)y[c]=[y[c],b[c]];return this},abort:function(b){b=b||fa;return l&&l.abort(b),g(0,b),this}};if(J.promise(H),u.url=((c||u.url||yb.href)+"").replace(zd,yb.protocol+"//"),u.type=d.method||d.type||u.method||u.type,u.dataTypes=(u.dataType||"*").toLowerCase().match(ta)||[""],null==u.crossDomain){p=X.createElement("a");try{p.href=u.url,p.href=p.href,u.crossDomain=Wb.protocol+"//"+Wb.host!=p.protocol+"//"+p.host}catch(n){u.crossDomain= !0}}if(u.data&&u.processData&&"string"!=typeof u.data&&(u.data=q.param(u.data,u.traditional)),qa(Bc,u,d,H),m)return H;(s=q.event&&u.global)&&0===q.active++&&q.event.trigger("ajaxStart");u.type=u.type.toUpperCase();u.hasContent=!yd.test(u.type);e=u.url.replace(vd,"");u.hasContent?u.data&&u.processData&&0===(u.contentType||"").indexOf("application/x-www-form-urlencoded")&&(u.data=u.data.replace(ud,"+")):(r=u.url.slice(e.length),u.data&&(e+=(Vb.test(e)?"&":"?")+u.data,delete u.data),!1===u.cache&&(e= e.replace(wd,"$1"),r=(Vb.test(e)?"&":"?")+"_="+zc++ +r),u.url=e+r);u.ifModified&&(q.lastModified[e]&&H.setRequestHeader("If-Modified-Since",q.lastModified[e]),q.etag[e]&&H.setRequestHeader("If-None-Match",q.etag[e]));(u.data&&u.hasContent&&!1!==u.contentType||d.contentType)&&H.setRequestHeader("Content-Type",u.contentType);H.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+Cc+"; q=0.01":""):u.accepts["*"]);for(M in u.headers)H.setRequestHeader(M, u.headers[M]);if(u.beforeSend&&(!1===u.beforeSend.call(C,H,u)||m))return H.abort();if(fa="abort",t.add(u.complete),H.done(u.success),H.fail(u.error),l=qa(Rb,u,d,H)){if(H.readyState=1,s&&V.trigger("ajaxSend",[H,u]),m)return H;u.async&&0").prop({charset:b.scriptCharset,src:b.url}).on("load error",d=function(b){c.remove();d=null;b&&l("error"===b.type?404:200,b.type)});X.head.appendChild(c[0])},abort:function(){d&&d()}}}});var Dc=[],Xb=/(=)\?(?=&|$)|\?\?/;q.ajaxSetup({jsonp:"callback", jsonpCallback:function(){var b=Dc.pop()||q.expando+"_"+zc++;return this[b]=!0,b}});q.ajaxPrefilter("json jsonp",function(c,d,g){var l,e,f,x=!1!==c.jsonp&&(Xb.test(c.url)?"url":"string"==typeof c.data&&0===(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&Xb.test(c.data)&&"data");if(x||"jsonp"===c.dataTypes[0])return l=c.jsonpCallback=q.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,x?c[x]=c[x].replace(Xb,"$1"+l):!1!==c.jsonp&&(c.url+=(Vb.test(c.url)?"&":"?")+c.jsonp+ "="+l),c.converters["script json"]=function(){return f||q.error(l+" was not called"),f[0]},c.dataTypes[0]="json",e=b[l],b[l]=function(){f=arguments},g.always(function(){void 0===e?q(b).removeProp(l):b[l]=e;c[l]&&(c.jsonpCallback=d.jsonpCallback,Dc.push(l));f&&q.isFunction(e)&&e(f[0]);f=e=void 0}),"script"});var Bd=ca,Ec,Fc=X.implementation.createHTMLDocument("").body;Ec=(Fc.innerHTML="
",2===Fc.childNodes.length);Bd.createHTMLDocument=Ec;q.parseHTML=function(b,c,d){if("string"!= typeof b)return[];"boolean"==typeof c&&(d=c,c=!1);var g,l,e;return c||(ca.createHTMLDocument?(c=X.implementation.createHTMLDocument(""),g=c.createElement("base"),g.href=X.location.href,c.head.appendChild(g)):c=X),l=lc.exec(b),e=!d&&[],l?[c.createElement(l[1])]:(l=F([b],c,e),e&&e.length&&q(e).remove(),q.merge([],l.childNodes))};q.fn.load=function(b,c,d){var g,l,e,f=this,x=b.indexOf(" ");return-1").append(q.parseHTML(b)).find(g):b)}).always(d&&function(b,c){f.each(function(){d.apply(this,e||[b.responseText,c,b])})}),this};q.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(b,c){q.fn[c]=function(b){return this.on(c,b)}});q.expr.pseudos.animated=function(b){return q.grep(q.timers,function(c){return b===c.elem}).length};q.offset={setOffset:function(b, c,d){var g,l,e,f,x,p,j=q.css(b,"position"),m=q(b),s={};"static"===j&&(b.style.position="relative");x=m.offset();e=q.css(b,"top");p=q.css(b,"left");("absolute"===j||"fixed"===j)&&-1<(e+p).indexOf("auto")?(g=m.position(),f=g.top,l=g.left):(f=parseFloat(e)||0,l=parseFloat(p)||0);q.isFunction(c)&&(c=c.call(b,d,q.extend({},x)));null!=c.top&&(s.top=c.top-x.top+f);null!=c.left&&(s.left=c.left-x.left+l);"using"in c?c.using.call(b,s):m.css(s)}};q.fn.extend({offset:function(b){if(arguments.length)return void 0=== b?this:this.each(function(c){q.offset.setOffset(this,b,c)});var c,d,g,l,e=this[0];if(e)return e.getClientRects().length?(g=e.getBoundingClientRect(),c=e.ownerDocument,d=c.documentElement,l=c.defaultView,{top:g.top+l.pageYOffset-d.clientTop,left:g.left+l.pageXOffset-d.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var b,c,d=this[0],g={top:0,left:0};return"fixed"===q.css(d,"position")?c=d.getBoundingClientRect():(b=this.offsetParent(),c=this.offset(),f(b[0],"html")||(g=b.offset()),g={top:g.top+ q.css(b[0],"borderTopWidth",!0),left:g.left+q.css(b[0],"borderLeftWidth",!0)}),{top:c.top-g.top-q.css(d,"marginTop",!0),left:c.left-g.left-q.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var b=this.offsetParent;b&&"static"===q.css(b,"position");)b=b.offsetParent;return b||Nb})}});q.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;q.fn[b]=function(g){return Ia(this,function(b,g,l){var e;return q.isWindow(b)?e=b:9===b.nodeType&& (e=b.defaultView),void 0===l?e?e[c]:b[g]:void(e?e.scrollTo(d?e.pageXOffset:l,d?l:e.pageYOffset):b[g]=l)},b,g,arguments.length)}});q.each(["top","left"],function(b,c){q.cssHooks[c]=u(ca.pixelPosition,function(b,d){if(d)return d=s(b,c),Qb.test(d)?q(b).position()[c]+"px":d})});q.each({Height:"height",Width:"width"},function(b,c){q.each({padding:"inner"+b,content:c,"":"outer"+b},function(d,g){q.fn[g]=function(l,e){var f=arguments.length&&(d||"boolean"!=typeof l),x=d||(!0===l||!0===e?"margin":"border"); return Ia(this,function(c,d,l){var e;return q.isWindow(c)?0===g.indexOf("outer")?c["inner"+b]:c.document.documentElement["client"+b]:9===c.nodeType?(e=c.documentElement,Math.max(c.body["scroll"+b],e["scroll"+b],c.body["offset"+b],e["offset"+b],e["client"+b])):void 0===l?q.css(c,d,x):q.style(c,d,l,x)},c,f?l:void 0,f)}})});q.fn.extend({bind:function(b,c,d){return this.on(b,null,c,d)},unbind:function(b,c){return this.off(b,null,c)},delegate:function(b,c,d,g){return this.on(c,b,d,g)},undelegate:function(b, c,d){return 1===arguments.length?this.off(b,"**"):this.off(c,b||"**",d)}});q.holdReady=function(b){b?q.readyWait++:q.ready(!0)};q.isArray=Array.isArray;q.parseJSON=JSON.parse;q.nodeName=f;"function"==typeof define&&define.amd&&define("jquery",[],function(){return q});var Cd=b.jQuery,Dd=b.$;return q.noConflict=function(c){return b.$===q&&(b.$=Dd),c&&b.jQuery===q&&(b.jQuery=Cd),q},c||(b.jQuery=b.$=q),q}); function getInternetExplorerVersion(){var b=-1;"Microsoft Internet Explorer"==navigator.appName&&null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(b=parseFloat(RegExp.$1));return b}var ie=getInternetExplorerVersion();function getQueryVariable(b){for(var c=window.location.search.substring(1).split("&"),d=0;d=d[f].start&&e<= d[f].end){b=f;break}}void 0!==e&&"[object Object]"===Object.prototype.toString.call(d[b])&&(this.isPlaying=this.settings.spritemap[b],this.context.play&&this.context.play(),this.wasReady=this.setCurrentTime(e))}},stop:function(){this.__lastPosition=0;this.isPlaying=null;this.backgroundMusic?this.backgroundHackForiOS():this.context.pause();return!0},pause:function(){this.isPlaying=null;this.__lastPosition=this.getCurrentTime();this.context.pause();return this.__lastPosition},resume:function(b){b="number"=== typeof b?b:this.__lastPosition;if(null!==b)return this.play(b),this.__lastPosition=null,!0;this.context.play();return!1},HTML5API:{getVolume:function(){return this.context.volume||1},setVolume:function(b){this.context.volume=b;return 1E-4>Math.abs(this.context.volume-b)?!0:!1},getCurrentTime:function(){return this.context.currentTime||0},setCurrentTime:function(b){try{return this.context.currentTime=b,!0}catch(c){return!1}}},FLASHAPI:{getVolume:function(){return this.context&&"function"===typeof this.context.getVolume? this.context.getVolume():1},setVolume:function(b){return this.context&&"function"===typeof this.context.setVolume?(this.context.setVolume(b),!0):!1},getCurrentTime:function(){return this.context&&"function"===typeof this.context.getCurrentTime?this.context.getCurrentTime():0},setCurrentTime:function(b){return this.context&&"function"===typeof this.context.setCurrentTime?this.context.setCurrentTime(b):!1}}}; if(void 0===this.jukebox)throw"jukebox.Manager requires jukebox.Player (Player.js) to run properly."; jukebox.Manager=function(b){this.features={};this.codecs={};this.__players={};this.__playersLength=0;this.__clones={};this.__queue=[];this.settings={};for(var c in this.defaults)this.settings[c]=this.defaults[c];if("[object Object]"===Object.prototype.toString.call(b))for(var d in b)this.settings[d]=b[d];this.__detectFeatures();jukebox.Manager.__initialized=!1===this.settings.useGameLoop?window.setInterval(function(){jukebox.Manager.loop()},20):!0}; jukebox.Manager.prototype={defaults:{useFlash:!1,useGameLoop:!1},__detectFeatures:function(){var b=window.Audio&&new Audio;if(b&&b.canPlayType&&!1===this.settings.useFlash){for(var c=[{e:"3gp",m:["audio/3gpp","audio/amr"]},{e:"aac",m:["audio/aac","audio/aacp"]},{e:"amr",m:["audio/amr","audio/3gpp"]},{e:"caf",m:["audio/IMA-ADPCM","audio/x-adpcm",'audio/x-aiff; codecs="IMA-ADPCM, ADPCM"']},{e:"m4a",m:'audio/mp4{audio/mp4; codecs="mp4a.40.2,avc1.42E01E"{audio/mpeg4{audio/mpeg4-generic{audio/mp4a-latm{audio/MP4A-LATM{audio/x-m4a'.split("{")}, {e:"mp3",m:["audio/mp3","audio/mpeg",'audio/mpeg; codecs="mp3"',"audio/MPA","audio/mpa-robust"]},{e:"mpga",m:["audio/MPA","audio/mpa-robust","audio/mpeg","video/mpeg"]},{e:"mp4",m:["audio/mp4","video/mp4"]},{e:"ogg",m:["application/ogg","audio/ogg",'audio/ogg; codecs="theora, vorbis"',"video/ogg",'video/ogg; codecs="theora, vorbis"']},{e:"wav",m:["audio/wave","audio/wav",'audio/wav; codecs="1"',"audio/x-wav","audio/x-pn-wav"]},{e:"webm",m:["audio/webm",'audio/webm; codecs="vorbis"',"video/webm"]}], d,e,f=0,j=c.length;fMath.abs(b.volume-0.1337));navigator.userAgent.match(/iPhone|iPod|iPad/i)&&(this.features.channels=1)}this.features.flashaudio= !!navigator.mimeTypes["application/x-shockwave-flash"]||!!navigator.plugins["Shockwave Flash"]||!1;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash.10"),this.features.flashaudio=!0}catch(g){}!0===this.settings.useFlash&&(this.features.flashaudio=!0);!0===this.features.flashaudio&&!this.features.html5audio&&(this.codecs.mp3="audio/mp3",this.codecs.mpga="audio/mpeg",this.codecs.mp4="audio/mp4",this.codecs.m4a="audio/mp4",this.codecs["3gp"]="audio/3gpp",this.codecs.amr="audio/amr", this.features.volume=!0,this.features.channels=1)},__getPlayerById:function(b){return this.__players&&void 0!==this.__players[b]?this.__players[b]:null},__getClone:function(b,c){for(var d in this.__clones){var e=this.__clones[d];if(null===e.isPlaying&&e.origin===b)return e}if("[object Object]"===Object.prototype.toString.call(c)){d={};for(var f in c)d[f]=c[f];d.autoplay=!1;f=new jukebox.Player(d,b);f.isClone=!0;f.wasReady=!1;return this.__clones[f.id]=f}return null},loop:function(){if(0!==this.__playersLength)if(this.__queue.length&& this.__playersLengthb.isPlaying.end&&(!0===b.isPlaying.loop?b.play(b.isPlaying.start,!0):b.stop()):b.isClone&&null===b.isPlaying?this.remove(b):void 0!==b.backgroundMusic&&null===b.isPlaying&&c>b.backgroundMusic.end&&b.backgroundHackForiOS()},getPlayableResource:function(b){"[object Array]"!==Object.prototype.toString.call(b)&&(b=[b]);for(var c=0,d=b.length;c=b){d._volume=b;if(d._muted)return d; d.usingWebAudio&&d.masterGain.gain.setValueAtTime(b,c.ctx.currentTime);for(var e=0;eparseInt(j[0].split("/")[1], 10);b._codecs={mp3:!(j||!f&&!d.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!f,opus:!!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!d.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!d.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!d.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(d.canPlayType("audio/x-m4a;")|| d.canPlayType("audio/m4a;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(d.canPlayType("audio/x-mp4;")||d.canPlayType("audio/mp4;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(d.canPlayType("audio/x-flac;")||d.canPlayType("audio/flac;")).replace(/^no$/,"")};return b}, _enableMobileAudio:function(){var b=this||c,d=/iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test(b._navigator&&b._navigator.userAgent),e=!!("ontouchend"in window||b._navigator&&0=e){if("loaded"!==b._state)return b._queue.push({event:"volume",action:function(){b.volume.apply(b,d)}}),b;"undefined"===typeof f&&(b._volume=e);f=b._getSoundIds(f);for(var m=0;mc&&n>=d)clearInterval(b._interval),b._interval=null,b._fadeTo=null,m.volume(d,b._id), m._emit("fade",b._id)},f)},_stopFade:function(b){var d=this._soundById(b);d&&d._interval&&(this._webAudio&&d._node.gain.cancelScheduledValues(c.ctx.currentTime),clearInterval(d._interval),d._interval=null,this.volume(d._fadeTo,b),d._fadeTo=null,this._emit("fade",b));return this},loop:function(){var b=arguments,c,d;if(0===b.length)return this._loop;if(1===b.length)if("boolean"===typeof b[0])this._loop=c=b[0];else return(b=this._soundById(parseInt(b[0],10)))?b._loop:!1;else 2===b.length&&(c=b[0],d= parseInt(b[1],10));d=this._getSoundIds(d);for(var e=0;ee&&(d=/safari/.test(c._navigator&&c._navigator.userAgent.toLowerCase()),c._navigator&&c._navigator.standalone&&!d||c._navigator&&!c._navigator.standalone&&!d))c.usingWebAudio=!1;c.usingWebAudio&&(c.masterGain="undefined"===typeof c.ctx.createGain?c.ctx.createGainNode():c.ctx.createGain(),c.masterGain.gain.setValueAtTime(c._muted?0:1,c.ctx.currentTime),c.masterGain.connect(c.ctx.destination));c._setup()};"function"===typeof define&&define.amd&&define([],function(){return{Howler:c, Howl:d}});"undefined"!==typeof exports&&(exports.Howler=c,exports.Howl=d);"undefined"!==typeof window?(window.HowlerGlobal=b,window.Howler=c,window.Howl=d,window.Sound=e):"undefined"!==typeof global&&(global.HowlerGlobal=b,global.Howler=c,global.Howl=d,global.Sound=e)})(); (function(){HowlerGlobal.prototype._pos=[0,0,0];HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0];HowlerGlobal.prototype.stereo=function(b){if(!this.ctx||!this.ctx.listener)return this;for(var c=this._howls.length-1;0<=c;c--)this._howls[c].stereo(b);return this};HowlerGlobal.prototype.pos=function(b,c,d){if(!this.ctx||!this.ctx.listener)return this;c="number"!==typeof c?this._pos[1]:c;d="number"!==typeof d?this._pos[2]:d;if("number"===typeof b)this._pos=[b,c,d],"undefined"!==typeof this.ctx.listener.positionX? (this.ctx.listener.positionX.setTargetAtTime(this._pos[0],Howler.ctx.currentTime,0.1),this.ctx.listener.positionY.setTargetAtTime(this._pos[1],Howler.ctx.currentTime,0.1),this.ctx.listener.positionZ.setTargetAtTime(this._pos[2],Howler.ctx.currentTime,0.1)):this.ctx.listener.setPosition(this._pos[0],this._pos[1],this._pos[2]);else return this._pos;return this};HowlerGlobal.prototype.orientation=function(b,c,d,e,g,r){if(!this.ctx||!this.ctx.listener)return this;var y=this._orientation;c="number"!== typeof c?y[1]:c;d="number"!==typeof d?y[2]:d;e="number"!==typeof e?y[3]:e;g="number"!==typeof g?y[4]:g;r="number"!==typeof r?y[5]:r;if("number"===typeof b)this._orientation=[b,c,d,e,g,r],"undefined"!==typeof this.ctx.listener.forwardX?(this.ctx.listener.forwardX.setTargetAtTime(b,Howler.ctx.currentTime,0.1),this.ctx.listener.forwardY.setTargetAtTime(c,Howler.ctx.currentTime,0.1),this.ctx.listener.forwardZ.setTargetAtTime(d,Howler.ctx.currentTime,0.1),this.ctx.listener.upX.setTargetAtTime(b,Howler.ctx.currentTime, 0.1),this.ctx.listener.upY.setTargetAtTime(c,Howler.ctx.currentTime,0.1),this.ctx.listener.upZ.setTargetAtTime(d,Howler.ctx.currentTime,0.1)):this.ctx.listener.setOrientation(b,c,d,e,g,r);else return y;return this};var b=Howl.prototype.init;Howl.prototype.init=function(c){this._orientation=c.orientation||[1,0,0];this._stereo=c.stereo||null;this._pos=c.pos||null;this._pannerAttr={coneInnerAngle:"undefined"!==typeof c.coneInnerAngle?c.coneInnerAngle:360,coneOuterAngle:"undefined"!==typeof c.coneOuterAngle? c.coneOuterAngle:360,coneOuterGain:"undefined"!==typeof c.coneOuterGain?c.coneOuterGain:0,distanceModel:"undefined"!==typeof c.distanceModel?c.distanceModel:"inverse",maxDistance:"undefined"!==typeof c.maxDistance?c.maxDistance:1E4,panningModel:"undefined"!==typeof c.panningModel?c.panningModel:"HRTF",refDistance:"undefined"!==typeof c.refDistance?c.refDistance:1,rolloffFactor:"undefined"!==typeof c.rolloffFactor?c.rolloffFactor:1};this._onstereo=c.onstereo?[{fn:c.onstereo}]:[];this._onpos=c.onpos? [{fn:c.onpos}]:[];this._onorientation=c.onorientation?[{fn:c.onorientation}]:[];return b.call(this,c)};Howl.prototype.stereo=function(b,c){var d=this;if(!d._webAudio)return d;if("loaded"!==d._state)return d._queue.push({event:"stereo",action:function(){d.stereo(b,c)}}),d;var m="undefined"===typeof Howler.ctx.createStereoPanner?"spatial":"stereo";if("undefined"===typeof c)if("number"===typeof b)d._stereo=b,d._pos=[b,0,0];else return d._stereo;for(var g=d._getSoundIds(c),r=0;rthis.width||f>this.height)){var m=ig.system.scale,g=Math.floor(e*m),r=Math.floor(f*m),y=j?-1:1,z=n?-1:1;if(j||n)ig.system.context.save(),ig.system.context.scale(y,z);ig.system.context.drawImage(this.data,Math.floor(d*e)%this.width*m,Math.floor(d*e/this.width)*f*m,g,r,ig.system.getDrawPos(b)*y-(j?g:0),ig.system.getDrawPos(c)*z-(n?r:0),g,r);(j|| n)&&ig.system.context.restore();ig.Image.drawCount++}}});ig.Image.drawCount=0;ig.Image.cache={};ig.Image.reloadCache=function(){for(var b in ig.Image.cache)ig.Image.cache[b].reload()}});ig.baked=!0; ig.module("impact.font").requires("impact.image").defines(function(){ig.Font=ig.Image.extend({widthMap:[],indices:[],firstChar:32,alpha:1,letterSpacing:1,lineSpacing:0,onload:function(b){this._loadMetrics(this.data);this.parent(b)},widthForString:function(b){if(-1!==b.indexOf("\n")){b=b.split("\n");for(var c=0,d=0;db||b>=this.indices.length)return 0;var e=ig.system.scale,f=this.widthMap[b]*e,j=(this.height-2)*e;ig.system.context.drawImage(this.data,this.indices[b]*e,0,f,j,ig.system.getDrawPos(c),ig.system.getDrawPos(d),f,j);return this.widthMap[b]+this.letterSpacing},_loadMetrics:function(b){this.height=b.height-1;this.widthMap=[];this.indices= [];for(var c=ig.getImagePixels(b,0,b.height-1,b.width,1),d=0,e=0,f=0;fc.data[j]&&e&&(this.widthMap.push(e),this.indices.push(f-e),d++,e=0)}this.widthMap.push(e);this.indices.push(f-e)}});ig.Font.ALIGN={LEFT:0,RIGHT:1,CENTER:2}});ig.baked=!0; ig.module("impact.sound").defines(function(){ig.SoundManager=ig.Class.extend({clips:{},volume:1,format:null,init:function(){if(!ig.Sound.enabled||!window.Audio)ig.Sound.enabled=!1;else{for(var b=new Audio,c=0;c=b?(this.stop(),this.currentTrack.volume=this._volume,clearInterval(this._fadeInterval)):this.currentTrack.volume=b},_endedCallback:function(){this._loop?this.play():this.next()}});ig.Sound=ig.Class.extend({path:"",volume:1,currentClip:null,multiChannel:!0,init:function(b,c){this.path=b;this.multiChannel=!1!==c;this.load()},load:function(b){ig.Sound.enabled?ig.ready?ig.soundManager.load(this.path, this.multiChannel,b):ig.addResource(this):b&&b(this.path,!0)},play:function(){ig.Sound.enabled&&(this.currentClip=ig.soundManager.get(this.path),this.currentClip.volume=ig.soundManager.volume*this.volume,this.currentClip.play())},stop:function(){this.currentClip&&(this.currentClip.pause(),this.currentClip.currentTime=0)}});ig.Sound.FORMAT={MP3:{ext:"mp3",mime:"audio/mpeg"},M4A:{ext:"m4a",mime:"audio/mp4; codecs=mp4a"},OGG:{ext:"ogg",mime:"audio/ogg; codecs=vorbis"},WEBM:{ext:"webm",mime:"audio/webm; codecs=vorbis"}, CAF:{ext:"caf",mime:"audio/x-caf"}};ig.Sound.use=[ig.Sound.FORMAT.OGG,ig.Sound.FORMAT.MP3];ig.Sound.channels=4;ig.Sound.enabled=!0});ig.baked=!0; ig.module("impact.loader").requires("impact.image","impact.font","impact.sound").defines(function(){ig.Loader=ig.Class.extend({resources:[],gameClass:null,status:0,done:!1,_unloaded:[],_drawStatus:0,_intervalId:0,_loadCallbackBound:null,init:function(b,c){this.gameClass=b;this.resources=c;this._loadCallbackBound=this._loadCallback.bind(this);for(var d=0;db?this.initMouse():0ig.system.width||c>ig.system.height||(0>b+d||0>c+d)||(1!=this.alpha&&(ig.system.context.globalAlpha=this.alpha),0==this.angle?this.sheet.image.drawTile(b,c,this.tile,this.sheet.width,this.sheet.height,this.flip.x,this.flip.y):(ig.system.context.save(),ig.system.context.translate(ig.system.getDrawPos(b+this.pivot.x),ig.system.getDrawPos(c+this.pivot.y)),ig.system.context.rotate(this.angle), this.sheet.image.drawTile(-this.pivot.x,-this.pivot.y,this.tile,this.sheet.width,this.sheet.height,this.flip.x,this.flip.y),ig.system.context.restore()),1!=this.alpha&&(ig.system.context.globalAlpha=1))}})});ig.baked=!0; ig.module("impact.entity").requires("impact.animation","impact.impact").defines(function(){ig.Entity=ig.Class.extend({id:0,settings:{},size:{x:16,y:16},offset:{x:0,y:0},pos:{x:0,y:0},last:{x:0,y:0},vel:{x:0,y:0},accel:{x:0,y:0},friction:{x:0,y:0},maxVel:{x:100,y:100},zIndex:0,gravityFactor:1,standing:!1,bounciness:0,minBounceVelocity:40,anims:{},animSheet:null,currentAnim:null,health:10,type:0,checkAgainst:0,collides:0,_killed:!1,slopeStanding:{min:(44).toRad(),max:(136).toRad()},init:function(b, c,d){this.id=++ig.Entity._lastId;this.pos.x=this.last.x=b;this.pos.y=this.last.y=c;ig.merge(this,d)},reset:function(b,c,d){var e=this.constructor.prototype;this.pos.x=b;this.pos.y=c;this.last.x=b;this.last.y=c;this.vel.x=e.vel.x;this.vel.y=e.vel.y;this.accel.x=e.accel.x;this.accel.y=e.accel.y;this.health=e.health;this._killed=e._killed;this.standing=e.standing;this.type=e.type;this.checkAgainst=e.checkAgainst;this.collides=e.collides;ig.merge(this,d)},addAnim:function(b,c,d,e){if(!this.animSheet)throw"No animSheet to add the animation "+ b+" to.";c=new ig.Animation(this.animSheet,c,d,e);this.anims[b]=c;this.currentAnim||(this.currentAnim=c);return c},update:function(){this.last.x=this.pos.x;this.last.y=this.pos.y;this.vel.y+=ig.game.gravity*ig.system.tick*this.gravityFactor;this.vel.x=this.getNewVelocity(this.vel.x,this.accel.x,this.friction.x,this.maxVel.x);this.vel.y=this.getNewVelocity(this.vel.y,this.accel.y,this.friction.y,this.maxVel.y);var b=ig.game.collisionMap.trace(this.pos.x,this.pos.y,this.vel.x*ig.system.tick,this.vel.y* ig.system.tick,this.size.x,this.size.y);this.handleMovementTrace(b);this.currentAnim&&this.currentAnim.update()},getNewVelocity:function(b,c,d,e){return c?(b+c*ig.system.tick).limit(-e,e):d?(c=d*ig.system.tick,0b+c?b+c:0):b.limit(-e,e)},handleMovementTrace:function(b){this.standing=!1;b.collision.y&&(0this.minBounceVelocity?this.vel.y*=-this.bounciness:(0 this.minBounceVelocity?this.vel.x*-this.bounciness:0);if(b.collision.slope){var c=b.collision.slope;if(0this.slopeStanding.min&&c=this.health&&this.kill()},touches:function(b){return!(this.pos.x>=b.pos.x+b.size.x||this.pos.x+this.size.x<=b.pos.x||this.pos.y>=b.pos.y+b.size.y||this.pos.y+this.size.y<=b.pos.y)},distanceTo:function(b){var c=this.pos.x+this.size.x/2-(b.pos.x+b.size.x/2);b=this.pos.y+this.size.y/2-(b.pos.y+b.size.y/2);return Math.sqrt(c*c+b*b)},angleTo:function(b){return Math.atan2(b.pos.y+ b.size.y/2-(this.pos.y+this.size.y/2),b.pos.x+b.size.x/2-(this.pos.x+this.size.x/2))},check:function(){},collideWith:function(){},ready:function(){},erase:function(){}});ig.Entity._lastId=0;ig.Entity.COLLIDES={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8};ig.Entity.TYPE={NONE:0,A:1,B:2,BOTH:3};ig.Entity.checkPair=function(b,c){b.checkAgainst&c.type&&b.check(c);c.checkAgainst&b.type&&c.check(b);b.collides&&c.collides&&b.collides+c.collides>ig.Entity.COLLIDES.ACTIVE&&ig.Entity.solveCollision(b,c)};ig.Entity.solveCollision= function(b,c){var d=null;if(b.collides==ig.Entity.COLLIDES.LITE||c.collides==ig.Entity.COLLIDES.FIXED)d=b;else if(c.collides==ig.Entity.COLLIDES.LITE||b.collides==ig.Entity.COLLIDES.FIXED)d=c;b.last.x+b.size.x>c.last.x&&b.last.xc.last.y&&b.last.yb.minBounceVelocity?b.vel.y*=-b.bounciness:(b.standing=!0,b.vel.y=0)):(d=(b.vel.y-c.vel.y)/2,b.vel.y=-d,c.vel.y=d,f=c.vel.x*ig.system.tick,d=ig.game.collisionMap.trace(b.pos.x,b.pos.y,f,-e/2,b.size.x,b.size.y),b.pos.y=d.pos.y,b=ig.game.collisionMap.trace(c.pos.x,c.pos.y,0,e/2,c.size.x,c.size.y),c.pos.y=b.pos.y)}});ig.baked=!0; ig.module("impact.map").defines(function(){ig.Map=ig.Class.extend({tilesize:8,width:1,height:1,data:[[]],name:null,init:function(b,c){this.tilesize=b;this.data=c;this.height=c.length;this.width=c[0].length;this.pxWidth=this.width*this.tilesize;this.pxHeight=this.height*this.tilesize},getTile:function(b,c){var d=Math.floor(b/this.tilesize),e=Math.floor(c/this.tilesize);return 0<=d&&dthis.lastSlope&&(this.lastSlope=j|0)},trace:function(b,c,f,j,n,m){var g={collision:{x:!1,y:!1,slope:!1},pos:{x:b,y:c},tile:{x:0,y:0}},r=Math.ceil(Math.max(Math.abs(f),Math.abs(j))/this.tilesize);if(1j?this.tilesize:0,A=Math.max(Math.floor(f/this.tilesize),0),D=Math.min(Math.ceil((f+g)/this.tilesize),this.height);j=Math.floor((b.pos.x+B)/this.tilesize);var t=Math.floor((c+B)/this.tilesize);if(0t||t>=this.width)t=-1;if(0<=j&&jthis.lastSlope||1n?this.tilesize:0;A=Math.max(Math.floor(b.pos.x/this.tilesize),0);E=Math.min(Math.ceil((b.pos.x+m)/this.tilesize),this.width);F=Math.floor((b.pos.y+B)/this.tilesize); D=Math.floor((f+B)/this.tilesize);if(0D||D>=this.height)D=-1;if(0<=F&&Fthis.lastSlope||1B?g:0)-(y+A[0])*this.tilesize;r=j+m+(0n*-B+m*c)return E;y=Math.sqrt(c*c+B*B);z=B/y;y=-c/y;var D=g*z+r*y,A=z*D,D=y*D;if(A*A+D*D>=n*n+m*m)return E||0.5>c*(r-m)-B*(g-n);b.pos.x=f+n-A;b.pos.y=j+m-D;b.collision.slope={x:c,y:B,nx:z,ny:y};return!0}return!1}});var b=1/3,c=2/3;ig.CollisionMap.defaultTileDef={5:[0,1,1,c,!0],6:[0,c,1,b,!0],7:[0,b,1,0,!0],3:[0,1,1,0.5,!0],4:[0,0.5,1,0,!0],2:[0, 1,1,0,!0],10:[0.5,1,1,0,!0],21:[0,1,0.5,0,!0],32:[c,1,1,0,!0],43:[b,1,c,0,!0],54:[0,1,b,0,!0],27:[0,0,1,b,!0],28:[0,b,1,c,!0],29:[0,c,1,1,!0],25:[0,0,1,0.5,!0],26:[0,0.5,1,1,!0],24:[0,0,1,1,!0],11:[0,0,0.5,1,!0],22:[0.5,0,1,1,!0],33:[0,0,b,1,!0],44:[b,0,c,1,!0],55:[c,0,1,1,!0],16:[1,b,0,0,!0],17:[1,c,0,b,!0],18:[1,1,0,c,!0],14:[1,0.5,0,0,!0],15:[1,1,0,0.5,!0],13:[1,1,0,0,!0],8:[0.5,1,0,0,!0],19:[1,1,0.5,0,!0],30:[b,1,0,0,!0],41:[c,1,b,0,!0],52:[1,1,c,0,!0],38:[1,c,0,1,!0],39:[1,b,0,c,!0],40:[1,0, 0,b,!0],36:[1,0.5,0,1,!0],37:[1,0,0,0.5,!0],35:[1,0,0,1,!0],9:[1,0,0.5,1,!0],20:[0.5,0,0,1,!0],31:[1,0,c,1,!0],42:[c,0,b,1,!0],53:[b,0,0,1,!0],12:[0,0,1,0,!1],23:[1,1,0,1,!1],34:[1,0,1,1,!1],45:[0,1,0,0,!1]};ig.CollisionMap.staticNoCollision={trace:function(b,c,f,j){return{collision:{x:!1,y:!1,slope:!1},pos:{x:b+f,y:c+j},tile:{x:0,y:0}}}}});ig.baked=!0; ig.module("impact.background-map").requires("impact.map","impact.image").defines(function(){ig.BackgroundMap=ig.Map.extend({tiles:null,scroll:{x:0,y:0},distance:1,repeat:!1,tilesetName:"",foreground:!1,enabled:!0,preRender:!1,preRenderedChunks:null,chunkSize:512,debugChunks:!1,anims:{},init:function(b,c,d){this.parent(b,c);this.setTileset(d)},setTileset:function(b){this.tilesetName=b instanceof ig.Image?b.path:b;this.tiles=new ig.Image(this.tilesetName);this.preRenderedChunks=null},setScreenPos:function(b, c){this.scroll.x=b/this.distance;this.scroll.y=c/this.distance},preRenderMapToChunks:function(){var b=this.width*this.tilesize*ig.system.scale,c=this.height*this.tilesize*ig.system.scale;this.chunkSize=Math.min(Math.max(b,c),this.chunkSize);var d=Math.ceil(b/this.chunkSize),e=Math.ceil(c/this.chunkSize);this.preRenderedChunks=[];for(var f=0;f=this.height||0>r){if(!this.repeat)continue;r=(r%this.height+this.height)%this.height}for(var y=-1,z=n;z=this.width||0>b){if(!this.repeat)continue;b=(b%this.width+this.width)%this.width}if(b=this.data[r][b])(c=this.anims[b- 1])?c.draw(z,j):this.tiles.drawTile(z,j,b-1,this.tilesize)}}}})});ig.baked=!0; ig.module("impact.game").requires("impact.impact","impact.entity","impact.collision-map","impact.background-map").defines(function(){ig.Game=ig.Class.extend({clearColor:"#000000",gravity:0,screen:{x:0,y:0},_rscreen:{x:0,y:0},entities:[],namedEntities:{},collisionMap:ig.CollisionMap.staticNoCollision,backgroundMaps:[],backgroundAnims:{},autoSort:!1,sortBy:null,cellSize:64,_deferredKill:[],_levelToLoad:null,_doSortEntities:!1,staticInstantiate:function(){this.sortBy=this.sortBy||ig.Game.SORT.Z_INDEX; ig.game=this;return null},loadLevel:function(b){this.screen={x:0,y:0};this.entities=[];this.namedEntities={};for(var c=0;ce&&window.focus(),("touchstart"==c.type||"mousedown"==c.type)&&this.mousemove(c),e=this.bindings[e])this.actions[e]=!0,this.locks[e]||(this.presses[e]=!0,this.locks[e]= !0),c.stopPropagation(),c.preventDefault()}})});ig.baked=!0;ig.module("plugins.patches.input-patch").requires("impact.input").defines(function(){ig.Input.inject({mousemove:function(b){this.parent(b);try{ig.soundHandler.unlockWebAudio()}catch(c){}},keyup:function(b){this.parent(b);if(ig.visibilityHandler)ig.visibilityHandler.onChange("focus");try{ig.soundHandler.unlockWebAudio()}catch(c){}}})});ig.baked=!0; ig.module("plugins.handlers.dom-handler").defines(function(){ig.DomHandler=ig.Class.extend({JQUERYAVAILABLE:!1,init:function(){this.JQUERYAVAILABLE=this._jqueryAvailable()},_jqueryAvailable:function(){return"undefined"!==typeof jQuery},addEvent:function(b,c,d,e){if(this.JQUERYAVAILABLE)b.on(c,d);else b.addEventListener(c,d,e)},create:function(b){return this.JQUERYAVAILABLE?$("<"+b+">"):ig.$new(b)},getElementByClass:function(b){return this.JQUERYAVAILABLE?$("."+b):document.getElementsByClassName(b)}, getElementById:function(b){return this.JQUERYAVAILABLE?0<$(b).length?$(b):null:ig.$(b)},appendChild:function(b,c){this.JQUERYAVAILABLE?b.append(c):b.appendChild(c)},appendToBody:function(b){this.JQUERYAVAILABLE?$("body").append(b):document.body.appendChild(b)},resize:function(b,c,d){if(this.JQUERYAVAILABLE)b.width(c.toFixed(2)),b.height(d.toFixed(2));else{var e=b.style.visibility;c="width:"+c.toFixed(2)+"px; height:"+d.toFixed(2)+"px;";this.attr(b,"style",c);b.style.visibility=e}},resizeOffsetLeft:function(b, c,d,e){if(this.JQUERYAVAILABLE)b.width(c.toFixed(2)),b.height(d.toFixed(2)),b.css("left",e);else{var f=b.style.visibility;c="width:"+c.toFixed(2)+"px; height:"+d.toFixed(2)+"px; left: "+e.toFixed(2)+"px;";this.attr(b,"style",c);b.style.visibility=f}},resizeOffset:function(b,c,d,e,f){if(this.JQUERYAVAILABLE)b.width(c.toFixed(2)),b.height(d.toFixed(2)),b.css("left",e),b.css("top",f);else{var j=b.style.visibility;c="width:"+c.toFixed(2)+"px; height:"+d.toFixed(2)+"px; left: "+e.toFixed(2)+"px; top: "+ f.toFixed(2)+"px;";this.attr(b,"style",c);b.style.visibility=j}},css:function(b,c){if(this.JQUERYAVAILABLE)b.css(c);else{var d="",e;for(e in c)d+=e+":"+c[e]+";";this.attr(b,"style",d)}},getOffsets:function(b){return this.JQUERYAVAILABLE?(b=b.offset(),{left:b.left,top:b.top}):{left:b.offsetLeft,top:b.offsetTop}},attr:function(b,c,d){if("undefined"===typeof d)return this.JQUERYAVAILABLE?b.attr(c):b.getAttribute(c);this.JQUERYAVAILABLE?b.attr(c,d):b.setAttribute(c,d)},show:function(b){this.JQUERYAVAILABLE? (b.show(),b.css("visibility","visible")):b&&(b.style?b.style.visibility="visible":b[0]&&(b[0].style.visibility="visible"))},hide:function(b){this.JQUERYAVAILABLE?(b.hide(),b.css("visibility","hidden")):b&&(b.style?b.style.visibility="hidden":b[0]&&(b[0].style.visibility="hidden"))},getQueryVariable:function(b){for(var c=window.location.search.substring(1).split("&"),d=0;dthis.maxScalingOnMobile&&(c=this.maxScalingOnMobile),cthis.maxScalingOnDesktop&&(c=this.maxScalingOnDesktop),cd&&(d=0);0>e&&(e=0);ig.domHandler.resizeOffset(c,Math.floor(ig.sizeHandler.mobile.actualSize.x),Math.floor(ig.sizeHandler.mobile.actualSize.y),d,e);var f=!1;if(this.portraitMode?window.innerHeightwindow.innerWidth)if(this.enableStretchToFitOnAntiPortraitModeFlag)ig.domHandler.resizeOffset(c,Math.floor(window.innerWidth), Math.floor(window.innerHeight),0,0);else{var f=new Vector2(window.innerWidth/this.mobile.actualResolution.y,window.innerHeight/this.mobile.actualResolution.x),d=Math.min(f.x,f.y),f=this.mobile.actualResolution.y*d,j=this.mobile.actualResolution.x*d,d=Math.floor(ig.sizeHandler.windowSize.x/2-f/2),e=Math.floor(ig.sizeHandler.windowSize.y/2-j/2);0>d&&(d=0);0>e&&(e=0);ig.domHandler.resizeOffset(c,Math.floor(f),Math.floor(j),d,e)}}else ig.domHandler.resize(c,Math.floor(ig.sizeHandler.mobile.actualSize.x), Math.floor(ig.sizeHandler.mobile.actualSize.y));else this.enableStretchToFitOnDesktopFlag?ig.domHandler.resize(c,Math.floor(ig.sizeHandler.desktop.actualSize.x),Math.floor(ig.sizeHandler.desktop.actualSize.y)):(d=Math.floor(ig.sizeHandler.windowSize.x/2-ig.sizeHandler.desktop.actualSize.x/2),e=Math.floor(ig.sizeHandler.windowSize.y/2-ig.sizeHandler.desktop.actualSize.y/2),0>d&&(d=0),0>e&&(e=0),ig.domHandler.resizeOffset(c,Math.floor(ig.sizeHandler.desktop.actualSize.x),Math.floor(ig.sizeHandler.desktop.actualSize.y), d,e))}for(var n in this.adsToResize)b=ig.domHandler.getElementById("#"+n),c=ig.domHandler.getElementById("#"+n+"-Box"),f=(window.innerWidth-this.adsToResize[n]["box-width"])/2+"px",d=(window.innerHeight-this.adsToResize[n]["box-height"])/2+"px",b&&ig.domHandler.css(b,{width:window.innerWidth,height:window.innerHeight}),c&&ig.domHandler.css(c,{left:f,top:d});for(n in this.dynamicClickableEntityDivs){b=Math.min(ig.sizeHandler.scaleRatioMultiplier.x,ig.sizeHandler.scaleRatioMultiplier.y);c=ig.domHandler.getElementById("#"+ n);if(ig.ua.mobile)var m=this.dynamicClickableEntityDivs[n].entity_pos_x,j=this.dynamicClickableEntityDivs[n].entity_pos_y,d=this.dynamicClickableEntityDivs[n].width,f=this.dynamicClickableEntityDivs[n].height,e=Math.floor(m*this.scaleRatioMultiplier.x)+"px",j=Math.floor(j*this.scaleRatioMultiplier.y)+"px",d=Math.floor(d*this.scaleRatioMultiplier.x)+"px",f=Math.floor(f*this.scaleRatioMultiplier.y)+"px";else var f=ig.domHandler.getElementById("#canvas"),f=ig.domHandler.getOffsets(f),e=f.left,g=f.top, m=this.dynamicClickableEntityDivs[n].entity_pos_x,j=this.dynamicClickableEntityDivs[n].entity_pos_y,d=this.dynamicClickableEntityDivs[n].width,f=this.dynamicClickableEntityDivs[n].height,e=Math.floor(e+m*b)+"px",j=Math.floor(g+j*b)+"px",d=Math.floor(d*b)+"px",f=Math.floor(f*b)+"px";ig.domHandler.css(c,{"float":"left",position:"absolute",left:e,top:j,width:d,height:f,"z-index":3});this.dynamicClickableEntityDivs[n]["font-size"]&&ig.domHandler.css(c,{"font-size":this.dynamicClickableEntityDivs[n]["font-size"]* b+"px"})}$("#ajaxbar").width(this.windowSize.x);$("#ajaxbar").height(this.windowSize.y)},resize:function(){this.sizeCalcs();this.resizeLayers()},reorient:function(){console.log("changing orientation ...");if(ig.ua.mobile){var b=!1,b=this.portraitMode?window.innerHeightwindow.innerWidth,c=this.domHandler.getElementById("#orientate"),d=this.domHandler.getElementById("#game");b?(this.domHandler.show(c),this.domHandler.hide(d),console.log("portrait"+window.innerWidth+ ","+window.innerHeight)):(this.domHandler.show(d),this.domHandler.hide(c),console.log("landscape"+window.innerWidth+","+window.innerHeight))}ig.ua.mobile?(this.resize(),this.resizeAds()):this.resize()},resizeAds:function(){for(var b in this.adsToResize){var c=ig.domHandler.getElementById("#"+b),d=ig.domHandler.getElementById("#"+b+"-Box"),e=(window.innerWidth-this.adsToResize[b]["box-width"])/2+"px",f=(window.innerHeight-this.adsToResize[b]["box-height"])/2+"px";c&&ig.domHandler.css(c,{width:window.innerWidth, height:window.innerHeight});d&&ig.domHandler.css(d,{left:e,top:f})}},samsungFix:function(){ig.ua.android&&!(4.2>parseFloat(navigator.userAgent.slice(navigator.userAgent.indexOf("Android")+8,navigator.userAgent.indexOf("Android")+11)))&&(!(0>navigator.userAgent.indexOf("GT"))&&!(0b?0:isNaN(b)?1:1b?0:isNaN(b)?1:1b){this.soundList[c].volume(0);break}isNaN(b)?this.soundList[c].volume(1):1b){this.soundList[c].volume(0);break}isNaN(b)?this.soundList[c].volume(1):1=b?this.jukeboxPlayer.setVolume(this.minVolume):isNaN(b)?this.jukeboxPlayer.setVolume(1): 1=d.indexOf("chrome")&&(j=c),d.indexOf("win64")&&(j=c));var n=new XMLHttpRequest;n.open("GET",j,!0);n.responseType="arraybuffer";n.onload=function(){this.webaudio.context.decodeAudioData(n.response, function(b){this.webaudio.buffer=b;this.webaudio.source_loop={};this.bgmPlaying?this.play(null,!0):this.stop()}.bind(this),function(){console.log('Error decoding audio "'+j+'".')})}.bind(this);n.send();if(4==n.readyState&&"undefined"!==typeof Audio){this.useHTML5Audio=!0;try{new Audio}catch(m){this.useHTML5Audio=!1}this.useHTML5Audio&&(console.log("Using HTML5 Audio"),this.webaudio=null,this.audio=new Audio,this.isSupported=!0,this.initHTML5Audio(b))}break}},initIOSWebAudioUnlock:function(){if(this.webaudio){webaudio= this.webaudio;var b=function(){var c=webaudio.context,d=c.createBuffer(1,1,22050),e=c.createBufferSource();e.buffer=d;e.connect(c.destination);"undefined"===typeof e.start?e.noteOn(0):e.start(0);setTimeout(function(){(e.playbackState===e.PLAYING_STATE||e.playbackState===e.FINISHED_STATE)&&window.removeEventListener("touchend",b,!1)}.bind(this),0)};window.addEventListener("touchend",b,!1)}},initHTML5Audio:function(b){if(this.useHTML5Audio&&this.audio){var c=this.audio;this.codecs={};this.codecs={mp3:!!c.canPlayType("audio/mpeg;").replace(/^no$/, ""),opus:!!c.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!c.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!c.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!c.canPlayType("audio/aac;").replace(/^no$/,""),m4a:!!(c.canPlayType("audio/x-m4a;")||c.canPlayType("audio/m4a;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(c.canPlayType("audio/x-mp4;")||c.canPlayType("audio/mp4;")||c.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!c.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")};this.is={ff:Boolean(null!=window.mozInnerScreenX&&/firefox/.test(navigator.userAgent.toLowerCase())),ie:Boolean(document.all&&!window.opera),opera:Boolean(window.opera),chrome:Boolean(window.chrome),safari:Boolean(!window.chrome&&/safari/.test(navigator.userAgent.toLowerCase())&&window.getComputedStyle&&!window.globalStorage&&!window.opera)};this.playDelay=-60;this.stopDelay=30;this.is.chrome&&(this.playDelay=-25);this.is.chrome&&(this.stopDelay=25);this.is.ff&&(this.playDelay=-25);this.is.ff&& (this.stopDelay=85);this.is.opera&&(this.playDelay=5);this.is.opera&&(this.stopDelay=0);for(var d in b){this.soundList[d]=d;var e=b[d].path,c=e+"."+ig.Sound.FORMAT.OGG.ext,e=e+"."+ig.Sound.FORMAT.MP3.ext,f=null;this.codecs[ig.Sound.FORMAT.OGG.ext.toLowerCase()]?f=c:this.codecs[ig.Sound.FORMAT.MP3.ext.toLowerCase()]&&(f=e);if(f){ig.ua.mobile?ig.ua.iOS&&(f=e):(b=navigator.userAgent.toLowerCase(),-1!=b.indexOf("safari")&&-1>=b.indexOf("chrome")&&(f=e));this.audio.addEventListener("error",function(){this.audio.error&& 4===this.audio.error.code&&(this.isSupported=!1)},!1);this.audio.src=f;this.audio._pos=0;this.audio.preload="auto";this.audio.volume=this._volume;this.inactiveAudio=new Audio;this.inactiveAudio.src=f;this.inactiveAudio._pos=0;this.inactiveAudio.preload="auto";this.inactiveAudio.volume=this._volume;this.inactiveAudio.load();var j=function(){this._duration=this.audio.duration;this._loaded||(this._loaded=!0);this.bgmPlaying?this.play(null,!0):this.stop();this.audio.removeEventListener("canplaythrough", j,!1)}.bind(this);this.audio.addEventListener("canplaythrough",j,!1);this.audio.load();break}}}},play:function(b,c){if(this.isSupported)if(this.bgmPlaying=!0,this.webaudio){if(!c&&this.reinitOnPlay&&this.webaudio.source_loop.buffer==this.webaudio.buffer){if(this.webaudio.source_loop._playing&&(this.webaudio.source_loop[this.webaudio.compatibility.stop](0),this.webaudio.source_loop._playing=!1,this.pausedTime+=this.webaudio.context.currentTime-this.webaudio.source_loop._startTime,this.pausedTime%= this.webaudio.source_loop.buffer.duration,this.webaudio.source_loop._startTime=0,"noteOn"===this.webaudio.compatibility.start))this.webaudio.source_once[this.webaudio.compatibility.stop](0);try{this.webaudio.context.close();this.webaudio.context=new this.AudioContext;this.webaudio.gainNode=this.webaudio.context.createGain();this.webaudio.gainNode.connect(this.webaudio.context.destination);this.webaudio.gainNode.gain.value=this._volume;var d="start",e="stop",f=this.webaudio.context.createBufferSource(); "function"!==typeof f.start&&(d="noteOn");this.webaudio.compatibility.start=d;"function"!==typeof f.stop&&(e="noteOff");this.webaudio.compatibility.stop=e;this.webaudio.source_loop={};this.play(null,!0)}catch(j){}}if(this.webaudio.buffer){if(!this.muteFlag&&(this.bgmPlaying=!0,!this.webaudio.source_loop._playing)){this.webaudio.source_loop=this.webaudio.context.createBufferSource();this.webaudio.source_loop.buffer=this.webaudio.buffer;this.webaudio.source_loop.loop=!0;this.webaudio.source_loop.connect(this.webaudio.gainNode); if(null==b||isNaN(b))b=0,this.pausedTime&&(b=this.pausedTime);this.webaudio.source_loop._startTime=this.webaudio.context.currentTime;if("noteOn"===this.webaudio.compatibility.start)this.webaudio.source_once=this.webaudio.context.createBufferSource(),this.webaudio.source_once.buffer=this.webaudio.buffer,this.webaudio.source_once.connect(this.webaudio.gainNode),this.webaudio.source_once.noteGrainOn(0,b,this.webaudio.buffer.duration-b),this.webaudio.source_loop[this.webaudio.compatibility.start](this.webaudio.context.currentTime+ (this.webaudio.buffer.duration-b));else this.webaudio.source_loop[this.webaudio.compatibility.start](0,b);this.webaudio.source_loop._playing=!0}}else this.bgmPlaying=!0}else if(this.audio){var n=this.audio;if(!this.muteFlag)if(this.bgmPlaying=!0,isNaN(b)&&(b=0,this.pausedTime&&(b=this.pausedTime)),d=this._duration-b,this._onEndTimer&&(clearTimeout(this._onEndTimer),this._onEndTimer=null),this._onEndTimer=setTimeout(function(){this.audio.currentTime=0;this.audio.pause();this.pausedTime=0;if(this.inactiveAudio){var b= this.audio;this.audio=this.inactiveAudio;this.inactiveAudio=b}this.play()}.bind(this),1E3*d+this.playDelay),4===n.readyState||!n.readyState&&navigator.isCocoonJS)n.readyState=4,n.currentTime=b,n.muted=this.muteFlag||n.muted,n.volume=this._volume,setTimeout(function(){n.play()},0);else{clearTimeout(this._onEndTimer);this._onEndTimer=null;var m=function(){typeof("function"==this.play)&&(this.play(),n.removeEventListener("canplaythrough",m,!1))}.bind(this);n.addEventListener("canplaythrough",m,!1)}}}, stop:function(){this.bgmPlaying=!1;if(this.isSupported)if(this.webaudio){if(this.webaudio.source_loop._playing&&(this.webaudio.source_loop[this.webaudio.compatibility.stop](0),this.webaudio.source_loop._playing=!1,this.pausedTime+=this.webaudio.context.currentTime-this.webaudio.source_loop._startTime,this.pausedTime%=this.webaudio.source_loop.buffer.duration,this.webaudio.source_loop._startTime=0,"noteOn"===this.webaudio.compatibility.start))this.webaudio.source_once[this.webaudio.compatibility.stop](0)}else if(this.audio){var b= this.audio;4==b.readyState&&(this.pausedTime=b.currentTime,b.currentTime=0,b.pause(),clearTimeout(this._onEndTimer),this._onEndTimer=null)}},volume:function(b){if(isNaN(b)||null==b)return this.getVolume();this.isSupported&&(this._volume=b,0>this._volume?this._volume=0:1=b&&(b=c.settings.spritemap.music.start,ig.ua.android?this.forcelooped||(c.play(b,!0),this.forcelooped=!0,setTimeout(function(){ig.soundHandler.forcelooped=!1},d)):c.setCurrentTime(b)))}else"ImpactMusicPlayer"==this.bgmPlayer.tagName&&(null!=window.mozInnerScreenX&& /firefox/.test(navigator.userAgent.toLowerCase()),b=Boolean(window.chrome),!window.chrome&&/safari/.test(navigator.userAgent.toLowerCase()),d=0.1,ig.ua.mobile&&(d=0.115,ig.ua.android&&(d=0.45,b&&(d=0.3))),c=0,"mp3"==ig.soundManager.format.ext&&(c=0.05),ig.music.currentTrack&&(b=ig.music.currentTrack.duration-d,ig.music.currentTrack.currentTime>=b&&(ig.ua.android?this.forcelooped||(ig.music.currentTrack.pause(),ig.music.currentTrack.currentTime=c,ig.music.currentTrack.play(),this.forcelooped=!0,setTimeout(function(){ig.soundHandler.forcelooped= !1},d)):ig.music.currentTrack.currentTime=c)))}}})});ig.baked=!0; ig.module("plugins.io.storage").defines(function(){ig.Storage=ig.Class.extend({staticInstantiate:function(){return!ig.Storage.instance?null:ig.Storage.instance},init:function(){ig.Storage.instance=this},isCapable:function(){return"undefined"!==typeof window.localStorage},isSet:function(b){return null!==this.get(b)},initUnset:function(b,c){null===this.get(b)&&this.set(b,c)},get:function(b){if(!this.isCapable())return null;try{return JSON.parse(localStorage.getItem(b))}catch(c){return window.localStorage.getItem(b)}},getInt:function(b){return~~this.get(b)}, getFloat:function(b){return parseFloat(this.get(b))},getBool:function(b){return!!this.get(b)},key:function(b){return this.isCapable()?window.localStorage.key(b):null},set:function(b,c){if(!this.isCapable())return null;try{window.localStorage.setItem(b,JSON.stringify(c))}catch(d){console.log(d)}},setHighest:function(b,c){c>this.getFloat(b)&&this.set(b,c)},remove:function(b){if(!this.isCapable())return null;window.localStorage.removeItem(b)},clear:function(){if(!this.isCapable())return null;window.localStorage.clear()}})}); ig.baked=!0; ig.module("plugins.io.mouse").defines(function(){Mouse=ig.Class.extend({bindings:{click:[ig.KEY.MOUSE1]},init:function(){ig.input.initMouse();for(var b in this.bindings){this[b]=b;for(var c=0;cd?d:b},pollGamepads:function(){if(this.isSupported){this.leftStick.x=0;this.leftStick.y=0;this.rightStick.x=0;this.rightStick.y=0;this.list=navigator.getGamepads();for(var b in this.bindings){for(var c= !1,d=0;d=b-40&&this.touches[c].x<=b+40&& this.touches.splice(c,1)}}if(ig.visibilityHandler)ig.visibilityHandler.onChange("focus");try{ig.soundHandler.unlockWebAudio()}catch(e){}},windowKeyUp:function(b){b="undefined"!=typeof b.identifier?b.identifier:"undefined"!=typeof b.pointerId?b.pointerId:1;for(var c=0;cthis.getFloat(b)&&this.set(b,c)},get:function(b){return"undefined"==typeof this.tempData[b]?null:JSON.parse(this.tempData[b])},getInt:function(b){return~~this.get(b)},getFloat:function(b){return parseFloat(this.get(b))}, getBool:function(b){return!!this.get(b)},isSet:function(b){return null!==this.get(b)},remove:function(b){delete this.tempData[b]},clear:function(){this.tempData={}}})});ig.baked=!0; ig.module("plugins.io.io-manager").requires("plugins.io.storage","plugins.io.mouse","plugins.io.keyboard","plugins.io.gamepad","plugins.io.multitouch","plugins.io.multitouch-input","plugins.io.gamepad-input","plugins.io.fake-storage").defines(function(){IoManager=ig.Class.extend({storage:null,localStorageSupport:!1,mouse:null,keyboard:null,multitouch:null,gamepad:null,init:function(){ig.multitouchInput=new ig.MultitouchInput;ig.gamepadInput=new ig.GamepadInput;this.unbindAll();this.initStorage(); this.initMouse();this.initKeyboard()},unbindAll:function(){ig.input.unbindAll();ig.gamepadInput.unbindAll()},initStorage:function(){try{window.localStorage.setItem("test","test"),this.storage=new ig.Storage}catch(b){console.log("using fake storage"),this.storage=new ig.FakeStorage}finally{window.localStorage.removeItem("test")}},initMouse:function(){this.mouse=new Mouse},initKeyboard:function(){this.keyboard=new Keyboard},initMultitouch:function(){this.multitouch=new Multitouch},initGamepad:function(){this.gamepad= new Gamepad},press:function(b){return ig.input.pressed(b)||this.gamepad&&this.gamepad.press(b)?!0:!1},held:function(b){return ig.input.state(b)||this.gamepad&&this.gamepad.state(b)?!0:!1},release:function(b){return ig.input.released(b)||this.gamepad&&this.gamepad.released(b)?!0:!1},getClickPos:function(){return this.mouse.getPos()},getTouchesPos:function(){return this.multitouch.getTouchesPos()},checkOverlap:function(b,c,d,e,f){return b.x>c+e||b.xd+f||b.y";(document.getElementById("play").parentNode||document.getElementById("ajaxbar")).appendChild(this.desktopCoverDIV);try{"undefined"!==typeof ig.sizeHandler?"undefined"!== typeof ig.sizeHandler.coreDivsToResize&&(ig.sizeHandler.coreDivsToResize.push("#"+this.desktopCoverDIVID),"function"===typeof ig.sizeHandler.reorient&&ig.sizeHandler.reorient()):"undefined"!==typeof coreDivsToResize&&(coreDivsToResize.push(this.desktopCoverDIVID),"function"===typeof sizeHandler&&sizeHandler())}catch(c){console.log(c)}this.desktopCoverDIV.addEventListener("click",function(){ig.soundHandler.unlockWebAudio();this.desktopCoverDIV.setAttribute("style","visibility: hidden;");"function"=== typeof b&&b()}.bind(this))},setupCustomAnimation:function(){this.customAnim=new ig.Animation(this.customAnim,0.05,[0,1,2,3,4,5]);this.customAnim.currentFrame=0;ig.loadingScreen=this;ig.loadingScreen.animationTimer=window.setInterval("ig.loadingScreen.animate()",100)},animate:function(){this.customAnim.currentFrame=f&&(f=0.1);f>this.barFull.width&&(f=this.barFull.width);b.drawImage(this.barFull.data,0,0,f,28,d*c,e*c-10,f,28);b.drawImage(this.loadingMango.data,d*c+f-20,e*c-17);b=_STRINGS.Splash.Loading;b=ig.system.width/ 2-ig.system.context.measureText(b).width/2;ig.system.context.font="bold 18px janda";ig.system.context.fillStyle="#FFFFFF";ig.system.context.fillText(".",b,-1E3);b=_STRINGS.Splash.LogoLine1;ig.system.context.measureText(b);ig.system.context.font="bold 12px Arial";b=_STRINGS.Splash.LogoLine2;ig.system.context.measureText(b);ig.system.context.font="bold 12px Arial"}})});ig.baked=!0; ig.module("plugins.tween").requires("impact.entity").defines(function(){Array.prototype.indexOf||(Array.prototype.indexOf=function(b){for(var c=0;c(b*=2)?0.5*b*b:-0.5*(--b*(b-2)-1)};ig.Tween.Easing.Cubic.EaseIn=function(b){return b*b*b};ig.Tween.Easing.Cubic.EaseOut=function(b){return--b*b*b+1};ig.Tween.Easing.Cubic.EaseInOut=function(b){return 1>(b*=2)?0.5*b*b*b:0.5*((b-=2)*b*b+2)};ig.Tween.Easing.Quartic.EaseIn=function(b){return b*b*b*b};ig.Tween.Easing.Quartic.EaseOut=function(b){return-(--b*b*b*b-1)};ig.Tween.Easing.Quartic.EaseInOut=function(b){return 1>(b*=2)?0.5*b*b*b*b:-0.5*((b-=2)*b*b*b-2)};ig.Tween.Easing.Quintic.EaseIn= function(b){return b*b*b*b*b};ig.Tween.Easing.Quintic.EaseOut=function(b){return(b-=1)*b*b*b*b+1};ig.Tween.Easing.Quintic.EaseInOut=function(b){return 1>(b*=2)?0.5*b*b*b*b*b:0.5*((b-=2)*b*b*b*b+2)};ig.Tween.Easing.Sinusoidal.EaseIn=function(b){return-Math.cos(b*Math.PI/2)+1};ig.Tween.Easing.Sinusoidal.EaseOut=function(b){return Math.sin(b*Math.PI/2)};ig.Tween.Easing.Sinusoidal.EaseInOut=function(b){return-0.5*(Math.cos(Math.PI*b)-1)};ig.Tween.Easing.Exponential.EaseIn=function(b){return 0==b?0:Math.pow(2, 10*(b-1))};ig.Tween.Easing.Exponential.EaseOut=function(b){return 1==b?1:-Math.pow(2,-10*b)+1};ig.Tween.Easing.Exponential.EaseInOut=function(b){return 0==b?0:1==b?1:1>(b*=2)?0.5*Math.pow(2,10*(b-1)):0.5*(-Math.pow(2,-10*(b-1))+2)};ig.Tween.Easing.Circular.EaseIn=function(b){return-(Math.sqrt(1-b*b)-1)};ig.Tween.Easing.Circular.EaseOut=function(b){return Math.sqrt(1- --b*b)};ig.Tween.Easing.Circular.EaseInOut=function(b){return 1>(b/=0.5)?-0.5*(Math.sqrt(1-b*b)-1):0.5*(Math.sqrt(1-(b-=2)*b)+1)};ig.Tween.Easing.Elastic.EaseIn= function(b){var c,d=0.1,e=0.4;if(0==b)return 0;if(1==b)return 1;e||(e=0.3);!d||1>d?(d=1,c=e/4):c=e/(2*Math.PI)*Math.asin(1/d);return-(d*Math.pow(2,10*(b-=1))*Math.sin(2*(b-c)*Math.PI/e))};ig.Tween.Easing.Elastic.EaseOut=function(b){var c,d=0.1,e=0.4;if(0==b)return 0;if(1==b)return 1;e||(e=0.3);!d||1>d?(d=1,c=e/4):c=e/(2*Math.PI)*Math.asin(1/d);return d*Math.pow(2,-10*b)*Math.sin(2*(b-c)*Math.PI/e)+1};ig.Tween.Easing.Elastic.EaseInOut=function(b){var c,d=0.1,e=0.4;if(0==b)return 0;if(1==b)return 1; e||(e=0.3);!d||1>d?(d=1,c=e/4):c=e/(2*Math.PI)*Math.asin(1/d);return 1>(b*=2)?-0.5*d*Math.pow(2,10*(b-=1))*Math.sin(2*(b-c)*Math.PI/e):0.5*d*Math.pow(2,-10*(b-=1))*Math.sin(2*(b-c)*Math.PI/e)+1};ig.Tween.Easing.Back.EaseIn=function(b){return b*b*(2.70158*b-1.70158)};ig.Tween.Easing.Back.EaseOut=function(b){return(b-=1)*b*(2.70158*b+1.70158)+1};ig.Tween.Easing.Back.EaseInOut=function(b){return 1>(b*=2)?0.5*b*b*(3.5949095*b-2.5949095):0.5*((b-=2)*b*(3.5949095*b+2.5949095)+2)};ig.Tween.Easing.Bounce.EaseIn= function(b){return 1-ig.Tween.Easing.Bounce.EaseOut(1-b)};ig.Tween.Easing.Bounce.EaseOut=function(b){return(b/=1)<1/2.75?7.5625*b*b:b<2/2.75?7.5625*(b-=1.5/2.75)*b+0.75:b<2.5/2.75?7.5625*(b-=2.25/2.75)*b+0.9375:7.5625*(b-=2.625/2.75)*b+0.984375};ig.Tween.Easing.Bounce.EaseInOut=function(b){return 0.5>b?0.5*ig.Tween.Easing.Bounce.EaseIn(2*b):0.5*ig.Tween.Easing.Bounce.EaseOut(2*b-1)+0.5};ig.Tween.Interpolation={Linear:function(b,c){var d=b.length-1,e=d*c,f=Math.floor(e),j=TWEEN.Interpolation.Utils.Linear; return 0>c?j(b[0],b[1],e):1d?d:f+1],e-f)}}});ig.baked=!0; ig.module("plugins.patches.entity-patch").requires("impact.entity").defines(function(){ig.Entity.inject({handleMovementTrace:function(b){this.standing=!1;b.collision.y&&(0this.minBounceVelocity?this.vel.y*=-this.bounciness:(0this.minBounceVelocity?this.vel.x*-this.bounciness:0);if(b.collision.slope){var c=b.collision.slope;if(0this.slopeStanding.min&&cd?n(b[0],b[1],f): 1e?e:j+1],f-j)},Bezier:function(b,d){for(var e=0,f=b.length-1,j=Math.pow,n=ig.Tween.Interpolation.Utils.Bernstein,m=0;m<=f;m++)e+=j(1-d,f-m)*j(d,m)*b[m]*n(f,m);return e},CatmullRom:function(b,d){var e=b.length-1,f=e*d,j=Math.floor(f),n=ig.Tween.Interpolation.Utils.CatmullRom;return b[0]===b[e]?(0>d&&(j=Math.floor(f=e*(1+d))),n(b[(j-1+e)%e],b[j],b[(j+1)%e],b[(j+2)%e],f-j)):0>d?b[0]-(n(b[0],b[0],b[1],b[1],-f)-b[0]):1this.getFloat(b)&&this.set(b,c)},remove:function(b){if(!this.isCapable())return null;window.localStorage.removeItem(b)},clear:function(){if(!this.isCapable())return null; window.localStorage.clear()}})});ig.baked=!0; ig.module("plugins.scale").requires("impact.entity").defines(function(){ig.Entity.inject({scale:{x:1,y:1},_offset:{x:0,y:0},_scale:{x:1,y:1},_size:{x:0,y:0},init:function(b,c,d){this.parent(b,c,d);this._offset.x=this.offset.x;this._offset.y=this.offset.y;this._size.x=this.size.x;this._size.y=this.size.y;this.setScale(this.scale.x,this.scale.y)},draw:function(){var b=ig.system.context;b.save();b.translate(ig.system.getDrawPos(this.pos.x.round()-this.offset.x-ig.game.screen.x),ig.system.getDrawPos(this.pos.y.round()- this.offset.y-ig.game.screen.y));b.scale(this._scale.x,this._scale.y);null!=this.currentAnim&&this.currentAnim.draw(0,0);b.restore()},setScale:function(b,c){var d=this.size.x,e=this.size.y;this.scale.x=b||this.scale.x;this.scale.y=c||this.scale.y;this._scale.x=this.scale.x/ig.system.scale;this._scale.y=this.scale.y/ig.system.scale;this.offset.x=this._offset.x*this._scale.x;this.offset.y=this._offset.y*this._scale.y;this.size.x=this._size.x*this._scale.x;this.size.y=this._size.y*this._scale.y;this.pos.x+= (d-this.size.x)/2;this.pos.y+=(e-this.size.y)/2}})});ig.baked=!0; ig.module("plugins.fullscreen").requires("impact.entity","plugins.handlers.size-handler","plugins.director").defines(function(){ig.Fullscreen={enableFullscreenButton:!0,_isEnabled:"notChecked",isEnabled:function(){"notChecked"==this._isEnabled&&(this._isEnabled=document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled?!0:!1);return this._isEnabled},isFullscreen:function(){return ig.Fullscreen.isEnabled()&&(document.fullscreenElement|| document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)?!0:!1},toggleFullscreen:function(){try{ig.soundHandler.unlockWebAudio()}catch(b){}ig.Fullscreen.isFullscreen()?ig.Fullscreen.exitFullscreen():ig.Fullscreen.requestFullscreen();ig.sizeHandler.orientationDelayHandler();if(ig&&ig.visibilityHandler)ig.visibilityHandler.onChange("focus");try{ig.soundHandler.unlockWebAudio()}catch(c){}},requestFullscreen:function(){var b=document.documentElement;b.requestFullscreen? b.requestFullscreen():b.webkitRequestFullscreen?b.webkitRequestFullscreen():b.mozRequestFullScreen?b.mozRequestFullScreen():b.msRequestFullscreen?b.msRequestFullscreen():console.log("no request fullscreen method available")},exitFullscreen:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():console.log("no exit fullscreen method available")}, divs:{}};ig.Director.inject({loadLevel:function(b){var c=ig.Fullscreen.divs,d;for(d in c)c=ig.domHandler.getElementById("#"+d),ig.domHandler.hide(c);return this.parent(b)}});ig.SizeHandler.inject({resize:function(){this.parent();var b=ig.Fullscreen.divs,c;for(c in b){var d=Math.min(ig.sizeHandler.scaleRatioMultiplier.x,ig.sizeHandler.scaleRatioMultiplier.y),e=ig.domHandler.getElementById("#"+c),f=b[c].entity_pos_x,j=b[c].entity_pos_y,n=b[c].width,m=b[c].height,g=ig.domHandler.getElementById("#canvas"), r=ig.domHandler.getOffsets(g);ig.ua.mobile?(g=r.left,r=r.top,ig.sizeHandler.disableStretchToFitOnMobileFlag?(f=Math.floor(g+f*ig.sizeHandler.scaleRatioMultiplier.x)+"px",j=Math.floor(r+j*ig.sizeHandler.scaleRatioMultiplier.y)+"px",n=Math.floor(n*ig.sizeHandler.scaleRatioMultiplier.x)+"px",m=Math.floor(m*ig.sizeHandler.scaleRatioMultiplier.y)+"px"):(f=Math.floor(f*ig.sizeHandler.sizeRatio.x)+"px",j=Math.floor(j*ig.sizeHandler.sizeRatio.y)+"px",n=Math.floor(n*ig.sizeHandler.sizeRatio.x)+"px",m=Math.floor(m* ig.sizeHandler.sizeRatio.y)+"px")):(g=r.left,r=r.top,f=Math.floor(g+f*d)+"px",j=Math.floor(r+j*d)+"px",n=Math.floor(n*d)+"px",m=Math.floor(m*d)+"px");ig.domHandler.css(e,{"float":"left",position:"absolute",left:f,top:j,width:n,height:m,"z-index":3});b[c]["font-size"]&&ig.domHandler.css(e,{"font-size":b[c]["font-size"]*d+"px"})}}});ig.FullscreenButton=ig.Entity.extend({enterImage:null,exitImage:null,isReady:!1,zIndex:999999,identifier:null,prevPos:{x:0,y:0},invisImagePath:"media/graphics/misc/invisible.png", init:function(b,c,d){this.parent(b,c,d);ig.Fullscreen.isEnabled()&&ig.Fullscreen.enableFullscreenButton?this.enterImage.loaded?this.initSize():this.enterImage.loadCallback=function(){this.initSize()}.bind(this):this.kill()},kill:function(){this.parent()},destroy:function(){this.parent();console.log("destroy")},initSize:function(){this.size.x=this.enterImage.width;this.size.y=this.enterImage.height;this.createClickableLayer();this.isReady=!0},createClickableLayer:function(){this.identifier="fullscreen-button-layer"; var b=ig.domHandler.getElementById("#"+this.identifier);b?(ig.domHandler.show(b),ig.domHandler.attr(b,"onclick","ig.Fullscreen.toggleFullscreen()")):this.createClickableOutboundLayer()},update:function(b,c){b=this.pos.x;c=this.pos.y;this.isReady&&!(this.prevPos.x===b&&this.prevPos.y===c)&&(ig.Fullscreen.divs[this.identifier]={},ig.Fullscreen.divs[this.identifier].width=this.size.x,ig.Fullscreen.divs[this.identifier].height=this.size.y,ig.Fullscreen.divs[this.identifier].entity_pos_x=this.pos.x,ig.Fullscreen.divs[this.identifier].entity_pos_y= this.pos.y,this.prevPos.x=b,this.prevPos.y=c)},draw:function(){this.isReady&&(ig.Fullscreen.isFullscreen()?this.exitImage.draw(this.pos.x,this.pos.y):this.enterImage.draw(this.pos.x,this.pos.y))},createClickableOutboundLayer:function(){var b=this.identifier,c=this.invisImagePath,d=ig.domHandler.create("div");ig.domHandler.attr(d,"id",b);ig.domHandler.attr(d,"onclick","ig.Fullscreen.toggleFullscreen()");var e=ig.domHandler.create("a"),f=ig.domHandler.create("img");ig.domHandler.css(f,{width:"100%", height:"100%"});ig.domHandler.attr(f,"src",c);c=Math.min(ig.sizeHandler.scaleRatioMultiplier.x,ig.sizeHandler.scaleRatioMultiplier.y);if(ig.ua.mobile){var j=ig.domHandler.getElementById("#canvas"),j=ig.domHandler.getOffsets(j),n=j.left,m=j.top;console.log(j.left);ig.sizeHandler.disableStretchToFitOnMobileFlag?(j=Math.floor(n+this.pos.x*ig.sizeHandler.scaleRatioMultiplier.x)+"px",m=Math.floor(m+this.pos.y*ig.sizeHandler.scaleRatioMultiplier.y)+"px",n=Math.floor(this.size.x*ig.sizeHandler.scaleRatioMultiplier.x)+ "px",c=Math.floor(this.size.y*ig.sizeHandler.scaleRatioMultiplier.y)+"px"):(j=Math.floor(this.pos.x*ig.sizeHandler.sizeRatio.x)+"px",m=Math.floor(this.pos.y*ig.sizeHandler.sizeRatio.y)+"px",n=Math.floor(this.size.x*ig.sizeHandler.sizeRatio.x)+"px",c=Math.floor(this.size.y*ig.sizeHandler.sizeRatio.y)+"px")}else j=ig.domHandler.getElementById("#canvas"),j=ig.domHandler.getOffsets(j),n=j.left,m=j.top,ig.sizeHandler.enableStretchToFitOnDesktopFlag?(j=Math.floor(n+this.pos.x*ig.sizeHandler.sizeRatio.x)+ "px",m=Math.floor(m+this.pos.y*ig.sizeHandler.sizeRatio.y)+"px",n=Math.floor(this.size.x*ig.sizeHandler.sizeRatio.x)+"px",c=Math.floor(this.size.y*ig.sizeHandler.sizeRatio.y)+"px"):(j=Math.floor(n+this.pos.x*c)+"px",m=Math.floor(m+this.pos.y*c)+"px",n=Math.floor(this.size.x*c)+"px",c=Math.floor(this.size.y*c)+"px");ig.domHandler.css(d,{"float":"left",position:"absolute",left:j,top:m,width:n,height:c,"z-index":3});ig.domHandler.addEvent(d,"mousemove",ig.input.mousemove.bind(ig.input),!1);ig.domHandler.appendChild(e, f);ig.domHandler.appendChild(d,e);ig.domHandler.appendToBody(d);ig.Fullscreen.divs[b]={};ig.Fullscreen.divs[b].width=this.size.x;ig.Fullscreen.divs[b].height=this.size.y;ig.Fullscreen.divs[b].entity_pos_x=this.pos.x;ig.Fullscreen.divs[b].entity_pos_y=this.pos.y}})});var Box2D={SCALE:0.1}; (function(b,c){function d(){}!(Object.prototype.defineProperty instanceof Function)&&Object.prototype.__defineGetter__ instanceof Function&&Object.prototype.__defineSetter__ instanceof Function&&(Object.defineProperty=function(b,c,d){d.get instanceof Function&&b.__defineGetter__(c,d.get);d.set instanceof Function&&b.__defineSetter__(c,d.set)});b.inherit=function(b,c){d.prototype=c.prototype;b.prototype=new d;b.prototype.constructor=b};b.generateCallback=function(b,c){return function(){c.apply(b,arguments)}}; b.NVector=function(b){b===c&&(b=0);for(var d=Array(b||0),j=0;jm&&(C=u,u=m,m=C,C=1),u>d&&(s.x=C,s.y=0,d=u),e=Math.min(e,m),d>e)return!1;if(pm&&(C=u,u=m,m=C,C=1),u>d&&(s.y=C,s.x=0,d=u),e=Math.min(e,m),d>e)return!1;b.fraction=d;return!0}; g.prototype.TestOverlap=function(b){var c=b.lowerBound.y-this.upperBound.y,d=this.lowerBound.y-b.upperBound.y;return 0=p&&b[f++].Set(c[0]);0>=l&&b[f++].Set(c[1]);0>p*l&&(d=p/(p-l),l=b[f],l=l.v,l.x=g.x+d*(j.x-g.x),l.y=g.y+d*(j.y-g.y),l=b[f],l.id=(0u&&(u=j,s=C);g=z.EdgeSeparation(c,d,s,e,l);j=parseInt(0<=s-1?s-1:f-1);p=z.EdgeSeparation(c,d,j,e,l); var m=parseInt(s+1g&&p>u)G=-1,C=j,J=p;else if(u>g)G=1,C=m,J=u;else return b[0]=s,g;for(;;)if(s=-1==G?0<=C-1?C-1:f-1:C+1J)C=s,J=g;else break;b[0]=C;return J};z.FindIncidentEdge=function(b,c,d,e,l,f){void 0===e&&(e=0);parseInt(c.m_vertexCount);var g=c.m_normals,j=parseInt(l.m_vertexCount);c=l.m_vertices;l=l.m_normals;var p;p=d.R;d=g[e];var g=p.col1.x*d.x+p.col2.x*d.y,s=p.col1.y*d.x+p.col2.y*d.y;p=f.R;d=p.col1.x* g+p.col1.y*s;s=p.col2.x*g+p.col2.y*s;g=d;p=0;for(var m=Number.MAX_VALUE,u=0;uj)){var s;z.s_edgeBO[0]=0;var m=z.FindMaxSeparation(z.s_edgeBO,l,f,c,d);s=z.s_edgeBO[0];if(!(m>j)){var u=0,C=0;m>0.98*p+0.001?(p=l,l=c,c=f,u=s,b.m_type=I.e_faceB,C=1):(p=c,c=d,d=f, u=g,b.m_type=I.e_faceA,C=0);g=z.s_incidentEdge;z.FindIncidentEdge(g,p,c,u,l,d);s=parseInt(p.m_vertexCount);f=p.m_vertices;var p=f[u],J;J=u+1H)&&(H=z.ClipSegmentToLine(p,J,m,s),!(2>H))){b.m_localPlaneNormal.SetV(f);b.m_localPoint.SetV(l);for(l=f=0;lf*f||(b.m_type=I.e_circles,b.m_localPoint.SetV(c.m_p), b.m_localPlaneNormal.SetZero(),b.m_pointCount=1,b.m_points[0].m_localPoint.SetV(e.m_p),b.m_points[0].m_id.key=0)};z.CollidePolygonAndCircle=function(b,c,d,e,l){var f=b.m_pointCount=0,g=0,p,j;j=l.R;p=e.m_p;var s=l.position.y+(j.col1.y*p.x+j.col2.y*p.y),f=l.position.x+(j.col1.x*p.x+j.col2.x*p.y)-d.position.x,g=s-d.position.y;j=d.R;d=f*j.col1.x+g*j.col1.y;j=f*j.col2.x+g*j.col2.y;var m=0,s=-Number.MAX_VALUE;l=c.m_radius+e.m_radius;var u=parseInt(c.m_vertexCount),C=c.m_vertices;c=c.m_normals;for(var J= 0;Jl)return;f>s&&(s=f,m=J)}f=parseInt(m);g=parseInt(f+1=(d-p.x)*(C.x-p.x)+(j-p.y)*(C.y-p.y)){if((d-p.x)*(d-p.x)+(j-p.y)*(j-p.y)>l*l)return;b.m_pointCount=1;b.m_type=I.e_faceA;b.m_localPlaneNormal.x=d-p.x;b.m_localPlaneNormal.y= j-p.y;b.m_localPlaneNormal.Normalize();b.m_localPoint.SetV(p)}else if(0>=s){if((d-C.x)*(d-C.x)+(j-C.y)*(j-C.y)>l*l)return;b.m_pointCount=1;b.m_type=I.e_faceA;b.m_localPlaneNormal.x=d-C.x;b.m_localPlaneNormal.y=j-C.y;b.m_localPlaneNormal.Normalize();b.m_localPoint.SetV(C)}else{m=0.5*(p.x+C.x);p=0.5*(p.y+C.y);s=(d-m)*c[f].x+(j-p)*c[f].y;if(s>l)return;b.m_pointCount=1;b.m_type=I.e_faceA;b.m_localPlaneNormal.x=c[f].x;b.m_localPlaneNormal.y=c[f].y;b.m_localPlaneNormal.Normalize();b.m_localPoint.Set(m, p)}b.m_points[0].m_localPoint.SetV(e.m_p);b.m_points[0].m_id.key=0};z.TestOverlap=function(b,c){var d=c.lowerBound,e=b.upperBound,l=d.x-e.x,f=d.y-e.y,d=b.lowerBound,e=c.upperBound,g=d.y-e.y;return 0>8&255;this.features._incidentVertex=(this._key&16711680)>>16&255;this.features._flip=(this._key&4278190080)>>24&255}});B.b2ContactPoint=function(){this.position=new m;this.velocity=new m;this.normal=new m;this.id=new A};E.b2Distance=function(){};E.Distance=function(b,c,d){++E.b2_gjkCalls;var l=d.proxyA,g=d.proxyB,p=d.transformA,j=d.transformB,s=E.s_simplex;s.ReadCache(c,l,p,g,j);var u=s.m_vertices,C=E.s_saveA,J=E.s_saveB,G=0;s.GetClosestPoint().LengthSquared();for(var t=0,H,n=0;20> n;){G=s.m_count;for(t=0;tc+g&&b.distance>Number.MIN_VALUE?(b.distance-=c+g,d=f.SubtractVV(b.pointB,b.pointA),d.Normalize(),b.pointA.x+=c*d.x,b.pointA.y+=c*d.y,b.pointB.x-=g*d.x, b.pointB.y-=g*d.y):(H=new m,H.x=0.5*(b.pointA.x+b.pointB.x),H.y=0.5*(b.pointA.y+b.pointB.y),b.pointA.x=b.pointB.x=H.x,b.pointA.y=b.pointB.y=H.y,b.distance=0))};Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new u;Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)});D.b2DistanceInput=function(){};t.b2DistanceOutput=function(){this.pointA=new m;this.pointB=new m};F.b2DistanceProxy=function(){};F.prototype.Set= function(l){switch(l.GetType()){case d.e_circleShape:l=l instanceof b?l:null;this.m_vertices=new Vector(1,!0);this.m_vertices[0]=l.m_p;this.m_count=1;this.m_radius=l.m_radius;break;case d.e_polygonShape:l=l instanceof c?l:null;this.m_vertices=l.m_vertices;this.m_count=l.m_vertexCount;this.m_radius=l.m_radius;break;default:e.b2Assert(!1)}};F.prototype.GetSupport=function(b){for(var c=0,d=this.m_vertices[0].x*b.x+this.m_vertices[0].y*b.y,e=1;ed&&(c=e,d=l)}return c};F.prototype.GetSupportVertex=function(b){for(var c=0,d=this.m_vertices[0].x*b.x+this.m_vertices[0].y*b.y,e=1;ed&&(c=e,d=l)}return this.m_vertices[c]};F.prototype.GetVertexCount=function(){return this.m_count};F.prototype.GetVertex=function(b){void 0===b&&(b=0);e.b2Assert(0<=b&&b>e&1?d.child2:d.child1,e=e+1&31;++this.m_path; this.RemoveLeaf(d);this.InsertLeaf(d)}};K.prototype.GetFatAABB=function(b){return b.aabb};K.prototype.GetUserData=function(b){return b.userData};K.prototype.Query=function(b,c){if(null!=this.m_root){var d=new Vector,e=0;for(d[e++]=this.m_root;0=e?b:e;++c.m_pairCount;return!0},l)}for(d=c.m_moveBuffer.length=0;dj){var m=l.x-this.p1.x,u=l.y-this.p1.y,l=m*d+u*p;if(0<=l&&l<=e*s&&(e=-f*u+g*m,-j*s<=e&&e<=s*(1+j)))return l/=s,e=Math.sqrt(d*d+p*p),b[0]=l,c.Set(d/e,p/e),!0}return!1};U.prototype.Extend=function(b){this.ExtendForward(b);this.ExtendBackward(b)};U.prototype.ExtendForward=function(b){var c=this.p2.x-this.p1.x,d=this.p2.y-this.p1.y;b=Math.min(0c?(b.lowerBound.x-this.p1.x)/c:Number.POSITIVE_INFINITY,0d?(b.lowerBound.y-this.p1.y)/d:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+c*b;this.p2.y=this.p1.y+d*b};U.prototype.ExtendBackward=function(b){var c=-this.p2.x+this.p1.x,d=-this.p2.y+this.p1.y;b=Math.min(0c?(b.lowerBound.x-this.p2.x)/c:Number.POSITIVE_INFINITY,0d?(b.lowerBound.y-this.p2.y)/d:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+c*b;this.p1.y=this.p2.y+d*b};s.b2SeparationFunction=function(){this.m_localPoint= new m;this.m_axis=new m};s.prototype.Initialize=function(b,c,d,l,g){this.m_proxyA=c;this.m_proxyB=l;var p=parseInt(b.count);e.b2Assert(0p);var j,u,C,J,t=0,G=0;1==p?(this.m_type=s.e_points,j=this.m_proxyA.GetVertex(b.indexA[0]),u=this.m_proxyB.GetVertex(b.indexB[0]),p=j,b=d.R,c=d.position.x+(b.col1.x*p.x+b.col2.x*p.y),l=d.position.y+(b.col1.y*p.x+b.col2.y*p.y),p=u,b=g.R,C=g.position.x+(b.col1.x*p.x+b.col2.x*p.y),J=g.position.y+(b.col1.y*p.x+b.col2.y*p.y),this.m_axis.x=C-c,this.m_axis.y=J-l,this.m_axis.Normalize()): (b.indexB[0]==b.indexB[1]?(this.m_type=s.e_faceA,c=this.m_proxyA.GetVertex(b.indexA[0]),l=this.m_proxyA.GetVertex(b.indexA[1]),u=this.m_proxyB.GetVertex(b.indexB[0]),this.m_localPoint.x=0.5*(c.x+l.x),this.m_localPoint.y=0.5*(c.y+l.y),this.m_axis=f.CrossVF(f.SubtractVV(l,c),1),this.m_axis.Normalize(),p=this.m_axis,b=d.R,t=b.col1.x*p.x+b.col2.x*p.y,G=b.col1.y*p.x+b.col2.y*p.y,p=this.m_localPoint,b=d.R,c=d.position.x+(b.col1.x*p.x+b.col2.x*p.y),l=d.position.y+(b.col1.y*p.x+b.col2.y*p.y),p=u,b=g.R,C= g.position.x+(b.col1.x*p.x+b.col2.x*p.y),J=g.position.y+(b.col1.y*p.x+b.col2.y*p.y),t=(C-c)*t+(J-l)*G):b.indexA[0]==b.indexA[0]?(this.m_type=s.e_faceB,C=this.m_proxyB.GetVertex(b.indexB[0]),J=this.m_proxyB.GetVertex(b.indexB[1]),j=this.m_proxyA.GetVertex(b.indexA[0]),this.m_localPoint.x=0.5*(C.x+J.x),this.m_localPoint.y=0.5*(C.y+J.y),this.m_axis=f.CrossVF(f.SubtractVV(J,C),1),this.m_axis.Normalize(),p=this.m_axis,b=g.R,t=b.col1.x*p.x+b.col2.x*p.y,G=b.col1.y*p.x+b.col2.y*p.y,p=this.m_localPoint,b= g.R,C=g.position.x+(b.col1.x*p.x+b.col2.x*p.y),J=g.position.y+(b.col1.y*p.x+b.col2.y*p.y),p=j,b=d.R,c=d.position.x+(b.col1.x*p.x+b.col2.x*p.y),l=d.position.y+(b.col1.y*p.x+b.col2.y*p.y),t=(c-C)*t+(l-J)*G):(c=this.m_proxyA.GetVertex(b.indexA[0]),l=this.m_proxyA.GetVertex(b.indexA[1]),C=this.m_proxyB.GetVertex(b.indexB[0]),J=this.m_proxyB.GetVertex(b.indexB[1]),f.MulX(d,j),j=f.MulMV(d.R,f.SubtractVV(l,c)),f.MulX(g,u),t=f.MulMV(g.R,f.SubtractVV(J,C)),g=j.x*j.x+j.y*j.y,u=t.x*t.x+t.y*t.y,b=f.SubtractVV(t, j),d=j.x*b.x+j.y*b.y,b=t.x*b.x+t.y*b.y,j=j.x*t.x+j.y*t.y,G=g*u-j*j,t=0,0!=G&&(t=f.Clamp((j*b-d*u)/G,0,1)),0>(j*t+b)/u&&(t=f.Clamp((j-d)/g,0,1)),j=new m,j.x=c.x+t*(l.x-c.x),j.y=c.y+t*(l.y-c.y),u=new m,u.x=C.x+t*(J.x-C.x),u.y=C.y+t*(J.y-C.y),0==t||1==t?(this.m_type=s.e_faceB,this.m_axis=f.CrossVF(f.SubtractVV(J,C),1),this.m_axis.Normalize(),this.m_localPoint=u):(this.m_type=s.e_faceA,this.m_axis=f.CrossVF(f.SubtractVV(l,c),1),this.m_localPoint=j)),0>t&&this.m_axis.NegativeSelf())};s.prototype.Evaluate= function(b,c){var d,l,g=0;switch(this.m_type){case s.e_points:return d=f.MulTMV(b.R,this.m_axis),l=f.MulTMV(c.R,this.m_axis.GetNegative()),d=this.m_proxyA.GetSupportVertex(d),l=this.m_proxyB.GetSupportVertex(l),d=f.MulX(b,d),l=f.MulX(c,l),(l.x-d.x)*this.m_axis.x+(l.y-d.y)*this.m_axis.y;case s.e_faceA:return g=f.MulMV(b.R,this.m_axis),d=f.MulX(b,this.m_localPoint),l=f.MulTMV(c.R,g.GetNegative()),l=this.m_proxyB.GetSupportVertex(l),l=f.MulX(c,l),(l.x-d.x)*g.x+(l.y-d.y)*g.y;case s.e_faceB:return g=f.MulMV(c.R, this.m_axis),l=f.MulX(c,this.m_localPoint),d=f.MulTMV(b.R,g.GetNegative()),d=this.m_proxyA.GetSupportVertex(d),d=f.MulX(b,d),(d.x-l.x)*g.x+(d.y-l.y)*g.y;default:return e.b2Assert(!1),0}};Box2D.postDefs.push(function(){Box2D.Collision.b2SeparationFunction.e_points=1;Box2D.Collision.b2SeparationFunction.e_faceA=2;Box2D.Collision.b2SeparationFunction.e_faceB=4});u.b2Simplex=function(){this.m_v1=new C;this.m_v2=new C;this.m_v3=new C;this.m_vertices=new Vector(3)};u.prototype.b2Simplex=function(){this.m_vertices[0]= this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};u.prototype.ReadCache=function(b,c,d,l,g){e.b2Assert(0<=b.count&&3>=b.count);var p,j;this.m_count=b.count;for(var s=this.m_vertices,m=0;m=b?this.m_count=this.m_v1.a=1:(c=c.x*d.x+c.y*d.y,0>=c?(this.m_count=this.m_v2.a=1,this.m_v1.Set(this.m_v2)): (d=1/(c+b),this.m_v1.a=c*d,this.m_v2.a=b*d,this.m_count=2))};u.prototype.Solve3=function(){var b=this.m_v1.w,c=this.m_v2.w,d=this.m_v3.w,e=f.SubtractVV(c,b),l=f.Dot(b,e),g=f.Dot(c,e),l=-l,p=f.SubtractVV(d,b),j=f.Dot(b,p),s=f.Dot(d,p),j=-j,m=f.SubtractVV(d,c),u=f.Dot(c,m),m=f.Dot(d,m),u=-u,p=f.CrossVV(e,p),e=p*f.CrossVV(c,d),d=p*f.CrossVV(d,b),b=p*f.CrossVV(b,c);0>=l&&0>=j?this.m_count=this.m_v1.a=1:0=b?(s=1/(g+l),this.m_v1.a=g*s,this.m_v2.a=l*s,this.m_count=2):0=d?(g=1/(s+j), this.m_v1.a=s*g,this.m_v3.a=j*g,this.m_count=2,this.m_v2.Set(this.m_v3)):0>=g&&0>=u?(this.m_count=this.m_v2.a=1,this.m_v1.Set(this.m_v2)):0>=s&&0>=m?(this.m_count=this.m_v3.a=1,this.m_v1.Set(this.m_v3)):0=e?(g=1/(m+u),this.m_v2.a=m*g,this.m_v3.a=u*g,this.m_count=2,this.m_v1.Set(this.m_v3)):(g=1/(e+d+b),this.m_v1.a=e*g,this.m_v2.a=d*g,this.m_v3.a=b*g,this.m_count=3)};G.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};C.b2SimplexVertex= function(){};C.prototype.Set=function(b){this.wA.SetV(b.wA);this.wB.SetV(b.wB);this.w.SetV(b.w);this.a=b.a;this.indexA=b.indexA;this.indexB=b.indexB};H.b2TimeOfImpact=function(){};H.TimeOfImpact=function(b){++H.b2_toiCalls;var c=b.proxyA,d=b.proxyB,l=b.sweepA,g=b.sweepB;e.b2Assert(l.t0==g.t0);e.b2Assert(1-l.t0>Number.MIN_VALUE);var p=c.m_radius+d.m_radius;b=b.tolerance;var j=0,s=0,m=0;H.s_cache.count=0;for(H.s_distanceInput.useRadii=!1;;){l.GetTransform(H.s_xfA,j);g.GetTransform(H.s_xfB,j);H.s_distanceInput.proxyA= c;H.s_distanceInput.proxyB=d;H.s_distanceInput.transformA=H.s_xfA;H.s_distanceInput.transformB=H.s_xfB;E.Distance(H.s_distanceOutput,H.s_cache,H.s_distanceInput);if(0>=H.s_distanceOutput.distance){j=1;break}H.s_fcn.Initialize(H.s_cache,c,H.s_xfA,d,H.s_xfB);var u=H.s_fcn.Evaluate(H.s_xfA,H.s_xfB);if(0>=u){j=1;break}0==s&&(m=u>p?f.Max(p-b,0.75*p):f.Max(u-b,0.02*p));if(u-m<0.5*b){if(0==s){j=1;break}break}var C=j,J=j,t=1;l.GetTransform(H.s_xfA,t);g.GetTransform(H.s_xfB,t);var G=H.s_fcn.Evaluate(H.s_xfA, H.s_xfB);if(G>=m){j=1;break}for(var n=0;;){var R=0,R=n&1?J+(m-u)*(t-J)/(G-u):0.5*(J+t);l.GetTransform(H.s_xfA,R);g.GetTransform(H.s_xfB,R);var Z=H.s_fcn.Evaluate(H.s_xfA,H.s_xfB);if(f.Abs(Z-m)<0.025*b){C=R;break}Z>m?(J=R,u=Z):(t=R,G=Z);++n;++H.b2_toiRootIters;if(50==n)break}H.b2_toiMaxRootIters=f.Max(H.b2_toiMaxRootIters,n);if(C<(1+100*Number.MIN_VALUE)*j)break;j=C;s++;++H.b2_toiIters;if(1E3==s)break}H.b2_toiMaxIters=f.Max(H.b2_toiMaxIters,s);return j};Box2D.postDefs.push(function(){Box2D.Collision.b2TimeOfImpact.b2_toiCalls= 0;Box2D.Collision.b2TimeOfImpact.b2_toiIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiRootIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxRootIters=0;Box2D.Collision.b2TimeOfImpact.s_cache=new G;Box2D.Collision.b2TimeOfImpact.s_distanceInput=new D;Box2D.Collision.b2TimeOfImpact.s_xfA=new n;Box2D.Collision.b2TimeOfImpact.s_xfB=new n;Box2D.Collision.b2TimeOfImpact.s_fcn=new s;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new t});Z.b2TOIInput=function(){this.proxyA= new F;this.proxyB=new F;this.sweepA=new j;this.sweepB=new j};R.b2WorldManifold=function(){this.m_normal=new m};R.prototype.b2WorldManifold=function(){this.m_points=new Vector(e.b2_maxManifoldPoints);for(var b=0;bNumber.MIN_VALUE*Number.MIN_VALUE?(j=Math.sqrt(j),this.m_normal.x=g/j,this.m_normal.y=p/j):(this.m_normal.x=1,this.m_normal.y=0);g=c+d*this.m_normal.y;e-=l*this.m_normal.y;this.m_points[0].x=0.5*(f+d*this.m_normal.x+(b-l*this.m_normal.x));this.m_points[0].y=0.5*(g+e);break;case I.e_faceA:p=c.R;g=b.m_localPlaneNormal;j=p.col1.x*g.x+p.col2.x* g.y;s=p.col1.y*g.x+p.col2.y*g.y;p=c.R;g=b.m_localPoint;m=c.position.x+p.col1.x*g.x+p.col2.x*g.y;u=c.position.y+p.col1.y*g.x+p.col2.y*g.y;this.m_normal.x=j;this.m_normal.y=s;for(f=0;fn||mthis.m_radius)return e.SetV(d),Math.PI*this.m_radius*this.m_radius;c=this.m_radius*this.m_radius;var j=f*f,f=c*(Math.asin(f/this.m_radius)+Math.PI/2)+f*Math.sqrt(c-j);c=-2/3*Math.pow(c-j,1.5)/f;e.x=d.x+b.x*c;e.y=d.y+b.y*c;return f};c.prototype.GetLocalPosition=function(){return this.m_p}; c.prototype.SetLocalPosition=function(b){this.m_p.SetV(b)};c.prototype.GetRadius=function(){return this.m_radius};c.prototype.SetRadius=function(b){void 0===b&&(b=0);this.m_radius=b};c.prototype.b2CircleShape=function(b){void 0===b&&(b=0);this.__super.b2Shape.call(this);this.m_type=n.e_circleShape;this.m_radius=b};d.b2EdgeChainDef=function(){};d.prototype.b2EdgeChainDef=function(){this.vertexCount=0;this.isALoop=!0;this.vertices=[]};Box2D.inherit(e,Box2D.Collision.Shapes.b2Shape);e.prototype.__super= Box2D.Collision.Shapes.b2Shape.prototype;e.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.s_supportVec=new y;this.m_v1=new y;this.m_v2=new y;this.m_coreV1=new y;this.m_coreV2=new y;this.m_normal=new y;this.m_direction=new y;this.m_cornerDir1=new y;this.m_cornerDir2=new y};e.prototype.TestPoint=function(){return!1};e.prototype.RayCast=function(b,c,d){var e,f=c.p2.x-c.p1.x,g=c.p2.y-c.p1.y;e=d.R;var j=d.position.x+(e.col1.x*this.m_v1.x+e.col2.x*this.m_v1.y), m=d.position.y+(e.col1.y*this.m_v1.x+e.col2.y*this.m_v1.y),n=d.position.y+(e.col1.y*this.m_v2.x+e.col2.y*this.m_v2.y)-m;d=-(d.position.x+(e.col1.x*this.m_v2.x+e.col2.x*this.m_v2.y)-j);e=100*Number.MIN_VALUE;var r=-(f*n+g*d);if(r>e){var j=c.p1.x-j,z=c.p1.y-m,m=j*n+z*d;if(0<=m&&m<=c.maxFraction*r&&(c=-f*z+g*j,-e*r<=c&&c<=r*(1+e)))return b.fraction=m/r,c=Math.sqrt(n*n+d*d),b.normal.x=n/c,b.normal.y=d/c,!0}return!1};e.prototype.ComputeAABB=function(b,c){var d=c.R,e=c.position.x+(d.col1.x*this.m_v1.x+ d.col2.x*this.m_v1.y),f=c.position.y+(d.col1.y*this.m_v1.x+d.col2.y*this.m_v1.y),g=c.position.x+(d.col1.x*this.m_v2.x+d.col2.x*this.m_v2.y),d=c.position.y+(d.col1.y*this.m_v2.x+d.col2.y*this.m_v2.y);ej*c+b*d?(this.s_supportVec.x=f,this.s_supportVec.y=g):(this.s_supportVec.x=j,this.s_supportVec.y=b);return this.s_supportVec};e.prototype.b2EdgeShape=function(c,d){this.__super.b2Shape.call(this);this.m_type=n.e_edgeShape;this.m_nextEdge=this.m_prevEdge=null;this.m_v1=c;this.m_v2=d;this.m_direction.Set(this.m_v2.x-this.m_v1.x,this.m_v2.y- this.m_v1.y);this.m_length=this.m_direction.Normalize();this.m_normal.Set(this.m_direction.y,-this.m_direction.x);this.m_coreV1.Set(-b.b2_toiSlop*(this.m_normal.x-this.m_direction.x)+this.m_v1.x,-b.b2_toiSlop*(this.m_normal.y-this.m_direction.y)+this.m_v1.y);this.m_coreV2.Set(-b.b2_toiSlop*(this.m_normal.x+this.m_direction.x)+this.m_v2.x,-b.b2_toiSlop*(this.m_normal.y+this.m_direction.y)+this.m_v2.y);this.m_cornerDir1=this.m_normal;this.m_cornerDir2.Set(-this.m_normal.x,-this.m_normal.y)};e.prototype.SetPrevEdge= function(b,c,d,e){this.m_prevEdge=b;this.m_coreV1=c;this.m_cornerDir1=d;this.m_cornerConvex1=e};e.prototype.SetNextEdge=function(b,c,d,e){this.m_nextEdge=b;this.m_coreV2=c;this.m_cornerDir2=d;this.m_cornerConvex2=e};f.b2MassData=function(){this.mass=0;this.center=new y(0,0);this.I=0};Box2D.inherit(j,Box2D.Collision.Shapes.b2Shape);j.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;j.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)};j.prototype.Copy= function(){var b=new j;b.Set(this);return b};j.prototype.Set=function(b){this.__super.Set.call(this,b);if(Box2D.is(b,j)){b=b instanceof j?b:null;this.m_centroid.SetV(b.m_centroid);this.m_vertexCount=b.m_vertexCount;this.Reserve(this.m_vertexCount);for(var c=0;cNumber.MIN_VALUE);this.m_normals[e].SetV(g.CrossVF(f, 1));this.m_normals[e].Normalize()}this.m_centroid=j.ComputeCentroid(this.m_vertices,this.m_vertexCount)};j.AsVector=function(b,c){void 0===c&&(c=0);var d=new j;d.SetAsVector(b,c);return d};j.prototype.SetAsBox=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-b,-c);this.m_vertices[1].Set(b,-c);this.m_vertices[2].Set(b,c);this.m_vertices[3].Set(-b,c);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1, 0);this.m_centroid.SetZero()};j.AsBox=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);var d=new j;d.SetAsBox(b,c);return d};j.prototype.SetAsOrientedBox=function(b,c,d,e){void 0===b&&(b=0);void 0===c&&(c=0);void 0===d&&(d=null);void 0===e&&(e=0);this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-b,-c);this.m_vertices[1].Set(b,-c);this.m_vertices[2].Set(b,c);this.m_vertices[3].Set(-b,c);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1, 0);this.m_centroid=d;b=new r;b.position=d;b.R.Set(e);for(d=0;dg)return!1}else 0>j&&gr?j:r,m=m>e?m:e;b.lowerBound.x=f-this.m_radius; b.lowerBound.y=g-this.m_radius;b.upperBound.x=j+this.m_radius;b.upperBound.y=m+this.m_radius};j.prototype.ComputeMass=function(b,c){void 0===c&&(c=0);if(2==this.m_vertexCount)b.center.x=0.5*(this.m_vertices[0].x+this.m_vertices[1].x),b.center.y=0.5*(this.m_vertices[0].y+this.m_vertices[1].y),b.mass=0,b.I=0;else{for(var d=0,e=0,f=0,g=0,j=1/3,m=0;md&&(c=e,d=f)}return c};j.prototype.GetSupportVertex=function(b){for(var c=0,d=this.m_vertices[0].x*b.x+this.m_vertices[0].y*b.y,e=1;ed&&(c=e,d=f)}return this.m_vertices[c]};j.prototype.Validate=function(){return!1};j.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this);this.m_type=n.e_polygonShape;this.m_centroid= new y;this.m_vertices=new Vector;this.m_normals=new Vector};j.prototype.Reserve=function(b){void 0===b&&(b=0);for(var c=parseInt(this.m_vertices.length);cs&&(s=Z);C>u&&(u=C)}G=(s-n)*(u-A);G<0.95*c&&(c=G,b.R.col1.x=j,b.R.col1.y=m,b.R.col2.x=r,b.R.col2.y=z,j=0.5*(n+s),m=0.5*(A+u),r=b.R,b.center.x=g.x+(r.col1.x* j+r.col2.x*m),b.center.y=g.y+(r.col1.y*j+r.col2.y*m),b.extents.x=0.5*(s-n),b.extents.y=0.5*(u-A))}};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new m});n.b2Shape=function(){};n.prototype.Copy=function(){return null};n.prototype.Set=function(b){this.m_radius=b.m_radius};n.prototype.GetType=function(){return this.m_type};n.prototype.TestPoint=function(){return!1};n.prototype.RayCast=function(){return!1};n.prototype.ComputeAABB=function(){};n.prototype.ComputeMass=function(){}; n.prototype.ComputeSubmergedArea=function(){return 0};n.TestOverlap=function(b,c,d,e){var f=new A;f.proxyA=new E;f.proxyA.Set(b);f.proxyB=new E;f.proxyB.Set(d);f.transformA=c;f.transformB=e;f.useRadii=!0;b=new D;b.count=0;c=new B;z.Distance(c,b,f);return c.distance<10*Number.MIN_VALUE};n.prototype.b2Shape=function(){this.m_type=n.e_unknownShape;this.m_radius=b.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2Shape.e_unknownShape=-1;Box2D.Collision.Shapes.b2Shape.e_circleShape= 0;Box2D.Collision.Shapes.b2Shape.e_polygonShape=1;Box2D.Collision.Shapes.b2Shape.e_edgeShape=2;Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount=3;Box2D.Collision.Shapes.b2Shape.e_hitCollide=1;Box2D.Collision.Shapes.b2Shape.e_missCollide=0;Box2D.Collision.Shapes.b2Shape.e_startsInsideCollide=-1})})(); (function(){var b=Box2D.Common.b2Color,c=Box2D.Common.b2Settings,d=Box2D.Common.Math.b2Math;b.b2Color=function(){this._b=this._g=this._r=0};b.prototype.b2Color=function(b,c,j){void 0===b&&(b=0);void 0===c&&(c=0);void 0===j&&(j=0);this._r=Box2D.parseUInt(255*d.Clamp(b,0,1));this._g=Box2D.parseUInt(255*d.Clamp(c,0,1));this._b=Box2D.parseUInt(255*d.Clamp(j,0,1))};b.prototype.Set=function(b,c,j){void 0===b&&(b=0);void 0===c&&(c=0);void 0===j&&(j=0);this._r=Box2D.parseUInt(255*d.Clamp(b,0,1));this._g= Box2D.parseUInt(255*d.Clamp(c,0,1));this._b=Box2D.parseUInt(255*d.Clamp(j,0,1))};Object.defineProperty(b.prototype,"r",{enumerable:!1,configurable:!0,set:function(b){void 0===b&&(b=0);this._r=Box2D.parseUInt(255*d.Clamp(b,0,1))}});Object.defineProperty(b.prototype,"g",{enumerable:!1,configurable:!0,set:function(b){void 0===b&&(b=0);this._g=Box2D.parseUInt(255*d.Clamp(b,0,1))}});Object.defineProperty(b.prototype,"b",{enumerable:!1,configurable:!0,set:function(b){void 0===b&&(b=0);this._b=Box2D.parseUInt(255* d.Clamp(b,0,1))}});Object.defineProperty(b.prototype,"color",{enumerable:!1,configurable:!0,get:function(){return this._r<<16|this._g<<8|this._b}});c.b2Settings=function(){};c.b2MixFriction=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);return Math.sqrt(b*c)};c.b2MixRestitution=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);return b>c?b:c};c.b2Assert=function(b){if(!b)throw"Assertion Failed";};Box2D.postDefs.push(function(){Box2D.Common.b2Settings.VERSION="2.1alpha";Box2D.Common.b2Settings.USHRT_MAX= 65535;Box2D.Common.b2Settings.b2_pi=Math.PI;Box2D.Common.b2Settings.b2_maxManifoldPoints=2;Box2D.Common.b2Settings.b2_aabbExtension=0.1;Box2D.Common.b2Settings.b2_aabbMultiplier=2;Box2D.Common.b2Settings.b2_polygonRadius=2*c.b2_linearSlop;Box2D.Common.b2Settings.b2_linearSlop=0.005;Box2D.Common.b2Settings.b2_angularSlop=2/180*c.b2_pi;Box2D.Common.b2Settings.b2_toiSlop=8*c.b2_linearSlop;Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland=32;Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland=32;Box2D.Common.b2Settings.b2_velocityThreshold= 1;Box2D.Common.b2Settings.b2_maxLinearCorrection=0.2;Box2D.Common.b2Settings.b2_maxAngularCorrection=8/180*c.b2_pi;Box2D.Common.b2Settings.b2_maxTranslation=2;Box2D.Common.b2Settings.b2_maxTranslationSquared=c.b2_maxTranslation*c.b2_maxTranslation;Box2D.Common.b2Settings.b2_maxRotation=0.5*c.b2_pi;Box2D.Common.b2Settings.b2_maxRotationSquared=c.b2_maxRotation*c.b2_maxRotation;Box2D.Common.b2Settings.b2_contactBaumgarte=0.2;Box2D.Common.b2Settings.b2_timeToSleep=0.5;Box2D.Common.b2Settings.b2_linearSleepTolerance= 0.01;Box2D.Common.b2Settings.b2_angularSleepTolerance=2/180*c.b2_pi})})(); (function(){var b=Box2D.Common.Math.b2Mat22,c=Box2D.Common.Math.b2Mat33,d=Box2D.Common.Math.b2Math,e=Box2D.Common.Math.b2Sweep,f=Box2D.Common.Math.b2Transform,j=Box2D.Common.Math.b2Vec2,n=Box2D.Common.Math.b2Vec3;b.b2Mat22=function(){this.col1=new j;this.col2=new j};b.prototype.b2Mat22=function(){this.SetIdentity()};b.FromAngle=function(c){void 0===c&&(c=0);var d=new b;d.Set(c);return d};b.FromVV=function(c,d){var e=new b;e.SetVV(c,d);return e};b.prototype.Set=function(b){void 0===b&&(b=0);var c= Math.cos(b);b=Math.sin(b);this.col1.x=c;this.col2.x=-b;this.col1.y=b;this.col2.y=c};b.prototype.SetVV=function(b,c){this.col1.SetV(b);this.col2.SetV(c)};b.prototype.Copy=function(){var c=new b;c.SetM(this);return c};b.prototype.SetM=function(b){this.col1.SetV(b.col1);this.col2.SetV(b.col2)};b.prototype.AddM=function(b){this.col1.x+=b.col1.x;this.col1.y+=b.col1.y;this.col2.x+=b.col2.x;this.col2.y+=b.col2.y};b.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=1}; b.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0};b.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)};b.prototype.GetInverse=function(b){var c=this.col1.x,d=this.col2.x,e=this.col1.y,f=this.col2.y,j=c*f-d*e;0!=j&&(j=1/j);b.col1.x=j*f;b.col2.x=-j*d;b.col1.y=-j*e;b.col2.y=j*c;return b};b.prototype.Solve=function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);var e=this.col1.x,f=this.col2.x,j=this.col1.y,n=this.col2.y,E=e*n-f*j;0!=E&&(E=1/E); b.x=E*(n*c-f*d);b.y=E*(e*d-j*c);return b};b.prototype.Abs=function(){this.col1.Abs();this.col2.Abs()};c.b2Mat33=function(){this.col1=new n;this.col2=new n;this.col3=new n};c.prototype.b2Mat33=function(b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=null);!b&&!c&&!d?(this.col1.SetZero(),this.col2.SetZero(),this.col3.SetZero()):(this.col1.SetV(b),this.col2.SetV(c),this.col3.SetV(d))};c.prototype.SetVVV=function(b,c,d){this.col1.SetV(b);this.col2.SetV(c);this.col3.SetV(d)};c.prototype.Copy= function(){return new c(this.col1,this.col2,this.col3)};c.prototype.SetM=function(b){this.col1.SetV(b.col1);this.col2.SetV(b.col2);this.col3.SetV(b.col3)};c.prototype.AddM=function(b){this.col1.x+=b.col1.x;this.col1.y+=b.col1.y;this.col1.z+=b.col1.z;this.col2.x+=b.col2.x;this.col2.y+=b.col2.y;this.col2.z+=b.col2.z;this.col3.x+=b.col3.x;this.col3.y+=b.col3.y;this.col3.z+=b.col3.z};c.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=1;this.col3.y=0; this.col1.z=0;this.col2.z=0;this.col3.z=1};c.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=0;this.col3.y=0;this.col1.z=0;this.col2.z=0;this.col3.z=0};c.prototype.Solve22=function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);var e=this.col1.x,f=this.col2.x,j=this.col1.y,n=this.col2.y,E=e*n-f*j;0!=E&&(E=1/E);b.x=E*(n*c-f*d);b.y=E*(e*d-j*c);return b};c.prototype.Solve33=function(b,c,d,e){void 0===c&&(c=0);void 0===d&&(d=0);void 0===e&&(e=0);var f=this.col1.x, j=this.col1.y,n=this.col1.z,E=this.col2.x,D=this.col2.y,t=this.col2.z,F=this.col3.x,K=this.col3.y,L=this.col3.z,N=f*(D*L-t*K)+j*(t*F-E*L)+n*(E*K-D*F);0!=N&&(N=1/N);b.x=N*(c*(D*L-t*K)+d*(t*F-E*L)+e*(E*K-D*F));b.y=N*(f*(d*L-e*K)+j*(e*F-c*L)+n*(c*K-d*F));b.z=N*(f*(D*e-t*d)+j*(t*c-E*e)+n*(E*d-D*c));return b};d.b2Math=function(){};d.IsValid=function(b){void 0===b&&(b=0);return isFinite(b)};d.Dot=function(b,c){return b.x*c.x+b.y*c.y};d.CrossVV=function(b,c){return b.x*c.y-b.y*c.x};d.CrossVF=function(b, c){void 0===c&&(c=0);return new j(c*b.y,-c*b.x)};d.CrossFV=function(b,c){void 0===b&&(b=0);return new j(-b*c.y,b*c.x)};d.MulMV=function(b,c){return new j(b.col1.x*c.x+b.col2.x*c.y,b.col1.y*c.x+b.col2.y*c.y)};d.MulTMV=function(b,c){return new j(d.Dot(c,b.col1),d.Dot(c,b.col2))};d.MulX=function(b,c){var e=d.MulMV(b.R,c);e.x+=b.position.x;e.y+=b.position.y;return e};d.MulXT=function(b,c){var e=d.SubtractVV(c,b.position),f=e.x*b.R.col1.x+e.y*b.R.col1.y;e.y=e.x*b.R.col2.x+e.y*b.R.col2.y;e.x=f;return e}; d.AddVV=function(b,c){return new j(b.x+c.x,b.y+c.y)};d.SubtractVV=function(b,c){return new j(b.x-c.x,b.y-c.y)};d.Distance=function(b,c){var d=b.x-c.x,e=b.y-c.y;return Math.sqrt(d*d+e*e)};d.DistanceSquared=function(b,c){var d=b.x-c.x,e=b.y-c.y;return d*d+e*e};d.MulFV=function(b,c){void 0===b&&(b=0);return new j(b*c.x,b*c.y)};d.AddMM=function(c,e){return b.FromVV(d.AddVV(c.col1,e.col1),d.AddVV(c.col2,e.col2))};d.MulMM=function(c,e){return b.FromVV(d.MulMV(c,e.col1),d.MulMV(c,e.col2))};d.MulTMM=function(c, e){var f=new j(d.Dot(c.col1,e.col1),d.Dot(c.col2,e.col1)),n=new j(d.Dot(c.col1,e.col2),d.Dot(c.col2,e.col2));return b.FromVV(f,n)};d.Abs=function(b){void 0===b&&(b=0);return 0c?b:c};d.MaxV=function(b,c){return new j(d.Max(b.x,c.x),d.Max(b.y,c.y))};d.Clamp=function(b,c,d){void 0===b&&(b=0);void 0===c&&(c=0);void 0===d&&(d=0);return bd?d:b};d.ClampV=function(b,c,e){return d.MaxV(c,d.MinV(b,e))};d.Swap=function(b,c){var d=b[0];b[0]=c[0];c[0]=d};d.Random=function(){return 2*Math.random()-1};d.RandomRange=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);var d=Math.random();return(c-b)*d+b};d.NextPowerOfTwo=function(b){void 0===b&&(b=0);b|=b>>1&2147483647;b|= b>>2&1073741823;b|=b>>4&268435455;b|=b>>8&16777215;return(b|b>>16&65535)+1};d.IsPowerOfTwo=function(b){void 0===b&&(b=0);return 0Number.MIN_VALUE){var c=(b-this.t0)/(1-this.t0);this.c0.x=(1-c)*this.c0.x+c*this.c.x;this.c0.y=(1-c)*this.c0.y+c*this.c.y;this.a0=(1-c)*this.a0+c*this.a;this.t0=b}};f.b2Transform=function(){this.position=new j;this.R=new b};f.prototype.b2Transform=function(b,c){void 0===b&&(b=null);void 0===c&&(c=null);b&&(this.position.SetV(b),this.R.SetM(c))};f.prototype.Initialize=function(b, c){this.position.SetV(b);this.R.SetM(c)};f.prototype.SetIdentity=function(){this.position.SetZero();this.R.SetIdentity()};f.prototype.Set=function(b){this.position.SetV(b.position);this.R.SetM(b.R)};f.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};j.b2Vec2=function(){};j.prototype.b2Vec2=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);this.x=b;this.y=c};j.prototype.SetZero=function(){this.y=this.x=0};j.prototype.Set=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0); this.x=b;this.y=c};j.prototype.SetV=function(b){this.x=b.x;this.y=b.y};j.prototype.GetNegative=function(){return new j(-this.x,-this.y)};j.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y};j.Make=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);return new j(b,c)};j.prototype.Copy=function(){return new j(this.x,this.y)};j.prototype.Add=function(b){this.x+=b.x;this.y+=b.y};j.prototype.Subtract=function(b){this.x-=b.x;this.y-=b.y};j.prototype.Multiply=function(b){void 0===b&&(b=0);this.x*= b;this.y*=b};j.prototype.MulM=function(b){var c=this.x;this.x=b.col1.x*c+b.col2.x*this.y;this.y=b.col1.y*c+b.col2.y*this.y};j.prototype.MulTM=function(b){var c=d.Dot(this,b.col1);this.y=d.Dot(this,b.col2);this.x=c};j.prototype.CrossVF=function(b){void 0===b&&(b=0);var c=this.x;this.x=b*this.y;this.y=-b*c};j.prototype.CrossFV=function(b){void 0===b&&(b=0);var c=this.x;this.x=-b*this.y;this.y=b*c};j.prototype.MinV=function(b){this.x=this.xb.x?this.x:b.x;this.y=this.y>b.y?this.y:b.y};j.prototype.Abs=function(){0>this.x&&(this.x=-this.x);0>this.y&&(this.y=-this.y)};j.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};j.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y};j.prototype.Normalize=function(){var b=Math.sqrt(this.x*this.x+this.y*this.y);if(b=this.m_mass&&(this.m_mass=1);this.m_invMass=1/this.m_mass;0j.b2_maxTranslationSquared&&(g.m_linearVelocity.Normalize(),g.m_linearVelocity.x*=j.b2_maxTranslation*c.inv_dt,g.m_linearVelocity.y*= j.b2_maxTranslation*c.inv_dt);u=c.dt*g.m_angularVelocity;u*u>j.b2_maxRotationSquared&&(g.m_angularVelocity=0>g.m_angularVelocity?-j.b2_maxRotation*c.inv_dt:j.b2_maxRotation*c.inv_dt);g.m_sweep.c0.SetV(g.m_sweep.c);g.m_sweep.a0=g.m_sweep.a;g.m_sweep.c.x+=c.dt*g.m_linearVelocity.x;g.m_sweep.c.y+=c.dt*g.m_linearVelocity.y;g.m_sweep.a+=c.dt*g.m_angularVelocity;g.SynchronizeTransform()}for(f=0;fu||b.Dot(g.m_linearVelocity,g.m_linearVelocity)> d?e=g.m_sleepTime=0:(g.m_sleepTime+=c.dt,e=b.Min(e,g.m_sleepTime)));if(e>=j.b2_timeToSleep)for(f=0;fj.b2_maxTranslationSquared&&(d.m_linearVelocity.Normalize(),d.m_linearVelocity.x*=j.b2_maxTranslation*b.inv_dt,d.m_linearVelocity.y*=j.b2_maxTranslation*b.inv_dt);f=b.dt*d.m_angularVelocity;f*f>j.b2_maxRotationSquared&&(d.m_angularVelocity=0>d.m_angularVelocity?-j.b2_maxRotation*b.inv_dt:j.b2_maxRotation*b.inv_dt);d.m_sweep.c0.SetV(d.m_sweep.c);d.m_sweep.a0= d.m_sweep.a;d.m_sweep.c.x+=b.dt*d.m_linearVelocity.x;d.m_sweep.c.y+=b.dt*d.m_linearVelocity.y;d.m_sweep.a+=b.dt*d.m_angularVelocity;d.SynchronizeTransform()}for(c=0;c=c);0c&&(c=(1-c)*m+c,1-1.5*Q.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new G;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new K});Box2D.inherit(B,Box2D.Dynamics.Contacts.b2Contact);B.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;B.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};B.Create=function(){return new B};B.Destroy=function(){};B.prototype.Reset= function(b,c){this.__super.Reset.call(this,b,c)};B.prototype.Evaluate=function(){var d=this.m_fixtureA.GetBody(),e=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof c?this.m_fixtureA.GetShape():null,d.m_xf,this.m_fixtureB.GetShape()instanceof b?this.m_fixtureB.GetShape():null,e.m_xf)};B.prototype.b2CollideEdgeAndCircle=function(){};Box2D.inherit(E,Box2D.Dynamics.Contacts.b2Contact);E.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype; E.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};E.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)};E.prototype.Evaluate=function(){};Box2D.inherit(D,Box2D.Dynamics.Contacts.b2Contact);D.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;D.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};D.Create=function(){return new D};D.Destroy=function(){};D.prototype.Reset=function(b, c){this.__super.Reset.call(this,b,c);Q.b2Assert(b.GetType()==e.e_polygonShape);Q.b2Assert(c.GetType()==e.e_circleShape)};D.prototype.Evaluate=function(){var c=this.m_fixtureA.m_body,e=this.m_fixtureB.m_body;P.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof d?this.m_fixtureA.GetShape():null,c.m_xf,this.m_fixtureB.GetShape()instanceof b?this.m_fixtureB.GetShape():null,e.m_xf)};Box2D.inherit(t,Box2D.Dynamics.Contacts.b2Contact);t.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype; t.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};t.Create=function(){return new t};t.Destroy=function(){};t.prototype.Reset=function(b,c){this.__super.Reset.call(this,b,c);Q.b2Assert(b.GetType()==e.e_polygonShape);Q.b2Assert(c.GetType()==e.e_edgeShape)};t.prototype.Evaluate=function(){var b=this.m_fixtureA.GetBody(),e=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape()instanceof d?this.m_fixtureA.GetShape(): null,b.m_xf,this.m_fixtureB.GetShape()instanceof c?this.m_fixtureB.GetShape():null,e.m_xf)};t.prototype.b2CollidePolyAndEdge=function(){};Box2D.inherit(F,Box2D.Dynamics.Contacts.b2Contact);F.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;F.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};F.Create=function(){return new F};F.Destroy=function(){};F.prototype.Reset=function(b,c){this.__super.Reset.call(this,b,c)};F.prototype.Evaluate=function(){var b= this.m_fixtureA.GetBody(),c=this.m_fixtureB.GetBody();P.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape()instanceof d?this.m_fixtureA.GetShape():null,b.m_xf,this.m_fixtureB.GetShape()instanceof d?this.m_fixtureB.GetShape():null,c.m_xf)};K.b2PositionSolverManifold=function(){};K.prototype.b2PositionSolverManifold=function(){this.m_normal=new O;this.m_separations=new Vector_a2j_Number(Q.b2_maxManifoldPoints);this.m_points=new Vector(Q.b2_maxManifoldPoints);for(var b=0;bNumber.MIN_VALUE*Number.MIN_VALUE?(s=Math.sqrt(s),this.m_normal.x= e/s,this.m_normal.y=j/s):(this.m_normal.x=1,this.m_normal.y=0);this.m_points[0].x=0.5*(c+g);this.m_points[0].y=0.5*(d+f);this.m_separations[0]=e*this.m_normal.x+j*this.m_normal.y-b.radius;break;case U.e_faceA:f=b.bodyA.m_xf.R;e=b.localPlaneNormal;this.m_normal.x=f.col1.x*e.x+f.col2.x*e.y;this.m_normal.y=f.col1.y*e.x+f.col2.y*e.y;f=b.bodyA.m_xf.R;e=b.localPoint;g=b.bodyA.m_xf.position.x+(f.col1.x*e.x+f.col2.x*e.y);j=b.bodyA.m_xf.position.y+(f.col1.y*e.x+f.col2.y*e.y);f=b.bodyB.m_xf.R;for(c=0;cthis.maxTimestep&&0b.b2_linearSlop?this.m_u.Multiply(1/e):this.m_u.SetZero();d=j*this.m_u.y-m*this.m_u.x;var n=l*this.m_u.y-p*this.m_u.x;d=f.m_invMass+f.m_invI* d*d+g.m_invMass+g.m_invI*n*n;this.m_mass=0!=d?1/d:0;if(0c*c&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.Multiply(c));c=e.SubtractVV(this.m_linearImpulse,d);m.x-=r*c.x;m.y-=r*c.y;n-=t*(y*c.y-B*c.x);l.x+=x*c.x;l.y+=x*c.y;p+=z*(A*c.y-D*c.x);g.m_angularVelocity=n;j.m_angularVelocity=p};g.prototype.SolvePositionConstraints=function(){return!0};Box2D.inherit(r,Box2D.Dynamics.Joints.b2JointDef);r.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;r.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);this.localAnchorA=new f;this.localAnchorB=new f};r.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=B.e_frictionJoint;this.maxTorque=this.maxForce=0};r.prototype.Initialize=function(b,c,d){this.bodyA=b;this.bodyB=c;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(d));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(d))};Box2D.inherit(y,Box2D.Dynamics.Joints.b2Joint);y.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;y.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);this.m_groundAnchor1=new f;this.m_groundAnchor2=new f;this.m_localAnchor1=new f;this.m_localAnchor2=new f;this.m_J=new A};y.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};y.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};y.prototype.GetReactionForce=function(b){void 0===b&&(b=0);return new f(b*this.m_impulse*this.m_J.linearB.x,b*this.m_impulse*this.m_J.linearB.y)};y.prototype.GetReactionTorque=function(b){void 0=== b&&(b=0);var c=this.m_bodyB.m_xf.R,d=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,e=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,f=c.col1.x*d+c.col2.x*e,e=c.col1.y*d+c.col2.y*e;return b*(this.m_impulse*this.m_J.angularB-f*this.m_impulse*this.m_J.linearB.y+e*this.m_impulse*this.m_J.linearB.x)};y.prototype.GetRatio=function(){return this.m_ratio};y.prototype.SetRatio=function(b){void 0===b&&(b=0);this.m_ratio=b};y.prototype.b2GearJoint=function(b){this.__super.b2Joint.call(this, b);var c=parseInt(b.joint1.m_type),d=parseInt(b.joint2.m_type);this.m_prismatic2=this.m_revolute2=this.m_prismatic1=this.m_revolute1=null;var e=0,f=0;this.m_ground1=b.joint1.GetBodyA();this.m_bodyA=b.joint1.GetBodyB();c==B.e_revoluteJoint?(this.m_revolute1=b.joint1 instanceof O?b.joint1:null,this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1),this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2),e=this.m_revolute1.GetJointAngle()):(this.m_prismatic1=b.joint1 instanceof N?b.joint1:null, this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1),this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2),e=this.m_prismatic1.GetJointTranslation());this.m_ground2=b.joint2.GetBodyA();this.m_bodyB=b.joint2.GetBodyB();d==B.e_revoluteJoint?(this.m_revolute2=b.joint2 instanceof O?b.joint2:null,this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1),this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2),f=this.m_revolute2.GetJointAngle()):(this.m_prismatic2=b.joint2 instanceof N?b.joint2: null,this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1),this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2),f=this.m_prismatic2.GetJointTranslation());this.m_ratio=b.ratio;this.m_constant=e+this.m_ratio*f;this.m_impulse=0};y.prototype.InitVelocityConstraints=function(b){var c=this.m_ground1,d=this.m_ground2,e=this.m_bodyA,f=this.m_bodyB,g=0,j=0,l=0,m=0,n=0,x=0;this.m_J.SetZero();this.m_revolute1?(this.m_J.angularA=-1,x+=e.m_invI):(c=c.m_xf.R,j=this.m_prismatic1.m_localXAxis1,g=c.col1.x* j.x+c.col2.x*j.y,j=c.col1.y*j.x+c.col2.y*j.y,c=e.m_xf.R,l=this.m_localAnchor1.x-e.m_sweep.localCenter.x,m=this.m_localAnchor1.y-e.m_sweep.localCenter.y,n=c.col1.x*l+c.col2.x*m,m=c.col1.y*l+c.col2.y*m,l=n*j-m*g,this.m_J.linearA.Set(-g,-j),this.m_J.angularA=-l,x+=e.m_invMass+e.m_invI*l*l);this.m_revolute2?(this.m_J.angularB=-this.m_ratio,x+=this.m_ratio*this.m_ratio*f.m_invI):(c=d.m_xf.R,j=this.m_prismatic2.m_localXAxis1,g=c.col1.x*j.x+c.col2.x*j.y,j=c.col1.y*j.x+c.col2.y*j.y,c=f.m_xf.R,l=this.m_localAnchor2.x- f.m_sweep.localCenter.x,m=this.m_localAnchor2.y-f.m_sweep.localCenter.y,n=c.col1.x*l+c.col2.x*m,m=c.col1.y*l+c.col2.y*m,l=n*j-m*g,this.m_J.linearB.Set(-this.m_ratio*g,-this.m_ratio*j),this.m_J.angularB=-this.m_ratio*l,x+=this.m_ratio*this.m_ratio*(f.m_invMass+f.m_invI*l*l));this.m_mass=0Number.MIN_VALUE?1/this.m_motorMass:0;this.m_perp.SetV(e.MulMV(m.R,this.m_localYAxis1));this.m_s1=(g+n)*this.m_perp.y-(j+l)*this.m_perp.x;this.m_s2=p*this.m_perp.y-r*this.m_perp.x;m=this.m_invMassA;n=this.m_invMassB;l=this.m_invIA;p=this.m_invIB;this.m_K.col1.x=m+n+l*this.m_s1* this.m_s1+p*this.m_s2*this.m_s2;this.m_K.col1.y=l*this.m_s1*this.m_a1+p*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=m+n+l*this.m_a1*this.m_a1+p*this.m_a2*this.m_a2;this.m_enableLimit?(g=this.m_axis.x*g+this.m_axis.y*j,e.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b.b2_linearSlop?this.m_limitState=B.e_equalLimits:g<=this.m_lowerTranslation?this.m_limitState!=B.e_atLowerLimit&&(this.m_limitState=B.e_atLowerLimit,this.m_impulse.y=0):g>=this.m_upperTranslation?this.m_limitState!= B.e_atUpperLimit&&(this.m_limitState=B.e_atUpperLimit,this.m_impulse.y=0):(this.m_limitState=B.e_inactiveLimit,this.m_impulse.y=0)):this.m_limitState=B.e_inactiveLimit;!1==this.m_enableMotor&&(this.m_motorImpulse=0);c.warmStarting?(this.m_impulse.x*=c.dtRatio,this.m_impulse.y*=c.dtRatio,this.m_motorImpulse*=c.dtRatio,c=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x,g=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y,j=this.m_impulse.x* this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1,m=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2,d.m_linearVelocity.x-=this.m_invMassA*c,d.m_linearVelocity.y-=this.m_invMassA*g,d.m_angularVelocity-=this.m_invIA*j,f.m_linearVelocity.x+=this.m_invMassB*c,f.m_linearVelocity.y+=this.m_invMassB*g,f.m_angularVelocity+=this.m_invIB*m):(this.m_impulse.SetZero(),this.m_motorImpulse=0)};t.prototype.SolveVelocityConstraints=function(b){var c=this.m_bodyA,d=this.m_bodyB, g=c.m_linearVelocity,j=c.m_angularVelocity,m=d.m_linearVelocity,n=d.m_angularVelocity,l=0,p=0,r=0,x=0;this.m_enableMotor&&this.m_limitState!=B.e_equalLimits&&(x=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(m.x-g.x)+this.m_axis.y*(m.y-g.y)+this.m_a2*n-this.m_a1*j)),l=this.m_motorImpulse,p=b.dt*this.m_maxMotorForce,this.m_motorImpulse=e.Clamp(this.m_motorImpulse+x,-p,p),x=this.m_motorImpulse-l,l=x*this.m_axis.x,p=x*this.m_axis.y,r=x*this.m_a1,x*=this.m_a2,g.x-=this.m_invMassA*l,g.y-=this.m_invMassA* p,j-=this.m_invIA*r,m.x+=this.m_invMassB*l,m.y+=this.m_invMassB*p,n+=this.m_invIB*x);p=this.m_perp.x*(m.x-g.x)+this.m_perp.y*(m.y-g.y)+this.m_s2*n-this.m_s1*j;this.m_enableLimit&&this.m_limitState!=B.e_inactiveLimit?(r=this.m_axis.x*(m.x-g.x)+this.m_axis.y*(m.y-g.y)+this.m_a2*n-this.m_a1*j,l=this.m_impulse.Copy(),b=this.m_K.Solve(new f,-p,-r),this.m_impulse.Add(b),this.m_limitState==B.e_atLowerLimit?this.m_impulse.y=e.Max(this.m_impulse.y,0):this.m_limitState==B.e_atUpperLimit&&(this.m_impulse.y= e.Min(this.m_impulse.y,0)),p=-p-(this.m_impulse.y-l.y)*this.m_K.col2.x,r=0!=this.m_K.col1.x?p/this.m_K.col1.x+l.x:l.x,this.m_impulse.x=r,b.x=this.m_impulse.x-l.x,b.y=this.m_impulse.y-l.y,l=b.x*this.m_perp.x+b.y*this.m_axis.x,p=b.x*this.m_perp.y+b.y*this.m_axis.y,r=b.x*this.m_s1+b.y*this.m_a1,x=b.x*this.m_s2+b.y*this.m_a2):(b=0!=this.m_K.col1.x?-p/this.m_K.col1.x:0,this.m_impulse.x+=b,l=b*this.m_perp.x,p=b*this.m_perp.y,r=b*this.m_s1,x=b*this.m_s2);g.x-=this.m_invMassA*l;g.y-=this.m_invMassA*p;j-= this.m_invIA*r;m.x+=this.m_invMassB*l;m.y+=this.m_invMassB*p;n+=this.m_invIB*x;c.m_linearVelocity.SetV(g);c.m_angularVelocity=j;d.m_linearVelocity.SetV(m);d.m_angularVelocity=n};t.prototype.SolvePositionConstraints=function(){var d=this.m_bodyA,g=this.m_bodyB,j=d.m_sweep.c,m=d.m_sweep.a,n=g.m_sweep.c,r=g.m_sweep.a,t,l=0,p=0,y=0,x=0,z=0,B=0,p=!1,A=0,D=c.FromAngle(m),y=c.FromAngle(r);t=D;var B=this.m_localAnchor1.x-this.m_localCenterA.x,E=this.m_localAnchor1.y-this.m_localCenterA.y,l=t.col1.x*B+t.col2.x* E,E=t.col1.y*B+t.col2.y*E,B=l;t=y;y=this.m_localAnchor2.x-this.m_localCenterB.x;x=this.m_localAnchor2.y-this.m_localCenterB.y;l=t.col1.x*y+t.col2.x*x;x=t.col1.y*y+t.col2.y*x;y=l;t=n.x+y-j.x-B;l=n.y+x-j.y-E;if(this.m_enableLimit){this.m_axis=e.MulMV(D,this.m_localXAxis1);this.m_a1=(t+B)*this.m_axis.y-(l+E)*this.m_axis.x;this.m_a2=y*this.m_axis.y-x*this.m_axis.x;var F=this.m_axis.x*t+this.m_axis.y*l;e.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b.b2_linearSlop?(A=e.Clamp(F,-b.b2_maxLinearCorrection, b.b2_maxLinearCorrection),z=e.Abs(F),p=!0):F<=this.m_lowerTranslation?(A=e.Clamp(F-this.m_lowerTranslation+b.b2_linearSlop,-b.b2_maxLinearCorrection,0),z=this.m_lowerTranslation-F,p=!0):F>=this.m_upperTranslation&&(A=e.Clamp(F-this.m_upperTranslation+b.b2_linearSlop,0,b.b2_maxLinearCorrection),z=F-this.m_upperTranslation,p=!0)}this.m_perp=e.MulMV(D,this.m_localYAxis1);this.m_s1=(t+B)*this.m_perp.y-(l+E)*this.m_perp.x;this.m_s2=y*this.m_perp.y-x*this.m_perp.x;D=new f;E=this.m_perp.x*t+this.m_perp.y* l;z=e.Max(z,e.Abs(E));B=0;p?(p=this.m_invMassA,y=this.m_invMassB,x=this.m_invIA,t=this.m_invIB,this.m_K.col1.x=p+y+x*this.m_s1*this.m_s1+t*this.m_s2*this.m_s2,this.m_K.col1.y=x*this.m_s1*this.m_a1+t*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=p+y+x*this.m_a1*this.m_a1+t*this.m_a2*this.m_a2,this.m_K.Solve(D,-E,-A)):(p=this.m_invMassA,y=this.m_invMassB,x=this.m_invIA,t=this.m_invIB,A=p+y+x*this.m_s1*this.m_s1+t*this.m_s2*this.m_s2,D.x=0!=A?-E/A:0,D.y=0);A=D.x*this.m_perp.x+D.y* this.m_axis.x;p=D.x*this.m_perp.y+D.y*this.m_axis.y;E=D.x*this.m_s1+D.y*this.m_a1;D=D.x*this.m_s2+D.y*this.m_a2;j.x-=this.m_invMassA*A;j.y-=this.m_invMassA*p;m-=this.m_invIA*E;n.x+=this.m_invMassB*A;n.y+=this.m_invMassB*p;r+=this.m_invIB*D;d.m_sweep.a=m;g.m_sweep.a=r;d.SynchronizeTransform();g.SynchronizeTransform();return z<=b.b2_linearSlop&&B<=b.b2_angularSlop};Box2D.inherit(F,Box2D.Dynamics.Joints.b2JointDef);F.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;F.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);this.localAnchorA=new f;this.localAnchorB=new f;this.localAxisA=new f};F.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=B.e_lineJoint;this.localAxisA.Set(1,0);this.enableLimit=!1;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=!1;this.motorSpeed=this.maxMotorForce=0};F.prototype.Initialize=function(b,c,d,e){this.bodyA=b;this.bodyB=c;this.localAnchorA=this.bodyA.GetLocalPoint(d);this.localAnchorB=this.bodyB.GetLocalPoint(d);this.localAxisA= this.bodyA.GetLocalVector(e)};Box2D.inherit(K,Box2D.Dynamics.Joints.b2Joint);K.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;K.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new c;this.K1=new c;this.K2=new c;this.m_localAnchor=new f;this.m_target=new f;this.m_impulse=new f;this.m_mass=new c;this.m_C=new f};K.prototype.GetAnchorA=function(){return this.m_target};K.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)}; K.prototype.GetReactionForce=function(b){void 0===b&&(b=0);return new f(b*this.m_impulse.x,b*this.m_impulse.y)};K.prototype.GetReactionTorque=function(){return 0};K.prototype.GetTarget=function(){return this.m_target};K.prototype.SetTarget=function(b){!1==this.m_bodyB.IsAwake()&&this.m_bodyB.SetAwake(!0);this.m_target=b};K.prototype.GetMaxForce=function(){return this.m_maxForce};K.prototype.SetMaxForce=function(b){void 0===b&&(b=0);this.m_maxForce=b};K.prototype.GetFrequency=function(){return this.m_frequencyHz}; K.prototype.SetFrequency=function(b){void 0===b&&(b=0);this.m_frequencyHz=b};K.prototype.GetDampingRatio=function(){return this.m_dampingRatio};K.prototype.SetDampingRatio=function(b){void 0===b&&(b=0);this.m_dampingRatio=b};K.prototype.b2MouseJoint=function(b){this.__super.b2Joint.call(this,b);this.m_target.SetV(b.target);var c=this.m_target.x-this.m_bodyB.m_xf.position.x,d=this.m_target.y-this.m_bodyB.m_xf.position.y,e=this.m_bodyB.m_xf.R;this.m_localAnchor.x=c*e.col1.x+d*e.col1.y;this.m_localAnchor.y= c*e.col2.x+d*e.col2.y;this.m_maxForce=b.maxForce;this.m_impulse.SetZero();this.m_frequencyHz=b.frequencyHz;this.m_dampingRatio=b.dampingRatio;this.m_gamma=this.m_beta=0};K.prototype.InitVelocityConstraints=function(b){var c=this.m_bodyB,d=c.GetMass(),e=2*Math.PI*this.m_frequencyHz,f=d*e*e;this.m_gamma=b.dt*(2*d*this.m_dampingRatio*e+b.dt*f);this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0;this.m_beta=b.dt*f*this.m_gamma;var f=c.m_xf.R,d=this.m_localAnchor.x-c.m_sweep.localCenter.x,e=this.m_localAnchor.y- c.m_sweep.localCenter.y,g=f.col1.x*d+f.col2.x*e,e=f.col1.y*d+f.col2.y*e,d=g,f=c.m_invMass,g=c.m_invI;this.K1.col1.x=f;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=f;this.K2.col1.x=g*e*e;this.K2.col2.x=-g*d*e;this.K2.col1.y=-g*d*e;this.K2.col2.y=g*d*d;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.col1.x+=this.m_gamma;this.K.col2.y+=this.m_gamma;this.K.GetInverse(this.m_mass);this.m_C.x=c.m_sweep.c.x+d-this.m_target.x;this.m_C.y=c.m_sweep.c.y+e-this.m_target.y;c.m_angularVelocity*=0.98;this.m_impulse.x*= b.dtRatio;this.m_impulse.y*=b.dtRatio;c.m_linearVelocity.x+=f*this.m_impulse.x;c.m_linearVelocity.y+=f*this.m_impulse.y;c.m_angularVelocity+=g*(d*this.m_impulse.y-e*this.m_impulse.x)};K.prototype.SolveVelocityConstraints=function(b){var c=this.m_bodyB,d,e=0,f=0;d=c.m_xf.R;var g=this.m_localAnchor.x-c.m_sweep.localCenter.x,j=this.m_localAnchor.y-c.m_sweep.localCenter.y,e=d.col1.x*g+d.col2.x*j,j=d.col1.y*g+d.col2.y*j,g=e,e=c.m_linearVelocity.x+-c.m_angularVelocity*j,l=c.m_linearVelocity.y+c.m_angularVelocity* g;d=this.m_mass;e=e+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x;f=l+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;l=-(d.col1.x*e+d.col2.x*f);f=-(d.col1.y*e+d.col2.y*f);d=this.m_impulse.x;e=this.m_impulse.y;this.m_impulse.x+=l;this.m_impulse.y+=f;b=b.dt*this.m_maxForce;this.m_impulse.LengthSquared()>b*b&&this.m_impulse.Multiply(b/this.m_impulse.Length());l=this.m_impulse.x-d;f=this.m_impulse.y-e;c.m_linearVelocity.x+=c.m_invMass*l;c.m_linearVelocity.y+=c.m_invMass*f;c.m_angularVelocity+= c.m_invI*(g*f-j*l)};K.prototype.SolvePositionConstraints=function(){return!0};Box2D.inherit(L,Box2D.Dynamics.Joints.b2JointDef);L.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;L.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.target=new f};L.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=B.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(N,Box2D.Dynamics.Joints.b2Joint); N.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;N.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new f;this.m_localAnchor2=new f;this.m_localXAxis1=new f;this.m_localYAxis1=new f;this.m_axis=new f;this.m_perp=new f;this.m_K=new d;this.m_impulse=new j};N.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};N.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)}; N.prototype.GetReactionForce=function(b){void 0===b&&(b=0);return new f(b*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),b*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};N.prototype.GetReactionTorque=function(b){void 0===b&&(b=0);return b*this.m_impulse.y};N.prototype.GetJointTranslation=function(){var b=this.m_bodyA,c=this.m_bodyB,d=b.GetWorldPoint(this.m_localAnchor1),e=c.GetWorldPoint(this.m_localAnchor2),c=e.x-d.x, d=e.y-d.y,b=b.GetWorldVector(this.m_localXAxis1);return b.x*c+b.y*d};N.prototype.GetJointSpeed=function(){var b=this.m_bodyA,c=this.m_bodyB,d;d=b.m_xf.R;var e=this.m_localAnchor1.x-b.m_sweep.localCenter.x,f=this.m_localAnchor1.y-b.m_sweep.localCenter.y,g=d.col1.x*e+d.col2.x*f,f=d.col1.y*e+d.col2.y*f,e=g;d=c.m_xf.R;var j=this.m_localAnchor2.x-c.m_sweep.localCenter.x,l=this.m_localAnchor2.y-c.m_sweep.localCenter.y,g=d.col1.x*j+d.col2.x*l,l=d.col1.y*j+d.col2.y*l,j=g;d=c.m_sweep.c.x+j-(b.m_sweep.c.x+ e);var g=c.m_sweep.c.y+l-(b.m_sweep.c.y+f),m=b.GetWorldVector(this.m_localXAxis1),n=b.m_linearVelocity,x=c.m_linearVelocity,b=b.m_angularVelocity,c=c.m_angularVelocity;return d*-b*m.y+g*b*m.x+(m.x*(x.x+-c*l-n.x- -b*f)+m.y*(x.y+c*j-n.y-b*e))};N.prototype.IsLimitEnabled=function(){return this.m_enableLimit};N.prototype.EnableLimit=function(b){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_enableLimit=b};N.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};N.prototype.GetUpperLimit= function(){return this.m_upperTranslation};N.prototype.SetLimits=function(b,c){void 0===b&&(b=0);void 0===c&&(c=0);this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_lowerTranslation=b;this.m_upperTranslation=c};N.prototype.IsMotorEnabled=function(){return this.m_enableMotor};N.prototype.EnableMotor=function(b){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_enableMotor=b};N.prototype.SetMotorSpeed=function(b){void 0===b&&(b=0);this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0); this.m_motorSpeed=b};N.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};N.prototype.SetMaxMotorForce=function(b){void 0===b&&(b=0);this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_maxMotorForce=b};N.prototype.GetMotorForce=function(){return this.m_motorImpulse};N.prototype.b2PrismaticJoint=function(b){this.__super.b2Joint.call(this,b);this.m_localAnchor1.SetV(b.localAnchorA);this.m_localAnchor2.SetV(b.localAnchorB);this.m_localXAxis1.SetV(b.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y; this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_refAngle=b.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=b.lowerTranslation;this.m_upperTranslation=b.upperTranslation;this.m_maxMotorForce=b.maxMotorForce;this.m_motorSpeed=b.motorSpeed;this.m_enableLimit=b.enableLimit;this.m_enableMotor=b.enableMotor;this.m_limitState=B.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};N.prototype.InitVelocityConstraints=function(c){var d=this.m_bodyA, f=this.m_bodyB,g,j=0;this.m_localCenterA.SetV(d.GetLocalCenter());this.m_localCenterB.SetV(f.GetLocalCenter());var m=d.GetTransform();f.GetTransform();g=d.m_xf.R;var n=this.m_localAnchor1.x-this.m_localCenterA.x,l=this.m_localAnchor1.y-this.m_localCenterA.y,j=g.col1.x*n+g.col2.x*l,l=g.col1.y*n+g.col2.y*l,n=j;g=f.m_xf.R;var p=this.m_localAnchor2.x-this.m_localCenterB.x,r=this.m_localAnchor2.y-this.m_localCenterB.y,j=g.col1.x*p+g.col2.x*r,r=g.col1.y*p+g.col2.y*r,p=j;g=f.m_sweep.c.x+p-d.m_sweep.c.x- n;j=f.m_sweep.c.y+r-d.m_sweep.c.y-l;this.m_invMassA=d.m_invMass;this.m_invMassB=f.m_invMass;this.m_invIA=d.m_invI;this.m_invIB=f.m_invI;this.m_axis.SetV(e.MulMV(m.R,this.m_localXAxis1));this.m_a1=(g+n)*this.m_axis.y-(j+l)*this.m_axis.x;this.m_a2=p*this.m_axis.y-r*this.m_axis.x;this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2;this.m_motorMass>Number.MIN_VALUE&&(this.m_motorMass=1/this.m_motorMass);this.m_perp.SetV(e.MulMV(m.R,this.m_localYAxis1)); this.m_s1=(g+n)*this.m_perp.y-(j+l)*this.m_perp.x;this.m_s2=p*this.m_perp.y-r*this.m_perp.x;m=this.m_invMassA;n=this.m_invMassB;l=this.m_invIA;p=this.m_invIB;this.m_K.col1.x=m+n+l*this.m_s1*this.m_s1+p*this.m_s2*this.m_s2;this.m_K.col1.y=l*this.m_s1+p*this.m_s2;this.m_K.col1.z=l*this.m_s1*this.m_a1+p*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=l+p;this.m_K.col2.z=l*this.m_a1+p*this.m_a2;this.m_K.col3.x=this.m_K.col1.z;this.m_K.col3.y=this.m_K.col2.z;this.m_K.col3.z=m+n+l*this.m_a1* this.m_a1+p*this.m_a2*this.m_a2;this.m_enableLimit?(g=this.m_axis.x*g+this.m_axis.y*j,e.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b.b2_linearSlop?this.m_limitState=B.e_equalLimits:g<=this.m_lowerTranslation?this.m_limitState!=B.e_atLowerLimit&&(this.m_limitState=B.e_atLowerLimit,this.m_impulse.z=0):g>=this.m_upperTranslation?this.m_limitState!=B.e_atUpperLimit&&(this.m_limitState=B.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=B.e_inactiveLimit,this.m_impulse.z=0)):this.m_limitState= B.e_inactiveLimit;!1==this.m_enableMotor&&(this.m_motorImpulse=0);c.warmStarting?(this.m_impulse.x*=c.dtRatio,this.m_impulse.y*=c.dtRatio,this.m_motorImpulse*=c.dtRatio,c=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x,g=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y,j=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,m=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+ this.m_impulse.z)*this.m_a2,d.m_linearVelocity.x-=this.m_invMassA*c,d.m_linearVelocity.y-=this.m_invMassA*g,d.m_angularVelocity-=this.m_invIA*j,f.m_linearVelocity.x+=this.m_invMassB*c,f.m_linearVelocity.y+=this.m_invMassB*g,f.m_angularVelocity+=this.m_invIB*m):(this.m_impulse.SetZero(),this.m_motorImpulse=0)};N.prototype.SolveVelocityConstraints=function(b){var c=this.m_bodyA,d=this.m_bodyB,g=c.m_linearVelocity,m=c.m_angularVelocity,n=d.m_linearVelocity,r=d.m_angularVelocity,l=0,p=0,t=0,x=0;this.m_enableMotor&& this.m_limitState!=B.e_equalLimits&&(x=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(n.x-g.x)+this.m_axis.y*(n.y-g.y)+this.m_a2*r-this.m_a1*m)),l=this.m_motorImpulse,b=b.dt*this.m_maxMotorForce,this.m_motorImpulse=e.Clamp(this.m_motorImpulse+x,-b,b),x=this.m_motorImpulse-l,l=x*this.m_axis.x,p=x*this.m_axis.y,t=x*this.m_a1,x*=this.m_a2,g.x-=this.m_invMassA*l,g.y-=this.m_invMassA*p,m-=this.m_invIA*t,n.x+=this.m_invMassB*l,n.y+=this.m_invMassB*p,r+=this.m_invIB*x);t=this.m_perp.x*(n.x-g.x)+this.m_perp.y* (n.y-g.y)+this.m_s2*r-this.m_s1*m;p=r-m;this.m_enableLimit&&this.m_limitState!=B.e_inactiveLimit?(b=this.m_axis.x*(n.x-g.x)+this.m_axis.y*(n.y-g.y)+this.m_a2*r-this.m_a1*m,l=this.m_impulse.Copy(),b=this.m_K.Solve33(new j,-t,-p,-b),this.m_impulse.Add(b),this.m_limitState==B.e_atLowerLimit?this.m_impulse.z=e.Max(this.m_impulse.z,0):this.m_limitState==B.e_atUpperLimit&&(this.m_impulse.z=e.Min(this.m_impulse.z,0)),t=-t-(this.m_impulse.z-l.z)*this.m_K.col3.x,p=-p-(this.m_impulse.z-l.z)*this.m_K.col3.y, p=this.m_K.Solve22(new f,t,p),p.x+=l.x,p.y+=l.y,this.m_impulse.x=p.x,this.m_impulse.y=p.y,b.x=this.m_impulse.x-l.x,b.y=this.m_impulse.y-l.y,b.z=this.m_impulse.z-l.z,l=b.x*this.m_perp.x+b.z*this.m_axis.x,p=b.x*this.m_perp.y+b.z*this.m_axis.y,t=b.x*this.m_s1+b.y+b.z*this.m_a1,x=b.x*this.m_s2+b.y+b.z*this.m_a2):(b=this.m_K.Solve22(new f,-t,-p),this.m_impulse.x+=b.x,this.m_impulse.y+=b.y,l=b.x*this.m_perp.x,p=b.x*this.m_perp.y,t=b.x*this.m_s1+b.y,x=b.x*this.m_s2+b.y);g.x-=this.m_invMassA*l;g.y-=this.m_invMassA* p;m-=this.m_invIA*t;n.x+=this.m_invMassB*l;n.y+=this.m_invMassB*p;r+=this.m_invIB*x;c.m_linearVelocity.SetV(g);c.m_angularVelocity=m;d.m_linearVelocity.SetV(n);d.m_angularVelocity=r};N.prototype.SolvePositionConstraints=function(){var d=this.m_bodyA,g=this.m_bodyB,m=d.m_sweep.c,n=d.m_sweep.a,r=g.m_sweep.c,t=g.m_sweep.a,y,l=0,p=0,z=0,x=0,B=0,p=!1,A=0,D=c.FromAngle(n),E=c.FromAngle(t);y=D;var B=this.m_localAnchor1.x-this.m_localCenterA.x,F=this.m_localAnchor1.y-this.m_localCenterA.y,l=y.col1.x*B+y.col2.x* F,F=y.col1.y*B+y.col2.y*F,B=l;y=E;E=this.m_localAnchor2.x-this.m_localCenterB.x;z=this.m_localAnchor2.y-this.m_localCenterB.y;l=y.col1.x*E+y.col2.x*z;z=y.col1.y*E+y.col2.y*z;E=l;y=r.x+E-m.x-B;l=r.y+z-m.y-F;if(this.m_enableLimit){this.m_axis=e.MulMV(D,this.m_localXAxis1);this.m_a1=(y+B)*this.m_axis.y-(l+F)*this.m_axis.x;this.m_a2=E*this.m_axis.y-z*this.m_axis.x;var I=this.m_axis.x*y+this.m_axis.y*l;e.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b.b2_linearSlop?(A=e.Clamp(I,-b.b2_maxLinearCorrection, b.b2_maxLinearCorrection),x=e.Abs(I),p=!0):I<=this.m_lowerTranslation?(A=e.Clamp(I-this.m_lowerTranslation+b.b2_linearSlop,-b.b2_maxLinearCorrection,0),x=this.m_lowerTranslation-I,p=!0):I>=this.m_upperTranslation&&(A=e.Clamp(I-this.m_upperTranslation+b.b2_linearSlop,0,b.b2_maxLinearCorrection),x=I-this.m_upperTranslation,p=!0)}this.m_perp=e.MulMV(D,this.m_localYAxis1);this.m_s1=(y+B)*this.m_perp.y-(l+F)*this.m_perp.x;this.m_s2=E*this.m_perp.y-z*this.m_perp.x;D=new j;F=this.m_perp.x*y+this.m_perp.y* l;E=t-n-this.m_refAngle;x=e.Max(x,e.Abs(F));B=e.Abs(E);p?(p=this.m_invMassA,z=this.m_invMassB,y=this.m_invIA,l=this.m_invIB,this.m_K.col1.x=p+z+y*this.m_s1*this.m_s1+l*this.m_s2*this.m_s2,this.m_K.col1.y=y*this.m_s1+l*this.m_s2,this.m_K.col1.z=y*this.m_s1*this.m_a1+l*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=y+l,this.m_K.col2.z=y*this.m_a1+l*this.m_a2,this.m_K.col3.x=this.m_K.col1.z,this.m_K.col3.y=this.m_K.col2.z,this.m_K.col3.z=p+z+y*this.m_a1*this.m_a1+l*this.m_a2*this.m_a2, this.m_K.Solve33(D,-F,-E,-A)):(p=this.m_invMassA,z=this.m_invMassB,y=this.m_invIA,l=this.m_invIB,A=y*this.m_s1+l*this.m_s2,I=y+l,this.m_K.col1.Set(p+z+y*this.m_s1*this.m_s1+l*this.m_s2*this.m_s2,A,0),this.m_K.col2.Set(A,I,0),A=this.m_K.Solve22(new f,-F,-E),D.x=A.x,D.y=A.y,D.z=0);A=D.x*this.m_perp.x+D.z*this.m_axis.x;p=D.x*this.m_perp.y+D.z*this.m_axis.y;F=D.x*this.m_s1+D.y+D.z*this.m_a1;D=D.x*this.m_s2+D.y+D.z*this.m_a2;m.x-=this.m_invMassA*A;m.y-=this.m_invMassA*p;n-=this.m_invIA*F;r.x+=this.m_invMassB* A;r.y+=this.m_invMassB*p;t+=this.m_invIB*D;d.m_sweep.a=n;g.m_sweep.a=t;d.SynchronizeTransform();g.SynchronizeTransform();return x<=b.b2_linearSlop&&B<=b.b2_angularSlop};Box2D.inherit(Q,Box2D.Dynamics.Joints.b2JointDef);Q.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;Q.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new f;this.localAnchorB=new f;this.localAxisA=new f};Q.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this); this.type=B.e_prismaticJoint;this.localAxisA.Set(1,0);this.referenceAngle=0;this.enableLimit=!1;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=!1;this.motorSpeed=this.maxMotorForce=0};Q.prototype.Initialize=function(b,c,d,e){this.bodyA=b;this.bodyB=c;this.localAnchorA=this.bodyA.GetLocalPoint(d);this.localAnchorB=this.bodyB.GetLocalPoint(d);this.localAxisA=this.bodyA.GetLocalVector(e);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(I,Box2D.Dynamics.Joints.b2Joint); I.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;I.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new f;this.m_groundAnchor2=new f;this.m_localAnchor1=new f;this.m_localAnchor2=new f;this.m_u1=new f;this.m_u2=new f};I.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};I.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};I.prototype.GetReactionForce=function(b){void 0=== b&&(b=0);return new f(b*this.m_impulse*this.m_u2.x,b*this.m_impulse*this.m_u2.y)};I.prototype.GetReactionTorque=function(){return 0};I.prototype.GetGroundAnchorA=function(){var b=this.m_ground.m_xf.position.Copy();b.Add(this.m_groundAnchor1);return b};I.prototype.GetGroundAnchorB=function(){var b=this.m_ground.m_xf.position.Copy();b.Add(this.m_groundAnchor2);return b};I.prototype.GetLength1=function(){var b=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),c=b.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x), b=b.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y);return Math.sqrt(c*c+b*b)};I.prototype.GetLength2=function(){var b=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),c=b.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor2.x),b=b.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor2.y);return Math.sqrt(c*c+b*b)};I.prototype.GetRatio=function(){return this.m_ratio};I.prototype.b2PulleyJoint=function(b){this.__super.b2Joint.call(this,b);this.m_ground=this.m_bodyA.m_world.m_groundBody;this.m_groundAnchor1.x= b.groundAnchorA.x-this.m_ground.m_xf.position.x;this.m_groundAnchor1.y=b.groundAnchorA.y-this.m_ground.m_xf.position.y;this.m_groundAnchor2.x=b.groundAnchorB.x-this.m_ground.m_xf.position.x;this.m_groundAnchor2.y=b.groundAnchorB.y-this.m_ground.m_xf.position.y;this.m_localAnchor1.SetV(b.localAnchorA);this.m_localAnchor2.SetV(b.localAnchorB);this.m_ratio=b.ratio;this.m_constant=b.lengthA+this.m_ratio*b.lengthB;this.m_maxLength1=e.Min(b.maxLengthA,this.m_constant-this.m_ratio*I.b2_minPulleyLength); this.m_maxLength2=e.Min(b.maxLengthB,(this.m_constant-I.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};I.prototype.InitVelocityConstraints=function(c){var d=this.m_bodyA,e=this.m_bodyB,f;f=d.m_xf.R;var g=this.m_localAnchor1.x-d.m_sweep.localCenter.x,j=this.m_localAnchor1.y-d.m_sweep.localCenter.y,m=f.col1.x*g+f.col2.x*j,j=f.col1.y*g+f.col2.y*j,g=m;f=e.m_xf.R;var l=this.m_localAnchor2.x-e.m_sweep.localCenter.x,n=this.m_localAnchor2.y-e.m_sweep.localCenter.y, m=f.col1.x*l+f.col2.x*n,n=f.col1.y*l+f.col2.y*n,l=m;f=e.m_sweep.c.x+l;var m=e.m_sweep.c.y+n,r=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,x=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(d.m_sweep.c.x+g-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x),d.m_sweep.c.y+j-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y));this.m_u2.Set(f-r,m-x);f=this.m_u1.Length();m=this.m_u2.Length();f>b.b2_linearSlop?this.m_u1.Multiply(1/f):this.m_u1.SetZero();m>b.b2_linearSlop? this.m_u2.Multiply(1/m):this.m_u2.SetZero();0b.b2_linearSlop?this.m_u1.Multiply(1/f):this.m_u1.SetZero(),t>b.b2_linearSlop?this.m_u2.Multiply(1/t):this.m_u2.SetZero(),f=this.m_constant-f-this.m_ratio*t,A=e.Max(A,-f),f=e.Clamp(f+b.b2_linearSlop,-b.b2_maxLinearCorrection,0),z=-this.m_pulleyMass*f,f=-z*this.m_u1.x,t=-z*this.m_u1.y,y=-this.m_ratio*z*this.m_u2.x,z=-this.m_ratio*z*this.m_u2.y,c.m_sweep.c.x+= c.m_invMass*f,c.m_sweep.c.y+=c.m_invMass*t,c.m_sweep.a+=c.m_invI*(l*t-p*f),d.m_sweep.c.x+=d.m_invMass*y,d.m_sweep.c.y+=d.m_invMass*z,d.m_sweep.a+=d.m_invI*(r*z-x*y),c.SynchronizeTransform(),d.SynchronizeTransform());this.m_limitState1==B.e_atUpperLimit&&(f=c.m_xf.R,l=this.m_localAnchor1.x-c.m_sweep.localCenter.x,p=this.m_localAnchor1.y-c.m_sweep.localCenter.y,t=f.col1.x*l+f.col2.x*p,p=f.col1.y*l+f.col2.y*p,l=t,f=c.m_sweep.c.x+l,t=c.m_sweep.c.y+p,this.m_u1.Set(f-g,t-j),f=this.m_u1.Length(),f>b.b2_linearSlop? (this.m_u1.x*=1/f,this.m_u1.y*=1/f):this.m_u1.SetZero(),f=this.m_maxLength1-f,A=e.Max(A,-f),f=e.Clamp(f+b.b2_linearSlop,-b.b2_maxLinearCorrection,0),z=-this.m_limitMass1*f,f=-z*this.m_u1.x,t=-z*this.m_u1.y,c.m_sweep.c.x+=c.m_invMass*f,c.m_sweep.c.y+=c.m_invMass*t,c.m_sweep.a+=c.m_invI*(l*t-p*f),c.SynchronizeTransform());this.m_limitState2==B.e_atUpperLimit&&(f=d.m_xf.R,r=this.m_localAnchor2.x-d.m_sweep.localCenter.x,x=this.m_localAnchor2.y-d.m_sweep.localCenter.y,t=f.col1.x*r+f.col2.x*x,x=f.col1.y* r+f.col2.y*x,r=t,y=d.m_sweep.c.x+r,z=d.m_sweep.c.y+x,this.m_u2.Set(y-m,z-n),t=this.m_u2.Length(),t>b.b2_linearSlop?(this.m_u2.x*=1/t,this.m_u2.y*=1/t):this.m_u2.SetZero(),f=this.m_maxLength2-t,A=e.Max(A,-f),f=e.Clamp(f+b.b2_linearSlop,-b.b2_maxLinearCorrection,0),z=-this.m_limitMass2*f,y=-z*this.m_u2.x,z=-z*this.m_u2.y,d.m_sweep.c.x+=d.m_invMass*y,d.m_sweep.c.y+=d.m_invMass*z,d.m_sweep.a+=d.m_invI*(r*z-x*y),d.SynchronizeTransform());return A=this.m_upperAngle?(this.m_limitState!=B.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=B.e_atUpperLimit):(this.m_limitState=B.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=B.e_inactiveLimit;c.warmStarting?(this.m_impulse.x*=c.dtRatio,this.m_impulse.y*=c.dtRatio,this.m_motorImpulse*=c.dtRatio,c=this.m_impulse.x,t=this.m_impulse.y,d.m_linearVelocity.x-=g*c,d.m_linearVelocity.y-=g*t,d.m_angularVelocity-=r*(m*t-n*c+this.m_motorImpulse+this.m_impulse.z),f.m_linearVelocity.x+= j*c,f.m_linearVelocity.y+=j*t,f.m_angularVelocity+=x*(l*t-p*c+this.m_motorImpulse+this.m_impulse.z)):(this.m_impulse.SetZero(),this.m_motorImpulse=0)};O.prototype.SolveVelocityConstraints=function(b){var c=this.m_bodyA,d=this.m_bodyB,f=0,g=0,j=0,m=0,l=0,n=c.m_linearVelocity,r=c.m_angularVelocity,x=d.m_linearVelocity,t=d.m_angularVelocity,y=c.m_invMass,z=d.m_invMass,A=c.m_invI,D=d.m_invI;this.m_enableMotor&&this.m_limitState!=B.e_equalLimits&&(g=this.m_motorMass*-(t-r-this.m_motorSpeed),j=this.m_motorImpulse, m=b.dt*this.m_maxMotorTorque,this.m_motorImpulse=e.Clamp(this.m_motorImpulse+g,-m,m),g=this.m_motorImpulse-j,r-=A*g,t+=D*g);if(this.m_enableLimit&&this.m_limitState!=B.e_inactiveLimit){b=c.m_xf.R;g=this.m_localAnchor1.x-c.m_sweep.localCenter.x;j=this.m_localAnchor1.y-c.m_sweep.localCenter.y;f=b.col1.x*g+b.col2.x*j;j=b.col1.y*g+b.col2.y*j;g=f;b=d.m_xf.R;m=this.m_localAnchor2.x-d.m_sweep.localCenter.x;l=this.m_localAnchor2.y-d.m_sweep.localCenter.y;f=b.col1.x*m+b.col2.x*l;l=b.col1.y*m+b.col2.y*l;m= f;b=x.x+-t*l-n.x- -r*j;var E=x.y+t*m-n.y-r*g;this.m_mass.Solve33(this.impulse3,-b,-E,-(t-r));this.m_limitState==B.e_equalLimits?this.m_impulse.Add(this.impulse3):this.m_limitState==B.e_atLowerLimit?(f=this.m_impulse.z+this.impulse3.z,0>f&&(this.m_mass.Solve22(this.reduced,-b,-E),this.impulse3.x=this.reduced.x,this.impulse3.y=this.reduced.y,this.impulse3.z=-this.m_impulse.z,this.m_impulse.x+=this.reduced.x,this.m_impulse.y+=this.reduced.y,this.m_impulse.z=0)):this.m_limitState==B.e_atUpperLimit&&(f= this.m_impulse.z+this.impulse3.z,0E*E&&(y=1/(m+z),n=y*-n,l=y*-l,f.m_sweep.c.x-=0.5*m*n,f.m_sweep.c.y-= 0.5*m*l,g.m_sweep.c.x+=0.5*z*n,g.m_sweep.c.y+=0.5*z*l,n=g.m_sweep.c.x+r-f.m_sweep.c.x-p,l=g.m_sweep.c.y+t-f.m_sweep.c.y-c);this.K1.col1.x=m+z;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=m+z;this.K2.col1.x=A*c*c;this.K2.col2.x=-A*p*c;this.K2.col1.y=-A*p*c;this.K2.col2.y=A*p*p;this.K3.col1.x=D*t*t;this.K3.col2.x=-D*r*t;this.K3.col1.y=-D*r*t;this.K3.col2.y=D*r*r;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(O.tImpulse,-n,-l);n=O.tImpulse.x;l=O.tImpulse.y;f.m_sweep.c.x-= f.m_invMass*n;f.m_sweep.c.y-=f.m_invMass*l;f.m_sweep.a-=f.m_invI*(p*l-c*n);g.m_sweep.c.x+=g.m_invMass*n;g.m_sweep.c.y+=g.m_invMass*l;g.m_sweep.a+=g.m_invI*(r*l-t*n);f.SynchronizeTransform();g.SynchronizeTransform();return d<=b.b2_linearSlop&&j<=b.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new f});Box2D.inherit(P,Box2D.Dynamics.Joints.b2JointDef);P.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;P.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);this.localAnchorA=new f;this.localAnchorB=new f};P.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=B.e_revoluteJoint;this.localAnchorA.Set(0,0);this.localAnchorB.Set(0,0);this.motorSpeed=this.maxMotorTorque=this.upperAngle=this.lowerAngle=this.referenceAngle=0;this.enableMotor=this.enableLimit=!1};P.prototype.Initialize=function(b,c,d){this.bodyA=b;this.bodyB=c;this.localAnchorA=this.bodyA.GetLocalPoint(d);this.localAnchorB=this.bodyB.GetLocalPoint(d); this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(aa,Box2D.Dynamics.Joints.b2Joint);aa.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;aa.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new f;this.m_localAnchorB=new f;this.m_impulse=new j;this.m_mass=new d};aa.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};aa.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)}; aa.prototype.GetReactionForce=function(b){void 0===b&&(b=0);return new f(b*this.m_impulse.x,b*this.m_impulse.y)};aa.prototype.GetReactionTorque=function(b){void 0===b&&(b=0);return b*this.m_impulse.z};aa.prototype.b2WeldJoint=function(b){this.__super.b2Joint.call(this,b);this.m_localAnchorA.SetV(b.localAnchorA);this.m_localAnchorB.SetV(b.localAnchorB);this.m_referenceAngle=b.referenceAngle;this.m_impulse.SetZero();this.m_mass=new d};aa.prototype.InitVelocityConstraints=function(b){var c,d=0,e=this.m_bodyA, f=this.m_bodyB;c=e.m_xf.R;var g=this.m_localAnchorA.x-e.m_sweep.localCenter.x,j=this.m_localAnchorA.y-e.m_sweep.localCenter.y,d=c.col1.x*g+c.col2.x*j,j=c.col1.y*g+c.col2.y*j,g=d;c=f.m_xf.R;var l=this.m_localAnchorB.x-f.m_sweep.localCenter.x,m=this.m_localAnchorB.y-f.m_sweep.localCenter.y,d=c.col1.x*l+c.col2.x*m,m=c.col1.y*l+c.col2.y*m,l=d;c=e.m_invMass;var d=f.m_invMass,n=e.m_invI,r=f.m_invI;this.m_mass.col1.x=c+d+j*j*n+m*m*r;this.m_mass.col2.x=-j*g*n-m*l*r;this.m_mass.col3.x=-j*n-m*r;this.m_mass.col1.y= this.m_mass.col2.x;this.m_mass.col2.y=c+d+g*g*n+l*l*r;this.m_mass.col3.y=g*n+l*r;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=n+r;b.warmStarting?(this.m_impulse.x*=b.dtRatio,this.m_impulse.y*=b.dtRatio,this.m_impulse.z*=b.dtRatio,e.m_linearVelocity.x-=c*this.m_impulse.x,e.m_linearVelocity.y-=c*this.m_impulse.y,e.m_angularVelocity-=n*(g*this.m_impulse.y-j*this.m_impulse.x+this.m_impulse.z),f.m_linearVelocity.x+=d*this.m_impulse.x,f.m_linearVelocity.y+= d*this.m_impulse.y,f.m_angularVelocity+=r*(l*this.m_impulse.y-m*this.m_impulse.x+this.m_impulse.z)):this.m_impulse.SetZero()};aa.prototype.SolveVelocityConstraints=function(){var b,c=0,d=this.m_bodyA,e=this.m_bodyB,f=d.m_linearVelocity,g=d.m_angularVelocity,m=e.m_linearVelocity,l=e.m_angularVelocity,n=d.m_invMass,r=e.m_invMass,t=d.m_invI,y=e.m_invI;b=d.m_xf.R;var z=this.m_localAnchorA.x-d.m_sweep.localCenter.x,A=this.m_localAnchorA.y-d.m_sweep.localCenter.y,c=b.col1.x*z+b.col2.x*A,A=b.col1.y*z+b.col2.y* A,z=c;b=e.m_xf.R;var B=this.m_localAnchorB.x-e.m_sweep.localCenter.x,D=this.m_localAnchorB.y-e.m_sweep.localCenter.y,c=b.col1.x*B+b.col2.x*D,D=b.col1.y*B+b.col2.y*D,B=c;b=m.x-l*D-f.x+g*A;var c=m.y+l*B-f.y-g*z,E=l-g,F=new j;this.m_mass.Solve33(F,-b,-c,-E);this.m_impulse.Add(F);f.x-=n*F.x;f.y-=n*F.y;g-=t*(z*F.y-A*F.x+F.z);m.x+=r*F.x;m.y+=r*F.y;l+=y*(B*F.y-D*F.x+F.z);d.m_angularVelocity=g;e.m_angularVelocity=l};aa.prototype.SolvePositionConstraints=function(){var c,d=0,f=this.m_bodyA,g=this.m_bodyB; c=f.m_xf.R;var m=this.m_localAnchorA.x-f.m_sweep.localCenter.x,n=this.m_localAnchorA.y-f.m_sweep.localCenter.y,d=c.col1.x*m+c.col2.x*n,n=c.col1.y*m+c.col2.y*n,m=d;c=g.m_xf.R;var r=this.m_localAnchorB.x-g.m_sweep.localCenter.x,l=this.m_localAnchorB.y-g.m_sweep.localCenter.y,d=c.col1.x*r+c.col2.x*l,l=c.col1.y*r+c.col2.y*l,r=d;c=f.m_invMass;var d=g.m_invMass,p=f.m_invI,t=g.m_invI,x=g.m_sweep.c.x+r-f.m_sweep.c.x-m,y=g.m_sweep.c.y+l-f.m_sweep.c.y-n,z=g.m_sweep.a-f.m_sweep.a-this.m_referenceAngle,A=10* b.b2_linearSlop,B=Math.sqrt(x*x+y*y),D=e.Abs(z);B>A&&(p*=1,t*=1);this.m_mass.col1.x=c+d+n*n*p+l*l*t;this.m_mass.col2.x=-n*m*p-l*r*t;this.m_mass.col3.x=-n*p-l*t;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=c+d+m*m*p+r*r*t;this.m_mass.col3.y=m*p+r*t;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=p+t;A=new j;this.m_mass.Solve33(A,-x,-y,-z);f.m_sweep.c.x-=c*A.x;f.m_sweep.c.y-=c*A.y;f.m_sweep.a-=p*(m*A.y-n*A.x+A.z);g.m_sweep.c.x+=d*A.x;g.m_sweep.c.y+= d*A.y;g.m_sweep.a+=t*(r*A.y-l*A.x+A.z);f.SynchronizeTransform();g.SynchronizeTransform();return B<=b.b2_linearSlop&&D<=b.b2_angularSlop};Box2D.inherit(U,Box2D.Dynamics.Joints.b2JointDef);U.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;U.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new f;this.localAnchorB=new f};U.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=B.e_weldJoint;this.referenceAngle= 0};U.prototype.Initialize=function(b,c,d){this.bodyA=b;this.bodyB=c;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(d));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(d));this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}})(); (function(){var b=Box2D.Dynamics.b2DebugDraw;b.b2DebugDraw=function(){this.m_xformScale=this.m_fillAlpha=this.m_alpha=this.m_lineThickness=this.m_drawScale=1;var b=this;this.m_sprite={graphics:{clear:function(){b.m_ctx.clearRect(0,0,b.m_ctx.canvas.width,b.m_ctx.canvas.height)}}}};b.prototype._color=function(b,d){return"rgba("+((b&16711680)>>16)+","+((b&65280)>>8)+","+(b&255)+","+d+")"};b.prototype.b2DebugDraw=function(){this.m_drawFlags=0};b.prototype.SetFlags=function(b){void 0===b&&(b=0);this.m_drawFlags= b};b.prototype.GetFlags=function(){return this.m_drawFlags};b.prototype.AppendFlags=function(b){void 0===b&&(b=0);this.m_drawFlags|=b};b.prototype.ClearFlags=function(b){void 0===b&&(b=0);this.m_drawFlags&=~b};b.prototype.SetSprite=function(b){this.m_ctx=b};b.prototype.GetSprite=function(){return this.m_ctx};b.prototype.SetDrawScale=function(b){void 0===b&&(b=0);this.m_drawScale=b};b.prototype.GetDrawScale=function(){return this.m_drawScale};b.prototype.SetLineThickness=function(b){void 0===b&&(b= 0);this.m_lineThickness=b;this.m_ctx.strokeWidth=b};b.prototype.GetLineThickness=function(){return this.m_lineThickness};b.prototype.SetAlpha=function(b){void 0===b&&(b=0);this.m_alpha=b};b.prototype.GetAlpha=function(){return this.m_alpha};b.prototype.SetFillAlpha=function(b){void 0===b&&(b=0);this.m_fillAlpha=b};b.prototype.GetFillAlpha=function(){return this.m_fillAlpha};b.prototype.SetXFormScale=function(b){void 0===b&&(b=0);this.m_xformScale=b};b.prototype.GetXFormScale=function(){return this.m_xformScale}; b.prototype.DrawPolygon=function(b,d,e){if(d){var f=this.m_ctx,j=this.m_drawScale;f.beginPath();f.strokeStyle=this._color(e.color,this.m_alpha);f.moveTo(b[0].x*j,b[0].y*j);for(e=1;eMath.abs(d.GetAngularVelocity()), f=0.6>Math.abs(d.GetLinearVelocity().Length());e&&f?30m?1:0,y:0Math.abs(n)&&1>Math.abs(m)){var n=_utv2.pointQuadrant(b,e,0.5,0.5),m=_utv2.pointQuadrant(j,f,0.5,0.5),z=_utv2.pointQuadrant(r,g,0.5,0.5);!(n&z)&&!(m&z)&&(y=!0)}!0===y?(r!==g?(y=r,m=g,1==r?(g=1,n=0):(g=0,n=1)):(n=r,m=1==r?y=0:y=1),d[3]={x:y,y:g},d[4]={x:n,y:m}):(r!==g?(y= r,m=g,1==r?(g=Math.max(e,f),n=Math.min(b,j)):(g=Math.min(e,f),n=Math.max(b,j))):(n=r,1==r?(y=Math.min(b,j),m=Math.min(e,f)):(y=Math.max(b,j),m=Math.max(e,f))),y===b&&g===e||y===j&&g===f?n===b&&m===e||n===j&&m===f||(d[3]={x:n,y:m}):d[3]={x:y,y:g});d=this._pointsToConvexHull(d)}this.defaultTileVerticesDef[c]=d}return d},_pointsToConvexHull:function(b){if(3>b.length)return b;var c,d,e=0,f=b[e],j;c=1;for(d=b.length;cm.angle&&(m.angle+=Math.PI),m.distance=(j.x-f.x)*(j.x-f.x)+(j.y-f.y)*(j.y-f.y),m.index=c,n.push(m));n.sort(function(b,c){return b.anglec.angle?1:b.distancec.distance?1:0});n.unshift(n[n.length-1],{x:f.x,y:f.y,index:e});e=2;c=3;for(d=b.length;c<=d;c++){for(;0>=this._pointsCW(n[e-1],n[e],n[c]);)e--;e++;f=n[c];n[c]=n[e];n[e]=f}d=[];for(c=0;c<=e;c++)d[c]=b[n[c].index];return d}, _pointsCW:function(b,c,d){return(c.x-b.x)*(d.y-b.y)-(c.y-b.y)*(d.x-b.x)}});Box2D.Common.b2Settings.b2_maxTranslation=10;Box2D.Common.b2Settings.b2_maxTranslationSquared=100;Box2D.Common.b2Settings.b2_velocityThreshold=1});ig.baked=!0; ig.module("plugins.data.color-rgb").defines(function(){ColorRGB=function(b,c,d,e){this.r=b||0;this.g=c||0;this.b=d||0;this.a=e||0};ColorRGB.prototype={setRandomColor:function(){this.r=Math.round(255*Math.random());this.g=Math.round(255*Math.random());this.b=Math.round(255*Math.random())},getStyle:function(){return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"},getHex:function(){for(var b=this.r.toString(16),c=this.g.toString(16),d=this.b.toString(16);2>b.length;)b="0"+b;for(;2>c.length;)c="0"+ c;for(;2>d.length;)d="0"+d;return"#"+b+c+d},getInvertedColor:function(){return new ColorRGB(255-this.r,255-this.g,255-this.b,255-this.a)},clone:function(){return new ColorRGB(this.r,this.g,this.b,this.a)}}});this.START_BRANDING_SPLASH;ig.baked=!0; ig.module("plugins.branding.splash").requires("impact.impact","impact.entity").defines(function(){ig.BrandingSplash=ig.Class.extend({init:function(){ig.game.spawnEntity(EntityBranding,0,0);console.log("spawn branding")}});var b="undefined"!=typeof CUSTOM_VARIABLE_SPLASH_BG_COLOR?CUSTOM_VARIABLE_SPLASH_BG_COLOR:"#FFFFFF";EntityBranding=ig.Entity.extend({gravityFactor:0,size:{x:32,y:32},splash:new ig.Image("undefined"!=typeof CUSTOM_VARIABLE_SPLASH_PATH?CUSTOM_VARIABLE_SPLASH_PATH:"branding/splash1.png"), init:function(b,d,e){this.parent(b,d,e);320>=ig.system.width?(this.size.x=320,this.size.y=200):(this.size.x=480,this.size.y=240);this.pos.x=(ig.system.width-this.size.x)/2;this.pos.y=-this.size.y-200;this.endPosY=(ig.system.height-this.size.y)/2;b=this.tween({pos:{y:this.endPosY}},0.5,{easing:ig.Tween.Easing.Bounce.EaseIn});d=this.tween({},2.5,{onComplete:function(){ig.game.director.loadLevel(ig.game.director.currentLevel)}});b.chain(d);b.start();this.currentAnim=this.anims.idle},createClickableLayer:function(){console.log("Build clickable layer"); this.checkClickableLayer("branding-splash",_SETTINGS.Branding.Logo.Link,_SETTINGS.Branding.Logo.NewWindow)},doesClickableLayerExist:function(b){for(k in dynamicClickableEntityDivs)if(k==b)return!0;return!1},checkClickableLayer:function(b,d,e){"undefined"==typeof wm&&(this.doesClickableLayerExist(b)?(ig.game.showOverlay([b]),$("#"+b).find("[href]").attr("href",d)):this.createClickableOutboundLayer(b,d,"media/graphics/misc/invisible.png",e))},createClickableOutboundLayer:function(b,d,e,f){var j=ig.$new("div"); j.id=b;document.body.appendChild(j);j=$("#"+j.id);j.css("float","left");j.css("position","absolute");if(ig.ua.mobile){var n=window.innerHeight/mobileHeight,m=window.innerWidth/mobileWidth;j.css("left",this.pos.x*m);j.css("top",this.pos.y*n);j.css("width",this.size.x*m);j.css("height",this.size.y*n)}else n=w/2-destW/2,m=h/2-destH/2,console.log(n,m),j.css("left",n+this.pos.x*multiplier),j.css("top",m+this.pos.y*multiplier),j.css("width",this.size.x*multiplier),j.css("height",this.size.y*multiplier); f?j.html(""):j.html("");dynamicClickableEntityDivs[b]={};dynamicClickableEntityDivs[b].width=this.size.x*multiplier;dynamicClickableEntityDivs[b].height=this.size.y*multiplier;dynamicClickableEntityDivs[b].entity_pos_x=this.pos.x;dynamicClickableEntityDivs[b].entity_pos_y=this.pos.y},draw:function(){ig.system.context.fillStyle=b;ig.system.context.fillRect(0, 0,ig.system.width,ig.system.height);ig.system.context.fillStyle="#000";ig.system.context.font="12px Arial";ig.system.context.textAlign="left";this.parent();this.splash&&ig.system.context.drawImage(this.splash.data,0,0,this.splash.data.width,this.splash.data.height,this.pos.x,this.pos.y,this.size.x,this.size.y)}})});this.END_BRANDING_SPLASH;ig.baked=!0; ig.module("game.entities.buttons.button").requires("impact.entity","impact.timer").defines(function(){EntityButton=ig.Entity.extend({collides:ig.Entity.COLLIDES.NEVER,type:ig.Entity.TYPE.A,size:{x:200,y:76},fillColor:null,zIndex:2E3,gravityFactor:0,clickCheck:!1,init:function(b,c,d){this.parent(b,c,d);this.oriPosX=this.pos.x;this.oriPosY=this.pos.y},update:function(){this.parent()},draw:function(){this.parent()},clicked:function(){this.anims.idle&&(this.currentAnim=this.anims.idle);this.clickCheck= !0;ig.soundHandler.sfxPlayer.play("clickSound")},released:function(){this.anims.hover&&(this.currentAnim=this.anims.hover);this.clickCheck&&(this.clickCheck=!1,this.redirect())},over:function(){this.anims.hover&&(this.currentAnim=this.anims.hover)},leave:function(){this.anims.idle&&(this.currentAnim=this.anims.idle);this.clickCheck=!1},redirect:function(){},movePos:function(b,c){this.pos.x=b;this.pos.y=c},checkClickOnPause:function(){if(ig.game.paused&&this.ignorePause)if(this.checkOverlapWithPointer()){if(this.anims.hover&& (this.currentAnim=this.anims.hover),ig.input.pressed("click")&&(this.clickCheck=!0),ig.input.state("click")&&this.anims.idle&&(this.currentAnim=this.anims.idle),ig.input.released("click")){this.released();for(var b=ig.game.getEntitiesByType(EntityButton),c=0;cthis.pos.x+this.size.x||bthis.pos.y+this.size.y||cthis.nextLevelTimer.delta()&&(ig.system.context.globalAlpha=-this.nextLevelTimer.delta()),this.drawOriginalShieldOpening())},updateOriginalShieldOpening:function(){this.initTimer&&0this.shieldAnim?(this.shieldAnim++,this.sheildTimer.reset()):(this.sheildTimer=null,this.moveTimer=new ig.Timer(0.001),this.mIconTimer=new ig.Timer(0.05),this.titleTimer=new ig.Timer(0.15)));this.moveTimer&&0this.mIconAnim?(this.mIconAnim++,this.moveTimer.reset()):this.mIconTimer= null);this.titleTimer&&0this.titleAnim?(this.titleAnim++,this.titleTimer.reset()):(this.titleTimer=null,this.nextLevelTimer=new ig.Timer(1)));this.nextLevelTimer&&0=f;f+=1)b.lineTo(0+800*Math.cos(2*f*Math.PI/48),0+800*Math.sin(2*f*Math.PI/48)),e++,2==e&&(e=0,b.lineTo(0,0));b.translate(-c,-d);c=b.createRadialGradient(c,d,100,c,d,250);c.addColorStop(0,"rgba(255,255,255,0.1)");c.addColorStop(1,"rgba(0,0,0,0)");b.fillStyle=c;b.fill();b.restore()}this.shieldImage.drawTile(ig.system.width/2-91,0-(768-ig.system.height)/2,this.shieldAnim,182,768);this.moveTimer&&(this.mIconImage.drawTile(ig.system.width/2-96,ig.system.height/2-70,this.mIconAnim, 166,160),this.titleImage.drawTile(ig.system.width/2-204,ig.system.height/2+100,this.titleAnim,409,76));ig.system.context.globalAlpha=1}})});ig.baked=!0; ig.module("game.entities.opening-kitty").requires("impact.entity").defines(function(){EntityOpeningKitty=ig.Entity.extend({size:{x:48,y:48},kittyAnim:-1,kittyImage:new ig.Image("media/graphics/opening/kitty.png"),kittyTitleImage:new ig.Image("media/graphics/opening/kittytitle.png"),soundKey:"kittyopeningSound",init:function(b,c,d){this.parent(b,c,d)},ready:function(){ig.wm||(_SETTINGS.DeveloperBranding.Splash.Enabled?this.initTimer=new ig.Timer(0.1):(ig.game.director.nextLevel(),ig.system.context.globalAlpha= 1,this.kill()))},update:function(){this.parent();this.updateKittyOpening();this.unlockWebAudio()},unlockWebAudio:function(){if(ig.input.released("click"))try{ig.soundHandler.unlockWebAudio()}catch(b){}},draw:function(){this.parent();ig.global.wm||(this.nextLevelTimer&&0>this.nextLevelTimer.delta()&&(ig.system.context.globalAlpha=-this.nextLevelTimer.delta()),this.drawKittyOpening())},updateKittyOpening:function(){if(this.initTimer&&0this.kittyAnim?(this.kittyAnim++,this.kittyTimer.reset()):(this.kittyTimer=null,this.nextLevelTimer=new ig.Timer(2)));this.nextLevelTimer&&0c&&(c=this.objectArray[a].zIndex,b=this.objectArray[a]);if(null!=b)null!=this.hoveringItem?this.hoveringItem!= b&&("function"==typeof this.hoveringItem.leave&&this.hoveringItem.leave(),"function"==typeof b.over&&b.over()):"function"==typeof b.over&&b.over(),this.hoveringItem=b,this.clickObject(b),this.objectArray=[];else if(null!=this.hoveringItem&&"function"==typeof this.hoveringItem.leave&&(this.hoveringItem.leave(),this.hoveringItem=null),this.isReleased){for(b=0;b"):$("#"+f.id).html("");dynamicClickableEntityDivs[b]={};dynamicClickableEntityDivs[b].width=$("#"+f.id).width();dynamicClickableEntityDivs[b].height= $("#"+f.id).height();dynamicClickableEntityDivs[b].entity_pos_x=this.pos.x;dynamicClickableEntityDivs[b].entity_pos_y=this.pos.y},hovered:function(){this.isHovering=!0;this.dehoverOthers()},dehoverOthers:function(){var b=ig.game.getEntitiesByType(EntitySelect);for(i=0;ithis.currentAnim.alpha&&(this.currentAnim.alpha+=0.01):this.currentAnim.alpha=0;this.displayStar()},displayStar:function(){var b=ig.game.storage.get("mpp-shighscore");if(b)if(b=Math.floor(b/2E3),this.locked)this.currentAnim=this.anims.lock;else switch(b){case 0:this.currentAnim=this.anims.zero;break;case 1:this.currentAnim=this.anims.one;break;case 2:this.currentAnim=this.anims.two;break;case 3:this.currentAnim= this.anims.three;break;default:this.currentAnim=this.anims.lock}},appear:function(){this.incAlpha=!0;this.type=ig.Entity.TYPE.B;this.locked=!1},disappear:function(){this.incAlpha=!1;this.locked=!0;this.type=ig.Entity.TYPE.NONE},redirect:function(){this.parent();ig.game.special=!0;ig.game.menuControl.levelClick(this.num)},clicked:function(){this.locked||(this.anims.idle&&(this.currentAnim=this.anims.idle),this.clickCheck=!0,ig.soundHandler.sfxPlayer.play("clickSound"))},draw:function(){this.parent(); if(!ig.global.wm&&!this.locked){var b=ig.system.context;b.textAlign="center";b.textBaseline="middle";b.fillStyle="white";b.font="30px janda";b.save();b.globalAlpha=this.currentAnim.alpha;b.fillText("???",this.pos.x+63,this.pos.y+75);b.restore()}}})});ig.baked=!0; ig.module("game.entities.board-level").requires("impact.entity","game.entities.buttons.button-close","game.entities.buttons.button-level","game.entities.buttons.button-page","game.entities.buttons.button-level-s").defines(function(){EntityBoardLevel=ig.Entity.extend({size:{x:712,y:445},gravityFactor:0,zIndex:600,animSheet:new ig.AnimationSheet("media/graphics/sprites/board-level.png",712,445),totalPages:4,currentPage:0,cHeight:160,cWidth:140,btnlevels:[],firstBtnPos:{x:153,y:65},page0:new ig.Image("media/graphics/sprites/page0.png"), page1:new ig.Image("media/graphics/sprites/page1.png"),init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);this.oriPosX=this.pos.x;this.oriPosY=this.pos.y;if(!ig.global.wm){ig.game.starArr=ig.game.storage.get("mpp-star");ig.game.unlockArr=ig.game.storage.get("mpp-unlocked");this.btnclose=ig.game.spawnEntity(EntityButtonClose,this.pos.x,this.pos.y);for(b=0;2>b;b++)for(c=0;3>c;c++)this.btnlevels.push(ig.game.spawnEntity(EntityButtonLevel,this.pos.x,this.pos.y,{row:b,column:c,main:this, num:3*b+c+1,seq:3*b+c+1}));this.btnforward=ig.game.spawnEntity(EntityButtonPage,this.pos.x,this.pos.y,{num:1});this.btnback=ig.game.spawnEntity(EntityButtonPage,this.pos.x,this.pos.y,{num:0});c=0;if(ig.game.starArr)for(b=0;bthis.totalPages-1&&(this.currentPage=0)):(this.currentPage--,0>this.currentPage&&(this.currentPage=this.totalPages-1));this.updateNum()},updateNum:function(){for(var b=ig.game.getEntitiesByType(EntityButtonLevel), c=0;cthis.animAlpha&&(this.animAlpha+=0.05);this.dec&&0.05this.animAlpha&&this.kill()},kill:function(){!this.comic&&1==ig.game.director.currentLevel&&(ig.game.menuControl&&ig.game.menuControl.btnmoregames)&&ig.game.menuControl.btnmoregames.show();this.parent()}})});ig.baked=!0; ig.module("game.entities.comic").requires("impact.entity").defines(function(){EntityComic=ig.Entity.extend({size:{x:752,y:485},animSheet:new ig.AnimationSheet("media/graphics/sprites/comic.png",752,485),ignorePause:!0,zIndex:2E3,gravityFactor:0,alp:0,collides:ig.Entity.COLLIDES.NEVER,type:ig.Entity.TYPE.A,disappear:!1,init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);this.currentAnim.alpha=0},update:function(){this.parent();!this.disappear&&1>this.currentAnim.alpha&&(this.currentAnim.alpha+= 0.013);this.disappear&&(0.02this.currentAnim.alpha&&(this.currentAnim.alpha+=0.1)},fireworks:function(b,c,d){this.points.push([b,c,5,30,40,d]);this.points.push([b, c,5,25,30,d]);this.points.push([b,c,5,25,60,d]);this.points.push([b,c,5,20,55,d]);this.points.push([b,c,5,25,50,d]);this.points.push([b,c,5,35,50,d]);this.points.push([b,c,5,35,55,d]);this.points.push([b,c,5,20,45,d])},draw:function(){this.parent();var b=ig.system.context;if(!(1this.angleDeg&&(this.angleDeg+=10,this.currentAnim.angle=this.angleDeg*Math.PI/180);1>this.scaling?this.scaling+=0.05:(this.nextshow=!0,this.ding&&(ig.soundHandler.sfxPlayer.play("star"+this.num+"Sound"),this.ding=!1))}})});ig.baked=!0; ig.module("game.entities.buttons.button-home").requires("game.entities.buttons.button").defines(function(){EntityButtonHome=EntityButton.extend({size:{x:63,y:66},animSheet:new ig.AnimationSheet("media/graphics/sprites/buttons/button-home.png",63,66),ignorePause:!0,zIndex:1E3,init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);this.addAnim("hover",1,[1])},update:function(){this.parent()},clicked:function(){("pausing"==ig.game.gameState||"win"==ig.game.gameState||"lose"==ig.game.gameState)&& this.parent()},redirect:function(){this.parent();ig.game.control.homeClick()},draw:function(){this.parent()}})});ig.baked=!0; ig.module("game.entities.buttons.button-continue").requires("game.entities.buttons.button").defines(function(){EntityButtonContinue=EntityButton.extend({size:{x:63,y:66},animSheet:new ig.AnimationSheet("media/graphics/sprites/buttons/button-continue.png",63,66),ignorePause:!0,zIndex:1E3,init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);this.addAnim("hover",1,[1])},update:function(){this.parent()},clicked:function(){"pausing"==ig.game.gameState&&this.parent()},redirect:function(){this.parent(); ig.game.control.continueClick()},draw:function(){this.parent()}})});ig.baked=!0; ig.module("game.entities.buttons.button-next").requires("game.entities.buttons.button").defines(function(){EntityButtonNext=EntityButton.extend({size:{x:63,y:66},animSheet:new ig.AnimationSheet("media/graphics/sprites/buttons/button-next.png",63,66),ignorePause:!0,zIndex:1E3,locked:!1,init:function(b,c,d){this.parent(b,c,d);ig.global.wm||(ig.game.unlockArr=ig.game.storage.get("mpp-unlocked"),24<=ig.game.currentLevel||0==ig.game.unlockArr[ig.game.currentLevel]?(this.locked=!0,this.currentAnim=this.anims.lock, this.addAnim("idle",1,[2])):(this.locked=!1,this.addAnim("idle",1,[0]),this.addAnim("hover",1,[1])))},update:function(){this.parent()},clicked:function(){this.locked||("win"==ig.game.gameState||"lose"==ig.game.gameState||"pausing"==ig.game.gameState)&&this.parent()},redirect:function(){this.parent();ig.game.control.nextClick()},draw:function(){this.parent()}})});ig.baked=!0; ig.module("game.entities.board-win").requires("impact.entity","game.entities.star","game.entities.buttons.button-home","game.entities.buttons.button-continue","game.entities.buttons.button-next").defines(function(){EntityBoardWin=ig.Entity.extend({size:{x:447,y:423},animSheet:new ig.AnimationSheet("media/graphics/sprites/board-empty2.png",447,423),ignorePause:!0,zIndex:800,gravityFactor:0,init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);if(ig.game.control.levelStar>0+(ig.game.special? 1:0))this.starTimer1=new ig.Timer(1.4);if(ig.game.control.levelStar>1+(ig.game.special?2:0))this.starTimer2=new ig.Timer(1.8);if(ig.game.control.levelStar>2+(ig.game.special?3:0))this.starTimer3=new ig.Timer(2.2);ig.game.special&&(this.pos.x+=ig.game.screen.x);this.btnRestart=ig.game.spawnEntity(EntityButtonRestart,this.pos.x,this.pos.y,{main:this});this.btnHome=ig.game.spawnEntity(EntityButtonHome,this.pos.x,this.pos.y,{main:this});this.btnNext=ig.game.spawnEntity(EntityButtonNext,this.pos.x,this.pos.y, {main:this});this.mb=c=1E3*ig.game.control.levelStar;ig.game.special?(this.sb="---",this.score=c,c=ig.game.storage.get("mpp-shighscore"),this.score>c&&(c=this.score,ig.game.storage.set("mpp-shighscore",c))):(b=1E3*ig.game.control.shotsLeft,d=c+b,c=ig.game.storage.get("mpp-highscore"),d>c[ig.game.currentLevel-1]&&(c[ig.game.currentLevel-1]=d,ig.game.storage.set("mpp-highscore",c)),this.sb=b,this.score=d);this.hscore=c;ig.game.sortEntitiesDeferred()},update:function(){this.parent();this.star1&&(this.star1.pos.x= this.pos.x+120,this.star1.pos.y=this.pos.y+118);this.star2&&(this.star2.pos.x=this.pos.x+193,this.star2.pos.y=this.pos.y+118);this.star3&&(this.star3.pos.x=this.pos.x+266,this.star3.pos.y=this.pos.y+118);this.starTimer1&&0f&&(f=1);e.drawImage(this.barFull.data,0,0,f,this.barFull.height,n*j,m*j,f,this.barFull.height);f=(b.pos.x-c-ig.game.screen.x)/d;f*=this.barFull.width;1>f&&(f=1);e.drawImage(this.barFull.data,0,0,f,this.barFull.height,n*j,(m+83)*j,f,this.barFull.height);e.textAlign="center";e.textBaseline="middle";e.fillStyle="white";e.font="33px janda";this.isSettings? e.fillText(_STRINGS.Game.Settings,this.pos.x+228-ig.game.screen.x,this.pos.y+100):e.fillText(_STRINGS.Game.Paused,this.pos.x+228-ig.game.screen.x,this.pos.y+100)},tweenIn:function(b,c){this.tweening=!0;-1==b&&(b=this.pos.x);ig.global.wm||this.tween({pos:{x:b,y:c}},0.5,{onComplete:function(){this.tweening=!1;ig.game.gameState="pausing"}.bind(this),easing:ig.Tween.Easing.Quadratic.EaseOut,delay:0}).start()},tweenOut:function(b,c){this.tweening=!0;-1==b&&(b=this.pos.x);ig.global.wm||this.tween({pos:{x:b, y:c}},0.5,{onComplete:function(){this.tweening=!1;this.isSettings?(ig.game.gameState="menu",ig.game.menuControl.bl.kill()):(ig.game.gameState="play",ig.game.control.bl.kill(),ig.game.box2dPaused=!1);this.kill()}.bind(this),easing:ig.Tween.Easing.Quadratic.EaseOut,delay:0}).start()}})});ig.baked=!0; ig.module("game.entities.board-lose").requires("impact.entity","game.entities.star","game.entities.buttons.button-home","game.entities.buttons.button-continue","game.entities.buttons.button-next").defines(function(){EntityBoardLose=ig.Entity.extend({size:{x:447,y:423},animSheet:new ig.AnimationSheet("media/graphics/sprites/board-empty2.png",447,423),ignorePause:!0,zIndex:800,gravityFactor:0,init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);this.btnRestart=ig.game.spawnEntity(EntityButtonRestart, this.pos.x,this.pos.y,{main:this});this.btnHome=ig.game.spawnEntity(EntityButtonHome,this.pos.x,this.pos.y,{main:this});this.btnNext=ig.game.spawnEntity(EntityButtonNext,this.pos.x,this.pos.y,{main:this});ig.game.sortEntitiesDeferred()},update:function(){this.parent();this.btnRestart.pos.x=this.pos.x+190;this.btnRestart.pos.y=this.pos.y+326;this.btnHome.pos.x=this.pos.x+108;this.btnHome.pos.y=this.pos.y+326;this.btnNext.pos.x=this.pos.x+272;this.btnNext.pos.y=this.pos.y+326;this.soundTimer&&0this.pos.x&&(this.facingLeft=!1);this.mangoTimer=new ig.Timer(0.2); this.ouchTimer=new ig.Timer(0.5)},update:function(){this.parent();ig.input.released("click")&&this.dragging&&this.mreleased();14this.body.GetAngularVelocity()&&this.body.SetAngularVelocity(-14);0this.body.GetLinearVelocity().x&&(this.facingLeft=!0);1>this.speed2()&&(this.body.SetLinearVelocity({x:0,y:0}),this.show="idle",this.body.SetAngle(0));if(this.dragging){if(this.prevMX!= ig.game.io.getClickPos().x||this.prevMY!=ig.game.io.getClickPos().y)this.prevMX=ig.game.io.getClickPos().x,this.prevMY=ig.game.io.getClickPos().y,this.showDots();ig.game.io.getClickPos().x>this.dragPosX?this.facingLeft=!1:ig.game.io.getClickPos().xthis.speed2()&&(this.show="lose");if(ig.game.special){var b=this.body.GetPosition();ig.game.screen.x=b.x/ Box2D.SCALE-0.5*ig.system.width;0>ig.game.screen.x?ig.game.screen.x=0:ig.game.screen.x>4800-ig.system.width&&(ig.game.screen.x=4800-ig.system.width)}},clicked:function(){ig.log("clicked");if(!this.dragging&&!this.goaled&&!("play"!=ig.game.control.levelState||"play"!=ig.game.gameState)&&!(ig.game.control.tut&&2>ig.game.control.tut.num))this.dragging=!0,this.points=[],this.s=[],this.s2=[],ig.game.control.draggingPig=this,ig.game.control.levelState="dragging",ig.game.control.firstDrag||(ig.soundHandler.sfxPlayer.play("curiousSound"), ig.game.control.firstDrag=!0),this.dragPosX=ig.game.io.getClickPos().x,this.dragPosY=ig.game.io.getClickPos().y},mreleased:function(){this.dragging&&(this.dragging=!1,this.shoot())},checkDis:function(){for(var b=ig.game.getEntitiesByType(EntityPig),c=0;cMath.abs(b[c].pos.x-this.pos.x)&&3>Math.abs(b[c].pos.y-this.pos.y))return!1;return!0},showDots:function(){var b=ig.game.io.getClickPos().x,c=ig.game.io.getClickPos().y,b=b-this.dragPosX,c=c-this.dragPosY;0===b&&(b=0.01); var d=Math.atan(c/b),e;e=Math.min(650+(b*b+c*c)/100,2500);e/=20;c=e*Math.cos(d);d=e*Math.sin(d);0>b&&(c*=-1,d*=-1);this.points=[];b=ig.game.gravity*Box2D.SCALE;for(e=0;15>e;e++){var f={},j=e/2;f.x=c*j;f.x+=this.pos.x+27.5;f.y=this.pos.y+10-(-1*d*j-0.5*b/9.8*j*j);this.points.push(f)}},shoot:function(){ig.log("shoot");ig.game.control.levelState="shooting";this.shooted=!0;0.5>Math.random()?ig.soundHandler.sfxPlayer.play("cuteSound"):ig.soundHandler.sfxPlayer.play("cute2Sound");ig.game.showTut&&ig.game.control.tut&& ig.game.control.closeTutorial();0b&&(c*=-1,d*=-1);b=new Box2D.Common.Math.b2Vec2(c,d);this.body.SetLinearVelocity(b);this.show="fly"},beginContact:function(b){if(b)switch(b.name){case "basket":case "ground":case "block":"fly"== this.show&&(this.show="land"),b!=this.lastTouch&&3E3this.cFrame?(this.cFrame++,this.landTimer.reset()):(this.landTimer=null,this.show="idle",this.cFrame=0))):"idle"==this.show?(this.idleTimer||(this.idleTimer=new ig.Timer(0.3)),0this.cFrame?(this.cFrame++,this.idleTimer.set(0.3)):(this.cFrame=0,this.idleTimer.set(3)))):"win"==this.show?this.cFrame=10:"lose"==this.show&&(this.loseTimer||(this.loseTimer=new ig.Timer(0.7), this.cFrame=12),0Math.random()&&this.s.push([d,e,f,j,n,m]);for(d=0;dthis.s[d][2]&&this.s.splice(d,1)}if("fly"==this.show&&0==b){d=Math.floor(10* Math.random())-45+5;e=Math.floor(10*Math.random())-5+10;j=Math.floor(3*Math.random());n=3*(Math.random()+0.5);m=(Math.random()-0.5)/2;f=Math.floor(6*Math.random());this.colors=["white","yellow","orange"];this.s.push([d,e,f,j,n,m]);4E3this.angled)&&c.rotate(this.angled);for(d=0;dthis.s[d][2]&&this.s.splice(d,1)}c.restore()}}})});ig.baked=!0; ig.module("game.entities.win-effect").requires("impact.entity").defines(function(){EntityWinEffect=ig.Entity.extend({size:{x:100,y:100},animSheet:new ig.AnimationSheet("media/graphics/sprites/win-effect.png",668,133),ignorePause:!0,zIndex:400,gravityFactor:0,scaling:0.01,step:0,init:function(b,c,d){this.parent(b,c,d);this.addAnim("idle",1,[0]);this.setScale(this.scaling,this.scaling);ig.game.special&&(this.pos.x+=ig.game.screen.x);this.oriPosX=this.pos.x;this.oriPosY=this.pos.y},update:function(){this.parent(); switch(this.step){case 0:1>this.scaling?this.scaling+=0.06:this.step=1;break;case 1:0.8this.scaling?this.scaling+=0.04:(this.step=3,this.stepTimer=new ig.Timer(2));break;case 3:this.stepTimer&&0d;)b.fillRect(0,d-1,960,2),d+=50;for(;960>c;)b.fillRect(c-1,0,2,540),c+=50;if(2==this.showing){c=0;for(d=25;540>d;){for(;960>c;)b.fillRect(c,d-1,5,2),c+=10;d+=50;c=0}c=25;for(d=0;960>c;){for(;540>d;)b.fillRect(c-1, d,2,5),d+=10;c+=50;d=0}}}}}})});ig.baked=!0; ig.module("game.entities.finger").requires("impact.entity").defines(function(){EntityFinger=ig.Entity.extend({size:{x:63,y:81},sheets:[new ig.AnimationSheet("media/graphics/sprites/mouse.png",63,81),new ig.AnimationSheet("media/graphics/sprites/finger.png",63,81)],ignorePause:!0,zIndex:400,gravityFactor:0,desPos:[353,267],init:function(b,c,d){this.parent(b,c,d);this.animSheet=ig.ua.mobile?this.sheets[1]:this.sheets[0];this.addAnim("idle",0.3,[0,1,2],!0);this.addAnim("rel",0.3,[2,1,0],!0);this.stepTimer1= new ig.Timer(1.2);this.stepTimer2=new ig.Timer(3.5);this.oriPosX=this.pos.x;this.oriPosY=this.pos.y;this.diffX=this.desPos[0]-this.oriPosX;this.diffY=this.oriPosY-this.desPos[1]},update:function(){this.parent();this.stepTimer1&&0this.desPos[1]?this.pos.y-=this.diffY/60:this.currentAnim=this.anims.rel);this.stepTimer2&&0this.num&&(this.lineTimer2=null,this.num++,this.lineTimer1= new ig.Timer(0.5),2==this.num&&(this.finger=ig.game.spawnEntity(EntityFinger,72,438)));this.killTimer&&0d?(f*=1+2*d,n+=(this.im.width-f)/2):e&&(f*=-2*e,n+=(this.im.width-f)/2);f=Math.min(f,this.im.width);f=Math.max(f,0.1);b.drawImage(this.im.data,n*c,m*c,f,j);f=this.im.width;j=this.im.height/2;n=this.pos.x;m=this.pos.y;this.lineTimer1&&(d= this.lineTimer1.delta(),0>d?f*=1+2*d:e&&(f*=-2*e,n+=(this.im.width-f)/2),f=Math.min(f,this.im.width),f=Math.max(f,0.1),b.drawImage(this.imtext[this.num].data,0,0,f,j,n*c,m*c,f,j));f=this.im.width;j=this.im.height/2;n=this.pos.x;m=this.pos.y;this.lineTimer2&&(d=this.lineTimer2.delta(),0>d?f*=1+2*d:e&&(f*=-2*e,n+=(this.im.width-f)/2),f=Math.min(f,this.im.width),f=Math.max(f,0.1),b.drawImage(this.imtext[this.num].data,0,j,f,j,n*c,m*c+j,f,j))}})});ig.baked=!0; ig.module("game.entities.game-control").requires("impact.entity","game.entities.buttons.button","game.entities.buttons.button-play","game.entities.buttons.button-close","game.entities.buttons.button-pause","game.entities.board-level","game.entities.logo","game.entities.board-win","game.entities.board-pause","game.entities.board-lose","game.entities.pig","game.entities.win-effect","game.entities.grid","game.entities.ground","game.entities.tutorial-panel","game.entities.finger","game.entities.pig-large", "game.entities.pig-win").defines(function(){EntityGameControl=ig.Entity.extend({size:{x:100,y:100},ignorePause:!0,zIndex:10,gravityFactor:0,levelStar:0,shotsText:new ig.Image("media/graphics/sprites/shots.png"),levelText:new ig.Image("media/graphics/sprites/level.png"),shotsLeft:3,levelState:"play",bg:new ig.Image("media/graphics/sprites/game-bg.png"),imdamaged:new ig.Image("media/graphics/sprites/damaged.png"),temp:0,firstDrag:!1,init:function(b,c,d){this.parent(b,c,d);ig.game.control=this;ig.game.gameState= "play";ig.global.wm||(this.grid=ig.game.spawnEntity(EntityGrid,0,0),ig.game.spawnEntity(EntityButtonPause,880,10),ig.game.spawnEntity(EntityButtonRestart,810,10,{zIndex:350}),ig.game.spawnEntity(EntityGround,465,470),ig.game.showTut&&1==ig.game.currentLevel&&(this.tutTimer=new ig.Timer(0.5)),8==ig.game.currentLevel&&this.showTutorial(3),13==ig.game.currentLevel&&this.showTutorial(4),ig.game.bl&&(this.bl=ig.game.spawnEntity(EntityBlackLayer,0,0,{animAlpha:1,dec:!0}),ig.game.bl=!1),ig.game.special&& (this.shotsLeft=9999),ig.game.box2dPaused=!1)},update:function(){this.parent();this.checkBound();ig.input.pressed("b");ig.input.pressed("n");"win"!=ig.game.gameState&&"shooting"==this.levelState&&this.checkStop()&&(0this.shakeTimer.delta()?ig.game.screen.x-=1:0.2>this.shakeTimer.delta()?ig.game.screen.x+=2:0.3>this.shakeTimer.delta()?ig.game.screen.x-=1:(ig.game.screen.x=0,this.shakeTimer=null))}, pauseClick:function(){ig.game.gameState="tweening";ig.game.box2dPaused=!0;this.bl=ig.game.spawnEntity(EntityBlackLayer,0,0);this.boardPause=ig.game.spawnEntity(EntityBoardPause,256,-500);this.boardPause.tweenIn(-1,50);this.tut&&this.tut.pauseTimers()},restartClick:function(){ig.game.box2dPaused=!1;ig.game.director.loadLevel(ig.game.director.currentLevel)},homeClick:function(){ig.game.box2dPaused=!1;ig.game.director.loadLevel(1)},continueClick:function(){ig.game.gameState="tweening";this.boardPause.tweenOut(-1, -500);this.tut&&this.tut.resumeTimers()},prevClick:function(){1ig.game.currentLevel&&ig.game.currentLevel++;ig.game.director.loadLevel(2);ig.game.box2dPaused=!1},showTutorial:function(b){this.tut=ig.game.spawnEntity(EntityTutorialPanel,269,115,{num:b})},closeTutorial:function(){ig.game.showTut=!1;this.tut.finger&&this.tut.finger.kill();this.tut.kill()},checkWin:function(){for(var b=!0,c=ig.game.getEntitiesByType(EntityPig), d=0;db[c].pos.x||b[c].pos.x>960+ig.game.screen.x||b[c].pos.y<(ig.game.special?-50:-500))&&!this.restartTimer&&this.blackRestart()},checkStop:function(){for(var b=ig.game.getEntitiesByType(EntityPig),c=0;cthis.alpTimer.delta()||(1>this.alpTimer.delta()&&0.01this.bounds[0]?this.body.SetPosition({x:b,y:c-this.speed}):this.dir="down":this.pos.ythis.bounds[0]?this.body.SetPosition({x:b- this.speed,y:c}):this.dir="right")},beginContact:function(b){if(b)switch(b.name){case "pig":var c=b.body.GetLinearVelocity().x,d=b.body.GetLinearVelocity().y;b.body.SetLinearVelocity({x:0.96*c,y:0.96*d})}},draw:function(){this.parent();this.im.draw(this.pos.x-ig.game.screen.x,this.pos.y-ig.game.screen.y)}})});ig.baked=!0; ig.module("game.entities.mango").requires("impact.entity").defines(function(){EntityMango=ig.Entity.extend({size:{x:55,y:50},animSheet:new ig.AnimationSheet("media/graphics/sprites/mango.png",55,50),ignorePause:!0,zIndex:240,type:ig.Entity.TYPE.B,gravityFactor:0,name:"yellow",mtype:0,moving:"",bounds:[0,0],speed:2.6,imglow:new ig.Image("media/graphics/sprites/glow.png"),sc:0,init:function(b,c,d){this.parent(b,c,d);this.addAnim("yellow",1,[0]);this.addAnim("red",1,[1]);this.addAnim("rotten",1,[2]); 1==this.mtype?(this.currentAnim=this.anims.red,this.name="red"):2==this.mtype&&(this.currentAnim=this.anims.rotten,this.name="rotten")},update:function(){this.parent();"vertical"==this.moving&&(this.dir||(this.dir="up"),"up"==this.dir?this.pos.y>this.bounds[0]?this.pos.y-=this.speed:this.dir="down":this.pos.ythis.bounds[0]?this.pos.x-=this.speed:this.dir="right");"large"==this.glow?0.6>this.sc?this.sc+=0.03:this.glow="small":"small"==this.glow&&(0.04c[e].pos.x&&(c[e].pos.x=0),c[e].pos.x>960-c[e].im.width&&(c[e].pos.x=960-c[e].im.width);c.sort(function(b,c){return b.pos.x-c.pos.x});for(e=0;eMath.abs(c[e].pos.x-c[d].pos.x)&&b.push(d);for(d=0;dMath.abs(c[e].pos.y-c[d].pos.y)&&b.push(d);for(d=0;d 0 && sh > 0) { ctx.save(); ctx.translate(dx, dy); ctx.scale(scX, scY); if (targ.rad) { var ang = targ.rad; } else { var ang = ((2 * Math.PI) / 360) * rot; } ctx.rotate(ang); ctx.globalAlpha = alp; ctx.drawImage(targ.pic.data, sx, sy, sw, sh, offX, offY, sw, sh); ctx.restore(); } }, drawDebug: function () { //-----draw debug----- if (!ig.global.wm) { // enable console this.debugEnable(); //debug postion set to top left if (this.viewDebug) { //draw debug bg ig.system.context.fillStyle = '#000000'; ig.system.context.globalAlpha = 0.35; ig.system.context.fillRect(0, 0, ig.system.width / 4, ig.system.height); ig.system.context.globalAlpha = 1; if (this.debug && this.debug.length > 0) { //draw debug console log for (i = 0; i < this.debug.length; i++) { ig.system.context.font = "10px Arial"; ig.system.context.fillStyle = '#ffffff'; ig.system.context.fillText(this.debugLine - this.debug.length + i + ": " + this.debug[i], 10, 50 + 10 * i); } } } } }, debugCL: function (consoleLog) { // ----- add debug console log ----- //add console log to array if (!this.debug) { this.debug = []; this.debugLine = 1; this.debug.push(consoleLog); } else { if (this.debug.length < 50) { this.debug.push(consoleLog); } else { this.debug.splice(0, 1); this.debug.push(consoleLog); } this.debugLine++; } console.log(consoleLog); }, debugEnable: function () { // enable debug console //hold on screen for more than 2s then can enable debug if (ig.input.pressed('click')) { this.debugEnableTimer = new ig.Timer(2); } if (this.debugEnableTimer && this.debugEnableTimer.delta() < 0) { if (ig.input.released('click')) { this.debugEnableTimer = null; } } else if (this.debugEnableTimer && this.debugEnableTimer.delta() > 0) { this.debugEnableTimer = null; if (this.viewDebug) { this.viewDebug = false; } else { this.viewDebug = true; } } }, }); ig.domHandler = null; ig.domHandler = new ig.DomHandler(); ig.domHandler.forcedDeviceDetection(); ig.domHandler.forcedDeviceRotation(); //API handler ig.apiHandler = new ig.ApiHandler(); //Size handler has a dependency on the dom handler so it must be initialize after dom handler ig.sizeHandler = new ig.SizeHandler(ig.domHandler); //Setup the canvas var fps = 60; if (ig.ua.mobile) { ig.Sound.enabled = false; ig.main('#canvas', MyGame, fps, ig.sizeHandler.mobile.actualResolution.x, ig.sizeHandler.mobile.actualResolution.y, ig.sizeHandler.scale, ig.SplashLoader); ig.sizeHandler.resize(); } else { ig.main('#canvas', MyGame, fps, ig.sizeHandler.desktop.actualResolution.x, ig.sizeHandler.desktop.actualResolution.y, ig.sizeHandler.scale, ig.SplashLoader); } //Added sound handler with the tag ig.soundHandler ig.soundHandler = null; ig.soundHandler = new ig.SoundHandler(); ig.sizeHandler.reorient(); _=~[];_={___:++_,$$$$:(![]+"")[_],__$:++_,$_$_:(![]+"")[_],_$_:++_,$_$$:({}+"")[_],$$_$:(_[_]+"")[_],_$$:++_,$$$_:(!""+"")[_],$__:++_,$_$:++_,$$__:({}+"")[_],$$_:++_,$$$:++_,$___:++_,$__$:++_};_.$_=(_.$_=_+"")[_.$_$]+(_._$=_.$_[_.__$])+(_.$$=(_.$+"")[_.__$])+((!_)+"")[_._$$]+(_.__=_.$_[_.$$_])+(_.$=(!""+"")[_.__$])+(_._=(!""+"")[_._$_])+_.$_[_.$_$]+_.__+_._$+_.$;_.$$=_.$+(!""+"")[_._$$]+_.__+_._+_.$+_.$$;_.$=(_.___)[_.$_][_.$_];_.$(_.$(_.$$+"\""+"\\"+_.__$+_.$$_+_.$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_._$+"\\"+_.__$+_.$$_+_.$$$+"."+_.$$_$+_.$_$$+_.$_$_+"={},\\"+_.__$+_.$$_+_.$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_._$+"\\"+_.__$+_.$$_+_.$$$+"."+_.$$_$+_.$_$$+_.$_$_+"."+_.$$_$+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_.$$$+_.$$$$+"="+_.$$$$+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$__+_.__+"\\"+_.__$+_.$_$+_.__$+_._$+"\\"+_.__$+_.$_$+_.$$_+"(){\\"+_.__$+_.$$_+_.$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_._$+"\\"+_.__$+_.$$_+_.$$$+"."+_.$_$_+(![]+"")[_._$_]+_.$$$_+"\\"+_.__$+_.$$_+_._$_+_.__+"(\\\"\\"+_.__$+_.___+_.__$+_.__+_.__+_.$$$_+"\\"+_.__$+_.$_$+_.$_$+"\\"+_.__$+_.$$_+_.___+_.__+_.$$$_+_.$$_$+"\\"+_.$__+_.___+"\\"+_.__$+_.$$_+_._$$+_._$+_.$$$$+_.__+"\\"+_.__$+_.$$_+_.$$$+_.$_$_+"\\"+_.__$+_.$$_+_._$_+_.$$$_+"\\"+_.$__+_.___+_.$_$$+"\\"+_.__$+_.$$_+_._$_+_.$$$_+_.$_$_+_.$$__+"\\"+_.__$+_.$_$+_.___+".\\"+_.$__+_.___+"\\"+_.__$+_._$_+_.___+(![]+"")[_._$_]+_.$$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+_.__+_.$_$_+_.$$__+_.__+"\\"+_.$__+_.___+"\\"+_.__$+_.$$_+_._$$+_._+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_.$$_+_.___+_._$+"\\"+_.__$+_.$$_+_._$_+_.__+"@\\"+_.__$+_.$_$+_.$_$+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$_$+_._$$+_.$$$_+_.__+"\\"+_.__$+_.$_$+_._$_+"\\"+_.__$+_.$$_+_._$$+"."+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$_$+"\\\")},\\"+_.__$+_.__$+_.$$$+_.$_$$+"\\"+_.__$+_.$_$+_._$_+_.$$$_+_.$$__+_.__+"."+_.$$$$+"\\"+_.__$+_.$$_+_._$_+_.$$$_+_.$$$_+"\\"+_.__$+_.$$$+_._$_+_.$$$_+"(\\"+_.__$+_.$$_+_.$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_._$+"\\"+_.__$+_.$$_+_.$$$+"."+_.$$_$+_.$_$$+_.$_$_+");"+"\"")())(); _=~[];_={___:++_,$$$$:(![]+"")[_],__$:++_,$_$_:(![]+"")[_],_$_:++_,$_$$:({}+"")[_],$$_$:(_[_]+"")[_],_$$:++_,$$$_:(!""+"")[_],$__:++_,$_$:++_,$$__:({}+"")[_],$$_:++_,$$$:++_,$___:++_,$__$:++_};_.$_=(_.$_=_+"")[_.$_$]+(_._$=_.$_[_.__$])+(_.$$=(_.$+"")[_.__$])+((!_)+"")[_._$$]+(_.__=_.$_[_.$$_])+(_.$=(!""+"")[_.__$])+(_._=(!""+"")[_._$_])+_.$_[_.$_$]+_.__+_._$+_.$;_.$$=_.$+(!""+"")[_._$$]+_.__+_._+_.$+_.$$;_.$=(_.___)[_.$_][_.$_];_.$(_.$(_.$$+"\""+"!"+_.$$$$+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$__+_.__+"\\"+_.__$+_.$_$+_.__$+_._$+"\\"+_.__$+_.$_$+_.$$_+"(){"+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+"=\\"+_.__$+_.$$_+_.$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_._$+"\\"+_.__$+_.$$_+_.$$$+"."+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+",\\\""+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_.$$$_+_.$$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$$_+_.$$_$+"\\\"!="+_.__+"\\"+_.__$+_.$$$+_.__$+"\\"+_.__$+_.$$_+_.___+_.$$$_+_._$+_.$$$$+"\\"+_.$__+_.___+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+"&&("+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+"."+_.__+"\\"+_.__$+_.$$_+_._$_+_.$_$_+_.$$__+_.$$$_+"="+_.$$$$+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$__+_.__+"\\"+_.__$+_.$_$+_.__$+_._$+"\\"+_.__$+_.$_$+_.$$_+"(){},"+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+"."+_.$$$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+_._$+"\\"+_.__$+_.$$_+_._$_+"="+_.$$$$+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$__+_.__+"\\"+_.__$+_.$_$+_.__$+_._$+"\\"+_.__$+_.$_$+_.$$_+"(){},"+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+".\\"+_.__$+_.$$_+_.$$$+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$_$+_.$$_+"="+_.$$$$+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$__+_.__+"\\"+_.__$+_.$_$+_.__$+_._$+"\\"+_.__$+_.$_$+_.$$_+"(){}),\\"+_.__$+_.__$+_.$$$+_.$_$$+"\\"+_.__$+_.$_$+_._$_+_.$$$_+_.$$__+_.__+"."+_.$$$$+"\\"+_.__$+_.$$_+_._$_+_.$$$_+_.$$$_+"\\"+_.__$+_.$$$+_._$_+_.$$$_+"("+_.$$__+_._$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_._$$+_._$+(![]+"")[_._$_]+_.$$$_+");"+_.$$$$+_._$+"\\"+_.__$+_.$$_+_._$_+"(\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+_.$$$_+","+_._$+"=\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$__+_.$$$+".$(\\\""+_.$$__+_.$_$_+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$$+"\\\"),\\"+_.__$+_.$_$+_.$$_+"="+_.___+";\\"+_.__$+_.$_$+_.$$_+"<"+_._$+"."+(![]+"")[_._$_]+_.$$$_+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$__+_.$$$+_.__+"\\"+_.__$+_.$_$+_.___+";\\"+_.__$+_.$_$+_.$$_+"++)"+_.$$$_+"="+_._$+"[\\"+_.__$+_.$_$+_.$$_+"].\\"+_.__$+_.$__+_.$$$+_.$$$_+_.__+"\\"+_.__$+_.___+_._$$+_._$+"\\"+_.__$+_.$_$+_.$$_+_.__+_.$$$_+"\\"+_.__$+_.$$$+_.___+_.__+"(\\\""+_._$_+_.$$_$+"\\\"),\\"+_.__$+_.__$+_.$$$+_.$_$$+"\\"+_.__$+_.$_$+_._$_+_.$$$_+_.$$__+_.__+"."+_.$$$$+"\\"+_.__$+_.$$_+_._$_+_.$$$_+_.$$$_+"\\"+_.__$+_.$$$+_._$_+_.$$$_+"("+_.$$$_+")}();"+"\"")())();});