diff -r 2937fe1ba865 -r b13a409f01dc integ/iri/js/vs.0.1-min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/integ/iri/js/vs.0.1-min.js Mon May 06 18:38:13 2013 +0200 @@ -0,0 +1,35 @@ +/* + * Visual Sedimentation Library v0.01 + * http://www.visualsedimentation.org/ + * + * Copyright 2013, Samuel Huron & Romain Vuillemont + * Licensed under the CeCILL-B or GPL Version 2 licenses. + * http://jquery.org/license + * + * + * + * + * + * Includes jquery.js + * http://jquery.com/ + * Copyright 2010, John Resig + * Released under Dual licensed under the MIT or GPL Version 2 licenses. + * + * Includes d3.js + * http://d3js.org/ + * Copyright 2012, Michael Bostock + * Released under BSD licenses. + * + * Includes Box2DWeb + * http://www.gphysics.com + * Copyright 2006, Erin Catto + * Released under zlib License. + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Tue Jan 01 14:25:48 2010 -0500 + */ +(function(Au,AD){function A6(){if(!AM.isReady){try{AE.documentElement.doScroll("left")}catch(A){setTimeout(A6,1);return}AM.ready()}}function AB(F,A){A.src?AM.ajax({url:A.src,async:false,dataType:"script"}):AM.globalEval(A.text||A.textContent||A.innerHTML||"");A.parentNode&&A.parentNode.removeChild(A)}function AU(F,A,O,K,L,G){var J=F.length;if(typeof A==="object"){for(var N in A){AU(F,N,A[N],K,L,O)}return F}if(O!==AD){K=!G&&K&&AM.isFunction(O);for(N=0;N)[^>]*$|^#([\w-]+)$/,Az=/^.[^:#\[\.,]*$/,AS=/\S/,AC=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,l=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Ad=navigator.userAgent,C=false,AZ=[],Ah,A7=Object.prototype.toString,A1=Object.prototype.hasOwnProperty,Ae=Array.prototype.push,AY=Array.prototype.slice,BC=Array.prototype.indexOf;AM.fn=AM.prototype={init:function(F,A){var J,G;if(!F){return this}if(F.nodeType){this.context=this[0]=F;this.length=1;return this}if(F==="body"&&!A){this.context=AE;this[0]=AE.body;this.selector="body";this.length=1;return this}if(typeof F==="string"){if((J=BD.exec(F))&&(J[1]||!A)){if(J[1]){G=A?A.ownerDocument||A:AE;if(F=l.exec(F)){if(AM.isPlainObject(A)){F=[AE.createElement(F[1])];AM.fn.attr.call(F,A,true)}else{F=[G.createElement(F[1])]}}else{F=A9([J[1]],[G]);F=(F.cacheable?F.fragment.cloneNode(true):F.fragment).childNodes}return AM.merge(this,F)}else{if(A=AE.getElementById(J[2])){if(A.id!==J[2]){return AX.find(F)}this.length=1;this[0]=A}this.context=AE;this.selector=F;return this}}else{if(!A&&/^\w+$/.test(F)){this.selector=F;this.context=AE;F=AE.getElementsByTagName(F);return AM.merge(this,F)}else{return !A||A.jquery?(A||AX).find(F):AM(A).find(F)}}}else{if(AM.isFunction(F)){return AX.ready(F)}}if(F.selector!==AD){this.selector=F.selector;this.context=F.context}return AM.makeArray(F,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return AY.call(this,0)},get:function(A){return A==null?this.toArray():A<0?this.slice(A)[0]:this[A]},pushStack:function(F,A,J){var G=AM();AM.isArray(F)?Ae.apply(G,F):AM.merge(G,F);G.prevObject=this;G.context=this.context;if(A==="find"){G.selector=this.selector+(this.selector?" ":"")+J}else{if(A){G.selector=this.selector+"."+A+"("+J+")"}}return G},each:function(F,A){return AM.each(this,F,A)},ready:function(A){AM.bindReady();if(AM.isReady){A.call(AE,AM)}else{AZ&&AZ.push(A)}return this},eq:function(A){return A===-1?this.slice(A):this.slice(A,+A+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(AY.apply(this,arguments),"slice",AY.call(arguments).join(","))},map:function(A){return this.pushStack(AM.map(this,function(F,G){return A.call(F,G,F)}))},end:function(){return this.prevObject||AM(null)},push:Ae,sort:[].sort,splice:[].splice};AM.fn.init.prototype=AM.fn;AM.extend=AM.fn.extend=function(){var F=arguments[0]||{},A=1,O=arguments.length,K=false,L,G,J,N;if(typeof F==="boolean"){K=F;F=arguments[1]||{};A=2}if(typeof F!=="object"&&!AM.isFunction(F)){F={}}if(O===A){F=this;--A}for(;A
a";var L=N.getElementsByTagName("*"),G=N.getElementsByTagName("a")[0];if(!(!L||!L.length||!G)){AM.support={leadingWhitespace:N.firstChild.nodeType===3,tbody:!N.getElementsByTagName("tbody").length,htmlSerialize:!!N.getElementsByTagName("link").length,style:/red/.test(G.getAttribute("style")),hrefNormalized:G.getAttribute("href")==="/a",opacity:/^0.55$/.test(G.style.opacity),cssFloat:!!G.style.cssFloat,checkOn:N.getElementsByTagName("input")[0].value==="on",optSelected:AE.createElement("select").appendChild(AE.createElement("option")).selected,parentNode:N.removeChild(N.appendChild(AE.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};O.type="text/javascript";try{O.appendChild(AE.createTextNode("window."+K+"=1;"))}catch(J){}P.insertBefore(O,P.firstChild);if(Au[K]){AM.support.scriptEval=true;delete Au[K]}try{delete O.test}catch(A){AM.support.deleteExpando=false}P.removeChild(O);if(N.attachEvent&&N.fireEvent){N.attachEvent("onclick",function F(){AM.support.noCloneEvent=false;N.detachEvent("onclick",F)});N.cloneNode(true).fireEvent("onclick")}N=AE.createElement("div");N.innerHTML="";P=AE.createDocumentFragment();P.appendChild(N.firstChild);AM.support.checkClone=P.cloneNode(true).cloneNode(true).lastChild.checked;AM(function(){var Q=AE.createElement("div");Q.style.width=Q.style.paddingLeft="1px";AE.body.appendChild(Q);AM.boxModel=AM.support.boxModel=Q.offsetWidth===2;AE.body.removeChild(Q).style.display="none"});P=function(Q){var T=AE.createElement("div");Q="on"+Q;var R=Q in T;if(!R){T.setAttribute(Q,"return;");R=typeof T[Q]==="function"}return R};AM.support.submitBubbles=P("submit");AM.support.changeBubbles=P("change");P=O=N=L=G=null}})();AM.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var An="jQuery"+Al(),E=0,Ay={};AM.extend({cache:{},expando:An,noData:{embed:true,object:true,applet:true},data:function(F,A,K){if(!(F.nodeName&&AM.noData[F.nodeName.toLowerCase()])){F=F==Au?Ay:F;var G=F[An],J=AM.cache;if(!G&&typeof A==="string"&&K===AD){return null}G||(G=++E);if(typeof A==="object"){F[An]=G;J[G]=AM.extend(true,{},A)}else{if(!J[G]){F[An]=G;J[G]={}}}F=J[G];if(K!==AD){F[A]=K}return typeof A==="string"?F[A]:F}},removeData:function(F,A){if(!(F.nodeName&&AM.noData[F.nodeName.toLowerCase()])){F=F==Au?Ay:F;var K=F[An],G=AM.cache,J=G[K];if(A){if(J){delete J[A];AM.isEmptyObject(J)&&AM.removeData(F)}}else{if(AM.support.deleteExpando){delete F[AM.expando]}else{F.removeAttribute&&F.removeAttribute(AM.expando)}delete G[K]}}}});AM.fn.extend({data:function(F,A){if(typeof F==="undefined"&&this.length){return AM.data(this[0])}else{if(typeof F==="object"){return this.each(function(){AM.data(this,F)})}}var J=F.split(".");J[1]=J[1]?"."+J[1]:"";if(A===AD){var G=this.triggerHandler("getData"+J[1]+"!",[J[0]]);if(G===AD&&this.length){G=AM.data(this[0],F)}return G===AD&&J[1]?this.data(J[0]):G}else{return this.trigger("setData"+J[1]+"!",[J[0],A]).each(function(){AM.data(this,F,A)})}},removeData:function(A){return this.each(function(){AM.removeData(this,A)})}});AM.extend({queue:function(F,A,J){if(F){A=(A||"fx")+"queue";var G=AM.data(F,A);if(!J){return G||[]}if(!G||AM.isArray(J)){G=AM.data(F,A,AM.makeArray(J))}else{G.push(J)}return G}},dequeue:function(F,A){A=A||"fx";var J=AM.queue(F,A),G=J.shift();if(G==="inprogress"){G=J.shift()}if(G){A==="fx"&&J.unshift("inprogress");G.call(F,function(){AM.dequeue(F,A)})}}});AM.fn.extend({queue:function(F,A){if(typeof F!=="string"){A=F;F="fx"}if(A===AD){return AM.queue(this[0],F)}return this.each(function(){var G=AM.queue(this,F,A);F==="fx"&&G[0]!=="inprogress"&&AM.dequeue(this,F)})},dequeue:function(A){return this.each(function(){AM.dequeue(this,A)})},delay:function(F,A){F=AM.fx?AM.fx.speeds[F]||F:F;A=A||"fx";return this.queue(A,function(){var G=this;setTimeout(function(){AM.dequeue(G,A)},F)})},clearQueue:function(A){return this.queue(A||"fx",[])}});var BI=/[\n\t]/g,AG=/\s+/,BE=/\r/g,As=/href|src|style/,A0=/(button|input)/i,Ac=/(button|input|object|select|textarea)/i,AF=/^(a|area)$/i,A4=/radio|checkbox/;AM.fn.extend({attr:function(F,A){return AU(this,F,A,true,AM.attr)},removeAttr:function(A){return this.each(function(){AM.attr(this,A,"");this.nodeType===1&&this.removeAttribute(A)})},addClass:function(P){if(AM.isFunction(P)){return this.each(function(R){var Q=AM(this);Q.addClass(P.call(this,R,Q.attr("class")))})}if(P&&typeof P==="string"){for(var O=(P||"").split(AG),N=0,K=this.length;N-1){return true}}return false},val:function(F){if(F===AD){var A=this[0];if(A){if(AM.nodeName(A,"option")){return(A.attributes.value||{}).specified?A.value:A.text}if(AM.nodeName(A,"select")){var O=A.selectedIndex,K=[],L=A.options;A=A.type==="select-one";if(O<0){return null}var G=A?O:0;for(O=A?O+1:L.length;G=0}else{if(AM.nodeName(this,"select")){var Q=AM.makeArray(R);AM("option",this).each(function(){this.selected=AM.inArray(AM(this).val(),Q)>=0});if(!Q.length){this.selectedIndex=-1}}else{this.value=R}}}})}});AM.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(F,A,L,J){if(!F||F.nodeType===3||F.nodeType===8){return AD}if(J&&A in AM.attrFn){return AM(F)[A](L)}J=F.nodeType!==1||!AM.isXMLDoc(F);var K=L!==AD;A=J&&AM.props[A]||A;if(F.nodeType===1){var G=As.test(A);if(A in F&&J&&!G){if(K){A==="type"&&A0.test(F.nodeName)&&F.parentNode&&AM.error("type property can't be changed");F[A]=L}if(AM.nodeName(F,"form")&&F.getAttributeNode(A)){return F.getAttributeNode(A).nodeValue}if(A==="tabIndex"){return(A=F.getAttributeNode("tabIndex"))&&A.specified?A.value:Ac.test(F.nodeName)||AF.test(F.nodeName)&&F.href?0:AD}return F[A]}if(!AM.support.style&&J&&A==="style"){if(K){F.style.cssText=""+L}return F.style.cssText}K&&F.setAttribute(A,""+L);F=!AM.support.hrefNormalized&&J&&G?F.getAttribute(A,2):F.getAttribute(A);return F===null?AD:F}return AM.style(F,A,L)}});var Af=/\.(.*)$/,m=function(A){return A.replace(/[^\w\s\.\|`]/g,function(F){return"\\"+F})};AM.event={add:function(T,R,P,N){if(!(T.nodeType===3||T.nodeType===8)){if(T.setInterval&&T!==Au&&!T.frameElement){T=Au}var O,K;if(P.handler){O=P;P=O.handler}if(!P.guid){P.guid=AM.guid++}if(K=AM.data(T)){var L=K.events=K.events||{},F=K.handle;if(!F){K.handle=F=function(){return typeof AM!=="undefined"&&!AM.event.triggered?AM.event.handle.apply(F.elem,arguments):AD}}F.elem=T;R=R.split(" ");for(var J,G=0,A;J=R[G++];){K=O?AM.extend({},O):{handler:P,data:N};if(J.indexOf(".")>-1){A=J.split(".");J=A.shift();K.namespace=A.slice(0).sort().join(".")}else{A=[];K.namespace=""}K.type=J;K.guid=P.guid;var V=L[J],Q=AM.event.special[J]||{};if(!V){V=L[J]=[];if(!Q.setup||Q.setup.call(T,N,A,F)===false){if(T.addEventListener){T.addEventListener(J,F,false)}else{T.attachEvent&&T.attachEvent("on"+J,F)}}}if(Q.add){Q.add.call(T,K);if(!K.handler.guid){K.handler.guid=P.guid}}V.push(K);AM.event.global[J]=true}T=null}}},global:{},remove:function(W,V,R,P){if(!(W.nodeType===3||W.nodeType===8)){var Q,N=0,O,J,L,K,A,X,T=AM.data(W),F=T&&T.events;if(T&&F){if(V&&V.type){R=V.handler;V=V.type}if(!V||typeof V==="string"&&V.charAt(0)==="."){V=V||"";for(Q in F){AM.event.remove(W,Q+V)}}else{for(V=V.split(" ");Q=V[N++];){K=Q;O=Q.indexOf(".")<0;J=[];if(!O){J=Q.split(".");Q=J.shift();L=new RegExp("(^|\\.)"+AM.map(J.slice(0).sort(),m).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=F[Q]){if(R){K=AM.event.special[Q]||{};for(G=P||0;G=0){Q.type=N=N.slice(0,-1);Q.exclusive=true}if(!O){Q.stopPropagation();AM.event.global[N]&&AM.each(AM.cache,function(){this.events&&this.events[N]&&AM.event.trigger(Q,P,this.handle.elem)})}if(!O||O.nodeType===3||O.nodeType===8){return AD}Q.result=AD;Q.target=O;P=AM.makeArray(P);P.unshift(Q)}Q.currentTarget=O;(L=AM.data(O,"handle"))&&L.apply(O,P);L=O.parentNode||O.ownerDocument;try{if(!(O&&O.nodeName&&AM.noData[O.nodeName.toLowerCase()])){if(O["on"+N]&&O["on"+N].apply(O,P)===false){Q.result=false}}}catch(J){}if(!Q.isPropagationStopped()&&L){AM.event.trigger(Q,P,L,true)}else{if(!Q.isDefaultPrevented()){L=Q.target;var K,A=AM.nodeName(L,"a")&&N==="click",G=AM.event.special[N]||{};if((!G._default||G._default.call(O,Q)===false)&&!A&&!(L&&L.nodeName&&AM.noData[L.nodeName.toLowerCase()])){try{if(L[N]){if(K=L["on"+N]){L["on"+N]=null}AM.event.triggered=true;L[N]()}}catch(F){}if(K){L["on"+N]=K}AM.event.triggered=false}}}},handle:function(F){var A,N,K,L;F=arguments[0]=AM.event.fix(F||Au.event);F.currentTarget=this;A=F.type.indexOf(".")<0&&!F.exclusive;if(!A){N=F.type.split(".");F.type=N.shift();K=new RegExp("(^|\\.)"+N.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}L=AM.data(this,"events");N=L[F.type];if(L&&N){N=N.slice(0);L=0;for(var G=N.length;L-1?AM.map(F.options,function(J){return J.selected}).join("-"):""}else{if(F.nodeName.toLowerCase()==="select"){G=F.selectedIndex}}}return G},BH=function(F,A){var K=F.target,G,J;if(!(!n.test(K.nodeName)||K.readOnly)){G=AM.data(K,"_change_data");J=U(K);if(F.type!=="focusout"||K.type!=="radio"){AM.data(K,"_change_data",J)}if(!(G===AD||J===G)){if(G!=null||J){F.type="change";return AM.event.trigger(F,A,K)}}}};AM.event.special.change={filters:{focusout:BH,click:function(F){var A=F.target,G=A.type;if(G==="radio"||G==="checkbox"||A.nodeName.toLowerCase()==="select"){return BH.call(this,F)}},keydown:function(F){var A=F.target,G=A.type;if(F.keyCode===13&&A.nodeName.toLowerCase()!=="textarea"||F.keyCode===32&&(G==="checkbox"||G==="radio")||G==="select-multiple"){return BH.call(this,F)}},beforeactivate:function(A){A=A.target;AM.data(A,"_change_data",U(A))}},setup:function(){if(this.type==="file"){return false}for(var A in I){AM.event.add(this,A+".specialChange",I[A])}return n.test(this.nodeName)},teardown:function(){AM.event.remove(this,".specialChange");return n.test(this.nodeName)}};I=AM.event.special.change.filters}AE.addEventListener&&AM.each({focus:"focusin",blur:"focusout"},function(F,A){function G(J){J=AM.event.fix(J);J.type=A;return AM.event.handle.call(this,J)}AM.event.special[A]={setup:function(){this.addEventListener(F,G,true)},teardown:function(){this.removeEventListener(F,G,true)}}});AM.each(["bind","one"],function(F,A){AM.fn[A]=function(O,K,L){if(typeof O==="object"){for(var G in O){this[A](G,K,O[G],L)}return this}if(AM.isFunction(K)){L=K;K=AD}var J=A==="one"?AM.proxy(L,function(P){AM(this).unbind(P,J);return L.apply(this,arguments)}):L;if(O==="unload"&&A!=="one"){this.one(O,K,L)}else{G=0;for(var N=this.length;G0){BT=BV;break}}}BV=BV[BS]}BP[Aa]=BT}}}var V=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,W=0,R=Object.prototype.toString,T=false,O=true;[0,0].sort(function(){O=false;return 0});var Q=function(BU,BT,BR,BQ){BR=BR||[];var Ab=BT=BT||AE;if(BT.nodeType!==1&&BT.nodeType!==9){return[]}if(!BU||typeof BU!=="string"){return BR}for(var BP=[],BZ,Ba,BW,BS,BY=true,BV=F(BT),BX=BU;(V.exec(""),BZ=V.exec(BX))!==null;){BX=BZ[3];BP.push(BZ[1]);if(BZ[2]){BS=BZ[3];break}}if(BP.length>1&&L.exec(BU)){if(BP.length===2&&P.relative[BP[0]]){Ba=w(BP[0]+BP[1],BT)}else{for(Ba=P.relative[BP[0]]?[BT]:Q(BP.shift(),BT);BP.length;){BU=BP.shift();if(P.relative[BU]){BU+=BP.shift()}Ba=w(BU,Ba)}}}else{if(!BQ&&BP.length>1&&BT.nodeType===9&&!BV&&P.match.ID.test(BP[0])&&!P.match.ID.test(BP[BP.length-1])){BZ=Q.find(BP.shift(),BT,BV);BT=BZ.expr?Q.filter(BZ.expr,BZ.set)[0]:BZ.set[0]}if(BT){BZ=BQ?{expr:BP.pop(),set:A(BQ)}:Q.find(BP.pop(),BP.length===1&&(BP[0]==="~"||BP[0]==="+")&&BT.parentNode?BT.parentNode:BT,BV);Ba=BZ.expr?Q.filter(BZ.expr,BZ.set):BZ.set;if(BP.length>0){BW=A(Ba)}else{BY=false}for(;BP.length;){var Aa=BP.pop();BZ=Aa;if(P.relative[Aa]){BZ=BP.pop()}else{Aa=""}if(BZ==null){BZ=BT}P.relative[Aa](BW,BZ,BV)}}else{BW=[]}}BW||(BW=Ba);BW||Q.error(Aa||BU);if(R.call(BW)==="[object Array]"){if(BY){if(BT&&BT.nodeType===1){for(BU=0;BW[BU]!=null;BU++){if(BW[BU]&&(BW[BU]===true||BW[BU].nodeType===1&&J(BT,BW[BU]))){BR.push(Ba[BU])}}}else{for(BU=0;BW[BU]!=null;BU++){BW[BU]&&BW[BU].nodeType===1&&BR.push(Ba[BU])}}}else{BR.push.apply(BR,BW)}}else{A(BW,BR)}if(BS){Q(BS,Ab,BR,BQ);Q.uniqueSort(BR)}return BR};Q.uniqueSort=function(Ab){if(N){T=O;Ab.sort(N);if(T){for(var Aa=1;Aa":function(BQ,BP){var Ab=typeof BP==="string";if(Ab&&!/\W/.test(BP)){BP=BP.toLowerCase();for(var Aa=0,BR=BQ.length;Aa=0)){Ab||Aa.push(BP)}else{if(Ab){BQ[BT]=false}}}}return false},ID:function(Aa){return Aa[1].replace(/\\/g,"")},TAG:function(Aa){return Aa[1].toLowerCase()},CHILD:function(Ab){if(Ab[1]==="nth"){var Aa=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(Ab[2]==="even"&&"2n"||Ab[2]==="odd"&&"2n+1"||!/\D/.test(Ab[2])&&"0n+"+Ab[2]||Ab[2]);Ab[2]=Aa[1]+(Aa[2]||1)-0;Ab[3]=Aa[3]-0}Ab[0]=W++;return Ab},ATTR:function(BQ,BP,Ab,Aa,BR,BS){BP=BQ[1].replace(/\\/g,"");if(!BS&&P.attrMap[BP]){BQ[1]=P.attrMap[BP]}if(BQ[2]==="~="){BQ[4]=" "+BQ[4]+" "}return BQ},PSEUDO:function(BQ,BP,Ab,Aa,BR){if(BQ[1]==="not"){if((V.exec(BQ[3])||"").length>1||/^\w/.test(BQ[3])){BQ[3]=Q(BQ[3],null,null,BP)}else{BQ=Q.filter(BQ[3],BP,Ab,true^BR);Ab||Aa.push.apply(Aa,BQ);return false}}else{if(P.match.POS.test(BQ[0])||P.match.CHILD.test(BQ[0])){return true}}return BQ},POS:function(Aa){Aa.unshift(true);return Aa}},filters:{enabled:function(Aa){return Aa.disabled===false&&Aa.type!=="hidden"},disabled:function(Aa){return Aa.disabled===true},checked:function(Aa){return Aa.checked===true},selected:function(Aa){return Aa.selected===true},parent:function(Aa){return !!Aa.firstChild},empty:function(Aa){return !Aa.firstChild},has:function(BP,Ab,Aa){return !!Q(Aa[3],BP).length},header:function(Aa){return/h\d/i.test(Aa.nodeName)},text:function(Aa){return"text"===Aa.type},radio:function(Aa){return"radio"===Aa.type},checkbox:function(Aa){return"checkbox"===Aa.type},file:function(Aa){return"file"===Aa.type},password:function(Aa){return"password"===Aa.type},submit:function(Aa){return"submit"===Aa.type},image:function(Aa){return"image"===Aa.type},reset:function(Aa){return"reset"===Aa.type},button:function(Aa){return"button"===Aa.type||Aa.nodeName.toLowerCase()==="button"},input:function(Aa){return/input|select|textarea|button/i.test(Aa.nodeName)}},setFilters:{first:function(Ab,Aa){return Aa===0},last:function(BQ,BP,Ab,Aa){return BP===Aa.length-1},even:function(Ab,Aa){return Aa%2===0},odd:function(Ab,Aa){return Aa%2===1},lt:function(BP,Ab,Aa){return AbAa[3]-0},nth:function(BP,Ab,Aa){return Aa[3]-0===Ab},eq:function(BP,Ab,Aa){return Aa[3]-0===Ab}},filter:{PSEUDO:function(BQ,BP,Ab,Aa){var BR=BP[1],BS=P.filters[BR];if(BS){return BS(BQ,Ab,BP,Aa)}else{if(BR==="contains"){return(BQ.textContent||BQ.innerText||Z([BQ])||"").indexOf(BP[3])>=0}else{if(BR==="not"){BP=BP[3];Ab=0;for(Aa=BP.length;Ab=0}},ID:function(Ab,Aa){return Ab.nodeType===1&&Ab.getAttribute("id")===Aa},TAG:function(Ab,Aa){return Aa==="*"&&Ab.nodeType===1||Ab.nodeName.toLowerCase()===Aa},CLASS:function(Ab,Aa){return(" "+(Ab.className||Ab.getAttribute("class"))+" ").indexOf(Aa)>-1},ATTR:function(BQ,BP){var Ab=BP[1];BQ=P.attrHandle[Ab]?P.attrHandle[Ab](BQ):BQ[Ab]!=null?BQ[Ab]:BQ.getAttribute(Ab);Ab=BQ+"";var Aa=BP[2];BP=BP[4];return BQ==null?Aa==="!=":Aa==="="?Ab===BP:Aa==="*="?Ab.indexOf(BP)>=0:Aa==="~="?(" "+Ab+" ").indexOf(BP)>=0:!BP?Ab&&BQ!==false:Aa==="!="?Ab!==BP:Aa==="^="?Ab.indexOf(BP)===0:Aa==="$="?Ab.substr(Ab.length-BP.length)===BP:Aa==="|="?Ab===BP||Ab.substr(0,BP.length+1)===BP+"-":false},POS:function(BQ,BP,Ab,Aa){var BR=P.setFilters[BP[2]];if(BR){return BR(BQ,Ab,BP,Aa)}}}},L=P.match.POS;for(var G in P.match){P.match[G]=new RegExp(P.match[G].source+/(?![^\[]*\])(?![^\(]*\))/.source);P.leftMatch[G]=new RegExp(/(^(?:.|\r|\n)*?)/.source+P.match[G].source.replace(/\\(\d+)/g,function(Ab,Aa){return"\\"+(Aa-0+1)}))}var A=function(Ab,Aa){Ab=Array.prototype.slice.call(Ab,0);if(Aa){Aa.push.apply(Aa,Ab);return Aa}return Ab};try{Array.prototype.slice.call(AE.documentElement.childNodes,0)}catch(K){A=function(BQ,BP){BP=BP||[];if(R.call(BQ)==="[object Array]"){Array.prototype.push.apply(BP,BQ)}else{if(typeof BQ.length==="number"){for(var Ab=0,Aa=BQ.length;Ab";var Aa=AE.documentElement;Aa.insertBefore(BP,Aa.firstChild);if(AE.getElementById(Ab)){P.find.ID=function(BQ,BR,BS){if(typeof BR.getElementById!=="undefined"&&!BS){return(BR=BR.getElementById(BQ[1]))?BR.id===BQ[1]||typeof BR.getAttributeNode!=="undefined"&&BR.getAttributeNode("id").nodeValue===BQ[1]?[BR]:AD:[]}};P.filter.ID=function(BQ,BR){var BS=typeof BQ.getAttributeNode!=="undefined"&&BQ.getAttributeNode("id");return BQ.nodeType===1&&BS&&BS.nodeValue===BR}}Aa.removeChild(BP);Aa=BP=null})();(function(){var Aa=AE.createElement("div");Aa.appendChild(AE.createComment(""));if(Aa.getElementsByTagName("*").length>0){P.find.TAG=function(BQ,BP){BP=BP.getElementsByTagName(BQ[1]);if(BQ[1]==="*"){BQ=[];for(var Ab=0;BP[Ab];Ab++){BP[Ab].nodeType===1&&BQ.push(BP[Ab])}BP=BQ}return BP}}Aa.innerHTML="";if(Aa.firstChild&&typeof Aa.firstChild.getAttribute!=="undefined"&&Aa.firstChild.getAttribute("href")!=="#"){P.attrHandle.href=function(Ab){return Ab.getAttribute("href",2)}}Aa=null})();AE.querySelectorAll&&function(){var BP=Q,Ab=AE.createElement("div");Ab.innerHTML="

";if(!(Ab.querySelectorAll&&Ab.querySelectorAll(".TEST").length===0)){Q=function(BQ,BT,BU,BR){BT=BT||AE;if(!BR&&BT.nodeType===9&&!F(BT)){try{return A(BT.querySelectorAll(BQ),BU)}catch(BS){}}return BP(BQ,BT,BU,BR)};for(var Aa in BP){Q[Aa]=BP[Aa]}Ab=null}}();(function(){var Aa=AE.createElement("div");Aa.innerHTML="
";if(!(!Aa.getElementsByClassName||Aa.getElementsByClassName("e").length===0)){Aa.lastChild.className="e";if(Aa.getElementsByClassName("e").length!==1){P.order.splice(1,0,"CLASS");P.find.CLASS=function(BQ,BP,Ab){if(typeof BP.getElementsByClassName!=="undefined"&&!Ab){return BP.getElementsByClassName(BQ[1])}};Aa=null}}})();var J=AE.compareDocumentPosition?function(Ab,Aa){return !!(Ab.compareDocumentPosition(Aa)&16)}:function(Ab,Aa){return Ab!==Aa&&(Ab.contains?Ab.contains(Aa):true)},F=function(Aa){return(Aa=(Aa?Aa.ownerDocument||Aa:0).documentElement)?Aa.nodeName!=="HTML":false},w=function(BQ,BP){var Ab=[],Aa="",BR;for(BP=BP.nodeType?[BP]:BP;BR=P.match.PSEUDO.exec(BQ);){Aa+=BR[0];BQ=BQ.replace(P.match.PSEUDO,"")}BQ=P.relative[BQ]?BQ+"*":BQ;BR=0;for(var BS=BP.length;BR=0===J})};AM.fn.extend({find:function(F){for(var A=this.pushStack("","find",F),N=0,K=0,L=this.length;K0){for(var G=N;G0},closest:function(P,O){if(AM.isArray(P)){var N=[],K=this[0],L,G={},J;if(K&&P.length){L=0;for(var A=P.length;L-1:AM(K).is(L)){N.push({selector:J,elem:K});delete G[J]}}K=K.parentNode}}return N}var F=AM.expr.match.POS.test(P)?AM(P,O||this.context):null;return this.map(function(R,Q){for(;Q&&Q.ownerDocument&&Q!==O;){if(F?F.index(Q)>-1:AM(Q).is(P)){return Q}Q=Q.parentNode}return null})},index:function(A){if(!A||typeof A==="string"){return AM.inArray(this[0],A?AM(A):this.parent().children())}return AM.inArray(A.jquery?A[0]:A,this)},add:function(F,A){F=typeof F==="string"?AM(F,A||this.context):AM.makeArray(F);A=AM.merge(this.get(),F);return this.pushStack(e(F[0])||e(A[0])?A:AM.unique(A))},andSelf:function(){return this.add(this.prevObject)}});AM.each({parent:function(A){return(A=A.parentNode)&&A.nodeType!==11?A:null},parents:function(A){return AM.dir(A,"parentNode")},parentsUntil:function(F,A,G){return AM.dir(F,"parentNode",G)},next:function(A){return AM.nth(A,2,"nextSibling")},prev:function(A){return AM.nth(A,2,"previousSibling")},nextAll:function(A){return AM.dir(A,"nextSibling")},prevAll:function(A){return AM.dir(A,"previousSibling")},nextUntil:function(F,A,G){return AM.dir(F,"nextSibling",G)},prevUntil:function(F,A,G){return AM.dir(F,"previousSibling",G)},siblings:function(A){return AM.sibling(A.parentNode.firstChild,A)},children:function(A){return AM.sibling(A.firstChild)},contents:function(A){return AM.nodeName(A,"iframe")?A.contentDocument||A.contentWindow.document:AM.makeArray(A.childNodes)}},function(F,A){AM.fn[F]=function(K,G){var J=AM.map(this,A,K);H.test(F)||(G=K);if(G&&typeof G==="string"){J=AM.filter(G,J)}J=this.length>1?AM.unique(J):J;if((this.length>1||A2.test(G))&&BF.test(F)){J=J.reverse()}return this.pushStack(J,F,AY.call(arguments).join(","))}});AM.extend({filter:function(F,A,G){if(G){F=":not("+F+")"}return AM.find.matches(F,A)},dir:function(F,A,J){var G=[];for(F=F[A];F&&F.nodeType!==9&&(J===AD||F.nodeType!==1||!AM(F).is(J));){F.nodeType===1&&G.push(F);F=F[A]}return G},nth:function(F,A,J){A=A||1;for(var G=0;F;F=F[J]){if(F.nodeType===1&&++G===A){break}}return F},sibling:function(F,A){for(var G=[];F;F=F.nextSibling){F.nodeType===1&&F!==A&&G.push(F)}return G}});var AN=/ jQuery\d+="(?:\d+|null)"/g,AW=/^\s+/,y=/(<([\w:]+)[^>]*?)\/>/g,Aj=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,f=/<([\w:]+)/,AH=/"},Ap={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};Ap.optgroup=Ap.option;Ap.tbody=Ap.tfoot=Ap.colgroup=Ap.caption=Ap.thead;Ap.th=Ap.td;if(!AM.support.htmlSerialize){Ap._default=[1,"div
","
"]}AM.fn.extend({text:function(A){if(AM.isFunction(A)){return this.each(function(F){var G=AM(this);G.text(A.call(this,F,G.text()))})}if(typeof A!=="object"&&A!==AD){return this.empty().append((this[0]&&this[0].ownerDocument||AE).createTextNode(A))}return AM.text(this)},wrapAll:function(F){if(AM.isFunction(F)){return this.each(function(G){AM(this).wrapAll(F.call(this,G))})}if(this[0]){var A=AM(F,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&A.insertBefore(this[0]);A.map(function(){for(var G=this;G.firstChild&&G.firstChild.nodeType===1;){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(A){if(AM.isFunction(A)){return this.each(function(F){AM(this).wrapInner(A.call(this,F))})}return this.each(function(){var F=AM(this),G=F.contents();G.length?G.wrapAll(A):F.append(A)})},wrap:function(A){return this.each(function(){AM(this).wrapAll(A)})},unwrap:function(){return this.parent().each(function(){AM.nodeName(this,"body")||AM(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.appendChild(A)})},prepend:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.insertBefore(A,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this)})}else{if(arguments.length){var A=AM(arguments[0]);A.push.apply(A,this.toArray());return this.pushStack(A,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this.nextSibling)})}else{if(arguments.length){var A=this.pushStack(this,"after",arguments);A.push.apply(A,AM(arguments[0]).toArray());return A}}},remove:function(F,A){for(var J=0,G;(G=this[J])!=null;J++){if(!F||AM.filter(F,[G]).length){if(!A&&G.nodeType===1){AM.cleanData(G.getElementsByTagName("*"));AM.cleanData([G])}G.parentNode&&G.parentNode.removeChild(G)}}return this},empty:function(){for(var F=0,A;(A=this[F])!=null;F++){for(A.nodeType===1&&AM.cleanData(A.getElementsByTagName("*"));A.firstChild;){A.removeChild(A.firstChild)}}return this},clone:function(F){var A=this.map(function(){if(!AM.support.noCloneEvent&&!AM.isXMLDoc(this)){var J=this.outerHTML,G=this.ownerDocument;if(!J){J=G.createElement("div");J.appendChild(this.cloneNode(true));J=J.innerHTML}return AM.clean([J.replace(AN,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(AW,"")],G)[0]}else{return this.cloneNode(true)}});if(F===true){BN(this,A);BN(this.find("*"),A.find("*"))}return A},html:function(F){if(F===AD){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(AN,""):null}else{if(typeof F==="string"&&!Av.test(F)&&(AM.support.leadingWhitespace||!AW.test(F))&&!Ap[(f.exec(F)||["",""])[1].toLowerCase()]){F=F.replace(y,BO);try{for(var A=0,J=this.length;A0||O.cacheable||this.length>1?J.cloneNode(true):J)}}F.length&&AM.each(F,AB)}return this}});AM.fragments={};AM.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(F,A){AM.fn[F]=function(N){var K=[];N=AM(N);var L=this.length===1&&this[0].parentNode;if(L&&L.nodeType===11&&L.childNodes.length===1&&N.length===1){N[A](this[0]);return this}else{L=0;for(var G=N.length;L0?this.clone(true):this).get();AM.fn[A].apply(AM(N[L]),J);K=K.concat(J)}return this.pushStack(K,F,N.selector)}}});AM.extend({clean:function(R,Q,P,N){Q=Q||AE;if(typeof Q.createElement==="undefined"){Q=Q.ownerDocument||Q[0]&&Q[0].ownerDocument||AE}for(var O=[],K=0,L;(L=R[K])!=null;K++){if(typeof L==="number"){L+=""}if(L){if(typeof L==="string"&&!o.test(L)){L=Q.createTextNode(L)}else{if(typeof L==="string"){L=L.replace(y,BO);var F=(f.exec(L)||["",""])[1].toLowerCase(),J=Ap[F]||Ap._default,G=J[0],A=Q.createElement("div");for(A.innerHTML=J[1]+L+J[2];G--;){A=A.lastChild}if(!AM.support.tbody){G=AH.test(L);F=F==="table"&&!G?A.firstChild&&A.firstChild.childNodes:J[1]===""&&!G?A.childNodes:[];for(J=F.length-1;J>=0;--J){AM.nodeName(F[J],"tbody")&&!F[J].childNodes.length&&F[J].parentNode.removeChild(F[J])}}!AM.support.leadingWhitespace&&AW.test(L)&&A.insertBefore(Q.createTextNode(AW.exec(L)[0]),A.firstChild);L=A.childNodes}}if(L.nodeType){O.push(L)}else{O=AM.merge(O,L)}}}if(P){for(K=0;O[K];K++){if(N&&AM.nodeName(O[K],"script")&&(!O[K].type||O[K].type.toLowerCase()==="text/javascript")){N.push(O[K].parentNode?O[K].parentNode.removeChild(O[K]):O[K])}else{O[K].nodeType===1&&O.splice.apply(O,[K+1,0].concat(AM.makeArray(O[K].getElementsByTagName("script"))));P.appendChild(O[K])}}}return O},cleanData:function(P){for(var O,N,K=AM.cache,L=AM.event.special,G=AM.support.deleteExpando,J=0,A;(A=P[J])!=null;J++){if(N=A[AM.expando]){O=K[N];if(O.events){for(var F in O.events){L[F]?AM.event.remove(A,F):Am(A,F,O.handle)}}if(G){delete A[AM.expando]}else{A.removeAttribute&&A.removeAttribute(AM.expando)}delete K[N]}}}});var M=/z-?index|font-?weight|opacity|zoom|line-?height/i,BA=/alpha\([^)]*\)/,Aw=/opacity=([^)]*)/,Ak=/float/i,AI=/-([a-z])/ig,BJ=/([A-Z])/g,A5=/^-?\d+(?:px)?$/i,Ao=/^-?\d/,AK={position:"absolute",visibility:"hidden",display:"block"},u=["Left","Right"],b=["Top","Bottom"],BM=AE.defaultView&&AE.defaultView.getComputedStyle,AQ=AM.support.cssFloat?"cssFloat":"styleFloat",p=function(F,A){return A.toUpperCase()};AM.fn.css=function(F,A){return AU(this,F,A,true,function(K,G,J){if(J===AD){return AM.curCSS(K,G)}if(typeof J==="number"&&!M.test(G)){J+="px"}AM.style(K,G,J)})};AM.extend({style:function(F,A,K){if(!F||F.nodeType===3||F.nodeType===8){return AD}if((A==="width"||A==="height")&&parseFloat(K)<0){K=AD}var G=F.style||F,J=K!==AD;if(!AM.support.opacity&&A==="opacity"){if(J){G.zoom=1;A=parseInt(K,10)+""==="NaN"?"":"alpha(opacity="+K*100+")";F=G.filter||AM.curCSS(F,"filter")||"";G.filter=BA.test(F)?F.replace(BA,A):A}return G.filter&&G.filter.indexOf("opacity=")>=0?parseFloat(Aw.exec(G.filter)[1])/100+"":""}if(Ak.test(A)){A=AQ}A=A.replace(AI,p);if(J){G[A]=K}return G[A]},css:function(F,A,N,K){if(A==="width"||A==="height"){var L,G=A==="width"?u:b;function J(){L=A==="width"?F.offsetWidth:F.offsetHeight;K!=="border"&&AM.each(G,function(){K||(L-=parseFloat(AM.curCSS(F,"padding"+this,true))||0);if(K==="margin"){L+=parseFloat(AM.curCSS(F,"margin"+this,true))||0}else{L-=parseFloat(AM.curCSS(F,"border"+this+"Width",true))||0}})}F.offsetWidth!==0?J():AM.swap(F,AK,J);return Math.max(0,Math.round(L))}return AM.curCSS(F,A,N)},curCSS:function(F,A,L){var J,K=F.style;if(!AM.support.opacity&&A==="opacity"&&F.currentStyle){J=Aw.test(F.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return J===""?"1":J}if(Ak.test(A)){A=AQ}if(!L&&K&&K[A]){J=K[A]}else{if(BM){if(Ak.test(A)){A="float"}A=A.replace(BJ,"-$1").toLowerCase();K=F.ownerDocument.defaultView;if(!K){return null}if(F=K.getComputedStyle(F,null)){J=F.getPropertyValue(A)}if(A==="opacity"&&J===""){J="1"}}else{if(F.currentStyle){L=A.replace(AI,p);J=F.currentStyle[A]||F.currentStyle[L];if(!A5.test(J)&&Ao.test(J)){A=K.left;var G=F.runtimeStyle.left;F.runtimeStyle.left=F.currentStyle.left;K.left=L==="fontSize"?"1em":J||0;J=K.pixelLeft+"px";K.left=A;F.runtimeStyle.left=G}}}}return J},swap:function(F,A,K){var G={};for(var J in A){G[J]=F.style[J];F.style[J]=A[J]}K.call(F);for(J in A){F.style[J]=G[J]}}});if(AM.expr&&AM.expr.filters){AM.expr.filters.hidden=function(F){var A=F.offsetWidth,J=F.offsetHeight,G=F.nodeName.toLowerCase()==="tr";return A===0&&J===0&&!G?true:A>0&&J>0&&!G?false:AM.curCSS(F,"display")==="none"};AM.expr.filters.visible=function(A){return !AM.expr.filters.hidden(A)}}var A8=Al(),At=//gi,AO=/select|textarea/i,z=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,Ag=/=\?(&|$)/,S=/\?/,g=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,BB=/%20/g,Ax=AM.fn.load;AM.fn.extend({load:function(F,A,L){if(typeof F!=="string"){return Ax.call(this,F)}else{if(!this.length){return this}}var J=F.indexOf(" ");if(J>=0){var K=F.slice(J,F.length);F=F.slice(0,J)}J="GET";if(A){if(AM.isFunction(A)){L=A;A=null}else{if(typeof A==="object"){A=AM.param(A,AM.ajaxSettings.traditional);J="POST"}}}var G=this;AM.ajax({url:F,type:J,dataType:"html",data:A,complete:function(N,O){if(O==="success"||O==="notmodified"){G.html(K?AM("
").append(N.responseText.replace(At,"")).find(K):N.responseText)}L&&G.each(L,[N.responseText,O,N])}});return this},serialize:function(){return AM.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?AM.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||AO.test(this.nodeName)||z.test(this.type))}).map(function(F,A){F=AM(this).val();return F==null?null:AM.isArray(F)?AM.map(F,function(G){return{name:A.name,value:G}}):{name:A.name,value:F}}).get()}});AM.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(F,A){AM.fn[A]=function(G){return this.bind(A,G)}});AM.extend({get:function(F,A,J,G){if(AM.isFunction(A)){G=G||J;J=A;A=null}return AM.ajax({type:"GET",url:F,data:A,success:J,dataType:G})},getScript:function(F,A){return AM.get(F,null,A,"script")},getJSON:function(F,A,G){return AM.get(F,A,G,"json")},post:function(F,A,J,G){if(AM.isFunction(A)){G=G||J;J=A;A={}}return AM.ajax({type:"POST",url:F,data:A,success:J,dataType:G})},ajaxSetup:function(A){AM.extend(AM.ajaxSettings,A)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:Au.XMLHttpRequest&&(Au.location.protocol!=="file:"||!Au.ActiveXObject)?function(){return new Au.XMLHttpRequest}:function(){try{return new Au.ActiveXObject("Microsoft.XMLHTTP")}catch(A){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(BP){function Ab(){w.success&&w.success.call(T,O,W,F);w.global&&Z("ajaxSuccess",[F,w])}function Aa(){w.complete&&w.complete.call(T,F,W);w.global&&Z("ajaxComplete",[F,w]);w.global&&!--AM.active&&AM.event.trigger("ajaxStop")}function Z(BR,BS){(w.context?AM(w.context):AM.event).trigger(BR,BS)}var w=AM.extend(true,{},AM.ajaxSettings,BP),V,W,O,T=BP&&BP.context||w,P=w.type.toUpperCase();if(w.data&&w.processData&&typeof w.data!=="string"){w.data=AM.param(w.data,w.traditional)}if(w.dataType==="jsonp"){if(P==="GET"){Ag.test(w.url)||(w.url+=(S.test(w.url)?"&":"?")+(w.jsonp||"callback")+"=?")}else{if(!w.data||!Ag.test(w.data)){w.data=(w.data?w.data+"&":"")+(w.jsonp||"callback")+"=?"}}w.dataType="json"}if(w.dataType==="json"&&(w.data&&Ag.test(w.data)||Ag.test(w.url))){V=w.jsonpCallback||"jsonp"+A8++;if(w.data){w.data=(w.data+"").replace(Ag,"="+V+"$1")}w.url=w.url.replace(Ag,"="+V+"$1");w.dataType="script";Au[V]=Au[V]||function(BR){O=BR;Ab();Aa();Au[V]=AD;try{delete Au[V]}catch(BS){}A&&A.removeChild(K)}}if(w.dataType==="script"&&w.cache===null){w.cache=false}if(w.cache===false&&P==="GET"){var L=Al(),G=w.url.replace(g,"$1_="+L+"$2");w.url=G+(G===w.url?(S.test(w.url)?"&":"?")+"_="+L:"")}if(w.data&&P==="GET"){w.url+=(S.test(w.url)?"&":"?")+w.data}w.global&&!AM.active++&&AM.event.trigger("ajaxStart");L=(L=B.exec(w.url))&&(L[1]&&L[1]!==location.protocol||L[2]!==location.host);if(w.dataType==="script"&&P==="GET"&&L){var A=AE.getElementsByTagName("head")[0]||AE.documentElement,K=AE.createElement("script");K.src=w.url;if(w.scriptCharset){K.charset=w.scriptCharset}if(!V){var N=false;K.onload=K.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){N=true;Ab();Aa();K.onload=K.onreadystatechange=null;A&&K.parentNode&&A.removeChild(K)}}}A.insertBefore(K,A.firstChild);return AD}var J=false,F=w.xhr();if(F){w.username?F.open(P,w.url,w.async,w.username,w.password):F.open(P,w.url,w.async);try{if(w.data||BP&&BP.contentType){F.setRequestHeader("Content-Type",w.contentType)}if(w.ifModified){AM.lastModified[w.url]&&F.setRequestHeader("If-Modified-Since",AM.lastModified[w.url]);AM.etag[w.url]&&F.setRequestHeader("If-None-Match",AM.etag[w.url])}L||F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.setRequestHeader("Accept",w.dataType&&w.accepts[w.dataType]?w.accepts[w.dataType]+", */*":w.accepts._default)}catch(BQ){}if(w.beforeSend&&w.beforeSend.call(T,F,w)===false){w.global&&!--AM.active&&AM.event.trigger("ajaxStop");F.abort();return false}w.global&&Z("ajaxSend",[F,w]);var Y=F.onreadystatechange=function(BS){if(!F||F.readyState===0||BS==="abort"){J||Aa();J=true;if(F){F.onreadystatechange=AM.noop}}else{if(!J&&F&&(F.readyState===4||BS==="timeout")){J=true;F.onreadystatechange=AM.noop;W=BS==="timeout"?"timeout":!AM.httpSuccess(F)?"error":w.ifModified&&AM.httpNotModified(F,w.url)?"notmodified":"success";var BT;if(W==="success"){try{O=AM.httpData(F,w.dataType,w)}catch(BR){W="parsererror";BT=BR}}if(W==="success"||W==="notmodified"){V||Ab()}else{AM.handleError(w,F,W,BT)}Aa();BS==="timeout"&&F.abort();if(w.async){F=null}}}};try{var X=F.abort;F.abort=function(){F&&X.call(F);Y("abort")}}catch(R){}w.async&&w.timeout>0&&setTimeout(function(){F&&!J&&Y("timeout")},w.timeout);try{F.send(P==="POST"||P==="PUT"||P==="DELETE"?w.data:null)}catch(Q){AM.handleError(w,F,null,Q);Aa()}w.async||Y();return F}},handleError:function(F,A,J,G){if(F.error){F.error.call(F.context||F,A,J,G)}if(F.global){(F.context?AM(F.context):AM.event).trigger("ajaxError",[A,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol==="file:"||F.status>=200&&F.status<300||F.status===304||F.status===1223||F.status===0}catch(A){}return false},httpNotModified:function(F,A){var J=F.getResponseHeader("Last-Modified"),G=F.getResponseHeader("Etag");if(J){AM.lastModified[A]=J}if(G){AM.etag[A]=G}return F.status===304||F.status===0},httpData:function(F,A,K){var G=F.getResponseHeader("content-type")||"",J=A==="xml"||!A&&G.indexOf("xml")>=0;F=J?F.responseXML:F.responseText;J&&F.documentElement.nodeName==="parsererror"&&AM.error("parsererror");if(K&&K.dataFilter){F=K.dataFilter(F,A)}if(typeof F==="string"){if(A==="json"||!A&&G.indexOf("json")>=0){F=AM.parseJSON(F)}else{if(A==="script"||!A&&G.indexOf("javascript")>=0){AM.globalEval(F)}}}return F},param:function(F,A){function L(N,O){if(AM.isArray(O)){AM.each(O,function(P,Q){A||/\[\]$/.test(N)?J(N,Q):L(N+"["+(typeof Q==="object"||AM.isArray(Q)?P:"")+"]",Q)})}else{!A&&O!=null&&typeof O==="object"?AM.each(O,function(P,Q){L(N+"["+P+"]",Q)}):J(N,O)}}function J(N,O){O=AM.isFunction(O)?O():O;K[K.length]=encodeURIComponent(N)+"="+encodeURIComponent(O)}var K=[];if(A===AD){A=AM.ajaxSettings.traditional}if(AM.isArray(F)||F.jquery){AM.each(F,function(){J(this.name,this.value)})}else{for(var G in F){L(G,F[G])}}return K.join("&").replace(BB,"+")}});var BK={},BG=/toggle|show|hide/,A3=/^([+-]=)?([\d+-.]+)(.*)$/,AV,AA=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];AM.fn.extend({show:function(F,A){if(F||F===0){return this.animate(Ai("show",3),F,A)}else{F=0;for(A=this.length;F").appendTo("body");G=J.css("display");if(G==="none"){G="block"}J.remove();BK[K]=G}AM.data(this[F],"olddisplay",G)}}F=0;for(A=this.length;F=0;J--){if(G[J].elem===this){A&&G[J](true);G.splice(J,1)}}});A||this.dequeue();return this}});AM.each({slideDown:Ai("show",1),slideUp:Ai("hide",1),slideToggle:Ai("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(F,A){AM.fn[F]=function(J,G){return this.animate(A,J,G)}});AM.extend({speed:function(F,A,J){var G=F&&typeof F==="object"?F:{complete:J||!J&&A||AM.isFunction(F)&&F,duration:F,easing:J&&A||A&&!AM.isFunction(A)&&A};G.duration=AM.fx.off?0:typeof G.duration==="number"?G.duration:AM.fx.speeds[G.duration]||AM.fx.speeds._default;G.old=G.complete;G.complete=function(){G.queue!==false&&AM(this).dequeue();AM.isFunction(G.old)&&G.old.call(this)};return G},easing:{linear:function(F,A,J,G){return J+G*F},swing:function(F,A,J,G){return(-Math.cos(F*Math.PI)/2+0.5)*G+J}},timers:[],fx:function(F,A,G){this.options=A;this.elem=F;this.prop=G;if(!A.orig){A.orig={}}}});AM.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(AM.fx.step[this.prop]||AM.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(A){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}return(A=parseFloat(AM.css(this.elem,this.prop,A)))&&A>-10000?A:parseFloat(AM.curCSS(this.elem,this.prop))||0},custom:function(F,A,K){function G(L){return J.step(L)}this.startTime=Al();this.start=F;this.end=A;this.unit=K||this.unit||"px";this.now=this.start;this.pos=this.state=0;var J=this;G.elem=this.elem;if(G()&&AM.timers.push(G)&&!AV){AV=setInterval(AM.fx.tick,13)}},show:function(){this.options.orig[this.prop]=AM.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());AM(this.elem).show()},hide:function(){this.options.orig[this.prop]=AM.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(F){var A=Al(),K=true;if(F||A>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var G in this.options.curAnim){if(this.options.curAnim[G]!==true){K=false}}if(K){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;F=AM.data(this.elem,"olddisplay");this.elem.style.display=F?F:this.options.display;if(AM.css(this.elem,"display")==="none"){this.elem.style.display="block"}}this.options.hide&&AM(this.elem).hide();if(this.options.hide||this.options.show){for(var J in this.options.curAnim){AM.style(this.elem,J,this.options.orig[J])}}this.options.complete.call(this.elem)}return false}else{J=A-this.startTime;this.state=J/this.options.duration;F=this.options.easing||(AM.easing.swing?"swing":"linear");this.pos=AM.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||F](this.state,J,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};AM.extend(AM.fx,{tick:function(){for(var F=AM.timers,A=0;A
";F.insertBefore(A,F.firstChild);L=A.firstChild;J=L.firstChild;K=L.nextSibling.firstChild.firstChild;this.doesNotAddBorder=J.offsetTop!==5;this.doesAddBorderForTableAndCells=K.offsetTop===5;J.style.position="fixed";J.style.top="20px";this.supportsFixedPosition=J.offsetTop===20||J.offsetTop===15;J.style.position=J.style.top="";L.style.overflow="hidden";L.style.position="relative";this.subtractsBorderForOverflowNotVisible=J.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=F.offsetTop!==G;F.removeChild(A);AM.offset.initialize=AM.noop},bodyOffset:function(F){var A=F.offsetTop,G=F.offsetLeft;AM.offset.initialize();if(AM.offset.doesNotIncludeMarginInBodyOffset){A+=parseFloat(AM.curCSS(F,"marginTop",true))||0;G+=parseFloat(AM.curCSS(F,"marginLeft",true))||0}return{top:A,left:G}},setOffset:function(F,A,N){if(/static/.test(AM.curCSS(F,"position"))){F.style.position="relative"}var K=AM(F),L=K.offset(),G=parseInt(AM.curCSS(F,"top",true),10)||0,J=parseInt(AM.curCSS(F,"left",true),10)||0;if(AM.isFunction(A)){A=A.call(F,N,L)}N={top:A.top-L.top+G,left:A.left-L.left+J};"using" in A?A.using.call(F,N):K.css(N)}};AM.fn.extend({position:function(){if(!this[0]){return null}var F=this[0],A=this.offsetParent(),J=this.offset(),G=/^body|html$/i.test(A[0].nodeName)?{top:0,left:0}:A.offset();J.top-=parseFloat(AM.curCSS(F,"marginTop",true))||0;J.left-=parseFloat(AM.curCSS(F,"marginLeft",true))||0;G.top+=parseFloat(AM.curCSS(A[0],"borderTopWidth",true))||0;G.left+=parseFloat(AM.curCSS(A[0],"borderLeftWidth",true))||0;return{top:J.top-G.top,left:J.left-G.left}},offsetParent:function(){return this.map(function(){for(var A=this.offsetParent||AE.body;A&&!/^body|html$/i.test(A.nodeName)&&AM.css(A,"position")==="static";){A=A.offsetParent}return A})}});AM.each(["Left","Top"],function(F,A){var G="scroll"+A;AM.fn[G]=function(K){var L=this[0],J;if(!L){return null}if(K!==AD){return this.each(function(){if(J=h(this)){J.scrollTo(!F?K:AM(J).scrollLeft(),F?K:AM(J).scrollTop())}else{this[G]=K}})}else{return(J=h(L))?"pageXOffset" in J?J[F?"pageYOffset":"pageXOffset"]:AM.support.boxModel&&J.document.documentElement[G]||J.document.body[G]:L[G]}}});AM.each(["Height","Width"],function(F,A){var G=A.toLowerCase();AM.fn["inner"+A]=function(){return this[0]?AM.css(this[0],G,false,"padding"):null};AM.fn["outer"+A]=function(J){return this[0]?AM.css(this[0],G,false,J?"margin":"border"):null};AM.fn[G]=function(J){var K=this[0];if(!K){return J==null?null:this}if(AM.isFunction(J)){return this.each(function(L){var N=AM(this);N[G](J.call(this,L,N[G]()))})}return"scrollTo" in K&&K.document?K.document.compatMode==="CSS1Compat"&&K.document.documentElement["client"+A]||K.document.body["client"+A]:K.nodeType===9?Math.max(K.documentElement["client"+A],K.body["scroll"+A],K.documentElement["scroll"+A],K.body["offset"+A],K.documentElement["offset"+A]):J===AD?AM.css(K,G):this.css(G,typeof J==="string"?J:J+"px")}});Au.jQuery=Au.$=AM})(window);(function(){if(!Date.now){Date.now=function(){return +new Date}}try{document.createElement("div").style.setProperty("opacity",0,"")}catch(DF){var Bv=CSSStyleDeclaration.prototype,D4=Bv.setProperty;Bv.setProperty=function(e,Ew,Ev){D4.call(this,e,Ew+"",Ev)}}d3={version:"2.8.1"};function Ep(Ex,Ew){try{for(var Ev in Ew){Object.defineProperty(Ex.prototype,Ev,{value:Ew[Ev],enumerable:false})}}catch(Ey){Ex.prototype=Ew}}var B2=At;function En(Ev){var e=-1,Ex=Ev.length,Ew=[];while(++ee?1:Ev>=e?0:NaN};d3.descending=function(Ev,e){return eEv?1:e>=Ev?0:NaN};d3.mean=function(E0,Ey){var Ez=E0.length,Ev,e=0,Ex=-1,Ew=0;if(arguments.length===1){while(++Ex1){Ev=Ev.map(e)}Ev=Ev.filter(ET);return Ev.length?d3.quantile(Ev.sort(d3.ascending),0.5):undefined};d3.min=function(Ez,Ex){var Ew=-1,Ey=Ez.length,Ev,e;if(arguments.length===1){while(++Ewe){Ev=e}}}else{while(++Ewe){Ev=e}}}return Ev};d3.max=function(Ez,Ex){var Ew=-1,Ey=Ez.length,Ev,e;if(arguments.length===1){while(++EwEv){Ev=e}}}else{while(++EwEv){Ev=e}}}return Ev};d3.extent=function(E0,Ex){var Ew=-1,Ez=E0.length,Ev,e,Ey;if(arguments.length===1){while(++Ewe){Ev=e}if(Eye){Ev=e}if(Ey1);return e+Ev*Ew*Math.sqrt(-2*Math.log(Ex)/Ex)}}};function ET(e){return e!=null&&!isNaN(e)}d3.sum=function(Ez,Ex){var Ew=0,Ey=Ez.length,e,Ev=-1;if(arguments.length===1){while(++Ev>1;if(e.call(Ew,Ew[Ex],Ex)>1;if(Ev0){Ev=e}}return Ev};d3.last=function(Ez,Ex){var Ew=0,Ey=Ez.length,Ev=Ez[0],e;if(arguments.length===1){Ex=d3.ascending}while(++Ew=Ew.length){return Ey?Ey.call(Ex,E8):(Ev?E8.sort(Ev):E8)}var E7=-1,E2=E8.length,FA=Ew[E6++],E5,E4,E3=new AK,E9,E1={};while(++E7=Ew.length){return E4}var E1=[],E2=E0[E5++],E3;for(E3 in E4){E1.push({key:E3,values:e(E4[E3],E5)})}if(E2){E1.sort(function(E7,E6){return E2(E7.key,E6.key)})}return E1}Ex.map=function(E1){return Ez(E1,0)};Ex.entries=function(E1){return e(Ez(E1,0),0)};Ex.key=function(E1){Ew.push(E1);return Ex};Ex.sortKeys=function(E1){E0[Ew.length-1]=E1;return Ex};Ex.sortValues=function(E1){Ev=E1;return Ex};Ex.rollup=function(E1){Ey=E1;return Ex};return Ex};d3.keys=function(Ew){var Ev=[];for(var e in Ew){Ev.push(e)}return Ev};d3.values=function(Ew){var e=[];for(var Ev in Ew){e.push(Ew[Ev])}return e};d3.entries=function(Ew){var e=[];for(var Ev in Ew){e.push({key:Ev,value:Ew[Ev]})}return e};d3.permute=function(Ey,Ev){var e=[],Ew=-1,Ex=Ev.length;while(++EwEy){Ev.push(Ew/e)}}else{while((Ew=E0+Ez*++Ex)=0){Ew=e.substring(0,Ev);e=e.substring(Ev+1)}return CJ.hasOwnProperty(Ew)?{space:CJ[Ew],local:e}:e}};d3.dispatch=function(){var e=new Ce,Ev=-1,Ew=arguments.length;while(++Ev0){e=Ew.substring(Ev+1);Ew=Ew.substring(0,Ev)}return arguments.length<2?this[Ew].on(e):this[Ew].on(e,Ex)};function C2(e){var Ew=[],Ev=new AK;function Ex(){var E0=Ew,Ez=-1,E1=E0.length,Ey;while(++Ez=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;var R=d3.map({g:function(e,Ev){return e.toPrecision(Ev)},e:function(e,Ev){return e.toExponential(Ev)},f:function(e,Ev){return e.toFixed(Ev)},r:function(e,Ev){return d3.round(e,Ev=CL(e,Ev)).toFixed(Math.max(0,Math.min(20,Ev)))}});function CL(e,Ev){return Ev-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-Ev))/Math.LN10):1)}function Ag(e){return e+""}function Bj(Ex){var Ev=Ex.lastIndexOf("."),Ew=Ev>=0?Ex.substring(Ev):(Ev=Ex.length,""),e=[];while(Ev>0){e.push(Ex.substring(Ev-=3,Ev+3))}return e.reverse().join(",")+Ew}var BH=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(B1);d3.formatPrefix=function(Ew,e){var Ev=0;if(Ew){if(Ew<0){Ew*=-1}if(e){Ew=d3.round(Ew,CL(Ew,e))}Ev=1+Math.floor(1e-12+Math.log(Ew)/Math.LN10);Ev=Math.max(-24,Math.min(24,Math.floor((Ev<=0?Ev+1:Ev-1)/3)*3))}return BH[8+Ev/3]};function B1(Ev,e){return{scale:Math.pow(10,(8-e)*3),symbol:Ev}}var A2=AP(2),Y=AP(3),EO=function(){return Bi};var p=d3.map({linear:EO,poly:AP,quad:function(){return A2},cubic:function(){return Y},sin:function(){return Df},exp:function(){return DC},circle:function(){return CH},elastic:o,back:ED,bounce:function(){return BB}});var I=d3.map({"in":Bi,out:U,"in-out":AW,"out-in":function(e){return AW(U(e))}});d3.ease=function(Ev){var Ex=Ev.indexOf("-"),Ew=Ex>=0?Ev.substring(0,Ex):Ev,e=Ex>=0?Ev.substring(Ex+1):"in";Ew=p.get(Ew)||EO;e=I.get(e)||Bi;return DJ(e(Ew.apply(null,Array.prototype.slice.call(arguments,1))))};function DJ(e){return function(Ev){return Ev<=0?0:Ev>=1?1:e(Ev)}}function U(e){return function(Ev){return 1-e(1-Ev)}}function AW(e){return function(Ev){return 0.5*(Ev<0.5?e(2*Ev):(2-e(2-2*Ev)))}}function Bi(e){return e}function AP(Ev){return function(e){return Math.pow(e,Ev)}}function Df(e){return 1-Math.cos(e*Math.PI/2)}function DC(e){return Math.pow(2,10*(e-1))}function CH(e){return 1-Math.sqrt(1-e*e)}function o(e,Ew){var Ev;if(arguments.length<2){Ew=0.45}if(arguments.length<1){e=1;Ev=Ew/4}else{Ev=Ew/(2*Math.PI)*Math.asin(1/e)}return function(Ex){return 1+e*Math.pow(2,10*-Ex)*Math.sin((Ex-Ev)*2*Math.PI/Ew)}}function ED(e){if(!e){e=1.70158}return function(Ev){return Ev*Ev*((e+1)*Ev-e)}}function BB(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+0.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+0.9375:7.5625*(e-=2.625/2.75)*e+0.984375}d3.event=null;function Ee(){d3.event.stopPropagation();d3.event.preventDefault()}function u(){var Ew=d3.event,Ev;while(Ev=Ew.sourceEvent){Ew=Ev}return Ew}function EN(Ew){var e=new Ce,Ev=0,Ex=arguments.length;while(++Ev=0&&!(Ex=d3.interpolators[Ew](Ev,e))){}return Ex};d3.interpolateNumber=function(Ev,e){e-=Ev;return function(Ew){return Ev+e*Ew}};d3.interpolateRound=function(Ev,e){e-=Ev;return function(Ew){return Math.round(Ev+e*Ew)}};d3.interpolateString=function(E1,E0){var Ex,Ez,Ey,E3=0,E2=0,E4=[],e=[],Ew,Ev;DS.lastIndex=0;for(Ez=0;Ex=DS.exec(E0);++Ez){if(Ex.index){E4.push(E0.substring(E3,E2=Ex.index))}e.push({i:E4.length,x:Ex[0]});E4.push(null);E3=DS.lastIndex}if(E31?1:Ey;e=e<0?0:e>1?1:e;Ew=e<=0.5?e*(1+Ey):e+Ey-e*Ey;Ex=2*e-Ew;function Ev(E1){if(E1>360){E1-=360}else{if(E1<0){E1+=360}}if(E1<60){return Ex+(Ew-Ex)*E1/60}if(E1<180){return Ew}if(E1<240){return Ex+(Ew-Ex)*(240-E1)/60}return Ex}function E0(E1){return Math.round(Ev(E1)*255)}return CO(E0(Ez+120),E0(Ez),E0(Ez-120))}function CA(e){Ci(e,B9);return e}var Bn=function(e,Ev){return Ev.querySelector(e)},Db=function(e,Ev){return Ev.querySelectorAll(e)},CW=document.documentElement,B=CW.matchesSelector||CW.webkitMatchesSelector||CW.mozMatchesSelector||CW.msMatchesSelector||CW.oMatchesSelector,A=function(Ev,e){return B.call(Ev,e)};if(typeof Sizzle==="function"){Bn=function(e,Ev){return Sizzle(e,Ev)[0]};Db=function(e,Ev){return Sizzle.uniqueSort(Sizzle(e,Ev))};A=Sizzle.matchesSelector}var B9=[];d3.selection=function(){return D7};d3.selection.prototype=B9;B9.select=function(Ez){var Ew=[],E3,e,E2,Ex;if(typeof Ez!=="function"){Ez=S(Ez)}for(var E0=-1,Ey=this.length;++E01){while(++Ev=0;){if(Ey=Ez[Ew]){if(Ex&&Ex!==Ey.nextSibling){Ex.parentNode.insertBefore(Ey,Ex)}Ex=Ey}}}return this};B9.sort=function(Ev){Ev=D3.apply(this,arguments);for(var Ew=-1,e=this.length;++Ew0){Ex=Ex.substring(0,Ew)}if(arguments.length<2){return(Ew=this.node()[Ev])&&Ew._}return this.each(function(E3,E0){var E1=this,E2=E1[Ev];if(E2){E1.removeEventListener(Ex,E2,E2.$);delete E1[Ev]}if(Ey){E1.addEventListener(Ex,E1[Ev]=Ez,Ez.$=e);Ez._=Ey}function Ez(E4){var E5=d3.event;d3.event=E4;try{Ey.call(E1,E1.__data__,E0)}finally{d3.event=E5}}})};B9.each=function(E0){for(var Ev=-1,e=this.length;++EvEz){return E9()}FB.active=Ez;Ew.forEach(function(FD,FE){if(tween=FE.call(E2,E8,E5)){FA.push(tween)}});Ev.start.call(E2,E8,E5);if(!E7(FC)){d3.timer(E7,0,Ex)}return 1}function E7(FC){if(FB.active!==Ez){return E9()}var FD=(FC-E6)/E3,FE=Ey(FD),FF=FA.length;while(FF>0){FA[--FF].call(E2,FE)}if(FD>=1){E9();EL=Ez;Ev.end.call(E2,E8,E5);EL=0;return 1}}function E9(){if(!--FB.count){delete E2.__transition__}return 1}});return 1},0,Ex);return e}var Q={};function EC(Ew,Ev,e){return e!=""&&Q}function E(Ex,e){var Ew=DD(Ex);function Ev(E2,E1,Ez){var E0=e.call(this,E2,E1);return E0==null?Ez!=""&&Q:Ez!=E0&&Ew(Ez,E0)}function Ey(E1,E0,Ez){return Ez!=e&&Ew(Ez,e)}return typeof e==="function"?Ev:e==null?EC:(e+="",Ey)}var CR=[],EZ=0,EL=0,D=0,EA=250,C3=d3.ease("cubic-in-out"),Cn=D,EE=EA,Ad=C3;CR.call=B9.call;d3.transition=function(e){return arguments.length?(EL?e.transition():e):D7.transition()};d3.transition.prototype=CR;CR.select=function(Ez){var Ew=[],E3,e,Ex;if(typeof Ez!=="function"){Ez=S(Ez)}for(var E0=-1,Ey=this.length;++E0=Ex.delay){Ex.flush=Ex.callback(e)}Ex=Ex.next}var Ev=Cs()-Ew;if(Ev>24){if(isFinite(Ev)){clearTimeout(C1);C1=setTimeout(EV,Ev)}BE=0}else{BE=1;EU(EV)}}d3.timer.flush=function(){var e,Ev=Date.now(),Ew=A6;while(Ew){e=Ev-Ew.then;if(!Ew.delay){Ew.flush=Ew.callback(e)}Ew=Ew.next}Cs()};function Cs(){var Ev=null,e=A6,Ew=Infinity;while(e){if(e.flush){e=Ev?Ev.next=e.next:A6=e.next}else{Ew=Math.min(Ew,e.then+e.delay);e=(Ev=e).next}}return Ew}var EU=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.transform=function(Ev){var Ew=document.createElementNS(d3.ns.prefix.svg,"g"),e={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(Ex){Ew.setAttribute("transform",Ex);var Ey=Ew.transform.baseVal.consolidate();return new N(Ey?Ey.matrix:e)})(Ev)};function N(e){var Ex=[e.a,e.b],Ev=[e.c,e.d],Ez=DA(Ex),Ew=Cj(Ex,Ev),Ey=DA(Ax(Ev,Ex,-Ew))||0;if(Ex[0]*Ev[1]2?f:AI,E3=E1?AF:EW;Ew=E2(Ez,Ex,E3,Ey);Ev=E2(Ex,Ez,E3,d3.interpolate);return E0}function E0(E2){return Ew(E2)}E0.invert=function(E2){return Ev(E2)};E0.domain=function(E2){if(!arguments.length){return Ez}Ez=E2.map(Number);return e()};E0.range=function(E2){if(!arguments.length){return Ex}Ex=E2;return e()};E0.rangeRound=function(E2){return E0.range(E2).interpolate(d3.interpolateRound)};E0.clamp=function(E2){if(!arguments.length){return E1}E1=E2;return e()};E0.interpolate=function(E2){if(!arguments.length){return Ey}Ey=E2;return e()};E0.ticks=function(E2){return Cm(Ez,E2)};E0.tickFormat=function(E2){return Cw(Ez,E2)};E0.nice=function(){Dk(Ez,AM);return e()};E0.copy=function(){return CM(Ez,Ex,Ey,E1)};return e()}function Dc(Ev,e){return d3.rebind(Ev,e,"range","rangeRound","interpolate","clamp")}function AM(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return{floor:function(Ev){return Math.floor(Ev/e)*e},ceil:function(Ev){return Math.ceil(Ev/e)*e}}}function O(Ez,e){var Ew=CP(Ez),Ev=Ew[1]-Ew[0],Ey=Math.pow(10,Math.floor(Math.log(Ev/e)/Math.LN10)),Ex=e/Ev*Ey;if(Ex<=0.15){Ey*=10}else{if(Ex<=0.35){Ey*=5}else{if(Ex<=0.75){Ey*=2}}}Ew[0]=Math.ceil(Ew[0]/Ey)*Ey;Ew[1]=Math.floor(Ew[1]/Ey)*Ey+Ey*0.5;Ew[2]=Ey;return Ew}function Cm(Ev,e){return d3.range.apply(d3,O(Ev,e))}function Cw(Ev,e){return d3.format(",."+Math.max(0,-Math.floor(Math.log(O(Ev,e)[2])/Math.LN10+0.01))+"f")}function AI(Ey,e,Ez,Ew){var Ev=Ez(Ey[0],Ey[1]),Ex=Ew(e[0],e[1]);return function(E0){return Ex(Ev(E0))}}function f(E0,Ev,E1,Ey){var Ex=[],Ez=[],Ew=0,e=Math.min(E0.length,Ev.length)-1;if(E0[e]0;Ey--){E4.push(Ew(E2)*Ey)}}}else{for(;E2Ez;E1--){}E4=E4.slice(E2,E1)}return E4};Ex.tickFormat=function(E2,E1){if(arguments.length<2){E1=Bo}if(arguments.length<1){return E1}var Ey=E2/Ex.ticks().length,Ez=Ev===Dg?(E0=-1e-12,Math.floor):(E0=1e-12,Math.ceil),E0;return function(E3){return E3/Ew(Ez(Ev(E3)+E0))0?0:-e)/Math.LN10}Dd.pow=function(e){return Math.pow(10,e)};Dg.pow=function(e){return -Math.pow(10,-e)};d3.scale.pow=function(){return Dp(d3.scale.linear(),1)};function Dp(e,Ew){var Ev=DU(Ew),Ex=DU(1/Ew);function Ey(Ez){return e(Ev(Ez))}Ey.invert=function(Ez){return Ex(e.invert(Ez))};Ey.domain=function(Ez){if(!arguments.length){return e.domain().map(Ex)}e.domain(Ez.map(Ev));return Ey};Ey.ticks=function(Ez){return Cm(Ey.domain(),Ez)};Ey.tickFormat=function(Ez){return Cw(Ey.domain(),Ez)};Ey.nice=function(){return Ey.domain(Dk(Ey.domain(),AM))};Ey.exponent=function(Ez){if(!arguments.length){return Ew}var E0=Ey.domain();Ev=DU(Ew=Ez);Ex=DU(1/Ew);return Ey.domain(E0)};Ey.copy=function(){return Dp(e.copy(),Ew)};return Dc(Ey,e)}function DU(Ev){return function(e){return e<0?-Math.pow(-e,Ev):Math.pow(e,Ev)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){return BF([],{t:"range",x:[]})};function BF(Ez,Ew){var Ey,Ev,Ex;function E0(E1){return Ev[((Ey.get(E1)||Ey.set(E1,Ez.push(E1)))-1)%Ev.length]}function e(E2,E1){return d3.range(Ez.length).map(function(E3){return E2+E1*E3})}E0.domain=function(E1){if(!arguments.length){return Ez}Ez=[];Ey=new AK;var E3=-1,E4=E1.length,E2;while(++E3=Eh?(E2?"M0,"+E1+"A"+E1+","+E1+" 0 1,1 0,"+(-E1)+"A"+E1+","+E1+" 0 1,1 0,"+E1+"M0,"+E2+"A"+E2+","+E2+" 0 1,0 0,"+(-E2)+"A"+E2+","+E2+" 0 1,0 0,"+E2+"Z":"M0,"+E1+"A"+E1+","+E1+" 0 1,1 0,"+(-E1)+"A"+E1+","+E1+" 0 1,1 0,"+E1+"Z"):(E2?"M"+E1*E4+","+E1*E7+"A"+E1+","+E1+" 0 "+E5+",1 "+E1*E3+","+E1*E6+"L"+E2*E3+","+E2*E6+"A"+E2+","+E2+" 0 "+E5+",0 "+E2*E4+","+E2*E7+"Z":"M"+E1*E4+","+E1*E7+"A"+E1+","+E1+" 0 "+E5+",1 "+E1*E3+","+E1*E6+"L0,0Z")}Ev.innerRadius=function(Ez){if(!arguments.length){return Ey}Ey=d3.functor(Ez);return Ev};Ev.outerRadius=function(Ez){if(!arguments.length){return Ex}Ex=d3.functor(Ez);return Ev};Ev.startAngle=function(Ez){if(!arguments.length){return Ew}Ew=d3.functor(Ez);return Ev};Ev.endAngle=function(Ez){if(!arguments.length){return e}e=d3.functor(Ez);return Ev};Ev.centroid=function(){var E0=(Ey.apply(this,arguments)+Ex.apply(this,arguments))/2,Ez=(Ew.apply(this,arguments)+e.apply(this,arguments))/2+Ec;return[Math.cos(Ez)*E0,Math.sin(Ez)*E0]};return Ev};var Ec=-Math.PI/2,Eh=2*Math.PI-0.000001;function An(e){return e.innerRadius}function BV(e){return e.outerRadius}function Dh(e){return e.startAngle}function AA(e){return e.endAngle}function Cv(Ev){var e=D9,E0=D8,Ex=CE,Ez=A7.get(Ex),Ey=0.7;function Ew(E1){return E1.length<1?null:"M"+Ez(Ev(AH(this,E1,e,E0)),Ey)}Ew.x=function(E1){if(!arguments.length){return e}e=E1;return Ew};Ew.y=function(E1){if(!arguments.length){return E0}E0=E1;return Ew};Ew.interpolate=function(E1){if(!arguments.length){return Ex}if(!A7.has(E1+="")){E1=CE}Ez=A7.get(Ex=E1);return Ew};Ew.tension=function(E1){if(!arguments.length){return Ey}Ey=E1;return Ew};return Ew}d3.svg.line=function(){return Cv(Object)};function AH(E3,Ey,E0,Ez){var E2=[],Ex=-1,e=Ey.length,Ew=typeof E0==="function",Ev=typeof Ez==="function",E1;if(Ew&&Ev){while(++Ex1){E3=Ez[1];e=E0[Ew];Ew++;E4+="C"+(E2[0]+Ey[0])+","+(E2[1]+Ey[1])+","+(e[0]-E3[0])+","+(e[1]-E3[1])+","+e[0]+","+e[1];for(var Ev=2;Ev9){E2=Ex*3/Math.sqrt(E2);e[Ew]=E2*E0;e[Ew+1]=E2*Ez}}}Ew=-1;while(++Ew<=Ev){E2=(E1[Math.min(Ev,Ew+1)][0]-E1[Math.max(0,Ew-1)][0])/(6*(1+e[Ew]*e[Ew]));Ey.push([E2||0,e[Ew]*E2||0])}return Ey}function Bl(e){return e.length<3?Ek(e):e[0]+BZ(e,AC(e))}d3.svg.line.radial=function(){var e=Cv(h);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};function h(Ex){var e,Ew=-1,Ez=Ex.length,Ey,Ev;while(++EwMath.PI)+",1 "+E6}function Ex(E5,E7,E4,E6){return"Q 0,0 "+E6}Ez.radius=function(E4){if(!arguments.length){return E0}E0=d3.functor(E4);return Ez};Ez.source=function(E4){if(!arguments.length){return e}e=d3.functor(E4);return Ez};Ez.target=function(E4){if(!arguments.length){return E1}E1=d3.functor(E4);return Ez};Ez.startAngle=function(E4){if(!arguments.length){return E2}E2=d3.functor(E4);return Ez};Ez.endAngle=function(E4){if(!arguments.length){return Ey}Ey=d3.functor(E4);return Ez};return Ez};function AB(e){return e.source}function AL(e){return e.target}function X(e){return e.radius}function Dx(e){return e.startAngle}function CQ(e){return e.endAngle}d3.svg.diagonal=function(){var Ew=AB,Ex=AL,e=L;function Ev(E2,Ez){var E3=Ew.call(this,E2,Ez),E0=Ex.call(this,E2,Ez),Ey=(E3.y+E0.y)/2,E1=[E3,{x:E3.x,y:Ey},{x:E0.x,y:Ey},E0];E1=E1.map(e);return"M"+E1[0]+"C"+E1[1]+" "+E1[2]+" "+E1[3]}Ev.source=function(Ey){if(!arguments.length){return Ew}Ew=d3.functor(Ey);return Ev};Ev.target=function(Ey){if(!arguments.length){return Ex}Ex=d3.functor(Ey);return Ev};Ev.projection=function(Ey){if(!arguments.length){return e}e=Ey;return Ev};return Ev};function L(e){return[e.x,e.y]}d3.svg.diagonal.radial=function(){var Ew=d3.svg.diagonal(),e=L,Ev=Ew.projection;Ew.projection=function(Ex){return arguments.length?Ev(M(e=Ex)):e};return Ew};function M(e){return function(){var Ex=e.apply(this,arguments),Ew=Ex[0],Ev=Ex[1]+Ec;return[Ew*Math.cos(Ev),Ew*Math.sin(Ev)]}}d3.svg.mouse=d3.mouse;d3.svg.touches=d3.touches;d3.svg.symbol=function(){var Ev=AQ,e=Cr;function Ew(Ey,Ex){return(Ei.get(Ev.call(this,Ey,Ex))||A8)(e.call(this,Ey,Ex))}Ew.type=function(Ex){if(!arguments.length){return Ev}Ev=d3.functor(Ex);return Ew};Ew.size=function(Ex){if(!arguments.length){return e}e=d3.functor(Ex);return Ew};return Ew};function Cr(){return 64}function AQ(){return"circle"}function A8(e){var Ev=Math.sqrt(e/Math.PI);return"M0,"+Ev+"A"+Ev+","+Ev+" 0 1,1 0,"+(-Ev)+"A"+Ev+","+Ev+" 0 1,1 0,"+Ev+"Z"}var Ei=d3.map({circle:A8,cross:function(e){var Ev=Math.sqrt(e/5)/2;return"M"+-3*Ev+","+-Ev+"H"+-Ev+"V"+-3*Ev+"H"+Ev+"V"+-Ev+"H"+3*Ev+"V"+Ev+"H"+Ev+"V"+3*Ev+"H"+-Ev+"V"+Ev+"H"+-3*Ev+"Z"},diamond:function(e){var Ev=Math.sqrt(e/(2*BC)),Ew=Ev*BC;return"M0,"+-Ev+"L"+Ew+",0 0,"+Ev+" "+-Ew+",0Z"},square:function(e){var Ev=Math.sqrt(e)/2;return"M"+-Ev+","+-Ev+"L"+Ev+","+-Ev+" "+Ev+","+Ev+" "+-Ev+","+Ev+"Z"},"triangle-down":function(e){var Ew=Math.sqrt(e/A5),Ev=Ew*A5/2;return"M0,"+Ev+"L"+Ew+","+-Ev+" "+-Ew+","+-Ev+"Z"},"triangle-up":function(e){var Ew=Math.sqrt(e/A5),Ev=Ew*A5/2;return"M0,"+-Ev+"L"+Ew+","+Ev+" "+-Ew+","+Ev+"Z"}});d3.svg.symbolTypes=Ei.keys();var A5=Math.sqrt(3),BC=Math.tan(30*Math.PI/180);d3.svg.axis=function(){var Ex=d3.scale.linear(),E0="bottom",Ey=6,e=6,Ev=6,E4=3,E3=[10],Ez=null,E2,E1=0;function Ew(E5){E5.each(function(){var FO=d3.select(this);var FP=Ez==null?(Ex.ticks?Ex.ticks.apply(Ex,E3):Ex.domain()):Ez,FI=E2==null?(Ex.tickFormat?Ex.tickFormat.apply(Ex,E3):String):E2;var FA=BW(Ex,FP,E1),E9=FO.selectAll(".minor").data(FA,String),FL=E9.enter().insert("line","g").attr("class","tick minor").style("opacity",0.000001),FJ=d3.transition(E9.exit()).style("opacity",0.000001).remove(),E7=d3.transition(E9).style("opacity",1);var FN=FO.selectAll("g").data(FP,String),FF=FN.enter().insert("g","path").style("opacity",0.000001),FH=d3.transition(FN.exit()).style("opacity",0.000001).remove(),FB=d3.transition(FN).style("opacity",1),E6;var FE=AT(Ex),FG=FO.selectAll(".domain").data([0]),E8=FG.enter().append("path").attr("class","domain"),FQ=d3.transition(FG);var FK=Ex.copy(),FM=this.__chart__||FK;this.__chart__=FK;FF.append("line").attr("class","tick");FF.append("text");FB.select("text").text(FI);switch(E0){case"bottom":E6=C7;FL.attr("y2",e);E7.attr("x2",0).attr("y2",e);FF.select("line").attr("y2",Ey);FF.select("text").attr("y",Math.max(Ey,0)+E4);FB.select("line").attr("x2",0).attr("y2",Ey);FB.select("text").attr("x",0).attr("y",Math.max(Ey,0)+E4).attr("dy",".71em").attr("text-anchor","middle");FQ.attr("d","M"+FE[0]+","+Ev+"V0H"+FE[1]+"V"+Ev);break;case"top":E6=C7;FL.attr("y2",-e);E7.attr("x2",0).attr("y2",-e);FF.select("line").attr("y2",-Ey);FF.select("text").attr("y",-(Math.max(Ey,0)+E4));FB.select("line").attr("x2",0).attr("y2",-Ey);FB.select("text").attr("x",0).attr("y",-(Math.max(Ey,0)+E4)).attr("dy","0em").attr("text-anchor","middle");FQ.attr("d","M"+FE[0]+","+-Ev+"V0H"+FE[1]+"V"+-Ev);break;case"left":E6=C5;FL.attr("x2",-e);E7.attr("x2",-e).attr("y2",0);FF.select("line").attr("x2",-Ey);FF.select("text").attr("x",-(Math.max(Ey,0)+E4));FB.select("line").attr("x2",-Ey).attr("y2",0);FB.select("text").attr("x",-(Math.max(Ey,0)+E4)).attr("y",0).attr("dy",".32em").attr("text-anchor","end");FQ.attr("d","M"+-Ev+","+FE[0]+"H0V"+FE[1]+"H"+-Ev);break;case"right":E6=C5;FL.attr("x2",e);E7.attr("x2",e).attr("y2",0);FF.select("line").attr("x2",Ey);FF.select("text").attr("x",Math.max(Ey,0)+E4);FB.select("line").attr("x2",Ey).attr("y2",0);FB.select("text").attr("x",Math.max(Ey,0)+E4).attr("y",0).attr("dy",".32em").attr("text-anchor","start");FQ.attr("d","M"+Ev+","+FE[0]+"H0V"+FE[1]+"H"+Ev);break}if(Ex.ticks){FF.call(E6,FM);FB.call(E6,FK);FH.call(E6,FK);FL.call(E6,FM);E7.call(E6,FK);FJ.call(E6,FK)}else{var FD=FK.rangeBand()/2,FC=function(FR){return FK(FR)+FD};FF.call(E6,FC);FB.call(E6,FC)}})}Ew.scale=function(E5){if(!arguments.length){return Ex}Ex=E5;return Ew};Ew.orient=function(E5){if(!arguments.length){return E0}E0=E5;return Ew};Ew.ticks=function(){if(!arguments.length){return E3}E3=arguments;return Ew};Ew.tickValues=function(E5){if(!arguments.length){return Ez}Ez=E5;return Ew};Ew.tickFormat=function(E5){if(!arguments.length){return E2}E2=E5;return Ew};Ew.tickSize=function(E5,E8,E6){if(!arguments.length){return Ey}var E7=arguments.length-1;Ey=+E5;e=E7>1?+E8:Ey;Ev=E7>0?+arguments[E7]:Ey;return Ew};Ew.tickPadding=function(E5){if(!arguments.length){return E4}E4=+E5;return Ew};Ew.tickSubdivide=function(E5){if(!arguments.length){return E1}E1=+E5;return Ew};return Ew};function C7(Ev,e){Ev.attr("transform",function(Ew){return"translate("+e(Ew)+",0)"})}function C5(e,Ev){e.attr("transform",function(Ew){return"translate(0,"+Ev(Ew)+")"})}function BW(Ew,E0,Ev){E1=[];if(Ev&&E0.length>1){var E3=CP(Ew.domain()),E1,Ey=-1,e=E0.length,Ez=(E0[1]-E0[0])/++Ev,Ex,E2;while(++Ey0;){if((E2=+E0[Ey]-Ex*Ez)>=E3[0]){E1.push(E2)}}}for(--Ey,Ex=0;++Exrect,.s>rect").attr("width",E4[1][0]-E4[0][0])}function Ew(E5){E5.select(".extent").attr("y",E4[0][1]);E5.selectAll(".extent,.e>rect,.w>rect").attr("height",E4[1][1]-E4[0][1])}function E2(){var FO=this,E6=d3.select(d3.event.target),FC=e.of(FO,arguments),FJ=d3.select(FO),FL=E6.datum(),FH=!/^(n|s)$/.test(FL)&&E0,FF=!/^(e|w)$/.test(FL)&&Ez,FG=E6.classed("extent"),FM,FN=FD(),E7;var FA=d3.select(window).on("mousemove.brush",FB).on("mouseup.brush",E5).on("touchmove.brush",FB).on("touchend.brush",E5).on("keydown.brush",FE).on("keyup.brush",E9);if(FG){FN[0]=E4[0][0]-FN[0];FN[1]=E4[0][1]-FN[1]}else{if(FL){var FK=+/w$/.test(FL),FI=+/^n/.test(FL);E7=[E4[1-FK][0]-FN[0],E4[1-FI][1]-FN[1]];FN[0]=E4[FK][0];FN[1]=E4[FI][1]}else{if(d3.event.altKey){FM=FN.slice()}}}FJ.style("pointer-events","none").selectAll(".resize").style("display",null);d3.select("body").style("cursor",E6.style("cursor"));FC({type:"brushstart"});FB();Ee();function FD(){var FP=d3.event.changedTouches;return FP?d3.touches(FO,FP)[0]:d3.mouse(FO)}function FE(){if(d3.event.keyCode==32){if(!FG){FM=null;FN[0]-=E4[1][0];FN[1]-=E4[1][1];FG=2}Ee()}}function E9(){if(d3.event.keyCode==32&&FG==2){FN[0]+=E4[1][0];FN[1]+=E4[1][1];FG=0;Ee()}}function FB(){var FP=FD(),FQ=false;if(E7){FP[0]+=E7[0];FP[1]+=E7[1]}if(!FG){if(d3.event.altKey){if(!FM){FM=[(E4[0][0]+E4[1][0])/2,(E4[0][1]+E4[1][1])/2]}FN[0]=E4[+(FP[0]0){Ey=FD}else{Ey=0}}else{if(FD>0){E8.start({type:"start",alpha:Ey=FD});d3.timer(Ev.tick)}}return Ev};Ev.start=function(){var FH,FG,FE=E6.length,FF=Ew.length,FK=E4[0],FJ=E4[1],FM,FD;for(FH=0;FHE1){E1=e}E0.push(e)}for(Ex=0;ExEv){Ew=Ex;Ev=e}}return Ew}function Br(e){return e.reduce(DL,0)}function DL(e,Ev){return e+Ev[1]}d3.layout.histogram=function(){var Ey=true,Ev=Number,e=Af,Ew=EX;function Ex(E2,E3){var E8=[],E6=E2.map(Ev,this),E4=e.call(this,E6,E3),E7=Ew.call(this,E4,E6,E3),E9,E3=-1,Ez=E6.length,E0=E7.length-1,E1=Ey?1:1/Ez,E5;while(++E3=E4[0])&&(E5<=E4[1])){E9=E8[d3.bisect(E7,E5,1,E0)-1];E9.y+=E1;E9.push(E2[E3])}}return E8}Ex.value=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return Ex};Ex.range=function(Ez){if(!arguments.length){return e}e=d3.functor(Ez);return Ex};Ex.bins=function(Ez){if(!arguments.length){return Ew}Ew=typeof Ez==="number"?function(E0){return F(E0,Ez)}:d3.functor(Ez);return Ex};Ex.frequency=function(Ez){if(!arguments.length){return Ey}Ey=!!Ez;return Ex};return Ex};function EX(Ev,e){return F(Ev,Math.ceil(Math.log(e.length)/Math.LN2+1))}function F(Ex,Ez){var Ew=-1,Ev=+Ex[0],e=(Ex[1]-Ev)/Ez,Ey=[];while(++Ew<=Ez){Ey[Ew]=e*Ew+Ev}return Ey}function Af(e){return[d3.min(e),d3.max(e)]}d3.layout.hierarchy=function(){var Ew=B5,Ev=AZ,Ey=Eg;function Ex(E5,E4,E0){var E7=Ev.call(e,E5,E4),E2=H?E5:{data:E5};E2.depth=E4;E0.push(E2);if(E7&&(E1=E7.length)){var E6=-1,E1,E8=E2.children=[],E9=0,E3=E4+1;while(++E60.001}function k(E4){var E9=Infinity,FD=-Infinity,e=Infinity,Ey=-Infinity,E3=E4.length,FC,FB,FA,E7,E6;function Ew(FE){E9=Math.min(FE.x-FE.r,E9);FD=Math.max(FE.x+FE.r,FD);e=Math.min(FE.y-FE.r,e);Ey=Math.max(FE.y+FE.r,Ey)}E4.forEach(AO);FC=E4[0];FC.x=-FC.r;FC.y=0;Ew(FC);if(E3>1){FB=E4[1];FB.x=FB.r;FB.y=0;Ew(FB);if(E3>2){FA=E4[2];Aa(FC,FB,FA);Ew(FA);Aw(FC,FA);FC._pack_prev=FA;Aw(FA,FB);FB=FC._pack_next;for(var E8=3;E80){Eo(DX(FH,FF,FI),FF,FC);FK+=FC;FJ+=FC}FM+=FH._tree.mod;FK+=FE._tree.mod;FL+=FG._tree.mod;FJ+=FD._tree.mod}if(FH&&!AG(FD)){FD._tree.thread=FH;FD._tree.mod+=FM-FJ}if(FE&&!Em(FG)){FG._tree.thread=FE;FG._tree.mod+=FK-FL;FI=FF}}return FI}Eb(E7,function(FC,FB){FC._tree={ancestor:FC,prelim:0,mod:0,change:0,shift:0,number:FB?FB._tree.number+1:0}});E4(E7);E6(E7,-E7._tree.prelim);var E2=CC(E7,Ap),FA=CC(E7,Bb),E9=CC(E7,W),E1=E2.x-Ex(E2,FA)/2,E0=FA.x+Ex(FA,E2)/2,E8=E9.depth||1;Eb(E7,function(FB){FB.x=(FB.x-E1)/(E0-E1)*Ew[0];FB.y=FB.depth/E8*Ew[1];delete FB._tree});return Ez}e.separation=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.size=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};return Dq(e,Ev)};function Bu(Ev,e){return Ev.parent==e.parent?1:2}function Em(Ev){var e=Ev.children;return e&&e.length?e[0]:Ev._tree.thread}function AG(Ev){var e=Ev.children,Ew;return e&&(Ew=e.length)?e[Ew-1]:Ev._tree.thread}function CC(Ew,Ex){var Ev=Ew.children;if(Ev&&(Ey=Ev.length)){var Ez,Ey,e=-1;while(++e0){Ew=Ez}}}return Ew}function Bb(Ev,e){return Ev.x-e.x}function Ap(Ev,e){return e.x-Ev.x}function W(Ev,e){return Ev.depth-e.depth}function Eb(Ev,Ew){function e(E1,E0){var Ez=E1.children;if(Ez&&(E2=Ez.length)){var E3,Ey=null,Ex=-1,E2;while(++Ex=0){Ey=Ew[Ev]._tree;Ey.prelim+=e;Ey.mod+=e;e+=Ey.shift+(Ez+=Ey.change)}}function Eo(Ev,Ew,e){Ev=Ev._tree;Ew=Ew._tree;var Ex=e/(Ew.number-Ev.number);Ev.change+=Ex;Ew.change-=Ex;Ew.shift+=e;Ew.prelim+=e;Ew.mod+=e}function DX(e,Ew,Ev){return e._tree.ancestor.parent==Ew.parent?e._tree.ancestor:Ev}d3.layout.treemap=function(){var E1=d3.layout.hierarchy(),E5=Math.round,E7=[1,1],E2=null,e=Cu,E3=false,Ez,E0=0.5*(1+Math.sqrt(5));function Ev(FA,E8){var E9=-1,FD=FA.length,FC,FB;while(++E90){FH.push(E8=FE[FA-1]);FH.area+=E8.area;if((FB=Ew(FH,FG))<=FD){FE.pop();FD=FB}else{FH.area-=FH.pop().area;Ey(FH,FG,FF,false);FG=Math.min(FF.dx,FF.dy);FH.length=FH.area=0;FD=Infinity}}if(FH.length){Ey(FH,FG,FF,true);FH.length=FH.area=0}E9.forEach(Ex)}}function E6(FB){var E8=FB.children;if(E8&&E8.length){var FA=e(FB),E9=E8.slice(),FD,FC=[];Ev(E9,FA.dx*FA.dy/FB.value);FC.area=0;while(FD=E9.pop()){FC.push(FD);FC.area+=FD.area;if(FD.z!=null){Ey(FC,FD.z?FA.dx:FA.dy,FA,!E9.length);FC.length=FC.area=0}}E8.forEach(E6)}}function Ew(FD,E9){var FB=FD.area,FC,FF=0,E8=Infinity,FA=-1,FE=FD.length;while(++FAFF){FF=FC}}FB*=FB;E9*=E9;return FB?Math.max((E9*FF*E0)/FB,FB/(E9*E8*E0)):Infinity}function Ey(FH,FG,FC,FF){var FA=-1,E9=FH.length,FD=FC.x,FB=FC.y,FE=FG?E5(FH.area/FG):0,E8;if(FG==FC.dx){if(FF||FE>FC.dy){FE=FC.dy}while(++FAFC.dx){FE=FC.dx}while(++FA=E1.length){return Ex}if(Ez){Ez=false;return Ev}var E6=E2.lastIndex;if(E1.charCodeAt(E6)===34){var E7=E6;while(E7++50?Ey:E0<-140?Ex:Ez<21?Ew:e)(E1)}Ev.scale=function(Ez){if(!arguments.length){return e.scale()}e.scale(Ez);Ey.scale(Ez*0.6);Ex.scale(Ez);Ew.scale(Ez*1.5);return Ev.translate(e.translate())};Ev.translate=function(E0){if(!arguments.length){return e.translate()}var Ez=e.scale()/1000,E2=E0[0],E1=E0[1];e.translate(E0);Ey.translate([E2-400*Ez,E1+170*Ez]);Ex.translate([E2-190*Ez,E1+200*Ez]);Ew.translate([E2+580*Ez,E1+430*Ez]);return Ev};return Ev.scale(e.scale())};d3.geo.bonne=function(){var Ez=200,Ey=[480,250],e,Ex,Ew,Ev;function E0(E4){var E1=E4[0]*Cb-e,E5=E4[1]*Cb-Ex;if(Ew){var E3=Ev+Ew-E5,E2=E1*Math.cos(E5)/E3;E1=E3*Math.sin(E2);E5=E3*Math.cos(E2)-Ev}else{E1*=Math.cos(E5);E5*=-1}return[Ez*E1+Ey[0],Ez*E5+Ey[1]]}E0.invert=function(E3){var E1=(E3[0]-Ey[0])/Ez,E5=(E3[1]-Ey[1])/Ez;if(Ew){var E4=Ev+E5,E2=Math.sqrt(E1*E1+E4*E4);E5=Ev+Ew-E2;E1=e+E2*Math.atan2(E1,E4)/Math.cos(E5)}else{E5*=-1;E1/=Math.cos(E5)}return[E1/Cb,E5/Cb]};E0.parallel=function(E1){if(!arguments.length){return Ew/Cb}Ev=1/Math.tan(Ew=E1*Cb);return E0};E0.origin=function(E1){if(!arguments.length){return[e/Cb,Ex/Cb]}e=E1[0]*Cb;Ex=E1[1]*Cb;return E0};E0.scale=function(E1){if(!arguments.length){return Ez}Ez=+E1;return E0};E0.translate=function(E1){if(!arguments.length){return Ey}Ey=[+E1[0],+E1[1]];return E0};return E0.origin([0,0]).parallel(45)};d3.geo.equirectangular=function(){var Ew=500,Ev=[480,250];function e(Ey){var Ex=Ey[0]/360,Ez=-Ey[1]/360;return[Ew*Ex+Ev[0],Ew*Ez+Ev[1]]}e.invert=function(Ey){var Ex=(Ey[0]-Ev[0])/Ew,Ez=(Ey[1]-Ev[1])/Ew;return[360*Ex,-360*Ez]};e.scale=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return e};e.translate=function(Ex){if(!arguments.length){return Ev}Ev=[+Ex[0],+Ex[1]];return e};return e};d3.geo.mercator=function(){var Ew=500,Ev=[480,250];function e(Ey){var Ex=Ey[0]/360,Ez=-(Math.log(Math.tan(Math.PI/4+Ey[1]*Cb/2))/Cb)/360;return[Ew*Ex+Ev[0],Ew*Math.max(-0.5,Math.min(0.5,Ez))+Ev[1]]}e.invert=function(Ey){var Ex=(Ey[0]-Ev[0])/Ew,Ez=(Ey[1]-Ev[1])/Ew;return[360*Ex,2*Math.atan(Math.exp(-360*Ez*Cb))/Cb-90]};e.scale=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return e};e.translate=function(Ex){if(!arguments.length){return Ev}Ev=[+Ex[0],+Ex[1]];return e};return e};function DI(Ev,e){return function(Ew){return Ew&&Ev.hasOwnProperty(Ew.type)?Ev[Ew.type](Ew):e}}d3.geo.path=function(){var E0=4.5,E4=Z(E0),Ez=d3.geo.albersUsa();function E3(E6,E5){if(typeof E0==="function"){E4=Z(E0.apply(this,arguments))}return Ev(E6)||null}function E1(E5){return Ez(E5).join(",")}var Ev=DI({FeatureCollection:function(E8){var E7=[],E6=E8.features,E5=-1,E9=E6.length;while(++E50){E9.push("M");while(++E70){FF.push("M");while(++E9Ev){Ev=Ez}if(E0Ex){Ex=E0}});return[[Ey,e],[Ev,Ex]]};function Bk(Ev,e){if(D0.hasOwnProperty(Ev.type)){D0[Ev.type](Ev,e)}}var D0={Feature:Ef,FeatureCollection:De,GeometryCollection:Cy,LineString:Dj,MultiLineString:Dw,MultiPoint:Dj,MultiPolygon:Ed,Point:ER,Polygon:BQ};function Ef(Ev,e){Bk(Ev.geometry,e)}function De(Ex,Ew){for(var e=Ex.features,Ev=0,Ey=e.length;Ev=(Ev*Ev+E4*E4)){E9[E0].index=-1}else{E9[FA].index=-1;E6=E9[E0].angle;FA=E0;E8=Ez}}else{E6=E9[E0].angle;FA=E0;E8=Ez}}E5.push(E1);for(E0=0,Ez=0;E0<2;++Ez){if(E9[Ez].index!==-1){E5.push(E9[Ez].index);E0++}}Ew=E5.length;for(;Ez0}d3.geom.polygon=function(e){e.area=function(){var Ex=0,Ey=e.length,Ew=e[Ey-1][0]*e[0][1],Ev=e[Ey-1][1]*e[0][0];while(++Ex=0){E4=Ey.ep.r;E3=Ey.ep.l}else{E4=Ey.ep.l;E3=Ey.ep.r}if(Ey.a===1){E1=E4?E4.y:-1000000;Ex=Ey.c-Ey.b*E1;Ez=E3?E3.y:1000000;Ew=Ey.c-Ey.b*Ez}else{Ex=E4?E4.x:-1000000;E1=Ey.c-Ey.a*Ex;Ew=E3?E3.x:1000000;Ez=Ey.c-Ey.a*Ew}var E2=[Ex,E1],E0=[Ew,Ez];e[Ey.region.l.index].push(E2,E0);e[Ey.region.r.index].push(E2,E0)});return e.map(function(Ey,Ex){var Ew=Ev[Ex][0],Ez=Ev[Ex][1];Ey.forEach(function(E0){E0.angle=Math.atan2(E0[0]-Ew,E0[1]-Ez)});return Ey.sort(function(E1,E0){return E1.angle-E0.angle}).filter(function(E1,E0){return !E0||(E1.angle-Ey[E0-1].angle>1e-10)})})};var Bs={l:"r",r:"l"};function D6(Ez,Ex){var FD={list:Ez.map(function(e,FF){return{index:FF,x:e[0],y:e[1]}}).sort(function(FF,e){return FF.ye.y?1:FF.xe.x?1:0}),bottomSite:null};var Ew={list:[],leftEnd:null,rightEnd:null,init:function(){Ew.leftEnd=Ew.createHalfEdge(null,"l");Ew.rightEnd=Ew.createHalfEdge(null,"l");Ew.leftEnd.r=Ew.rightEnd;Ew.rightEnd.l=Ew.leftEnd;Ew.list.unshift(Ew.leftEnd,Ew.rightEnd)},createHalfEdge:function(FF,e){return{edge:FF,side:e,vertex:null,l:null,r:null}},insert:function(FF,e){e.l=FF;e.r=FF.r;FF.r.l=e;FF.r=e},leftBound:function(FF){var e=Ew.leftEnd;do{e=e.r}while(e!=Ew.rightEnd&&FC.rightOf(e,FF));e=e.l;return e},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?FD.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?FD.bottomSite:e.edge.region[Bs[e.side]]}};var FC={bisect:function(FI,FG){var FH={region:{l:FI,r:FG},ep:{l:null,r:null}};var FF=FG.x-FI.x,e=FG.y-FI.y,FK=FF>0?FF:-FF,FJ=e>0?e:-e;FH.c=FI.x*FF+FI.y*e+(FF*FF+e*e)*0.5;if(FK>FJ){FH.a=1;FH.b=e/FF;FH.c/=FF}else{FH.b=1;FH.a=FF/e;FH.c/=e}return FH},intersect:function(FI,FH){var FN=FI.edge,FM=FH.edge;if(!FN||!FM||(FN.region.r==FM.region.r)){return null}var FL=(FN.a*FM.b)-(FN.b*FM.a);if(Math.abs(FL)<1e-10){return null}var FG=(FN.c*FM.b-FM.c*FN.b)/FL,FQ=(FM.c*FN.a-FN.c*FM.a)/FL,FP=FN.region.r,FK=FM.region.r,FF,FJ;if((FP.y=FJ.region.r.x);if((FO&&(FF.side==="l"))||(!FO&&(FF.side==="r"))){return null}return{x:FG,y:FQ}},rightOf:function(FK,FF){var FO=FK.edge,FI=FO.region.r,FR=(FF.x>FI.x);if(FR&&(FK.side==="l")){return 1}if(!FR&&(FK.side==="r")){return 0}if(FO.a===1){var FQ=FF.y-FI.y,FG=FF.x-FI.x,FL=0,FP=0;if((!FR&&(FO.b<0))||(FR&&(FO.b>=0))){FP=FL=(FQ>=FO.b*FG)}else{FP=((FF.x+FF.y*FO.b)>FO.c);if(FO.b<0){FP=!FP}if(!FP){FL=1}}if(!FL){var FS=FI.x-FO.region.l.x;FP=(FO.b*(FG*FG-FQ*FQ))<(FS*FQ*(1+2*FG/FS+FO.b*FO.b));if(FO.b<0){FP=!FP}}}else{var FH=FO.c-FO.a*FF.x,FN=FF.y-FH,FM=FF.x-FI.x,FJ=FH-FI.y;FP=(FN*FN)>(FM*FM+FJ*FJ)}return FK.side==="l"?FP:!FP},endPoint:function(FG,FF,e){FG.ep[FF]=e;if(!FG.ep[Bs[FF]]){return}Ex(FG)},distance:function(FH,FG){var FF=FH.x-FG.x,e=FH.y-FG.y;return Math.sqrt(FF*FF+e*e)}};var Ev={list:[],insert:function(FJ,FF,FK){FJ.vertex=FF;FJ.ystar=FF.y+FK;for(var FG=0,FI=Ev.list,e=FI.length;FGFH.ystar||(FJ.ystar==FH.ystar&&FF.x>FH.vertex.x)){continue}else{break}}FI.splice(FG,0,FJ)},del:function(FH){for(var FG=0,FF=Ev.list,e=FF.length;FGE5.y){FB=E4;E4=E5;E5=FB;E8="r"}E9=FC.bisect(E4,E5);E0=Ew.createHalfEdge(E9,E8);Ew.insert(Ey,E0);FC.endPoint(E9,Bs[E8],E2);E7=FC.intersect(Ey,E0);if(E7){Ev.del(Ey);Ev.insert(Ey,E7,FC.distance(E7,E4))}E7=FC.intersect(E0,FA);if(E7){Ev.insert(E0,E7,FC.distance(E7,E4))}}else{break}}}for(E6=Ew.right(Ew.leftEnd);E6!=Ew.rightEnd;E6=Ew.right(E6)){Ex(E6.edge)}}d3.geom.delaunay=function(Ev){var e=Ev.map(function(){return[]}),Ew=[];D6(Ev,function(Ex){e[Ex.region.l.index].push(Ev[Ex.region.r.index])});e.forEach(function(E2,E1){var Ez=Ev[E1],Ey=Ez[0],E3=Ez[1];E2.forEach(function(E4){E4.angle=Math.atan2(E4[0]-Ey,E4[1]-E3)});E2.sort(function(E5,E4){return E5.angle-E4.angle});for(var E0=0,Ex=E2.length-1;E0e){e=Ev.x}if(Ev.y>E1){E1=Ev.y}}var E6=e-Ew,E5=E1-E2;if(E6>E5){E1=E2+E6}else{e=Ew+E5}}}function E4(FD,FC,E9,FB,E8,FA){if(isNaN(FC.x)||isNaN(FC.y)){return}if(FD.leaf){var E7=FD.point;if(E7){if((Math.abs(E7.x-FC.x)+Math.abs(E7.y-FC.y))<0.01){Ez(FD,FC,E9,FB,E8,FA)}else{FD.point=null;Ez(FD,E7,E9,FB,E8,FA);Ez(FD,FC,E9,FB,E8,FA)}}else{FD.point=FC}}else{Ez(FD,FC,E9,FB,E8,FA)}}function Ez(FB,E9,FA,FG,E8,FE){var FF=(FA+E8)*0.5,FD=(FG+FE)*0.5,FH=E9.x>=FF,E7=E9.y>=FD,FC=(E7<<1)+FH;FB.leaf=false;FB=FB.nodes[FC]||(FB.nodes[FC]=DP());if(FH){FA=FF}else{E8=FF}if(E7){FG=FD}else{FE=FD}E4(FB,E9,FA,FG,E8,FE)}var E0=DP();E0.add=function(E7){E4(E0,E7,Ew,E2,e,E1)};E0.visit=function(E7){BS(E7,E0,Ew,E2,e,E1)};E3.forEach(E0.add);return E0};function DP(){return{leaf:true,nodes:[],point:null}}function BS(Ey,Ex,Ev,E2,e,E0){if(!Ey(Ex,Ev,E2,e,E0)){var E1=(Ev+e)*0.5,Ez=(E2+E0)*0.5,Ew=Ex.nodes;if(Ew[0]){BS(Ey,Ew[0],Ev,E2,E1,Ez)}if(Ew[1]){BS(Ey,Ew[1],E1,E2,e,Ez)}if(Ew[2]){BS(Ey,Ew[2],Ev,Ez,E1,E0)}if(Ew[3]){BS(Ey,Ew[3],E1,Ez,e,E0)}}}function l(e){return{x:e[0],y:e[1]}}d3.time={};var DO=Date;function EG(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}EG.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){DZ.setUTCDate.apply(this._,arguments)},setDay:function(){DZ.setUTCDay.apply(this._,arguments)},setFullYear:function(){DZ.setUTCFullYear.apply(this._,arguments)},setHours:function(){DZ.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){DZ.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){DZ.setUTCMinutes.apply(this._,arguments)},setMonth:function(){DZ.setUTCMonth.apply(this._,arguments)},setSeconds:function(){DZ.setUTCSeconds.apply(this._,arguments)},setTime:function(){DZ.setTime.apply(this._,arguments)}};var DZ=Date.prototype;d3.time.format=function(e){var Ew=e.length;function Ev(Ez){var Ey=[],E0=-1,Ex=0,E2,E1;while(++E0=Ew){return -1}E1=E2.charCodeAt(Ez++);if(E1==37){e=Ej[E2.charAt(Ez++)];if(!e||((Ey=e(Ex,E0,Ey))<0)){return -1}}else{if(E1!=E0.charCodeAt(Ey++)){return -1}}}return Ey}var As=d3.format("02d"),Ar=d3.format("03d"),Aq=d3.format("04d"),Ao=d3.format("2d");var Dt={a:function(e){return d3_time_weekdays[e.getDay()].substring(0,3)},A:function(e){return d3_time_weekdays[e.getDay()]},b:function(e){return BD[e.getMonth()].substring(0,3)},B:function(e){return BD[e.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(e){return As(e.getDate())},e:function(e){return Ao(e.getDate())},H:function(e){return As(e.getHours())},I:function(e){return As(e.getHours()%12||12)},j:function(e){return Ar(1+d3.time.dayOfYear(e))},L:function(e){return Ar(e.getMilliseconds())},m:function(e){return As(e.getMonth()+1)},M:function(e){return As(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return As(e.getSeconds())},U:function(e){return As(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return As(d3.time.mondayOfYear(e))},x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(e){return As(e.getFullYear()%100)},Y:function(e){return Aq(e.getFullYear()%10000)},Z:DW,"%":function(e){return"%"}};var Ej={a:EF,A:BO,b:AV,B:Cl,c:CS,d:A3,e:A3,H:AN,I:AN,L:EB,m:D2,M:BY,p:Ea,S:B8,x:Et,X:Dz,y:g,Y:Am};function EF(Ev,e,Ew){return C4.test(e.substring(Ew,Ew+=3))?Ew:-1}function BO(Ev,e,Ew){Ay.lastIndex=0;var Ex=Ay.exec(e.substring(Ew,Ew+10));return Ex?Ew+=Ex[0].length:-1}var C4=/^(?:sun|mon|tue|wed|thu|fri|sat)/i,Ay=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;d3_time_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function AV(Ev,e,Ew){var Ex=Cp.get(e.substring(Ew,Ew+=3).toLowerCase());return Ex==null?-1:(Ev.m=Ex,Ew)}var Cp=d3.map({jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11});function Cl(Ev,e,Ew){EI.lastIndex=0;var Ex=EI.exec(e.substring(Ew,Ew+12));return Ex?(Ev.m=DG.get(Ex[0].toLowerCase()),Ew+=Ex[0].length):-1}var EI=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;var DG=d3.map({january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11});var BD=["January","February","March","April","May","June","July","August","September","October","November","December"];function CS(Ev,e,Ew){return CG(Ev,Dt.c.toString(),e,Ew)}function Et(Ev,e,Ew){return CG(Ev,Dt.x.toString(),e,Ew)}function Dz(Ev,e,Ew){return CG(Ev,Dt.X.toString(),e,Ew)}function Am(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+4));return Ex?(Ev.y=+Ex[0],Ew+=Ex[0].length):-1}function g(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.y=Aj()+ +Ex[0],Ew+=Ex[0].length):-1}function Aj(){return ~~(new Date().getFullYear()/1000)*1000}function D2(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.m=Ex[0]-1,Ew+=Ex[0].length):-1}function A3(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.d=+Ex[0],Ew+=Ex[0].length):-1}function AN(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.H=+Ex[0],Ew+=Ex[0].length):-1}function BY(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.M=+Ex[0],Ew+=Ex[0].length):-1}function B8(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.S=+Ex[0],Ew+=Ex[0].length):-1}function EB(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+3));return Ex?(Ev.L=+Ex[0],Ew+=Ex[0].length):-1}var Da=/\s*\d+/;function Ea(Ev,e,Ew){var Ex=C.get(e.substring(Ew,Ew+=2).toLowerCase());return Ex==null?-1:(Ev.p=Ex,Ew)}var C=d3.map({am:0,pm:1});function DW(Ey){var Ex=Ey.getTimezoneOffset(),Ew=Ex>0?"-":"+",Ev=~~(Math.abs(Ex)/60),e=Math.abs(Ex)%60;return Ew+As(Ev)+As(e)}d3.time.format.utc=function(Ev){var e=d3.time.format(Ev);function Ew(Ex){try{DO=EG;var Ey=new DO();Ey._=Ex;return e(Ey)}finally{DO=Date}}Ew.parse=function(Ey){try{DO=EG;var Ex=e.parse(Ey);return Ex&&Ex._}finally{DO=Date}};Ew.toString=e.toString;return Ew};var B4=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Bt:B4;function Bt(e){return e.toISOString()}Bt.parse=function(e){return new Date(e)};Bt.toString=B4.toString;function Ba(Ez,e,Ev){function E2(E3){var E5=Ez(E3),E4=Ex(E5,1);return E3-E51){while(E6=0&&A>=0)&&this.lowerBound.IsValid()&&this.upperBound.IsValid()};AI.prototype.GetCenter=function(){return new AQ((this.lowerBound.x+this.upperBound.x)/2,(this.lowerBound.y+this.upperBound.y)/2)};AI.prototype.GetExtents=function(){return new AQ((this.upperBound.x-this.lowerBound.x)/2,(this.upperBound.y-this.lowerBound.y)/2)};AI.prototype.Contains=function(A){var B=true;return B=(B=(B=(B=B&&this.lowerBound.x<=A.lowerBound.x)&&this.lowerBound.y<=A.lowerBound.y)&&A.upperBound.x<=this.upperBound.x)&&A.upperBound.y<=this.upperBound.y};AI.prototype.RayCast=function(I,H){var G=-Number.MAX_VALUE,D=Number.MAX_VALUE,A=H.p1.x,O=H.p1.y,M=H.p2.x-H.p1.x,N=H.p2.y-H.p1.y,L=Math.abs(N),B=I.normal,K=0,E=0,F=K=0;F=0;if(Math.abs(M)K){F=E;E=K;K=F;F=1}if(E>G){B.x=F;B.y=0;G=E}D=Math.min(D,K);if(G>D){return false}}if(LK){F=E;E=K;K=F;F=1}if(E>G){B.y=F;B.x=0;G=E}D=Math.min(D,K);if(G>D){return false}}I.fraction=G;return true};AI.prototype.TestOverlap=function(A){var D=A.lowerBound.y-this.upperBound.y,B=this.lowerBound.y-A.upperBound.y;if(A.lowerBound.x-this.upperBound.x>0||D>0){return false}if(this.lowerBound.x-A.upperBound.x>0||B>0){return false}return true};AI.Combine=function(A,D){var B=new AI;B.Combine(A,D);return B};AI.prototype.Combine=function(A,B){this.lowerBound.x=Math.min(A.lowerBound.x,B.lowerBound.x);this.lowerBound.y=Math.min(A.lowerBound.y,B.lowerBound.y);this.upperBound.x=Math.max(A.upperBound.x,B.upperBound.x);this.upperBound.y=Math.max(A.upperBound.y,B.upperBound.y)};f.b2Bound=function(){};f.prototype.IsLower=function(){return(this.value&1)==0};f.prototype.IsUpper=function(){return(this.value&1)==1};f.prototype.Swap=function(B){var E=this.value,D=this.proxy,A=this.stabbingCount;this.value=B.value;this.proxy=B.proxy;this.stabbingCount=B.stabbingCount;B.value=E;B.proxy=D;B.stabbingCount=A};T.b2BoundValues=function(){};T.prototype.b2BoundValues=function(){this.lowerValues=new Vector_a2j_Number;this.lowerValues[0]=0;this.lowerValues[1]=0;this.upperValues=new Vector_a2j_Number;this.upperValues[0]=0;this.upperValues[1]=0};x.b2Collision=function(){};x.ClipSegmentToLine=function(F,E,D,B){if(B===undefined){B=0}var A,K=0;A=E[0];var H=A.v;A=E[1];var I=A.v,G=D.x*H.x+D.y*H.y-B;A=D.x*I.x+D.y*I.y-B;G<=0&&F[K++].Set(E[0]);A<=0&&F[K++].Set(E[1]);if(G*A<0){D=G/(G-A);A=F[K];A=A.v;A.x=H.x+D*(I.x-H.x);A.y=H.y+D*(I.y-H.y);A=F[K];A.id=(G>0?E[0]:E[1]).id;++K}return K};x.EdgeSeparation=function(K,I,H,E,A){if(H===undefined){H=0}parseInt(K.m_vertexCount);var Q=K.m_vertices;K=K.m_normals;var N=parseInt(E.m_vertexCount),O=E.m_vertices,M,B;M=I.R;B=K[H];K=M.col1.x*B.x+M.col2.x*B.y;E=M.col1.y*B.x+M.col2.y*B.y;M=A.R;var L=M.col1.x*K+M.col1.y*E;M=M.col2.x*K+M.col2.y*E;for(var F=0,G=Number.MAX_VALUE,D=0;DF){F=Q;B=H}}O=x.EdgeSeparation(K,I,B,E,A);Q=parseInt(B-1>=0?B-1:R-1);N=x.EdgeSeparation(K,I,Q,E,A);M=parseInt(B+1O&&N>F){G=-1;H=Q;D=N}else{if(F>O){G=1;H=M;D=F}else{L[0]=B;return O}}for(;;){B=G==-1?H-1>=0?H-1:R-1:H+1D){H=B;D=O}else{break}}L[0]=H;return D};x.FindIncidentEdge=function(H,G,F,D,A,N){if(D===undefined){D=0}parseInt(G.m_vertexCount);var L=G.m_normals,M=parseInt(A.m_vertexCount);G=A.m_vertices;A=A.m_normals;var K;K=F.R;F=L[D];L=K.col1.x*F.x+K.col2.x*F.y;var B=K.col1.y*F.x+K.col2.y*F.y;K=N.R;F=K.col1.x*L+K.col1.y*B;B=K.col2.x*L+K.col2.y*B;L=F;K=0;for(var I=Number.MAX_VALUE,E=0;EQ)){var O=0;x.s_edgeBO[0]=O;var B=x.FindMaxSeparation(x.s_edgeBO,E,A,K,I);O=x.s_edgeBO[0];if(!(B>Q)){var N=0,F=0;if(B>0.98*R+0.001){R=E;E=K;K=A;I=I;N=O;M.m_type=AG.e_faceB;F=1}else{R=K;E=E;K=I;I=A;N=S;M.m_type=AG.e_faceA;F=0}S=x.s_incidentEdge;x.FindIncidentEdge(S,R,K,N,E,I);O=parseInt(R.m_vertexCount);A=R.m_vertices;R=A[N];var H;H=N+1F*F)){B.m_type=AG.e_circles;B.m_localPoint.SetV(I.m_p);B.m_localPlaneNormal.SetZero();B.m_pointCount=1;B.m_points[0].m_localPoint.SetV(A.m_p);B.m_points[0].m_id.key=0}};x.CollidePolygonAndCircle=function(K,I,H,E,A){var Q=K.m_pointCount=0,N=0,O,M;M=A.R;O=E.m_p;var B=A.position.y+(M.col1.y*O.x+M.col2.y*O.y);Q=A.position.x+(M.col1.x*O.x+M.col2.x*O.y)-H.position.x;N=B-H.position.y;M=H.R;H=Q*M.col1.x+N*M.col1.y;M=Q*M.col2.x+N*M.col2.y;var L=0;B=-Number.MAX_VALUE;A=I.m_radius+E.m_radius;var F=parseInt(I.m_vertexCount),G=I.m_vertices;I=I.m_normals;for(var D=0;DA){return}if(Q>B){B=Q;L=D}}Q=parseInt(L);N=parseInt(Q+1A*A){return}K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.x=H-O.x;K.m_localPlaneNormal.y=M-O.y;K.m_localPlaneNormal.Normalize();K.m_localPoint.SetV(O)}else{if(B<=0){if((H-G.x)*(H-G.x)+(M-G.y)*(M-G.y)>A*A){return}K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.x=H-G.x;K.m_localPlaneNormal.y=M-G.y;K.m_localPlaneNormal.Normalize();K.m_localPoint.SetV(G)}else{L=0.5*(O.x+G.x);O=0.5*(O.y+G.y);B=(H-L)*I[Q].x+(M-O)*I[Q].y;if(B>A){return}K.m_pointCount=1;K.m_type=AG.e_faceA;K.m_localPlaneNormal.x=I[Q].x;K.m_localPlaneNormal.y=I[Q].y;K.m_localPlaneNormal.Normalize();K.m_localPoint.Set(L,O)}}}K.m_points[0].m_localPoint.SetV(E.m_p);K.m_points[0].m_id.key=0};x.TestOverlap=function(B,H){var G=H.lowerBound,A=B.upperBound,F=G.x-A.x,E=G.y-A.y;G=B.lowerBound;A=H.upperBound;var D=G.y-A.y;if(F>0||E>0){return false}if(G.x-A.x>0||D>0){return false}return true};Box2D.postDefs.push(function(){Box2D.Collision.b2Collision.s_incidentEdge=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints1=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints2=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_edgeAO=new Vector_a2j_Number(1);Box2D.Collision.b2Collision.s_edgeBO=new Vector_a2j_Number(1);Box2D.Collision.b2Collision.s_localTangent=new AQ;Box2D.Collision.b2Collision.s_localNormal=new AQ;Box2D.Collision.b2Collision.s_planePoint=new AQ;Box2D.Collision.b2Collision.s_normal=new AQ;Box2D.Collision.b2Collision.s_tangent=new AQ;Box2D.Collision.b2Collision.s_tangent2=new AQ;Box2D.Collision.b2Collision.s_v11=new AQ;Box2D.Collision.b2Collision.s_v12=new AQ;Box2D.Collision.b2Collision.b2CollidePolyTempVec=new AQ;Box2D.Collision.b2Collision.b2_nullFeature=255});AA.b2ContactID=function(){this.features=new AZ};AA.prototype.b2ContactID=function(){this.features._m_id=this};AA.prototype.Set=function(A){this.key=A._key};AA.prototype.Copy=function(){var A=new AA;A.key=this.key;return A};Object.defineProperty(AA.prototype,"key",{enumerable:false,configurable:true,get:function(){return this._key}});Object.defineProperty(AA.prototype,"key",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._key=A;this.features._referenceEdge=this._key&255;this.features._incidentEdge=(this._key&65280)>>8&255;this.features._incidentVertex=(this._key&16711680)>>16&255;this.features._flip=(this._key&4278190080)>>24&255}});AC.b2ContactPoint=function(){this.position=new AQ;this.velocity=new AQ;this.normal=new AQ;this.id=new AA};P.b2Distance=function(){};P.Distance=function(M,K,I){++P.b2_gjkCalls;var E=I.proxyA,A=I.proxyB,S=I.transformA,Q=I.transformB,R=P.s_simplex;R.ReadCache(K,E,S,A,Q);var O=R.m_vertices,B=P.s_saveA,N=P.s_saveB,F=0;R.GetClosestPoint().LengthSquared();for(var H=0,D,G=0;G<20;){F=R.m_count;for(H=0;HK+A&&M.distance>Number.MIN_VALUE){M.distance-=K+A;I=AN.SubtractVV(M.pointB,M.pointA);I.Normalize();M.pointA.x+=K*I.x;M.pointA.y+=K*I.y;M.pointB.x-=A*I.x;M.pointB.y-=A*I.y}else{D=new AQ;D.x=0.5*(M.pointA.x+M.pointB.x);D.y=0.5*(M.pointA.y+M.pointB.y);M.pointA.x=M.pointB.x=D.x;M.pointA.y=M.pointB.y=D.y;M.distance=0}}};Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new AW;Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)});J.b2DistanceInput=function(){};AU.b2DistanceOutput=function(){this.pointA=new AQ;this.pointB=new AQ};AL.b2DistanceProxy=function(){};AL.prototype.Set=function(A){switch(A.GetType()){case AB.e_circleShape:A=A instanceof AF?A:null;this.m_vertices=new Vector(1,true);this.m_vertices[0]=A.m_p;this.m_count=1;this.m_radius=A.m_radius;break;case AB.e_polygonShape:A=A instanceof AE?A:null;this.m_vertices=A.m_vertices;this.m_count=A.m_vertexCount;this.m_radius=A.m_radius;break;default:AM.b2Assert(false)}};AL.prototype.GetSupport=function(B){for(var F=0,E=this.m_vertices[0].x*B.x+this.m_vertices[0].y*B.y,A=1;AE){F=A;E=D}}return F};AL.prototype.GetSupportVertex=function(B){for(var F=0,E=this.m_vertices[0].x*B.x+this.m_vertices[0].y*B.y,A=1;AE){F=A;E=D}}return this.m_vertices[F]};AL.prototype.GetVertexCount=function(){return this.m_count};AL.prototype.GetVertex=function(A){if(A===undefined){A=0}AM.b2Assert(0<=A&&A0?D.x:-D.x);D=AM.b2_aabbExtension+AM.b2_aabbMultiplier*(D.y>0?D.y:-D.y);B.aabb.lowerBound.x=E.lowerBound.x-A;B.aabb.lowerBound.y=E.lowerBound.y-D;B.aabb.upperBound.x=E.upperBound.x+A;B.aabb.upperBound.y=E.upperBound.y+D;this.InsertLeaf(B);return true};AO.prototype.Rebalance=function(B){if(B===undefined){B=0}if(this.m_root!=null){for(var E=0;E>A&1?D.child2:D.child1;A=A+1&31}++this.m_path;this.RemoveLeaf(D);this.InsertLeaf(D)}}};AO.prototype.GetFatAABB=function(A){return A.aabb};AO.prototype.GetUserData=function(A){return A.userData};AO.prototype.Query=function(B,F){if(this.m_root!=null){var E=new Vector,A=0;for(E[A++]=this.m_root;A>0;){var D=E[--A];if(D.aabb.TestOverlap(F)){if(D.IsLeaf()){if(!B(D)){break}}else{E[A++]=D.child1;E[A++]=D.child2}}}}};AO.prototype.RayCast=function(H,G){if(this.m_root!=null){var F=G.p1,D=G.p2,A=AN.SubtractVV(F,D);A.Normalize();A=AN.CrossFV(1,A);var N=AN.AbsV(A),L=G.maxFraction,M=new AI,K=0,B=0;K=F.x+L*(D.x-F.x);B=F.y+L*(D.y-F.y);M.lowerBound.x=Math.min(F.x,K);M.lowerBound.y=Math.min(F.y,B);M.upperBound.x=Math.max(F.x,K);M.upperBound.y=Math.max(F.y,B);var I=new Vector,E=0;for(I[E++]=this.m_root;E>0;){L=I[--E];if(L.aabb.TestOverlap(M)!=false){K=L.aabb.GetCenter();B=L.aabb.GetExtents();if(!(Math.abs(A.x*(F.x-K.x)+A.y*(F.y-K.y))-N.x*B.x-N.y*B.y>0)){if(L.IsLeaf()){K=new b;K.p1=G.p1;K.p2=G.p2;K.maxFraction=G.maxFraction;L=H(K,L);if(L==0){break}if(L>0){K=F.x+L*(D.x-F.x);B=F.y+L*(D.y-F.y);M.lowerBound.x=Math.min(F.x,K);M.lowerBound.y=Math.min(F.y,B);M.upperBound.x=Math.max(F.x,K);M.upperBound.y=Math.max(F.y,B)}}else{I[E++]=L.child1;I[E++]=L.child2}}}}}};AO.prototype.AllocateNode=function(){if(this.m_freeList){var A=this.m_freeList;this.m_freeList=A.parent;A.parent=null;A.child1=null;A.child2=null;return A}return new AD};AO.prototype.FreeNode=function(A){A.parent=this.m_freeList;this.m_freeList=A};AO.prototype.InsertLeaf=function(B){++this.m_insertionCount;if(this.m_root==null){this.m_root=B;this.m_root.parent=null}else{var E=B.aabb.GetCenter(),D=this.m_root;if(D.IsLeaf()==false){do{var A=D.child1;D=D.child2;D=Math.abs((A.aabb.lowerBound.x+A.aabb.upperBound.x)/2-E.x)+Math.abs((A.aabb.lowerBound.y+A.aabb.upperBound.y)/2-E.y)=A?K:A;++H.m_pairCount;return true},F)}for(G=H.m_moveBuffer.length=0;GK){var I=A.x-this.p1.x,E=A.y-this.p1.y;A=I*F+E*M;if(0<=A&&A<=D*B){D=-N*E+L*I;if(-K*B<=D&&D<=B*(1+K)){A/=B;D=Math.sqrt(F*F+M*M);F/=D;M/=D;H[0]=A;G.Set(F,M);return true}}}return false};C.prototype.Extend=function(A){this.ExtendForward(A);this.ExtendBackward(A)};C.prototype.ExtendForward=function(A){var D=this.p2.x-this.p1.x,B=this.p2.y-this.p1.y;A=Math.min(D>0?(A.upperBound.x-this.p1.x)/D:D<0?(A.lowerBound.x-this.p1.x)/D:Number.POSITIVE_INFINITY,B>0?(A.upperBound.y-this.p1.y)/B:B<0?(A.lowerBound.y-this.p1.y)/B:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+D*A;this.p2.y=this.p1.y+B*A};C.prototype.ExtendBackward=function(A){var D=-this.p2.x+this.p1.x,B=-this.p2.y+this.p1.y;A=Math.min(D>0?(A.upperBound.x-this.p2.x)/D:D<0?(A.lowerBound.x-this.p2.x)/D:Number.POSITIVE_INFINITY,B>0?(A.upperBound.y-this.p2.y)/B:B<0?(A.lowerBound.y-this.p2.y)/B:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+D*A;this.p1.y=this.p2.y+B*A};AY.b2SeparationFunction=function(){this.m_localPoint=new AQ;this.m_axis=new AQ};AY.prototype.Initialize=function(H,G,F,D,A){this.m_proxyA=G;this.m_proxyB=D;var N=parseInt(H.count);AM.b2Assert(01){G=G.metric;L=this.GetMetric();if(L<0.5*G||2*G0?AN.CrossFV(1,A):AN.CrossVF(A,1);default:AM.b2Assert(false);return new AQ}};AW.prototype.GetClosestPoint=function(){switch(this.m_count){case 0:AM.b2Assert(false);return new AQ;case 1:return this.m_v1.w;case 2:return new AQ(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);default:AM.b2Assert(false);return new AQ}};AW.prototype.GetWitnessPoints=function(A,B){switch(this.m_count){case 0:AM.b2Assert(false);break;case 1:A.SetV(this.m_v1.wA);B.SetV(this.m_v1.wB);break;case 2:A.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x;A.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y;B.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x;B.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:B.x=A.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x;B.y=A.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y;break;default:AM.b2Assert(false)}};AW.prototype.GetMetric=function(){switch(this.m_count){case 0:AM.b2Assert(false);return 0;case 1:return 0;case 2:return AN.SubtractVV(this.m_v1.w,this.m_v2.w).Length();case 3:return AN.CrossVV(AN.SubtractVV(this.m_v2.w,this.m_v1.w),AN.SubtractVV(this.m_v3.w,this.m_v1.w));default:AM.b2Assert(false);return 0}};AW.prototype.Solve2=function(){var A=this.m_v1.w,D=this.m_v2.w,B=AN.SubtractVV(D,A);A=-(A.x*B.x+A.y*B.y);if(A<=0){this.m_count=this.m_v1.a=1}else{D=D.x*B.x+D.y*B.y;if(D<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{B=1/(D+A);this.m_v1.a=D*B;this.m_v2.a=A*B;this.m_count=2}}};AW.prototype.Solve3=function(){var G=this.m_v1.w,F=this.m_v2.w,E=this.m_v3.w,D=AN.SubtractVV(F,G),A=AN.Dot(G,D),M=AN.Dot(F,D);A=-A;var K=AN.SubtractVV(E,G),L=AN.Dot(G,K),I=AN.Dot(E,K);L=-L;var B=AN.SubtractVV(E,F),H=AN.Dot(F,B);B=AN.Dot(E,B);H=-H;K=AN.CrossVV(D,K);D=K*AN.CrossVV(F,E);E=K*AN.CrossVV(E,G);G=K*AN.CrossVV(G,F);if(A<=0&&L<=0){this.m_count=this.m_v1.a=1}else{if(M>0&&A>0&&G<=0){I=1/(M+A);this.m_v1.a=M*I;this.m_v2.a=A*I;this.m_count=2}else{if(I>0&&L>0&&E<=0){M=1/(I+L);this.m_v1.a=I*M;this.m_v3.a=L*M;this.m_count=2;this.m_v2.Set(this.m_v3)}else{if(M<=0&&H<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{if(I<=0&&B<=0){this.m_count=this.m_v3.a=1;this.m_v1.Set(this.m_v3)}else{if(B>0&&H>0&&D<=0){M=1/(B+H);this.m_v2.a=B*M;this.m_v3.a=H*M;this.m_count=2;this.m_v1.Set(this.m_v3)}else{M=1/(D+E+G);this.m_v1.a=D*M;this.m_v2.a=E*M;this.m_v3.a=G*M;this.m_count=3}}}}}}};AT.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};AV.b2SimplexVertex=function(){};AV.prototype.Set=function(A){this.wA.SetV(A.wA);this.wB.SetV(A.wB);this.w.SetV(A.w);this.a=A.a;this.indexA=A.indexA;this.indexB=A.indexB};AR.b2TimeOfImpact=function(){};AR.TimeOfImpact=function(N){++AR.b2_toiCalls;var L=N.proxyA,K=N.proxyB,E=N.sweepA,A=N.sweepB;AM.b2Assert(E.t0==A.t0);AM.b2Assert(1-E.t0>Number.MIN_VALUE);var U=L.m_radius+K.m_radius;N=N.tolerance;var R=0,S=0,Q=0;AR.s_cache.count=0;for(AR.s_distanceInput.useRadii=false;;){E.GetTransform(AR.s_xfA,R);A.GetTransform(AR.s_xfB,R);AR.s_distanceInput.proxyA=L;AR.s_distanceInput.proxyB=K;AR.s_distanceInput.transformA=AR.s_xfA;AR.s_distanceInput.transformB=AR.s_xfB;P.Distance(AR.s_distanceOutput,AR.s_cache,AR.s_distanceInput);if(AR.s_distanceOutput.distance<=0){R=1;break}AR.s_fcn.Initialize(AR.s_cache,L,AR.s_xfA,K,AR.s_xfB);var B=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(B<=0){R=1;break}if(S==0){Q=B>U?AN.Max(U-N,0.75*U):AN.Max(B-N,0.02*U)}if(B-Q<0.5*N){if(S==0){R=1;break}break}var O=R,G=R,I=1;B=B;E.GetTransform(AR.s_xfA,I);A.GetTransform(AR.s_xfB,I);var D=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(D>=Q){R=1;break}for(var H=0;;){var M=0;M=H&1?G+(Q-B)*(I-G)/(D-B):0.5*(G+I);E.GetTransform(AR.s_xfA,M);A.GetTransform(AR.s_xfB,M);var F=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(AN.Abs(F-Q)<0.025*N){O=M;break}if(F>Q){G=M;B=F}else{I=M;D=F}++H;++AR.b2_toiRootIters;if(H==50){break}}AR.b2_toiMaxRootIters=AN.Max(AR.b2_toiMaxRootIters,H);if(O<(1+100*Number.MIN_VALUE)*R){break}R=O;S++;++AR.b2_toiIters;if(S==1000){break}}AR.b2_toiMaxIters=AN.Max(AR.b2_toiMaxIters,S);return R};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 AT;Box2D.Collision.b2TimeOfImpact.s_distanceInput=new J;Box2D.Collision.b2TimeOfImpact.s_xfA=new X;Box2D.Collision.b2TimeOfImpact.s_xfB=new X;Box2D.Collision.b2TimeOfImpact.s_fcn=new AY;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new AU});AP.b2TOIInput=function(){this.proxyA=new AL;this.proxyB=new AL;this.sweepA=new AJ;this.sweepB=new AJ};AS.b2WorldManifold=function(){this.m_normal=new AQ};AS.prototype.b2WorldManifold=function(){this.m_points=new Vector(AM.b2_maxManifoldPoints);for(var A=0;ANumber.MIN_VALUE*Number.MIN_VALUE){L=Math.sqrt(L);this.m_normal.x=M/L;this.m_normal.y=N/L}else{this.m_normal.x=1;this.m_normal.y=0}M=H+G*this.m_normal.y;D=D-A*this.m_normal.y;this.m_points[0].x=0.5*(O+G*this.m_normal.x+(I-A*this.m_normal.x));this.m_points[0].y=0.5*(M+D);break;case AG.e_faceA:N=H.R;M=I.m_localPlaneNormal;L=N.col1.x*M.x+N.col2.x*M.y;B=N.col1.y*M.x+N.col2.y*M.y;N=H.R;M=I.m_localPoint;K=H.position.x+N.col1.x*M.x+N.col2.x*M.y;E=H.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_normal.x=L;this.m_normal.y=B;for(O=0;Othis.m_radius){I.SetV(B);return Math.PI*this.m_radius*this.m_radius}K=this.m_radius*this.m_radius;var G=F*F;F=K*(Math.asin(F/this.m_radius)+Math.PI/2)+F*Math.sqrt(K-G);K=-2/3*Math.pow(K-G,1.5)/F;I.x=B.x+A.x*K;I.y=B.y+A.y*K;return F};e.prototype.GetLocalPosition=function(){return this.m_p};e.prototype.SetLocalPosition=function(A){this.m_p.SetV(A)};e.prototype.GetRadius=function(){return this.m_radius};e.prototype.SetRadius=function(A){if(A===undefined){A=0}this.m_radius=A};e.prototype.b2CircleShape=function(A){if(A===undefined){A=0}this.__super.b2Shape.call(this);this.m_type=O.e_circleShape;this.m_radius=A};X.b2EdgeChainDef=function(){};X.prototype.b2EdgeChainDef=function(){this.vertexCount=0;this.isALoop=true;this.vertices=[]};Box2D.inherit(T,Box2D.Collision.Shapes.b2Shape);T.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;T.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.s_supportVec=new N;this.m_v1=new N;this.m_v2=new N;this.m_coreV1=new N;this.m_coreV2=new N;this.m_normal=new N;this.m_direction=new N;this.m_cornerDir1=new N;this.m_cornerDir2=new N};T.prototype.TestPoint=function(){return false};T.prototype.RayCast=function(F,M,U){var B,Q=M.p2.x-M.p1.x,K=M.p2.y-M.p1.y;B=U.R;var V=U.position.x+(B.col1.x*this.m_v1.x+B.col2.x*this.m_v1.y),I=U.position.y+(B.col1.y*this.m_v1.x+B.col2.y*this.m_v1.y),L=U.position.y+(B.col1.y*this.m_v2.x+B.col2.y*this.m_v2.y)-I;U=-(U.position.x+(B.col1.x*this.m_v2.x+B.col2.x*this.m_v2.y)-V);B=100*Number.MIN_VALUE;var G=-(Q*L+K*U);if(G>B){V=M.p1.x-V;var A=M.p1.y-I;I=V*L+A*U;if(0<=I&&I<=M.maxFraction*G){M=-Q*A+K*V;if(-B*G<=M&&M<=G*(1+B)){I/=G;F.fraction=I;M=Math.sqrt(L*L+U*U);F.normal.x=L/M;F.normal.y=U/M;return true}}}return false};T.prototype.ComputeAABB=function(A,K){var B=K.R,I=K.position.x+(B.col1.x*this.m_v1.x+B.col2.x*this.m_v1.y),F=K.position.y+(B.col1.y*this.m_v1.x+B.col2.y*this.m_v1.y),G=K.position.x+(B.col1.x*this.m_v2.x+B.col2.x*this.m_v2.y);B=K.position.y+(B.col1.y*this.m_v2.x+B.col2.y*this.m_v2.y);if(I0){if(A>0){return 0}else{I.x=-A/(G-A)*I.x+G/(G-A)*B.x;I.y=-A/(G-A)*I.y+G/(G-A)*B.y}}else{if(A>0){B.x=-A/(G-A)*I.x+G/(G-A)*B.x;B.y=-A/(G-A)*I.y+G/(G-A)*B.y}}K.x=(F.x+I.x+B.x)/3;K.y=(F.y+I.y+B.y)/3;return 0.5*((I.x-F.x)*(B.y-F.y)-(I.y-F.y)*(B.x-F.x))};T.prototype.GetLength=function(){return this.m_length};T.prototype.GetVertex1=function(){return this.m_v1};T.prototype.GetVertex2=function(){return this.m_v2};T.prototype.GetCoreVertex1=function(){return this.m_coreV1};T.prototype.GetCoreVertex2=function(){return this.m_coreV2};T.prototype.GetNormalVector=function(){return this.m_normal};T.prototype.GetDirectionVector=function(){return this.m_direction};T.prototype.GetCorner1Vector=function(){return this.m_cornerDir1};T.prototype.GetCorner2Vector=function(){return this.m_cornerDir2};T.prototype.Corner1IsConvex=function(){return this.m_cornerConvex1};T.prototype.Corner2IsConvex=function(){return this.m_cornerConvex2};T.prototype.GetFirstVertex=function(A){var B=A.R;return new N(A.position.x+(B.col1.x*this.m_coreV1.x+B.col2.x*this.m_coreV1.y),A.position.y+(B.col1.y*this.m_coreV1.x+B.col2.y*this.m_coreV1.y))};T.prototype.GetNextEdge=function(){return this.m_nextEdge};T.prototype.GetPrevEdge=function(){return this.m_prevEdge};T.prototype.Support=function(A,L,B){if(L===undefined){L=0}if(B===undefined){B=0}var K=A.R,F=A.position.x+(K.col1.x*this.m_coreV1.x+K.col2.x*this.m_coreV1.y),I=A.position.y+(K.col1.y*this.m_coreV1.x+K.col2.y*this.m_coreV1.y),G=A.position.x+(K.col1.x*this.m_coreV2.x+K.col2.x*this.m_coreV2.y);A=A.position.y+(K.col1.y*this.m_coreV2.x+K.col2.y*this.m_coreV2.y);if(F*L+I*B>G*L+A*B){this.s_supportVec.x=F;this.s_supportVec.y=I}else{this.s_supportVec.x=G;this.s_supportVec.y=A}return this.s_supportVec};T.prototype.b2EdgeShape=function(A,B){this.__super.b2Shape.call(this);this.m_type=O.e_edgeShape;this.m_nextEdge=this.m_prevEdge=null;this.m_v1=A;this.m_v2=B;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(-f.b2_toiSlop*(this.m_normal.x-this.m_direction.x)+this.m_v1.x,-f.b2_toiSlop*(this.m_normal.y-this.m_direction.y)+this.m_v1.y);this.m_coreV2.Set(-f.b2_toiSlop*(this.m_normal.x+this.m_direction.x)+this.m_v2.x,-f.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)};T.prototype.SetPrevEdge=function(A,G,B,F){this.m_prevEdge=A;this.m_coreV1=G;this.m_cornerDir1=B;this.m_cornerConvex1=F};T.prototype.SetNextEdge=function(A,G,B,F){this.m_nextEdge=A;this.m_coreV2=G;this.m_cornerDir2=B;this.m_cornerConvex2=F};b.b2MassData=function(){this.mass=0;this.center=new N(0,0);this.I=0};Box2D.inherit(H,Box2D.Collision.Shapes.b2Shape);H.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;H.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)};H.prototype.Copy=function(){var A=new H;A.Set(this);return A};H.prototype.Set=function(A){this.__super.Set.call(this,A);if(Box2D.is(A,H)){A=A instanceof H?A:null;this.m_centroid.SetV(A.m_centroid);this.m_vertexCount=A.m_vertexCount;this.Reserve(this.m_vertexCount);for(var B=0;BNumber.MIN_VALUE);this.m_normals[B].SetV(D.CrossVF(G,1));this.m_normals[B].Normalize()}this.m_centroid=H.ComputeCentroid(this.m_vertices,this.m_vertexCount)};H.AsVector=function(A,F){if(F===undefined){F=0}var B=new H;B.SetAsVector(A,F);return B};H.prototype.SetAsBox=function(A,B){if(A===undefined){A=0}if(B===undefined){B=0}this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-A,-B);this.m_vertices[1].Set(A,-B);this.m_vertices[2].Set(A,B);this.m_vertices[3].Set(-A,B);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()};H.AsBox=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}var B=new H;B.SetAsBox(A,F);return B};H.prototype.SetAsOrientedBox=function(A,G,B,F){if(A===undefined){A=0}if(G===undefined){G=0}if(B===undefined){B=null}if(F===undefined){F=0}this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-A,-G);this.m_vertices[1].Set(A,-G);this.m_vertices[2].Set(A,G);this.m_vertices[3].Set(-A,G);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=B;A=new P;A.position=B;A.R.Set(F);for(B=0;B0){return false}}return true};H.prototype.RayCast=function(G,U,W){var B=0,V=U.maxFraction,L=0,Y=0,K,M;L=U.p1.x-W.position.x;Y=U.p1.y-W.position.y;K=W.R;var I=L*K.col1.x+Y*K.col1.y,A=L*K.col2.x+Y*K.col2.y;L=U.p2.x-W.position.x;Y=U.p2.y-W.position.y;K=W.R;U=L*K.col1.x+Y*K.col1.y-I;K=L*K.col2.x+Y*K.col2.y-A;for(var F=parseInt(-1),Q=0;Q0&&L=0){G.fraction=B;K=W.R;M=this.m_normals[F];G.normal.x=K.col1.x*M.x+K.col2.x*M.y;G.normal.y=K.col1.y*M.x+K.col2.y*M.y;return true}return false};H.prototype.ComputeAABB=function(B,L){for(var Q=L.R,A=this.m_vertices[0],M=L.position.x+(Q.col1.x*A.x+Q.col2.x*A.y),I=L.position.y+(Q.col1.y*A.x+Q.col2.y*A.y),U=M,G=I,K=1;KF?U:F;G=G>A?G:A}B.lowerBound.x=M-this.m_radius;B.lowerBound.y=I-this.m_radius;B.upperBound.x=U+this.m_radius;B.upperBound.y=G+this.m_radius};H.prototype.ComputeMass=function(I,Y){if(Y===undefined){Y=0}if(this.m_vertexCount==2){I.center.x=0.5*(this.m_vertices[0].x+this.m_vertices[1].x);I.center.y=0.5*(this.m_vertices[0].y+this.m_vertices[1].y);I.mass=0;I.I=0}else{for(var m=0,B=0,g=0,U=0,n=1/3,M=0;M0){if(A){if(!G){L=F-1;I++}}else{if(G){M=F-1;I++}}}G=A}switch(I){case 0:if(G){F=new b;this.ComputeMass(F,1);B.SetV(D.MulX(U,F.center));return F.mass}else{return 0}case 1:if(L==-1){L=this.m_vertexCount-1}else{M=this.m_vertexCount-1}}F=parseInt((L+1)%this.m_vertexCount);Q=parseInt((M+1)%this.m_vertexCount);K=(0-V[L])/(V[F]-V[L]);V=(0-V[M])/(V[Q]-V[M]);L=new N(this.m_vertices[L].x*(1-K)+this.m_vertices[F].x*K,this.m_vertices[L].y*(1-K)+this.m_vertices[F].y*K);M=new N(this.m_vertices[M].x*(1-V)+this.m_vertices[Q].x*V,this.m_vertices[M].y*(1-V)+this.m_vertices[Q].y*V);V=0;K=new N;I=this.m_vertices[F];for(F=F;F!=Q;){F=(F+1)%this.m_vertexCount;G=F==Q?M:this.m_vertices[F];A=0.5*((I.x-L.x)*(G.y-L.y)-(I.y-L.y)*(G.x-L.x));V+=A;K.x+=A*(L.x+I.x+G.x)/3;K.y+=A*(L.y+I.y+G.y)/3;I=G}K.Multiply(1/V);B.SetV(D.MulX(U,K));return V};H.prototype.GetVertexCount=function(){return this.m_vertexCount};H.prototype.GetVertices=function(){return this.m_vertices};H.prototype.GetNormals=function(){return this.m_normals};H.prototype.GetSupport=function(A){for(var I=0,B=this.m_vertices[0].x*A.x+this.m_vertices[0].y*A.y,G=1;GB){I=G;B=F}}return I};H.prototype.GetSupportVertex=function(A){for(var I=0,B=this.m_vertices[0].x*A.x+this.m_vertices[0].y*A.y,G=1;GB){I=G;B=F}}return this.m_vertices[I]};H.prototype.Validate=function(){return false};H.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this);this.m_type=O.e_polygonShape;this.m_centroid=new N;this.m_vertices=new Vector;this.m_normals=new Vector};H.prototype.Reserve=function(A){if(A===undefined){A=0}for(var B=parseInt(this.m_vertices.length);Bp){p=V}if(m>n){n=m}}Y=(p-I)*(n-A);if(Y<0.95*K){K=Y;g.R.col1.x=Q;g.R.col1.y=F;g.R.col2.x=B;g.R.col2.y=t;Q=0.5*(I+p);F=0.5*(A+n);B=g.R;g.center.x=G.x+(B.col1.x*Q+B.col2.x*F);g.center.y=G.y+(B.col1.y*Q+B.col2.y*F);g.extents.x=0.5*(p-I);g.extents.y=0.5*(n-A)}}};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new E});O.b2Shape=function(){};O.prototype.Copy=function(){return null};O.prototype.Set=function(A){this.m_radius=A.m_radius};O.prototype.GetType=function(){return this.m_type};O.prototype.TestPoint=function(){return false};O.prototype.RayCast=function(){return false};O.prototype.ComputeAABB=function(){};O.prototype.ComputeMass=function(){};O.prototype.ComputeSubmergedArea=function(){return 0};O.TestOverlap=function(A,I,B,G){var F=new S;F.proxyA=new J;F.proxyA.Set(A);F.proxyB=new J;F.proxyB.Set(B);F.transformA=I;F.transformB=G;F.useRadii=true;A=new C;A.count=0;I=new Z;R.Distance(I,A,F);return I.distance<10*Number.MIN_VALUE};O.prototype.b2Shape=function(){this.m_type=O.e_unknownShape;this.m_radius=f.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2Shape.e_unknownShape=parseInt(-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=parseInt(-1)})})();(function(){var C=Box2D.Common.b2Color,B=Box2D.Common.b2Settings,A=Box2D.Common.Math.b2Math;C.b2Color=function(){this._b=this._g=this._r=0};C.prototype.b2Color=function(F,E,D){if(F===undefined){F=0}if(E===undefined){E=0}if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(F,0,1));this._g=Box2D.parseUInt(255*A.Clamp(E,0,1));this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))};C.prototype.Set=function(F,E,D){if(F===undefined){F=0}if(E===undefined){E=0}if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(F,0,1));this._g=Box2D.parseUInt(255*A.Clamp(E,0,1));this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))};Object.defineProperty(C.prototype,"r",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"g",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._g=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"b",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"color",{enumerable:false,configurable:true,get:function(){return this._r<<16|this._g<<8|this._b}});B.b2Settings=function(){};B.b2MixFriction=function(E,D){if(E===undefined){E=0}if(D===undefined){D=0}return Math.sqrt(E*D)};B.b2MixRestitution=function(E,D){if(E===undefined){E=0}if(D===undefined){D=0}return E>D?E:D};B.b2Assert=function(D){if(!D){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*B.b2_linearSlop;Box2D.Common.b2Settings.b2_linearSlop=0.005;Box2D.Common.b2Settings.b2_angularSlop=2/180*B.b2_pi;Box2D.Common.b2Settings.b2_toiSlop=8*B.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*B.b2_pi;Box2D.Common.b2Settings.b2_maxTranslation=2;Box2D.Common.b2Settings.b2_maxTranslationSquared=B.b2_maxTranslation*B.b2_maxTranslation;Box2D.Common.b2Settings.b2_maxRotation=0.5*B.b2_pi;Box2D.Common.b2Settings.b2_maxRotationSquared=B.b2_maxRotation*B.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*B.b2_pi})})();(function(){var I=Box2D.Common.Math.b2Mat22,H=Box2D.Common.Math.b2Mat33,D=Box2D.Common.Math.b2Math,J=Box2D.Common.Math.b2Sweep,C=Box2D.Common.Math.b2Transform,B=Box2D.Common.Math.b2Vec2,E=Box2D.Common.Math.b2Vec3;I.b2Mat22=function(){this.col1=new B;this.col2=new B};I.prototype.b2Mat22=function(){this.SetIdentity()};I.FromAngle=function(A){if(A===undefined){A=0}var F=new I;F.Set(A);return F};I.FromVV=function(F,G){var A=new I;A.SetVV(F,G);return A};I.prototype.Set=function(A){if(A===undefined){A=0}var F=Math.cos(A);A=Math.sin(A);this.col1.x=F;this.col2.x=-A;this.col1.y=A;this.col2.y=F};I.prototype.SetVV=function(A,F){this.col1.SetV(A);this.col2.SetV(F)};I.prototype.Copy=function(){var A=new I;A.SetM(this);return A};I.prototype.SetM=function(A){this.col1.SetV(A.col1);this.col2.SetV(A.col2)};I.prototype.AddM=function(A){this.col1.x+=A.col1.x;this.col1.y+=A.col1.y;this.col2.x+=A.col2.x;this.col2.y+=A.col2.y};I.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=1};I.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0};I.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)};I.prototype.GetInverse=function(K){var O=this.col1.x,G=this.col2.x,F=this.col1.y,N=this.col2.y,A=O*N-G*F;if(A!=0){A=1/A}K.col1.x=A*N;K.col2.x=-A*G;K.col1.y=-A*F;K.col2.y=A*O;return K};I.prototype.Solve=function(O,R,N){if(R===undefined){R=0}if(N===undefined){N=0}var G=this.col1.x,P=this.col2.x,F=this.col1.y,K=this.col2.y,A=G*K-P*F;if(A!=0){A=1/A}O.x=A*(K*R-P*N);O.y=A*(G*N-F*R);return O};I.prototype.Abs=function(){this.col1.Abs();this.col2.Abs()};H.b2Mat33=function(){this.col1=new E;this.col2=new E;this.col3=new E};H.prototype.b2Mat33=function(F,G,A){if(F===undefined){F=null}if(G===undefined){G=null}if(A===undefined){A=null}if(!F&&!G&&!A){this.col1.SetZero();this.col2.SetZero();this.col3.SetZero()}else{this.col1.SetV(F);this.col2.SetV(G);this.col3.SetV(A)}};H.prototype.SetVVV=function(F,G,A){this.col1.SetV(F);this.col2.SetV(G);this.col3.SetV(A)};H.prototype.Copy=function(){return new H(this.col1,this.col2,this.col3)};H.prototype.SetM=function(A){this.col1.SetV(A.col1);this.col2.SetV(A.col2);this.col3.SetV(A.col3)};H.prototype.AddM=function(A){this.col1.x+=A.col1.x;this.col1.y+=A.col1.y;this.col1.z+=A.col1.z;this.col2.x+=A.col2.x;this.col2.y+=A.col2.y;this.col2.z+=A.col2.z;this.col3.x+=A.col3.x;this.col3.y+=A.col3.y;this.col3.z+=A.col3.z};H.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};H.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};H.prototype.Solve22=function(O,R,N){if(R===undefined){R=0}if(N===undefined){N=0}var G=this.col1.x,P=this.col2.x,F=this.col1.y,K=this.col2.y,A=G*K-P*F;if(A!=0){A=1/A}O.x=A*(K*R-P*N);O.y=A*(G*N-F*R);return O};H.prototype.Solve33=function(K,G,R,O){if(G===undefined){G=0}if(R===undefined){R=0}if(O===undefined){O=0}var S=this.col1.x,U=this.col1.y,X=this.col1.z,N=this.col2.x,F=this.col2.y,P=this.col2.z,T=this.col3.x,b=this.col3.y,A=this.col3.z,Z=S*(F*A-P*b)+U*(P*T-N*A)+X*(N*b-F*T);if(Z!=0){Z=1/Z}K.x=Z*(G*(F*A-P*b)+R*(P*T-N*A)+O*(N*b-F*T));K.y=Z*(S*(R*A-O*b)+U*(O*T-G*A)+X*(G*b-R*T));K.z=Z*(S*(F*O-P*R)+U*(P*G-N*O)+X*(N*R-F*G));return K};D.b2Math=function(){};D.IsValid=function(A){if(A===undefined){A=0}return isFinite(A)};D.Dot=function(A,F){return A.x*F.x+A.y*F.y};D.CrossVV=function(A,F){return A.x*F.y-A.y*F.x};D.CrossVF=function(A,F){if(F===undefined){F=0}return new B(F*A.y,-F*A.x)};D.CrossFV=function(A,F){if(A===undefined){A=0}return new B(-A*F.y,A*F.x)};D.MulMV=function(A,F){return new B(A.col1.x*F.x+A.col2.x*F.y,A.col1.y*F.x+A.col2.y*F.y)};D.MulTMV=function(A,F){return new B(D.Dot(F,A.col1),D.Dot(F,A.col2))};D.MulX=function(F,G){var A=D.MulMV(F.R,G);A.x+=F.position.x;A.y+=F.position.y;return A};D.MulXT=function(G,K){var F=D.SubtractVV(K,G.position),A=F.x*G.R.col1.x+F.y*G.R.col1.y;F.y=F.x*G.R.col2.x+F.y*G.R.col2.y;F.x=A;return F};D.AddVV=function(A,F){return new B(A.x+F.x,A.y+F.y)};D.SubtractVV=function(A,F){return new B(A.x-F.x,A.y-F.y)};D.Distance=function(G,K){var F=G.x-K.x,A=G.y-K.y;return Math.sqrt(F*F+A*A)};D.DistanceSquared=function(G,K){var F=G.x-K.x,A=G.y-K.y;return F*F+A*A};D.MulFV=function(A,F){if(A===undefined){A=0}return new B(A*F.x,A*F.y)};D.AddMM=function(A,F){return I.FromVV(D.AddVV(A.col1,F.col1),D.AddVV(A.col2,F.col2))};D.MulMM=function(A,F){return I.FromVV(D.MulMV(A,F.col1),D.MulMV(A,F.col2))};D.MulTMM=function(G,K){var F=new B(D.Dot(G.col1,K.col1),D.Dot(G.col2,K.col1)),A=new B(D.Dot(G.col1,K.col2),D.Dot(G.col2,K.col2));return I.FromVV(F,A)};D.Abs=function(A){if(A===undefined){A=0}return A>0?A:-A};D.AbsV=function(A){return new B(D.Abs(A.x),D.Abs(A.y))};D.AbsM=function(A){return I.FromVV(D.AbsV(A.col1),D.AbsV(A.col2))};D.Min=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return AF?A:F};D.MaxV=function(A,F){return new B(D.Max(A.x,F.x),D.Max(A.y,F.y))};D.Clamp=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}return FA?A:F};D.ClampV=function(F,G,A){return D.MaxV(G,D.MinV(F,A))};D.Swap=function(F,G){var A=F[0];F[0]=G[0];G[0]=A};D.Random=function(){return Math.random()*2-1};D.RandomRange=function(F,G){if(F===undefined){F=0}if(G===undefined){G=0}var A=Math.random();return A=(G-F)*A+F};D.NextPowerOfTwo=function(A){if(A===undefined){A=0}A|=A>>1&2147483647;A|=A>>2&1073741823;A|=A>>4&268435455;A|=A>>8&16777215;A|=A>>16&65535;return A+1};D.IsPowerOfTwo=function(A){if(A===undefined){A=0}return A>0&&(A&A-1)==0};Box2D.postDefs.push(function(){Box2D.Common.Math.b2Math.b2Vec2_zero=new B(0,0);Box2D.Common.Math.b2Math.b2Mat22_identity=I.FromVV(new B(1,0),new B(0,1));Box2D.Common.Math.b2Math.b2Transform_identity=new C(D.b2Vec2_zero,D.b2Mat22_identity)});J.b2Sweep=function(){this.localCenter=new B;this.c0=new B;this.c=new B};J.prototype.Set=function(A){this.localCenter.SetV(A.localCenter);this.c0.SetV(A.c0);this.c.SetV(A.c);this.a0=A.a0;this.a=A.a;this.t0=A.t0};J.prototype.Copy=function(){var A=new J;A.localCenter.SetV(this.localCenter);A.c0.SetV(this.c0);A.c.SetV(this.c);A.a0=this.a0;A.a=this.a;A.t0=this.t0;return A};J.prototype.GetTransform=function(F,G){if(G===undefined){G=0}F.position.x=(1-G)*this.c0.x+G*this.c.x;F.position.y=(1-G)*this.c0.y+G*this.c.y;F.R.Set((1-G)*this.a0+G*this.a);var A=F.R;F.position.x-=A.col1.x*this.localCenter.x+A.col2.x*this.localCenter.y;F.position.y-=A.col1.y*this.localCenter.x+A.col2.y*this.localCenter.y};J.prototype.Advance=function(A){if(A===undefined){A=0}if(this.t0Number.MIN_VALUE){var F=(A-this.t0)/(1-this.t0);this.c0.x=(1-F)*this.c0.x+F*this.c.x;this.c0.y=(1-F)*this.c0.y+F*this.c.y;this.a0=(1-F)*this.a0+F*this.a;this.t0=A}};C.b2Transform=function(){this.position=new B;this.R=new I};C.prototype.b2Transform=function(A,F){if(A===undefined){A=null}if(F===undefined){F=null}if(A){this.position.SetV(A);this.R.SetM(F)}};C.prototype.Initialize=function(A,F){this.position.SetV(A);this.R.SetM(F)};C.prototype.SetIdentity=function(){this.position.SetZero();this.R.SetIdentity()};C.prototype.Set=function(A){this.position.SetV(A.position);this.R.SetM(A.R)};C.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};B.b2Vec2=function(){};B.prototype.b2Vec2=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}this.x=A;this.y=F};B.prototype.SetZero=function(){this.y=this.x=0};B.prototype.Set=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}this.x=A;this.y=F};B.prototype.SetV=function(A){this.x=A.x;this.y=A.y};B.prototype.GetNegative=function(){return new B(-this.x,-this.y)};B.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y};B.Make=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return new B(A,F)};B.prototype.Copy=function(){return new B(this.x,this.y)};B.prototype.Add=function(A){this.x+=A.x;this.y+=A.y};B.prototype.Subtract=function(A){this.x-=A.x;this.y-=A.y};B.prototype.Multiply=function(A){if(A===undefined){A=0}this.x*=A;this.y*=A};B.prototype.MulM=function(A){var F=this.x;this.x=A.col1.x*F+A.col2.x*this.y;this.y=A.col1.y*F+A.col2.y*this.y};B.prototype.MulTM=function(A){var F=D.Dot(this,A.col1);this.y=D.Dot(this,A.col2);this.x=F};B.prototype.CrossVF=function(A){if(A===undefined){A=0}var F=this.x;this.x=A*this.y;this.y=-A*F};B.prototype.CrossFV=function(A){if(A===undefined){A=0}var F=this.x;this.x=-A*this.y;this.y=A*F};B.prototype.MinV=function(A){this.x=this.xA.x?this.x:A.x;this.y=this.y>A.y?this.y:A.y};B.prototype.Abs=function(){if(this.x<0){this.x=-this.x}if(this.y<0){this.y=-this.y}};B.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};B.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y};B.prototype.Normalize=function(){var A=Math.sqrt(this.x*this.x+this.y*this.y);if(A0;B.SetNextEdge(G,D,F,E);G.SetPrevEdge(B,D,F,E);return A};AS.prototype.CreateFixture=function(A){if(this.m_world.IsLocked()==true){return null}var B=new b;B.Create(this,this.m_xf,A);this.m_flags&AS.e_activeFlag&&B.CreateProxy(this.m_world.m_contactManager.m_broadPhase,this.m_xf);B.m_next=this.m_fixtureList;this.m_fixtureList=B;++this.m_fixtureCount;B.m_body=this;B.m_density>0&&this.ResetMassData();this.m_world.m_flags|=AU.e_newFixture;return B};AS.prototype.CreateFixture2=function(A,D){if(D===undefined){D=0}var B=new AW;B.shape=A;B.density=D;return this.CreateFixture(B)};AS.prototype.DestroyFixture=function(B){if(this.m_world.IsLocked()!=true){for(var F=this.m_fixtureList,D=null;F!=null;){if(F==B){if(D){D.m_next=B.m_next}else{this.m_fixtureList=B.m_next}break}D=F;F=F.m_next}for(F=this.m_contactList;F;){D=F.contact;F=F.next;var A=D.GetFixtureA(),E=D.GetFixtureB();if(B==A||B==E){this.m_world.m_contactManager.Destroy(D)}}this.m_flags&AS.e_activeFlag&&B.DestroyProxy(this.m_world.m_contactManager.m_broadPhase);B.Destroy();B.m_body=null;B.m_next=null;--this.m_fixtureCount;this.ResetMassData()}};AS.prototype.SetPositionAndAngle=function(B,E){if(E===undefined){E=0}var D;if(this.m_world.IsLocked()!=true){this.m_xf.R.Set(E);this.m_xf.position.SetV(B);D=this.m_xf.R;var A=this.m_sweep.localCenter;this.m_sweep.c.x=D.col1.x*A.x+D.col2.x*A.y;this.m_sweep.c.y=D.col1.y*A.x+D.col2.y*A.y;this.m_sweep.c.x+=this.m_xf.position.x;this.m_sweep.c.y+=this.m_xf.position.y;this.m_sweep.c0.SetV(this.m_sweep.c);this.m_sweep.a0=this.m_sweep.a=E;A=this.m_world.m_contactManager.m_broadPhase;for(D=this.m_fixtureList;D;D=D.m_next){D.Synchronize(A,this.m_xf,this.m_xf)}this.m_world.m_contactManager.FindNewContacts()}};AS.prototype.SetTransform=function(A){this.SetPositionAndAngle(A.position,A.GetAngle())};AS.prototype.GetTransform=function(){return this.m_xf};AS.prototype.GetPosition=function(){return this.m_xf.position};AS.prototype.SetPosition=function(A){this.SetPositionAndAngle(A,this.GetAngle())};AS.prototype.GetAngle=function(){return this.m_sweep.a};AS.prototype.SetAngle=function(A){if(A===undefined){A=0}this.SetPositionAndAngle(this.GetPosition(),A)};AS.prototype.GetWorldCenter=function(){return this.m_sweep.c};AS.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter};AS.prototype.SetLinearVelocity=function(A){this.m_type!=AS.b2_staticBody&&this.m_linearVelocity.SetV(A)};AS.prototype.GetLinearVelocity=function(){return this.m_linearVelocity};AS.prototype.SetAngularVelocity=function(A){if(A===undefined){A=0}if(this.m_type!=AS.b2_staticBody){this.m_angularVelocity=A}};AS.prototype.GetAngularVelocity=function(){return this.m_angularVelocity};AS.prototype.GetDefinition=function(){var A=new AA;A.type=this.GetType();A.allowSleep=(this.m_flags&AS.e_allowSleepFlag)==AS.e_allowSleepFlag;A.angle=this.GetAngle();A.angularDamping=this.m_angularDamping;A.angularVelocity=this.m_angularVelocity;A.fixedRotation=(this.m_flags&AS.e_fixedRotationFlag)==AS.e_fixedRotationFlag;A.bullet=(this.m_flags&AS.e_bulletFlag)==AS.e_bulletFlag;A.awake=(this.m_flags&AS.e_awakeFlag)==AS.e_awakeFlag;A.linearDamping=this.m_linearDamping;A.linearVelocity.SetV(this.GetLinearVelocity());A.position=this.GetPosition();A.userData=this.GetUserData();return A};AS.prototype.ApplyForce=function(A,B){if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_force.x+=A.x;this.m_force.y+=A.y;this.m_torque+=(B.x-this.m_sweep.c.x)*A.y-(B.y-this.m_sweep.c.y)*A.x}};AS.prototype.ApplyTorque=function(A){if(A===undefined){A=0}if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_torque+=A}};AS.prototype.ApplyImpulse=function(A,B){if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_linearVelocity.x+=this.m_invMass*A.x;this.m_linearVelocity.y+=this.m_invMass*A.y;this.m_angularVelocity+=this.m_invI*((B.x-this.m_sweep.c.x)*A.y-(B.y-this.m_sweep.c.y)*A.x)}};AS.prototype.Split=function(D){for(var I=this.GetLinearVelocity().Copy(),F=this.GetAngularVelocity(),B=this.GetWorldCenter(),H=this.m_world.CreateBody(this.GetDefinition()),G,A=this.m_fixtureList;A;){if(D(A)){var E=A.m_next;if(G){G.m_next=E}else{this.m_fixtureList=E}this.m_fixtureCount--;A.m_next=H.m_fixtureList;H.m_fixtureList=A;H.m_fixtureCount++;A.m_body=H;A=E}else{G=A;A=A.m_next}}this.ResetMassData();H.ResetMassData();G=this.GetWorldCenter();D=H.GetWorldCenter();G=AI.AddVV(I,AI.CrossFV(F,AI.SubtractVV(G,B)));I=AI.AddVV(I,AI.CrossFV(F,AI.SubtractVV(D,B)));this.SetLinearVelocity(G);H.SetLinearVelocity(I);this.SetAngularVelocity(F);H.SetAngularVelocity(F);this.SynchronizeFixtures();H.SynchronizeFixtures();return H};AS.prototype.Merge=function(B){var F;for(F=B.m_fixtureList;F;){var D=F.m_next;B.m_fixtureCount--;F.m_next=this.m_fixtureList;this.m_fixtureList=F;this.m_fixtureCount++;F.m_body=E;F=D}A.m_fixtureCount=0;var A=this,E=B;A.GetWorldCenter();E.GetWorldCenter();A.GetLinearVelocity().Copy();E.GetLinearVelocity().Copy();A.GetAngularVelocity();E.GetAngularVelocity();A.ResetMassData();this.SynchronizeFixtures()};AS.prototype.GetMass=function(){return this.m_mass};AS.prototype.GetInertia=function(){return this.m_I};AS.prototype.GetMassData=function(A){A.mass=this.m_mass;A.I=this.m_I;A.center.SetV(this.m_sweep.localCenter)};AS.prototype.SetMassData=function(A){AN.b2Assert(this.m_world.IsLocked()==false);if(this.m_world.IsLocked()!=true){if(this.m_type==AS.b2_dynamicBody){this.m_invI=this.m_I=this.m_invMass=0;this.m_mass=A.mass;if(this.m_mass<=0){this.m_mass=1}this.m_invMass=1/this.m_mass;if(A.I>0&&(this.m_flags&AS.e_fixedRotationFlag)==0){this.m_I=A.I-this.m_mass*(A.center.x*A.center.x+A.center.y*A.center.y);this.m_invI=1/this.m_I}var B=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(A.center);this.m_sweep.c0.SetV(AI.MulX(this.m_xf,this.m_sweep.localCenter));this.m_sweep.c.SetV(this.m_sweep.c0);this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-B.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-B.x)}}};AS.prototype.ResetMassData=function(){this.m_invI=this.m_I=this.m_invMass=this.m_mass=0;this.m_sweep.localCenter.SetZero();if(!(this.m_type==AS.b2_staticBody||this.m_type==AS.b2_kinematicBody)){for(var A=AC.Make(0,0),D=this.m_fixtureList;D;D=D.m_next){if(D.m_density!=0){var B=D.GetMassData();this.m_mass+=B.mass;A.x+=B.center.x*B.mass;A.y+=B.center.y*B.mass;this.m_I+=B.I}}if(this.m_mass>0){this.m_invMass=1/this.m_mass;A.x*=this.m_invMass;A.y*=this.m_invMass}else{this.m_invMass=this.m_mass=1}if(this.m_I>0&&(this.m_flags&AS.e_fixedRotationFlag)==0){this.m_I-=this.m_mass*(A.x*A.x+A.y*A.y);this.m_I*=this.m_inertiaScale;AN.b2Assert(this.m_I>0);this.m_invI=1/this.m_I}else{this.m_invI=this.m_I=0}D=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(A);this.m_sweep.c0.SetV(AI.MulX(this.m_xf,this.m_sweep.localCenter));this.m_sweep.c.SetV(this.m_sweep.c0);this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-D.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-D.x)}};AS.prototype.GetWorldPoint=function(A){var B=this.m_xf.R;A=new AC(B.col1.x*A.x+B.col2.x*A.y,B.col1.y*A.x+B.col2.y*A.y);A.x+=this.m_xf.position.x;A.y+=this.m_xf.position.y;return A};AS.prototype.GetWorldVector=function(A){return AI.MulMV(this.m_xf.R,A)};AS.prototype.GetLocalPoint=function(A){return AI.MulXT(this.m_xf,A)};AS.prototype.GetLocalVector=function(A){return AI.MulTMV(this.m_xf.R,A)};AS.prototype.GetLinearVelocityFromWorldPoint=function(A){return new AC(this.m_linearVelocity.x-this.m_angularVelocity*(A.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(A.x-this.m_sweep.c.x))};AS.prototype.GetLinearVelocityFromLocalPoint=function(A){var B=this.m_xf.R;A=new AC(B.col1.x*A.x+B.col2.x*A.y,B.col1.y*A.x+B.col2.y*A.y);A.x+=this.m_xf.position.x;A.y+=this.m_xf.position.y;return new AC(this.m_linearVelocity.x-this.m_angularVelocity*(A.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(A.x-this.m_sweep.c.x))};AS.prototype.GetLinearDamping=function(){return this.m_linearDamping};AS.prototype.SetLinearDamping=function(A){if(A===undefined){A=0}this.m_linearDamping=A};AS.prototype.GetAngularDamping=function(){return this.m_angularDamping};AS.prototype.SetAngularDamping=function(A){if(A===undefined){A=0}this.m_angularDamping=A};AS.prototype.SetType=function(A){if(A===undefined){A=0}if(this.m_type!=A){this.m_type=A;this.ResetMassData();if(this.m_type==AS.b2_staticBody){this.m_linearVelocity.SetZero();this.m_angularVelocity=0}this.SetAwake(true);this.m_force.SetZero();this.m_torque=0;for(A=this.m_contactList;A;A=A.next){A.contact.FlagForFiltering()}}};AS.prototype.GetType=function(){return this.m_type};AS.prototype.SetBullet=function(A){if(A){this.m_flags|=AS.e_bulletFlag}else{this.m_flags&=~AS.e_bulletFlag}};AS.prototype.IsBullet=function(){return(this.m_flags&AS.e_bulletFlag)==AS.e_bulletFlag};AS.prototype.SetSleepingAllowed=function(A){if(A){this.m_flags|=AS.e_allowSleepFlag}else{this.m_flags&=~AS.e_allowSleepFlag;this.SetAwake(true)}};AS.prototype.SetAwake=function(A){if(A){this.m_flags|=AS.e_awakeFlag;this.m_sleepTime=0}else{this.m_flags&=~AS.e_awakeFlag;this.m_sleepTime=0;this.m_linearVelocity.SetZero();this.m_angularVelocity=0;this.m_force.SetZero();this.m_torque=0}};AS.prototype.IsAwake=function(){return(this.m_flags&AS.e_awakeFlag)==AS.e_awakeFlag};AS.prototype.SetFixedRotation=function(A){if(A){this.m_flags|=AS.e_fixedRotationFlag}else{this.m_flags&=~AS.e_fixedRotationFlag}this.ResetMassData()};AS.prototype.IsFixedRotation=function(){return(this.m_flags&AS.e_fixedRotationFlag)==AS.e_fixedRotationFlag};AS.prototype.SetActive=function(A){if(A!=this.IsActive()){var B;if(A){this.m_flags|=AS.e_activeFlag;A=this.m_world.m_contactManager.m_broadPhase;for(B=this.m_fixtureList;B;B=B.m_next){B.CreateProxy(A,this.m_xf)}}else{this.m_flags&=~AS.e_activeFlag;A=this.m_world.m_contactManager.m_broadPhase;for(B=this.m_fixtureList;B;B=B.m_next){B.DestroyProxy(A)}for(A=this.m_contactList;A;){B=A;A=A.next;this.m_world.m_contactManager.Destroy(B.contact)}this.m_contactList=null}}};AS.prototype.IsActive=function(){return(this.m_flags&AS.e_activeFlag)==AS.e_activeFlag};AS.prototype.IsSleepingAllowed=function(){return(this.m_flags&AS.e_allowSleepFlag)==AS.e_allowSleepFlag};AS.prototype.GetFixtureList=function(){return this.m_fixtureList};AS.prototype.GetJointList=function(){return this.m_jointList};AS.prototype.GetControllerList=function(){return this.m_controllerList};AS.prototype.GetContactList=function(){return this.m_contactList};AS.prototype.GetNext=function(){return this.m_next};AS.prototype.GetUserData=function(){return this.m_userData};AS.prototype.SetUserData=function(A){this.m_userData=A};AS.prototype.GetWorld=function(){return this.m_world};AS.prototype.b2Body=function(B,E){this.m_flags=0;if(B.bullet){this.m_flags|=AS.e_bulletFlag}if(B.fixedRotation){this.m_flags|=AS.e_fixedRotationFlag}if(B.allowSleep){this.m_flags|=AS.e_allowSleepFlag}if(B.awake){this.m_flags|=AS.e_awakeFlag}if(B.active){this.m_flags|=AS.e_activeFlag}this.m_world=E;this.m_xf.position.SetV(B.position);this.m_xf.R.Set(B.angle);this.m_sweep.localCenter.SetZero();this.m_sweep.t0=1;this.m_sweep.a0=this.m_sweep.a=B.angle;var D=this.m_xf.R,A=this.m_sweep.localCenter;this.m_sweep.c.x=D.col1.x*A.x+D.col2.x*A.y;this.m_sweep.c.y=D.col1.y*A.x+D.col2.y*A.y;this.m_sweep.c.x+=this.m_xf.position.x;this.m_sweep.c.y+=this.m_xf.position.y;this.m_sweep.c0.SetV(this.m_sweep.c);this.m_contactList=this.m_controllerList=this.m_jointList=null;this.m_controllerCount=0;this.m_next=this.m_prev=null;this.m_linearVelocity.SetV(B.linearVelocity);this.m_angularVelocity=B.angularVelocity;this.m_linearDamping=B.linearDamping;this.m_angularDamping=B.angularDamping;this.m_force.Set(0,0);this.m_sleepTime=this.m_torque=0;this.m_type=B.type;if(this.m_type==AS.b2_dynamicBody){this.m_invMass=this.m_mass=1}else{this.m_invMass=this.m_mass=0}this.m_invI=this.m_I=0;this.m_inertiaScale=B.inertiaScale;this.m_userData=B.userData;this.m_fixtureList=null;this.m_fixtureCount=0};AS.prototype.SynchronizeFixtures=function(){var A=AS.s_xf1;A.R.Set(this.m_sweep.a0);var D=A.R,B=this.m_sweep.localCenter;A.position.x=this.m_sweep.c0.x-(D.col1.x*B.x+D.col2.x*B.y);A.position.y=this.m_sweep.c0.y-(D.col1.y*B.x+D.col2.y*B.y);B=this.m_world.m_contactManager.m_broadPhase;for(D=this.m_fixtureList;D;D=D.m_next){D.Synchronize(B,A,this.m_xf)}};AS.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var A=this.m_xf.R,B=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(A.col1.x*B.x+A.col2.x*B.y);this.m_xf.position.y=this.m_sweep.c.y-(A.col1.y*B.x+A.col2.y*B.y)};AS.prototype.ShouldCollide=function(A){if(this.m_type!=AS.b2_dynamicBody&&A.m_type!=AS.b2_dynamicBody){return false}for(var B=this.m_jointList;B;B=B.next){if(B.other==A){if(B.joint.m_collideConnected==false){return false}}}return true};AS.prototype.Advance=function(A){if(A===undefined){A=0}this.m_sweep.Advance(A);this.m_sweep.c.SetV(this.m_sweep.c0);this.m_sweep.a=this.m_sweep.a0;this.SynchronizeTransform()};Box2D.postDefs.push(function(){Box2D.Dynamics.b2Body.s_xf1=new AB;Box2D.Dynamics.b2Body.e_islandFlag=1;Box2D.Dynamics.b2Body.e_awakeFlag=2;Box2D.Dynamics.b2Body.e_allowSleepFlag=4;Box2D.Dynamics.b2Body.e_bulletFlag=8;Box2D.Dynamics.b2Body.e_fixedRotationFlag=16;Box2D.Dynamics.b2Body.e_activeFlag=32;Box2D.Dynamics.b2Body.b2_staticBody=0;Box2D.Dynamics.b2Body.b2_kinematicBody=1;Box2D.Dynamics.b2Body.b2_dynamicBody=2});AA.b2BodyDef=function(){this.position=new AC;this.linearVelocity=new AC};AA.prototype.b2BodyDef=function(){this.userData=null;this.position.Set(0,0);this.angle=0;this.linearVelocity.Set(0,0);this.angularDamping=this.linearDamping=this.angularVelocity=0;this.awake=this.allowSleep=true;this.bullet=this.fixedRotation=false;this.type=AS.b2_staticBody;this.active=true;this.inertiaScale=1};AH.b2ContactFilter=function(){};AH.prototype.ShouldCollide=function(B,E){var D=B.GetFilterData(),A=E.GetFilterData();if(D.groupIndex==A.groupIndex&&D.groupIndex!=0){return D.groupIndex>0}return(D.maskBits&A.categoryBits)!=0&&(D.categoryBits&A.maskBits)!=0};AH.prototype.RayCollide=function(A,B){if(!A){return true}return this.ShouldCollide(A instanceof b?A:null,B)};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactFilter.b2_defaultFilter=new AH});AK.b2ContactImpulse=function(){this.normalImpulses=new Vector_a2j_Number(AN.b2_maxManifoldPoints);this.tangentImpulses=new Vector_a2j_Number(AN.b2_maxManifoldPoints)};AE.b2ContactListener=function(){};AE.prototype.BeginContact=function(){};AE.prototype.EndContact=function(){};AE.prototype.PreSolve=function(){};AE.prototype.PostSolve=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactListener.b2_defaultListener=new AE});g.b2ContactManager=function(){};g.prototype.b2ContactManager=function(){this.m_world=null;this.m_contactCount=0;this.m_contactFilter=AH.b2_defaultFilter;this.m_contactListener=AE.b2_defaultListener;this.m_contactFactory=new AT(this.m_allocator);this.m_broadPhase=new AM};g.prototype.AddPair=function(I,G){var D=I instanceof b?I:null,H=G instanceof b?G:null,F=D.GetBody(),E=H.GetBody();if(F!=E){for(var B=E.GetContactList();B;){if(B.other==F){var A=B.contact.GetFixtureA(),K=B.contact.GetFixtureB();if(A==D&&K==H){return}if(A==H&&K==D){return}}B=B.next}if(E.ShouldCollide(F)!=false){if(this.m_contactFilter.ShouldCollide(D,H)!=false){B=this.m_contactFactory.Create(D,H);D=B.GetFixtureA();H=B.GetFixtureB();F=D.m_body;E=H.m_body;B.m_prev=null;B.m_next=this.m_world.m_contactList;if(this.m_world.m_contactList!=null){this.m_world.m_contactList.m_prev=B}this.m_world.m_contactList=B;B.m_nodeA.contact=B;B.m_nodeA.other=E;B.m_nodeA.prev=null;B.m_nodeA.next=F.m_contactList;if(F.m_contactList!=null){F.m_contactList.prev=B.m_nodeA}F.m_contactList=B.m_nodeA;B.m_nodeB.contact=B;B.m_nodeB.other=F;B.m_nodeB.prev=null;B.m_nodeB.next=E.m_contactList;if(E.m_contactList!=null){E.m_contactList.prev=B.m_nodeB}E.m_contactList=B.m_nodeB;++this.m_world.m_contactCount}}}};g.prototype.FindNewContacts=function(){this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this,this.AddPair))};g.prototype.Destroy=function(A){var D=A.GetFixtureA(),B=A.GetFixtureB();D=D.GetBody();B=B.GetBody();A.IsTouching()&&this.m_contactListener.EndContact(A);if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(A==this.m_world.m_contactList){this.m_world.m_contactList=A.m_next}if(A.m_nodeA.prev){A.m_nodeA.prev.next=A.m_nodeA.next}if(A.m_nodeA.next){A.m_nodeA.next.prev=A.m_nodeA.prev}if(A.m_nodeA==D.m_contactList){D.m_contactList=A.m_nodeA.next}if(A.m_nodeB.prev){A.m_nodeB.prev.next=A.m_nodeB.next}if(A.m_nodeB.next){A.m_nodeB.next.prev=A.m_nodeB.prev}if(A.m_nodeB==B.m_contactList){B.m_contactList=A.m_nodeB.next}this.m_contactFactory.Destroy(A);--this.m_contactCount};g.prototype.Collide=function(){for(var B=this.m_world.m_contactList;B;){var F=B.GetFixtureA(),D=B.GetFixtureB(),A=F.GetBody(),E=D.GetBody();if(A.IsAwake()==false&&E.IsAwake()==false){B=B.GetNext()}else{if(B.m_flags&AR.e_filterFlag){if(E.ShouldCollide(A)==false){F=B;B=F.GetNext();this.Destroy(F);continue}if(this.m_contactFilter.ShouldCollide(F,D)==false){F=B;B=F.GetNext();this.Destroy(F);continue}B.m_flags&=~AR.e_filterFlag}if(this.m_broadPhase.TestOverlap(F.m_proxy,D.m_proxy)==false){F=B;B=F.GetNext();this.Destroy(F)}else{B.Update(this.m_contactListener);B=B.GetNext()}}}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactManager.s_evalCP=new AO});AJ.b2DebugDraw=function(){};AJ.prototype.b2DebugDraw=function(){};AJ.prototype.SetFlags=function(){};AJ.prototype.GetFlags=function(){};AJ.prototype.AppendFlags=function(){};AJ.prototype.ClearFlags=function(){};AJ.prototype.SetSprite=function(){};AJ.prototype.GetSprite=function(){};AJ.prototype.SetDrawScale=function(){};AJ.prototype.GetDrawScale=function(){};AJ.prototype.SetLineThickness=function(){};AJ.prototype.GetLineThickness=function(){};AJ.prototype.SetAlpha=function(){};AJ.prototype.GetAlpha=function(){};AJ.prototype.SetFillAlpha=function(){};AJ.prototype.GetFillAlpha=function(){};AJ.prototype.SetXFormScale=function(){};AJ.prototype.GetXFormScale=function(){};AJ.prototype.DrawPolygon=function(){};AJ.prototype.DrawSolidPolygon=function(){};AJ.prototype.DrawCircle=function(){};AJ.prototype.DrawSolidCircle=function(){};AJ.prototype.DrawSegment=function(){};AJ.prototype.DrawTransform=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2DebugDraw.e_shapeBit=1;Box2D.Dynamics.b2DebugDraw.e_jointBit=2;Box2D.Dynamics.b2DebugDraw.e_aabbBit=4;Box2D.Dynamics.b2DebugDraw.e_pairBit=8;Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit=16;Box2D.Dynamics.b2DebugDraw.e_controllerBit=32});e.b2DestructionListener=function(){};e.prototype.SayGoodbyeJoint=function(){};e.prototype.SayGoodbyeFixture=function(){};m.b2FilterData=function(){this.categoryBits=1;this.maskBits=65535;this.groupIndex=0};m.prototype.Copy=function(){var A=new m;A.categoryBits=this.categoryBits;A.maskBits=this.maskBits;A.groupIndex=this.groupIndex;return A};b.b2Fixture=function(){this.m_filter=new m};b.prototype.GetType=function(){return this.m_shape.GetType()};b.prototype.GetShape=function(){return this.m_shape};b.prototype.SetSensor=function(B){if(this.m_isSensor!=B){this.m_isSensor=B;if(this.m_body!=null){for(B=this.m_body.GetContactList();B;){var E=B.contact,D=E.GetFixtureA(),A=E.GetFixtureB();if(D==this||A==this){E.SetSensor(D.IsSensor()||A.IsSensor())}B=B.next}}}};b.prototype.IsSensor=function(){return this.m_isSensor};b.prototype.SetFilterData=function(B){this.m_filter=B.Copy();if(!this.m_body){for(B=this.m_body.GetContactList();B;){var E=B.contact,D=E.GetFixtureA(),A=E.GetFixtureB();if(D==this||A==this){E.FlagForFiltering()}B=B.next}}};b.prototype.GetFilterData=function(){return this.m_filter.Copy()};b.prototype.GetBody=function(){return this.m_body};b.prototype.GetNext=function(){return this.m_next};b.prototype.GetUserData=function(){return this.m_userData};b.prototype.SetUserData=function(A){this.m_userData=A};b.prototype.TestPoint=function(A){return this.m_shape.TestPoint(this.m_body.GetTransform(),A)};b.prototype.RayCast=function(A,B){return this.m_shape.RayCast(A,B,this.m_body.GetTransform())};b.prototype.GetMassData=function(A){if(A===undefined){A=null}if(A==null){A=new AD}this.m_shape.ComputeMass(A,this.m_density);return A};b.prototype.SetDensity=function(A){if(A===undefined){A=0}this.m_density=A};b.prototype.GetDensity=function(){return this.m_density};b.prototype.GetFriction=function(){return this.m_friction};b.prototype.SetFriction=function(A){if(A===undefined){A=0}this.m_friction=A};b.prototype.GetRestitution=function(){return this.m_restitution};b.prototype.SetRestitution=function(A){if(A===undefined){A=0}this.m_restitution=A};b.prototype.GetAABB=function(){return this.m_aabb};b.prototype.b2Fixture=function(){this.m_aabb=new X;this.m_shape=this.m_next=this.m_body=this.m_userData=null;this.m_restitution=this.m_friction=this.m_density=0};b.prototype.Create=function(A,D,B){this.m_userData=B.userData;this.m_friction=B.friction;this.m_restitution=B.restitution;this.m_body=A;this.m_next=null;this.m_filter=B.filter.Copy();this.m_isSensor=B.isSensor;this.m_shape=B.shape.Copy();this.m_density=B.density};b.prototype.Destroy=function(){this.m_shape=null};b.prototype.CreateProxy=function(A,B){this.m_shape.ComputeAABB(this.m_aabb,B);this.m_proxy=A.CreateProxy(this.m_aabb,this)};b.prototype.DestroyProxy=function(A){if(this.m_proxy!=null){A.DestroyProxy(this.m_proxy);this.m_proxy=null}};b.prototype.Synchronize=function(B,F,D){if(this.m_proxy){var A=new X,E=new X;this.m_shape.ComputeAABB(A,F);this.m_shape.ComputeAABB(E,D);this.m_aabb.Combine(A,E);F=AI.SubtractVV(D.position,F.position);B.MoveProxy(this.m_proxy,this.m_aabb,F)}};AW.b2FixtureDef=function(){this.filter=new m};AW.prototype.b2FixtureDef=function(){this.userData=this.shape=null;this.friction=0.2;this.density=this.restitution=0;this.filter.categoryBits=1;this.filter.maskBits=65535;this.filter.groupIndex=0;this.isSensor=false};C.b2Island=function(){};C.prototype.b2Island=function(){this.m_bodies=new Vector;this.m_contacts=new Vector;this.m_joints=new Vector};C.prototype.Initialize=function(D,H,E,B,G,F){if(D===undefined){D=0}if(H===undefined){H=0}if(E===undefined){E=0}var A=0;this.m_bodyCapacity=D;this.m_contactCapacity=H;this.m_jointCapacity=E;this.m_jointCount=this.m_contactCount=this.m_bodyCount=0;this.m_allocator=B;this.m_listener=G;this.m_contactSolver=F;for(A=this.m_bodies.length;AAN.b2_maxTranslationSquared){H.m_linearVelocity.Normalize();H.m_linearVelocity.x*=AN.b2_maxTranslation*D.inv_dt;H.m_linearVelocity.y*=AN.b2_maxTranslation*D.inv_dt}A=D.dt*H.m_angularVelocity;if(A*A>AN.b2_maxRotationSquared){H.m_angularVelocity=H.m_angularVelocity<0?-AN.b2_maxRotation*D.inv_dt:AN.b2_maxRotation*D.inv_dt}H.m_sweep.c0.SetV(H.m_sweep.c);H.m_sweep.a0=H.m_sweep.a;H.m_sweep.c.x+=D.dt*H.m_linearVelocity.x;H.m_sweep.c.y+=D.dt*H.m_linearVelocity.y;H.m_sweep.a+=D.dt*H.m_angularVelocity;H.SynchronizeTransform()}}for(B=0;BA||AI.Dot(H.m_linearVelocity,H.m_linearVelocity)>I){F=H.m_sleepTime=0}else{H.m_sleepTime+=D.dt;F=AI.Min(F,H.m_sleepTime)}}}if(F>=AN.b2_timeToSleep){for(B=0;BAN.b2_maxTranslationSquared){E.m_linearVelocity.Normalize();E.m_linearVelocity.x*=AN.b2_maxTranslation*D.inv_dt;E.m_linearVelocity.y*=AN.b2_maxTranslation*D.inv_dt}G=D.dt*E.m_angularVelocity;if(G*G>AN.b2_maxRotationSquared){E.m_angularVelocity=E.m_angularVelocity<0?-AN.b2_maxRotation*D.inv_dt:AN.b2_maxRotation*D.inv_dt}E.m_sweep.c0.SetV(E.m_sweep.c);E.m_sweep.a0=E.m_sweep.a;E.m_sweep.c.x+=D.dt*E.m_linearVelocity.x;E.m_sweep.c.y+=D.dt*E.m_linearVelocity.y;E.m_sweep.a+=D.dt*E.m_angularVelocity;E.SynchronizeTransform()}}for(H=0;H0?1/B:0;A.dtRatio=this.m_inv_dt0*B;A.warmStarting=AU.m_warmStarting;this.m_contactManager.Collide();A.dt>0&&this.Solve(A);AU.m_continuousPhysics&&A.dt>0&&this.SolveTOI(A);if(A.dt>0){this.m_inv_dt0=A.inv_dt}this.m_flags&=~AU.e_locked};AU.prototype.ClearForces=function(){for(var A=this.m_bodyList;A;A=A.m_next){A.m_force.SetZero();A.m_torque=0}};AU.prototype.DrawDebugData=function(){if(this.m_debugDraw!=null){this.m_debugDraw.m_sprite.graphics.clear();var D=this.m_debugDraw.GetFlags(),H,E,B;new AC;new AC;new AC;var G;new X;new X;G=[new AC,new AC,new AC,new AC];var F=new AF(0,0,0);if(D&AJ.e_shapeBit){for(H=this.m_bodyList;H;H=H.m_next){G=H.m_xf;for(E=H.GetFixtureList();E;E=E.m_next){B=E.GetShape();if(H.IsActive()==false){F.Set(0.5,0.5,0.3)}else{if(H.GetType()==AS.b2_staticBody){F.Set(0.5,0.9,0.5)}else{if(H.GetType()==AS.b2_kinematicBody){F.Set(0.5,0.5,0.9)}else{H.IsAwake()==false?F.Set(0.6,0.6,0.6):F.Set(0.9,0.7,0.7)}}}this.DrawShape(B,G,F)}}}if(D&AJ.e_jointBit){for(H=this.m_jointList;H;H=H.m_next){this.DrawJoint(H)}}if(D&AJ.e_controllerBit){for(H=this.m_controllerList;H;H=H.m_next){H.Draw(this.m_debugDraw)}}if(D&AJ.e_pairBit){F.Set(0.3,0.9,0.9);for(H=this.m_contactManager.m_contactList;H;H=H.GetNext()){B=H.GetFixtureA();E=H.GetFixtureB();B=B.GetAABB().GetCenter();E=E.GetAABB().GetCenter();this.m_debugDraw.DrawSegment(B,E,F)}}if(D&AJ.e_aabbBit){B=this.m_contactManager.m_broadPhase;G=[new AC,new AC,new AC,new AC];for(H=this.m_bodyList;H;H=H.GetNext()){if(H.IsActive()!=false){for(E=H.GetFixtureList();E;E=E.GetNext()){var A=B.GetFatAABB(E.m_proxy);G[0].Set(A.lowerBound.x,A.lowerBound.y);G[1].Set(A.upperBound.x,A.lowerBound.y);G[2].Set(A.upperBound.x,A.upperBound.y);G[3].Set(A.lowerBound.x,A.upperBound.y);this.m_debugDraw.DrawPolygon(G,4,F)}}}}if(D&AJ.e_centerOfMassBit){for(H=this.m_bodyList;H;H=H.m_next){G=AU.s_xf;G.R=H.m_xf.R;G.position=H.GetWorldCenter();this.m_debugDraw.DrawTransform(G)}}}};AU.prototype.QueryAABB=function(A,D){var B=this.m_contactManager.m_broadPhase;B.Query(function(E){return A(B.GetUserData(E))},D)};AU.prototype.QueryShape=function(B,F,D){if(D===undefined){D=null}if(D==null){D=new AB;D.SetIdentity()}var A=this.m_contactManager.m_broadPhase,E=new X;F.ComputeAABB(E,D);A.Query(function(G){G=A.GetUserData(G) instanceof b?A.GetUserData(G):null;if(J.TestOverlap(F,D,G.GetShape(),G.GetBody().GetTransform())){return B(G)}return true},E)};AU.prototype.QueryPoint=function(B,E){var D=this.m_contactManager.m_broadPhase,A=new X;A.lowerBound.Set(E.x-AN.b2_linearSlop,E.y-AN.b2_linearSlop);A.upperBound.Set(E.x+AN.b2_linearSlop,E.y+AN.b2_linearSlop);D.Query(function(F){F=D.GetUserData(F) instanceof b?D.GetUserData(F):null;if(F.TestPoint(E)){return B(F)}return true},A)};AU.prototype.RayCast=function(B,G,D){var A=this.m_contactManager.m_broadPhase,F=new T,E=new f(G,D);A.RayCast(function(H,M){var L=A.GetUserData(M);L=L instanceof b?L:null;if(L.RayCast(F,H)){var I=F.fraction,K=new AC((1-I)*G.x+I*D.x,(1-I)*G.y+I*D.y);return B(L,K,F.normal,I)}return H.maxFraction},E)};AU.prototype.RayCastOne=function(A,D){var B;this.RayCast(function(F,H,G,E){if(E===undefined){E=0}B=F;return E},A,D);return B};AU.prototype.RayCastAll=function(A,D){var B=new Vector;this.RayCast(function(E){B[B.length]=E;return 1},A,D);return B};AU.prototype.GetBodyList=function(){return this.m_bodyList};AU.prototype.GetJointList=function(){return this.m_jointList};AU.prototype.GetContactList=function(){return this.m_contactList};AU.prototype.IsLocked=function(){return(this.m_flags&AU.e_locked)>0};AU.prototype.Solve=function(D){for(var I,F=this.m_controllerList;F;F=F.m_next){F.Step(D)}F=this.m_island;F.Initialize(this.m_bodyCount,this.m_contactCount,this.m_jointCount,null,this.m_contactManager.m_contactListener,this.m_contactSolver);for(I=this.m_bodyList;I;I=I.m_next){I.m_flags&=~AS.e_islandFlag}for(var B=this.m_contactList;B;B=B.m_next){B.m_flags&=~AR.e_islandFlag}for(B=this.m_jointList;B;B=B.m_next){B.m_islandFlag=false}parseInt(this.m_bodyCount);B=this.s_stack;for(var H=this.m_bodyList;H;H=H.m_next){if(!(H.m_flags&AS.e_islandFlag)){if(!(H.IsAwake()==false||H.IsActive()==false)){if(H.GetType()!=AS.b2_staticBody){F.Clear();var G=0;B[G++]=H;for(H.m_flags|=AS.e_islandFlag;G>0;){I=B[--G];F.AddBody(I);I.IsAwake()==false&&I.SetAwake(true);if(I.GetType()!=AS.b2_staticBody){for(var A,E=I.m_contactList;E;E=E.next){if(!(E.contact.m_flags&AR.e_islandFlag)){if(!(E.contact.IsSensor()==true||E.contact.IsEnabled()==false||E.contact.IsTouching()==false)){F.AddContact(E.contact);E.contact.m_flags|=AR.e_islandFlag;A=E.other;if(!(A.m_flags&AS.e_islandFlag)){B[G++]=A;A.m_flags|=AS.e_islandFlag}}}}for(I=I.m_jointList;I;I=I.next){if(I.joint.m_islandFlag!=true){A=I.other;if(A.IsActive()!=false){F.AddJoint(I.joint);I.joint.m_islandFlag=true;if(!(A.m_flags&AS.e_islandFlag)){B[G++]=A;A.m_flags|=AS.e_islandFlag}}}}}}F.Solve(D,this.m_gravity,this.m_allowSleep);for(G=0;G0&&G<1){G=(1-G)*K+G;if(G>1){G=1}}H.m_toi=G;H.m_flags|=AR.e_toiFlag}if(Number.MIN_VALUE0;){G=E[H++];--B;F.AddBody(G);G.IsAwake()==false&&G.SetAwake(true);if(G.GetType()==AS.b2_dynamicBody){for(D=G.m_contactList;D;D=D.next){if(F.m_contactCount==F.m_contactCapacity){break}if(!(D.contact.m_flags&AR.e_islandFlag)){if(!(D.contact.IsSensor()==true||D.contact.IsEnabled()==false||D.contact.IsTouching()==false)){F.AddContact(D.contact);D.contact.m_flags|=AR.e_islandFlag;K=D.other;if(!(K.m_flags&AS.e_islandFlag)){if(K.GetType()!=AS.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AS.e_islandFlag}}}}for(G=G.m_jointList;G;G=G.next){if(F.m_jointCount!=F.m_jointCapacity){if(G.joint.m_islandFlag!=true){K=G.other;if(K.IsActive()!=false){F.AddJoint(G.joint);G.joint.m_islandFlag=true;if(!(K.m_flags&AS.e_islandFlag)){if(K.GetType()!=AS.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AS.e_islandFlag}}}}}}}H=AU.s_timestep;H.warmStarting=false;H.dt=(1-A)*I.dt;H.inv_dt=1/H.dt;H.dtRatio=0;H.velocityIterations=I.velocityIterations;H.positionIterations=I.positionIterations;F.SolveTOI(H);for(A=A=0;A0;for(I=0;I0){A.m_fixtureA.m_body.SetAwake(true);A.m_fixtureB.m_body.SetAwake(true)}var D=parseInt(A.m_fixtureA.GetType()),B=parseInt(A.m_fixtureB.GetType());D=this.m_registers[D][B];D.poolCount++;A.m_next=D.pool;D.pool=A;D=D.destroyFcn;D(A,this.m_allocator)};T.b2ContactRegister=function(){};n.b2ContactResult=function(){this.position=new m;this.normal=new m;this.id=new AQ};o.b2ContactSolver=function(){this.m_step=new AC;this.m_constraints=new Vector};o.prototype.b2ContactSolver=function(){};o.prototype.Initialize=function(V,R,O,S){if(O===undefined){O=0}var l;this.m_step.Set(V);this.m_allocator=S;V=0;for(this.m_constraintCount=O;this.m_constraints.length0);o.s_worldManifold.Initialize(U,Z.m_xf,W,Y.m_xf,k);h=o.s_worldManifold.m_normal.x;l=o.s_worldManifold.m_normal.y;S=this.m_constraints[V];S.bodyA=Z;S.bodyB=Y;S.manifold=U;S.normal.x=h;S.normal.y=l;S.pointCount=U.m_pointCount;S.friction=N;S.restitution=L;S.localPlaneNormal.x=U.m_localPlaneNormal.x;S.localPlaneNormal.y=U.m_localPlaneNormal.y;S.localPoint.x=U.m_localPoint.x;S.localPoint.y=U.m_localPoint.y;S.radius=W+k;S.type=U.m_type;for(W=0;W0?S:0;O=S-R.normalImpulse;h=O*k;O=O*Z;H.x-=G*h;H.y-=G*O;I-=B*(R.rA.x*O-R.rA.y*h);M.x+=F*h;M.y+=F*O;K+=A*(R.rB.x*O-R.rB.y*h);R.normalImpulse=S}else{R=l.points[0];V=l.points[1];O=R.normalImpulse;W=V.normalImpulse;var E=(M.x-K*R.rB.y-H.x+I*R.rA.y)*k+(M.y+K*R.rB.x-H.y-I*R.rA.x)*Z,Q=(M.x-K*V.rB.y-H.x+I*V.rA.y)*k+(M.y+K*V.rB.x-H.y-I*V.rA.x)*Z;S=E-R.velocityBias;h=Q-V.velocityBias;Y=l.K;S-=Y.col1.x*O+Y.col2.x*W;for(h-=Y.col1.y*O+Y.col2.y*W;;){Y=l.normalMass;D=-(Y.col1.x*S+Y.col2.x*h);Y=-(Y.col1.y*S+Y.col2.y*h);if(D>=0&&Y>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}D=-R.normalMass*S;Y=0;Q=l.K.col1.y*D+h;if(D>=0&&Q>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}D=0;Y=-V.normalMass*h;E=l.K.col2.x*Y+S;if(Y>=0&&E>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}Y=D=0;E=S;Q=h;if(E>=0&&Q>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}break}}N.m_angularVelocity=I;L.m_angularVelocity=K}};o.prototype.FinalizeVelocityConstraints=function(){for(var B=0;B-1.5*g.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new AM;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new AF});Box2D.inherit(AB,Box2D.Dynamics.Contacts.b2Contact);AB.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AB.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AB.Create=function(){return new AB};AB.Destroy=function(){};AB.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};AB.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof AE?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};AB.prototype.b2CollideEdgeAndCircle=function(){};Box2D.inherit(P,Box2D.Dynamics.Contacts.b2Contact);P.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;P.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};P.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)};P.prototype.Evaluate=function(){};Box2D.inherit(J,Box2D.Dynamics.Contacts.b2Contact);J.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;J.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};J.Create=function(){return new J};J.Destroy=function(){};J.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==AA.e_polygonShape);g.b2Assert(B.GetType()==AA.e_circleShape)};J.prototype.Evaluate=function(){var A=this.m_fixtureA.m_body,B=this.m_fixtureB.m_body;b.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};Box2D.inherit(AN,Box2D.Dynamics.Contacts.b2Contact);AN.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AN.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AN.Create=function(){return new AN};AN.Destroy=function(){};AN.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==AA.e_polygonShape);g.b2Assert(B.GetType()==AA.e_edgeShape)};AN.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AE?this.m_fixtureB.GetShape():null,B.m_xf)};AN.prototype.b2CollidePolyAndEdge=function(){};Box2D.inherit(t,Box2D.Dynamics.Contacts.b2Contact);t.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;t.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};t.Create=function(){return new t};t.Destroy=function(){};t.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};t.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof x?this.m_fixtureB.GetShape():null,B.m_xf)};AF.b2PositionSolverManifold=function(){};AF.prototype.b2PositionSolverManifold=function(){this.m_normal=new m;this.m_separations=new Vector_a2j_Number(g.b2_maxManifoldPoints);this.m_points=new Vector(g.b2_maxManifoldPoints);for(var A=0;A0);var G=0,F=0,I=0,B,H=0,E=0;switch(D.type){case C.e_circles:B=D.bodyA.m_xf.R;I=D.localPoint;G=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);F=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyB.m_xf.R;I=D.points[0].localPoint;H=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);B=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);I=H-G;E=B-F;var A=I*I+E*E;if(A>Number.MIN_VALUE*Number.MIN_VALUE){A=Math.sqrt(A);this.m_normal.x=I/A;this.m_normal.y=E/A}else{this.m_normal.x=1;this.m_normal.y=0}this.m_points[0].x=0.5*(G+H);this.m_points[0].y=0.5*(F+B);this.m_separations[0]=I*this.m_normal.x+E*this.m_normal.y-D.radius;break;case C.e_faceA:B=D.bodyA.m_xf.R;I=D.localPlaneNormal;this.m_normal.x=B.col1.x*I.x+B.col2.x*I.y;this.m_normal.y=B.col1.y*I.x+B.col2.y*I.y;B=D.bodyA.m_xf.R;I=D.localPoint;H=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);E=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyB.m_xf.R;for(G=0;G0||A>0?1/Math.max(B,A):0};H.prototype.Step=function(G){G=G.dt;if(!(G<=Number.MIN_VALUE)){if(G>this.maxTimestep&&this.maxTimestep>0){G=this.maxTimestep}for(var B=this.m_bodyList;B;B=B.nextBody){var F=B.body;if(F.IsAwake()){var A=F.GetWorldVector(O.MulMV(this.T,F.GetLocalVector(F.GetLinearVelocity())));F.SetLinearVelocity(new M(F.GetLinearVelocity().x+A.x*G,F.GetLinearVelocity().y+A.y*G))}}}}})();(function(){var AE=Box2D.Common.b2Settings,AC=Box2D.Common.Math.b2Mat22,o=Box2D.Common.Math.b2Mat33,t=Box2D.Common.Math.b2Math,AB=Box2D.Common.Math.b2Vec2,AI=Box2D.Common.Math.b2Vec3,X=Box2D.Dynamics.Joints.b2DistanceJoint,AJ=Box2D.Dynamics.Joints.b2DistanceJointDef,AH=Box2D.Dynamics.Joints.b2FrictionJoint,f=Box2D.Dynamics.Joints.b2FrictionJointDef,T=Box2D.Dynamics.Joints.b2GearJoint,l=Box2D.Dynamics.Joints.b2GearJointDef,m=Box2D.Dynamics.Joints.b2Jacobian,x=Box2D.Dynamics.Joints.b2Joint,P=Box2D.Dynamics.Joints.b2JointDef,J=Box2D.Dynamics.Joints.b2JointEdge,AK=Box2D.Dynamics.Joints.b2LineJoint,n=Box2D.Dynamics.Joints.b2LineJointDef,AD=Box2D.Dynamics.Joints.b2MouseJoint,AG=Box2D.Dynamics.Joints.b2MouseJointDef,AA=Box2D.Dynamics.Joints.b2PrismaticJoint,g=Box2D.Dynamics.Joints.b2PrismaticJointDef,AF=Box2D.Dynamics.Joints.b2PulleyJoint,e=Box2D.Dynamics.Joints.b2PulleyJointDef,h=Box2D.Dynamics.Joints.b2RevoluteJoint,b=Box2D.Dynamics.Joints.b2RevoluteJointDef,AL=Box2D.Dynamics.Joints.b2WeldJoint,C=Box2D.Dynamics.Joints.b2WeldJointDef;Box2D.inherit(X,Box2D.Dynamics.Joints.b2Joint);X.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;X.b2DistanceJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_u=new AB};X.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};X.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};X.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_u.x,A*this.m_impulse*this.m_u.y)};X.prototype.GetReactionTorque=function(){return 0};X.prototype.GetLength=function(){return this.m_length};X.prototype.SetLength=function(A){if(A===undefined){A=0}this.m_length=A};X.prototype.GetFrequency=function(){return this.m_frequencyHz};X.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};X.prototype.GetDampingRatio=function(){return this.m_dampingRatio};X.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};X.prototype.b2DistanceJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_length=A.length;this.m_frequencyHz=A.frequencyHz;this.m_dampingRatio=A.dampingRatio;this.m_bias=this.m_gamma=this.m_impulse=0};X.prototype.InitVelocityConstraints=function(I){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchor1.x-F.m_sweep.localCenter.x,D=this.m_localAnchor1.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var M=this.m_localAnchor2.x-B.m_sweep.localCenter.x,K=this.m_localAnchor2.y-B.m_sweep.localCenter.y;E=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=E;this.m_u.x=B.m_sweep.c.x+M-F.m_sweep.c.x-A;this.m_u.y=B.m_sweep.c.y+K-F.m_sweep.c.y-D;E=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);E>AE.b2_linearSlop?this.m_u.Multiply(1/E):this.m_u.SetZero();G=A*this.m_u.y-D*this.m_u.x;var H=M*this.m_u.y-K*this.m_u.x;G=F.m_invMass+F.m_invI*G*G+B.m_invMass+B.m_invI*H*H;this.m_mass=G!=0?1/G:0;if(this.m_frequencyHz>0){E=E-this.m_length;H=2*Math.PI*this.m_frequencyHz;var L=this.m_mass*H*H;this.m_gamma=I.dt*(2*this.m_mass*this.m_dampingRatio*H+I.dt*L);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_bias=E*I.dt*L*this.m_gamma;this.m_mass=G+this.m_gamma;this.m_mass=this.m_mass!=0?1/this.m_mass:0}if(I.warmStarting){this.m_impulse*=I.dtRatio;I=this.m_impulse*this.m_u.x;G=this.m_impulse*this.m_u.y;F.m_linearVelocity.x-=F.m_invMass*I;F.m_linearVelocity.y-=F.m_invMass*G;F.m_angularVelocity-=F.m_invI*(A*G-D*I);B.m_linearVelocity.x+=B.m_invMass*I;B.m_linearVelocity.y+=B.m_invMass*G;B.m_angularVelocity+=B.m_invI*(M*G-K*I)}else{this.m_impulse=0}};X.prototype.SolveVelocityConstraints=function(){var H,E=this.m_bodyA,B=this.m_bodyB;H=E.m_xf.R;var D=this.m_localAnchor1.x-E.m_sweep.localCenter.x,G=this.m_localAnchor1.y-E.m_sweep.localCenter.y,F=H.col1.x*D+H.col2.x*G;G=H.col1.y*D+H.col2.y*G;D=F;H=B.m_xf.R;var I=this.m_localAnchor2.x-B.m_sweep.localCenter.x,A=this.m_localAnchor2.y-B.m_sweep.localCenter.y;F=H.col1.x*I+H.col2.x*A;A=H.col1.y*I+H.col2.y*A;I=F;F=-this.m_mass*(this.m_u.x*(B.m_linearVelocity.x+-B.m_angularVelocity*A-(E.m_linearVelocity.x+-E.m_angularVelocity*G))+this.m_u.y*(B.m_linearVelocity.y+B.m_angularVelocity*I-(E.m_linearVelocity.y+E.m_angularVelocity*D))+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=F;H=F*this.m_u.x;F=F*this.m_u.y;E.m_linearVelocity.x-=E.m_invMass*H;E.m_linearVelocity.y-=E.m_invMass*F;E.m_angularVelocity-=E.m_invI*(D*F-G*H);B.m_linearVelocity.x+=B.m_invMass*H;B.m_linearVelocity.y+=B.m_invMass*F;B.m_angularVelocity+=B.m_invI*(I*F-A*H)};X.prototype.SolvePositionConstraints=function(){var I;if(this.m_frequencyHz>0){return true}var G=this.m_bodyA,E=this.m_bodyB;I=G.m_xf.R;var F=this.m_localAnchor1.x-G.m_sweep.localCenter.x,B=this.m_localAnchor1.y-G.m_sweep.localCenter.y,A=I.col1.x*F+I.col2.x*B;B=I.col1.y*F+I.col2.y*B;F=A;I=E.m_xf.R;var D=this.m_localAnchor2.x-E.m_sweep.localCenter.x,L=this.m_localAnchor2.y-E.m_sweep.localCenter.y;A=I.col1.x*D+I.col2.x*L;L=I.col1.y*D+I.col2.y*L;D=A;A=E.m_sweep.c.x+D-G.m_sweep.c.x-F;var K=E.m_sweep.c.y+L-G.m_sweep.c.y-B;I=Math.sqrt(A*A+K*K);A/=I;K/=I;I=I-this.m_length;I=t.Clamp(I,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);var H=-this.m_mass*I;this.m_u.Set(A,K);A=H*this.m_u.x;K=H*this.m_u.y;G.m_sweep.c.x-=G.m_invMass*A;G.m_sweep.c.y-=G.m_invMass*K;G.m_sweep.a-=G.m_invI*(F*K-B*A);E.m_sweep.c.x+=E.m_invMass*A;E.m_sweep.c.y+=E.m_invMass*K;E.m_sweep.a+=E.m_invI*(D*K-L*A);G.SynchronizeTransform();E.SynchronizeTransform();return t.Abs(I)0){this.m_angularMass=1/this.m_angularMass}if(K.warmStarting){this.m_linearImpulse.x*=K.dtRatio;this.m_linearImpulse.y*=K.dtRatio;this.m_angularImpulse*=K.dtRatio;K=this.m_linearImpulse;F.m_linearVelocity.x-=G*K.x;F.m_linearVelocity.y-=G*K.y;F.m_angularVelocity-=H*(A*K.y-D*K.x+this.m_angularImpulse);B.m_linearVelocity.x+=E*K.x;B.m_linearVelocity.y+=E*K.y;B.m_angularVelocity+=M*(N*K.y-L*K.x+this.m_angularImpulse)}else{this.m_linearImpulse.SetZero();this.m_angularImpulse=0}};AH.prototype.SolveVelocityConstraints=function(R){var M,K=0,L=this.m_bodyA,G=this.m_bodyB,F=L.m_linearVelocity,H=L.m_angularVelocity,V=G.m_linearVelocity,S=G.m_angularVelocity,N=L.m_invMass,U=G.m_invMass,Q=L.m_invI,O=G.m_invI;M=L.m_xf.R;var I=this.m_localAnchorA.x-L.m_sweep.localCenter.x,E=this.m_localAnchorA.y-L.m_sweep.localCenter.y;K=M.col1.x*I+M.col2.x*E;E=M.col1.y*I+M.col2.y*E;I=K;M=G.m_xf.R;var D=this.m_localAnchorB.x-G.m_sweep.localCenter.x,A=this.m_localAnchorB.y-G.m_sweep.localCenter.y;K=M.col1.x*D+M.col2.x*A;A=M.col1.y*D+M.col2.y*A;D=K;M=0;K=-this.m_angularMass*(S-H);var B=this.m_angularImpulse;M=R.dt*this.m_maxTorque;this.m_angularImpulse=t.Clamp(this.m_angularImpulse+K,-M,M);K=this.m_angularImpulse-B;H-=Q*K;S+=O*K;M=t.MulMV(this.m_linearMass,new AB(-(V.x-S*A-F.x+H*E),-(V.y+S*D-F.y-H*I)));K=this.m_linearImpulse.Copy();this.m_linearImpulse.Add(M);M=R.dt*this.m_maxForce;if(this.m_linearImpulse.LengthSquared()>M*M){this.m_linearImpulse.Normalize();this.m_linearImpulse.Multiply(M)}M=t.SubtractVV(this.m_linearImpulse,K);F.x-=N*M.x;F.y-=N*M.y;H-=Q*(I*M.y-E*M.x);V.x+=U*M.x;V.y+=U*M.y;S+=O*(D*M.y-A*M.x);L.m_angularVelocity=H;G.m_angularVelocity=S};AH.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(f,Box2D.Dynamics.Joints.b2JointDef);f.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;f.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};f.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_frictionJoint;this.maxTorque=this.maxForce=0};f.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(A))};Box2D.inherit(T,Box2D.Dynamics.Joints.b2Joint);T.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;T.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new AB;this.m_groundAnchor2=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_J=new m};T.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};T.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};T.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_J.linearB.x,A*this.m_impulse*this.m_J.linearB.y)};T.prototype.GetReactionTorque=function(F){if(F===undefined){F=0}var D=this.m_bodyB.m_xf.R,A=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,B=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,E=D.col1.x*A+D.col2.x*B;B=D.col1.y*A+D.col2.y*B;A=E;return F*(this.m_impulse*this.m_J.angularB-A*this.m_impulse*this.m_J.linearB.y+B*this.m_impulse*this.m_J.linearB.x)};T.prototype.GetRatio=function(){return this.m_ratio};T.prototype.SetRatio=function(A){if(A===undefined){A=0}this.m_ratio=A};T.prototype.b2GearJoint=function(F){this.__super.b2Joint.call(this,F);var D=parseInt(F.joint1.m_type),A=parseInt(F.joint2.m_type);this.m_prismatic2=this.m_revolute2=this.m_prismatic1=this.m_revolute1=null;var B=0,E=0;this.m_ground1=F.joint1.GetBodyA();this.m_bodyA=F.joint1.GetBodyB();if(D==x.e_revoluteJoint){this.m_revolute1=F.joint1 instanceof h?F.joint1:null;this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);B=this.m_revolute1.GetJointAngle()}else{this.m_prismatic1=F.joint1 instanceof AA?F.joint1:null;this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);B=this.m_prismatic1.GetJointTranslation()}this.m_ground2=F.joint2.GetBodyA();this.m_bodyB=F.joint2.GetBodyB();if(A==x.e_revoluteJoint){this.m_revolute2=F.joint2 instanceof h?F.joint2:null;this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);E=this.m_revolute2.GetJointAngle()}else{this.m_prismatic2=F.joint2 instanceof AA?F.joint2:null;this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);E=this.m_prismatic2.GetJointTranslation()}this.m_ratio=F.ratio;this.m_constant=B+this.m_ratio*E;this.m_impulse=0};T.prototype.InitVelocityConstraints=function(I){var G=this.m_ground1,E=this.m_ground2,F=this.m_bodyA,B=this.m_bodyB,A=0,D=0,M=0,K=0,H=M=0,L=0;this.m_J.SetZero();if(this.m_revolute1){this.m_J.angularA=-1;L+=F.m_invI}else{G=G.m_xf.R;D=this.m_prismatic1.m_localXAxis1;A=G.col1.x*D.x+G.col2.x*D.y;D=G.col1.y*D.x+G.col2.y*D.y;G=F.m_xf.R;M=this.m_localAnchor1.x-F.m_sweep.localCenter.x;K=this.m_localAnchor1.y-F.m_sweep.localCenter.y;H=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=H;M=M*D-K*A;this.m_J.linearA.Set(-A,-D);this.m_J.angularA=-M;L+=F.m_invMass+F.m_invI*M*M}if(this.m_revolute2){this.m_J.angularB=-this.m_ratio;L+=this.m_ratio*this.m_ratio*B.m_invI}else{G=E.m_xf.R;D=this.m_prismatic2.m_localXAxis1;A=G.col1.x*D.x+G.col2.x*D.y;D=G.col1.y*D.x+G.col2.y*D.y;G=B.m_xf.R;M=this.m_localAnchor2.x-B.m_sweep.localCenter.x;K=this.m_localAnchor2.y-B.m_sweep.localCenter.y;H=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=H;M=M*D-K*A;this.m_J.linearB.Set(-this.m_ratio*A,-this.m_ratio*D);this.m_J.angularB=-this.m_ratio*M;L+=this.m_ratio*this.m_ratio*(B.m_invMass+B.m_invI*M*M)}this.m_mass=L>0?1/L:0;if(I.warmStarting){F.m_linearVelocity.x+=F.m_invMass*this.m_impulse*this.m_J.linearA.x;F.m_linearVelocity.y+=F.m_invMass*this.m_impulse*this.m_J.linearA.y;F.m_angularVelocity+=F.m_invI*this.m_impulse*this.m_J.angularA;B.m_linearVelocity.x+=B.m_invMass*this.m_impulse*this.m_J.linearB.x;B.m_linearVelocity.y+=B.m_invMass*this.m_impulse*this.m_J.linearB.y;B.m_angularVelocity+=B.m_invI*this.m_impulse*this.m_J.angularB}else{this.m_impulse=0}};T.prototype.SolveVelocityConstraints=function(){var D=this.m_bodyA,B=this.m_bodyB,A=-this.m_mass*this.m_J.Compute(D.m_linearVelocity,D.m_angularVelocity,B.m_linearVelocity,B.m_angularVelocity);this.m_impulse+=A;D.m_linearVelocity.x+=D.m_invMass*A*this.m_J.linearA.x;D.m_linearVelocity.y+=D.m_invMass*A*this.m_J.linearA.y;D.m_angularVelocity+=D.m_invI*A*this.m_J.angularA;B.m_linearVelocity.x+=B.m_invMass*A*this.m_J.linearB.x;B.m_linearVelocity.y+=B.m_invMass*A*this.m_J.linearB.y;B.m_angularVelocity+=B.m_invI*A*this.m_J.angularB};T.prototype.SolvePositionConstraints=function(){var E=this.m_bodyA,D=this.m_bodyB,A=0,B=0;A=this.m_revolute1?this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation();B=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation();A=-this.m_mass*(this.m_constant-(A+this.m_ratio*B));E.m_sweep.c.x+=E.m_invMass*A*this.m_J.linearA.x;E.m_sweep.c.y+=E.m_invMass*A*this.m_J.linearA.y;E.m_sweep.a+=E.m_invI*A*this.m_J.angularA;D.m_sweep.c.x+=D.m_invMass*A*this.m_J.linearB.x;D.m_sweep.c.y+=D.m_invMass*A*this.m_J.linearB.y;D.m_sweep.a+=D.m_invI*A*this.m_J.angularB;E.SynchronizeTransform();D.SynchronizeTransform();return 0Number.MIN_VALUE?1/this.m_motorMass:0;this.m_perp.SetV(t.MulMV(A.R,this.m_localYAxis1));this.m_s1=(F+D)*this.m_perp.y-(B+L)*this.m_perp.x;this.m_s2=K*this.m_perp.y-H*this.m_perp.x;A=this.m_invMassA;D=this.m_invMassB;L=this.m_invIA;K=this.m_invIB;this.m_K.col1.x=A+D+L*this.m_s1*this.m_s1+K*this.m_s2*this.m_s2;this.m_K.col1.y=L*this.m_s1*this.m_a1+K*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=A+D+L*this.m_a1*this.m_a1+K*this.m_a2*this.m_a2;if(this.m_enableLimit){F=this.m_axis.x*F+this.m_axis.y*B;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){this.m_limitState=x.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=x.e_atLowerLimit){this.m_limitState=x.e_atLowerLimit;this.m_impulse.y=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=x.e_atUpperLimit){this.m_limitState=x.e_atUpperLimit;this.m_impulse.y=0}}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.y=0}}}}else{this.m_limitState=x.e_inactiveLimit}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_motorImpulse*=I.dtRatio;I=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x;F=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y;B=this.m_impulse.x*this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1;A=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2;G.m_linearVelocity.x-=this.m_invMassA*I;G.m_linearVelocity.y-=this.m_invMassA*F;G.m_angularVelocity-=this.m_invIA*B;E.m_linearVelocity.x+=this.m_invMassB*I;E.m_linearVelocity.y+=this.m_invMassB*F;E.m_angularVelocity+=this.m_invIB*A}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};AK.prototype.SolveVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F=G.m_linearVelocity,B=G.m_angularVelocity,A=E.m_linearVelocity,D=E.m_angularVelocity,M=0,K=0,H=0,L=0;if(this.m_enableMotor&&this.m_limitState!=x.e_equalLimits){L=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B));M=this.m_motorImpulse;K=I.dt*this.m_maxMotorForce;this.m_motorImpulse=t.Clamp(this.m_motorImpulse+L,-K,K);L=this.m_motorImpulse-M;M=L*this.m_axis.x;K=L*this.m_axis.y;H=L*this.m_a1;L=L*this.m_a2;F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L}K=this.m_perp.x*(A.x-F.x)+this.m_perp.y*(A.y-F.y)+this.m_s2*D-this.m_s1*B;if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){H=this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B;M=this.m_impulse.Copy();I=this.m_K.Solve(new AB,-K,-H);this.m_impulse.Add(I);if(this.m_limitState==x.e_atLowerLimit){this.m_impulse.y=t.Max(this.m_impulse.y,0)}else{if(this.m_limitState==x.e_atUpperLimit){this.m_impulse.y=t.Min(this.m_impulse.y,0)}}K=-K-(this.m_impulse.y-M.y)*this.m_K.col2.x;H=0;H=this.m_K.col1.x!=0?K/this.m_K.col1.x+M.x:M.x;this.m_impulse.x=H;I.x=this.m_impulse.x-M.x;I.y=this.m_impulse.y-M.y;M=I.x*this.m_perp.x+I.y*this.m_axis.x;K=I.x*this.m_perp.y+I.y*this.m_axis.y;H=I.x*this.m_s1+I.y*this.m_a1;L=I.x*this.m_s2+I.y*this.m_a2}else{I=0;I=this.m_K.col1.x!=0?-K/this.m_K.col1.x:0;this.m_impulse.x+=I;M=I*this.m_perp.x;K=I*this.m_perp.y;H=I*this.m_s1;L=I*this.m_s2}F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L;G.m_linearVelocity.SetV(F);G.m_angularVelocity=B;E.m_linearVelocity.SetV(A);E.m_angularVelocity=D};AK.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G=N.m_sweep.c,H=N.m_sweep.a,D=I.m_sweep.c,B=I.m_sweep.a,E,R=0,O=0,K=0,Q=0,M=E=0,L=0;O=false;var F=0,A=AC.FromAngle(H);K=AC.FromAngle(B);E=A;L=this.m_localAnchor1.x-this.m_localCenterA.x;var U=this.m_localAnchor1.y-this.m_localCenterA.y;R=E.col1.x*L+E.col2.x*U;U=E.col1.y*L+E.col2.y*U;L=R;E=K;K=this.m_localAnchor2.x-this.m_localCenterB.x;Q=this.m_localAnchor2.y-this.m_localCenterB.y;R=E.col1.x*K+E.col2.x*Q;Q=E.col1.y*K+E.col2.y*Q;K=R;E=D.x+K-G.x-L;R=D.y+Q-G.y-U;if(this.m_enableLimit){this.m_axis=t.MulMV(A,this.m_localXAxis1);this.m_a1=(E+L)*this.m_axis.y-(R+U)*this.m_axis.x;this.m_a2=K*this.m_axis.y-Q*this.m_axis.x;var S=this.m_axis.x*E+this.m_axis.y*R;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){F=t.Clamp(S,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);M=t.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){F=t.Clamp(S-this.m_lowerTranslation+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);M=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){F=t.Clamp(S-this.m_upperTranslation+AE.b2_linearSlop,0,AE.b2_maxLinearCorrection);M=S-this.m_upperTranslation;O=true}}}}this.m_perp=t.MulMV(A,this.m_localYAxis1);this.m_s1=(E+L)*this.m_perp.y-(R+U)*this.m_perp.x;this.m_s2=K*this.m_perp.y-Q*this.m_perp.x;A=new AB;U=this.m_perp.x*E+this.m_perp.y*R;M=t.Max(M,t.Abs(U));L=0;if(O){O=this.m_invMassA;K=this.m_invMassB;Q=this.m_invIA;E=this.m_invIB;this.m_K.col1.x=O+K+Q*this.m_s1*this.m_s1+E*this.m_s2*this.m_s2;this.m_K.col1.y=Q*this.m_s1*this.m_a1+E*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=O+K+Q*this.m_a1*this.m_a1+E*this.m_a2*this.m_a2;this.m_K.Solve(A,-U,-F)}else{O=this.m_invMassA;K=this.m_invMassB;Q=this.m_invIA;E=this.m_invIB;F=O+K+Q*this.m_s1*this.m_s1+E*this.m_s2*this.m_s2;O=0;O=F!=0?-U/F:0;A.x=O;A.y=0}F=A.x*this.m_perp.x+A.y*this.m_axis.x;O=A.x*this.m_perp.y+A.y*this.m_axis.y;U=A.x*this.m_s1+A.y*this.m_a1;A=A.x*this.m_s2+A.y*this.m_a2;G.x-=this.m_invMassA*F;G.y-=this.m_invMassA*O;H-=this.m_invIA*U;D.x+=this.m_invMassB*F;D.y+=this.m_invMassB*O;B+=this.m_invIB*A;N.m_sweep.a=H;I.m_sweep.a=B;N.SynchronizeTransform();I.SynchronizeTransform();return M<=AE.b2_linearSlop&&L<=AE.b2_angularSlop};Box2D.inherit(n,Box2D.Dynamics.Joints.b2JointDef);n.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;n.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB;this.localAxisA=new AB};n.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_lineJoint;this.localAxisA.Set(1,0);this.enableLimit=false;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};n.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.localAxisA=this.bodyA.GetLocalVector(B)};Box2D.inherit(AD,Box2D.Dynamics.Joints.b2Joint);AD.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AD.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new AC;this.K1=new AC;this.K2=new AC;this.m_localAnchor=new AB;this.m_target=new AB;this.m_impulse=new AB;this.m_mass=new AC;this.m_C=new AB};AD.prototype.GetAnchorA=function(){return this.m_target};AD.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)};AD.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};AD.prototype.GetReactionTorque=function(){return 0};AD.prototype.GetTarget=function(){return this.m_target};AD.prototype.SetTarget=function(A){this.m_bodyB.IsAwake()==false&&this.m_bodyB.SetAwake(true);this.m_target=A};AD.prototype.GetMaxForce=function(){return this.m_maxForce};AD.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AD.prototype.GetFrequency=function(){return this.m_frequencyHz};AD.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};AD.prototype.GetDampingRatio=function(){return this.m_dampingRatio};AD.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};AD.prototype.b2MouseJoint=function(E){this.__super.b2Joint.call(this,E);this.m_target.SetV(E.target);var D=this.m_target.x-this.m_bodyB.m_xf.position.x,A=this.m_target.y-this.m_bodyB.m_xf.position.y,B=this.m_bodyB.m_xf.R;this.m_localAnchor.x=D*B.col1.x+A*B.col1.y;this.m_localAnchor.y=D*B.col2.x+A*B.col2.y;this.m_maxForce=E.maxForce;this.m_impulse.SetZero();this.m_frequencyHz=E.frequencyHz;this.m_dampingRatio=E.dampingRatio;this.m_gamma=this.m_beta=0};AD.prototype.InitVelocityConstraints=function(G){var D=this.m_bodyB,A=D.GetMass(),B=2*Math.PI*this.m_frequencyHz,F=A*B*B;this.m_gamma=G.dt*(2*A*this.m_dampingRatio*B+G.dt*F);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_beta=G.dt*F*this.m_gamma;F=D.m_xf.R;A=this.m_localAnchor.x-D.m_sweep.localCenter.x;B=this.m_localAnchor.y-D.m_sweep.localCenter.y;var E=F.col1.x*A+F.col2.x*B;B=F.col1.y*A+F.col2.y*B;A=E;F=D.m_invMass;E=D.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=E*B*B;this.K2.col2.x=-E*A*B;this.K2.col1.y=-E*A*B;this.K2.col2.y=E*A*A;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=D.m_sweep.c.x+A-this.m_target.x;this.m_C.y=D.m_sweep.c.y+B-this.m_target.y;D.m_angularVelocity*=0.98;this.m_impulse.x*=G.dtRatio;this.m_impulse.y*=G.dtRatio;D.m_linearVelocity.x+=F*this.m_impulse.x;D.m_linearVelocity.y+=F*this.m_impulse.y;D.m_angularVelocity+=E*(A*this.m_impulse.y-B*this.m_impulse.x)};AD.prototype.SolveVelocityConstraints=function(H){var E=this.m_bodyB,B,D=0,G=0;B=E.m_xf.R;var F=this.m_localAnchor.x-E.m_sweep.localCenter.x,I=this.m_localAnchor.y-E.m_sweep.localCenter.y;D=B.col1.x*F+B.col2.x*I;I=B.col1.y*F+B.col2.y*I;F=D;D=E.m_linearVelocity.x+-E.m_angularVelocity*I;var A=E.m_linearVelocity.y+E.m_angularVelocity*F;B=this.m_mass;D=D+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x;G=A+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;A=-(B.col1.x*D+B.col2.x*G);G=-(B.col1.y*D+B.col2.y*G);B=this.m_impulse.x;D=this.m_impulse.y;this.m_impulse.x+=A;this.m_impulse.y+=G;H=H.dt*this.m_maxForce;this.m_impulse.LengthSquared()>H*H&&this.m_impulse.Multiply(H/this.m_impulse.Length());A=this.m_impulse.x-B;G=this.m_impulse.y-D;E.m_linearVelocity.x+=E.m_invMass*A;E.m_linearVelocity.y+=E.m_invMass*G;E.m_angularVelocity+=E.m_invI*(F*G-I*A)};AD.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(AG,Box2D.Dynamics.Joints.b2JointDef);AG.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AG.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.target=new AB};AG.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(AA,Box2D.Dynamics.Joints.b2Joint);AA.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AA.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_localXAxis1=new AB;this.m_localYAxis1=new AB;this.m_axis=new AB;this.m_perp=new AB;this.m_K=new o;this.m_impulse=new AI};AA.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AA.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AA.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),A*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};AA.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};AA.prototype.GetJointTranslation=function(){var E=this.m_bodyA,D=this.m_bodyB,A=E.GetWorldPoint(this.m_localAnchor1),B=D.GetWorldPoint(this.m_localAnchor2);D=B.x-A.x;A=B.y-A.y;E=E.GetWorldVector(this.m_localXAxis1);return E.x*D+E.y*A};AA.prototype.GetJointSpeed=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,M=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*M;M=E.col1.y*D+E.col2.y*M;D=A;E=G.m_sweep.c.x+D-(I.m_sweep.c.x+F);A=G.m_sweep.c.y+M-(I.m_sweep.c.y+B);var K=I.GetWorldVector(this.m_localXAxis1),H=I.m_linearVelocity,L=G.m_linearVelocity;I=I.m_angularVelocity;G=G.m_angularVelocity;return E*-I*K.y+A*I*K.x+(K.x*(L.x+-G*M-H.x- -I*B)+K.y*(L.y+G*D-H.y-I*F))};AA.prototype.IsLimitEnabled=function(){return this.m_enableLimit};AA.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};AA.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};AA.prototype.GetUpperLimit=function(){return this.m_upperTranslation};AA.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=B;this.m_upperTranslation=A};AA.prototype.IsMotorEnabled=function(){return this.m_enableMotor};AA.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};AA.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};AA.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};AA.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};AA.prototype.GetMotorForce=function(){return this.m_motorImpulse};AA.prototype.b2PrismaticJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_localXAxis1.SetV(A.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_refAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=A.lowerTranslation;this.m_upperTranslation=A.upperTranslation;this.m_maxMotorForce=A.maxMotorForce;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=x.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};AA.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;this.m_localCenterA.SetV(G.GetLocalCenter());this.m_localCenterB.SetV(E.GetLocalCenter());var A=G.GetTransform();E.GetTransform();F=G.m_xf.R;var D=this.m_localAnchor1.x-this.m_localCenterA.x,L=this.m_localAnchor1.y-this.m_localCenterA.y;B=F.col1.x*D+F.col2.x*L;L=F.col1.y*D+F.col2.y*L;D=B;F=E.m_xf.R;var K=this.m_localAnchor2.x-this.m_localCenterB.x,H=this.m_localAnchor2.y-this.m_localCenterB.y;B=F.col1.x*K+F.col2.x*H;H=F.col1.y*K+F.col2.y*H;K=B;F=E.m_sweep.c.x+K-G.m_sweep.c.x-D;B=E.m_sweep.c.y+H-G.m_sweep.c.y-L;this.m_invMassA=G.m_invMass;this.m_invMassB=E.m_invMass;this.m_invIA=G.m_invI;this.m_invIB=E.m_invI;this.m_axis.SetV(t.MulMV(A.R,this.m_localXAxis1));this.m_a1=(F+D)*this.m_axis.y-(B+L)*this.m_axis.x;this.m_a2=K*this.m_axis.y-H*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;if(this.m_motorMass>Number.MIN_VALUE){this.m_motorMass=1/this.m_motorMass}this.m_perp.SetV(t.MulMV(A.R,this.m_localYAxis1));this.m_s1=(F+D)*this.m_perp.y-(B+L)*this.m_perp.x;this.m_s2=K*this.m_perp.y-H*this.m_perp.x;A=this.m_invMassA;D=this.m_invMassB;L=this.m_invIA;K=this.m_invIB;this.m_K.col1.x=A+D+L*this.m_s1*this.m_s1+K*this.m_s2*this.m_s2;this.m_K.col1.y=L*this.m_s1+K*this.m_s2;this.m_K.col1.z=L*this.m_s1*this.m_a1+K*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=L+K;this.m_K.col2.z=L*this.m_a1+K*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=A+D+L*this.m_a1*this.m_a1+K*this.m_a2*this.m_a2;if(this.m_enableLimit){F=this.m_axis.x*F+this.m_axis.y*B;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){this.m_limitState=x.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=x.e_atLowerLimit){this.m_limitState=x.e_atLowerLimit;this.m_impulse.z=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=x.e_atUpperLimit){this.m_limitState=x.e_atUpperLimit;this.m_impulse.z=0}}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=x.e_inactiveLimit}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_motorImpulse*=I.dtRatio;I=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x;F=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y;B=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1;A=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;G.m_linearVelocity.x-=this.m_invMassA*I;G.m_linearVelocity.y-=this.m_invMassA*F;G.m_angularVelocity-=this.m_invIA*B;E.m_linearVelocity.x+=this.m_invMassB*I;E.m_linearVelocity.y+=this.m_invMassB*F;E.m_angularVelocity+=this.m_invIB*A}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};AA.prototype.SolveVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F=G.m_linearVelocity,B=G.m_angularVelocity,A=E.m_linearVelocity,D=E.m_angularVelocity,M=0,K=0,H=0,L=0;if(this.m_enableMotor&&this.m_limitState!=x.e_equalLimits){L=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B));M=this.m_motorImpulse;I=I.dt*this.m_maxMotorForce;this.m_motorImpulse=t.Clamp(this.m_motorImpulse+L,-I,I);L=this.m_motorImpulse-M;M=L*this.m_axis.x;K=L*this.m_axis.y;H=L*this.m_a1;L=L*this.m_a2;F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L}H=this.m_perp.x*(A.x-F.x)+this.m_perp.y*(A.y-F.y)+this.m_s2*D-this.m_s1*B;K=D-B;if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){I=this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B;M=this.m_impulse.Copy();I=this.m_K.Solve33(new AI,-H,-K,-I);this.m_impulse.Add(I);if(this.m_limitState==x.e_atLowerLimit){this.m_impulse.z=t.Max(this.m_impulse.z,0)}else{if(this.m_limitState==x.e_atUpperLimit){this.m_impulse.z=t.Min(this.m_impulse.z,0)}}H=-H-(this.m_impulse.z-M.z)*this.m_K.col3.x;K=-K-(this.m_impulse.z-M.z)*this.m_K.col3.y;K=this.m_K.Solve22(new AB,H,K);K.x+=M.x;K.y+=M.y;this.m_impulse.x=K.x;this.m_impulse.y=K.y;I.x=this.m_impulse.x-M.x;I.y=this.m_impulse.y-M.y;I.z=this.m_impulse.z-M.z;M=I.x*this.m_perp.x+I.z*this.m_axis.x;K=I.x*this.m_perp.y+I.z*this.m_axis.y;H=I.x*this.m_s1+I.y+I.z*this.m_a1;L=I.x*this.m_s2+I.y+I.z*this.m_a2}else{I=this.m_K.Solve22(new AB,-H,-K);this.m_impulse.x+=I.x;this.m_impulse.y+=I.y;M=I.x*this.m_perp.x;K=I.x*this.m_perp.y;H=I.x*this.m_s1+I.y;L=I.x*this.m_s2+I.y}F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L;G.m_linearVelocity.SetV(F);G.m_angularVelocity=B;E.m_linearVelocity.SetV(A);E.m_angularVelocity=D};AA.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G=N.m_sweep.c,H=N.m_sweep.a,D=I.m_sweep.c,B=I.m_sweep.a,E,R=0,O=0,K=0,Q=R=E=0,M=0;O=false;var L=0,F=AC.FromAngle(H),A=AC.FromAngle(B);E=F;M=this.m_localAnchor1.x-this.m_localCenterA.x;var U=this.m_localAnchor1.y-this.m_localCenterA.y;R=E.col1.x*M+E.col2.x*U;U=E.col1.y*M+E.col2.y*U;M=R;E=A;A=this.m_localAnchor2.x-this.m_localCenterB.x;K=this.m_localAnchor2.y-this.m_localCenterB.y;R=E.col1.x*A+E.col2.x*K;K=E.col1.y*A+E.col2.y*K;A=R;E=D.x+A-G.x-M;R=D.y+K-G.y-U;if(this.m_enableLimit){this.m_axis=t.MulMV(F,this.m_localXAxis1);this.m_a1=(E+M)*this.m_axis.y-(R+U)*this.m_axis.x;this.m_a2=A*this.m_axis.y-K*this.m_axis.x;var S=this.m_axis.x*E+this.m_axis.y*R;if(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){L=t.Clamp(S,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);Q=t.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){L=t.Clamp(S-this.m_lowerTranslation+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);Q=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){L=t.Clamp(S-this.m_upperTranslation+AE.b2_linearSlop,0,AE.b2_maxLinearCorrection);Q=S-this.m_upperTranslation;O=true}}}}this.m_perp=t.MulMV(F,this.m_localYAxis1);this.m_s1=(E+M)*this.m_perp.y-(R+U)*this.m_perp.x;this.m_s2=A*this.m_perp.y-K*this.m_perp.x;F=new AI;U=this.m_perp.x*E+this.m_perp.y*R;A=B-H-this.m_refAngle;Q=t.Max(Q,t.Abs(U));M=t.Abs(A);if(O){O=this.m_invMassA;K=this.m_invMassB;E=this.m_invIA;R=this.m_invIB;this.m_K.col1.x=O+K+E*this.m_s1*this.m_s1+R*this.m_s2*this.m_s2;this.m_K.col1.y=E*this.m_s1+R*this.m_s2;this.m_K.col1.z=E*this.m_s1*this.m_a1+R*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=E+R;this.m_K.col2.z=E*this.m_a1+R*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=O+K+E*this.m_a1*this.m_a1+R*this.m_a2*this.m_a2;this.m_K.Solve33(F,-U,-A,-L)}else{O=this.m_invMassA;K=this.m_invMassB;E=this.m_invIA;R=this.m_invIB;L=E*this.m_s1+R*this.m_s2;S=E+R;this.m_K.col1.Set(O+K+E*this.m_s1*this.m_s1+R*this.m_s2*this.m_s2,L,0);this.m_K.col2.Set(L,S,0);L=this.m_K.Solve22(new AB,-U,-A);F.x=L.x;F.y=L.y;F.z=0}L=F.x*this.m_perp.x+F.z*this.m_axis.x;O=F.x*this.m_perp.y+F.z*this.m_axis.y;U=F.x*this.m_s1+F.y+F.z*this.m_a1;F=F.x*this.m_s2+F.y+F.z*this.m_a2;G.x-=this.m_invMassA*L;G.y-=this.m_invMassA*O;H-=this.m_invIA*U;D.x+=this.m_invMassB*L;D.y+=this.m_invMassB*O;B+=this.m_invIB*F;N.m_sweep.a=H;I.m_sweep.a=B;N.SynchronizeTransform();I.SynchronizeTransform();return Q<=AE.b2_linearSlop&&M<=AE.b2_angularSlop};Box2D.inherit(g,Box2D.Dynamics.Joints.b2JointDef);g.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;g.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB;this.localAxisA=new AB};g.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_prismaticJoint;this.localAxisA.Set(1,0);this.referenceAngle=0;this.enableLimit=false;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};g.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.localAxisA=this.bodyA.GetLocalVector(B);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(AF,Box2D.Dynamics.Joints.b2Joint);AF.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AF.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new AB;this.m_groundAnchor2=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_u1=new AB;this.m_u2=new AB};AF.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AF.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AF.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_u2.x,A*this.m_impulse*this.m_u2.y)};AF.prototype.GetReactionTorque=function(){return 0};AF.prototype.GetGroundAnchorA=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor1);return A};AF.prototype.GetGroundAnchorB=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor2);return A};AF.prototype.GetLength1=function(){var B=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),A=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(A*A+B*B)};AF.prototype.GetLength2=function(){var B=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),A=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(A*A+B*B)};AF.prototype.GetRatio=function(){return this.m_ratio};AF.prototype.b2PulleyJoint=function(A){this.__super.b2Joint.call(this,A);this.m_ground=this.m_bodyA.m_world.m_groundBody;this.m_groundAnchor1.x=A.groundAnchorA.x-this.m_ground.m_xf.position.x;this.m_groundAnchor1.y=A.groundAnchorA.y-this.m_ground.m_xf.position.y;this.m_groundAnchor2.x=A.groundAnchorB.x-this.m_ground.m_xf.position.x;this.m_groundAnchor2.y=A.groundAnchorB.y-this.m_ground.m_xf.position.y;this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_ratio=A.ratio;this.m_constant=A.lengthA+this.m_ratio*A.lengthB;this.m_maxLength1=t.Min(A.maxLengthA,this.m_constant-this.m_ratio*AF.b2_minPulleyLength);this.m_maxLength2=t.Min(A.maxLengthB,(this.m_constant-AF.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};AF.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F;F=G.m_xf.R;var B=this.m_localAnchor1.x-G.m_sweep.localCenter.x,A=this.m_localAnchor1.y-G.m_sweep.localCenter.y,D=F.col1.x*B+F.col2.x*A;A=F.col1.y*B+F.col2.y*A;B=D;F=E.m_xf.R;var M=this.m_localAnchor2.x-E.m_sweep.localCenter.x,K=this.m_localAnchor2.y-E.m_sweep.localCenter.y;D=F.col1.x*M+F.col2.x*K;K=F.col1.y*M+F.col2.y*K;M=D;F=E.m_sweep.c.x+M;D=E.m_sweep.c.y+K;var H=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,L=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(G.m_sweep.c.x+B-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x),G.m_sweep.c.y+A-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y));this.m_u2.Set(F-H,D-L);F=this.m_u1.Length();D=this.m_u2.Length();F>AE.b2_linearSlop?this.m_u1.Multiply(1/F):this.m_u1.SetZero();D>AE.b2_linearSlop?this.m_u2.Multiply(1/D):this.m_u2.SetZero();if(this.m_constant-F-this.m_ratio*D>0){this.m_state=x.e_inactiveLimit;this.m_impulse=0}else{this.m_state=x.e_atUpperLimit}if(FAE.b2_linearSlop?this.m_u1.Multiply(1/G):this.m_u1.SetZero();M>AE.b2_linearSlop?this.m_u2.Multiply(1/M):this.m_u2.SetZero();G=this.m_constant-G-this.m_ratio*M;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);F=-this.m_pulleyMass*G;G=-F*this.m_u1.x;M=-F*this.m_u1.y;L=-this.m_ratio*F*this.m_u2.x;F=-this.m_ratio*F*this.m_u2.y;N.m_sweep.c.x+=N.m_invMass*G;N.m_sweep.c.y+=N.m_invMass*M;N.m_sweep.a+=N.m_invI*(R*M-O*G);I.m_sweep.c.x+=I.m_invMass*L;I.m_sweep.c.y+=I.m_invMass*F;I.m_sweep.a+=I.m_invI*(K*F-Q*L);N.SynchronizeTransform();I.SynchronizeTransform()}if(this.m_limitState1==x.e_atUpperLimit){G=N.m_xf.R;R=this.m_localAnchor1.x-N.m_sweep.localCenter.x;O=this.m_localAnchor1.y-N.m_sweep.localCenter.y;M=G.col1.x*R+G.col2.x*O;O=G.col1.y*R+G.col2.y*O;R=M;G=N.m_sweep.c.x+R;M=N.m_sweep.c.y+O;this.m_u1.Set(G-H,M-D);G=this.m_u1.Length();if(G>AE.b2_linearSlop){this.m_u1.x*=1/G;this.m_u1.y*=1/G}else{this.m_u1.SetZero()}G=this.m_maxLength1-G;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);F=-this.m_limitMass1*G;G=-F*this.m_u1.x;M=-F*this.m_u1.y;N.m_sweep.c.x+=N.m_invMass*G;N.m_sweep.c.y+=N.m_invMass*M;N.m_sweep.a+=N.m_invI*(R*M-O*G);N.SynchronizeTransform()}if(this.m_limitState2==x.e_atUpperLimit){G=I.m_xf.R;K=this.m_localAnchor2.x-I.m_sweep.localCenter.x;Q=this.m_localAnchor2.y-I.m_sweep.localCenter.y;M=G.col1.x*K+G.col2.x*Q;Q=G.col1.y*K+G.col2.y*Q;K=M;L=I.m_sweep.c.x+K;F=I.m_sweep.c.y+Q;this.m_u2.Set(L-B,F-E);M=this.m_u2.Length();if(M>AE.b2_linearSlop){this.m_u2.x*=1/M;this.m_u2.y*=1/M}else{this.m_u2.SetZero()}G=this.m_maxLength2-M;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);F=-this.m_limitMass2*G;L=-F*this.m_u2.x;F=-F*this.m_u2.y;I.m_sweep.c.x+=I.m_invMass*L;I.m_sweep.c.y+=I.m_invMass*F;I.m_sweep.a+=I.m_invI*(K*F-Q*L);I.SynchronizeTransform()}return A=this.m_upperAngle){if(this.m_limitState!=x.e_atUpperLimit){this.m_impulse.z=0}this.m_limitState=x.e_atUpperLimit}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=x.e_inactiveLimit}if(K.warmStarting){this.m_impulse.x*=K.dtRatio;this.m_impulse.y*=K.dtRatio;this.m_motorImpulse*=K.dtRatio;K=this.m_impulse.x;I=this.m_impulse.y;G.m_linearVelocity.x-=F*K;G.m_linearVelocity.y-=F*I;G.m_angularVelocity-=H*(A*I-D*K+this.m_motorImpulse+this.m_impulse.z);E.m_linearVelocity.x+=B*K;E.m_linearVelocity.y+=B*I;E.m_angularVelocity+=M*(N*I-L*K+this.m_motorImpulse+this.m_impulse.z)}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};h.prototype.SolveVelocityConstraints=function(N){var I=this.m_bodyA,G=this.m_bodyB,H=0,D=H=0,B=0,E=0,R=0,O=I.m_linearVelocity,K=I.m_angularVelocity,Q=G.m_linearVelocity,M=G.m_angularVelocity,L=I.m_invMass,F=G.m_invMass,A=I.m_invI,U=G.m_invI;if(this.m_enableMotor&&this.m_limitState!=x.e_equalLimits){D=this.m_motorMass*-(M-K-this.m_motorSpeed);B=this.m_motorImpulse;E=N.dt*this.m_maxMotorTorque;this.m_motorImpulse=t.Clamp(this.m_motorImpulse+D,-E,E);D=this.m_motorImpulse-B;K-=A*D;M+=U*D}if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){N=I.m_xf.R;D=this.m_localAnchor1.x-I.m_sweep.localCenter.x;B=this.m_localAnchor1.y-I.m_sweep.localCenter.y;H=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=H;N=G.m_xf.R;E=this.m_localAnchor2.x-G.m_sweep.localCenter.x;R=this.m_localAnchor2.y-G.m_sweep.localCenter.y;H=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=H;N=Q.x+-M*R-O.x- -K*B;var S=Q.y+M*E-O.y-K*D;this.m_mass.Solve33(this.impulse3,-N,-S,-(M-K));if(this.m_limitState==x.e_equalLimits){this.m_impulse.Add(this.impulse3)}else{if(this.m_limitState==x.e_atLowerLimit){H=this.m_impulse.z+this.impulse3.z;if(H<0){this.m_mass.Solve22(this.reduced,-N,-S);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}}else{if(this.m_limitState==x.e_atUpperLimit){H=this.m_impulse.z+this.impulse3.z;if(H>0){this.m_mass.Solve22(this.reduced,-N,-S);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}}}}O.x-=L*this.impulse3.x;O.y-=L*this.impulse3.y;K-=A*(D*this.impulse3.y-B*this.impulse3.x+this.impulse3.z);Q.x+=F*this.impulse3.x;Q.y+=F*this.impulse3.y;M+=U*(E*this.impulse3.y-R*this.impulse3.x+this.impulse3.z)}else{N=I.m_xf.R;D=this.m_localAnchor1.x-I.m_sweep.localCenter.x;B=this.m_localAnchor1.y-I.m_sweep.localCenter.y;H=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=H;N=G.m_xf.R;E=this.m_localAnchor2.x-G.m_sweep.localCenter.x;R=this.m_localAnchor2.y-G.m_sweep.localCenter.y;H=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=H;this.m_mass.Solve22(this.impulse2,-(Q.x+-M*R-O.x- -K*B),-(Q.y+M*E-O.y-K*D));this.m_impulse.x+=this.impulse2.x;this.m_impulse.y+=this.impulse2.y;O.x-=L*this.impulse2.x;O.y-=L*this.impulse2.y;K-=A*(D*this.impulse2.y-B*this.impulse2.x);Q.x+=F*this.impulse2.x;Q.y+=F*this.impulse2.y;M+=U*(E*this.impulse2.y-R*this.impulse2.x)}I.m_linearVelocity.SetV(O);I.m_angularVelocity=K;G.m_linearVelocity.SetV(Q);G.m_angularVelocity=M};h.prototype.SolvePositionConstraints=function(){var N=0,I,G=this.m_bodyA,H=this.m_bodyB,D=0,B=I=0,E=0,R=0;if(this.m_enableLimit&&this.m_limitState!=x.e_inactiveLimit){N=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle;var O=0;if(this.m_limitState==x.e_equalLimits){N=t.Clamp(N-this.m_lowerAngle,-AE.b2_maxAngularCorrection,AE.b2_maxAngularCorrection);O=-this.m_motorMass*N;D=t.Abs(N)}else{if(this.m_limitState==x.e_atLowerLimit){N=N-this.m_lowerAngle;D=-N;N=t.Clamp(N+AE.b2_angularSlop,-AE.b2_maxAngularCorrection,0);O=-this.m_motorMass*N}else{if(this.m_limitState==x.e_atUpperLimit){D=N=N-this.m_upperAngle;N=t.Clamp(N-AE.b2_angularSlop,0,AE.b2_maxAngularCorrection);O=-this.m_motorMass*N}}}G.m_sweep.a-=G.m_invI*O;H.m_sweep.a+=H.m_invI*O;G.SynchronizeTransform();H.SynchronizeTransform()}I=G.m_xf.R;O=this.m_localAnchor1.x-G.m_sweep.localCenter.x;N=this.m_localAnchor1.y-G.m_sweep.localCenter.y;B=I.col1.x*O+I.col2.x*N;N=I.col1.y*O+I.col2.y*N;O=B;I=H.m_xf.R;var K=this.m_localAnchor2.x-H.m_sweep.localCenter.x,Q=this.m_localAnchor2.y-H.m_sweep.localCenter.y;B=I.col1.x*K+I.col2.x*Q;Q=I.col1.y*K+I.col2.y*Q;K=B;E=H.m_sweep.c.x+K-G.m_sweep.c.x-O;R=H.m_sweep.c.y+Q-G.m_sweep.c.y-N;var M=E*E+R*R;I=Math.sqrt(M);B=G.m_invMass;var L=H.m_invMass,F=G.m_invI,A=H.m_invI,S=10*AE.b2_linearSlop;if(M>S*S){M=1/(B+L);E=M*-E;R=M*-R;G.m_sweep.c.x-=0.5*B*E;G.m_sweep.c.y-=0.5*B*R;H.m_sweep.c.x+=0.5*L*E;H.m_sweep.c.y+=0.5*L*R;E=H.m_sweep.c.x+K-G.m_sweep.c.x-O;R=H.m_sweep.c.y+Q-G.m_sweep.c.y-N}this.K1.col1.x=B+L;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=B+L;this.K2.col1.x=F*N*N;this.K2.col2.x=-F*O*N;this.K2.col1.y=-F*O*N;this.K2.col2.y=F*O*O;this.K3.col1.x=A*Q*Q;this.K3.col2.x=-A*K*Q;this.K3.col1.y=-A*K*Q;this.K3.col2.y=A*K*K;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(h.tImpulse,-E,-R);E=h.tImpulse.x;R=h.tImpulse.y;G.m_sweep.c.x-=G.m_invMass*E;G.m_sweep.c.y-=G.m_invMass*R;G.m_sweep.a-=G.m_invI*(O*R-N*E);H.m_sweep.c.x+=H.m_invMass*E;H.m_sweep.c.y+=H.m_invMass*R;H.m_sweep.a+=H.m_invI*(K*R-Q*E);G.SynchronizeTransform();H.SynchronizeTransform();return I<=AE.b2_linearSlop&&D<=AE.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new AB});Box2D.inherit(b,Box2D.Dynamics.Joints.b2JointDef);b.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;b.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};b.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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=false};b.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(AL,Box2D.Dynamics.Joints.b2Joint);AL.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AL.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new AB;this.m_localAnchorB=new AB;this.m_impulse=new AI;this.m_mass=new o};AL.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AL.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AL.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};AL.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.z};AL.prototype.b2WeldJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchorA.SetV(A.localAnchorA);this.m_localAnchorB.SetV(A.localAnchorB);this.m_referenceAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_mass=new o};AL.prototype.InitVelocityConstraints=function(I){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchorA.x-F.m_sweep.localCenter.x,D=this.m_localAnchorA.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var M=this.m_localAnchorB.x-B.m_sweep.localCenter.x,K=this.m_localAnchorB.y-B.m_sweep.localCenter.y;E=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=E;G=F.m_invMass;E=B.m_invMass;var H=F.m_invI,L=B.m_invI;this.m_mass.col1.x=G+E+D*D*H+K*K*L;this.m_mass.col2.x=-D*A*H-K*M*L;this.m_mass.col3.x=-D*H-K*L;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=G+E+A*A*H+M*M*L;this.m_mass.col3.y=A*H+M*L;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=H+L;if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_impulse.z*=I.dtRatio;F.m_linearVelocity.x-=G*this.m_impulse.x;F.m_linearVelocity.y-=G*this.m_impulse.y;F.m_angularVelocity-=H*(A*this.m_impulse.y-D*this.m_impulse.x+this.m_impulse.z);B.m_linearVelocity.x+=E*this.m_impulse.x;B.m_linearVelocity.y+=E*this.m_impulse.y;B.m_angularVelocity+=L*(M*this.m_impulse.y-K*this.m_impulse.x+this.m_impulse.z)}else{this.m_impulse.SetZero()}};AL.prototype.SolveVelocityConstraints=function(){var R,M=0,K=this.m_bodyA,L=this.m_bodyB,G=K.m_linearVelocity,F=K.m_angularVelocity,H=L.m_linearVelocity,V=L.m_angularVelocity,S=K.m_invMass,N=L.m_invMass,U=K.m_invI,Q=L.m_invI;R=K.m_xf.R;var O=this.m_localAnchorA.x-K.m_sweep.localCenter.x,I=this.m_localAnchorA.y-K.m_sweep.localCenter.y;M=R.col1.x*O+R.col2.x*I;I=R.col1.y*O+R.col2.y*I;O=M;R=L.m_xf.R;var E=this.m_localAnchorB.x-L.m_sweep.localCenter.x,D=this.m_localAnchorB.y-L.m_sweep.localCenter.y;M=R.col1.x*E+R.col2.x*D;D=R.col1.y*E+R.col2.y*D;E=M;R=H.x-V*D-G.x+F*I;M=H.y+V*E-G.y-F*O;var A=V-F,B=new AI;this.m_mass.Solve33(B,-R,-M,-A);this.m_impulse.Add(B);G.x-=S*B.x;G.y-=S*B.y;F-=U*(O*B.y-I*B.x+B.z);H.x+=N*B.x;H.y+=N*B.y;V+=Q*(E*B.y-D*B.x+B.z);K.m_angularVelocity=F;L.m_angularVelocity=V};AL.prototype.SolvePositionConstraints=function(){var N,I=0,G=this.m_bodyA,H=this.m_bodyB;N=G.m_xf.R;var D=this.m_localAnchorA.x-G.m_sweep.localCenter.x,B=this.m_localAnchorA.y-G.m_sweep.localCenter.y;I=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=I;N=H.m_xf.R;var E=this.m_localAnchorB.x-H.m_sweep.localCenter.x,R=this.m_localAnchorB.y-H.m_sweep.localCenter.y;I=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=I;N=G.m_invMass;I=H.m_invMass;var O=G.m_invI,K=H.m_invI,Q=H.m_sweep.c.x+E-G.m_sweep.c.x-D,M=H.m_sweep.c.y+R-G.m_sweep.c.y-B,L=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle,F=10*AE.b2_linearSlop,A=Math.sqrt(Q*Q+M*M),S=t.Abs(L);if(A>F){O*=1;K*=1}this.m_mass.col1.x=N+I+B*B*O+R*R*K;this.m_mass.col2.x=-B*D*O-R*E*K;this.m_mass.col3.x=-B*O-R*K;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=N+I+D*D*O+E*E*K;this.m_mass.col3.y=D*O+E*K;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=O+K;F=new AI;this.m_mass.Solve33(F,-Q,-M,-L);G.m_sweep.c.x-=N*F.x;G.m_sweep.c.y-=N*F.y;G.m_sweep.a-=O*(D*F.y-B*F.x+F.z);H.m_sweep.c.x+=I*F.x;H.m_sweep.c.y+=I*F.y;H.m_sweep.a+=K*(E*F.y-R*F.x+F.z);G.SynchronizeTransform();H.SynchronizeTransform();return A<=AE.b2_linearSlop&&S<=AE.b2_angularSlop};Box2D.inherit(C,Box2D.Dynamics.Joints.b2JointDef);C.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;C.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};C.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_weldJoint;this.referenceAngle=0};C.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(A));this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}})();(function(){var A=Box2D.Dynamics.b2DebugDraw;A.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)}}}};A.prototype._color=function(C,B){return"rgba("+((C&16711680)>>16)+","+((C&65280)>>8)+","+(C&255)+","+B+")"};A.prototype.b2DebugDraw=function(){this.m_drawFlags=0};A.prototype.SetFlags=function(B){if(B===undefined){B=0}this.m_drawFlags=B};A.prototype.GetFlags=function(){return this.m_drawFlags};A.prototype.AppendFlags=function(B){if(B===undefined){B=0}this.m_drawFlags|=B};A.prototype.ClearFlags=function(B){if(B===undefined){B=0}this.m_drawFlags&=~B};A.prototype.SetSprite=function(B){this.m_ctx=B};A.prototype.GetSprite=function(){return this.m_ctx};A.prototype.SetDrawScale=function(B){if(B===undefined){B=0}this.m_drawScale=B};A.prototype.GetDrawScale=function(){return this.m_drawScale};A.prototype.SetLineThickness=function(B){if(B===undefined){B=0}this.m_lineThickness=B;this.m_ctx.strokeWidth=B};A.prototype.GetLineThickness=function(){return this.m_lineThickness};A.prototype.SetAlpha=function(B){if(B===undefined){B=0}this.m_alpha=B};A.prototype.GetAlpha=function(){return this.m_alpha};A.prototype.SetFillAlpha=function(B){if(B===undefined){B=0}this.m_fillAlpha=B};A.prototype.GetFillAlpha=function(){return this.m_fillAlpha};A.prototype.SetXFormScale=function(B){if(B===undefined){B=0}this.m_xformScale=B};A.prototype.GetXFormScale=function(){return this.m_xformScale};A.prototype.DrawPolygon=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.moveTo(E[0].x*B,E[0].y*B);for(F=1;F=0;C--){if(G.tokens[C].attr(D)==F||E==true){B.push(G.tokens[C])}}return B},select:function(E,C,D){result=[];if(typeof(D)=="undefined"&&typeof(C)=="undefined"){return E.tokens}else{for(var B=E.tokens.length-1;B>=0;B--){if(E.tokens[B].attr(C)==D){result.push(E.tokens[B]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},addToken:function(H,G){var C={x:50,y:50,t:null,category:1,state:0,size:10,fillStyle:"###",strokeStyle:"rgba(0,0,0,0)",lineWidth:0,texture:undefined,shape:{type:"round"},userdata:{},callback:{},phy:{density:10,friction:0,restitution:0},targets:[],elbow:{}};var B=null;var D=null;var F={};F.toString=function(){return"Token ID="+this.setting.ID};if(typeof(G)=="undefined"){F.setting=C;F.setting.ID=this.ID(H)}else{F.setting=G;if(typeof(F.setting.phy)=="undefined"){F.setting.phy=C.phy}if(typeof(F.setting.t)=="undefined"){F.setting.t=H.settings.stream.now}if(typeof(F.setting.x)=="undefined"){F.setting.x=H.settings.sedimentation.incoming.point[G.category].x+(Math.random()*2)}if(typeof(F.setting.y)=="undefined"){F.setting.y=H.settings.sedimentation.incoming.point[G.category].y+(Math.random()*2)}if(typeof(F.setting.size)=="undefined"){F.setting.size=H.settings.sedimentation.token.size.original}if(typeof(F.setting.targets)=="undefined"){F.setting.targets=[]}F.setting.ID=F.setting.ID=this.ID(H);if(typeof(F.setting.state)=="undefined"){F.setting.state=0}if(typeof(F.setting.shape)=="undefined"){F.setting.shape=C.shape}}F.myobj=this.create(H,F.setting);F.flocculate=function(){H.tokens.indexOf(this);H.flocculate.destroyIt(H,this);return this};F.attr=function(I,J,K){if(typeof(J)=="undefined"){if(typeof(this[I])!="undefined"){return this[I]()}else{return this.myobj.m_userData[I]}}else{if(typeof(this[I])!="undefined"){this[I](J,K)}else{this.myobj.m_userData[I]=J}}return this};F.callback=function(I,J){if(!arguments.length){return this.myobj.m_userData.callback}if(typeof(this.myobj.m_userData.callback[I])=="function"){return this.myobj.m_userData.callback[I](J)}else{return function(K){console.log("callback undefined")}}};F.size=function(I){if(this.myobj!=null&&this.attr("state")<2){if(!arguments.length){return this.myobj.m_shape.m_radius*this.myobj.m_userData.scale}this.myobj.m_shape.m_radius=I/this.myobj.m_userData.scale}};F.b2dObj=function(){if(this.myobj!=null&&this.attr("state")<2){return this.myobj}};F.texture=function(I){if(!arguments.length){return this.myobj.m_userData.texture.img.src}console.log("texture",I);this.myobj.m_userData.texture={};this.myobj.m_userData.texture.img=new Image();this.myobj.m_userData.texture.img.src=I};H.tokens.push(F);H.decay.tokens.push(F);if(typeof(this.myobj.m_userData.callback)!="undefined"){if(typeof(this.myobj.m_userData.callback.suspension)=="function"){var E=H.select("ID",F.setting.ID);this.myobj.m_userData.callback.suspension(E)}}return F},create:function(H,C){C.scale=scale=H.settings.options.scale;var G=C.x/scale+(Math.random()*0.1);var D=C.y/scale+(Math.random()*0.1);var F=new Box2D.Dynamics.b2FixtureDef;F.density=0.1;F.friction=0;F.restitution=0;if(C.shape.type=="round"){F.shape=new Box2D.Collision.Shapes.b2CircleShape(C.size/scale)}else{if(C.shape.type=="polygons"){F=this.setPolygons(H,C,F)}else{if(C.shape.type=="box"){F.shape=new Box2D.Collision.Shapes.b2PolygonShape;F.shape.SetAsBox(C.shape.width/scale,C.shape.height/scale)}}}var B=new Box2D.Dynamics.b2BodyDef;B.type=Box2D.Dynamics.b2Body.b2_dynamicBody;B.position.x=C.x/scale;B.position.y=C.y/scale;this.myobj=H.world.CreateBody(B).CreateFixture(F);if(typeof(C.texture)!="undefined"){C.texture.img=new Image();C.texture.img.src=C.texture.src}if(typeof(C.impulse)!="undefined"){this.applyImpulse(this.myobj,C.impulse.angle,C.impulse.power)}if(typeof(C.fillStyle)=="undefined"){C.fillStyle=this.colorRange(C.category)}if(typeof(C.lineWidth)=="undefined"){C.lineWidth=0}if(typeof(C.type)=="undefined"){C.type="token"}if(typeof(C.callback)=="undefined"){C.callback={}}this.myobj.m_userData=C;this.myobj.attr=this.attr;this.myobj.m_userData.mouse={};this.myobj.m_userData.mouse.over=false;this.myobj.m_userData.mouse.down=false;this.myobj.m_userData.mouse.dragging=false;this.myobj.m_userData.mouse.statebefore=false;this.myobj.m_userData.state=1;if(C.targets.length==0&&H.settings.chart.type=="CircleLayout"){C.targets[0]={x:H.settings.sedimentation.incoming.target[C.category].x,y:H.settings.sedimentation.incoming.target[C.category].y}}if(C.targets.length>0){var E=new H.phy.b2MouseJointDef();E.bodyA=H.world.GetGroundBody();E.bodyB=this.myobj.GetBody();E.target.Set(G,D);E.collideConnected=true;E.maxForce=50*this.myobj.GetBody().GetMass();mouseJoint=H.world.CreateJoint(E);mouseJoint.SetTarget(new H.phy.b2Vec2(C.targets[0].x/scale,C.targets[0].y/scale))}return this.myobj},applyImpulse:function(D,E,C){var B=D.GetBody();B.ApplyImpulse(new Box2D.Common.Math.b2Vec2(Math.cos(E*(Math.PI/180))*C,Math.sin(E*(Math.PI/180))*C),B.GetWorldCenter())},setPolygons:function(F,D,E){E.shape=new Box2D.Collision.Shapes.b2PolygonShape;if(D.shape.points==null){D.shape.points=[{x:-1,y:-1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:-1}]}for(var C=0;C=0;B--){buffer.push(C)}},update:function(C){if(type=="generator"){for(var B=0;BbufferSize){this.update(C,c,bufferSize)}},destroyIt:function(D,C){C.attr("callback","flocculation",C);C.attr("state",2);var B=D.world.DestroyBody(C.myobj.GetBody());return B},update:function(E,D,B){if(E.settings.sedimentation.flocculate.number==1){while(this.buffer[D].length>B){var C=this.buffer[D].shift();this.destroyIt(E,C)}}else{while(this.buffer[D].length>E.settings.sedimentation.flocculate.number){var C=this.buffer[D].shift();this.destroyIt(E,C)}}},disapear:function(C,B){window.setInterval(function(){B.update(self)},self.settings.options.refresh/2)},all:function(C){for(var B=C.decay.tokens-1;B>=0;B--){this.update(C,B,C.tokens.length)}},strategy:function(){if(flocullateBuffer.length>0){if(chart.flocullate.strategy=="Size"&&flocullateBuffer.length>=chart.flocullate.bufferSize){flocullateByArray(flocullateBuffer)}else{if(chart.flocullate.strategy=="Time"){}else{if(chart.flocullate.strategy=="Height"){}}}}}}})(jQuery);(function(A){A.fn._vs.aggregate={defaultSettings:{},strata_layers:function(H,G,B,D){var F=d3.scale.linear().domain([1,B-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var C=d3.scale.pow().exponent(10).domain([0,B]).range([0,1]);return d3.range(G).map(function(I){var J=5*Math.random();return d3.range(B).map(function(L){if(H.settings.sedimentation.aggregation.strataType=="sin"){if(I==1){return 20}var K=5+J*5*Math.sin(F(L))+(I*50);if(K<0){return -K}else{return K}}else{if(H.settings.sedimentation.aggregation.strataType=="log"){return I+1}else{if(typeof(D)=="undefined"){D=0}return H.settings.data.strata[D][I].value}}}).map(E)});function E(J,I){return{x:I,y:Math.max(0,J)}}},init:function(L){if(typeof(L.settings.data.strata)=="undefined"||L.settings.data.strata.length==0||L.settings.data.strata[0].length==0){return}var M=L.token.colorRange;if(L.settings.chart.type=="StackedAreaChart"){var E=L.settings.chart.width/L.settings.data.model.length,O=L.settings.sedimentation.aggregation.height;var G=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",L.settings.width).attr("height",L.settings.height).append("g").attr("transform","translate("+L.settings.chart.x+","+L.settings.chart.y+")");var Q=G.selectAll("g.gcol").data(L.settings.data.strata,function(V){return[V]}).enter().append("g").attr("transform",function(W,V){return"translate("+(V*E)+", "+(L.settings.chart.height-L.settings.sedimentation.aggregation.height)+")"}).attr("class",function(W,V){return"gcol col_"+V});var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});var R=L.settings.data.strata[0].length,S=20;smx=S-1,smy=0;var D=0;var T=d3.svg.area().x(function(V){return L.settings.chart.spacer+V.x*(E-2*L.settings.chart.spacer)/smx}).y0(function(V){return(O-V.y0*D)}).y1(function(V){return(O-(V.y+V.y0)*D)});var K=[];var B=Q.selectAll("gpath").data(function(X,V){var W=d3.layout.stack().offset("expand")(L.aggregate.strata_layers(L,X.length,S,V));smy=d3.max(W,function(Y){return d3.max(Y,function(Z){return Z.y0+Z.y})});W.map(function(Y){Y.map(function(Z){Z.col=V;return Z})});return W}).enter().append("g").attr("class","gpath");B.append("path").attr("d",function(W,V){D=L.settings.chart.height-L.chart.getPosition(L)[W[0].col].y;return T(W)}).style("fill",function(W,V){if(L.settings.data.strata[W[0].col][V].texture!=null){return"url(#RectanglePattern_"+W[0].col+"_"+V+")"}else{return d3.rgb(M(W[0].col)).darker(L.settings.data.strata[W[0].col].length/2-(V+1)/2)}}).attr("class",function(W,V){return"layer"}).attr("class",function(W,V){return"col_"+W[0].col+" layer_"+V});var C=E/1;var I=C;for(var F=0;F=_this.settings.stream.now-2*(r+1)){b[b.length-r-1].push(tk)}}}}var res=Array();for(var j=0;j0||_this.strata.stratas.length>0){if(typeof settings.data.strata=="function"||(settings.data.strata[0].length>0&&typeof(settings.data.strata[0])=="object")){if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}else{if(typeof settings.data.strata[0].value=="function"){for(var i=0;i=0;i--){if(_this.strata.stratas[i].attr(key)==value){result.push(_this.strata.stratas[i]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},add:function(_this,setting){var strata=function(){};strata.myobj=setting;strata.attr=function(key,value,param){if(typeof(value)=="undefined"){if(typeof(this[key])!="undefined"){return this[key]()}else{return this.myobj[key]}}else{if(typeof(this[key])!="undefined"){this[key](value,param)}else{this.myobj[key]=value}}return this};return strata},remove:function(_this,key,value){},strata_layers:function(_this,n,m,p){var sn=d3.scale.linear().domain([1,m-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var logscale=d3.scale.pow().exponent(10).domain([0,m]).range([0,1]);return d3.range(n).map(function(i){var r=5*Math.random();return d3.range(m).map(function(j){if(_this.settings.sedimentation.aggregation.strataType=="sin"){if(i==1){return 20}var x=5+r*5*Math.sin(sn(j))+(i*50);if(x<0){return -x}else{return x}}else{if(_this.settings.sedimentation.aggregation.strataType=="log"){return i+1}else{if(typeof(p)=="undefined"){p=0}return _this.strata.stratas[p][i].value(_this,p)}}}).map(stream_index)});function stream_index(d,i){return{x:i,y:Math.max(0,d)}}},create_strata:function(_this){if(_this.settings.chart.type=="StackedAreaChart"){var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;if(typeof _this.settings.options.canvasFirst!="undefined"&&_this.settings.options.canvasFirst==false){var vis=d3.select("#"+_this.settings.DOMelement.id).insert("div",":first-child").style("position","absolute").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}else{var vis=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v