text: (/*Copyright_2016_Erik_Neumann_All_Rights_Reserved_www.myphysicslab.com*/function(){'use strict';var g,aa="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},ba;if("function"==typeof Object.setPrototypeOf)ba=Object.setPrototypeOf;else{var da;a:{var ea={X:!0},fa={};try{fa.__proto__=ea;da=fa.X;break a}catch(a){}da=!1}ba=da?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ha=ba;
  function l(a,b){a.prototype=aa(b.prototype);a.prototype.constructor=a;if(ha)ha(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.sf=b.prototype}var ia=this;function n(a){return void 0!==a}function ja(a){return"string"==typeof a}function t(a){return"number"==typeof a}function ka(){}
  function la(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
  else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ma(a){return"array"==la(a)}function na(a){var b=la(a);return"array"==b||"object"==b&&"number"==typeof a.length}function oa(a){return"function"==la(a)}function qa(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}var ra="closure_uid_"+(1E9*Math.random()>>>0),sa=0;function ta(a,b,c){return a.call.apply(a.bind,arguments)}
  function ua(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function v(a,b,c){v=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ta:ua;return v.apply(null,arguments)}
  function va(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}}var wa=Date.now||function(){return+new Date};function z(a,b){a=a.split(".");var c=ia;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&n(b)?c[d]=b:c=c[d]&&c[d]!==Object.prototype[d]?c[d]:c[d]={}}
  function xa(a,b){function c(){}c.prototype=b.prototype;a.sf=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.yi=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};var ya=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(ja(a))return ja(b)&&1==b.length?a.indexOf(b,0):-1;for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},A=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ja(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)};
  function za(a,b,c){var d=a.length,e=ja(a)?a.split(""):a;for(--d;0<=d;--d)d in e&&b.call(c,e[d],d,a)}
  var Aa=Array.prototype.filter?function(a,b,c){return Array.prototype.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,h=ja(a)?a.split(""):a,k=0;k<d;k++)if(k in h){var m=h[k];b.call(c,m,k,a)&&(e[f++]=m)}return e},Ba=Array.prototype.map?function(a,b,c){return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=ja(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e},Ca=Array.prototype.reduce?function(a,b,c){return Array.prototype.reduce.call(a,
  b,c)}:function(a,b,c){var d=c;A(a,function(c,f){d=b.call(void 0,d,c,f,a)});return d};function Da(a,b){var c=0;A(a,function(a,e,f){b.call(void 0,a,e,f)&&++c},void 0);return c}function Ea(a,b){b=Fa(a,b,void 0);return 0>b?null:ja(a)?a.charAt(b):a[b]}function Fa(a,b,c){for(var d=a.length,e=ja(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1}function B(a,b){return 0<=ya(a,b)}function Ga(a){if(!ma(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0}
  function Ha(a,b){b=ya(a,b);var c;(c=0<=b)&&Ia(a,b);return c}function Ia(a,b){return 1==Array.prototype.splice.call(a,b,1).length}function Ja(a,b,c){var d=0;za(a,function(e,f){b.call(c,e,f,a)&&Ia(a,f)&&d++})}function Ka(a){return Array.prototype.concat.apply([],arguments)}function La(a){return Array.prototype.concat.apply([],arguments)}function Ma(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]}
  function Na(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(na(d)){var e=a.length||0,f=d.length||0;a.length=e+f;for(var h=0;h<f;h++)a[e+h]=d[h]}else a.push(d)}}function Oa(a,b,c,d){Array.prototype.splice.apply(a,Pa(arguments,1))}function Pa(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)}function Qa(a,b){a.sort(b||Ra)}
  function Ta(a,b){for(var c=Array(a.length),d=0;d<a.length;d++)c[d]={index:d,value:a[d]};var e=b||Ra;Qa(c,function(a,b){return e(a.value,b.value)||a.index-b.index});for(d=0;d<a.length;d++)a[d]=c[d].value}function Ua(a,b){if(!na(a)||!na(b)||a.length!=b.length)return!1;for(var c=a.length,d=Va,e=0;e<c;e++)if(!d(a[e],b[e]))return!1;return!0}function Ra(a,b){return a>b?1:a<b?-1:0}function Va(a,b){return a===b}function Wa(a,b){for(var c=[],d=0;d<b;d++)c[d]=a;return c};function Xa(a){var b=document.createElement("img");b.src=a;b.width=30;b.height=n(void 0)?void 0:30;return b}function Ya(a){for(var b=Array(a),c=0;c<a;c++)b[c]=!1;return b}function D(a){for(var b=Array(a),c=0;c<a;c++)b[c]=0;return b}function Za(a){return null!=a?a.toFixed(2):null===a?"null":"undefined"}function $a(a){return null!=a?a.toFixed(5):null===a?"null":"undefined"}function ab(a){return null!=a?a.toFixed(7).replace(/\.?0+$/,""):null===a?"null":"undefined"}
  function bb(a){return null!=a?a.toFixed(9):null===a?"null":"undefined"}function cb(a){return null!=a?a.toExponential(7):null===a?"null":"undefined"}
  function db(a){var b,c;t(b)||(b=2);ja(c)||(c="  ");var d=String(a),e="",f=0,h=d.length,k=!1,m=[],p="",q=0;a:for(;q<h;q++){var r=d.charAt(q);if(k)if(" "==r)continue;else k=!1;if("{"==r||"["==r){f++;if(f<=b){e+=r+"\n";for(var u=0;u<f;u++)e+=c;k=!0}else e+=r;m.push(p);p="{"==r?"}":"]"}else if(r==p){if(f<=b)for(f--,e+="\n",u=0;u<f;u++)e+=c;else f--;e+=r;p=m.pop();if(0>f)throw Error("unbalanced "+p+" at "+q+" in "+a);}else{if('"'==r||"'"==r){u=r;var x=q;for(e+=r;++q<h;)if(r=d.charAt(q),e+=r,r==u)continue a;
  throw Error("unbalanced quote at "+x+" in "+a);}if((","==r||";"==r)&&f<=b){e+=r+"\n";for(u=0;u<f;u++)e+=c;k=!0}else e+=r}}return e=e.replace(/^\s+\n/gm,"")}function eb(a,b){for(var c=1;c<arguments.length;c++)a+=" "+$a(arguments[c]);console.log(a)}function fb(){window.onerror=function(a,b,c){3>gb++&&alert(a+"\n"+b+":"+c)}}function hb(a){void 0!==a&&(ib=a)}function jb(){return kb&&!lb?.001*performance.now():.001*wa()}function mb(a){if(!isFinite(a))throw Error("not a finite number "+a);return a}
  function nb(a){if(isNaN(a))throw Error("not a number "+a);return a}function E(a){return a.toUpperCase().replace(/[ -]/g,"_")}function ob(a){if(!a.match(/^[A-Z_][A-Z_0-9]*$/))throw Error("not a valid name: "+a);return a}function F(a,b,c){c=c||1E-14;if(0>=c)throw Error("epsilon must be positive "+c);var d=d||1;if(0>=d)throw Error("magnitude must be positive "+d);var e=Math.max(Math.abs(a),Math.abs(b));return Math.abs(a-b)>(e>d?e:d)*c}function pb(a){for(var b=a.length,c=0;c<b;c++)a[c]=0}
  var ib=".",qb=Math.pow(2,53),lb=!1,kb=qa(performance)&&oa(performance.now),rb=Number.NaN,sb=Number.NEGATIVE_INFINITY,gb=0,G=Number.POSITIVE_INFINITY;function ub(){this.c=this.a=this.b=0}ub.prototype.toString=function(){return""};function vb(a,b){a.a+=b}function wb(a){a.b+=1}function xb(a,b){a.c+=b}ub.prototype.reset=function(){this.b=this.c=this.a=0};function I(a,b,c){c=t(c)?c:0;this.a=nb(a);this.b=nb(b);this.c=nb(c)}g=I.prototype;g.toString=function(){return""};function yb(a){return a instanceof I?a:new I(a.j(),a.l(),a.sa())}g.add=function(a){return new I(this.a+a.j(),this.b+a.l(),this.c+a.sa())};function zb(a,b){var c=a.a-b.j(),d=a.b-b.l();a=a.c-b.sa();return c*c+d*d+a*a}function Ab(a,b){return Math.sqrt(zb(a,b))}
  function Bb(a,b){if(1===b)return a;if(1E-10>b)throw Error("Vector.divide by near zero factor "+cb(b));return new I(a.a/b,a.b/b,a.c/b)}function Cb(a,b){a=a.a*b.j()+a.b*b.l()+a.c*b.sa();if(isNaN(a))throw Error("");return a}g.Fb=function(a){return null===a?!1:a.j()===this.a&&a.l()===this.b&&a.sa()===this.c};function Db(a){return Math.atan2(a.b,a.a)}g.j=function(){return this.a};g.l=function(){return this.b};g.sa=function(){return this.c};g.length=function(){return Math.sqrt(Eb(this))};
  function Fb(a){var b=Math.abs(a.a)+Math.abs(a.b);return 0==a.c?b:b+Math.abs(a.c)}function Eb(a){return 0===a.c?a.a*a.a+a.b*a.b:a.a*a.a+a.b*a.b+a.c*a.c}function Gb(a,b){return 1===b?a:new I(b*a.a,b*a.b,b*a.c)}g.Oa=function(a,b){return F(this.a,a.j(),b)||F(this.b,a.l(),b)||F(this.c,a.sa(),b)?!1:!0};function Hb(a){return Bb(a,a.length())}function Ib(a,b,c){if(n(c))var d=b;else d=Math.cos(b),c=Math.sin(b);if(1E-12<Math.abs(d*d+c*c-1))throw Error();return new I(a.a*d-a.b*c,a.a*c+a.b*d,a.c)}
  function J(a,b){return new I(a.a-b.j(),a.b-b.l(),a.c-b.sa())}var Jb=new I(1,0),Kb=new I(0,1),K=new I(0,0);new I(0,-1);new I(-1,0);function M(a,b,c,d){this.c=nb(a);this.a=nb(c);this.b=nb(b);this.f=nb(d);if(a>c)throw Error("DoubleRect: left > right "+a+" > "+c);if(b>d)throw Error("DoubleRect: bottom > top "+b+" > "+d);}g=M.prototype;g.toString=function(){return""};function Lb(a,b){return new M(Math.min(a.j(),b.j()),Math.min(a.l(),b.l()),Math.max(a.j(),b.j()),Math.max(a.l(),b.l()))}function Mb(a,b){return b.j()>=a.c&&b.j()<=a.a&&b.l()>=a.b&&b.l()<=a.f}
  g.Fb=function(a){return a===this?!0:a instanceof M?a.ra()==this.c&&a.a==this.a&&a.b==this.b&&a.ka()==this.f:!1};function Nb(a){return new I(Ob(a),Pb(a))}function Ob(a){return(a.c+a.a)/2}function Pb(a){return(a.b+a.f)/2}g.S=function(){return this.f-this.b};g.ra=function(){return this.c};g.ka=function(){return this.f};g.P=function(){return this.a-this.c};g.Va=function(){return 1E-16>this.P()||1E-16>this.S()};
  function Qb(a,b,c){if(Mb(a,b)||Mb(a,c))return!0;var d=b.j();b=b.l();var e=c.j();c=c.l();var f=a.c;if(d<f&&e<f)return!1;f=a.a;if(d>f&&e>f)return!1;f=a.b;if(b<f&&c<f)return!1;f=a.f;return b>f&&c>f?!1:!0}g.Oa=function(a,b){return F(this.c,a.ra(),b)||F(this.b,a.b,b)||F(this.a,a.a,b)||F(this.f,a.ka(),b)?!1:!0};g.scale=function(a,b){b=void 0===b?a:b;var c=Ob(this),d=Pb(this),e=this.P(),f=this.S();return new M(c-a*e/2,d-b*f/2,c+a*e/2,d+b*f/2)};
  g.translate=function(a,b){t(a)||(b=a.l(),a=a.j());if(!t(a)||!t(b))throw Error();return new M(this.c+a,this.b+b,this.a+a,this.f+b)};var Rb=new M(0,0,0,0);function Sb(a,b){a=a||"SIM_OBJ"+Tb++;this.ec=ob(E(a));this.Qd=b||a;this.U=G}g=Sb.prototype;g.toString=function(){return""};g.Wd=function(){return this.U};g.getName=function(a){return a?this.Qd:this.ec};g.nc=function(){return!1};g.R=function(a){return this.ec==E(a)};g.ac=function(a){return a==this};var Tb=1;function Ub(a,b,c){Sb.call(this,a);this.b=qa(b)?b:K;this.a=qa(c)?c:K}l(Ub,Sb);g=Ub.prototype;g.toString=function(){return""};g.Qa=function(){return Lb(this.W(),this.aa())};g.aa=function(){return this.a};g.W=function(){return this.b};g.Sa=function(){return J(this.aa(),this.W())};g.ac=function(a,b){return a instanceof Ub&&a.W().Oa(this.W(),b)?a.aa().Oa(this.aa(),b):!1};function N(a,b,c){this.a=ob(E(b));this.b=a;this.c=c}g=N.prototype;g.toString=function(){return""};g.getName=function(){return this.a};g.ea=function(){return this.b};g.N=function(){return this.c};g.R=function(a){return this.a==E(a)};function Vb(a,b,c,d,e){this.i=a;this.b=ob(E(b));this.g=c;this.f=d;this.h=e;this.a=!1;this.c=[];this.m=[]}g=Vb.prototype;g.toString=function(){return""};g.bd=function(){return this.N().toString()};g.hc=function(){return Ma(this.c)};g.getName=function(a){return a?this.g:this.b};g.ea=function(){return this.i};g.N=function(){return this.f()};g.pc=function(){return Ba(this.m,function(a){return a.toString()})};g.Yb=function(){return this.a};g.R=function(a){return this.b==E(a)};g.qc=function(a){this.a=a};
  g.sc=function(a){this.dd("true"==a||"TRUE"==a)};g.dd=function(a){if("boolean"!=typeof a)throw Error("non-boolean value: "+a);a!==this.N()&&this.h(a)};function O(a,b,c,d,e){this.h=a;this.o=ob(E(b));this.A=c;this.w=d;this.B=e;this.m=!1;this.g=3;this.f=-1;this.a=0;this.b=G;this.i=[];this.c=[]}g=O.prototype;g.toString=function(){return""};g.bd=function(){return this.N().toString()};g.hc=function(){return Ma(this.i)};g.getName=function(a){return a?this.A:this.o};g.ea=function(){return this.h};g.N=function(){return this.w()};g.pc=function(){return Ba(this.c,function(a){return a.toString()})};g.Yb=function(){return this.m};
  g.R=function(a){return this.o==E(a)};function Wb(a,b,c){if(c.length!==b.length)throw Error("choices and values not same length");a.i=b;a.c=c;b=new N(a.h,"CHOICES_MODIFIED",a);Xb(a.h,b)}g.qc=function(a){this.m=a};function Yb(a){a.f=0;return a}g.sc=function(a){var b=Number(a);if(isNaN(b))throw Error("not a number: "+a);this.ff(b)};function Zb(a,b){if(b>a.N()||b>a.b)throw Error("out of range: "+b+" value="+a.N()+" upper="+a.b);a.a=b;return a}function $b(a,b){a.g=b;return a}
  function ac(a,b){if(b<a.N()||b<a.a)throw Error("out of range: "+b+" value="+a.N()+" lower="+a.a);a.b=b;return a}g.ff=function(a){if(!t(a))throw Error("not a number: "+a);if(a<this.a||a>this.b)throw Error("out of range. "+a+" is not between "+this.a+" and "+this.b);if(0<this.c.length&&!B(this.c,a))throw Error(a+" is not an allowed value among: ["+this.c.join(",")+"]");a!==this.N()&&this.B(a)};function bc(a,b,c,d,e,f,h){this.o=a;this.g=ob(E(b));this.i=c;this.h=d;this.m=e;this.f=!1;this.b=G;this.c=[];this.a=[];if(null!=f)if(null!=h){this.c=f;if(h.length!==f.length)throw Error("different lengths choices:"+f+" values:"+h);this.a=h}else throw Error("values is not defined");}g=bc.prototype;g.toString=function(){return""};g.bd=function(){return this.N()};g.hc=function(){return Ma(this.c)};g.getName=function(a){return a?this.i:this.g};g.ea=function(){return this.o};g.N=function(){return this.h()};
  g.pc=function(){return Ma(this.a)};g.Yb=function(){return this.f};g.R=function(a){return this.g==E(a)};g.qc=function(a){this.f=a};g.sc=function(a){if(!ja(a))throw Error("non-string value: "+a);if(a.length>this.b)throw Error("string too long: "+a+" maxLength="+this.b);if(0<this.a.length&&!B(this.a,a))throw Error('"'+a+'" is not an allowed value among: ['+this.a.join(",")+"]");a!==this.N()&&this.m(a)};function P(a){if(!a)throw Error("no name");this.Pc=ob(E(a));this.O=[];this.Ga=[];this.ha=!0;this.va=!1;this.J=[]}g=P.prototype;g.toString=function(){return""};function ec(a,b){a.J.push({action:!0,ed:b});fc(a)}function fc(a){if(!a.va){for(var b=0,c=a.J.length;b<c;b++){var d=a.J[b];d.action?B(a.O,d.ed)||a.O.push(d.ed):Ha(a.O,d.ed)}a.J=[]}}g.I=function(a){var b=a.getName(),c=gc(this,b);if(null!=c)throw Error("parameter "+b+" already exists: "+c);this.Ga.push(a)};
  function Xb(a,b){if(a.ha){a.va=!0;try{A(a.O,function(a){a.ga(b)})}finally{a.va=!1,fc(a)}}}function Q(a,b){var c=gc(a,b);if(null==c)throw Error("unknown Parameter "+b);Xb(a,c)}g.getName=function(){return this.Pc};function gc(a,b){b=E(b);return Ea(a.Ga,function(a){return a.getName()==b})}g.cd=function(a){var b=gc(this,a);if(null!=b)return b;throw Error("Parameter not found "+a);};function hc(a,b){a=gc(a,b);if(a instanceof Vb)return a;throw Error("ParameterBoolean not found "+b);}
  function ic(a,b){a=gc(a,b);if(a instanceof O)return a;throw Error("ParameterNumber not found "+b);}function jc(a,b){a=gc(a,b);if(a instanceof bc)return a;throw Error("ParameterString not found "+b);}g.getParameters=function(){return Ma(this.Ga)};function kc(a,b){a.J.push({action:!1,ed:b});fc(a)}function lc(a,b){var c=a.ha;a.ha=b;return c};function mc(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.f=d;this.g=e;this.h=f}mc.prototype.toString=function(){return""};function nc(a,b){b.transform(a.a,a.b,a.c,a.f,a.g,a.h)}function oc(a,b){return new mc(a.a*b.a+a.c*b.b,a.b*b.a+a.f*b.b,a.a*b.c+a.c*b.f,a.b*b.c+a.f*b.f,a.a*b.g+a.c*b.h+a.g,a.b*b.g+a.f*b.h+a.h)}function pc(a,b,c,d){a=qc(a,b,c);d.lineTo(a.j(),a.l())}function rc(a,b){a=qc(a,0,0);b.moveTo(a.j(),a.l())}
  function sc(a,b){var c=Math.cos(b);b=Math.sin(b);return new mc(c*a.a+b*a.c,c*a.b+b*a.f,-b*a.a+c*a.c,-b*a.b+c*a.f,a.g,a.h)}mc.prototype.scale=function(a,b){return new mc(this.a*a,this.b*a,this.c*b,this.f*b,this.g,this.h)};function tc(a,b){b.setTransform(a.a,a.b,a.c,a.f,a.g,a.h)}function qc(a,b,c){t(b)||(c=b.l(),b=b.j());if(!t(b)||!t(c))throw Error();return new I(a.a*b+a.c*c+a.g,a.b*b+a.f*c+a.h)}
  mc.prototype.translate=function(a,b){t(a)||(b=a.l(),a=a.j());if(!t(a)||!t(b))throw Error();return new mc(this.a,this.b,this.c,this.f,this.g+this.a*a+this.c*b,this.h+this.b*a+this.f*b)};var uc=new mc(1,0,0,1,0,0);function vc(a,b){Sb.call(this,a,b);this.w=1;this.f=K;this.i=this.o=0;this.h=1;this.D=K;this.A=0;this.a=K;this.Bb=null;this.za=[K];this.Oc=0;this.g=rb}l(vc,Sb);g=vc.prototype;g.toString=function(){return""};g.qb=function(a,b,c){c=void 0===c?this.o:c;var d=a.j()-this.a.j();a=a.l()-this.a.l();var e=Math.sin(c),f=Math.cos(c);this.u(new I(b.j()-(d*f-a*e),b.l()-(d*e+a*f)),c)};g.G=function(a){var b=a.j()-this.a.j();a=a.l()-this.a.l();return new I(this.f.j()+(b*this.h-a*this.i),this.f.l()+(b*this.i+a*this.h))};
  g.Oe=function(){var a=new mc(1,0,0,1,this.f.j(),this.f.l());a=sc(a,this.o);return a.translate(-this.a.j(),-this.a.l())};g.ke=function(){return this.o};g.gc=function(){return this.A};g.Re=function(){var a=G;A(this.Xb(),function(b){b=this.G(b);b.l()<a&&(a=b.l())},this);return a};function wc(a){return new M(a.wa(),a.Da(),a.ub(),a.gb())}g.Qa=function(){return new M(this.Xd(),this.Re(),this.Yd(),this.jc())};g.Te=function(){return this.a};g.$b=function(){return this.G(this.Zb())};g.Gb=function(){return Ma(this.za)};
  g.S=function(){return this.gb()-this.Da()};g.Xd=function(){var a=G;A(this.Xb(),function(b){b=this.G(b);b.j()<a&&(a=b.j())},this);return a};g.M=function(){return this.w};g.ba=function(){return this.f};g.Yd=function(){var a=sb;A(this.Xb(),function(b){b=this.G(b);b.j()>a&&(a=b.j())},this);return a};g.jc=function(){var a=sb;A(this.Xb(),function(b){b=this.G(b);b.l()>a&&(a=b.l())},this);return a};g.P=function(){return this.ub()-this.wa()};
  g.hb=function(a){return n(a)?(a=this.na(J(yb(a),this.a)),new I(this.D.j()-a.l()*this.A,this.D.l()+a.j()*this.A)):this.D};g.bf=function(){return this.Bb};g.nc=function(){return!0};g.kb=function(){return this.w*this.Oc};g.na=function(a){return Ib(yb(a),this.h,this.i)};g.lf=function(a){return Ib(yb(a),this.h,-this.i)};g.mf=function(){return.5*this.kb()*this.A*this.A};g.Ua=function(a){this.u(this.f,a)};g.nf=function(a){if(!isFinite(a))throw Error("angular velocity must be finite "+a);this.A=a};
  g.pa=function(a,b){this.a=new I(a,b);this.g=rb};g.xb=function(a){this.za=Ma(a)};g.L=function(a){if(0>=a||!t(a))throw Error("mass must be positive "+a);this.w=a;return this};g.xa=function(a){this.Oc=a};g.u=function(a,b){this.f=yb(a);n(b)&&this.o!=b&&(this.o=b,this.i=Math.sin(b),this.h=Math.cos(b))};g.K=function(a,b){this.D=yb(a);n(b)&&this.nf(b)};g.T=function(a){this.Bb=n(a)?a:this.f.l();return this};g.tf=function(){return.5*this.w*Eb(this.D)};
  g.Ea=function(a){var b=a.j()-this.f.j();a=a.l()-this.f.l();var c=-this.i,d=this.h;return new I(this.a.j()+(b*d-a*c),this.a.l()+(b*c+a*d))};function xc(a,b){n(a)&&""!=a?b=b?b:a:(b=yc++,a=zc.Ce+b,b=Ac.Ce+b);vc.call(this,a,b);this.b=this.c=this.w=1}l(xc,vc);g=xc.prototype;g.toString=function(){return""};function Bc(a,b){b=new xc(b,void 0);b.c=a;b.b=a;return b}g.Sd=function(a){a.beginPath();var b=this.b/2,c=this.c/2;oa(a.ellipse)?(a.moveTo(c,0),a.ellipse(0,0,c,b,0,0,2*Math.PI,!1)):(a.arc(0,0,Math.min(c,b),0,2*Math.PI,!1),a.closePath())};g.Da=function(){return-this.b/2};g.Zb=function(){return K};
  g.tb=function(){var a=this.c/2,b=this.b/2;return Math.sqrt(a*a+b*b)};g.wa=function(){return-this.c/2};g.Hb=function(){if(isNaN(this.g)){var a=this.a.j(),b=this.a.l(),c=b-this.Da(),d=a-this.wa();d<c&&(c=d);d=this.gb()-b;d<c&&(c=d);d=this.ub()-a;d<c&&(c=d);this.g=c}return this.g};g.ub=function(){return this.c/2};g.gb=function(){return this.b/2};g.Xb=function(){var a=this.c/2,b=this.b/2;return[new I(-a,-b),new I(a,-b),new I(a,b),new I(-a,b)]};
  g.L=function(a){if(0>a||!t(a))throw Error("mass must be non-negative "+a);this.w=a;return this};g.ac=function(a,b){return a instanceof xc&&a.f.Oa(this.f,b)&&!F(a.c,this.c,b)&&!F(a.b,this.b,b)?!0:!1};var yc=1,zc={Ce:"PointMass"},Ac=zc;function Cc(a,b,c,d,e,f,h){Sb.call(this,a);this.a=b;this.g=c;this.f=e;this.i=d;this.h=f;this.c=this.b=0;this.m=void 0===h?0:h}l(Cc,Sb);g=Cc.prototype;g.toString=function(){return""};g.Qa=function(){return Lb(this.W(),this.aa())};g.aa=function(){return this.W().add(this.Sa())};g.W=function(){return 0==this.i?this.a.G(this.g):this.g};g.Sa=function(){return 0==this.h?this.a.na(this.f):this.f};
  g.ac=function(a,b){return a instanceof Cc&&a.getName()==this.getName()&&this.W().Oa(a.W(),b)?this.Sa().Oa(a.Sa(),b):!1};function Dc(a,b,c,d,e,f,h,k){Sb.call(this,a);this.b=b;this.g=yb(c);this.c=d;this.h=yb(e);this.a=f;this.f=void 0===h?0:h;this.i=k||!1}l(Dc,Sb);g=Dc.prototype;g.toString=function(){return""};g.Db=function(){var a=this.W(),b=this.aa(),c=J(b,a),d=c.length(),e=-this.f*(d-this.a);c=new I(c.j()/d*-e,c.l()/d*-e,0);return[new Cc("spring",this.b,a,1,c,1),new Cc("spring",this.c,b,1,Gb(c,-1),1)]};g.Kb=function(){};g.Qa=function(){return Lb(this.W(),this.aa())};
  g.aa=function(){if(null==this.h||null==this.c)throw Error();var a=this.c.G(this.h);if(this.i){var b=this.W(),c=this.a;if(Ab(b,a)<=c)return a;a=Hb(J(a,b));return b.add(Gb(a,c))}return a};g.Ib=function(){var a=Ab(this.aa(),this.W())-this.a;return.5*this.f*a*a};g.W=function(){if(null==this.g||null==this.b)throw Error();return this.b.G(this.g)};g.Sa=function(){return J(this.aa(),this.W())};function Ec(){P.call(this,"SIM_LIST");this.a=[]}l(Ec,P);g=Ec.prototype;g.toString=function(){return""};g.add=function(a){for(var b=0;b<arguments.length;b++){var c=arguments[b];if(null==c)throw Error("cannot add invalid SimObject");if(isFinite(c.Wd()))for(var d;d=Fc(this,c);)this.remove(d);B(this.a,c)||(this.a.push(c),Xb(this,new N(this,"OBJECT_ADDED",c)))}};
  g.get=function(a){if(t(a)){if(0<=a&&a<this.a.length)return this.a[a]}else if(ja(a)){a=E(a);var b=Ea(this.a,function(b){return b.getName()==a});if(null!=b)return b}throw Error("SimList did not find "+a);};function Fc(a,b){return Ea(a.a,function(a){return a.ac(b,.1)})}g.indexOf=function(a){return ya(this.a,a)};g.length=function(){return this.a.length};g.remove=function(a){Ha(this.a,a)&&Xb(this,new N(this,"OBJECT_REMOVED",a))};
  function Gc(a,b){for(var c=a.a.length-1;0<=c;c--){var d=a.a[c];d.Wd()<b&&(a.a.splice(c,1),Xb(a,new N(a,"OBJECT_REMOVED",d)))}};function Hc(a,b,c){this.h=a;this.f=ob(E(b));this.g=c;this.a=0;this.c=!1;this.b=0}g=Hc.prototype;g.toString=function(){return""};g.bd=function(){return this.a.toString()};g.hc=function(){return[]};g.getName=function(a){return a?this.g:this.f};g.ea=function(){return this.h};g.N=function(){return this.a};g.pc=function(){return[]};g.Yb=function(){return this.c};g.R=function(a){return this.f==E(a)};g.qc=function(a){this.c=a};
  g.sc=function(a){var b=Number(a);if(isNaN(b))throw Error("not a number: "+a+" (ConcreteVariable)");this.a!=b&&(this.a=b,this.b++)};function Ic(a,b,c){P.call(this,n(c)?c:"VARIABLES");this.b=-1;if(a.length!=b.length)throw Error("varNames and localNames are different lengths");c=0;for(var d=a.length;c<d;c++){var e=a[c];if(!ja(e))throw Error("variable name "+e+" is not a string i="+c);e=ob(E(e));a[c]=e;"TIME"==e&&(this.b=c)}a:{c=a.length;if(1<c){d=Array(c);for(e=0;e<c;e++)d[e]=a[e];Qa(d);var f=d[0];for(e=1;e<c;e++){if(f==d[e]){c=!1;break a}f=d[e]}}c=!0}if(!c)throw Error("duplicate variable names");this.a=[];c=0;for(d=a.length;c<
  d;c++)this.a.push(new Hc(this,a[c],b[c]))}l(Ic,P);g=Ic.prototype;g.toString=function(){return""};g.I=function(){throw Error("addParameter not allowed on VarsList");};
  function Jc(a,b,c){var d=b.length;if(0==d)throw Error();if(b.length!=c.length)throw Error("names and localNames are different lengths");a:{if(0>d)throw Error();var e=0;var f=-1;for(var h=0,k=a.a.length;h<k;h++)if("DELETED"==a.a[h].getName()){if(-1==f&&(f=h),e++,e>=d)break a}else f=-1,e=0;0<e?e=d-e:(f=a.a.length,e=d);for(h=0;h<e;h++)a.a.push(new Hc(a,"DELETED","DELETED"))}for(h=0;h<d;h++){e=ob(E(b[h]));if("DELETED"==e)throw Error("variable cannot be named ''+VarsList.DELETED+''");k=f+h;a.a[k]=new Hc(a,
  e,c[h]);"TIME"==e&&(a.b=k)}Xb(a,new N(a,"VARS_MODIFIED"));return f}function Kc(a,b){if(0>b||b>=a.a.length)throw Error("bad variable index="+b+"; numVars="+a.a.length);}g.cd=function(a){a=E(a);var b=Ea(this.a,function(b){return b.getName()==a});if(null!=b)return b;throw Error("Parameter not found "+a);};g.getParameters=function(){return Ma(this.a)};g.N=function(a){Kc(this,a);return this.a[a].N()};function Lc(a,b){return Ba(a.a,function(a){return!b&&a.Yb()?NaN:a.N()})}
  function Mc(a,b){if(t(b))var c=b;else if(ja(b)){if(b=E(b),c=Fa(a.a,function(a){return a.getName()==b}),0>c)throw Error("unknown variable name "+b);}else throw Error();Kc(a,c);return a.a[c]}g.Lb=function(a){if(0==arguments.length)for(var b=0,c=this.a.length;b<c;b++)this.a[b].b++;else for(b=0,c=arguments.length;b<c;b++){var d=arguments[b];Kc(this,d);this.a[d].b++}};g.bh=function(a){for(var b=0,c=arguments.length;b<c;b++){var d=arguments[b];Kc(this,d);this.a[d].qc(!0)}};function Nc(a){R(a,a.b,0)}
  function R(a,b,c,d){Kc(a,b);a=a.a[b];if("DELETED"!=a.getName()){if(isNaN(c)&&!a.Yb())throw Error("cannot set variable "+a.getName()+" to NaN");d?a.a=c:a.a!=c&&(a.a=c,a.b++)}}function Oc(a,b,c){var d=a.a.length,e=b.length;if(e>d)throw Error("setValues bad length n="+e+" > N="+d);for(var f=0;f<d;f++)f<e&&R(a,f,b[f],c)}var Pc={He:"time"};function Qc(){this.c=this.g=0;this.b=this.a=this.f=G}Qc.prototype.toString=function(){return""};function Rc(a){a.g=0;a.c=0;a.f=G;a.a=G;a.b=G}function Sc(a,b){Rc(a);A(b,function(a){a.i?this.g++:Tc(a);Tc(a);a.U&&(this.c++,a.F<this.b&&(this.b=a.F));if((a.U||!Tc(a))&&0>Uc(a)){var b=a.f;if(!isFinite(b))throw Error("distance is NaN "+a);b<this.f&&(this.f=b);isNaN(this.a)||(a=a.C,isNaN(a)?this.a=rb:a<this.a&&(this.a=a))}},a);a.a==G&&(a.a=rb);a.b==G&&(a.b=rb)};function Vc(a){this.a=a;this.c=[];this.h=[];this.i=[];this.f=[];this.g=[]}Vc.prototype.toString=function(){return""};Vc.prototype.getName=function(a){return a?Wc.oa:E(Xc.oa)};Vc.prototype.R=function(a){return this.getName()==E(a)};
  Vc.prototype.b=function(a){var b,c=this.a.v(),d=Lc(c),e=d.length;this.c.length<e&&(this.c=Array(e),this.h=Array(e),this.i=Array(e),this.f=Array(e),this.g=Array(e));var f=this.c,h=this.h,k=this.i,m=this.f,p=this.g;for(b=0;b<e;b++)f[b]=d[b];pb(h);b=this.a.fb(f,h,0);if(null!==b)return b;for(b=0;b<e;b++)f[b]=d[b]+h[b]*a/2;pb(k);b=this.a.fb(f,k,a/2);if(null!==b)return b;for(b=0;b<e;b++)f[b]=d[b]+k[b]*a/2;pb(m);b=this.a.fb(f,m,a/2);if(null!==b)return b;for(b=0;b<e;b++)f[b]=d[b]+m[b]*a;pb(p);b=this.a.fb(f,
  p,a);if(null!==b)return b;for(b=0;b<e;b++)d[b]+=(h[b]+2*k[b]+2*m[b]+p[b])*a/6;Oc(c,d,!0);return null};var Xc={oa:"Runge-Kutta"},Wc=Xc;function Yc(a){this.f=a;this.b=new Vc(a);this.a=.025;this.c=!1;this.i=new ub;this.O=this.C=this.m=0;this.o=rb;this.g=[];this.w=new Qc;this.D=[];this.h=!1;this.J=this.F=this.H=this.A=this.B=0}Yc.prototype.toString=function(){return""};
  function Zc(a,b,c){if(1E-16>b)a.f.ca();else{Gc(a.f.a,a.f.ma()+b);a.C=0;a.O=b;a.m=b;a.B=0;a.h=!1;a.o=rb;a.A=0;a.H=0;a.J=0;a.F=0;Rc(a.w);a.g=[];for(b=!1;a.C<a.O-1E-16;){$c(a,a.m);Sc(a.w,a.g);var d=!1;if(0<a.w.c&&(ad(a,a.m),d=!0,Sc(a.w,a.g),a.A++,3<=a.A&&(a.h||(a.h=!0),30<=a.A)))throw Error("collision was not resolved after "+a.A+" tries");a.F=Da(a.g,function(a){var b;if(b=(a.U||!Tc(a))&&0>Uc(a))b=d,b=Tc(a)?!0:b?0<a.f&&a.f<a.J+a.Z:a.f>a.J-a.Z&&a.f<a.J+a.Z;return b});if(0<a.F){a.D=[];bd(a);var e=cd(a,
  a.F);b=b||e;a.o=NaN;Sc(a.w,a.D)}d||(1E-7<a.m&&(a.A=0),a.C+=a.m,void 0!==c&&c.Ma(),a.h&&2<=++a.B?(a.h=!1,a.B=0):isFinite(a.o)&&(a.h=!0));dd(a,d)}!b&&a.c&&0<a.w.g&&ed(a);vb(a.i,a.J);xb(a.i,a.H)}}function dd(a,b){a.o=a.w.a;a.h||(a.o<a.f.ma()&&(a.h=!0),0<a.w.c&&isNaN(a.o)&&(a.h=!0));var c=a.O-a.C;a.h?(a.o=NaN,b&&(a.m/=2,a.B=0),a.m=Math.min(a.m,c)):isNaN(a.o)?a.m=c:(b=a.o-a.f.ma(),a.m=Math.min(b,c))}
  function $c(a,b){a.g=[];fd(a.f);var c=a.b.b(b);a.f.ca();a.H++;null!=c?a.g=c:(c=Lc(a.f.v()),a.f.qa(a.g,c,b));Ta(a.g,function(a,b){a=Math.round(1E7*a.C);b=Math.round(1E7*b.C);return isNaN(a)?isNaN(b)?0:1:isNaN(b)?-1:a<b?-1:a>b?1:0});A(a.g,function(a){var b=gd(a);a.U=b})}function ad(a,b){hd(a.f);a.f.ca();for(var c=a.f.ma(),d=a.g.length-1;0<=d;d--){var e=a.g[d];gd(e)?e.Wa(c):Ia(a.g,d)}c=Lc(a.f.v());a.f.qa(a.g,c,b)}
  function cd(a,b){if(id(a.f,a.g)){a.f.ca();var c=a.f.ma();A(a.g,function(a){a.Wa(c)});a.h&&wb(a.i);a.J+=b;a.h=!1;a.B=0;return!0}a.h=!0;return!1}function ed(a){0<a.g.length&&(bd(a),id(a.f,a.g),a.f.ca())}function jd(a){return a.f.ma()}function bd(a){for(var b=a.g.length;0<b--;){var c=a.g[b];c.i||c.f<c.H||(Ia(a.g,b),a.D.push(c))}}Yc.prototype.reset=function(){this.f.reset();this.i.reset()};function kd(){return"simultaneous;hybrid;serial grouped;serial grouped lastpass;serial separate;serial separate lastpass".split(";")}function ld(a){for(var b=kd(),c=0,d=b.length;c<d;c++)if(a==b[c])return b[c];throw Error("not found "+a);};function md(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}md.prototype.a=8;md.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};md.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{md.BYTES_PER_ELEMENT=8}catch(a){}md.prototype.BYTES_PER_ELEMENT=md.prototype.a;md.prototype.set=md.prototype.set;md.prototype.toString=md.prototype.toString;z("Float64Array",md)};function nd(a,b){var c=t(void 0)?void 0:0;this.a=nb(a);this.b=nb(b);this.c=nb(c)}g=nd.prototype;g.toString=function(){return""};g.add=function(a){this.a+=a.j();this.b+=a.l();this.c+=a.sa();return this};function od(a,b){var c=a.a-b.j(),d=a.b-b.l();a=a.c-b.sa();return c*c+d*d+a*a}function pd(a){a.a/=2;a.b/=2;a.c/=2;return a}g.Fb=function(a){return null===a?!1:a.j()===this.a&&a.l()===this.b&&a.sa()===this.c};g.j=function(){return this.a};g.l=function(){return this.b};g.sa=function(){return this.c};
  g.length=function(){return Math.sqrt(0===this.c?this.a*this.a+this.b*this.b:this.a*this.a+this.b*this.b+this.c*this.c)};function qd(a,b){a.a*=b;a.b*=b;a.c*=b;return a}g.Oa=function(a,b){return F(this.a,a.j(),b)||F(this.b,a.l(),b)||F(this.c,a.sa(),b)?!1:!0};function rd(a,b){a.a=b.j();a.b=b.l();a.c=b.sa();return a}function sd(a,b){a.a-=b.j();a.b-=b.l();a.c-=b.sa()};function td(a,b){for(var c=0,d=0;d<b;d++)a[d]&&c++;return c}
  function ud(a,b,c){var d;if(2>c.length)throw Error("");if(3!=a.length)throw Error("");var e=Array(3);for(d=0;3>d;d++)e[d]=b(a[d]);e[0]>e[1]&&vd(e,a,0,1);e[1]>e[2]&&vd(e,a,1,2);e[0]>e[1]&&vd(e,a,0,1);d=new nd(0,0);for(var f=new nd(0,0),h=new nd(0,0),k=new nd(0,0),m=new nd(0,0),p=new nd(0,0),q=0;1E-6<wd(a);){q++;if(1E4<q)return c[0]=q,c[1]=1,yb(a[0]);pd(rd(d,a[0]).add(a[1]));sd(qd(rd(f,d),2),a[2]);var r=b(f);if(r<e[1])if(r>=e[0])e[2]=r,rd(a[2],f),vd(e,a,1,2);else{sd(qd(rd(h,f),2),d);var u=b(h);u<r?
  (e[2]=u,rd(a[2],h)):(e[2]=r,rd(a[2],f));vd(e,a,1,2);vd(e,a,0,1)}else pd(rd(k,a[2]).add(d)),r=b(k),rd(p,pd(a[2])),sd(qd(rd(m,d),1.5),p),u=b(m),r<e[2]&&r<u?(e[2]=r,rd(a[2],k),e[2]<e[1]&&vd(e,a,1,2),e[1]<e[0]&&vd(e,a,0,1)):u<e[2]?(e[2]=u,rd(a[2],m),e[2]<e[1]&&vd(e,a,1,2),e[1]<e[0]&&vd(e,a,0,1)):(pd(a[1].add(a[0])),pd(a[2].add(a[0])),e[1]=b(a[1]),e[2]=b(a[2]),e[0]>e[1]&&vd(e,a,0,1),e[1]>e[2]&&vd(e,a,1,2),e[0]>e[1]&&vd(e,a,0,1))}c[0]=q;c[1]=0;return yb(a[0])}
  function xd(a,b,c,d){var e=a.j();a=a.l();var f=b.j();b=b.l();var h=c.j();c=c.l();var k=d.j(),m=d.l();var p=e>f?e:f;if(h>p&&k>p)return null;p=e<f?e:f;if(h<p&&k<p)return null;p=a>b?a:b;if(c>p&&m>p)return null;p=a<b?a:b;if(c<p&&m<p)return null;if(1E-16>Math.abs(f-e)){if(1E-16>Math.abs(k-h))return null;var q=e;d=(m-c)/(k-h)*(q-h)+c;b<a&&(p=a,a=b,b=p);k<h&&(p=h,h=k,k=p);m<c&&(p=c,c=m,m=p);return a-1E-14<=d&&d<=b+1E-14&&h-1E-14<=q&&q<=k+1E-14&&c-1E-14<=d&&d<=m+1E-14?new I(q,d):null}if(1E-16>Math.abs(k-
  h))return q=h,d=(b-a)/(f-e)*(q-e)+a,b<a&&(p=a,a=b,b=p),f<e&&(p=e,e=f,f=p),m<c&&(p=c,c=m,m=p),e-1E-14<=q&&q<=f+1E-14&&a-1E-14<=d&&d<=b+1E-14&&c-1E-14<=d&&d<=m+1E-14?new I(q,d):null;p=(b-a)/(f-e);q=(m-c)/(k-h);if(1E-16>Math.abs(q-p))return null;1E-16>Math.abs(q)?(d=(c+m)/2,q=(d-a)/p+e):1E-16>Math.abs(p)?(d=(a+b)/2,q=(d-c)/q+h):(q=(q*h-p*e-c+a)/(q-p),d=p*(q-e)+a);b<a&&(p=a,a=b,b=p);f<e&&(p=e,e=f,f=p);k<h&&(p=h,h=k,k=p);m<c&&(p=c,c=m,m=p);return e-1E-14<=q&&q<=f+1E-14&&a-1E-14<=d&&d<=b+1E-14&&h-1E-14<=
  q&&q<=k+1E-14&&c-1E-14<=d&&d<=m+1E-14?new I(q,d):null}function wd(a){var b=od(a[0],a[1]),c=od(a[0],a[2]);c>b&&(b=c);c=od(a[1],a[2]);c>b&&(b=c);return Math.sqrt(b)}function yd(a,b){a+=" [";for(var c=0,d=b.length;c<d;c++)a+=b[c].toString()+", ";console.log(a+"]")}function zd(a,b,c){for(var d=b.length,e=Array(d),f=0;f<d;f++){for(var h=e[f]=0;h<d;h++)e[f]+=a[f][h]*b[h];c&&(e[f]+=-c[f])}return e}
  function Ad(a,b,c,d){var e=b.length,f,h,k,m=Array(e+1),p=Array(e);for(f=0;f<e;f++){d[f]=f;m[f]=f;for(h=p[f]=0;h<e;h++)Math.abs(a[f][h])>p[f]&&(p[f]=Math.abs(a[f][h]));if(1E-10>p[f])return f}m[e]=e;var q=0;f=0;a:for(;f<e;f++)for(k=0;;){var r=q;var u=Math.abs(a[d[r]][m[f]])/p[d[r]];for(h=q+1;h<e;h++){var x=Math.abs(a[d[h]][m[f]])/p[d[h]];x>u&&(u=x,r=h)}if(Math.abs(a[d[r]][m[f]])<c){if(k>=e-1-f)break a;u=m[f];for(h=f;h<e-1;h++)m[h]=m[h+1];m[e-1]=u;k++}else{d[q]!=d[r]&&(u=d[q],d[q]=d[r],d[r]=u);for(h=
  q+1;h<e;h++)for(r=a[d[h]][m[f]]/a[d[q]][m[f]],k=0;k<e+1;k++)a[d[h]][m[k]]-=r*a[d[q]][m[k]];q++;break}}q--;if(q<e-1)for(f=q+1;f<e;f++)if(.1<Math.abs(a[d[f]][e]))return d[f];f=e-1;for(p=e;0<=q;){h=-1;for(k=f;k>=q;k--)Math.abs(a[d[q]][m[k]])>c&&(h=k);-1!=h&&h!=f&&(f=h);if(!(Math.abs(a[d[q]][m[f]])<c)){if(1<p-f)for(h=f+1;h<p;h++)b[m[h]]=0;p=f;k=0;for(h=f+1;h<e;h++)k+=a[d[q]][m[h]]*b[m[h]];b[m[f]]=(a[d[q]][e]-k)/a[d[q]][m[f]];f--}q--}return-1}
  function Bd(a,b,c){for(var d=G,e=0,f=0;f<b;f++){var h=Math.abs(a[c[f]][f]);h<d&&(d=h);h>e&&(e=h)}return.002>Math.abs(d)}function Cd(a,b,c){if(a==rb||b==rb)throw Error();a=a==G?0<b?b:a:b==G?0<a?a:b:0<a&&0<b?a<b?a:b:0>a?-a:-b;return a==G?c:2*a*Math.sqrt(2*c/a)}function vd(a,b,c,d){var e=a[c];a[c]=a[d];a[d]=e;a=b[c];b[c]=b[d];b[d]=a}function Dd(a,b){for(var c=a.length,d=Array(c),e=0;e<c;e++)d[e]=a[e]+b[e];return d};function Ed(a){this.J=!1;this.time=0;this.F=[];this.w=[];this.A=[];this.i=[];this.X=[];this.m=[];this.h=[];this.D=[];this.o=[];this.U=[];this.b=[];this.c=[];this.f=[];this.g=[];this.a=0;this.C=[];this.B=0;this.H=[];this.O=[];this.V=a}
  function Fd(a,b,c,d,e,f){a.J=!1;a.time=f;a.a=d.length;if(1==a.a)return c[0]=e[0]||0>d[0]?-d[0]/b[0][0]:0,-1;a.o=b;a.U=d;a.i=c;a.g=e;a.X.length<a.a&&(b=a.a+10,a.X=D(b),a.b=Ya(b),a.c=Ya(b),a.f=Ya(b),a.h=D(b),a.m=D(b),a.D=Ya(b));Ga(a.F);b=0;a.H=[];a.O=[];for(c=0;c<a.a;c++)a.i[c]=0,a.X[c]=a.U[c],a.c[c]=!1,a.b[c]=!1,a.f[c]=!1;for(c=0;;){c++;a:{d=a;var h=Gd(d.V,d.a);for(f=0;f<d.a;f++)if(e=h[f],d.g[e]&&!d.b[e]&&!d.c[e]&&!d.f[e]){d=e;break a}h=G;f=-1;for(e=0;e<d.a;e++)!(d.g[e]||d.b[e]||d.c[e]||d.f[e])&&d.X[e]<
  h&&(h=d.X[e],f=e);if(-1<f)d=f;else{f=0;h=-1;for(e=0;e<d.a;e++)d.f[e]&&!B(d.F,e)&&(!d.g[e]&&d.X[e]<-f||d.g[e]&&Math.abs(d.X[e])>f)&&(f=Math.abs(d.X[e]),h=e);d=-1<h&&1E-8<f?h:-1}}if(0>d)break;a.f[d]&&a.F.push(d);a:{var k;e=a;f=d;var m=e.J;for(h=0;h<e.a;h++)if(!e.b[h]&&!e.c[h]&&!e.f[h]){e=!1;break a}var p=[];for(h=0;h<e.a;h++)p.push(e.b[h]?1:e.c[h]?2:3);p.push(f);m&&yd("checkLoop state",p);f=!1;h=0;for(k=e.H.length;h<k;h++){var q=e.H[h];m&&yd("state",p);Ua(p,q)&&(f=!0)}if(!f){e.H.push(p);h=e.X;for(p=
  m=0;p<e.a;p++)if(e.g[p]||0>h[p])m+=h[p]*h[p];e.O.push(m)}e=f}if(e)break;e=Hd(a,d);if(-1<e)a.b[e]=!1,a.c[e]=!1,a.f[e]=!0;else{if(-1>e)return e;Ga(a.F);a.f[d]&&(b++,a.f[d]=!1)}}return-1}function Id(a){return Jd(a.i,a.X,a.g)?!0:!1}function Jd(a,b,c){var d=a.length,e;if(b.length<d)throw Error();var f=!0;for(e=0;e<d;e++)c[e]||1E-10<Math.abs(a[e])?1E-4<Math.abs(b[e])&&(f=!1):-1E-4>b[e]&&(f=!1);return f}
  function Hd(a,b){var c;if(!a.g[b]&&-1E-10<=a.X[b]||a.g[b]&&1E-10>=Math.abs(a.X[b]))return a.c[b]=!0,-1;var d,e=td(a.b,a.a);e+=1;var f=Kd(a,e),h=0;for(d=0;d<a.a;d++)if(a.b[d]||d==b){var k=0;for(c=0;c<a.a;c++)if(a.b[c]||c==b)f[h][k]=a.o[d][c],k++;f[h][e]=1;h++}d=D(e);c=D(e);Ad(f,c,1E-9,d);if(c=(c=Bd(f,e,d))&&!a.f[b])return b;for(c=0;c<a.a;c++)a.h[c]=0,a.m[c]=0,a.D[c]=!1;e=1E-10;for(f=0;!a.g[b]&&a.X[b]<-e||a.g[b]&&Math.abs(a.X[b])>e;){a:{var m;d=a;var p=b;for(m=0;m<d.a;m++)d.m[m]=0;d.m[p]=1;c=td(d.b,
  d.a);if(0<c){h=Kd(d,c);if(null==d.C||d.C.length<c)d.C=D(c+10);var q=0;for(m=0;m<d.a;m++)if(d.b[m]){var r=0;for(k=0;k<d.a;k++)d.b[k]&&(h[q][r]=d.o[m][k],r++);h[q][c]=-d.o[m][p];d.C[q]=-d.o[m][p];q++}k=D(c);Ld(c,c+1,h,d.A);for(m=1E-9;;){q=D(c);if(-1!=Ad(h,k,m,q)){d=-999999;break a}q=zd(d.A,k,d.C);p=void 0;r=0;p=p||q.length;for(var u=0;u<p;u++)Math.abs(q[u])>r&&(r=Math.abs(q[u]));if(1E-7>r)break;else if(m/=10,Ld(c,c+1,d.A,h),1E-17>m)break}for(m=q=0;m<d.a;m++)d.b[m]&&(d.m[m]=k[q++])}for(m=0;m<d.a;m++)for(k=
  d.h[m]=0;k<d.a;k++)d.h[m]+=d.o[m][k]*d.m[k];d=-1}if(-1!=d)return d;h=a;k=G;h.g[b]&&0<h.X[b]&&(k=sb);m=-1;h.g[b]?(m=b,k=-h.X[b]/h.h[b]):0<h.h[b]&&(m=b,k=-h.X[b]/h.h[b]);q=0<k?1:-1;for(c=0;c<h.a;c++)!h.g[c]&&h.b[c]&&-1E-14>h.m[c]*q&&(d=-h.i[c]/h.m[c],0>d*q&&(2E-10<Math.abs(h.i[c])&&(h.J=!0),d=0),d*q<k*q&&(k=d,m=c));for(c=0;c<h.a;c++)h.c[c]&&(!h.g[c]&&-1E-14>h.h[c]*q||h.g[c]&&1E-14<Math.abs(h.h[c]*q))&&(d=-h.X[c]/h.h[c],0>d*q&&(2E-10<Math.abs(h.X[c])&&(h.J=!0),d=0),d*q<k*q&&(k=d,m=c));h.B=k;d=m;if(0>
  d||1E5<Math.abs(a.B)){if(1E-10>Math.abs(a.i[b]))return b;if(1E-5>Math.abs(a.X[b])){e=1.1*Math.abs(a.X[b]);continue}return-2}1E-12>Math.abs(a.B)&&(a.D[d]&&(a.b[d]=!1,a.c[d]=!1,a.f[d]=!0),a.D[d]=!0);for(c=0;c<a.a;c++)a.i[c]+=a.B*a.m[c],a.X[c]+=a.B*a.h[c];if(f++>10*a.a&&f>1E3*a.a)throw Error("drive_to_zero() loopCtr="+f+" d="+b+" a[d]="+a.X[b]);if(a.c[d]){q=a;p=b;r=d;c=td(q.b,q.a);c+=2;h=Kd(q,c);for(m=u=0;m<q.a;m++)if(q.b[m]||m==p||m==r){var x=0;for(k=0;k<q.a;k++)if(q.b[k]||k==p||k==r)h[u][x]=q.o[m][k],
  x++;h[u][c]=1;u++}k=D(c);m=D(c);Ad(h,m,1E-9,k);if(c=(c=Bd(h,c,k))&&!a.f[d]){a.b[d]=!1;a.c[d]=!1;a.f[d]=!0;continue}}if(a.b[d])if(1E-10<Math.abs(a.X[d])){if(1E-9<Math.abs(a.i[d]))throw Error("moving C to NC but f[j]="+cb(a.i[d]));a.b[d]=!1;a.c[d]=!1;a.f[d]=!0}else a.b[d]=!1,a.c[d]=!0;else a.c[d]&&(1E-10<Math.abs(a.i[d])?(a.b[d]=!1,a.c[d]=!1,a.f[d]=!0):(a.b[d]=!0,a.c[d]=!1))}a.b[b]=1E-10<Math.abs(a.i[b]);a.c[b]=!a.b[b];return-1}
  function Kd(a,b){if(null==a.w||a.w.length<b){b=10*(2+b/10);a.w=Array(b);a.A=Array(b);for(var c=0;c<b;c++)a.w[c]=new Float64Array(b+1),a.A[c]=new Float64Array(b+1)}return a.w}function Ld(a,b,c,d){for(var e=0;e<a;e++)for(var f=b,h=c[e],k=d[e],m=0;m<f;m++)k[m]=h[m]};function Md(){this.b=this.a=K;this.f=0;this.c=1}Md.prototype.toString=function(){return""};function Nd(a,b){var c=b.j()-a.a.j();b=b.l()-a.a.l();return new I(a.b.j()+(c*a.c-b*a.f),a.b.l()+(c*a.f+b*a.c))}Md.prototype.set=function(a,b,c,d){this.a=a;this.b=b;this.f=c;this.c=d};function Od(a,b){var c=b.j()-a.b.j();b=b.l()-a.b.l();var d=-a.f,e=a.c;return new I(a.a.j()+(c*e-b*d),a.a.l()+(c*d+b*e))};function Pd(a,b,c){this.c=a;this.b=b;this.i=c;this.H=Math.max(a.Ca(),b.Ca());this.J=c?0:this.H/2;c=Math.max(a.Vd(),b.Vd());if(0>=c||1<c)throw Error("accuracy must be between 0 and 1, is "+c);this.Z=c*this.H/2;this.Ha=Math.max(a.he(),b.he());this.va=Math.min(a.ad(),b.ad());this.m=this.B=this.U=this.Ga=!1;this.g=K;this.o=null;this.f=rb;this.a=Kb;this.Ia=null;this.za=this.ia=this.h=this.w=rb;this.A="";this.Bb=this.Ab=this.C=this.F=rb}g=Pd.prototype;g.toString=function(){return""};
  function Tc(a){return a.i||Math.abs(Uc(a))<a.Ha&&0<a.f&&a.f<a.H}g.ic=function(){return null};function Uc(a){if(isNaN(a.ia)){var b=a.a,c,d=c=0,e=0,f=0;if(isFinite(a.c.M())){c=a.kc();d=c.j();c=c.l();var h=a.c.hb(),k=a.c.gc();c=h.j()-k*c;d=h.l()+k*d}isFinite(a.b.M())&&(e=a.Wb(),f=e.j(),e=e.l(),h=a.b.hb(),k=a.b.gc(),e=h.j()-k*e,f=h.l()+k*f);c=new I(c-e,d-f);a.ia=Cb(b,c)}return a.ia}function Qd(a){return J(a.g,a.c.ba())}function Rd(a){return J(a.o?a.o:a.g,a.b.ba())}g.kc=function(){return Qd(this)};
  g.Wb=function(){return Rd(this)};function Sd(a,b){return a.c==b||a.b==b}g.Jb=function(){return!1};g.mc=function(){return!1};function gd(a){return a.i?!1:0>a.f||Uc(a)<-a.Ha&&a.f<a.J-a.Z?!0:!1}function Td(a,b){if(isFinite(a.F))throw Error("detectedTime_ already set "+a);a.F=b;var c=Uc(a);a.za=c;a.C=rb;!a.i&&-.001>c&&(a.C=b+(a.J-a.f)/c)}
  g.Wa=function(a){if(!isFinite(this.f))throw Error("distance is NaN "+this);this.ia=rb;if((this.U||!Tc(this))&&0>Uc(this)){var b=this.F,c=this.f,d=Uc(this),e=this.za,f=b-a;1E-12>=f||(e=(e-d)/f,1E-12>Math.abs(e)||(f=Math.sqrt(d*d-2*e*(c-this.J)),c=a+(-d+f)/e,d=a+(-d-f)/e,e=!1,c>a&&c<b&&(this.C=c,e=!0),d>a&&d<b&&(!e||d<c)&&(this.C=d)))}else this.C=rb};function Ud(){return["none","velocity","velocity_and_distance","velocity_joints","velocity_and_distance_joints"]}function Vd(a){for(var b=Ud(),c=0,d=b.length;c<d;c++)if(a===b[c])return b[c];throw Error("not found "+a);}var Wd={NONE:"none",Rb:"velocity",Tf:"velocity+distance",Vf:"velocity (also joints)",Uf:"velocity+distance (also joints)"};function Xd(a,b,c,d,e,f){Sb.call(this,a);this.g=b;this.b=c;this.a=d;this.c=e;this.f=f}l(Xd,Sb);g=Xd.prototype;g.toString=function(){return""};g.Qa=function(){return Lb(this.a,this.aa())};g.aa=function(){return this.a.add(this.c)};g.W=function(){return this.a};g.Sa=function(){return this.c};g.ac=function(a,b){return a instanceof Xd&&a.getName()==this.getName()&&this.a.Oa(a.W(),b)&&!F(this.b,a.b,b)&&this.c.Oa(a.Sa(),b)?this.f.Oa(a.f,b):!1};function Yd(a,b,c){this.f=b;this.c=c;this.A=Gb(this.f.a.add(this.c.a),.5);this.B=null;this.o=rb;this.a=a;this.F=-1;this.J=!1}Yd.prototype.toString=function(){return""};function Zd(a){isNaN(a.o)&&(a.o=1.25*a.Ye(a.A));return a.o}function $d(a){null==a.B&&(a.B=a.a.G(a.A));return a.B}Yd.prototype.Ue=function(){return[]};function ae(a){if(-1==a.F&&(a.F=ya(a.a.c,a),-1==a.F))throw Error();return a.F}Yd.prototype.be=function(a,b){var c=$d(this),d=$d(a);c=Eb(J(c,d));a=Zd(a)+Zd(this)+b;return c<a*a};
  function be(a,b,c){a=a.rb(b);return b.add(Gb(a,c))};function ce(a,b){Pd.call(this,a.a,b.a,!1);this.ha=a;this.V=b;this.D=this.O=null}l(ce,Pd);g=ce.prototype;g.toString=function(){return""};g.kc=function(){return null!=this.O?this.O:this.B?this.O=J(this.c.G(this.ha.i),this.c.ba()):Qd(this)};g.Wb=function(){return null!=this.D?this.D:this.m?this.D=J(this.b.G(this.V.i),this.b.ba()):Rd(this)};g.Jb=function(a){return null==a?!1:a==this.V||a==this.ha};
  g.hd=function(a){if(!(Sd(a,this.c)&&Sd(a,this.b)&&a.Jb(this.V)&&a.Jb(this.ha)))return!1;var b=Cd(this.w,this.h,this.H);return Eb(J(this.g,a.g))>b*b||.9>Math.abs(Cb(this.a,a.a))?!1:!0};g.Wa=function(a){this.D=this.O=null;this.ha.ae(this,this.V);Pd.prototype.Wa.call(this,a)};function de(a,b){var c=ee(a);if(null==c)throw Error("CornerEdgeCollision: null edge; vertex="+a);Pd.call(this,c.a,b.a,!1);this.V=a;this.D=b;this.ha=c;this.O=null;this.ob=a.f?fe(a):null;this.w=ge(a);this.B=!1}l(de,Pd);g=de.prototype;g.toString=function(){return""};g.Wb=function(){if(null!=this.O)return this.O;if(this.m){this.b.Ea(this.o?this.o:this.g);var a=this.D.Se();if(null!=a)return this.O=J(this.b.G(a),this.b.ba())}return Rd(this)};
  g.Jb=function(a){return null==a?!1:a==this.D||a==this.ha||this.ob==a};g.mc=function(a){return a==this.V};g.hd=function(a){if(!Sd(a,this.c)||!Sd(a,this.b))return!1;if(a.mc(this.V))return!0;if(!a.Jb(this.D)||!a.Jb(this.ha)&&!a.Jb(this.ob))return!1;var b=Cd(this.w,this.h,this.H);return Eb(J(this.g,a.g))>b*b||.9>Math.abs(Cb(this.a,a.a))?!1:!0};
  g.Wa=function(a){this.O=null;var b=this.c.G(this.V.a);b=this.b.Ea(b);var c=this.D.Ve(b);null!=c&&(this.g=this.b.G(c[0]),this.a=this.b.na(c[1]),this.f=this.D.Tb(b),Pd.prototype.Wa.call(this,a))};function he(a,b){if(null==b)throw Error();var c=[],d=!0;if(!b.i){if(!isFinite(b.f))throw Error("distance is NaN "+b);A(a,function(a){if(b.hd(a)){var e=a.F,h=b.F;e>h+1E-14?d=!1:h>e+1E-14?c.push(a):b.f<a.f?c.push(a):d=!1}})}0<c.length&&A(c,function(b){Ha(a,b)});d&&a.push(b)}
  function ie(a,b,c,d){var e=c.Ea(b.$b()),f=je(b);null!=f&&(f=c.lf(f));A(c.m,function(h){if(!ke(b,ee(h))||!ke(b,fe(h))){var k=b.Ea(c.G(h.a)),m=k,p=0,q=b.Ub(),r=c.Ub();if(null!=q&&null!=r)m=Od(q,Nd(r,h.a)),p=zb(k,m);else if(null!=q||null!=r)throw Error("problem with old copy in checkVertexes");p=.01<p?Math.sqrt(p):.1;if(null!=f){if(q=Cb(J(h.a,e),f),q>b.tb()+b.Ca())return}else if(q=b.tb()+b.Ca()+p,r=q*q,q=Eb(J(h.a,e)),q>r)return;le(a,b,h,k,m,p,d)}})}
  function me(a,b,c){var d=je(a);if(null==d)throw Error();return Cb(J(b.$b(),a.$b()),d)<b.tb()+a.tb()+c}function ne(a,b,c,d,e,f){var h=new de(c,b);if(null==ee(c))throw Error();c=b.a;h.f=b.Tb(e);e=c.G(d);h.g=e;d=c.na(b.rb(d));h.a=d;h.h=b.Yc();h.m=isFinite(h.h);h.A="";Td(h,f);he(a,h)}
  function oe(a){var b,c=[];if(0==a.length)return c;c.push(a[0]);var d=[];var e=c[0];isFinite(e.c.M())&&d.push(e.c);null!=e.b&&isFinite(e.b.M())&&d.push(e.b);do{var f=c.length;var h=0;for(b=a.length;h<b;h++)e=a[h],B(c,e)||(B(d,e.c)?(c.push(e),isFinite(e.b.M())&&!B(d,e.b)&&d.push(e.b)):B(d,e.b)&&(c.push(e),isFinite(e.c.M())&&!B(d,e.c)&&d.push(e.c)))}while(f<c.length);return c}
  function pe(a,b,c,d,e){var f;if(0==a.length)return[];var h=[];h.push(b);var k=[];isFinite(b.c.M())&&k.push(b.c);isFinite(b.b.M())&&k.push(b.b);if(c)for(c=0,f=a.length;c<f;c++){var m=a[c];B(h,m)||m.i||!(d[c]<e)||m.c!=b.c&&m.b!=b.b&&m.c!=b.b&&m.b!=b.c||(h.push(m),B(k,m.c)||k.push(m.c),B(k,m.b)||k.push(m.b))}do for(b=h.length,c=0,f=a.length;c<f;c++)m=a[c],B(h,m)||(B(k,m.c)&&m.i?(h.push(m),isFinite(m.b.M())&&!B(k,m.b)&&k.push(m.b)):B(k,m.b)&&m.i&&(h.push(m),isFinite(m.c.M())&&!B(k,m.c)&&k.push(m.c)));
  while(b<h.length);return h}
  function le(a,b,c,d,e,f,h){var k=ee(c);if(null==k)throw Error("");var m=k.a,p=b.Ca();if(!(d.j()<b.wa()-p&&e.j()<b.wa()||d.j()>b.ub()+p&&e.j()>b.ub()||d.l()<b.Da()-p&&e.l()<b.Da()||d.l()>b.gb()+p&&e.l()>b.gb()))for(;;){var q=null,r=null,u=G;A(b.c,function(b){if(!ke(m,b)){var k=Zd(b)+p+f;zb(b.A,d)>k*k||(k=b.ge(d,e),null==k?c.f&&(k=b.Qe(c,d,p),null!=k&&(Td(k,h),he(a,k))):A(k,function(a){var c=J(e,a).length();c<u&&(u=c,r=a,q=b)}))}});null!=q&&null!=r&&ne(a,q,c,r,d,h);break}};function qe(a,b,c){var d=b.a,e=c.a;if(c.g||b.g){e.G(c.i);d=d.G(b.i);d=e.Ea(d);d=re(c,d);var f=d.length();if(c.g&&b.g)a.f=f-(c.b+b.b);else if(!c.g&&b.g)a.f=c.b-b.b-f;else if(c.g&&!b.g)a.f=b.b-c.b-f;else throw Error();b=Gb(d,1/f);d=se(c,Gb(b,c.b));a.g=d;c.g||(b=Gb(b,-1));a.a=e.na(b)}}
  function te(a,b,c,d,e,f,h,k){var m=new ce(d,c);m.f=e;m.m=!0;m.B=!0;m.A="";f=Gb(h,1/f);h=se(c,Gb(f,c.b));m.g=h;c.g||(f=Gb(f,-1));m.a=c.a.na(f);m.w=(d.g?1:-1)*d.b;m.h=(c.g?1:-1)*c.b;a&&(m.w+=e/2,m.h+=e/2);Td(m,k);he(b,m)};function ue(a,b,c,d,e,f,h,k){var m=new ce(d,c);m.m=!1;m.B=!0;m.w=d.b;m.h=G;a&&(m.w+=e);m.f=e;m.g=f;m.A="";m.a=c.a.na(c.rb(h));Td(m,k);he(b,m)};function ve(a,b,c){this.a=a;this.f=n(b)?b:!0;this.c=n(c)?c:null;this.b=null;we++}ve.prototype.toString=function(){return""};function S(a){return a.a.j()}function xe(a){return a.a.l()}function ge(a){var b=G;null!=a.c&&(b=a.c.Yc(),null!=a.b&&(a=a.b.Yc(),Math.abs(a)<Math.abs(b)&&(b=a)));return b}function ee(a){if(null!=a.c)return a.c;throw Error();}function fe(a){if(null!=a.b)return a.b;if(null!=a.c)return a.c;throw Error();}function ye(a,b){if(null==a.c)a.c=b;else throw Error();}var we=1;function ze(a,b){var c=ee(a),d=ee(b);if(null==c||null==d)throw Error("CornerCornerCollision: null edge; vertex="+a+"; normalVertex="+b);Pd.call(this,c.a,d.a,!1);this.O=a;this.D=b}l(ze,Pd);ze.prototype.toString=function(){return""};ze.prototype.mc=function(a){return a==this.O||a==this.D};ze.prototype.hd=function(a){return Sd(a,this.c)&&Sd(a,this.b)?a.mc(this.O)||a.mc(this.D)?!0:!1:!1};
  ze.prototype.Wa=function(a){var b=this.c.G(this.O.a);b=this.b.Ea(b);this.g=this.b.G(this.D.a);this.f=Ab(this.D.a,b);if(!isFinite(this.f))throw Error();b=Hb(J(b,this.D.a));if(null==b)throw Error();this.a=this.b.na(b);Pd.prototype.Wa.call(this,a)};function Ae(a,b,c,d){Yd.call(this,a,b,c);this.b=d;if(null==b.b)b.b=this;else throw Error();ye(c,this);this.J=!0}l(Ae,Yd);g=Ae.prototype;g.toString=function(){return""};g.af=function(a){a.lineTo(S(this.c),xe(this.c))};function Be(a,b,c,d){var e=Ab(a.f.a,c);if(1E-6<=e&&e<=.6*d)return Ce(a,a.f,b,c,e);e=Ab(a.c.a,c);return 1E-6<=e&&e<=.6*d?Ce(a,a.c,b,c,e):null}g.Pe=function(){return 0};
  g.Tb=function(a){var b=a.j();a=a.l();var c=S(this.f),d=S(this.c),e=xe(this.f),f=xe(this.c);1E-10>Math.abs(d-c)?a=this.b?b-c:c-b:1E-10>Math.abs(f-e)?a=this.b?a-e:e-a:(f=(f-e)/(d-c),d=(-e+a+b/f+f*c)/(1/f+f),c=e+f*(d-c),b-=d,e=a-c,b=Math.sqrt(b*b+e*e),a<c&&(b=-b),a=this.b?b:-b);if(isNaN(a))throw Error("");return a};
  g.Td=function(a){var b=a.j();a=a.l();var c=S(this.f),d=S(this.c),e=xe(this.f),f=xe(this.c);if(1E-10>Math.abs(d-c))return e>f&&(a>e||a<f)||f>e&&(a>f||a<e)?G:this.b?b-c:c-b;if(1E-10>Math.abs(f-e))return c>d&&(b>c||b<d)||d>c&&(b>d||b<c)?G:this.b?a-e:e-a;var h=(f-e)/(d-c);f=(-e+a+b/h+h*c)/(1/h+h);e+=h*(f-c);if(c<d&&(f<c||f>d)||d<c&&(f<d||f>c))return G;b-=f;c=a-e;b=Math.sqrt(b*b+c*c);a<e&&(b=-b);return this.b?b:-b};
  g.Qe=function(a,b,c){var d=b.j(),e=b.l(),f=S(this.f),h=S(this.c),k=xe(this.f),m=xe(this.c);if(1E-10>Math.abs(h-f)){var p=(f+h)/2;if(k>m&&(e>k||e<m)||m>k&&(e>m||e<k))return Be(this,a,b,c);b=this.b?d-p:p-d;if(0>b||b>c)return null;a=new de(a,this);a.f=b;e=this.a.G(new I(p,e));a.g=e;e=this.a.na(new I(this.b?1:-1,0));a.a=e;a.m=!1;a.h=G;a.A="";return a}if(1E-10>Math.abs(m-k)){m=(k+m)/2;if(f>h&&(d>f||d<h)||h>f&&(d>h||d<f))return Be(this,a,b,c);b=this.b?e-m:m-e;if(0>b||b>c)return null;a=new de(a,this);a.f=
  b;e=this.a.G(new I(d,m));a.g=e;e=this.a.na(new I(0,this.b?1:-1));a.a=e;a.m=!1;a.h=G;a.A="";return a}m=(m-k)/(h-f);p=(-k+e+d/m+m*f)/(1/m+m);k+=m*(p-f);if(f<h&&(p<f||p>h)||h<f&&(p<h||p>f))return Be(this,a,b,c);d-=p;b=e-k;b=Math.sqrt(d*d+b*b);e<k&&(b=-b);b=this.b?b:-b;if(0>b||b>c)return null;a=new de(a,this);a.f=b;e=this.a.G(new I(p,k));a.g=e;e=Math.sqrt(1+m*m);e=this.a.na(new I(-m/e,1/e));this.b||(e=Gb(e,-1));a.a=e;a.m=!1;a.h=G;a.A="";return a};
  g.ce=function(){var a=xe(this.f),b=xe(this.c);return a<b?a:b};g.Se=function(){return null};g.Yc=function(){return G};g.de=function(){var a=S(this.f),b=S(this.c);return a<b?a:b};g.rb=function(){var a=S(this.f),b=S(this.c),c=xe(this.f),d=xe(this.c);if(1E-10>Math.abs(b-a))return new I(this.b?1:-1,0);if(1E-10>Math.abs(d-c))return new I(0,this.b?1:-1);b=(d-c)/(b-a);a=Math.sqrt(1+b*b);b=-b/a;a=1/a;this.b||(b=-b,a=-a);return new I(b,a)};g.Ve=function(a){var b=De(this,a);a=this.rb(a);return[b,a]};
  g.ee=function(){var a=S(this.f),b=S(this.c);return a>b?a:b};g.fe=function(){var a=xe(this.f),b=xe(this.c);return a>b?a:b};g.ae=function(a,b){b.J||b.ae(a,this)};g.ge=function(a,b){if(a==b)return null;a=xd(this.f.a,this.c.a,a,b);return null==a?null:[a]};g.be=function(a,b){return a.J?!1:Yd.prototype.be.call(this,a,b)};function Ce(a,b,c,d,e){c=new ze(c,b);c.f=e;var f=a.a.G(b.a);c.g=f;b=Hb(J(d,b.a));if(null==b)return null;a=a.a.na(b);c.a=a;c.B=!1;c.w=rb;c.m=!0;c.h=e;c.A="";return Tc(c)?c:null}
  g.Ye=function(a){var b=Ab(this.f.a,a);a=Ab(this.c.a,a);return b>a?b:a};function De(a,b){var c=b.j(),d=b.l();b=S(a.f);var e=S(a.c),f=xe(a.f);a=xe(a.c);if(1E-10>Math.abs(e-b))return new I(b,d);if(1E-10>Math.abs(a-f))return new I(c,f);a=(a-f)/(e-b);c=(-f+d+c/a+a*b)/(1/a+a);return new I(c,f+a*(c-b))}g.oe=function(a,b,c){b.J||b.oe(a,this,c)};function Ee(a,b,c,d,e,f,h){Yd.call(this,a,b,c);this.i=d;this.g=f;this.b=Ab(d,b.a);if(Math.abs(1E-10<this.b-Ab(c.a,d)))throw Error("center is not equidistant from the two end points");this.D=e;this.H=Db(J(b.a,d));this.C=Db(J(c.a,d));1E-10>Math.abs(this.H-this.C)&&(this.C=this.H+2*Math.PI);a=this.H;d=this.C;e=this.D;1E-10>Math.abs(a-d)?(e=a,a=e+2*Math.PI):1E-10>Math.abs(Math.abs(a-d)-2*Math.PI)?(e=Math.min(a,d),a=e+2*Math.PI):a>d?e?e=d:(e=a,a=d+2*Math.PI):e?(e=d,a+=2*Math.PI):(e=a,a=d);a=[e,a];this.h=
  a[0];this.m=a[1];d=this.m-this.h;a=Math.sin(d/2)-Math.sin(d)/2;d=Math.cos(d/2)-(1+Math.cos(d))/2;this.w=this.b*Math.sqrt(a*a+d*d);h=Math.max(Math.ceil((this.m-this.h)/(Math.PI/4)),Math.ceil((this.m-this.h)*this.b/(void 0===h?.3:h)));this.U=a=(this.m-this.h)/h;this.V=[];for(d=1;d<h;d++)e=this.D?this.m-d*a:this.h+d*a,e=new I(this.i.j()+this.b*Math.cos(e),this.i.l()+this.b*Math.sin(e)),e=new ve(e,!1,this),this.V.push(e);if(null==b.b)b.b=this;else throw Error();ye(c,this);this.m-this.h>=Math.PI?(this.A=
  this.i,this.o=this.b):this.o=Ab(this.A,b.a);this.g||(this.o*=1.2);this.O=1E-6>Math.abs(2*Math.PI-(this.m-this.h))}l(Ee,Yd);g=Ee.prototype;g.toString=function(){return""};g.af=function(a){a.arc(this.i.j(),this.i.l(),this.b,this.H,this.C,this.D)};function re(a,b){return J(b,a.i)}g.Pe=function(){return this.b*(1-Math.sqrt(1-this.U*this.U/4))};g.Tb=function(a){a=re(this,a);return(this.g?1:-1)*(a.length()-this.b)};g.Td=function(a){a=re(this,a);return Fe(this,a)?(this.g?1:-1)*(a.length()-this.b):G};
  function Ge(a,b){return b.add(a.i)}function se(a,b){return a.a.G(b.add(a.i))}g.Qe=function(a,b,c){var d=re(this,b);if(!Fe(this,d))return null;var e=d.length();b=(this.g?1:-1)*(e-this.b);if(0>b||b>c)return null;c=new de(a,this);c.f=b;if(1E-10>e)throw Error("cannot get normal for point at center of circle");d=Gb(d,1/e*(this.g?1:-1));c.a=this.a.na(d);c.h=(this.g?1:-1)*this.b;c.h+=b;b=this.a.G(Ge(this,Gb(d,c.h)));c.g=b;c.m=!0;c.w=ge(a);c.A="";return c};
  g.ce=function(){var a=-Math.PI/2;a+=a<this.h?2*Math.PI:0;return this.h<=a&&a<=this.m?this.i.l()-this.b:xe(this.f)<xe(this.c)?xe(this.f):xe(this.c)};g.Se=function(){return this.i};g.Yc=function(){return(this.g?1:-1)*this.b};g.Ue=function(){return this.V};g.de=function(){var a=Math.PI;a+=a<this.h?2*Math.PI:0;return this.h<=a&&a<=this.m?this.i.j()-this.b:S(this.f)<S(this.c)?S(this.f):S(this.c)};g.rb=function(a){a=re(this,a);var b=a.length();if(1E-10>b)throw Error("");return Gb(a,this.g?1/b:-1/b)};
  g.Ve=function(a){a=this.rb(a);return[Ge(this,Gb(a,(this.g?1:-1)*this.b)),a]};g.ee=function(){var a=0;a+=a<this.h?2*Math.PI:0;return this.h<=a&&a<=this.m?this.i.j()+this.b:S(this.f)>S(this.c)?S(this.f):S(this.c)};g.fe=function(){var a=Math.PI/2;a+=a<this.h?2*Math.PI:0;return this.h<=a&&a<=this.m?this.i.l()+this.b:xe(this.f)>xe(this.c)?xe(this.f):xe(this.c)};
  g.ae=function(a,b){if(b instanceof Ae){var c=b.a,d=this.a.G(this.i),e=c.Ea(d);d=be(b,e,-this.b);var f=Tc(a)?De(b,e):d;e=c.G(f);f=b.rb(f);c=c.na(f);a.f=b.Tb(d);a.g=e;a.a=c}else if(b instanceof Ee)a.b==b.a?qe(a,this,b):qe(a,b,this);else throw Error();};
  g.ge=function(a,b){if(a==b)return null;var c=re(this,a),d=re(this,b);a=b=null;if(1E-10>Math.abs(d.j()-c.j())){var e=(c.j()+d.j())/2;if(Math.abs(e)>this.b)return null;var f=Math.sqrt(this.b*this.b-e*e),h=c.l()<d.l()?c.l():d.l();c=c.l()>d.l()?c.l():d.l();h<=f&&f<=c&&(b=new I(e,f));h<=-f&&-f<=c&&(a=new I(e,-f))}else{h=(d.l()-c.l())/(d.j()-c.j());var k=1+h*h,m=c.l()-h*c.j(),p=k*this.b*this.b-m*m;if(0>p)return null;p=Math.sqrt(p);e=-(h*m+p)/k;f=(h*-m+p)/k;var q=(m-h*p)/k;k=(m+h*p)/k;m=c.j()<d.j()?c.j():
  d.j();p=c.j()>d.j()?c.j():d.j();h=c.l()<d.l()?c.l():d.l();c=c.l()>d.l()?c.l():d.l();m<=e&&e<=p&&h<=q&&q<=c&&(b=new I(e,q));m<=f&&f<=p&&h<=k&&k<=c&&(a=new I(f,k))}d=c=null;null!=b&&Fe(this,b)&&(c=Ge(this,b));null!=a&&Fe(this,a)&&(d=Ge(this,a));return null==c&&null==d?null:null!=c&&null!=d?[c,d]:null!=c?[c]:[d]};function He(a,b,c){a=Db(a);a<b&&(a+=2*Math.PI);return b<=a&&a<=c}function Fe(a,b){return a.O?!0:He(b,a.h,a.m)}function Ie(a,b){if(a.O)return!0;b=re(a,a.a.Ea(b));return He(b,a.h,a.m)}
  g.Ye=function(a){return Ab(this.i,a)+this.b};
  g.oe=function(a,b,c){if(b instanceof Ae){if(this.g){var d=this.a.G(this.i),e=b.a.Ea(d);d=be(b,e,-this.b);var f=b.a.G(d),h=b.Tb(d);if(0<h)h>b.a.Ca()||b.Td(d)==G||!Ie(this,f)||(d=De(b,e),f=b.a.G(d),ue(!0,a,b,this,h,f,d,c));else{e=this.a.Ub();var k=b.a.Ub();if(null==e||null==k){if(null!=k||null!=e)throw Error("problem with old copy in CircleStraight");}else{var m=Nd(e,this.i);m=Od(k,m);m=be(b,m,-this.b);m=Nd(k,m);m=Od(e,m);var p=Db(re(this,m)),q=p+(p<this.h?2*Math.PI:0);this.h<=q&&q<=this.m||(m=(p<this.h?
  this.h-p:this.h-(p-2*Math.PI))<(p>this.m?p-this.m:2*Math.PI+p-this.m)?this.h:this.m,m=Ge(this,new I(this.b*Math.cos(m),this.b*Math.sin(m))));m=Nd(e,m);m=Od(k,m);0>b.Tb(m)||Ie(this,f)&&null!=b.ge(d,m)&&ue(!1,a,b,this,h,f,d,c)}}}}else if(b instanceof Ee){if(b.g||this.g)if(b.g&&this.g)d=b.a.G(b.i),Ie(this,d)&&(d=this.a.G(this.i),d=b.a.Ea(d),d=re(b,d),Fe(b,d)&&(e=d.length(),h=e-(this.b+b.b),h>b.a.Ca()||(0<h?te(!0,a,b,this,h,e,d,c):h<-(this.w>b.w?this.w:b.w)||te(!1,a,b,this,h,e,d,c))));else if(d=b.g?b:
  this,f=b.g?this:b,!(d.b>f.b)){h=f.a.G(f.i);h=re(d,d.a.Ea(h));if(null==h)h=!1;else{for(h=Db(h);h<d.h+Math.PI;)h+=2*Math.PI;h=d.h+Math.PI<=h&&h<=d.m+Math.PI}h&&(h=d.a.G(d.i),h=f.a.Ea(h),k=re(f,h),Fe(f,k)&&(e=k.length(),h=f.b-d.b-e,h>b.a.Ca()||(0<h?te(!0,a,f,d,h,e,k,c):h<-d.w||te(!1,a,f,d,h,e,k,c))))}}else throw Error();};function Je(a,b){n(a)&&""!=a?b=b?b:a:(b=Ke++,a=Le.De+b,b=Me.De+b);vc.call(this,a,b);this.m=[];this.c=[];this.B=!1;this.b=null;this.Z=[];this.C=null;this.ob=1;this.H=[];this.F=null;this.V=rb;this.O=this.va=null;this.Ga=this.Qc=this.Pc=this.Ha=rb;this.ia=-1;this.J=null;this.Pd=new Md;this.ha=.01;this.Ab=.5;this.Ia=.6}l(Je,vc);g=Je.prototype;g.toString=function(){return""};function Ne(a,b,c){b=new Ee(a,Oe(a),new ve(b,!0),c,!1,!0);Pe(a,b)}
  function Pe(a,b){if(a.B)throw Error("cannot add edges to finished Polygon");if(null==a.b)throw Error("Polygon does not have an open path to add edges to");if(b.c!=Oe(a))throw Error("edge is not connected to open path");a.c.push(b);Na(a.m,b.Ue());b.c==a.b?Qe(a):a.m.push(b.c)}g.Ba=function(a){a=this.H=La(this.H,a);for(var b={},c=0,d=0;d<a.length;){var e=a[d++];var f=e;f=qa(f)?"o"+(f[ra]||(f[ra]=++sa)):(typeof f).charAt(0)+f;Object.prototype.hasOwnProperty.call(b,f)||(b[f]=!0,a[c++]=e)}a.length=c};
  function T(a,b,c){b=new Ae(a,Oe(a),new ve(b,!0),c);Pe(a,b);return b}function Re(a){var b=G,c=sb,d=G,e=sb;A(a.c,function(a){a.de()<b&&(b=a.de());a.ee()>c&&(c=a.ee());a.ce()<d&&(d=a.ce());a.fe()>e&&(e=a.fe())});a.Ha=b;a.Pc=c;a.Ga=d;a.Qc=e}function Se(a,b,c,d){ie(b,a,c,d);ie(b,c,a,d);A(a.c,function(a){ke(c,a)||A(Ma(c.c),function(c){ke(this,c)||a.be(c,this.ha)&&a.oe(b,c,d)},this)},a)}
  function Te(a){if(!a.B)throw Error("Polygon construction is not finished.");A(a.Z,function(a){var b=a;do{b=fe(b);if(null==b)throw Error();b=b.c}while(b!=a)})}function Qe(a){if(a.B)throw Error("Polygon construction is finished.");if(null!=a.b){var b=Ue(a);if(null!=b){if(b.c!=a.b){var c=a.b;b=b.c;if(1E-8<Ab(c.a,b.a))throw Error("");var d=ee(b);if(null==d)throw Error("v2.edge1 is null; v2="+b+"; this="+a);ye(c,d);d.c=c;Ha(a.m,b)}a.Z.push(a.b);a.b=null}}}
  g.Sd=function(a){a.beginPath();A(this.Z,function(b){a.moveTo(S(b),xe(b));var c=b;do{var d=fe(c);if(null==d)throw Error();c=d.c;d.af(a)}while(c!=b);a.closePath()})};g.Ud=function(a){return B(this.H,a)};g.fc=function(){this.J=null};function Ve(a){var b=Array(2),c=.1*Math.max(a.P(),a.S()),d=Array(3);d[0]=new nd(a.a.j()+c,a.a.l());d[1]=new nd(a.a.j(),a.a.l()+c);d[2]=new nd(a.a.j()-c,a.a.l()-c);c=ud(d,function(b){return We(a,yb(b))},b);if(0!=b[1])throw Error("");return c}
  function Xe(a){if(a.B)throw Error("Polygon construction is finished.");null!=a.b&&Qe(a);a.B=!0;Te(a);Re(a);a.pa(a.wa()+a.P()/2,a.Da()+a.S()/2);a.P()<=a.S()?a.xb([new I(a.wa()+.5*a.P(),a.Da()+.8*a.S()),new I(a.wa()+.5*a.P(),a.Da()+.2*a.S())]):a.xb([new I(a.wa()+.8*a.P(),a.Da()+.5*a.S()),new I(a.wa()+.2*a.P(),a.Da()+.5*a.S())]);var b=a.P(),c=a.S();a.xa((b*b+c*c)/12);a.O=null;a.Zb()}g.Vd=function(){return this.Ia};g.Da=function(){return this.Ga};
  g.Zb=function(){null==this.F&&(this.F=Ve(this),Ye(this,this.F));return this.F};g.tb=function(){return this.V};g.Ca=function(){return this.ha};g.ad=function(){return this.ob};g.wa=function(){return this.Ha};g.Hb=function(){if(isNaN(this.g)){var a=G;A(this.c,function(b){b=b.Td(this.a);b!=G&&(0<b?a=0:(b=-b,b<a&&(a=b)))},this);a==G&&(a=Ze(this));this.g=a}return this.g};
  function Ze(a){if(isNaN(a.g)){for(var b=G,c,d=0;3>=d;d++){switch(d){case 0:c=a.a.l()-a.Da();break;case 1:c=a.ub()-a.a.j();break;case 2:c=a.gb()-a.a.l();break;case 3:c=a.a.j()-a.wa();break;default:c=G}c<b&&(b=c)}a.g=b}return a.g}g.Ub=function(){return this.J};g.ub=function(){return this.Pc};function je(a){var b=a.va;if(null==b)return null;var c=a.O;null==c&&(c=a.na(b.rb(K)),a.O=c);return c}g.gb=function(){return this.Qc};
  function $e(a,b,c){a=a.getName(c)+" ";switch(b){case 0:a+="X "+(c?Me.Ec:Le.Ec);break;case 1:a+="X "+(c?Me.Rb:Le.Rb);break;case 2:a+="Y "+(c?Me.Ec:Le.Ec);break;case 3:a+="Y "+(c?Me.Rb:Le.Rb);break;case 4:a+=c?Me.qe:Le.qe;break;case 5:a+=c?Me.re:Le.re;break;default:throw Error();}return a}g.la=function(){return this.ia};g.he=function(){return this.Ab};g.Xb=function(){return Ba(this.m,function(a){return a.a})};
  function Ue(a){if(null==a.b)throw Error();var b=a.b.b;if(null==b)return null;for(;;){var c=b.c,d=c.b;if(null==d)break;b=d;if(c==a.b)throw Error();}return b}function Oe(a){if(null==a.b)throw Error("Polygon does not have an open path to add edges to");var b=Ue(a);return null==b?a.b:b.c}function We(a,b){var c=0;A(a.m,function(a){a=Ab(b,a.a);a>c&&(c=a)});var d=0;A(a.c,function(a){a=a.Pe();a>d&&(d=a)});c+=d;return c*c}
  function ke(a,b){null==b?b=!0:null!=a.C?(a=a.C,b.a!=a.c?b=!1:(b=ae(b),b=b>=a.a&&b<=a.b)):b=!1;return b}g.kf=function(a){Ja(this.H,function(b){return B(a,b)})};g.fd=function(){null==this.J&&(this.J=this.Pd);this.J.set(this.a,this.f,this.i,this.h)};g.me=function(a){if(0>=a||1<a)throw Error("accuracy must be between 0 and 1, is "+a);this.Ia=a};function Ye(a,b){if(null!=a.b)throw Error("setCentroid called before finish, while creating Polygon");a.F=b;a.V=Math.sqrt(We(a,b))}g.ie=function(a){this.ha=a};
  g.Y=function(a){this.ob=a};g.L=function(a){if(0>=a||!t(a))throw Error("mass must be positive "+a);this.w=a;return this};g.u=function(a,b){this.f=yb(a);n(b)&&isFinite(b)&&this.o!=b&&(this.o=b,this.i=Math.sin(b),this.h=Math.cos(b),this.O=null);a=0;for(b=this.c.length;a<b;a++)this.c[a].B=null};function af(a,b,c){if(4!=a.c.length)throw Error("");if(0>b||3<b)throw Error();a.va=a.c[b];a.V=c;A(a.c,function(a){a!=this.va&&(a.o=0)},a)}g.je=function(a){this.Ab=a};
  function bf(a,b){if(a.B)throw Error("Polygon construction is finished.");if(null!=a.b)throw Error("there is already an open path");b instanceof ve?(a.b=b,a.m.push(a.b)):(a.b=b.f,a.m.push(a.b),a.c.push(b))}var Le={De:"polygon",qe:"angle",re:"angular velocity",Ec:"position",Rb:"velocity"},Me=Le,Ke=1;function cf(a){this.a=a=Math.floor(Math.abs(a))%4294967296;df(this.a)}cf.prototype.toString=function(){return""};function df(a){if(0>a)throw Error("random seed must be 0 or greater "+a);if(4294967296<=a)throw Error("random seed must be less than 4294967296 was "+a);if(a!=Math.floor(a))throw Error("random seed must be an integer "+a);}function ef(a){var b=1664525*a.a+1013904223;a.a=b-4294967296*Math.floor(b/4294967296);df(a.a);return a.a}
  function Gd(a,b){for(var c=Array(b),d=Array(b),e=0;e<b;e++)c[e]=-1,d[e]=e;e=b;var f=0;do{var h=e--;if(0>=h)throw Error("n must be positive");var k=ef(a)/4294967296;h=Math.floor(k*h);for(var m=k=0;m<b;m++)if(!(0>d[m])&&k++==h){c[f++]=d[m];d[m]=-1;break}}while(0>c[b-1]);return c};function ff(a,b,c){var d=gf++;P.call(this,"DAMPING_LAW"+(0<d?"_"+d:""));this.a=a;this.f=b||1;this.b=[];this.c=null;null!=c&&hf(this,c);this.I($b(new O(this,jf.Ob,kf.Ob,v(this.Vg,this),v(this.Wg,this)),3));this.I($b(new O(this,jf.Gd,kf.Gd,v(this.wg,this),v(this.Gh,this)),3))}l(ff,P);g=ff.prototype;g.toString=function(){return""};g.cf=function(a){if(a.nc()&&!B(this.b,a)){var b=a.M();0<b&&isFinite(b)&&this.b.push(a)}};
  g.Db=function(){var a=[];if(0==this.a)return a;A(this.b,function(b){isFinite(b.M())&&(b=new Cc("damping",b,b.ba(),1,Gb(b.hb(),-this.a),1,-this.a*this.f*b.gc()),a.push(b))},this);return a};function hf(a,b){var c=Ma(b.a);A(c,v(a.cf,a));ec(b,a);a.c=b}g.Kb=function(){null!=this.c&&kc(this.c,this)};g.Vg=function(){return this.a};g.Ib=function(){return 0};g.wg=function(){return this.f};g.ga=function(a){a.R("OBJECT_ADDED")?(a=a.N(),this.cf(a)):a.R("OBJECT_REMOVED")&&(a=a.N(),Ha(this.b,a))};
  g.Wg=function(a){this.a=a;Q(this,jf.Ob)};g.Gh=function(a){this.f=a;Q(this,jf.Gd)};var gf=0,jf={Ob:"damping",Gd:"rotate ratio"},kf=jf;function lf(a,b,c){this.b=a||0;this.c=b||0;this.a=void 0===c?rb:c}lf.prototype.toString=function(){return""};function mf(a){var b=a.b+a.c;isNaN(a.a)||(b+=a.a);return b};var nf={Fc:"potential energy",Ke:"translational energy",Cc:"kinetic energy",Ee:"rotational energy",Ie:"total",Je:"total energy"};function U(a,b){var c=of++;P.call(this,"GRAVITY_LAW"+(0<c?"_"+c:""));this.b=a;this.f=0;this.a=[];this.c=null;null!=b&&pf(this,b);this.I($b(new O(this,qf.Za,rf.Za,v(this.Zg,this),v(this.ah,this)),4));this.I(Zb(new O(this,qf.Rd,rf.Rd,v(this.$g,this),v(this.T,this)),sb))}l(U,P);g=U.prototype;g.toString=function(){return""};function sf(a,b){A(b,v(a.ef,a))}g.ef=function(a){if(a.nc()&&!B(this.a,a)){var b=a.M();0<b&&isFinite(b)&&this.a.push(a)}};
  g.Db=function(){var a=[];A(this.a,v(function(b){isFinite(b.M())&&a.push(new Cc("gravity",b,b.ba(),1,new I(0,-this.b*b.M(),0),1))},this));return a};function pf(a,b){sf(a,Ma(b.a));ec(b,a);a.c=b}g.Kb=function(){null!=this.c&&(kc(this.c,this),this.c=null)};g.Zg=function(){return this.b};g.Ib=function(){var a=0;A(this.a,function(b){if(isFinite(b.M())){var c=b.bf();c=null!=c?c:this.f;a+=(b.ba().l()-c)*b.M()*this.b}},this);return a};g.$g=function(){return this.f};
  g.ga=function(a){var b=a.N();a.R("OBJECT_ADDED")?this.ef(b):a.R("OBJECT_REMOVED")&&Ha(this.a,b)};g.ah=function(a){this.b=a;Q(this,qf.Za)};g.T=function(a){this.f=a;Q(this,qf.Rd)};var of=0,qf={Za:"gravity",Rd:"zero energy level"},rf=qf;function tf(){}g=tf.prototype;g.toString=function(){return""};g.Ba=function(){};g.qb=function(){throw Error();};g.G=function(a){return yb(a)};g.Oe=function(){return uc};g.Sd=function(a){a.beginPath();a.closePath()};g.Ud=function(){return!0};g.fc=function(){};g.Vd=function(){return 0};g.ke=function(){return 0};g.gc=function(){return 0};g.Da=function(){return sb};g.Re=function(){return sb};g.Qa=function(){return wc(this)};g.Te=function(){return K};g.Zb=function(){return K};g.tb=function(){return G};
  g.$b=function(){return K};g.Ca=function(){return 0};g.Gb=function(){return[]};g.ad=function(){return 1};g.Wd=function(){return G};g.S=function(){return G};g.wa=function(){return sb};g.Xd=function(){return sb};g.M=function(){return G};g.getName=function(){return"SCRIM"};g.Hb=function(){return G};g.Ub=function(){return null};g.ba=function(){return K};g.ub=function(){return G};g.Yd=function(){return G};g.gb=function(){return G};g.jc=function(){return G};g.la=function(){return-1};g.hb=function(){return K};
  g.he=function(){return 0};g.Xb=function(){return[]};g.P=function(){return G};g.bf=function(){return null};g.nc=function(){return!0};g.kb=function(){return G};g.R=function(a){return this.getName()==E(a)};g.kf=function(){};g.na=function(a){return yb(a)};g.lf=function(a){return yb(a)};g.mf=function(){return 0};g.fd=function(){};g.me=function(){};g.Ua=function(){};g.nf=function(){};g.pa=function(){};g.ie=function(){};g.xb=function(){};g.Y=function(){};g.L=function(){throw Error();};g.xa=function(){};
  g.u=function(a,b){if(0!=a.j()||0!=a.l())throw Error();if(n(b)&&0!=b)throw Error();};g.K=function(a,b){if(0!=a.j()||0!=a.l())throw Error();if(n(b)&&0!=b)throw Error();};g.je=function(){};g.T=function(){return this};g.ac=function(){return!1};g.tf=function(){return 0};g.Ea=function(a){return yb(a)};var uf=new tf;function vf(a){P.call(this,a||"SIM");this.b=[];this.U=!1;this.h=[];this.a=new Ec;this.c=new Ic([Pc.He,nf.Cc,nf.Fc,nf.Je],[Pc.He,nf.Cc,nf.Fc,nf.Je],this.getName()+"_VARS");this.v().bh(1,2,3);this.D=this.w=null;this.I(new Vb(this,wf.Kc,xf.Kc,v(this.zg,this),v(this.da,this)))}l(vf,P);g=vf.prototype;g.toString=function(){return""};g.v=function(){return this.c};g.ma=function(){var a=this.c;if(0>a.b)throw Error("no time variable");return a.N(a.b)};g.zg=function(){return this.U};
  g.da=function(a){this.U=a;Q(this,wf.Kc)};g.reset=function(){null!=this.w&&this.w.length==this.c.a.length&&Oc(this.c,this.w);A(this.b,function(a){a.fc()});Gc(this.a,G);this.ca();Xb(this,new N(this,"RESET"))};function yf(a){a.w=Lc(a.c);Xb(a,new N(a,"INITIAL_STATE_SAVED"))}
  g.Eb=function(){for(var a=this.a,b=Ma(a.a),c=0,d=b.length;c<d;c++)a.remove(b[c]);zf(this);b=this.c.a.length;if(4<b&&(a=this.c,b-=4,0!=b)){if(0>b||4+b>a.a.length)throw Error("deleteVariables");for(c=4;c<4+b;c++)a.a[c]=new Hc(a,"DELETED","DELETED");Xb(a,new N(a,"VARS_MODIFIED"))}a=0;for(b=this.b.length;a<b;a++)this.b[a].ia=-1;this.b=[]};function fd(a){a.D=Lc(a.c);A(a.b,function(a){a.fd()})}function hd(a){null!=a.D&&Oc(a.c,a.D,!0);A(a.b,function(a){a.fc()})}
  g.s=function(a){if(!(a instanceof tf)){if(!B(this.b,a)){for(var b=[],c=0;6>c;c++)b.push($e(a,c,!1));var d=[];for(c=0;6>c;c++)d.push($e(a,c,!0));b=Jc(this.c,b,d);a.ia=b;this.b.push(a);this.a.add(a)}Af(this,a);A(this.b,function(a){a.fc()})}};function Bf(a){return Ma(a.b)}function Cf(a,b){var c=null;if(ja(b)){var d=E(b);c=Ea(a.b,function(a){return a.getName()==d})}else b<a.b.length&&0<=b&&(c=a.b[b]);if(null==c)throw Error("no body "+b);return c}
  function Af(a,b){b.fc();var c=b.la();if(0>c)throw Error("unknown body "+b);var d=a.c;R(d,c,b.ba().j());R(d,2+c,b.ba().l());R(d,4+c,b.ke());R(d,1+c,b.hb().j());R(d,3+c,b.hb().l());R(d,5+c,b.gc());a.v().Lb(1,2,3)}g.ca=function(){var a=this.c,b=Lc(a);Df(this,b);b=Ef(this);R(a,1,b.c+b.a,!0);R(a,2,b.b,!0);R(a,3,mf(b),!0)};
  function V(a,b){var c=Ea(a.h,function(a){return b instanceof ff?a instanceof ff:b instanceof U?a instanceof U:!1});if(null!=c)throw Error("cannot add DampingLaw or GravityLaw twice "+c);B(a.h,b)||a.h.push(b);a.v().Lb(1,2,3)}g.jf=function(a){a.Kb();this.v().Lb(1,2,3);return Ha(this.h,a)};function zf(a){za(a.h,a.jf,a);a.v().Lb(1,2,3)}function Ff(a){var b=Lc(a.v());Df(a,b);return Ef(a)}
  function Ef(a){var b=0,c=0,d=0;A(a.b,function(a){isFinite(a.M())&&(c+=a.mf(),d+=a.tf())});A(a.h,function(a){b+=a.Ib()});return new lf(b,d,c)}function Df(a,b){A(a.b,function(a){var c=a.la();0>c||(a.u(new I(b[c],b[c+2]),b[c+4]),a.K(new I(b[c+1],b[c+3]),b[c+5]))},a)}
  g.fb=function(a,b){Df(this,a);A(this.b,function(c){var d=c.la();if(!(0>d))if(c.M()==G)for(c=0;6>c;c++)b[d+c]=0;else b[d]=a[d+1],b[d+2]=a[d+3],b[d+4]=a[d+5],b[d+1]=0,b[d+3]=0,b[d+5]=0},this);A(this.h,function(a){a=a.Db();A(a,function(a){Gf(this,b,a)},this)},this);b[this.c.b]=1;return null};
  function Gf(a,b,c){var d=c.a;if(B(a.b,d)){var e=d.la();if(!(0>e)){var f=c.Sa(),h=c.W(),k=d.M();b[e+1]+=f.j()/k;b[e+3]+=f.l()/k;b[e+5]+=((h.j()-d.ba().j())*f.l()-(h.l()-d.ba().l())*f.j())/d.kb();f=c.m;0!=f&&(b[e+5]+=f/d.kb());a.U&&(b=a.ma(),c.U=b,a.a.add(c))}}}function W(a,b){if(0==a.b.length)throw Error("setElasticity: no bodies");A(a.b,function(a){a.Y(b)});Xb(a,new N(a,"ELASTICITY_SET",b))}
  var wf={nd:"collision method",md:"collision accuracy",pd:"distance tolerance",sd:"extra accel",Gc:"random seed",Kc:"show forces",pi:"show collisions",Nd:"velocity tolerance"},xf=wf;function Hf(a){vf.call(this,a);this.Z=!0;this.m="serial grouped lastpass";this.i=new cf(0);this.C=new Ed(this.i);this.f=.01;this.H=.5;this.A=.6;this.I(new bc(this,wf.nd,xf.nd,v(this.gg,this),v(function(a){If(this,ld(a))},this),kd(),kd()));this.I($b(new O(this,wf.pd,xf.pd,v(this.Qg,this),v(this.ta,this)),5));this.I($b(new O(this,wf.Nd,xf.Nd,v(this.Rg,this),v(this.Na,this)),3));this.I(ac($b(new O(this,wf.md,xf.md,v(this.fg,this),v(this.$,this)),3),1));this.I(Zb(Yb(new O(this,wf.Gc,xf.Gc,v(this.ug,this),
  v(this.ua,this))),sb))}l(Hf,vf);g=Hf.prototype;g.ug=function(){return this.i.a};g.ua=function(a){var b=this.i;df(a);b.a=a;Q(this,wf.Gc)};g.gg=function(){return this.m};function If(a,b){b=ld(b);a.m!=b&&(a.m=b,Q(a,wf.nd))}g.fg=function(){return this.A};g.$=function(a){if(0>=a||1<a)throw Error("accuracy must be between 0 and 1, is "+a);this.A=a;A(this.b,function(b){b.me(a)});Q(this,wf.md)};g.Qg=function(){return this.f};g.ta=function(a){this.f=a;A(this.b,function(b){b.ie(a)});Q(this,wf.pd)};g.Rg=function(){return this.H};
  g.Na=function(a){this.H=a;A(this.b,function(b){b.je(a)});Q(this,wf.Nd)};g.da=function(a){vf.prototype.da.call(this,a);this.Z=a};g.s=function(a){vf.prototype.s.call(this,a);a.ie(this.f);a.je(this.H);a.me(this.A)};g.Eb=function(){vf.prototype.Eb.call(this);this.C=new Ed(this.i)};
  g.qa=function(a,b,c){b=b[this.c.b];var d;var e=0;for(d=this.b.length;e<d;e++){var f=this.b[e];var h=e+1;a:for(;h<d;h++){var k=this.b[h];if(f.Ud(k)||k.Ud(f))continue a;if(f.M()==G&&k.M()==G)continue a;var m=2*(f.Hb()+k.Hb())/c;if(!(m=Fb(f.hb())+Fb(k.hb())>m)){var p=f,q=k,r=this.f;null!=je(p)?m=me(p,q,r):null!=je(q)?m=me(q,p,r):(m=Eb(J(q.$b(),p.$b())),p=q.tb()+p.tb()+r,m=m<p*p)}if(!m)continue a;Se(f,a,k,b)}}};
  function Jf(a,b,c){if(!isFinite(c.M()))return 0;if(a.c==c){var d=Qd(a);var e=d.j();var f=d.l()}else if(a.b==c)d=Rd(a),e=d.j(),f=d.l();else return 0;if(b.c==c){d=Qd(b);var h=d.j();d=d.l();var k=1}else if(b.b==c)d=Rd(b),h=d.j(),d=d.l(),k=-1;else return 0;return k*(a.a.j()*(b.a.j()/c.M()-f*(h*b.a.l()-d*b.a.j())/c.kb())+a.a.l()*(b.a.l()/c.M()+e*(h*b.a.l()-d*b.a.j())/c.kb()))}
  function Kf(a){for(var b=a.length,c=Array(b),d=0;d<b;d++)c[d]=new Float64Array(b);for(var e=0;e<b;e++){var f=a[e];for(d=0;d<b;d++){var h=a[d];c[e][d]+=Jf(f,h,f.c);c[e][d]-=Jf(f,h,f.b)}}return c}
  function id(a,b){if(0==b.length)throw Error("empty array passed to handleCollisions");switch(a.m){case "simultaneous":for(var c=b.length,d=D(c),e=D(c),f=D(c),h=Ya(c),k=!1,m=0;m<c;m++){var p=b[m];d[m]=Uc(p);f[m]=Tc(p)?1:1+p.va;d[m]*=Tc(p)?1:1+p.va;h[m]=p.i;k=k||!p.i}f=Kf(b);Fd(a.C,f,e,d,h,a.ma());d=!1;for(h=0;h<c;h++)f=b[h],1E-12<e[h]&&(d=!0),Lf(a,f,e[h]);k&&d&&a.v().Lb(1,3);a.ca();a=d;break;case "hybrid":a=Mf(a,b,!0);break;case "serial separate":a=Mf(a,b,!1,!1,!1);break;case "serial grouped":a=Mf(a,
  b,!1,!0,!1);break;case "serial separate lastpass":a=Mf(a,b,!1,!1,!0);break;case "serial grouped lastpass":a=Mf(a,b,!1,!0,!0);break;default:throw Error("");}return a}
  function Mf(a,b,c,d,e){d=n(d)?d:!0;e=n(e)?e:!0;var f=f||1E-5;var h=n(h)?h:!0;var k=b.length,m,p=0,q=20*k,r=q,u=D(k),x=D(k),C=D(k);var y=D(k);var w=Ya(k),H=!1;for(m=0;m<k;m++){var L=b[m];w[m]=L.i;u[m]=d?w[m]?0:L.va:L.va;x[m]=Uc(L);y[m]=x[m];H=H||!L.i}m=Kf(b);do{p++;h&&p>r&&(f*=2,r+=q);var ca=f,Sa=w,pa=x,cc=pa.length,tb=-1,dc=Gd(a.i,cc);for(y=0;y<cc;y++)if(L=dc[y],!Sa[L]&&pa[L]<-ca||Sa[L]&&Math.abs(pa[L])>ca){tb=L;break}y=tb;if(-1==y&&!e)break;Nf(a,c,d,f,y,w,u,x,C,b,m)}while(-1<y);d=!1;for(m=0;m<k;m++)c=
  b[m],1E-12<C[m]&&(d=!0),Lf(a,c,C[m]);H&&d&&a.v().Lb(1,3);a.ca();return d}
  function Nf(a,b,c,d,e,f,h,k,m,p,q){var r,u=k.length,x=Ya(u);if(-1==e)for(b=0;b<u;b++)x[b]=!0;else if(b||c)for(c=pe(p,p[e],b,k,-d),d=c.length,b=0;b<d;b++){var C=c[b],y=Fa(p,function(a){return a==C});x[y]=!0}else for(b=0;b<u;b++)x[b]=b==e;p=0;c=D(u);for(b=0;b<u;b++)c[b]=x[b]?p:-1,p+=x[b]?1:0;d=D(p);for(b=0;b<u;b++)x[b]&&(d[c[b]]=b);y=null;var w=D(p);var H=Array(p);for(b=0;b<p;b++)H[b]=new Float64Array(p);y=D(p);var L=Ya(p);for(b=0;b<u;b++)if(x[b])for(y[c[b]]=k[b],L[c[b]]=f[b],r=0;r<u;r++)x[r]&&(H[c[b]][c[r]]=
  q[b][r]);for(b=0;b<p;b++)-1!=e&&(y[b]*=1+h[d[b]]),w[b]=0;if(-1!=Fd(a.C,H,w,y,L,a.ma())&&(a=zd(H,w),a=Dd(a,y),!Jd(w,a,L)))throw Error("");for(b=0;b<p;b++)m[d[b]]+=w[b];for(b=0;b<u;b++)for(r=0;r<u;r++)x[r]&&(k[b]+=q[b][r]*w[c[r]])}function Lf(a,b,c){if(!b.i&&0>c){if(-1E-12>c)throw Error("");c=0}b.Ab=c;0!=c&&(Of(a,new Xd("IMPULSE1",b.c,c,b.g,b.a,Qd(b))),Of(a,new Xd("IMPULSE2",b.b,-c,null!=b.o?b.o:b.g,b.a,Rd(b))))}
  function Of(a,b){var c=b.g,d=c.M();if(isFinite(d)){var e=b.b,f=1E-4>Math.abs(e),h=a.v(),k=c.kb();c=c.la();var m=b.Sa(),p=b.f;if(-1<c){var q=1+c;R(h,q,h.N(q)+m.j()*e/d,f);q=3+c;R(h,q,h.N(q)+m.l()*e/d,f);q=5+c;R(h,q,h.N(q)+e*(p.j()*m.l()-p.l()*m.j())/k,f)}}a.Z&&(d=a.ma()+.1,b.U=d,a.a.add(b))};function Pf(a){Hf.call(this,a);this.g=[];this.V=0;this.B=new Ed(this.i);this.F=.025;D(4);this.o="velocity_and_distance_joints";this.I(new bc(this,wf.sd,xf.sd,v(this.kg,this),v(function(a){X(this,Vd(a))},this),[Wd.NONE,Wd.Rb,Wd.Tf,Wd.Vf,Wd.Uf],Ud()))}l(Pf,Hf);g=Pf.prototype;g.kg=function(){return this.o};function X(a,b){b=Vd(b);a.o!=b&&(a.o=b,Q(a,wf.sd))}g.Eb=function(){Hf.prototype.Eb.call(this);this.g=[];this.B=new Ed(this.i)};
  g.reset=function(){var a=lc(this,!1);Hf.prototype.reset.call(this);lc(this,a);Qf(this);Xb(this,new N(this,"RESET"))};function Rf(a,b){if(!B(a.g,b)){var c=b.Zc();if(!(B(a.b,c)||c instanceof tf))throw Error("body not found "+c);c=b.$c();if(!(B(a.b,c)||c instanceof tf))throw Error("body not found "+c);a.g.push(b);a.a.add(b)}}function Qf(a){for(var b=0,c=a.g.length;b<c;b++)a.g[b].oc();b=0;for(c=a.b.length;b<c;b++)Af(a,a.b[b])}
  g.fb=function(a,b,c){var d=0;Hf.prototype.fb.call(this,a,b,c);var e=[];this.qa(e,a,c);if(0<Da(e,function(a){return a.i?!1:0>a.f}))return e;for(Sf(this,e);0<e.length&&(c=Tf?oe(e):e,c.length>d&&(d=c.length),Uf(this,a,b,c),c.length!=e.length);)for(var f=0,h=c.length;f<h;f++)Ha(e,c[f]);this.V=d;return null};
  function Uf(a,b,c,d){var e=Vf(d),f=Wf(a,d,c,b),h=Ba(d,function(a){return a.i}),k=D(f.length);b=Fd(a.B,e,k,f,h,b[a.c.b]);-1===b&&Id(a.B)||Xf(a,b,e,k,f,h);e=0;for(f=d.length;e<f;e++)Yf(a,d[e],k[e],c)}function Sf(a,b){for(var c=b.length-1;0<=c;c--){var d=b[c];if(d.i?0:0>d.f)throw Error("unexpected collision at time="+a.ma()+" "+d);Tc(d)||Ia(b,c)}}g.qa=function(a,b,c){var d;Hf.prototype.qa.call(this,a,b,c);c=0;for(d=this.g.length;c<d;c++)this.g[c].Cb(a,b[this.c.b])};
  function Vf(a){var b=a.length;var c=b||b;for(var d=Array(b),e=0;e<b;e++)d[e]=new Float64Array(c);for(c=0;c<b;c++){e=a[c];var f=e.c.M();var h=e.c.kb();var k=e.b.M();var m=e.b.kb();for(var p=e.kc(),q=e.Wb(),r=p.j(),u=p.l(),x=q.j(),C=q.l(),y=0;y<b;y++){d[c][y]=0;var w=a[y];p=w.kc();q=w.Wb();var H=p.j();p=p.l();var L=q.j();q=q.l();isFinite(f)&&e.c==w.c&&(d[c][y]+=e.a.j()*(w.a.j()/f+(-u*H*w.a.l()+u*p*w.a.j())/h),d[c][y]+=e.a.l()*(w.a.l()/f+(-r*p*w.a.j()+r*H*w.a.l())/h));isFinite(f)&&e.c==w.b&&(d[c][y]-=
  e.a.j()*(w.a.j()/f+(-u*L*w.a.l()+u*q*w.a.j())/h),d[c][y]-=e.a.l()*(w.a.l()/f+(-r*q*w.a.j()+r*L*w.a.l())/h));isFinite(k)&&e.b==w.c&&(d[c][y]-=e.a.j()*(w.a.j()/k+(-C*H*w.a.l()+C*p*w.a.j())/m),d[c][y]-=e.a.l()*(w.a.l()/k+(-x*p*w.a.j()+x*H*w.a.l())/m));isFinite(k)&&e.b==w.b&&(d[c][y]+=e.a.j()*(w.a.j()/k+(-C*L*w.a.l()+C*q*w.a.j())/m),d[c][y]+=e.a.l()*(w.a.l()/k+(-x*q*w.a.j()+x*L*w.a.l())/m))}}return d}
  function Wf(a,b,c,d){for(var e=b.length,f=Array(e),h=0;h<e;h++){var k=b[h];f[h]=0;var m=k.c.M()==G,p=k.b.M()==G,q=m?-1:k.c.la(),r=p?-1:k.b.la(),u=0;switch(a.o){case "none":u=0;break;case "velocity":if(k.i)break;case "velocity_joints":u=Uc(k)/a.F;break;case "velocity_and_distance":if(k.i)break;case "velocity_and_distance_joints":u=Uc(k);var x=a.F;u=(2*u*x+(k.f-k.J))/(x*x)}f[h]+=u;u=m?0:d[1+q];x=m?0:d[3+q];var C=m?0:d[5+q],y=p?0:d[1+r],w=p?0:d[3+r],H=p?0:d[5+r],L=k.kc(),ca=k.Wb(),Sa=L.j();L=L.l();var pa=
  rb,cc=rb;p||(pa=ca.j(),cc=ca.l());if(!k.Ga){if(k.m){var tb=k.Ia;if(null!=tb)ca=tb.j(),tb=tb.l();else{var dc=k.B?k.w+k.h:k.h;ca=(u-C*L)/dc;tb=(x+C*Sa)/dc;p||(ca-=(y-H*cc)/dc,tb-=(w+H*pa)/dc)}}else ca=-H*k.a.l(),tb=H*k.a.j(),k.B&&(p||(f[h]+=-k.w*H*H));dc=m?0:u-C*L;var Dj=m?0:x+C*Sa,Ej=p?0:y-H*cc,Fj=p?0:w+H*pa;f[h]=k.m?f[h]+(ca*(dc-Ej)+tb*(Dj-Fj)):f[h]+2*(ca*(dc-Ej)+tb*(Dj-Fj))}m||(f[h]+=k.a.j()*(c[q+1]-c[q+5]*L-C*C*Sa),f[h]+=k.a.l()*(c[q+3]+c[q+5]*Sa-C*C*L));p||(f[h]-=k.a.j()*(c[r+1]-c[r+5]*cc-H*H*
  pa),f[h]-=k.a.l()*(c[r+3]+c[r+5]*pa-H*H*cc));if(!isFinite(f[h]))throw console.log("c= "+k),eb("nums ",Sa,L,pa,cc,C,H,u,x,y,w),Error();}return f}function Yf(a,b,c,d){b.Bb=c;if(0!=c){var e=1;if(isFinite(b.c.M())){var f=new Cc("contact_force"+e+"_"+b.c.getName(),b.c,b.g,1,Gb(b.a,c),1);f.b=b.f;f.c=b.c.Ca();e++;Gf(a,d,f)}isFinite(b.b.M())&&(c=new Cc("contact_force"+e+"_"+b.b.getName(),b.b,null==b.o?b.g:b.o,1,Gb(b.a,-c),1),c.b=b.f,c.c=b.b.Ca(),Gf(a,d,c))}}
  function Xf(a,b,c,d,e,f){c=zd(c,d);c=Dd(c,e);if(!Jd(d,c,f))throw d=Error,a=a.ma(),d((null!=a?a.toFixed(7):null===a?"null":"undefined")+" compute_forces failed error="+b+" with tol="+cb(1E-4));}var Tf=!0;var Zf={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",
  darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",
  ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",
  lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",
  moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",
  seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function $f(a){var b={};a=String(a);var c="#"==a.charAt(0)?a:"#"+a;if(ag.test(c))return b.Zd=bg(c),b.type="hex",b;a:{var d=a.match(cg);if(d){c=Number(d[1]);var e=Number(d[2]);d=Number(d[3]);if(0<=c&&255>=c&&0<=e&&255>=e&&0<=d&&255>=d){c=[c,e,d];break a}}c=[]}if(c.length){e=c[0];a=c[1];c=c[2];e=Number(e);a=Number(a);c=Number(c);if(e!=(e&255)||a!=(a&255)||c!=(c&255))throw Error('"('+e+","+a+","+c+'") is not a valid RGB color');e=dg(e.toString(16));a=dg(a.toString(16));c=dg(c.toString(16));b.Zd="#"+
  e+a+c;b.type="rgb";return b}if(Zf&&(c=Zf[a.toLowerCase()]))return b.Zd=c,b.type="named",b;throw Error(a+" is not a valid color string");}var eg=/#(.)(.)(.)/;function bg(a){if(!ag.test(a))throw Error("'"+a+"' is not a valid hex color");4==a.length&&(a=a.replace(eg,"#$1$1$2$2$3$3"));return a.toLowerCase()}var ag=/^#(?:[0-9a-f]{3}){1,2}$/i,cg=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;function dg(a){return 1==a.length?"0"+a:a};function fg(){return["LEFT","MIDDLE","RIGHT","FULL","VALUE"]}function gg(a){for(var b=fg(),c=0,d=b.length;c<d;c++)if(a===b[c])return b[c];throw Error("invalid HorizAlign value:  "+a);}var hg={Dc:"left",Bd:"middle",Hc:"right",ud:"full",Md:"value"};function ig(a,b){if(!(t(0)&&t(0)&&t(a)&&t(b)))throw Error();if(0>a||0>b)throw Error();this.b=a;this.a=b}g=ig.prototype;g.toString=function(){return""};g.Fb=function(a){return this.b==a.b&&this.a==a.a};g.S=function(){return this.a};g.ra=function(){return 0};g.ka=function(){return 0};g.P=function(){return this.b};g.Va=function(){return 1E-14>this.b||1E-14>this.a};g.Oa=function(a,b){return F(0,0,b)||F(0,0,b)||F(this.b,a.b,b)||F(this.a,a.a,b)?!1:!0};var jg=new ig(0,0);function kg(){return["TOP","MIDDLE","BOTTOM","FULL","VALUE"]}function lg(a){for(var b=kg(),c=0,d=b.length;c<d;c++)if(a===b[c])return b[c];throw Error("invalid VerticalAlign value: "+a);}var mg={Rf:"top",Bd:"middle",wf:"bottom",ud:"full",Md:"value"};function ng(a,b,c,d,e,f){this.f=mb(a);this.c=mb(b);this.h=mb(c);this.g=mb(d);this.a=mb(e);this.b=mb(f);a=uc;a=a.translate(this.f,this.c);a=a.scale(this.a,-this.b);this.i=a=a.translate(-this.h,-this.g)}ng.prototype.toString=function(){return""};
  function og(a,b,c,d,e){c=gg(c||"MIDDLE");d=lg(d||"MIDDLE");e=e||1;if(1E-15>e||!isFinite(e))throw Error("bad aspectRatio "+e);var f=b.ra(),h=b.b,k=b.a-f,m=b.ka()-h;if(1E-15>k||1E-15>m)throw Error("simRect cannot be empty "+b);b=a.ka();var p=a.ra(),q=a.P();a=a.S();var r=0,u=0,x=0,C=0;"FULL"==c&&(x=q/k,r=0);"FULL"==d&&(C=a/m,u=0);if("FULL"!=c||"FULL"!=d)if("FULL"==c?(C=x*e,r=!0):"FULL"==d?(x=C/e,r=!1):(x=q/k,C=x*e,r=!0,u=Math.floor(.5+C*m),a<u&&(C=a/m,x=C/e,r=!1)),r)switch(r=0,u=Math.floor(.5+m*C),d){case "BOTTOM":u=
  0;break;case "MIDDLE":u=(a-u)/2;break;case "TOP":u=a-u;break;default:throw Error("unsupported alignment "+d);}else switch(u=0,d=Math.floor(.5+k*x),c){case "LEFT":r=0;break;case "MIDDLE":r=(q-d)/2;break;case "RIGHT":r=q-d;break;default:throw Error("unsupported alignment "+c);}return new ng(p,b+a,f-r/x,h-u/C,x,C)}function pg(a,b){if(t(b))var c=void 0;else c=b.l(),b=b.j();if(!t(b)||!t(c))throw Error();return new I(a.h+(b-a.f)/a.a,a.g+(a.c-c)/a.b)}
  function qg(a,b){return new M(a.h+(b.ra()-a.f)/a.a,a.g+(a.c-(b.ka()+b.S()))/a.b,a.h+(b.ra()+b.P()-a.f)/a.a,a.g+(a.c-b.ka())/a.b)}function rg(a,b){return new I(sg(a,b.j()),tg(a,b.l()))}function sg(a,b){return a.f+(b-a.h)*a.a}function tg(a,b){return a.c-(b-a.g)*a.b};function ug(a,b){this.b=null!=a?a:new xc("proto");this.a=null!=b?b:null;this.H=isFinite(this.b.M())&&0<this.b.Gb().length;this.f=vg(this);this.c=wg(this.f)}g=ug.prototype;g.toString=function(){return""};g.ib=function(a){a=this.b.Ea(a);return Mb(wc(this.b),a)};
  function wg(a){if(!ja(a)||""==a)return!1;var b=a.match(/^rgba\((.*),\s*\d*\.?\d+\)/);null!=b&&(a="rgb("+b[1]+")");a=$f(a).Zd;a=bg(a);var c=[parseInt(a.substr(1,2),16),parseInt(a.substr(3,2),16),parseInt(a.substr(5,2),16)];a=c[0];b=c[1];var d=c[2];c=Math.max(Math.max(a,b),d);var e=Math.min(Math.min(a,b),d);if(e==c)e=a=0;else{var f=c-e;e=f/c;a=60*(a==c?(b-d)/f:b==c?2+(d-a)/f:4+(a-b)/f);0>a&&(a+=360);360<a&&(a-=360)}a=[a,e,c];return.65>a[2]||.57<a[1]&&.11>Math.abs(a[0]-.677)}
  g.jb=function(a,b){a.save();var c=1/b.a,d=oc(b.i,this.b.Oe());tc(d,a);this.b.Sd(a);xg(this)&&a.clip();var e=vg(this);e&&(a.fillStyle=e,a.fill());var f=yg(this);if(f){a.lineWidth=zg(this)/b.a;var h=Ag(this);0<h.length&&oa(a.setLineDash)&&(h=Ba(h,function(a){return a/b.a}),a.setLineDash(h));a.strokeStyle=f;a.stroke();a.setLineDash([])}f=Bg(this);h=Cg(this);if(null!=f||null!=h)a.translate(this.b.wa(),this.b.gb()),a.scale(c,-c),nc(Dg(this),a),null!=f&&a.drawImage(f,0,0),null!=h&&h(a);if(this.b.M()!=G){tc(d,
  a);this.f!==e&&(this.f=e,this.c=wg(e));e=1/b.a;a.lineWidth=e;if(Eg(this)){f=this.b.Te();a.strokeStyle=this.c?"#ccc":"black";h=.2*Math.min(this.b.P(),this.b.S());var k=8*e;h>k&&(h=k);a.beginPath();a.moveTo(f.j()-h,f.l());a.lineTo(f.j()+h,f.l());a.stroke();a.beginPath();a.moveTo(f.j(),f.l()-h);a.lineTo(f.j(),f.l()+h);a.stroke()}if(Fg(this)){var m=4*e;e=.15*Math.min(this.b.P(),this.b.S());e<m&&(m=e);A(this.b.Gb(),function(b){a.fillStyle=this.c?"#ccc":"gray";a.beginPath();a.arc(b.j(),b.l(),m,0,2*Math.PI,
  !1);a.closePath();a.fill()},this)}}Gg(this)&&(e=this.b.Zb(),d=d.translate(e),(e=Hg(this))&&(d=sc(d,e)),d=d.scale(c,-c),tc(d,a),a.fillStyle=Ig(this),a.font=Gg(this),a.textAlign="center",a.fillText(this.b.getName(!0),0,a.measureText("M").width/2));a.restore()};function Ag(a){return void 0!==a.w?a.w:null!=a.a?Ag(a.a):[]}function Eg(a){return void 0!==a.g?a.g:null!=a.a?Eg(a.a):!1}function Fg(a){return void 0!==a.A?a.A:null!=a.a?Fg(a.a):!1}
  function vg(a){return void 0!==a.h?a.h:null!=a.a?vg(a.a):"lightGray"}function Bg(a){return void 0!==a.F?a.F:null!=a.a?Bg(a.a):null}function Dg(a){return void 0!==a.B?a.B:null!=a.a?Dg(a.a):uc}function xg(a){return void 0!==a.C?a.C:null!=a.a?xg(a.a):!1}function Cg(a){return void 0!==a.J?a.J:null!=a.a?Cg(a.a):null}g.cb=function(){return[this.b]};function Ig(a){return void 0!==a.O?a.O:null!=a.a?Ig(a.a):"black"}function Gg(a){return void 0!==a.m?a.m:null!=a.a?Gg(a.a):""}
  function Hg(a){return void 0!==a.U?a.U:null!=a.a?Hg(a.a):0}g.Xa=function(){return this.b.ba()};g.Ra=function(){return[this.b]};function yg(a){return void 0!==a.o?a.o:null!=a.a?yg(a.a):""}function zg(a){return void 0!==a.D?a.D:null!=a.a?zg(a.a):1}g.fa=function(){return void 0!==this.i?this.i:null!=this.a?this.a.fa():0};g.eb=function(){return this.H};function Jg(a,b){a.h=b;return a}g.Ya=function(a){this.b.u(a)};g.ya=function(a){this.i=a};var Kg={ERN_MacBookProMid2010:{Safari:{all:{six_blocks_perf:2.8,pile_10_perf:7.7,clock_gears_perf:3.5}},Firefox:{all:{six_blocks_perf:4.5,pile_10_perf:8.2,clock_gears_perf:8}},Chrome:{all:{six_blocks_perf:1.2,pile_10_perf:2.44,pile_20_perf:25,clock_gears_perf:6}}},ERN_MacBookPro2013:{Safari:{simple:{six_blocks_perf:.94,pile_10_perf:2.86,clock_gears_perf:.64},advanced:{six_blocks_perf:.94,pile_10_perf:3,clock_gears_perf:.64}},Firefox:{simple:{six_blocks_perf:.75,pile_10_perf:1.03,clock_gears_perf:.92},
  advanced:{six_blocks_perf:.66,pile_10_perf:1.1,clock_gears_perf:1.2}},Chrome:{simple:{six_blocks_perf:.56,pile_10_perf:1.08,pile_20_perf:19,clock_gears_perf:.91},advanced:{six_blocks_perf:.56,pile_10_perf:1.15,pile_20_perf:11.24,clock_gears_perf:.9}}}};function Lg(a,b,c,d){Pd.call(this,a,b,d);this.D=c}l(Lg,Pd);Lg.prototype.toString=function(){return""};Lg.prototype.ic=function(){return this.D};Lg.prototype.hd=function(){return!1};Lg.prototype.Wa=function(a){this.D.sb(this);Pd.prototype.Wa.call(this,a)};function Mg(a,b,c,d,e,f){Sb.call(this,"JOINT"+Ng++);this.b=a;this.a=c;this.c=b;this.f=d;a.Ba([c]);c.Ba([a]);this.h=f;this.g=e}l(Mg,Sb);g=Mg.prototype;g.toString=function(){return""};g.Cb=function(a,b){var c=new Lg(this.b,this.a,this,!0);this.sb(c);Td(c,b);Oa(a,0,0,c)};g.oc=function(){isFinite(this.a.M())?this.a.qb(this.f,this.b.G(this.c)):isFinite(this.b.M())&&this.b.qb(this.c,this.a.G(this.f))};g.Zc=function(){return this.b};g.$c=function(){return this.a};g.Qa=function(){return Lb(this.La(),this.Vb())};
  g.Wc=function(){var a=[];this.Cb(a,NaN);return a[0].f};g.La=function(){return this.b.G(this.c)};g.Vb=function(){return this.a.G(this.f)};g.sb=function(a){if(a.c!=this.b||a.b!=this.a)throw Error();if(a.ic()!=this)throw Error();var b=this.b.G(this.c);a.g=b;a.Ga=1==this.g;b=1==this.g?this.h:this.a.na(this.h);a.o=this.a.G(this.f);a.a=b;var c=J(a.g,a.o);a.f=Cb(b,c);a.A="Joint"};var Ng=0;function Og(a){this.g=this.b=0;this.a=a||0;this.Fa=this.c=rb;this.F=!1;this.A=1;this.i=-1;this.J=this.w=this.o=this.m=this.C=this.B=this.h=this.f=0}Og.prototype.toString=function(){return""};function Pg(a,b){a.b=b.b;a.g=b.g;a.a=b.a;a.c=b.c;a.Fa=b.Fa;a.F=b.F;a.A=b.A;a.i=b.i;a.f=b.f;a.h=b.h;a.B=b.B;a.C=b.C;a.m=b.m;a.o=b.o;a.w=b.w;a.J=b.w}function Qg(a){return new I(a.b,a.g)}Og.prototype.j=function(){return this.b};Og.prototype.l=function(){return this.g};Og.prototype.sa=function(){return 0};function Rg(a,b){Sb.call(this,a.getName());this.b=b||9E3;this.c=D(this.b);this.f=D(this.b);this.a=D(this.b);this.h=D(this.b);this.o=D(this.b);this.i=D(this.b);this.m=D(this.b);this.C=D(this.b);this.J=D(this.b);this.w=a.g;this.g=0;this.F=Rb;b=a.m;var c=(a.h-b)/(this.b-1),d=b,e=0;this.a[0]=0;var f,h;var k=f=this.c[0]=a.a(d);var m=h=this.f[0]=a.b(d);for(b=1;b<this.b;b++){d+=c;this.c[b]=a.a(d);this.f[b]=a.b(d);var p=this.c[b]-this.c[b-1],q=this.f[b]-this.f[b-1];e+=Math.sqrt(p*p+q*q);this.a[b]=e;this.c[b]<
  k&&(k=this.c[b]);this.c[b]>f&&(f=this.c[b]);this.f[b]<m&&(m=this.f[b]);this.f[b]>h&&(h=this.f[b])}this.F=new M(k,m,f,h);this.g=this.a[this.b-1]-this.a[0];for(b=0;b<this.b;b++)0==b?(this.h[0]=Sg(this,this.c,0,0),this.o[0]=Sg(this,this.f,0,0)):b==this.b-1?(this.h[b]=Sg(this,this.c,b-2,2),this.o[b]=Sg(this,this.f,b-2,2)):(this.h[b]=Sg(this,this.c,b-1,1),this.o[b]=Sg(this,this.f,b-1,1)),1E-16>Math.abs(this.h[b])?(this.i[b]=0>this.o[b]?1:-1,this.m[b]=0):1E-16>Math.abs(this.o[b])?(this.i[b]=0,this.m[b]=
  0<this.h[b]?1:-1):(a=-this.h[b]/this.o[b],c=Math.sqrt(1+a*a),this.i[b]=1/c,this.m[b]=a/c,0>(0<this.h[b]?1:-1)*a&&(this.i[b]=-this.i[b],this.m[b]=-this.m[b]));for(b=0;b<this.b;b++)0==b?(this.C[0]=Sg(this,this.i,0,0),this.J[0]=Sg(this,this.m,0,0)):b==this.b-1?(this.C[b]=Sg(this,this.i,b-2,2),this.J[b]=Sg(this,this.m,b-2,2)):(this.C[b]=Sg(this,this.i,b-1,1),this.J[b]=Sg(this,this.m,b-1,1));a:{a=this.c;b=a.length;if(2>b)throw Error("array must have more than one element");c=a[0]<a[b-1];for(d=1;d<b;d++)if(c){if(a[d-
  1]>a[d])break a}else if(a[d-1]<a[d])break a}this.B=new Og(this.a[0]);this.A=new Og(this.a[this.a.length-1]);Tg(this,this.B);Tg(this,this.A)}l(Rg,Sb);Rg.prototype.toString=function(){return""};
  function Ug(a,b){var c=a.length;if(2>c)throw Error("array must have more than one element");var d=a[0]<a[c-1];var e=Math.floor(c/2);if(d){var f=0;var h=c-1}else f=c-1,h=0;if(d){if(b<a[0])return-1;if(b>=a[c-1])return c}else{if(b<a[c-1])return c;if(b>=a[0])return-1}for(;1<Math.abs(h-f);)a[e]<=b?d?f=e:h=e:d?h=e:f=e,e=d?f+Math.floor((h-f)/2):h+Math.floor((f-h)/2);return e}
  function Sg(a,b,c,d){var e=a.a[c],f=a.a[c+1];a=a.a[c+2];switch(d){case 0:d=e;break;case 1:d=f;break;case 2:d=a;break;default:throw Error();}var h=b[c]*(2*d-f-a)/((e-f)*(e-a));h+=b[c+1]*(2*d-e-a)/((f-e)*(f-a));return h+=b[c+2]*(2*d-e-f)/((a-e)*(a-f))}function Vg(a,b,c){var d=b.j()-a.c[c];a=b.l()-a.f[c];return d*d+a*a}function Wg(a,b,c,d){var e=Xg(a.a,a.c,c,d-1);a=Xg(a.a,a.f,c,d-1);e=b.j()-e;b=b.l()-a;return e*e+b*b}
  function Yg(a,b){var c=new Og,d=b.j();b=b.l();for(var e=G,f=0;f<a.b;f++){var h=d-a.c[f],k=b-a.f[f];h=h*h+k*k;h<e&&(e=h,c.b=a.c[f],c.g=a.f[f],c.a=a.a[f],c.i=f)}return c}
  function Zg(a,b,c){var d=$g(a,c.i),e=Math.floor(a.b/20),f=a.g/20,h=a.a[d],k=0;do{if(1<e){h=a.a[d];var m=Vg(a,b,$g(a,d-e));var p=Vg(a,b,d);var q=Vg(a,b,$g(a,d+e))}else m=ah(a,h-f),m=Wg(a,b,m,bh(a,m,d)),p=Wg(a,b,h,d),q=ah(a,h+f),q=Wg(a,b,q,bh(a,q,d));m<p&&m<q?1<e?(d=$g(a,d-e),h=a.a[d]):(h=ah(a,h-f),d=bh(a,h,d)):q<p?1<e?(d=$g(a,d+e),h=a.a[d]):(h=ah(a,h+f),d=bh(a,h,d)):1<e?(e=Math.floor(e/2),1==e&&(a.w?(f=$g(a,d-1),f=a.a[$g(a,f+2)]-a.a[f]):(f=$g(a,d),f=0==f?0:f==a.b-1?a.b-3:f-1,f=a.a[f+2]-a.a[f]))):f/=
  2;k++}while(1<e||1E-6<f);a.w?(b=ah(a,c.a),b<a.g/6&&h>5*a.g/6?(a=h-a.g-b,c.a+=a):h<a.g/6&&b>5*a.g/6?(a=h+a.g-b,c.a+=a):c.a+=h-b):c.a=h;c.i=d}Rg.prototype.Qa=function(){return this.F};
  function Xg(a,b,c,d){var e=a.length;if(b.length!=e)throw Error();d>e-4?d=e-4:0>d&&(d=0);e=b[d];var f=(b[d+1]-e)/(a[d+1]-a[d]);var h=(b[d+2]-(e+f*(a[d+2]-a[d])))/((a[d+2]-a[d])*(a[d+2]-a[d+1]));b=b[d+3]-(e+f*(a[d+3]-a[d])+h*(a[d+3]-a[d])*(a[d+3]-a[d+1]));b/=(a[d+3]-a[d])*(a[d+3]-a[d+1])*(a[d+3]-a[d+2]);return((b*(c-a[d+2])+h)*(c-a[d+1])+f)*(c-a[d])+e}
  function bh(a,b,c){c>a.b-2&&(c=a.b-2);0>c&&(c=0);if(Math.abs(a.a[c]-b)>a.g/20)c=Ug(a.a,b);else for(;!(a.a[c]<=b&&b<a.a[c+1]);)if(b<a.a[c])if(0<c)--c;else break;else if(c<a.b-2)c+=1;else break;return c}function ah(a,b){a.w&&(0>b||b>a.g)&&(b-=a.g*Math.floor(b/a.g));return b}function $g(a,b){if(a.w){for(;0>b;)b+=a.b;for(;b>=a.b;)b-=a.b}else 0>b?b=0:b>=a.b&&(b=a.b-1);return b}
  function Tg(a,b){var c=ah(a,b.a),d=b.i;if(0>d||d>a.b-2||a.a[d]>c||a.a[d+1]<=c)b.i=d=Ug(a.a,c);0>d&&(d=0);d>=a.b-1&&(d=a.b-2);if(!a.w){if(c<a.a[0]){Pg(b,a.B);b.a=c;b.i=d;d=b.c;b.b=a.B.b+(c-a.a[0])/Math.sqrt(1+d*d);b.g=a.B.g+d*(b.b-a.B.b);return}if(c>a.a[a.a.length-1]){Pg(b,a.A);b.a=c;b.i=d;d=b.c;b.b=a.A.b+(c-a.a[a.a.length-1])/Math.sqrt(1+d*d);b.g=a.A.g+d*(b.b-a.A.b);return}}b.b=Xg(a.a,a.c,c,d-1);b.g=Xg(a.a,a.f,c,d-1);b.J=Xg(a.a,a.o,c,d-1);b.w=Xg(a.a,a.h,c,d-1);if(1E-12>Math.abs(b.w))b.w=0,0<b.J?(b.A=
  1,b.c=b.Fa=G,b.m=0,b.o=1,b.f=-1):(b.A=-1,b.c=b.Fa=sb,b.m=0,b.o=-1,b.f=1),b.h=0;else{b.A=0<b.w?1:-1;b.c=b.J/b.w;var e=Math.sqrt(1+b.c*b.c);b.m=1/e;b.o=b.c/e;-1==b.A&&(b.m=-b.m,b.o=-b.o);if(1E-12<Math.abs(b.c)){e=-1/b.c;var f=Math.sqrt(1+e*e);b.f=1/f;b.h=e/f;0<b.A*b.c&&(b.f=-b.f,b.h=-b.h)}else b.f=0,b.h=0<b.A?1:-1}b.B=Xg(a.a,a.C,c,d-1);b.C=Xg(a.a,a.J,c,d-1);if(b.F)if(2>d||d>a.b-4)b.Fa=G;else{c=a.c[d]-a.c[d-2];e=a.f[d]-a.f[d-2];f=e/c;var h=a.a[d-1];c=a.c[d+3]-a.c[d+1];e=a.f[d+3]-a.f[d+1];b.Fa=(a.a[d+
  2]-h)/(Math.atan(e/c)-Math.atan(f));if(isNaN(b.Fa)||!isFinite(b.c))b.Fa=0<b.c?G:sb}};function ch(a,b,c){Sb.call(this,"PathJoint"+dh++);this.b=b;this.f=a;this.c=c;this.a=new Og}l(ch,Sb);g=ch.prototype;g.toString=function(){return""};g.Cb=function(a,b){var c=new Lg(this.b,uf,this,!0);this.sb(c);Td(c,b);Oa(a,0,0,c)};g.oc=function(){var a=this.b.G(this.c);this.a=Yg(this.f,a);Tg(this.f,this.a);this.b.qb(this.c,this.a)};g.Zc=function(){return this.b};g.$c=function(){return uf};g.Qa=function(){return Lb(this.La(),this.Vb())};g.Wc=function(){var a=[];this.Cb(a,NaN);return a[0].f};g.La=function(){return this.b.G(this.c)};
  g.Vb=function(){return this.La()};
  g.sb=function(a){if(a.c!=this.b||a.b!=uf)throw Error();if(a.ic()!=this)throw Error();var b=this.b.G(this.c);a.g=b;Zg(this.f,b,this.a);Tg(this.f,this.a);var c;if(c=!this.f.w){c=this.a;if(1E-16>Math.abs(c.f))b=Math.abs(b.j()-c.b);else{var d=-c.h,e=c.f;b=Math.abs(d*b.j()+e*b.l()+(c.h*c.b-c.f*c.g))/Math.sqrt(d*d+e*e)}c=1E-4<b}c&&(this.a.B=0,this.a.C=0);b=this.a;b=new I(b.f,b.h);c=this.b.hb(this.c);d=new I(this.a.m,this.a.o);c=Cb(c,d);a.Ia=new I(this.a.B*c,this.a.C*c);a.Ga=!1;a.h=rb;a.m=!0;a.o=Qg(this.a);
  a.a=b;c=J(a.g,a.o);a.f=Cb(b,c);a.A="PathJoint"};var dh=0;function eh(){if(window.hasOwnProperty("MYPHYSICSLAB_MACHINE_NAME")){var a=window.MYPHYSICSLAB_MACHINE_NAME;if(ja(a))return a}return"UNKNOWN_MACHINE"}function fh(){var a=navigator;return null==a?"unknown":null!=a.userAgent.match(/.*Chrome.*/)?"Chrome":null!=a.userAgent.match(/.*Firefox.*/)?"Firefox":null!=a.userAgent.match(/.*Safari.*/)?"Safari":"other"}
  function gh(a,b){var c=100*a/b-100;return"time="+Za(a)+" expected="+Za(b)+"  ("+(null!=c?(0<c?"+":"")+c.toFixed(1):null===c?"null":"undefined")+"%)"}function hh(a){var b;void 0===b&&(b=1E4);var c=eh(),d=fh(),e="no expected results for machine: "+c;c=Kg[c];if(!qa(c))return ih(e,!0),b;e+=", browser: "+d;d=c[d];if(!qa(d))return ih(e,!0),b;e+=", compiled: advanced";c=d.advanced;if(!qa(c)&&(c=d.all,!qa(c)))return ih(e,!0),b;d=c[a];if(t(d))return d;ih(e+(", test: "+a),!0);return b}
  function jh(a){try{a()}catch(b){kh+=1,ih("***FAILED*** "+lh+" "+b,!0),ih(b.stack,!0)}}function mh(a){nh.push(va(jh,a))}function oh(){var a=nh.shift();oa(a)&&(a(),setTimeout(oh,10))}function ph(){var a=kh;0<a?ih("Tests finished -- "+a+" TESTS FAILED",!0):ih("Tests finished and passed.");a=new Date;ih(a.toDateString()+" "+a.toTimeString())}
  function ih(a,b,c){console.log(a);null!=qh&&(b&&(a='<span class="error">'+a+"</span>"),c&&(a='<span class="warning">'+a+"</span>"),qh.innerHTML+=a+"<br>",window.scrollTo(0,document.documentElement.offsetHeight-window.innerHeight))}function rh(a,b,c){var d=lh+" ["+b+"]";a?("performance"==b&&(d+=" "+c),a=null!=lh.match(/.*error.*/),ih("passed: "+d,!1,a)):(kh+=1,ih("FAILED "+d,!0),ja(c)&&0<c.length&&ih(c,!0),console.trace())}var nh=[],kh=0,qh=null,lh="";function sh(a){for(var b=Array(a),c=0;c<a;c++)b[c]=rb;return b}function th(a,b,c,d,e,f,h,k,m){a=Cf(a,c).la();b[a]=d;b[a+1]=e;b[a+2]=f;b[a+3]=h;b[a+4]=k;b[a+5]=m}
  function uh(a,b,c,d,e,f,h,k){a instanceof Pf&&(a.F=b.a);d=n(d)?d:null;h=n(h)?h:0;k=n(k)?k:-1;var m=n(m)?m:0;1E-12>jd(b)&&(Zc(b,0),b.i.reset());var p=mf(Ff(a)),q=b.i.a,r=b.i.b;vh&&ih(" time      X        VX        Y       VY       W      VW     energy");for(jd(b);jd(b)<c-1E-7;){if(vh){var u=a,x=Lc(u.v(),!0);ih($a(u.ma())+" "+$a(x[0])+" "+$a(x[1])+" "+$a(x[2])+" "+$a(x[3])+" "+$a(x[4])+" "+$a(x[5])+" "+$a(mf(Ff(u))))}Zc(b,b.a)}x=!1;u=!0;c="";if(null!=d&&n(e)){if(null==d||isNaN(e))throw Error();u=!0;
  x=-1;for(var C=0,y=Lc(a.v(),!0),w=0;w<d.length;w++)if(!isNaN(d[w])){var H=Math.abs(y[w]-d[w]);H>e&&(u=!1,0>x||H>C)&&(x=w,C=H)}if(!u){w=Lc(a.v(),!0);H=Bf(a).length;for(var L=0;L<H;L++){var ca=Cf(a,L).la();ih("Engine2DTestRig.setBodyVars(sim, vars, "+L+", "+ab(w[ca])+", "+ab(w[ca+1])+", "+ab(w[ca+2])+", "+ab(w[ca+3])+", "+ab(w[ca+4])+", "+ab(w[ca+5])+");")}rh(!1,"vars","vars["+x+"]="+y[x]+" != "+d[x]+" with tolerance="+e+" diff="+(null!=C?2E-4<Math.abs(C)||0==C?C.toFixed(5):C.toExponential(5):null===
  C?"null":"undefined"))}c+=(""!=c?"+":"")+"vars";x=!0}n(f)&&!isNaN(f)&&(c+=(""!=c?"+":"")+"energy",a=mf(Ff(a)),Math.abs(a-p-f)<h||(f="energy diff="+bb(a-p)+", expected diff="+bb(f)+", energyTol="+h+", error="+bb(a-p-f)+", energy="+bb(a),rh(!1,c,f),u=!1),x=!0);-1<k&&(c+=(""!=c?"+":"")+"num_collisions",f=b.i.a,f-q!=k&&(rh(!1,c,"should have had "+k+" but had "+(f-q)+" collisions"),u=!1),x=!0);-1<m&&(c+=(""!=c?"+":"")+"collision_search",b=b.i.b,b-r!=m&&(rh(!1,c,"should have had "+m+" but had "+(b-r)+" collision searches"),
  u=!1),x=!0);u&&x&&rh(!0,c)}var vh=!1;function wh(a,b){var c=xh++;P.call(this,"GRAVITY_INVERSE_SQUARE_LAW"+(0<c?"_"+c:""));this.b=a;this.a=[];this.c=null;null!=b&&(a=Ma(b.a),A(a,v(this.df,this)),ec(b,this),this.c=b);this.I($b(new O(this,yh.Za,zh.Za,v(this.Xg,this),v(this.Yg,this)),4))}l(wh,P);g=wh.prototype;g.toString=function(){return""};g.df=function(a){if(a.nc()&&!B(this.a,a)){var b=a.M();0<b&&isFinite(b)&&this.a.push(a)}};
  g.Db=function(){var a=Ma(this.a),b=[],c=0,d=a.length;A(this.a,function(e){c++;var f=e.M();if(!(0>=f)&&isFinite(f))for(var h=e.ba(),k=c;k<d;k++){var m=a[k],p=m.M();if(!(0>=p)&&isFinite(p)){var q=J(h,m.ba()),r=q.length();q=Hb(q);null!=q&&(q=Gb(q,this.b*f*p/(r*r)),b.push(new Cc("gravity",e,e.ba(),1,Gb(q,-1),1)),b.push(new Cc("gravity",m,m.ba(),1,q,1)))}}},this);return b};g.Kb=function(){null!=this.c&&kc(this.c,this)};g.Xg=function(){return this.b};
  g.Ib=function(){var a=0,b=Ma(this.a),c=0,d=b.length;A(this.a,function(e){c++;var f=e.M();if(!(0>=f)&&isFinite(f)){var h=e.Hb();e=e.ba();for(var k=c;k<d;k++){var m=b[k],p=m.M();if(!(0>=p)&&isFinite(p)){var q=m.Hb();m=J(e,m.ba()).length();a+=this.b*f*p*(1/(h+q)-1/m)}}}},this);return a};g.ga=function(a){a.R("OBJECT_ADDED")?(a=a.N(),this.df(a)):a.R("OBJECT_REMOVED")&&(a=a.N(),Ha(this.a,a))};g.Yg=function(a){this.b=a;Q(this,yh.Za)};var xh=0,yh={Za:"gravity"},zh=yh;function Y(a,b,c){b=new Je(b,c);bf(b,new ve(new I(-a,0)));Ne(b,new I(-a,0),K);Xe(b);Ye(b,K);b.xa(a*a/2);b.Y(.8);return b}function Z(a,b,c,d){c=new Je(c,d);d=a/2;var e=b/2;bf(c,new ve(new I(-d,-e)));T(c,new I(d,-e),!1);T(c,new I(d,e),!0);T(c,new I(-d,e),!0);T(c,new I(-d,-e),!1);Xe(c);Ye(c,K);c.xa((a*a+b*b)/12);c.Y(.8);return c}
  function Ah(a,b,c){if(b<-Math.PI/2||b>Math.PI/2)throw Error("angle must be within +/- pi/2");c=new Je(c,void 0);var d=a/2,e=Math.cos(b),f=Math.sin(b),h=Ib(new I(-.5,-d),e,f);bf(c,new ve(new I(h.j(),h.l())));h=Ib(new I(.5,-d),e,f);T(c,h,!1);h=Ib(new I(.5,d),e,f);T(c,h,0<=b);h=Ib(new I(-.5,d),e,f);T(c,h,!0);h=Ib(new I(-.5,-d),e,f);T(c,h,0>b);Xe(c);c.xa((1+a*a)/12);Ye(c,K);c.Y(.8);return c}
  function Bh(a,b){a/=2;b/=2;var c=new Je("body1",void 0);bf(c,new ve(new I(a-.1,b-.1)));T(c,new I(a-.1,-(b-.1)),!1);T(c,new I(-(a-.1),-(b-.1)),!0);T(c,new I(-(a-.1),b-.1),!0);T(c,new I(a-.1,b-.1),!1);Qe(c);bf(c,new ve(new I(a+.1,b+.1)));T(c,new I(-(a+.1),b+.1),!0);T(c,new I(-(a+.1),-(b+.1)),!1);T(c,new I(a+.1,-(b+.1)),!1);T(c,new I(a+.1,b+.1),!0);Qe(c);Xe(c);c.Y(.8);return c}
  function Ch(a,b,c,d){c=new Je(c,d);bf(c,new ve(new I(.05,b)));T(c,new I(.05,a+.05),!0);T(c,new I(-.05,a+.05),!0);T(c,new I(-.05,b),!1);Ne(c,new I(.05,b),new I(0,0));Xe(c);c.pa(0,0);c.xb([K]);a=Math.sqrt(.05*.05+b*b);c.xa(a*a/2);c.Y(.8);return c}function Dh(a){var b=[!0,!0,!1,!1],c=1/6;if(3>a.length||a.length!=b.length)throw Error();var d=new Je(void 0,void 0),e=a[0];bf(d,new ve(e));for(var f=1;f<a.length;f++)T(d,a[f],b[f-1]);T(d,e,b[a.length-1]);Xe(d);d.xa(c);d.Y(.8);return d}
  function Eh(a){a=new Je(a,void 0);bf(a,new ve(new I(-.48,-.5)));T(a,new I(.48,-.5),!1);Ne(a,new I(.5,-.48),new I(.48,-.48));T(a,new I(.5,.48),!0);Ne(a,new I(.48,.5),new I(.48,.48));T(a,new I(-.48,.5),!0);Ne(a,new I(-.5,.48),new I(-.48,.48));T(a,new I(-.5,-.48),!1);Ne(a,new I(-.48,-.5),new I(-.48,-.48));Xe(a);Ye(a,K);a.xa(2/12);a.Y(.8);return a}function Fh(a,b,c,d,e){if(0>c||3<c)throw Error();a=Z(a,b,d,e);af(a,c,0==c||2==c?a.S()/2:a.P()/2);return a}var Gh=new cf(0);function Hh(){var a=new Je("concave_circle");bf(a,new ve(new I(0,-.5)));T(a,new I(3,-.5),!1);T(a,new I(3,1),!0);var b=new I(0,1);var c=Oe(a);b=new ve(b,!0);var d=(S(c)+S(b))/2;var e=(xe(c)+xe(b))/2;var f=S(c)-d;var h=xe(c)-e;f=Math.sqrt(f*f+h*h);h=4-f*f;if(1E-10>h)throw Error("radius 2 is too small, must be >= "+f);h=Math.sqrt(h);1E-10>Math.abs(S(b)-S(c))?d=h+d:(f=(xe(b)-xe(c))/(S(b)-S(c)),h/=Math.sqrt(1+f*f),d=-f*h+d,e=h+e);c=new Ee(a,c,b,new I(d,e),!0,!1);Pe(a,c);T(a,new I(0,-.5),!1);Xe(a);a.pa(1.5,
  0);a.Y(.8);return a};function Ih(a,b,c,d,e){e=e||K;d=d||1;var f,h=0,k=[];for(f=0;4>f;f++){var m=null;switch(f){case 0:m=Fh(b+2*d,d,2,Jh.Sb,Kh.Sb);m.u(new I(e.j(),e.l()-c/2-d/2),0);h=m.jc();break;case 1:m=Fh(d,c+2*d,3,Jh.Sc,Kh.Sc);m.u(new I(e.j()+b/2+d/2,e.l()),0);break;case 2:m=Fh(b+2*d,d,0,Jh.Le,Kh.Le);m.u(new I(e.j(),e.l()+c/2+d/2),0);break;case 3:m=Fh(d,c+2*d,1,Jh.Rc,Kh.Rc),m.u(new I(e.j()-b/2-d/2,e.l()),0)}null!=m&&(m.L(G),m.Y(1),k.push(m),a.s(m))}for(f=0;f<k.length;f++)k[f].Ba(k);return h}
  function Lh(a,b){return Ih(a,b.P(),b.S(),void 0,Nb(b))}var Jh={Sb:"wall bottom",Sc:"wall right",Rc:"wall left",Le:"wall top"},Kh=Jh;function Mh(a,b){V(a,new ff(0,.15,a.a));a.ta(.01);a.Na(.5);a.$(.6);If(a,"serial grouped lastpass");a instanceof Pf&&X(a,"velocity");a.ua(99999);b.a=.025;b.b=new Vc(a)}z("module$exports$myphysicslab$test$CircleCircleTest.ball_ball_contact_setup",function(a,b){Mh(a,b);b=Y(.75,"ball1");b.pa(0,.2);b.u(new I(-.754,-.2),0);b.K(new I(0,0),1);a.s(b);b=Y(1,"ball2");b.pa(0,-.3);b.u(new I(.95,.3),Math.PI);a.s(b);W(a,.8);V(a,new wh(3,a.a));b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  z("module$exports$myphysicslab$test$CircleCircleTest.concave_circle_and_ball_setup",function(a,b){Mh(a,b);b=Hh();b.u(new I(0,-2),0);a.s(b);b=Y(.5,"ball");b.pa(.2,0);b.u(new I(.5,-.22),0);a.s(b);W(a,.8);V(a,new wh(3,a.a))});function Nh(a,b,c){V(a,new ff(void 0===c?0:c,.5,a.a));a.$(.6);If(a,"serial grouped lastpass");a.ua(99999);a.ta(.01);a.Na(.5);a instanceof Pf&&X(a,"velocity");b.a=.025;b.b=new Vc(a)}z("module$exports$myphysicslab$test$CircleStraightTest.ball_block_collide_setup",function(a,b){Nh(a,b);b=Y(.75,"ball");b.pa(0,.2);b.u(new I(-2,2),0);b.K(new I(1,-1),1);a.s(b);b=Z(1,1,"block");b.u(new I(0,0),0);a.s(b);W(a,1)});
  z("module$exports$myphysicslab$test$CircleStraightTest.ball_block_attract_setup",function(a,b){Nh(a,b);b=Y(.75,"ball");b.pa(0,.2);b.u(new I(-2,2),0);b.K(new I(.1,-.1),1);a.s(b);b=Z(1,1,"block");b.u(new I(0,0),0);b.K(new I(-.1,.1),-1);a.s(b);W(a,.8);V(a,new wh(3,a.a))});
  z("module$exports$myphysicslab$test$CircleStraightTest.ball_block_contact_setup",function(a,b){Nh(a,b);b=Y(.75,"ball");b.pa(0,.2);b.u(new I(-.2525,0),0);b.K(new I(0,.6),1);a.s(b);b=Z(1,3,"block");b.u(new I(1,0),0);b.K(new I(0,-.6),0);a.s(b);W(a,.8);V(a,new wh(3,a.a));b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  z("module$exports$myphysicslab$test$CircleStraightTest.circle_arc_block_setup",function(a,b){Nh(a,b);b.a=.01;b=new Je("block-round-edge");bf(b,new ve(new I(0,0)));T(b,new I(2,0),!1);T(b,new I(2,1),!0);Ne(b,new I(0,1),new I(1,-.3));T(b,new I(0,0),!1);Xe(b);b.Y(.8);b.u(new I(0,-1),0);a.s(b);b=Z(1,1,"block");b.u(new I(2.5,.3),Math.PI/8-Math.PI/24);a.s(b);W(a,.8);V(a,new wh(3,a.a))});
  z("module$exports$myphysicslab$test$CircleStraightTest.concave_ball_block_collide_setup",function(a,b){Nh(a,b);b.a=.01;b=Hh();b.u(new I(0,-2),0);a.s(b);b=Z(1,1,"block");b.u(new I(.5,-.22),Math.PI/8-Math.PI/24);a.s(b);W(a,.8);V(a,new wh(3,a.a))});
  z("module$exports$myphysicslab$test$CircleStraightTest.concave_ball_block_contact_setup",function(a,b){Nh(a,b);b.a=.01;b=Hh();b.u(new I(0,-2.3228757),0);b.Y(.8);a.s(b);var c=Z(1,1,"block");c.Y(.8);for(var d=Math.PI/16,e=1.5,f=G;1E-8<Math.abs(f);){c.u(new I(0,0),d);c.fd();b.fd();c.u(new I(e*Math.sin(d),-e*Math.cos(d)),d);var h=[];Se(b,h,c,0);if(0==h.length)e+=.01;else{f=G;for(var k=0,m=h.length;k<m;k++){var p=h[k];p=p.f-p.J-.001;p<f&&(f=p)}e+=f}}a.s(c);V(a,new wh(10,a.a))});
  function Oh(a,b){Nh(a,b);b=Y(.75,"ball");b.u(new I(-.4,0),0);b.K(new I(0,0),0);a.s(b);b=Z(1,3,"block");b.u(new I(1.5,0),-Math.PI/4);b.K(new I(-.2,0),.5);a.s(b);W(a,.8)}z("module$exports$myphysicslab$test$CircleStraightTest.rotating_block_vs_ball_1_setup",function(a,b){Oh(a,b);W(a,1)});z("module$exports$myphysicslab$test$CircleStraightTest.rotating_block_vs_ball_0_setup",function(a,b){Oh(a,b);W(a,0)});
  z("module$exports$myphysicslab$test$CircleStraightTest.ball_falls_on_floor_setup",function(a,b){Nh(a,b);zf(a);b=Y(.5,"ball");b.u(new I(0,0),0);a.s(b);var c=Z(10,1,"wall");c.L(G);c.u(new I(0,-2.5),0);a.s(c);c=c.jc();b.T(c+b.Hb());b=new U(3,a.a);V(a,b);W(a,.8)});
  z("module$exports$myphysicslab$test$CircleStraightTest.wedged_ball_setup",function(a,b){Nh(a,b,0);X(a,"velocity_and_distance");a.$(.6);b=Y(1.5,"ball");b.pa(.4,.2);b.u(new I(-3.99,-3),0);a.s(b);b=Z(1,1,"fixed block");b.u(new I(-2.5,-5),0);b.L(G);a.s(b);b=new U(3,a.a);V(a,b);var c=Ih(a,12,12,1);b.T(c);W(a,.8)});
  z("module$exports$myphysicslab$test$CircleStraightTest.elastic_balls_setup",function(a,b){Nh(a,b,0);X(a,"velocity_and_distance");b=Y(.8,"ball1");b.u(new I(-5,2));b.Y(1);a.s(b);b=Y(.8,"ball2");b.u(new I(-3,2));b.Y(.8);a.s(b);b=Y(.8,"ball3");b.u(new I(-1,2));b.Y(.6);a.s(b);b=Y(.8,"ball4");b.u(new I(1,2));b.Y(.4);a.s(b);b=Y(.8,"ball5");b.u(new I(3,2));b.Y(.2);a.s(b);b=Y(.8,"ball6");b.u(new I(5,2));b.Y(0);a.s(b);b=new U(3,a.a);V(a,b);a=Ih(a,12,12,1);b.T(a)});function Ph(a){this.a=a}Ph.prototype.toString=function(){return""};Ph.prototype.Db=function(){return null!=this.a?[this.a]:[]};Ph.prototype.Kb=function(){};Ph.prototype.Ib=function(){return 0};var Qh=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]};function Rh(a,b){return a<b?-1:a>b?1:0};var Sh;a:{var Th=ia.navigator;if(Th){var Uh=Th.userAgent;if(Uh){Sh=Uh;break a}}Sh=""};function Vh(a){Vh[" "](a);return a}Vh[" "]=ka;function Wh(a,b){var c=Xh;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var Yh=-1!=Sh.indexOf("Opera"),Zh=-1!=Sh.indexOf("Trident")||-1!=Sh.indexOf("MSIE"),$h=-1!=Sh.indexOf("Edge"),ai=-1!=Sh.indexOf("Gecko")&&!(-1!=Sh.toLowerCase().indexOf("webkit")&&-1==Sh.indexOf("Edge"))&&!(-1!=Sh.indexOf("Trident")||-1!=Sh.indexOf("MSIE"))&&-1==Sh.indexOf("Edge"),bi=-1!=Sh.toLowerCase().indexOf("webkit")&&-1==Sh.indexOf("Edge");function ci(){var a=ia.document;return a?a.documentMode:void 0}var di;
  a:{var ei="",fi=function(){var a=Sh;if(ai)return/rv:([^\);]+)(\)|;)/.exec(a);if($h)return/Edge\/([\d\.]+)/.exec(a);if(Zh)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(bi)return/WebKit\/(\S+)/.exec(a);if(Yh)return/(?:Version)[ \/]?(\S+)/.exec(a)}();fi&&(ei=fi?fi[1]:"");if(Zh){var gi=ci();if(null!=gi&&gi>parseFloat(ei)){di=String(gi);break a}}di=ei}var Xh={};
  function hi(a){return Wh(a,function(){for(var b=0,c=Qh(String(di)).split("."),d=Qh(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var h=c[f]||"",k=d[f]||"";do{h=/(\d*)(\D*)(.*)/.exec(h)||["","","",""];k=/(\d*)(\D*)(.*)/.exec(k)||["","","",""];if(0==h[0].length&&0==k[0].length)break;b=Rh(0==h[1].length?0:parseInt(h[1],10),0==k[1].length?0:parseInt(k[1],10))||Rh(0==h[2].length,0==k[2].length)||Rh(h[2],k[2]);h=h[3];k=k[3]}while(0==b)}return 0<=b})}var ii;var ji=ia.document;
  ii=ji&&Zh?ci()||("CSS1Compat"==ji.compatMode?parseInt(di,10):5):void 0;var ki=Zh||Yh||bi;function li(a,b){this.width=a;this.height=b}g=li.prototype;g.Yf=function(){return this.width*this.height};g.aspectRatio=function(){return this.width/this.height};g.Va=function(){return!this.Yf()};g.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};g.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};g.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
  g.scale=function(a,b){b=t(b)?b:a;this.width*=a;this.height*=b;return this};function mi(){var a=window.document;a="CSS1Compat"==a.compatMode?a.documentElement:a.body;return new li(a.clientWidth,a.clientHeight)}function ni(a){var b;if(ki&&!(Zh&&hi("9")&&!hi("10")&&ia.SVGElement&&a instanceof ia.SVGElement)&&(b=a.parentElement))return b;b=a.parentNode;return qa(b)&&1==b.nodeType?b:null};var oi;(oi=!Zh)||(oi=9<=Number(ii));var pi=oi,qi=Zh&&!hi("9"),ri=function(){if(!ia.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});ia.addEventListener("test",ka,b);ia.removeEventListener("test",ka,b);return a}();function si(a,b){this.type=a;this.c=this.target=b}si.prototype.a=function(){};function ti(a,b){si.call(this,a?a.type:"");this.relatedTarget=this.c=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.b=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.pointerId=0;this.pointerType="";this.f=null;if(a){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.c=b;if(b=a.relatedTarget){if(ai){a:{try{Vh(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==
  c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.b=a.keyCode||0;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=
  a.shiftKey;this.metaKey=a.metaKey;this.pointerId=a.pointerId||0;this.pointerType=ja(a.pointerType)?a.pointerType:ui[a.pointerType]||"";this.f=a;a.defaultPrevented&&this.a()}}xa(ti,si);var ui={2:"touch",3:"pen",4:"mouse"};ti.prototype.a=function(){ti.sf.a.call(this);var a=this.f;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,qi)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var vi="closure_listenable_"+(1E6*Math.random()|0),wi=0;function xi(a,b,c,d,e){this.listener=a;this.a=null;this.src=b;this.type=c;this.capture=!!d;this.c=e;this.key=++wi;this.rc=this.b=!1}function yi(a){a.rc=!0;a.listener=null;a.a=null;a.src=null;a.c=null};function zi(a){this.src=a;this.a={};this.b=0}zi.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var h=Ai(a,b,d,e);-1<h?(b=a[h],c||(b.b=!1)):(b=new xi(b,this.src,f,!!d,e),b.b=c,a.push(b));return b};zi.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=Ai(e,b,c,d);return-1<b?(yi(e[b]),Ia(e,b),0==e.length&&(delete this.a[a],this.b--),!0):!1};
  function Bi(a,b){var c=b.type;c in a.a&&Ha(a.a[c],b)&&(yi(b),0==a.a[c].length&&(delete a.a[c],a.b--))}function Ai(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.rc&&f.listener==b&&f.capture==!!c&&f.c==d)return e}return-1};var Ci="closure_lm_"+(1E6*Math.random()|0),Di={},Ei=0;function Fi(a,b,c,d,e){if(d&&d.once)Gi(a,b,c,d,e);else if(ma(b))for(var f=0;f<b.length;f++)Fi(a,b[f],c,d,e);else c=Hi(c),a&&a[vi]?a.a.add(String(b),c,!1,qa(d)?!!d.capture:!!d,e):Ii(a,b,c,!1,d,e)}
  function Ii(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var h=qa(e)?!!e.capture:!!e,k=Ji(a);k||(a[Ci]=k=new zi(a));c=k.add(b,c,d,h,f);if(!c.a){d=Ki();c.a=d;d.src=a;d.listener=c;if(a.addEventListener)ri||(e=h),void 0===e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(Li(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");Ei++}}
  function Ki(){var a=Mi,b=pi?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function Gi(a,b,c,d,e){if(ma(b))for(var f=0;f<b.length;f++)Gi(a,b[f],c,d,e);else c=Hi(c),a&&a[vi]?a.a.add(String(b),c,!0,qa(d)?!!d.capture:!!d,e):Ii(a,b,c,!0,d,e)}function Li(a){return a in Di?Di[a]:Di[a]="on"+a}
  function Ni(a,b,c,d){var e=!0;if(a=Ji(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.rc&&(f=Oi(f,d),e=e&&!1!==f)}return e}
  function Oi(a,b){var c=a.listener,d=a.c||a.src;if(a.b&&!t(a)&&a&&!a.rc){var e=a.src;if(e&&e[vi])Bi(e.a,a);else{var f=a.type,h=a.a;e.removeEventListener?e.removeEventListener(f,h,a.capture):e.detachEvent?e.detachEvent(Li(f),h):e.addListener&&e.removeListener&&e.removeListener(h);Ei--;(f=Ji(e))?(Bi(f,a),0==f.b&&(f.src=null,e[Ci]=null)):yi(a)}}return c.call(d,b)}
  function Mi(a,b){if(a.rc)return!0;if(!pi){if(!b)a:{b=["window","event"];for(var c=ia,d=0;d<b.length;d++)if(c=c[b[d]],null==c){b=null;break a}b=c}d=b;b=new ti(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(h){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.c;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.c=d[e];var f=Ni(d[e],a,!0,b);c=c&&f}for(e=0;e<d.length;e++)b.c=d[e],f=Ni(d[e],a,!1,b),c=c&&f}return c}return Oi(a,
  new ti(b,this))}function Ji(a){a=a[Ci];return a instanceof zi?a:null}var Pi="__closure_events_fn_"+(1E9*Math.random()>>>0);function Hi(a){if(oa(a))return a;a[Pi]||(a[Pi]=function(b){return a.handleEvent(b)});return a[Pi]};function Qi(a,b,c,d){this.g=a;this.a=b;this.h=c;this.c=b();a=null;qa(d)?(b=ni(d),null!=b&&"LABEL"==b.tagName&&(a=b)):(d=document.createElement("input"),d.type="checkbox",a=document.createElement("LABEL"),a.appendChild(d),a.appendChild(document.createTextNode(this.g)));this.b=d;this.b.checked=this.c;this.i=null!==a?a:this.b;Fi(this.b,"change",this.m,!0,this)}Qi.prototype.toString=function(){return""};Qi.prototype.ja=function(){return this.i};Qi.prototype.m=function(){Ri(this,!this.a())};
  Qi.prototype.ga=function(){Ri(this,this.a())};function Ri(a,b){a.a()!=b&&a.h(b);a.c!=a.a()&&(a.c=a.a(),a.b.checked=a.c)};function Si(a,b){Qi.call(this,a.getName(!0),v(a.N,a),v(a.dd,a),b);this.f=a;ec(this.f.ea(),this)}l(Si,Qi);Si.prototype.toString=function(){return""};Si.prototype.ga=function(a){a==this.f&&Qi.prototype.ga.call(this,a)};function Ti(a,b,c,d,e){this.h=c;this.o=d;this.g=a;this.c=b;this.b=ya(this.c,c());this.a=document.createElement("select");Ui(this);this.i=ja(e)?e:"";a=null;0<this.i.length&&(a=document.createElement("LABEL"),a.appendChild(document.createTextNode(this.i)),a.appendChild(this.a));this.a.selectedIndex=this.b;this.w=null!==a?a:this.a;Fi(this.a,"change",this.m,!0,this)}Ti.prototype.toString=function(){return""};
  function Ui(a){for(var b=a.a.options.length=0,c=a.g.length;b<c;b++)a.a.options[b]=new Option(a.g[b])}Ti.prototype.ja=function(){return this.w};Ti.prototype.m=function(){this.a.selectedIndex!==this.b&&Vi(this,this.a.selectedIndex)};Ti.prototype.ga=function(){var a=ya(this.c,this.h());Vi(this,a)};
  function Vi(a,b){if(a.b!==b){var c=a.a.options.length;if(a.c.length!=c)throw Error("ChoiceControl: values_.length="+a.c.length+" but menu.options.length="+c);try{-1>b?b=-1:b>c-1&&(b=c-1),a.b=b,-1<b&&a.o(a.c[b])}catch(d){alert(d),a.b=ya(a.c,a.h())}a.a.selectedIndex=a.b}};function Wi(a,b,c,d){c=void 0!==c?c:a.hc();d=void 0!==d?d:a.pc();b=void 0!==b?b:a.getName(!0);Ti.call(this,c,d,v(a.bd,a),v(a.sc,a),b);this.f=a;ec(this.f.ea(),this)}l(Wi,Ti);Wi.prototype.toString=function(){return""};Wi.prototype.ga=function(a){a.N()==this.f&&a.R("CHOICES_MODIFIED")?setTimeout(v(this.A,this),50):a==this.f&&Ti.prototype.ga.call(this,a)};
  Wi.prototype.A=function(){var a=this.f.hc();if(!Ua(this.g,a)){var b=this.f.pc();if(a.length!=b.length)throw Error();this.g=a;this.c=b;this.b=ya(this.c,this.h());Ui(this);this.a.selectedIndex=this.b}};function Xi(a,b,c){this.b=document.createElement("button");this.b.type="button";n(c)?(this.b.className="icon",this.b.appendChild(c)):this.b.appendChild(document.createTextNode(a));this.f=b;Fi(this.b,"mousedown",this.Og,!0,this);Fi(this.b,"mouseup",this.We,!0,this);Fi(this.b,"dragleave",this.We,!1,this);this.c=void 0;this.a=0}g=Xi.prototype;g.toString=function(){return""};g.ja=function(){return this.b};g.Og=function(){this.Xe()};g.We=function(){n(this.c)&&(clearTimeout(this.c),this.c=void 0)};
  g.Xe=function(){this.f();if(0<this.a){var a=n(this.c)?this.a:2*this.a;this.c=setTimeout(v(this.Xe,this),a)}};function Yi(a){this.a=a||Rb;this.o="14pt sans-serif";this.c="gray";this.g=0;this.h="VALUE";this.m=0;this.b="VALUE";this.f=0;this.$d="x";this.jd="y";this.i=100}g=Yi.prototype;g.toString=function(){return""};g.ib=function(){return!1};
  g.jb=function(a,b){a.save();a.strokeStyle=this.c;a.fillStyle=this.c;a.font=this.o;a.textAlign="start";a.textBaseline="alphabetic";var c=this.a;var d=c.ra(),e=c.a,f=c.b,h=c.ka();var k=e-.06*(e-d);var m=d+.01*(e-d);switch(this.b){case "VALUE":var p=this.m;p<m?p=m:p>k&&(p=k);k=sg(b,p);break;case "RIGHT":k=sg(b,k);break;case "LEFT":k=sg(b,m);break;default:k=sg(b,Ob(c))}m=tg(b,h);p=tg(b,f);switch(this.h){case "VALUE":c=tg(b,this.g);c<m+30?c=m+30:c>p-30&&(c=p-30);break;case "TOP":c=m+30;break;case "BOTTOM":c=
  p-30;break;default:c=tg(b,Pb(c))}a.beginPath();a.moveTo(sg(b,d),c);a.lineTo(sg(b,e),c);a.stroke();d=c;m=this.a;e=d-4;c=e+8;var q=m.ra();m=m.a;p=Zi(this,m-q);for(var r=Math.ceil(q/p)*p;r<m;){q=sg(b,r);a.beginPath();a.moveTo(q,e);a.lineTo(q,c);a.stroke();var u=r+p;if(u>r)r=r.toFixed(this.f),a.fillText(r,q-a.measureText(r).width/2,c+12);else{a.fillText("scale is too small",q,c+12);break}r=u}a.fillText(this.$d,sg(b,m)-a.measureText(this.$d).width-5,d-8);a.beginPath();a.moveTo(k,tg(b,f));a.lineTo(k,tg(b,
  h));a.stroke();f=k;d=this.a;h=f-4;k=h+8;c=d.b;d=d.ka();e=Zi(this,d-c);for(p=Math.ceil(c/e)*e;p<d;){c=tg(b,p);a.beginPath();a.moveTo(h,c);a.lineTo(k,c);a.stroke();m=p+e;if(m>p)p=p.toFixed(this.f),q=a.measureText(p).width,"RIGHT"===this.b?a.fillText(p,k-(q+10),c+6):a.fillText(p,k+5,c+6);else{a.fillText("scale is too small",k,c);break}p=m}h=a.measureText(this.jd).width;"RIGHT"===this.b?a.fillText(this.jd,f-(h+6),tg(b,d)+13):a.fillText(this.jd,f+6,tg(b,d)+13);a.restore()};g.cb=function(){return[]};
  function Zi(a,b){var c=Math.pow(10,Math.floor(Math.log(b)/Math.LN10));b/=c;c*=8<=b?2:5<=b?1:3<=b?.5:2<=b?.4:.2;b=Math.log(c)/Math.LN10;a.f=0>b?Math.ceil(-b):0;return c}g.Xa=function(){return K};g.Ra=function(){return[]};g.fa=function(){return this.i};g.eb=function(){return!1};g.Ka=function(a){this.c=a};g.Ya=function(){};function $i(a){a.h="BOTTOM";t(void 0)&&(a.g=void 0)}function aj(a){a.b="LEFT";t(void 0)&&(a.m=void 0)}g.ya=function(a){n(a)&&(this.i=a)};function bj(a,b){this.w=a;this.o=b;this.b=t(2)?2:1;this.a=qa(void 0)?void 0:K;this.f="14pt sans-serif";this.A="blue";this.m=this.g=1;this.i="black";this.h="rgba(255, 255, 255, 0.75)";this.c=0}g=bj.prototype;g.toString=function(){return""};g.ib=function(a){return Ab(a,this.a)<=this.b};
  g.jb=function(a,b){var c=rg(b,this.a),d=this.b*b.a;a.save();a.beginPath();a.arc(c.j(),c.l(),d,0,2*Math.PI,!1);a.closePath();a.lineWidth=this.m;a.strokeStyle=this.i;a.stroke();a.fillStyle=this.h;a.fill();d=this.w();var e=this.o();cj(this,a,b,"blue",d,c);cj(this,a,b,"red",e,c);b=d.toFixed(3);a.fillStyle=this.A;a.font=this.f;a.textAlign="center";a.fillText(b,c.j(),c.l());a.restore()};
  function cj(a,b,c,d,e,f){e-=2*Math.floor(e/2);var h=e/2;e=a.b*Math.sin(2*Math.PI*h)*c.a;c=a.b*Math.cos(2*Math.PI*h)*c.b;b.lineWidth=a.g;b.strokeStyle=d;b.beginPath();b.moveTo(f.j(),f.l());b.lineTo(f.j()+e,f.l()-c);b.stroke()}g.eb=function(){return!0};g.cb=function(){return[]};g.Xa=function(){return this.a};g.Ra=function(){return[]};g.fa=function(){return this.c};g.Ya=function(a){this.a=a};g.ya=function(a){this.c=n(a)?a:0};var dj={Jc:"show clock"};function ej(a,b){if(this.a=a)a.spellcheck=!1;if(this.f=b)b.spellcheck=!1;this.a&&Fi(this.a,"keydown",this.B,!1,this);this.a&&Fi(this.a,"change",this.C,!0,this);this.A=!1;this.g=[];this.b=-1;this.J=[];this.m=!1;this.o=[];this.F="myphysicslab goog length name terminal find".split(" ");this.h=null;this.i=0}ej.prototype.toString=function(){return""};function fj(a){return a.replace(/\\(x|u00)([0-9a-fA-F]{2})/g,function(a,c,d){return String.fromCharCode(Number("0x"+d))})}
  function gj(a){return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}
  ej.prototype.eval=function(a,b,c){b="boolean"==typeof b?b:!0;if((c=c||!1)&&!b)throw Error();a=fj(a).trim();if(!a.match(/^\s*$/)){this.i++;1<this.i&&(b=!1);b?(this.g.unshift(a),this.b=-1):(this.o.push(this.c),this.c=void 0);try{var d=a,e=/^\w\s*\[\s*\d*\s*\]$/,f=d.match(/\w\s*\[[^\]]*?\]/g);if(null!=f)for(var h=0,k=f.length;h<k;h++)if(!e.test(f[h]))throw Error("prohibited usage of square brackets in script: "+d+" Only positive integer is allowed in brackets.  Try using Util.get(array, index) or Util.set(array, index, value).");
  for(f=["",a];f=hj(f[1]),f[0];){var m=f[0].trim();if(0!=m.length)a:{b&&ij(this,"> "+m);if(null!=this.h){b:{var p=this.h;k=m;";"==k.slice(-1)&&(k=k.slice(0,k.length-1));d=0;for(var q=p.b.length;d<q;d++)if(k.toLowerCase()==p.b[d]){var r=p.m[d]();break b}var u=k.split("="),x=E(u[0].trim()),C=jj(p,x);if(null==C||2<u.length)r=void 0;else{if(2==u.length)try{var y=u[1].trim();if(2>y.length)var w=y;else{var H=y.charAt(0);if(H!=y.charAt(y.length-1)||'"'!=H&&"'"!=H)w=y;else{k="";d=1;for(var L=y.length-1;d<L;d++){var ca=
  y[d];if("\\"==ca)if(d++,d<L)switch(ca=y[d],ca){case "0":k+="\x00";break;case "b":k+="\b";break;case "t":k+="\t";break;case "n":k+="\n";break;case "v":k+="\v";break;case "f":k+="\f";break;case "r":k+="\r";break;case '"':k+='"';break;case "'":k+="'";break;case "\\":k+="\\";break;default:k+="\\"+ca}else k+=ca;else k+=ca}w=k}}C.sc(w)}catch(pa){throw pa.message+='\nwhile setting value "'+w+'" on parameter '+x,pa;}r=C.N()}}if(void 0!==r){this.c=r;break a}}var Sa=kj(this,m);console.log("JavaScript is disabled due to advanced compilation; try a simple-compiled version: "+
  Sa);ij(this,"JavaScript is disabled due to advanced compilation; try a simple-compiled version");this.c=void 0}}b&&n(this.c)&&";"!=a.slice(-1)&&ij(this,String(this.c));b&&n(this.w)&&this.w()}catch(pa){if(b?(this.c=void 0,ij(this,pa)):this.c=this.o.pop(),!c)throw this.i--,pa.message+="\nScript: "+a,pa;}this.i--;if(b)return lj(this),this.c;a=this.c;this.c=this.o.pop();return a}};
  function kj(a,b){b=mj(b);for(var c="",d=0;b;){if(1E4<++d)throw Error("Terminal.expand");var e=b.match(/^[^'"/]+/);if(null!==e&&(e=e[0],b=b.slice(e.length),e=Ca(a.J,function(a,b){return a.replace(b.zi,b.replace)},e),nj(e,a.F),c+=e,0==b.length))break;if(c.match(/.*[=(][ ]*$/)&&(e=b.match(/^\/[^*/](\\\/|[^\\/])*\//),null!==e)){e=e[0];b=b.slice(e.length);c+=e;continue}0<b.length&&"/"==b[0]?(c+="/",b=b.slice(1)):(e=b.match(/^"(\\.|[^\\"])*"/),null!==e?(e=e[0],b=b.slice(e.length),c+=e):0<b.length&&'"'==
  b[0]?(c+='"',b=b.slice(1)):(e=b.match(/^'(\\.|[^\\'])*'/),null!==e?(e=e[0],b=b.slice(e.length),c+=e):0<b.length&&"'"==b[0]&&(c+="'",b=b.slice(1))))}return c}
  ej.prototype.B=function(a){this.a&&this.f&&(a.metaKey&&75==a.b?(this.f.value="",a.a()):38==a.b||40==a.b?(-1==this.b&&""!=this.a.value&&(this.g.unshift(this.a.value),this.b=0),38==a.b?this.b<this.g.length-1&&(this.b++,this.a.value=this.g[this.b]):40==a.b&&(0<this.b?(this.b--,this.a.value=this.g[this.b]):(this.b=-1,this.a.value="")),a.a()):13==a.b&&this.eval(this.a.value,!0,!0))};ej.prototype.C=function(){this.a&&this.eval(this.a.value,!0,!0)};
  function oj(){var a=window.location.href,b=a.indexOf("?");-1<b&&(a=a.slice(0,b));return a}function ij(a,b){a.f&&(a.f.value+=b+"\n",lj(a))}function pj(a){a.m=!0;try{var b=window.localStorage;if(null!=b){var c=b.getItem(oj());c&&(ij(a,"//start of stored scripts"),A(c.split("\n"),function(a){this.eval(a)},a),ij(a,"//end of stored scripts"))}}catch(d){ij(a,"//cannot access localStorage due to: "+d)}a.m=!1}function mj(a){var b=a.match(/^\s*var\s+(\w[\w_\d]*)(.*)/);return b?b[1]+b[2]:a}
  function lj(a){a.a&&a.f&&(a.f.scrollTop=a.f.scrollHeight-a.f.offsetHeight,a.a.value="")}function qj(a,b){a.w=b}
  function hj(a){var b=0,c="",d="",e=!1,f=!1,h=!1,k="",m;var p=0;for(m=a.length;p<m;p++){var q=d;" "!=d&&"\t"!=d&&"\n"!=d&&(c=d);d=a[p];var r=p+1<m?a[p+1]:"\x00";if(e){if("\n"==d&&(e=!1,0==b))break}else if(f)"/"==d&&"\\"!=q&&(f=!1);else if(h)d==k&&"\\"!=q&&(h=!1,k="");else if("/"==d)"/"==r?e=!0:"*"==r||!c||"="!=c&&"("!=c||(f=!0);else if('"'==d||"'"==d)h=!0,k=d;else if(";"==d&&0==b)break;else"{"==d?b++:"}"==d&&b--}return[a.slice(0,p+1),a.slice(p+1)]}
  function nj(a,b){for(var c in window){a:{var d=0;for(var e=b.length;d<e;d++)if(c==b[d]){d=!1;break a}d=(new RegExp("\\b"+c+"\\b","g")).test(a)}if(d)throw Error('prohibited name: "'+c+'" found in script: '+a);}if(/\b(myEval|Function|with|__proto__|call|apply|caller|callee|arguments|addWhiteList|vetCommand|badCommand|whiteList_|addRegex|addRegex2|regexs_|afterEvalFn_|setAfterEval|parentNode|parentElement|innerHTML|outerHTML|offsetParent|insertAdjacentHTML|appendChild|insertBefore|replaceChild|removeChild|ownerDocument|insertBefore|setParser|defineNames|globalEval|window|defineProperty|defineProperties|__defineGetter__|__defineSetter__)\b/g.test(a))throw Error("prohibited name in script: "+
  a);};function rj(a,b){sj(a);this.c=a;this.h=ma(b)?b:[];Ja(this.c,function(a){return B(this.h,a)},this);this.c=Ka(this.c,this.h);this.w=[];this.i=[];this.f=[];this.a=[];this.g=[];this.A=[];this.b=[];this.m=[];this.o=[];tj(this,"url",v(function(){return uj(this)},this),"prints URL with script to recreate current state");tj(this,"script",v(function(){return vj(this)},this),"prints script to recreate current state");tj(this,"values",v(function(){return db(wj(this,!1,!0,!0)+wj(this,!0,!0,!0))},this),"shows available parameters and their current values");
  tj(this,"names",v(function(){return db(Ma(this.f).join(";"))},this),"shows available parameter names (format is SUBJECT.PARAMETER)");tj(this,"help",v(function(){var a='myPhysicsLab version 2.0.0, advanced-compiled on 2020-02-21 12:51:06.\nUse the "values" command to see what can be set and the syntax.\n\ncommand-K            clear Terminal window\narrow up/down        retrieve previous or next command\n';for(var b=0,e=this.b.length;b<e;b++){for(var f=this.b[b];20>f.length;)f+=" ";a+=f+" "+this.o[b]+
  "\n"}return a},this),"prints this help text");xj(this)}rj.prototype.toString=function(){return""};function tj(a,b,c,d){a.b.push(b);a.m.push(c);a.o.push(d)}function sj(a){var b=[];A(a,function(a){a=a.getName();if(B(b,a))throw Error("duplicate Subject name: "+a);b.push(a)})}
  function jj(a,b){b=E(b);var c=b.split(".");if(1==c.length){var d="";var e=c[0]}else if(2==c.length)d=c[0],e=c[1];else return null;if(""==d){if(1<Da(a.a,function(a){return a==e}))throw Error("multiple Subjects have Parameter "+e);b=ya(a.a,e)}else b=ya(a.f,b);return-1<b?a.g[b].cd(e):null}rj.prototype.ea=function(){var a=E(void 0);return Ea(this.c,function(b){return b.getName()==a})};
  function wj(a,b,c,d){b=1==b;var e=Ba(a.g,function(a,b){return a.cd(this.a[b])},a),f=e;c||(f=Aa(f,function(a){return!a.Yb()}));f=Aa(f,function(a){return B(this.h,a.ea())==b},a);var h=/^[a-zA-Z0-9_]+$/;a=Ba(f,function(a){var b=E(a.getName()),c=ya(e,a),f=a.N();ja(f)&&!h.test(f)&&(f='"'+f+'"');return!d&&this.A[c]?b+"="+f:E(a.ea().getName())+"."+b+"="+f},a);return 0<a.length?a.join(";")+";":""}
  function vj(a){var b=wj(a,!1).split(";");b=Ka(b,wj(a,!0).split(";"));var c=Ka(a.w,a.i);Ja(b,function(a){return B(c,a)});return b.join(";")+(0<b.length?";":"")}function uj(a){return window.location.href.replace(/\.html\?.*$/,".html")+"?"+gj(vj(a))}
  function xj(a){var b=Ca(a.c,function(a,b){b=Aa(b.getParameters(),function(a){return"DELETED"!=a.getName()});return a.concat(b)},[]);a.g=Ba(b,function(a){return a.ea()});a.a=Ba(b,function(a){return E(a.getName())});a.f=Ba(b,function(a){return E(a.ea().getName()+"."+a.getName())});a.A=Ba(a.a,function(a){return 1==Da(this.a,function(b){return b==a})},a);a.i=wj(a,!0).split(";")}
  var yj={Sf:"share",Jf:"Press command-C to copy this URL to the clipboard, it will replicate this simulation with current parameters.",Wf:"WARNING: URL is longer than 2048 characters."};function zj(a){this.za="10pt sans-serif";this.Ha=a;this.a=Rb;this.A=this.f=this.b=0;this.c=10;this.o=2;this.i=!0;this.Z="#666";this.Ga="#999";this.va="#ccc";this.J=jb();this.O=this.D=this.U=0;this.ia=1;this.V=sb;this.g=this.F=this.C=this.h=0;this.w=Array(12);this.B=0;this.m=Rb;this.H=!0;this.ha=0}g=zj.prototype;g.toString=function(){return""};g.ib=function(a){return Mb(this.a,a)};
  g.jb=function(a,b){if(!this.m.Va()){a.save();a.font=this.za;a.textAlign="start";a.textBaseline="alphabetic";var c=Ff(this.Ha),d=c.c,e=c.b,f=c.a,h=Aj.Ke+",";isNaN(f)&&(h=Aj.Cc+",");var k=58/b.b;if(this.H||this.a.Va()||F(k,this.a.S())){var m=this.a.Va()?this.m.ka():this.a.ka(),p=m-k;m>this.m.ka()||k>this.m.S()?(m=this.m.ka(),p=m-k):p<this.m.b&&(p=this.m.b,m=p+k);this.a=new M(this.m.ra(),p,this.m.a,m);this.i=!0;this.H=!1}this.f=sg(b,this.a.ra())+10;this.A=sg(b,this.a.a);k=this.A-this.f;b=tg(b,this.a.ka());
  a.fillStyle="rgba(255,255,255,0.75)";a.fillRect(this.f-10,b,k+10,58);this.g=d+e+(isNaN(f)?0:f);this.F=0>e?e:0;.3<jb()-this.V&&(this.V=jb(),this.O=this.D,this.D=mf(c));c=this.F;d=jb();1<d-this.U?(this.U=d,++this.B>=this.w.length&&(this.B=0),this.w[this.B]=c):this.F<this.w[this.B]&&(this.w[this.B]=c);12<d-this.J?(this.J=d,c=!0):c=!1;m=d=0;for(p=this.w.length;m<p;m++)this.w[m]<d&&(d=this.w[m]);this.h=d;-1E-6>this.h?(this.b+Math.floor(.5+this.h*this.c)<this.f-10&&(this.i=!0),c&&-this.h*this.c<.2*(this.b-
  this.f)&&(this.i=!0)):1E-6<this.h?this.b>this.f&&(this.i=!0):c&&10<this.b-this.f&&(this.i=!0);this.g>this.C&&(this.C=this.g);1E-12<this.g?(this.b+this.g*this.c>this.A&&(this.i=!0),this.A-this.b>.2*(this.b-this.f)&&this.g*this.c<.2*(this.A-this.b)&&(this.i=!0,this.C=this.g)):-1E-12>this.g&&c&&(0>this.C&&this.b<this.A&&(this.i=!0),this.C=this.g);this.i&&(this.J=jb(),this.i=!1,c=0<this.g?this.g:0,c-=this.h,1E-16>c&&(c=1),this.c=c*this.c>k?.75*k/c:.95*k/c,this.b=-1E-12>this.h?this.f+Math.floor(.5+this.c*
  -this.h):this.f,k=Math.pow(10,Math.floor(Math.log(c)/Math.log(10))),c/=k,this.o=8<=c?2:5<=c?1:3<=c?.5:2<=c?.4:.2,this.o*=k);k=this.b;a.fillStyle=this.Z;0>e?(e=Math.floor(.5-e*this.c),a.fillRect(k-e,b,e,10),k-=e):(e=Math.floor(.5+e*this.c),a.fillRect(k,b+10,e,10),k+=e);isNaN(f)||(e=Math.floor(.5+f*this.c),a.fillStyle=this.va,a.fillRect(k,b+10,e,10),k+=e);e=this.b+Math.floor(.5+this.g*this.c)-k;a.fillStyle=this.Ga;a.fillRect(k,b+10,e,10);e=this.f;b+=10;k=(this.A-this.b)/this.c;if(1E-18<Math.abs(k)&&
  1E-18<this.o){a.fillStyle="#000";a.strokeStyle="#000";c=0;do d=this.b+Math.floor(c*this.c),a.beginPath(),a.moveTo(d,b+5),a.lineTo(d,b+12),a.stroke(),m=Bj(c),p=a.measureText(m).width,a.fillText(m,d-p/2,b+25),c+=this.o;while(c<k+this.o+1E-16);if(-1E-12>this.h){c=-this.o;do d=this.b+Math.floor(c*this.c),a.beginPath(),a.moveTo(d,b+5),a.lineTo(d,b+12),a.stroke(),m=Bj(c),p=a.measureText(m).width,a.fillText(m,d-p/2,b+25),c-=this.o;while(c>this.h&&d>=e)}}e=b+33;b=this.f;b=Cj(a,Aj.Fc+",",this.Z,b,e);isNaN(f)||
  (b=Cj(a,Aj.Ee+",",this.va,b,e));b=Cj(a,h,this.Ga,b,e);f=Aj.Ie+" ";h=this.D;k=Math.abs(h-this.O);1E-15<k&&(k=-Math.floor(Math.log(k)/Math.log(10)),k=0<k?k:1,this.ia=20>k?k:20);k=Math.abs(h);h=0>h?"-":"+";f+=1E-6>k?h+k.toExponential(5):h+k.toFixed(this.ia);a.fillStyle="#000";a.fillText(f,b,e+12);a.restore()}};function Cj(a,b,c,d,e){a.fillStyle=c;a.fillRect(d,e,10,10);d+=13;c=a.measureText(b).width;a.fillStyle="#000";a.fillText(b,d,e+12);return d+(c+5)}g.Ra=function(){return[]};g.cb=function(){return[]};
  g.Xa=function(){return this.a.Va()?new I(0,0):Nb(this.a)};g.fa=function(){return this.ha};g.eb=function(){return!0};
  function Bj(a){var b=Math.abs(a);1E-16>b?b="0":.001>b?(b=b.toExponential(3),b=b.replace(/\.0+([eE])/,"$1"),b=b.replace(/(\.\d*[1-9])0+([eE])/,"$1$2")):10>b?(b=b.toFixed(4),b=b.replace(/\.0+$/,""),b=b.replace(/(\.\d*[1-9])0+$/,"$1")):100>b?(b=b.toFixed(3),b=b.replace(/\.0+$/,""),b=b.replace(/(\.\d*[1-9])0+$/,"$1")):1E3>b?(b=b.toFixed(2),b=b.replace(/\.0+$/,""),b=b.replace(/(\.[1-9])0$/,"$1")):1E4>b?b=b.toFixed(0):(b=b.toExponential(3),b=b.replace(/\.0+([eE])/,"$1"),b=b.replace(/(\.\d*[1-9])0+([eE])/,
  "$1$2"));return 0>a?"-"+b:b}g.Ya=function(a){if(this.a.Va())this.a=new M(-5,a.l()-.5,5,a.l()+.5);else{var b=this.a.S()/2;this.a=new M(this.a.ra(),a.l()-b,this.a.a,a.l()+b)}};function Gj(a,b){a.m=b;a.H=!0}g.ya=function(a){this.ha=n(a)?a:0};var Hj={Fe:"show energy",Fc:"potential",Ke:"translational",Cc:"kinetic",Ee:"rotational",Ie:"total"},Aj=Hj;function Ij(a,b){ec(a,this);this.a=b}Ij.prototype.toString=function(){return""};Ij.prototype.ga=function(a){this.a(a)};function Jj(a){this.a=a}Jj.prototype.toString=function(){return""};Jj.prototype.ja=function(){return this.a};function Kj(){this.b=[];this.a=!1}Kj.prototype.toString=function(){return""};Kj.prototype.Aa=function(a){if(this.a)throw Error("addMemo during memorize");B(this.b,a)||this.b.push(a)};Kj.prototype.Ma=function(){try{this.a=!0,A(this.b,function(a){a.Ma()})}finally{this.a=!1}};Kj.prototype.Nb=function(a){if(this.a)throw Error("removeMemo during memorize");Ha(this.b,a)};function Lj(a,b){this.a=null!=a?a:null;this.b=null!=b?b:null}g=Lj.prototype;g.toString=function(){return""};g.ib=function(){return!1};
  g.jb=function(a,b){if(null!=this.a){var c=this.a;c=Ab(c.aa(),c.W());if(!(1E-6>c||0==this.a.f)){a.save();a.lineWidth=Mj(this);a.strokeStyle=c<this.a.a-1E-5?Nj(this):Oj(this);if(1===Pj(this)){b=b.i;var d=this.a.W(),e=this.a.aa();b=b.translate(d.j(),d.l());b=sc(b,Math.atan2(e.l()-d.l(),e.j()-d.j()));c=b=b.scale(c/6,this.P()/.5);a.beginPath();rc(c,a);pc(c,.375,0,a);pc(c,.75,.25,a);for(d=1;3>=d;d++)pc(c,1.5*d,-.25,a),pc(c,.375*(4*d+2),.25,a);pc(c,5.625,0,a);pc(c,6,0,a)}else d=rg(b,this.a.W()),e=rg(b,this.a.aa()),
  a.beginPath(),a.moveTo(d.j(),d.l()),a.lineTo(e.j(),e.l());a.stroke();a.restore()}}};function Nj(a){return void 0!==a.h?a.h:null!=a.b?Nj(a.b):"red"}function Oj(a){return void 0!==a.i?a.i:null!=a.b?Oj(a.b):"green"}function Pj(a){return void 0!==a.m?a.m:null!=a.b?Pj(a.b):1}g.cb=function(){return[]};g.Xa=function(){return null==this.a?K:Gb(this.a.W().add(this.a.aa()),.5)};g.Ra=function(){return null==this.a?[]:[this.a]};function Mj(a){return void 0!==a.c?a.c:null!=a.b?Mj(a.b):4}
  g.P=function(){return void 0!==this.f?this.f:null!=this.b?this.b.P():.5};g.fa=function(){return void 0!==this.g?this.g:null!=this.b?this.b.fa():0};g.eb=function(){return!1};g.Ya=function(){};function Qj(a){var b=new Lj;b.c=a;return b}function Rj(a,b){a.f=b;return a}g.ya=function(a){this.g=a};function Sj(a){P.call(this,a||"DISPLAY_LIST_"+Tj++);this.a=[]}l(Sj,P);g=Sj.prototype;g.toString=function(){return""};g.add=function(a){if(!qa(a))throw Error("non-object passed to DisplayList.add");var b=a.fa();Uj(this);for(var c=0,d=this.a.length;c<d&&!(b<this.a[c].fa());c++);Oa(this.a,c,0,a);Xb(this,new N(this,"OBJECT_ADDED",a))};g.gf=function(a){if(!qa(a))throw Error("non-object passed to DisplayList.contains");return B(this.a,a)};function Vj(a,b,c){Uj(a);A(a.a,function(a){a.jb(b,c)})}
  function Wj(a,b){if(t(b)){var c=a.a.length;if(0>b||b>=c)return null;Uj(a);return a.a[b]}if(ja(b)){var d=E(b);return Ea(a.a,function(a){a=a.Ra();for(var b=0,c=a.length;b<c;b++)if(a[b].getName()==d)return!0;return!1})}return qa(b)?Ea(a.a,function(a){return B(a.Ra(),b)}):null}function Xj(a,b){a=Wj(a,b);if(a instanceof ug)return a;throw Error("DisplayShape not found: "+b);}g.get=function(a){var b=this.a.length;if(0>a||a>=b)throw Error(a+" is not in range 0 to "+(b-1));Uj(this);return this.a[a]};
  g.length=function(){return this.a.length};function Yj(a,b){if(!qa(b))throw Error("non-object passed to DisplayList.add");var c=b.fa();Uj(a);for(var d=a.a.length;0<d&&!(c>a.a[d-1].fa());d--);Oa(a.a,d,0,b);Xb(a,new N(a,"OBJECT_ADDED",b))}g.remove=function(a){if(!qa(a))throw Error("non-object passed to DisplayList.remove");var b=ya(this.a,a);-1<b&&(Ia(this.a,b),Xb(this,new N(this,"OBJECT_REMOVED",a)))};
  function Uj(a){for(var b=!0,c=sb,d=0,e=a.a.length;d<e;d++){var f=a.a[d].fa();if(f<c){b=!1;break}c=f}b||Ta(a.a,function(a,b){a=a.fa();b=b.fa();return a<b?-1:a>b?1:0})}var Tj=1;function Zj(a,b){P.call(this,b);this.a=a;a.contentEditable=!1;this.g=[];this.h=new Kj;this.f=null;this.c=1;this.b="";this.I(new O(this,ak.ab,bk.ab,v(this.P,this),v(this.eh,this)));this.I(new O(this,ak.$a,bk.$a,v(this.S,this),v(this.dh,this)));this.I(new O(this,ak.ALPHA,bk.ALPHA,v(this.bg,this),v(this.wb,this)));this.I(new bc(this,ak.bc,bk.bc,v(this.eg,this),v(this.lb,this)))}l(Zj,P);g=Zj.prototype;g.toString=function(){return""};g.Aa=function(a){this.h.Aa(a)};
  function ck(a,b){if(0<a.P()&&0<a.S()){var c=new ig(a.P(),a.S());dk(b,c)}a.g.push(b);a.Aa(b);Xb(a,new N(a,"VIEW_ADDED",b));Xb(a,new N(a,"VIEW_LIST_MODIFIED"));if(null==a.f){if(null!=b&&!B(a.g,b))throw Error("cannot set focus to unknown view "+b);a.f!=b&&(a.f=b,Xb(a,new N(a,"FOCUS_VIEW_CHANGED",b)))}}g.bg=function(){return this.c};g.eg=function(){return this.b};g.S=function(){return this.a.height};function ek(a){return new ig(a.a.width,a.a.height)}g.P=function(){return this.a.width};g.Ma=function(){this.h.Ma()};
  function fk(a){var b=ek(a);A(a.g,function(a){dk(a,b)});Xb(a,new N(a,"SIZE_CHANGED"))}function gk(a){if(null!=a.a.offsetParent){var b=a.a.getContext("2d");b.save();try{""!=a.b?(b.globalAlpha=a.c,b.fillStyle=a.b,b.fillRect(0,0,a.a.width,a.a.height),b.globalAlpha=1):b.clearRect(0,0,a.a.width,a.a.height),A(a.g,function(a){b.save();b.globalAlpha=a.H;Vj(a.h,b,a.g);b.restore()})}finally{b.restore()}}}g.Nb=function(a){this.h.Nb(a)};
  g.wb=function(a){F(this.c,a)&&(this.c=a,F(a,1)&&""==this.b&&this.lb("white"),Q(this,ak.ALPHA))};g.lb=function(a){this.b!=a&&(this.b=a,Q(this,ak.bc))};g.dh=function(a){F(a,this.a.height)&&(this.a.height=a);fk(this);Q(this,ak.$a)};function hk(a,b,c){if(!t(b)||0>=b||!t(c)||0>=c)throw Error("bad size "+b+", "+c);a.a.width=b;a.a.height=c;fk(a);Q(a,ak.ab);Q(a,ak.$a)}g.eh=function(a){F(a,this.a.width)&&(this.a.width=a);fk(this);Q(this,ak.ab)};
  var ak={ab:"width",$a:"height",ALPHA:"alpha",bc:"background"},bk=ak;function ik(a){P.call(this,a||"CLOCK");this.m=this.h=jb();this.b=1;this.f=this.c=0;this.g=this.a=!1;this.i=[];this.I(new O(this,jk.Lc,kk.Lc,v(this.Fg,this),v(this.Nh,this)))}l(ik,P);g=ik.prototype;g.toString=function(){return""};function lk(a){A(a.i,function(a){a.cancel()})}function mk(a,b,c){A(a.i,function(a){a.a()>=b&&a.a()<=b+c&&a.b(0)})}g.Xc=function(){return this.a?(jb()-this.m)*this.b:this.f};function nk(a){return a.a?(jb()-a.h)*a.b:a.c}g.Fg=function(){return this.b};
  function ok(a){a.g=!1;a.a&&(a.c=nk(a),a.f=a.Xc(),lk(a),a.a=!1,Xb(a,new N(a,"CLOCK_PAUSE")))}function pk(a){a.g=!1;a.a||(a.a=!0,qk(a,a.c),rk(a,a.f),Xb(a,new N(a,"CLOCK_RESUME")))}g.uh=function(a){a.cancel();if(this.a){var b=nk(this)/this.b+this.h;var c=a.a()/this.b+this.h;F(c,b)?c>b&&a.b(c-b):a.c()}};function rk(a,b){a.a?a.m=jb()-b/a.b:a.f=b}function sk(a,b){var c=nk(a);F(c,b,.001)&&(qk(a,b),Xb(a,new N(a,"CLOCK_SET_TIME")))}function qk(a,b){a.a?(a.h=jb()-b/a.b,A(a.i,v(a.uh,a))):a.c=b}
  g.Nh=function(a){if(F(this.b,a)){var b=nk(this),c=this.Xc();this.b=a;qk(this,b);rk(this,c);nk(this);this.Xc();Q(this,jk.Lc)}};var jk={Lc:"time rate"},kk=jk;function tk(){this.i=!oa(requestAnimationFrame);this.c=void 0;this.h=null;this.o=v(this.m,this);this.a=0;this.b=!1;this.f=rb;this.g=0}tk.prototype.toString=function(){return""};tk.prototype.m=function(){if(null!=this.h){var a=jb(),b=a-(this.f-this.g);b>=this.a&&(this.h(),this.f=a,this.g=0<this.a?b%this.a:0);this.c=this.i?setTimeout(this.o,0<this.a?Math.round(1E3*this.a):17):requestAnimationFrame(this.o)}};function uk(a){a.b||(a.b=!0,a.g=0,a.f=jb()-a.a-1E-7,a.m())}
  function vk(a){a.b=!1;n(a.c)&&(a.i?clearTimeout(a.c):cancelAnimationFrame(a.c),a.c=void 0);a.f=NaN;a.g=0};function wk(a,b){P.call(this,b||"SIM_RUNNER");this.c=[a];this.f=a.a;this.i=0;this.g=!1;this.b=new tk;var c=this.i;if(0>c)throw Error();this.b.a=c;c=this.b;var d=v(this.Zf,this);vk(c);c.h=d;this.a=new ik((b?b+"_":"")+"CLOCK");a=jd(a);sk(this.a,a);rk(this.a,a);ec(this.a,this);this.h=[];this.o=new Kj;this.m=[];this.I($b(new O(this,xk.Mc,yk.Mc,v(this.Mg,this),v(this.Ng,this)),3));this.I($b(new O(this,xk.od,yk.od,v(this.hg,this),v(this.xh,this)),3));this.I(new Vb(this,xk.Ic,yk.Ic,v(this.xg,this),v(this.Hh,
  this)));this.I(new Vb(this,xk.td,yk.td,v(this.mg,this),v(this.zh,this)));this.I(new Vb(this,xk.Cd,yk.Cd,v(this.tg,this),v(this.Eh,this)))}l(wk,P);g=wk.prototype;g.toString=function(){return""};function zk(a,b){B(a.h,b)||(a.h.push(b),a.Aa(b))}function Ak(a,b){B(a.m,b)||a.m.push(b)}g.Aa=function(a){this.o.Aa(a)};
  g.Zf=function(){try{if(this.a.a||this.a.g){var a=nk(this.a),b=jd(this.c[0]);if(a>b+1||a<b-1){var c=b+this.f;sk(this.a,c);rk(this.a,c);a=c}c=a;for(var d=0,e=this.c.length;d<e;d++)for(var f=this.c[d],h=c,k=jd(f);k<h;){Zc(f,this.f,this);var m=k;k=jd(f);if(1E-15>=k-m)throw Error("SimRunner: time did not advance");if(h-k<this.f)break}this.a.g?this.a.g=!1:(a=nk(this.a),b=jd(this.c[0]),a-b>20*this.f&&sk(this.a,b))}Bk(this)}catch(p){Ck(this,p)}};g.hg=function(){return this.i};g.mg=function(){return this.b.b};
  g.tg=function(){return this.g};g.xg=function(){return this.a.a};g.Mg=function(){return this.f};function Ck(a,b){Dk(a);vk(a.b);A(a.m,function(a){a.c&&Ek(a)});alert(yk.Pf+(null!=b?" "+b:""))}g.Ma=function(){this.o.Ma()};g.ga=function(a){a.ea()==this.a&&(a.R("CLOCK_RESUME")||a.R("CLOCK_PAUSE")?(a=jd(this.c[0]),sk(this.a,a),rk(this.a,a),Q(this,xk.Ic)):a.R("CLOCK_SET_TIME")&&this.Ma())};function Bk(a){A(a.h,function(a){gk(a)})}function Dk(a){ok(a.a);return nk(a.a)}g.Nb=function(a){this.o.Nb(a)};
  g.reset=function(){uk(this.b);ok(this.a);A(this.c,function(a){a.reset()});var a=jd(this.c[0]);sk(this.a,a);rk(this.a,a);Bk(this);Xb(this,new N(this,"RESET"));return nk(this.a)};function Fk(a){uk(a.b);pk(a.a);return nk(a.a)}function Gk(a){A(a.c,function(a){yf(a.f)});return nk(a.a)}g.xh=function(a){this.i=a;if(0>a)throw Error();this.b.a=a;Q(this,xk.od)};g.zh=function(a){a?uk(this.b):this.g||vk(this.b);Q(this,xk.td)};g.Eh=function(a){this.g=a;Q(this,xk.Cd)};g.Hh=function(a){a?Fk(this):Dk(this)};
  g.Ng=function(a){this.f=a;Q(this,xk.Mc)};g.$e=function(){var a=jd(this.c[0])+this.f-nk(this.a),b=this.a;ok(b);b.g=!0;var c=b.c;b.c+=a;b.f+=a;Xb(b,new N(b,"CLOCK_STEP"));mk(b,c,a);uk(this.b);return nk(this.a)};var xk={Mc:"time step",od:"display period",Mf:"restart",Ic:"running",td:"firing",li:"pause",oi:"resume",Cd:"non-stop",Of:"step",Pf:"Simulation is stuck; click reset and play to continue."},yk=xk;function Hk(a,b){P.call(this,a);if(!(b instanceof M)||b.Va())throw Error("bad simRect: "+b);this.b=b;this.f=new ig(800,600);this.C=this.A="MIDDLE";this.w=1;this.h=new Sj;this.o=!0;this.H=1;this.g=og(this.f,this.b,this.A,this.C,this.w);this.c=b.P();this.a=b.S();this.i=Ob(b);this.m=Pb(b);this.B=this.a/this.c;this.F=new Kj;this.I(new O(this,Ik.ab,Jk.ab,v(this.P,this),v(this.hh,this)));this.I(new O(this,Ik.$a,Jk.$a,v(this.S,this),v(this.le,this)));this.I(Zb(new O(this,Ik.xc,Jk.xc,v(this.fh,this),v(this.gd,
  this)),Number.NEGATIVE_INFINITY));this.I(Zb(new O(this,Ik.yc,Jk.yc,v(this.gh,this),v(this.ne,this)),Number.NEGATIVE_INFINITY));this.I(new Vb(this,Ik.Hd,Jk.Hd,v(this.yg,this),v(this.pf,this)));this.I(new bc(this,Ik.Od,Jk.Od,v(this.Hg,this),v(function(a){Kk(this,lg(a))},this),[mg.Rf,mg.Bd,mg.wf,mg.ud,mg.Md],kg()));this.I(new bc(this,Ik.zd,Jk.zd,v(this.qg,this),v(function(a){Lk(this,gg(a))},this),[hg.Dc,hg.Bd,hg.Hc,hg.ud,hg.Md],fg()));this.I(new O(this,Ik.kd,Jk.kd,v(this.cg,this),v(this.vh,this)))}
  l(Hk,P);g=Hk.prototype;g.toString=function(){return""};g.Aa=function(a){this.F.Aa(a)};g.cg=function(){return this.w};g.fh=function(){return this.i};g.gh=function(){return this.m};g.S=function(){return this.a};g.qg=function(){return this.A};g.yg=function(){return this.o};g.Hg=function(){return this.C};g.P=function(){return this.c};g.Ma=function(){this.F.Ma()};function Mk(a){var b=a.i-a.c/2,c=a.m-a.a/2;b=new M(b,c,b+a.c,c+a.a);Nk(a,b)}g.qh=function(){this.ne(this.m-.05*this.a)};
  g.rh=function(){this.gd(this.i-.05*this.c)};g.sh=function(){this.gd(this.i+.05*this.c)};g.th=function(){this.ne(this.m+.05*this.a)};function Ok(a){var b=og(a.f,a.b,a.A,a.C,a.w);if(!(b instanceof ng))throw Error("not a CoordMap: "+b);a.g=b;Xb(a,new N(a,"COORD_MAP_CHANGED"));a.c=a.b.P();a.a=a.b.S();a.i=Ob(a.b);a.m=Pb(a.b);a.B=a.a/a.c}g.Nb=function(a){this.F.Nb(a)};g.vh=function(a){F(this.w,a)&&(this.w=a,Ok(this),Q(this,Ik.kd))};g.gd=function(a){F(this.i,a)&&(this.i=a,Mk(this))};
  g.ne=function(a){F(this.m,a)&&(this.m=a,Mk(this))};g.le=function(a){F(this.a,a)&&(this.a=a,this.o&&(this.c=this.a/this.B),Mk(this))};function Lk(a,b){a.A=gg(b);Ok(a);Q(a,Ik.zd)}g.pf=function(a){if(this.o!=a){if(this.o=a)this.B=this.a/this.c;Q(this,Ik.Hd)}};function dk(a,b){if(!(b instanceof ig))throw Error("not a ScreenRect: "+b);if(b.Va())throw Error("empty screenrect");a.f.Fb(b)||(a.f=b,Ok(a),Xb(a,new N(a,"SCREEN_RECT_CHANGED")))}
  function Nk(a,b){if(!(b instanceof M))throw Error("not a DoubleRect: "+b);b.Fb(a.b)||(a.b=b,Ok(a),Q(a,Ik.ab),Q(a,Ik.$a),Q(a,Ik.xc),Q(a,Ik.yc),Xb(a,new N(a,"SIM_RECT_CHANGED")))}function Kk(a,b){a.C=lg(b);Ok(a);Q(a,Ik.Od)}g.hh=function(a){F(this.c,a)&&(this.c=a,this.o&&(this.a=this.c*this.B),Mk(this))};g.Vh=function(){this.le(this.a/1.1)};g.Wh=function(){this.le(1.1*this.a)};
  var Ik={Hd:"scale X-Y together",ab:"width",$a:"height",xc:"center-x",yc:"center-y",Od:"vertical-align",zd:"horizontal-align",kd:"aspect-ratio"},Jk=Ik;function Pk(a,b,c){this.b=a;this.c=this.b.N();this.g=b;this.f=c;this.a=document.createElement("button");this.a.type="button";this.a.className="icon";c.style.display=this.c?"block":"none";b.style.display=this.c?"none":"block";this.a.appendChild(b);this.a.appendChild(c);Fi(this.a,"click",this.h,!0,this);ec(this.b.ea(),this)}Pk.prototype.toString=function(){return""};Pk.prototype.ja=function(){return this.a};Pk.prototype.h=function(){Qk(this,!this.c)};Pk.prototype.ga=function(a){a==this.b&&Qk(this,this.b.N())};
  function Qk(a,b){a.c!=b&&(a.b.dd(b),a.c=b,a.f.style.display=b?"block":"none",a.g.style.display=b?"none":"block")};function Rk(a,b){var c=new Yi(a.b);b&&($i(c),aj(c));new Ij(a,function(b){b.R("COORD_MAP_CHANGED")&&(b=qg(a.g,a.f),c.a=b)});a.h.add(c);return c}
  function Sk(a){var b=[Tk.Tc,Tk.vc,Tk.Ne,Tk.te,Tk.Me,Tk.se],c=[Uk.Tc,Uk.vc,Uk.Ne,Uk.te,Uk.Me,Uk.se];c=Ba(c,function(a){return E(a)});b=new Ti(b,c,function(){var b=a.b,e=a.c;if(""==b)return c[0];if("black"==b)if(F(e,1)){if(!F(e,.1))return c[3];if(!F(e,.05))return c[5]}else return c[1];else if("white"==b)if(F(e,1)){if(!F(e,.1))return c[2];if(!F(e,.05))return c[4]}else return c[0];return-1},function(b){switch(ya(c,b)){case 0:a.lb("");a.wb(1);break;case 1:a.lb("black");a.wb(1);break;case 2:a.lb("white");
  a.wb(.1);break;case 3:a.lb("black");a.wb(.1);break;case 4:a.lb("white");a.wb(.05);break;case 5:a.lb("black"),a.wb(.05)}},Tk.bc);ec(a,b);return b}
  function Vk(a,b){var c=ib+"/",d=document.createElement("div");d.style.width="96px";var e=Xa(c+"up_gray.png");e=new Xi("up",v(a.th,a),e);e.a=100;d.appendChild(e.ja());var f=document.createElement("div");f.style.width=d.style.width;e=Xa(c+"backward_gray.png");e=new Xi("left",v(a.rh,a),e);e.a=100;f.appendChild(e.ja());e=Xa(c+"target_gray.png");e=new Xi("reset",b,e);f.appendChild(e.ja());e=Xa(c+"forward_gray.png");e=new Xi("right",v(a.sh,a),e);e.a=100;f.appendChild(e.ja());var h=document.createElement("div");
  e=Xa(c+"down_gray.png");e=new Xi("down",v(a.qh,a),e);e.a=100;h.appendChild(e.ja());h.style.width=d.style.width;b=document.createElement("div");b.appendChild(d);b.appendChild(f);b.appendChild(h);b.style.textAlign="center";d=document.createElement("div");e=Xa(c+"plus_gray.png");e=new Xi("zoomIn",v(a.Vh,a),e);e.a=100;d.appendChild(e.ja());d.appendChild(document.createElement("BR"));e=Xa(c+"minus_gray.png");e=new Xi("zoomOut",v(a.Wh,a),e);e.a=100;d.appendChild(e.ja());d.style.cssFloat="right";d.style.marginTop=
  "18px";a=document.createElement("div");a.style.position="absolute";a.style.right="10%";a.style.bottom="12%";a.style.width="126px";a.appendChild(d);a.appendChild(b);a.style.display="none";return a}
  function Wk(a){var b=ib+"/",c=document.createElement("div");c.style.display="block";var d=Xa(b+"rewind.png");d=new Xi(yk.Mf,v(a.reset,a),d);c.appendChild(d.ja());d=Xa(b+"forward.png");var e=Xa(b+"pause.png");d=new Pk(hc(a,xk.Ic),d,e);c.appendChild(d.ja());d=Xa(b+"next.png");a=new Xi(yk.Of,v(a.$e,a),d);a.a=100;c.appendChild(a.ja());return new Jj(c)}
  function Xk(a,b,c,d){a=new rj(a,b);tj(a,"reset",function(){return c.reset()},"sets simulation to initial conditions");tj(a,"save",function(){return Gk(c)},"saves simulation initial conditions");tj(a,"step",function(){return c.$e()},"advance simulation by a small time increment");tj(a,"pause",function(){return Dk(c)},"pause simulation");tj(a,"resume",function(){return Fk(c)},"resume simulation");return d.h=a}
  function Yk(a,b,c){var d=b.h;b=new Vb(c,dj.Jc,dj.Jc,v(d.gf,d,a),function(b){b?d.add(a):d.remove(a);Q(c,dj.Jc)});c.I(b);new Ij(d,function(b){b.N()==a&&Q(c,dj.Jc)});return b}function Zk(a,b,c){var d=ja(void 0)?void 0:Hj.Fe,e=ja(void 0)?void 0:Aj.Fe,f=qg(b.g,b.f);Gj(a,f);var h=b.h;b=new Vb(c,d,e,v(h.gf,h,a),function(b){b?h.add(a):h.remove(a);Q(c,d)});c.I(b);new Ij(h,function(b){b.N()==a&&Q(c,d)});return b}
  function $k(a,b){var c=new Vb(b,Uk.Dd,Tk.Dd,function(){return"none"!=a.style.display},function(c){a.style.display=c?"block":"none";Q(b,Uk.Dd)});b.I(c);return c}function al(a,b){if(!n(a))throw Error();return new Xi(yj.Sf,function(){var c=uj(a),d=yj.Jf;2048<c.length&&(d=d+"  "+yj.Wf);var e=b.b.b;e&&(b.g||vk(b.b));window.prompt(d,c);e&&uk(b.b)})}
  var Uk={Dd:"pan-zoom",bc:"background",Tc:"white",vc:"black",Ne:"white with trails",te:"black with trails",Me:"white with long trails",se:"black with long trails"},Tk=Uk;function bl(a){this.c=a||3E3;if(2>this.c)throw Error();this.b=this.g=this.a=0;this.h=-1;this.f=Array(this.c)}bl.prototype.toString=function(){return""};function cl(a){return 0==a.a?-1:0==a.b?dl(a,a.a-1):dl(a,a.b-1)}function el(a){var b=cl(a);return-1==b?null:a.f[fl(a,b)]}bl.prototype.N=function(a){return this.f[fl(this,a)]};function fl(a,b){return a.a<a.c?b:b-(a.g-(b%a.c<a.b?0:1))*a.c}
  function dl(a,b){if(a.a<a.c)return b;a=b+(a.g-(b<a.b?0:1))*a.c;if(a>=qb)throw Error("exceeded max int");return a}bl.prototype.reset=function(){this.g=this.b=this.a=0;this.h=-1};bl.prototype.store=function(a){this.h=this.b;this.f[this.b]=a;this.b++;this.a<this.c&&this.a++;this.b>=this.c&&(this.g++,this.b=0);return dl(this,this.h)};
  function gl(a,b){this.c=0<a.a;this.a=a;if(void 0===b||0>b)b=a.a<a.c?0:dl(a,a.b);if(0<a.a&&(b<(a.a<a.c?0:dl(a,a.b))||b>cl(a)))throw Error("out of range startIndex="+b);this.b=b;this.f=fl(a,b)}function hl(a){if(0==a.a.a)throw Error("no data");return a.b}gl.prototype.N=function(){if(0==this.a.a)throw Error("no data");return this.a.f[this.f]};function il(a){return a.c||a.b<cl(a.a)}
  function jl(a){if(0===a.a.a)throw Error("no data");if(a.c)a.c=!1;else{if(a.b+1>cl(a.a))throw Error("cannot iterate past end of list");a.b++;a.f=fl(a.a,a.b)}return a.a.f[a.f]};function kl(a){for(var b=["dots","lines"],c=0,d=b.length;c<d;c++)if(a==b[c])return b[c];throw Error("not found "+a);}var ll={xf:"Dots",LINES:"Lines"};function ml(a,b,c,d){this.a=a;this.b=b;this.c=c;this.f=d}g=ml.prototype;g.toString=function(){return""};g.Fb=function(a){return this.a==a.a&&this.b==a.b&&this.c==a.c&&this.f==a.f};g.j=function(){return this.a};g.l=function(){return this.b};g.sa=function(){return 0};function nl(a,b,c,d){this.f=a;this.c=b;this.a=c;this.b=d}nl.prototype.toString=function(){return""};function ol(a,b,c){P.call(this,a);this.b=b;ec(b,this);this.f=this.a=-1;this.w=Zb(new O(this,pl.bb,ql.bb,v(this.Jg,this),v(this.Pa,this)),-1);this.I(this.w);this.o=Zb(new O(this,pl.pb,ql.pb,v(this.Ig,this),v(this.mb,this)),-1);this.I(this.o);rl(this);this.c=new bl(c||1E5);this.h="lime";this.i="lines";this.g=1;this.m=[];sl(this);this.A=function(a){return a};this.B=function(a){return a};this.I(new O(this,pl.LINE_WIDTH,ql.LINE_WIDTH,v(this.sg,this),v(this.Dh,this)));this.I(new bc(this,pl.Ac,ql.Ac,v(this.ig,
  this),v(function(a){a=kl(a);a=kl(a);this.i!=a&&(this.i=a,sl(this));Q(this,pl.Ac)},this),[ll.xf,ll.LINES],["dots","lines"]));this.I(new bc(this,pl.Bc,ql.Bc,v(this.Ug,this),v(this.Ka,this)))}l(ol,P);g=ol.prototype;g.toString=function(){return""};function sl(a){a.m.push(new nl(cl(a.c)+1,a.i,a.h,a.g))}function rl(a){for(var b=[ql.NONE],c=[-1],d=0,e=a.b.a.length;d<e;d++)b.push(Mc(a.b,d).getName(!0)),c.push(d);Wb(a.w,b,c);Wb(a.o,b,c)}function tl(a){return a instanceof ol?!0:!1}g.Ug=function(){return this.h};
  g.ig=function(){return this.i};function ul(a,b){a=a.m;if(0==a.length)throw Error("graph styles list is empty");for(var c=a[0],d=1,e=a.length;d<e;d++){var f=a[d];if(f.f>b)break;c=f}return c}g.sg=function(){return this.g};g.v=function(){return this.b};g.Ig=function(){return this.a};g.Jg=function(){return this.f};g.Ma=function(){if(-1<this.a&&-1<this.f){var a=Mc(this.b,this.a),b=Mc(this.b,this.f),c=a.N(),d=b.N();a=new ml(this.A(c),this.B(d),a.b,b.b);b=el(this.c);null!=b&&b.Fb(a)||this.c.store(a)}};
  g.ga=function(a){a.ea()==this.b&&a.R("VARS_MODIFIED")&&rl(this)};g.reset=function(){this.c.reset();this.m=[];sl(this);Xb(this,new N(this,"RESET"))};g.Ka=function(a){this.h!=a&&(this.h=a,sl(this),Q(this,pl.Bc))};g.Dh=function(a){F(a,this.g)&&(this.g=a,sl(this),Q(this,pl.LINE_WIDTH))};g.mb=function(a){if(-1>a||a>this.b.a.length-1)throw Error("setXVariable bad index "+a);a!=this.a&&(this.a=a,this.reset(),Q(this,pl.pb))};
  g.Pa=function(a){if(-1>a||a>this.b.a.length-1)throw Error("setYVariable bad index "+a);a!=this.f&&(this.f=a,this.reset(),Q(this,pl.bb))};var pl={Ac:"draw mode",Bc:"graph color",gi:"graph draw mode",hi:"graph points",LINE_WIDTH:"draw width",pb:"X variable",bb:"Y variable",ve:"clear graph",NONE:"-none-"},ql=pl;function vl(a,b,c){P.call(this,a);if(n(b)&&!tl(b))throw Error("not a GraphLine "+b);this.i=[];tl(b)&&(this.i.push(b),ec(b,this));this.w=c;c.Aa(this);ec(c,this);this.m=this.B=!0;this.C=!1;this.A="BOTH_AXES";this.o=Wa(-1,this.i.length);this.H=this.F=!1;this.g=this.b=this.f=this.a=0;this.c=10;this.h=.01;this.I($b(new O(this,wl.Nc,xl.Nc,v(this.Gg,this),v(this.Oh,this)),3));a=["VERTICAL","HORIZONTAL","BOTH_AXES"];this.I(new bc(this,wl.ld,xl.ld,v(this.dg,this),v(this.wh,this),a,a));this.I(new Vb(this,wl.uc,
  xl.uc,v(this.Sg,this),v(this.vb,this)));this.I(new Vb(this,wl.qd,xl.qd,v(this.jg,this),v(this.Tg,this)));yl(this,this.m)}l(vl,P);g=vl.prototype;g.toString=function(){return""};function zl(a,b){if(tl(b))B(a.i,b)||(a.i.push(b),a.o.push(-1));else throw Error("not a GraphLine "+b);}g.Sg=function(){return this.m};g.dg=function(){return this.A};g.jg=function(){return this.B};g.Gg=function(){return this.c};
  g.Ma=function(){for(var a=0,b=this.i.length;a<b;a++){var c=this.i[a].c;this.o[a]>cl(c)&&this.reset()}a=0;for(b=this.i.length;a<b;a++)for(c=this.i[a].c,c=new gl(c,this.o[a]);il(c);){var d=jl(c),e=this.i[a],f=d.a;d=d.b;isFinite(f)||(f==Number.POSITIVE_INFINITY?f=1E308:f==Number.NEGATIVE_INFINITY&&(f=-1E308));isFinite(d)||(d==Number.POSITIVE_INFINITY?d=1E308:d==Number.NEGATIVE_INFINITY&&(d=-1E308));var h=e.v().b,k=e.a==h;e=e.f==h;this.F?(f<this.f&&(k?(this.f=f,this.a=f+this.c):this.f=f-this.h*(this.a-
  this.f)),k?f>this.a-this.h*this.c&&(this.a=f+this.h*this.c,this.f=this.a-this.c):f>this.a&&(this.a=f+this.h*(this.a-this.f))):(this.f=f,this.a=f+(k?this.c:0),this.F=!0);this.H?(d<this.g&&(e?(this.g=d,this.b=d+this.c):this.g=d-this.h*(this.b-this.g)),e?d>this.b-this.h*this.c&&(this.b=d+this.h*this.c,this.g=this.b-this.c):d>this.b&&(this.b=d+this.h*(this.b-this.g))):(this.g=d,this.b=d+(e?this.c:0),this.H=!0);this.o[a]=hl(c)}1E-14>this.a-this.f&&(a=(this.a+this.f)/2,b=Math.max(1E-14*a,1E-14),this.a=
  a+b,this.f=a-b);1E-14>this.b-this.g&&(a=(this.b+this.g)/2,b=Math.max(1E-14*a,1E-14),this.b=a+b,this.g=a-b);a=new M(this.f,this.g,this.a,this.b);b=this.w.b;"VERTICAL"==this.A?a=new M(b.ra(),a.b,b.a,a.ka()):"HORIZONTAL"==this.A&&(a=new M(a.ra(),b.b,a.a,b.ka()));this.m&&!a.Oa(b)&&(this.C=!0,Nk(this.w,a),this.C=!1,Xb(this,new N(this,"AUTO_SCALE",a)))};g.ga=function(a){a.ea()==this.w?a.R("SIM_RECT_CHANGED")&&(this.C||this.vb(!1)):B(this.i,a.ea())&&(a.R(pl.pb)||a.R(pl.bb)?this.reset():a.R("RESET")&&this.vb(!0))};
  g.reset=function(){this.a=this.f=0;this.F=!1;this.b=this.g=0;this.H=!1;for(var a=0,b=this.o.length;a<b;a++)this.o[a]=-1};g.vb=function(a){this.m!=a&&(a?this.B&&(this.reset(),this.w.Aa(this),yl(this,!0),this.m=!0,Q(this,wl.uc)):(this.w.Nb(this),yl(this,!1),this.m=!1,Q(this,wl.uc)))};g.wh=function(a){if("VERTICAL"==a||"HORIZONTAL"==a||"BOTH_AXES"==a)this.A=a,Q(this,wl.ld);else throw Error("unknown "+a);};function yl(a,b){A([Ik.ab,Ik.$a,Ik.xc,Ik.yc],v(function(a){this.w.cd(a).qc(b)},a))}
  g.Tg=function(a){this.B!=a&&(this.B=a,this.vb(a),Q(this,wl.qd))};g.Oh=function(a){F(a,this.c)&&(this.c=a,this.reset(),this.vb(!0),Q(this,wl.Nc))};var wl={ld:"axis",Nc:"time window",uc:"active",qd:"enabled"},xl=wl;function Al(a,b,c){this.a=a;this.c=b;this.f=c}Al.prototype.toString=function(){return""};Al.prototype.getName=function(a){return a?Bl.oa+"-"+this.f.getName(!0):E(Cl.oa)+"_"+this.f.getName(!1)};Al.prototype.R=function(a){return this.getName()==E(a)};
  Al.prototype.b=function(a){fd(this.a);var b=this.a.ma(),c=a,d;this.a.ca();var e=mf(Ff(this.c)),f=G,h=G,k=!0;if(1E-15>a)return null;do{var m=b;if(!k&&(hd(this.a),this.a.ca(),Ff(this.c),c/=5,1E-15>c))throw Error("time step too small "+c);for(d=0;m<b+a;){var p=c;m+p>b+a-1E-10&&(p=b+a-m);d++;var q=this.f.b(p);this.a.ca();if(null!=q)return q;m+=p}d=mf(Ff(this.c));d=Math.abs(e-d);k||(h=Math.abs(d-f));f=d;k=!1}while(1E-6<h);return null};var Cl={oa:"Adaptive Step"},Bl=Cl;function Dl(a){this.f=a;this.a=[];this.c=[]}Dl.prototype.toString=function(){return""};Dl.prototype.getName=function(a){return a?El.oa:E(Fl.oa)};Dl.prototype.R=function(a){return this.getName()==E(a)};Dl.prototype.b=function(a){var b,c=this.f.v(),d=Lc(c),e=d.length;this.a.length!=e&&(this.a=Array(e),this.c=Array(e));var f=this.a,h=this.c;for(b=0;b<e;b++)f[b]=d[b];pb(h);b=this.f.fb(f,h,0);if(null!==b)return b;for(b=0;b<e;b++)d[b]+=h[b]*a;Oc(c,d,!0);return null};var Fl={oa:"Eulers Method"},El=Fl;function Gl(a){this.c=a;this.a=[];this.f=[];this.g=[]}Gl.prototype.toString=function(){return""};Gl.prototype.getName=function(a){return a?Hl.oa:E(Il.oa)};Gl.prototype.R=function(a){return this.getName()==E(a)};
  Gl.prototype.b=function(a){var b,c=this.c.v(),d=Lc(c),e=d.length;this.a.length!=e&&(this.a=Array(e),this.f=Array(e),this.g=Array(e));var f=this.a,h=this.f,k=this.g;for(b=0;b<e;b++)f[b]=d[b];pb(h);b=this.c.fb(f,h,0);if(null!==b)return b;for(b=0;b<e;b++)f[b]=d[b]+h[b]*a;pb(k);b=this.c.fb(f,k,a);if(null!==b)return b;for(b=0;b<e;b++)d[b]+=(h[b]+k[b])*a/2;Oc(c,d,!0);return null};var Il={oa:"Modified Euler"},Hl=Il;function Jl(a,b,c,d){P.call(this,d||"DIFF_EQ_SUBJECT");this.b=a;this.f=b;this.c=c;this.a=[];this.a.push(new Dl(this.b));this.a.push(new Gl(this.b));this.a.push(new Vc(this.b));null!=this.f&&(a=new Al(this.b,this.f,new Gl(this.b)),this.a.push(a),a=new Al(this.b,this.f,new Vc(this.b)),this.a.push(a));a=Ba(this.a,function(a){return a.getName(!0)});b=Ba(this.a,function(a){return a.getName()});this.I(new bc(this,Kl.zc,Ll.zc,v(this.g,this),v(this.h,this),a,b))}l(Jl,P);Jl.prototype.toString=function(){return""};
  Jl.prototype.g=function(){return this.c.b.getName()};Jl.prototype.h=function(a){if(!this.c.b.R(a)){var b=Ea(this.a,function(b){return b.R(a)});if(null!=b)this.c.b=b,Q(this,Kl.zc);else throw Error("unknown solver: "+a);}};var Kl={zc:"Diff Eq Solver"},Ll=Kl;function Ml(a){P.call(this,"ELASTICITY_SETTER");this.f=a;this.a=0;ec(a,this);this.I(ac($b(new O(this,Nl.cc,Ol.cc,v(this.b,this),v(this.c,this)),3),1))}l(Ml,P);Ml.prototype.toString=function(){return""};Ml.prototype.b=function(){return this.a=Pl(this)};function Pl(a){var b=Bf(a.f);return 0==b.length?a.a:Ca(b,function(a,b){return Math.min(a,b.ad())},1)}Ml.prototype.c=function(a){A(Bf(this.f),function(b){b.Y(a)});this.a=a;Q(this,Nl.cc)};
  Ml.prototype.ga=function(a){a.ea()==this.f&&a.R("ELASTICITY_SET")&&(a=Pl(this),this.a!=a&&(this.a=a,Q(this,Nl.cc)))};var Nl={cc:"elasticity"},Ol=Nl;function Ql(a,b,c,d){this.w=a;this.o=b;this.A=c;this.a=b();if(!t(this.a))throw Error("not a number "+this.a);this.c=3;this.f=-1;this.g=Math.max(8,1+this.c);a=null;qa(d)?(b=ni(d),null!=b&&"LABEL"==b.tagName&&(a=b)):(d=document.createElement("input"),d.type="text",d.size=this.g,a=document.createElement("LABEL"),a.appendChild(document.createTextNode(this.w)),a.appendChild(d));this.b=d;this.B=null!==a?a:this.b;this.m="";this.b.b="right";Fi(this.b,"change",this.Uh,!0,this);Fi(this.b,"focus",this.Pg,!1,
  this);Fi(this.b,"click",this.ag,!1,this);this.i=!1;Rl(this)}g=Ql.prototype;g.toString=function(){return""};function Sl(a,b,c){if(-1<a.f)return a.f;a=c-1-Tl(b);16<a&&(a=16);return 0<a?a:0}g.ag=function(){this.i&&(this.b.select(),this.i=!1)};function Rl(a){var b=a.a;var c=Tl(b);b=2+Sl(a,b,a.c)+(0<c?c:0);a.m=a.a.toFixed(Sl(a,a.a,a.c));a.b.value=a.m;b!=a.g&&(a.g=b,a.b.size=a.g)}g.Pg=function(){this.i=!0};g.ja=function(){return this.B};g.N=function(){return this.a};
  function Tl(a){return 1E-15>Math.abs(a)?0:Math.floor(Math.LOG10E*Math.log(Math.abs(a)))}g.ga=function(){Ul(this,this.o())};function Ul(a,b){if(b!=a.a){try{if(isNaN(b))throw Error("not a number "+b);a.a=b;a.A(b)}catch(c){alert(c),a.a=a.o()}Rl(a)}}g.Uh=function(){var a=this.b.value.replace(/^\s*|\s*$/g,"");if(a!=this.m){var b=parseFloat(a);isNaN(b)?(alert("not a number: "+a),Rl(this)):Ul(this,b)}};function Vl(a,b){Ql.call(this,a.getName(!0),v(a.N,a),v(a.ff,a),b);this.h=a;b=a.g;this.c!=b&&(this.c=b,Rl(this));a=a.f;this.f!=a&&(this.f=-1<a?a:-1,Rl(this));ec(this.h.ea(),this)}l(Vl,Ql);Vl.prototype.toString=function(){return""};Vl.prototype.ga=function(a){a==this.h&&(Ql.prototype.ga.call(this,a),a=this.h.g,this.c!=a&&(this.c=a,Rl(this)),a=this.h.f,this.f!=a&&(this.f=-1<a?a:-1,Rl(this)))};function Wl(a,b){this.g=a;this.f=b;this.b=Wa(K,6);this.c=Wa(K,6);this.a=Wa(!1,6)}Wl.prototype.toString=function(){return""};Wl.prototype.Db=function(){for(var a=[],b=0;b<this.a.length;b++)if(this.a[b]){var c=this.g.na(Xl(this,b)),d=this.g.G(Yl(this,b));c=new Cc("thruster"+b,this.g,d,1,c,1);a.push(c)}return a};Wl.prototype.Kb=function(){};function Xl(a,b){if(0>b||b>=a.c.length)throw Error();return Gb(a.c[b],a.f)}function Yl(a,b){if(0>b||b>=a.b.length)throw Error();return a.b[b]}Wl.prototype.Ib=function(){return 0};function Zl(a,b){this.a=a;this.g=b;this.c=this.C=this.J=null;this.h=Bc(1,"mouse position").L(G);this.b=-1;this.f=!1;this.A=this.B=0;this.i=this.w=this.o=this.m=!1}Zl.prototype.toString=function(){return""};function $l(a,b,c){if("right"==c)a.J=b;else if("left"==c)a.C=b;else throw Error("unknown side "+c);}function am(a,b,c){if(!a.g.a&&-1<a.b){var d=Cf(a.a,a.b);a.f?d.Ua(a.A+Math.atan2(b.l()-d.ba().l(),b.j()-d.ba().j())-a.B):d.u(J(b,c));Af(a.a,d)}else a.h.u(b)}
  function bm(a){var b=a.c;null!=b&&(a.a.jf(b),a.a.a.remove(b),a.c=null);a.b=-1}
  function cm(a,b,c,d){var e=a.J,f=a.C;if(!(d.ctrlKey||d.metaKey||d.altKey))switch(b){case 37:case 74:null!=e&&(c&&(a.m=d.shiftKey),e.a[1]=c,e.a[a.m?4:5]=c,d.a());break;case 39:case 76:null!=e&&(c&&(a.o=d.shiftKey),e.a[0]=c,e.a[a.o?5:4]=c,d.a());break;case 38:case 73:null!=e&&(e.a[3]=c,d.a());break;case 40:case 75:null!=e&&(e.a[2]=c,d.a());break;case 83:null!=f&&(c&&(a.w=d.shiftKey),f.a[1]=c,f.a[a.w?4:5]=c,d.a());break;case 70:null!=f&&(c&&(a.i=d.shiftKey),f.a[0]=c,f.a[a.i?5:4]=c,d.a());break;case 69:null!=
  f&&(f.a[3]=c,d.a());break;case 68:case 67:null!=f&&(f.a[2]=c,d.a())}}var dm={$h:"click",we:"drag"};function em(a,b){this.b=null!=a?a:null;this.a=null!=b?b:null}g=em.prototype;g.toString=function(){return""};g.ib=function(){return!1};g.jb=function(a,b){null!=this.b&&(a.save(),a.fillStyle=fm(this),b=rg(b,this.Xa()),a.translate(b.j(),b.l()),a.beginPath(),a.arc(0,0,gm(this),0,2*Math.PI,!1),a.closePath(),a.fill(),a.restore())};g.eb=function(){return!1};function fm(a){return void 0!==a.c?a.c:null!=a.a?fm(a.a):"blue"}g.cb=function(){return[]};g.Xa=function(){return null==this.b?K:this.b.La()};
  function gm(a){return void 0!==a.f?a.f:null!=a.a?gm(a.a):2}g.Ra=function(){return null==this.b?[]:[this.b]};g.fa=function(){return void 0!==this.g?this.g:null!=this.a?this.a.fa():10};g.Ka=function(a){this.c=a;return this};g.Ya=function(){};function hm(a){var b=new em;b.f=a;return b}g.ya=function(a){this.g=a};function im(a,b){this.b=null!=a?a:new Ub("proto");this.a=null!=b?b:null}g=im.prototype;g.toString=function(){return""};g.ib=function(){return!1};g.jb=function(a,b){if(0<jm(this)){var c=rg(b,this.b.W());b=rg(b,this.b.aa());if(!(1E-6>Ab(c,b))){a.save();var d=km(this);0<d.length&&a.setLineDash&&a.setLineDash(d);a.lineWidth=jm(this);a.strokeStyle=lm(this);a.beginPath();a.moveTo(c.j(),c.l());a.lineTo(b.j(),b.l());a.stroke();a.restore()}}};
  function lm(a){return void 0!==a.c?a.c:null!=a.a?lm(a.a):"gray"}function km(a){return void 0!==a.h?a.h:null!=a.a?km(a.a):[]}g.cb=function(){return[]};g.Xa=function(){return Gb(this.b.W().add(this.b.aa()),.5)};g.Ra=function(){return[this.b]};function jm(a){return void 0!==a.f?a.f:null!=a.a?jm(a.a):4}g.fa=function(){return void 0!==this.g?this.g:null!=this.a?this.a.fa():0};g.eb=function(){return!1};g.Ka=function(a){this.c=a;return this};g.Ya=function(){};function mm(a){var b=new im;b.f=a;return b}
  g.ya=function(a){this.g=a};function nm(a,b,c,d,e,f){Sb.call(this,"rope"+om++);if(!isFinite(c.M()))throw Error("body2 must have finite mass");this.b=a;this.h=b;this.a=c;this.g=d;this.c=e;this.f=2==f;this.i=Math.max(this.b.Ca(),this.a.Ca())}l(nm,Sb);g=nm.prototype;g.toString=function(){return""};g.Cb=function(a,b){var c=new Lg(this.b,this.a,this,this.f);this.sb(c);Td(c,b);this.f?a.unshift(c):c.f<this.i&&a.unshift(c)};
  g.oc=function(){var a=-Math.PI/2;var b=this.b.G(this.h);var c=J(this.a.G(this.g),b);var d=c.length();var e=this.f?this.c:this.c-this.i/2;!this.f&&d<e||(.01<d&&(a=Math.atan2(c.l(),c.j())),a=b.add(new I(e*Math.cos(a),e*Math.sin(a))),this.a.qb(this.g,a))};g.Zc=function(){return this.b};g.$c=function(){return this.a};g.Qa=function(){return Lb(this.La(),this.Vb())};g.aa=function(){return this.a.G(this.g)};function pm(a){return Ab(a.aa(),a.W())}g.Wc=function(){return pm(this)};g.La=function(){return this.b.G(this.h)};
  g.Vb=function(){return this.a.G(this.g)};g.W=function(){return this.b.G(this.h)};g.Sa=function(){return J(this.aa(),this.W())};g.sb=function(a){if(a.c!=this.b||a.b!=this.a)throw Error();if(a.ic()!=this)throw Error();a.f=-(pm(this)-this.c);var b=Hb(this.Sa());if(null!=b)a.a=b;else throw Error();a.g=this.b.G(this.h);a.o=this.a.G(this.g);a.A="";a.B=!0;a.w=0;a.m=!0;a.h=this.f?-this.c:-J(a.g,a.o).length()};var om=0;function qm(a,b){this.a=null!=a?a:null;this.b=null!=b?b:null}g=qm.prototype;g.toString=function(){return""};g.ib=function(){return!1};
  g.jb=function(a,b){if(null!=this.a){var c=pm(this.a);if(!(1E-6>c)){a.save();a.lineWidth=rm(this);var d,e=this.a;e=(d=e.f||pm(e)>e.c-e.i)?0:this.a.c-c;a.strokeStyle=d?sm(this):tm(this);var f=this.a.W(),h=this.a.aa();d?(f=rg(b,f),h=rg(b,h),a.beginPath(),a.moveTo(f.j(),f.l()),a.lineTo(h.j(),h.l()),a.stroke()):(b=b.i,b=b.translate(f.j(),f.l()),b=sc(b,Math.atan2(h.l()-f.l(),h.j()-f.j())),b=b.scale(c/6,Math.max(2*e/6,.1)),um(a,b));a.restore()}}};
  function um(a,b){function c(a){return.5*Math.sin(Math.PI*a/6)}a.beginPath();rc(b,a);pc(b,.375,-c(.375),a);pc(b,.75,c(.75),a);for(var d=1;3>=d;d++){var e=1.5*d;pc(b,e,-c(e),a);e=.375*(4*d+2);pc(b,e,c(e),a)}pc(b,5.625,-c(5.625),a);pc(b,6,0,a);a.stroke()}function tm(a){return void 0!==a.f?a.f:null!=a.b?tm(a.b):"green"}function sm(a){return void 0!==a.g?a.g:null!=a.b?sm(a.b):"red"}g.cb=function(){return[]};g.Xa=function(){return null==this.a?K:Gb(this.a.W().add(this.a.aa()),.5)};
  g.Ra=function(){return null==this.a?[]:[this.a]};function rm(a){return void 0!==a.h?a.h:null!=a.b?rm(a.b):3}g.fa=function(){return void 0!==this.c?this.c:null!=this.b?this.b.fa():0};g.eb=function(){return!1};g.Ya=function(){};g.ya=function(a){this.c=a};function vm(a,b,c,d,e,f){Sb.call(this,a);this.a=c;this.c=b;this.i=d;this.f=e;this.m=f;a=ah(b,e);c=Ug(b.a,a);a=Xg(b.a,b.c,a,c-1);e=ah(b,e);c=Ug(b.a,e);b=Xg(b.a,b.f,e,c-1);this.g=new I(a,b);b=this.a.G(this.i);this.b=Yg(this.c,b);this.h=new Og(this.b.a)}l(vm,Sb);g=vm.prototype;g.toString=function(){return""};
  g.Cb=function(a,b){var c=new Lg(this.a,uf,this,!1);this.sb(c);Td(c,b);if(0>c.f){b=this.a.Ub();if(null==b)return;b=Nd(b,this.i);Zg(this.c,b,this.h);Tg(this.c,this.h);if(0>(this.m?this.f-this.h.a:this.h.a-this.f))return}c.f<this.a.Ca()&&a.unshift(c)};g.oc=function(){};g.Zc=function(){return this.a};g.$c=function(){return uf};g.Qa=function(){return Lb(this.g,this.g)};g.Wc=function(){var a=[];this.Cb(a,NaN);return a[0].f};g.La=function(){return this.g};g.Vb=function(){return this.g};
  g.sb=function(a){if(a.c!=this.a||a.b!=uf)throw Error();if(a.ic()!=this)throw Error();var b=this.a.G(this.i);a.g=b;Zg(this.c,b,this.b);Tg(this.c,this.b);a.f=this.m?this.f-this.b.a:this.b.a-this.f;b=this.b;b=new I(b.m,b.o);a.a=Gb(b,this.m?-1:1);a.m=!1;a.o=Qg(this.b);a.A=""};function wm(a,b){this.a=b;this.B=a;b=Ma(a.a);A(b,v(this.f,this));ec(a,this);this.b=[];this.i=mm(1).Ka("blue");this.i.ya(10);this.h=mm(1).Ka("red");this.h.ya(10);this.D=mm(2).Ka("magenta");this.C=mm(8);this.A=Rj(Qj(3),.75);this.J=Rj(Qj(2),.5);this.H=new qm;this.w=new ug;a=Jg(new ug,"");a.o="red";this.g=a;this.g.ya(10);this.F=new ug;this.c=Jg(Jg(new ug,""),"lightGray");this.c.ya(-1);this.m=hm(2).Ka("blue");this.m.ya(10);this.o=hm(3).Ka("red");this.o.ya(10)}wm.prototype.toString=function(){return""};
  function xm(a,b,c){"over"==ym?a.a.add(b):Yj(a.a,b);a.b.push({Qh:c,$f:b})}
  wm.prototype.f=function(a){if(null==Wj(this.a,a))if(a instanceof Je){var b=a;isFinite(b.M())?xm(this,new ug(b,this.w),a):xm(this,new ug(b,this.c),a)}else a instanceof Xd?null==a.getName().match(/^IMPULSE2/)&&null!=a.getName().match(/^IMPULSE1/)&&(b=Bc(Math.max(.02,Math.abs(2*Math.sqrt(Math.abs(5*a.b)/Math.PI))),a.getName()).L(0),b.u(a.W()),xm(this,new ug(b,this.g),a)):a instanceof Cc?null==a.getName().match(/^CONTACT_FORCE2/)&&(null!=a.getName().match(/^CONTACT_FORCE1/)?xm(this,new im(a,this.h),a):
  null!=a.getName().match(/^THRUSTER/)?xm(this,new im(a,this.D),a):xm(this,new im(a,this.i),a)):a instanceof vm?xm(this,new em(a,this.o),a):a instanceof Mg||a instanceof ch?xm(this,new em(a,this.m),a):a instanceof xc?xm(this,new ug(a,this.F),a):a instanceof Dc?(b=a,b.R(dm.we)?xm(this,new Lj(b,this.J),a):xm(this,new Lj(b,this.A),a)):a instanceof nm?xm(this,new qm(a,this.H),a):a instanceof Ub&&xm(this,new im(a,this.C),a)};
  function zm(a,b){var c=Ea(a.b,function(a){return a.Qh==b});null!=c&&(a.a.remove(c.$f),Ha(a.b,c))}wm.prototype.ga=function(a){if(a.ea()==this.B){var b=a.N();a.R("OBJECT_ADDED")?this.f(b):a.R("OBJECT_REMOVED")&&zm(this,b)}};var ym="over";function Am(a,b,c,d,e){if(null==a&&null==e)throw Error();this.h=a;this.m=b;this.a=e;this.g=!1;this.f=null;null!=a&&(b=a.Ra(),0<b.length&&(this.f=b[0]));this.c=c;this.i=d;this.b=K;null!=a&&(this.b=J(c,a.Xa()))};function Bm(a,b){this.a=a;this.b=a.g;this.c=rg(this.b,Nb(a.b));this.f=b}function Cm(a,b){b=J(a.f,b);var c=pg(a.b,a.c.add(b)),d=a.a.b;b=d.P();d=d.S();var e=c.j();c=c.l();b=new M(e-b/2,c-d/2,e+b/2,c+d/2);Nk(a.a,b)};function Dm(a,b,c){this.a=a;this.g=b||null;this.h=null!==c;this.m=null!=c?1==c.control:!1;this.o=null!=c?1==c.Ze:!1;this.w=null!=c?1==c.shift:!1;this.i=null!=c?1==c.alt:!0;this.c=!1;this.f=this.b=null;Fi(a.a,"mousedown",this.oh,!1,this);Fi(document,"mousemove",this.ph,!1,this);Fi(document,"mouseup",this.hf,!1,this);Fi(document,"keydown",this.Kg,!1,this);Fi(document,"keyup",this.Lg,!1,this);Fi(document,"touchstart",this.Th,!1,this);Fi(document,"touchmove",this.Sh,!1,this);Fi(document,"touchend",this.Rh,
  !1,this)}g=Dm.prototype;g.toString=function(){return""};g.oh=function(a){Em(this,a,a.clientX,a.clientY)};
  function Em(a,b,c,d){if(b.target==a.a.a)if(a.a.a.focus(),a.c=!0,c=Fm(a,c,d),a.h&&a.m==b.ctrlKey&&a.o==b.metaKey&&a.w==b.shiftKey&&a.i==b.altKey)b=a.a.f,null!=b&&(a.f=new Bm(b,c),Cm(a.f,c));else{a:{var e=a.a;d=a.g;var f=null,h=null,k=G,m=Ma(e.g),p=m.length-1;b:for(;0<=p;p--){var q=m[p],r=q.g,u=pg(r,c);var x=q.h;Uj(x);x=Ma(x.a);var C=x.length-1;c:for(;0<=C;C--){var y=x[C];if(!y.eb())continue c;var w=y.cb();if(!(1<w.length))if(0==w.length){if(y.ib(u)){f=y;var H=q;var L=u;h=K;break b}}else{w=w[0];for(var ca=
  w.Gb(),Sa=ca.length-1;0<=Sa;Sa--){var pa=w.G(ca[Sa]);pa=Ab(c,rg(r,pa));pa<=k&&(k=pa,f=y,H=q,h=ca[Sa],L=u)}}}}if(null==f){H=e.f;if(null!=H)L=pg(H.g,c);else{c=null;break a}if(null==d){c=null;break a}}c=n(H)&&n(L)?new Am(f,H,L,h,d):null}a.b=c;if(null!=a.b){a=a.b;if(null!=a.a){c=a.a;f=a.f;H=a.c;L=a.b;d=a.i;c.f=b.altKey||b.metaKey||b.ctrlKey;bm(c);b=Bf(c.a).length;for(h=0;h<b;h++)f===Cf(c.a,h)&&(c.b=h);-1<c.b&&((b=Cf(c.a,c.b),c.g.a)?null!=d&&(c.c=new Dc(dm.we,b,d,c.h,K,0,3),am(c,H,L),V(c.a,c.c),c.a.a.add(c.c)):
  c.f&&(c.A=b.ke(),c.B=Math.atan2(L.l(),L.j())));b=-1<c.b}else b=!1;a.g=b}}}function Fm(a,b,c){var d=a.a.a,e=d.getBoundingClientRect();return Bb(new I(b-e.left,c-e.top),d.offsetWidth/a.a.P())}g.ph=function(a){Gm(this,a,a.clientX,a.clientY)};function Gm(a,b,c,d){var e=a.a.a;null!=e.offsetParent&&(c=Fm(a,c,d),(b.target==e||b.target==document.body)&&a.c&&b.a(),null!=a.f?Cm(a.f,c):null!=a.b&&(a=a.b,a.c=pg(a.m.g,c),null==a.h||null!=a.f&&a.g?null!=a.a&&a.g&&am(a.a,a.c,a.b):a.h.Ya(J(a.c,a.b))))}
  g.hf=function(a){var b=this.a.a;null!=b.offsetParent&&((a.target==b||a.target==document.body)&&this.c&&a.a(),Ek(this))};function Ek(a){if(null==a.f&&null!=a.b){var b=a.b;null!=b.a&&bm(b.a)}a.b=null;a.f=null;a.c=!1}g.Kg=function(a){a.target!=this.a.a&&a.target!=document.body||null==this.g||cm(this.g,a.b,!0,a)};g.Lg=function(a){a.target!=this.a.a&&a.target!=document.body||null==this.g||cm(this.g,a.b,!1,a)};
  g.Th=function(a){if(a.target==this.a.a){var b=a.f;null!=b&&((b=b.touches)&&1==b.length?Em(this,a,b[0].clientX,b[0].clientY):Ek(this))}};g.Sh=function(a){var b=a.f;b=null!=b?b.touches:[];this.c&&b&&1==b.length?Gm(this,a,b[0].clientX,b[0].clientY):Ek(this)};g.Rh=function(a){this.c&&this.hf(a)};function Hm(a){if(n(a)&&!tl(a))throw Error("not a GraphLine "+a);this.a=n(a)?[a]:[];this.f=Wa(-1,this.a.length);this.h=this.c=null;this.g=jg;this.b=!1;this.i=!0;this.m=0}g=Hm.prototype;g.toString=function(){return""};function Im(a,b){if(tl(b))B(a.a,b)||(a.a.push(b),a.f.push(-1));else throw Error("not a GraphLine "+b);}g.ib=function(){return!1};
  g.jb=function(a,b){if(!this.g.Va()){a.save();if(null==this.h||this.h!=b)this.h=b,this.b=!0;for(var c=0,d=this.a.length;c<d;c++)if(this.f[c]>cl(this.a[c].c)){this.reset();break}if(this.i){c=this.g.P();d=this.g.S();null==this.c&&(this.c=document.createElement("canvas"),this.c.width=c,this.c.height=d,this.b=!0);var e=this.c.getContext("2d");this.b?(e.clearRect(0,0,c,d),this.f=Wa(-1,this.a.length),Jm(this,e,b),this.b=!1):Jm(this,e,b);a.drawImage(this.c,0,0,c,d)}else this.b=!0,this.f=Wa(-1,this.a.length),
  Jm(this,a,b),this.b=!1;c=0;for(d=this.a.length;c<d;c++){e=a;var f=b,h=el(this.a[c].c);if(null!=h){var k=sg(f,h.j());f=tg(f,h.l());e.fillStyle="red";e.fillRect(k-2,f-2,5,5)}}a.restore()}};g.cb=function(){return[]};g.Xa=function(){return K};g.Ra=function(){return[]};g.fa=function(){return this.m};
  function Jm(a,b,c){for(var d=0,e=a.a.length;d<e;d++){var f=a.f,h=d;var k=b;var m=c,p=a.f[d],q=a.a[d],r=qg(m,a.g),u=new gl(q.c,p);if(il(u)){p=jl(u);var x=ul(q,hl(u));if("dots"==x.c){var C=sg(m,p.a),y=tg(m,p.b),w=x.b;k.fillStyle=x.a;k.fillRect(C,y,w,w)}for(;il(u);)if(y=p,p=jl(u),p.a!=y.a||p.b!=y.b)if(x=ul(q,hl(u)),C=p.c==y.c&&p.f==y.f,"dots"!=x.c&&C){if(Qb(r,y,p)){C=sg(m,y.a);y=tg(m,y.b);w=sg(m,p.a);var H=tg(m,p.b);k.strokeStyle=x.a;k.lineWidth=x.b;k.beginPath();k.moveTo(C,y);k.lineTo(w,H);k.stroke()}}else Mb(r,
  p)&&(C=sg(m,p.a),y=tg(m,p.b),w=x.b,k.fillStyle=x.a,k.fillRect(C,y,w,w));k=hl(u)}else k=p;f[h]=k}}g.eb=function(){return!1};g.reset=function(){this.f=Wa(-1,this.a.length);this.b=!0};g.Ya=function(){};function Km(a,b){a.g=b;a.c=null}function Lm(a,b){a.i=b;a.i||(a.c=null)}g.ya=function(a){this.m=n(a)?a:0};var Mm={uf:"aqua",vc:"black",vf:"blue",zf:"fuchsia",Af:"gray",Bf:"green",Cf:"lime",Gf:"maroon",Hf:"navy",If:"olive",Kf:"purple",Lf:"red",Nf:"silver",Qf:"teal",Tc:"white",Xf:"yellow"};function Nm(a,b,c,d,e,f){P.call(this,"GRAPH_LAYOUT");this.g=f||"block";zk(e,b);this.view=new Hk("X_Y_GRAPH_VIEW",new M(0,0,1,1));Lk(this.view,"FULL");Kk(this.view,"FULL");ck(b,this.view);this.i=this.view.h;this.a=new ol("X_Y_GRAPH_LINE",a);this.a.mb(0);this.a.Pa(1);this.a.Ka("lime");this.view.Aa(this.a);this.f=Rk(this.view);a=v(function(a){if(a.R(pl.pb)){var b=this.f;var c=this.a;c=-1<c.a?Mc(c.b,c.a).getName(!0):"";b.$d=c}a.R(pl.bb)&&(a=this.f,b=this.a,b=-1<b.f?Mc(b.b,b.f).getName(!0):"",a.jd=b)},
  this);new Ij(this.a,a);a(new N(this.a,ql.pb));this.c=new vl("X_Y_AUTO_SCALE",this.a,this.view);this.c.h=.05;this.b=new Hm(this.a);Km(this.b,this.view.f);Lm(this.b,!0);Yj(this.i,this.b);new Ij(this.view,v(function(a){a.R("SCREEN_RECT_CHANGED")&&Km(this.b,this.view.f)},this));this.h=[];this.m=c;Om(this,Wk(e));c=ic(this.a,pl.bb);Om(this,new Wi(c,"Y:"));c=ic(this.a,pl.pb);Om(this,new Wi(c,"X:"));Om(this,new Xi(ql.ve,v(this.a.reset,this.a)));c=jc(this.a,pl.Bc);Om(this,new Wi(c,void 0,[Mm.uf,Mm.vc,Mm.vf,
  Mm.zf,Mm.Af,Mm.Bf,Mm.Cf,Mm.Gf,Mm.Hf,Mm.If,Mm.Kf,Mm.Lf,Mm.Nf,Mm.Qf,Mm.Tc,Mm.Xf],"aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal white yellow".split(" ")));c=ic(this.a,pl.LINE_WIDTH);Om(this,new Vl(c));c=jc(this.a,pl.Ac);Om(this,new Wi(c));new Dm(b,null,{alt:!1,control:!1,Ze:!1,shift:!1});b=Vk(this.view,v(function(){this.c.vb(!0)},this));d.appendChild(b);d=$k(b,this);Om(this,new Si(d))}l(Nm,P);Nm.prototype.toString=function(){return""};
  Nm.prototype.Ja=function(){return[this,this.a,this.view,this.c]};function Om(a,b){var c=b.ja();c.style.display=a.g;a.m.appendChild(c);a.h.push(b)};function Pm(a){a.style[Zh?"styleFloat":"cssFloat"]="left"};function Qm(a,b,c){P.call(this,"TAB_LAYOUT");b=b||800;c=c||800;this.B=this.A=this.H=1;hb(a.images_dir);this.U=Rm(a,"tab_list");this.f=Sm(this);""==this.f&&(this.f=Tm,Um(this,this.f));Fi(this.U,"click",v(function(a){a=a.target;if(void 0===a)throw Error("event target is undefined ");if(null!=a&&"LI"==a.tagName&&!(-1<a.className.indexOf("selected"))){a=a.className;a=a.toLowerCase().trim();switch(a){case Vm:a=Wm;break;case Xm:a=Ym;break;case Zm:a=$m}this.yb(a)}},this));Fi(window,"resize",v(this.Mb,this));
  Fi(window,"orientationchange",v(this.Mb,this));var d=an(a,"term_output");this.V=an(a,"term_input");this.za=new ej(this.V,d);this.C=Rm(a,"container");this.c=Rm(a,"sim_applet");this.c.style.position="relative";d=document.createElement("canvas");d.tabIndex=0;this.m=new Zj(d,"SIM_CANVAS");hk(this.m,b,c);this.c.appendChild(this.m.a);this.g=Rm(a,"show_sim");d=ni(this.g);if(null==d||"LABEL"!=d.tagName)throw Error();this.w=d;Fi(this.g,"click",v(function(){var a=this.g.checked;switch(this.f){case "":case Tm:break;
  case Vm:a&&this.yb(Wm);break;case Wm:a||this.yb(Vm);break;case Xm:a&&this.yb(Ym);break;case Ym:a||this.yb(Xm);break;case Zm:a&&this.yb($m);break;case $m:a||this.yb(Zm);break;default:throw Error('showSim: no such layout "'+this.f+'"');}},this));this.a=Rm(a,"div_graph");this.a.style.position="relative";d=document.createElement("canvas");this.D=new Zj(d,"GRAPH_CANVAS");b=Math.max(b,c);hk(this.D,b,b);this.a.appendChild(d);this.i=Rm(a,"graph_controls");this.Ha=[];this.h=Rm(a,"sim_controls");this.h.style.marginLeft=
  "10px";this.ia=Rm(a,"div_terminal");this.ia.style.display="none";Rm(a,"label_terminal").style.display="inline";this.F=Rm(a,"show_terminal");Fi(this.F,"click",v(function(){this.qf(this.F.checked)},this));this.b=Rm(a,"div_time_graph");this.b.style.position="relative";c=document.createElement("canvas");this.Z=new Zj(c,"TIME_GRAPH_CANVAS");hk(this.Z,b,b);this.b.appendChild(c);this.o=Rm(a,"time_graph_controls");this.Mb();this.I(new O(this,bn.Id,cn.Id,v(this.Ag,this),v(this.Ih,this)));this.I(new O(this,
  bn.wd,cn.wd,v(this.og,this),v(this.Bh,this)));this.I(new O(this,bn.Ld,cn.Ld,v(this.Eg,this),v(this.Mh,this)));this.I(new bc(this,bn.Ae,cn.Ae,v(this.rg,this),v(this.yb,this),[Tm,Vm,Wm,Xm,Ym,Zm,$m],[Tm,Vm,Wm,Xm,Ym,Zm,$m]));this.I(new Vb(this,bn.Ge,cn.Ge,v(function(){return this.F.checked},this),v(this.qf,this)))}l(Qm,P);g=Qm.prototype;g.toString=function(){return""};
  function Rm(a,b){a=a[b];if(!ja(a))throw Error("unknown elementId: "+b);b=document.getElementById(a);if(!qa(b))throw Error("not found: element with id="+a);return b}function an(a,b){a=a[b];if(!ja(a))throw Error("unknown elementId: "+b);return document.getElementById(a)}
  function dn(a,b,c,d){b.style.display="block";c.style.display="inline-block";c.style.a="1";c.style.MozColumnCount="1";c.style.webkitColumnCount="1";c.style.width="auto";var e=c.getBoundingClientRect().width;e=150<e?e:300;b=b.offsetWidth||b.getBoundingClientRect().width;null!=d&&(d.style.display="block",b+=d.offsetWidth||d.getBoundingClientRect().width);a=a.C.offsetWidth||a.C.getBoundingClientRect().width;a-b-2<e&&a>2*e&&(c.style.width="100%",c.style.a="2",c.style.MozColumnCount="2",c.style.webkitColumnCount=
  "2")}g.og=function(){return this.A};g.rg=function(){return this.f};function Sm(a){a=Ea(a.U.childNodes,function(a){return a.nodeType!=Node.ELEMENT_NODE||"LI"!=a.tagName?!1:null!=a.className.match(/.*selected/)});return null==a?"":a.className.replace(/[ ]*selected/,"")}g.Ag=function(){return this.H};g.Ja=function(){return[this,this.m,this.D,this.Z]};g.Eg=function(){return this.B};
  g.Mb=function(){var a=mi();Pm(this.c);Pm(this.a);Pm(this.b);switch(this.f){case "":case Tm:this.a.style.display="none";this.i.style.display="none";this.b.style.display="none";this.o.style.display="none";en(this,.95*this.H,this.a);dn(this,this.c,this.h);this.w.style.display="none";break;case Vm:this.c.style.display="none";this.h.style.display="none";this.b.style.display="none";this.o.style.display="none";en(this,.95*this.A,this.a);dn(this,this.a,this.i);this.g.checked=!1;this.w.style.display="inline";
  break;case Wm:this.b.style.display="none";this.h.style.display="none";this.o.style.display="none";600<a.width?en(this,.49,this.a):en(this,.95*this.A,this.a);dn(this,this.a,this.i,this.c);this.g.checked=!0;this.w.style.display="inline";break;case Xm:this.a.style.display="none";this.i.style.display="none";this.c.style.display="none";this.h.style.display="none";en(this,.95*this.B,this.b);dn(this,this.b,this.o);this.g.checked=!1;this.w.style.display="inline";break;case Ym:this.a.style.display="none";
  this.h.style.display="none";this.i.style.display="none";600<a.width?en(this,.49,this.b):en(this,.95*this.B,this.b);dn(this,this.b,this.o,this.c);this.g.checked=!0;this.w.style.display="inline";break;case Zm:this.a.style.display="block";this.b.style.display="block";this.c.style.display="none";this.h.style.display="none";this.i.style.display="none";this.o.style.display="none";en(this,.49,this.a);en(this,.49,this.b);this.g.checked=!1;this.w.style.display="inline";break;case $m:this.a.style.display="block";
  this.b.style.display="block";this.c.style.display="block";this.h.style.display="none";this.i.style.display="none";this.o.style.display="none";en(this,.49,this.a);en(this,.49,this.b);this.g.checked=!0;this.w.style.display="inline";break;default:throw Error('redoLayout: no such layout "'+this.f+'"');}};
  function en(a,b,c){var d=mi().height-80,e=a.C.offsetWidth||a.C.getBoundingClientRect().width,f=ek(a.m);b=Math.min(b,d/e*(f.P()/f.S()));b=Math.floor(100*b)+"%";a.c.style.width=b;a.c.style.height="auto";c.style.width=b;c.style.height="auto"}g.Bh=function(a){F(a,this.A)&&(this.A=a);this.Mb();Q(this,bn.wd)};g.yb=function(a){a=a.toLowerCase().trim();if(this.f!=a){a=this.f=a;switch(a){case Wm:a=Vm;break;case Ym:a=Xm;break;case $m:a=Zm}Um(this,a);this.Mb()}};
  function Um(a,b){Sm(a)!=b&&A(a.U.childNodes,function(a){a.nodeType==Node.ELEMENT_NODE&&"LI"==a.tagName&&(a.className.trim()==b?a.className+=" selected":-1<a.className.indexOf("selected")&&(a.className=a.className.replace(/[ ]*selected/,"")))},a)}g.Ih=function(a){F(a,this.H)&&(this.H=a);this.Mb();Q(this,bn.Id)};g.Mh=function(a){F(a,this.B)&&(this.B=a);this.Mb();Q(this,bn.Ld)};g.qf=function(a){this.ia.style.display=a?"block":"none";(this.F.checked=a)&&this.V&&!this.za.m&&this.V.focus()};
  var Tm="sim",Vm="graph",Wm="sim+graph",Xm="time_graph",Ym="sim+time_graph",Zm="multi_graph",$m="sim+multi_graph",bn={Id:"sim-width",wd:"graph-width",Ld:"time-graph-width",Ae:"layout",Ge:"show terminal"},cn=bn;function fn(a,b,c,d,e){P.call(this,"TIME_GRAPH_LAYOUT");zk(e,b);this.view=new Hk("TIME_GRAPH_VIEW",new M(0,0,1,1));Lk(this.view,"FULL");Kk(this.view,"FULL");ck(b,this.view);Rk(this.view);this.a=new ol("TIME_GRAPH_LINE_1",a);this.a.Ka("lime");this.view.Aa(this.a);this.f=new vl("TIME_GRAPH_AUTO_SCALE",this.a,this.view);this.f.h=.05;this.g=new Hm(this.a);Km(this.g,this.view.f);Yj(this.view.h,this.g);new Ij(this.view,v(function(a){a.R("SCREEN_RECT_CHANGED")&&Km(this.g,this.view.f)},this));var f=this.a.v().b;
  this.a.mb(f);this.a.Pa(0);Lm(this.g,this.a.a!=f);this.b=new ol("TIME_GRAPH_LINE_2",a);zl(this.f,this.b);this.view.Aa(this.b);this.b.mb(f);this.b.Pa(1);this.b.Ka("red");Im(this.g,this.b);this.c=new ol("TIME_GRAPH_LINE_3",a);zl(this.f,this.c);this.view.Aa(this.c);this.c.mb(f);this.c.Pa(-1);this.c.Ka("blue");Im(this.g,this.c);this.h=[];this.i=c;gn(this,Wk(e));a=ic(this.a,pl.bb);gn(this,new Wi(a,hn.Df));a=ic(this.b,pl.bb);gn(this,new Wi(a,hn.Ef));a=ic(this.c,pl.bb);gn(this,new Wi(a,hn.Ff));a=ic(this.a,
  pl.pb);gn(this,new Wi(a,"X:"));a=ic(this.f,wl.Nc);gn(this,new Vl(a));a=new Xi(ql.ve,v(function(){this.a.reset();this.b.reset();this.c.reset()},this));gn(this,a);new Ij(this.a,v(function(){Lm(this.g,this.a.a!=f);this.b.mb(this.a.a);this.c.mb(this.a.a)},this));new Dm(b,null,{alt:!1,control:!1,Ze:!1,shift:!1});this.view.pf(!1);new Ij(e,v(function(a){a.R("RESET")&&(this.view.gd(this.view.P()/2),this.f.vb(!0))},this));b=Vk(this.view,v(function(){this.f.vb(!0)},this));d.appendChild(b);d=$k(b,this);gn(this,
  new Si(d))}l(fn,P);fn.prototype.toString=function(){return""};function gn(a,b){var c=b.ja();c.style.display="block";a.i.appendChild(c);a.h.push(b)}fn.prototype.Ja=function(){return[this,this.a,this.b,this.c,this.view,this.f]};var hn={Df:"line 1",Ef:"line 2",Ff:"line 3"};function jn(a,b,c,d,e){fb();P.call(this,e||"APP");this.U=b;this.b=new Qm(a,800,Math.round(800*this.U.S()/this.U.P()));this.F=this.b.za;a=this.b.m;this.m=c;qj(this.F,v(c.ca,c));new Ij(c,v(function(){c.ca()},this));c.da(!1);this.C=c.a;this.ec=c.v();this.ia=d;this.o=new Hk("SIM_VIEW",this.U);this.B=this.o.h;ck(a,this.o);this.V=new Hk("STATUS_VIEW",new M(-10,-10,10,10));ck(a,this.V);Rk(this.o,!0);this.a=new wk(d);zk(this.a,a);this.f=this.a.a;this.za=new Zl(c,this.f);this.Qd=new Dm(a,this.za);Ak(this.a,
  this.Qd);this.Ha=new wm(this.C,this.B);this.h=new Ml(c);this.Oc=new zj(c);this.Pd=Zk(this.Oc,this.V,this);this.Ab=new bj(v(c.ma,c),v(this.f.Xc,this.f));this.Ab.Ya(new I(8,4));this.Qc=Yk(this.Ab,this.V,this);a=Vk(this.o,v(function(){Nk(this.o,this.U)},this));this.b.c.appendChild(a);this.Bb=$k(a,this);this.Bb.dd(!1);this.ob=new Jl(c,c,d);this.i=new Nm(c.v(),this.b.D,this.b.i,this.b.a,this.a);this.w=new fn(c.v(),this.b.Z,this.b.o,this.b.b,this.a)}l(jn,P);jn.prototype.toString=function(){return""};
  jn.prototype.Uc=function(){};jn.prototype.defineNames=jn.prototype.Uc;function kn(a,b){new Ij(b.ea(),v(function(a){a==b&&(this.m.ca(),this.m.v().Lb(2,3))},a))}jn.prototype.Ja=function(){return Ka([this,this.m,this.h,this.ob,this.a,this.f,this.o,this.V,this.ec],this.b.Ja(),this.i.Ja(),this.w.Ja())};function ln(a){var b=[a.ec];ma(void 0)&&(b=Ka(b,void 0));a.A=Xk(a.Ja(),b,a.a,a.F)}
  jn.prototype.lc=function(a){null!=a||(a=Ea(Bf(this.m),function(a){return isFinite(a.M())}));null!=a&&(0>this.i.a.a&&this.i.a.mb(a.la()),0>this.i.a.f&&this.i.a.Pa(a.la()+2));this.w.a.Pa(1);this.w.b.Pa(2);this.w.c.Pa(3)};jn.prototype.graphSetup=jn.prototype.lc;function mn(a){nn(a,al(a.A,a.a));Om(a.i,al(a.A,a.a));gn(a.w,al(a.A,a.a))}
  function on(a){var b=ic(a.h,Nl.cc);nn(a,new Vl(b));b=hc(a.m,wf.Kc);nn(a,new Si(b));nn(a,new Si(a.Pd));nn(a,new Si(a.Qc));nn(a,new Si(a.Bb));b=ic(a.a,xk.Mc);nn(a,new Vl(b));b=ic(a.a.a,jk.Lc);nn(a,new Vl(b));b=jc(a.ob,Kl.zc);nn(a,new Wi(b));b=Sk(a.b.m);nn(a,b)}function nn(a,b){a=a.b;var c=b.ja();c.style.display="block";a.h.appendChild(c);a.Ha.push(b)}jn.prototype.eval=function(a,b){try{return this.F.eval(a,b)}catch(c){a=this.F,b=c,a.A?console.log(b):(a.A=!0,alert(b))}};jn.prototype.eval=jn.prototype.eval;
  jn.prototype.Ph=function(){pk(this.f);var a=this.F;if(null!=a.h){var b=a.h;b.w=wj(b,!1).split(";");b.i=wj(b,!0).split(";")}b=window.location.href;var c=b.indexOf("?");-1<c?(b=b.slice(c+1),b=decodeURIComponent(b),a.eval(b),b=!0):b=!1;b||pj(a);yf(this.m);this.m.ca();this.a.Ma()};jn.prototype.setup=jn.prototype.Ph;jn.prototype.start=function(){uk(this.a.b)};jn.prototype.start=jn.prototype.start;function pn(a,b,c,d,e,f,h){b=new Mg(b,c,d,e,f,h);Rf(a,b);b.oc()}function qn(a,b,c,d){rn(a,uf,b.G(c),b,c,d)}function rn(a,b,c,d,e,f){pn(a,b,c,d,e,f,Kb);pn(a,b,c,d,e,f,Jb)};function sn(a,b,c,d,e){this.f=a;this.c=b;this.b=c;this.a=d;this.g=e}sn.prototype.toString=function(){return""};sn.prototype.Kb=function(){};sn.prototype.Db=function(){var a=this.g*this.f.ma();a=new I(this.a*Math.cos(a),this.a*Math.sin(a));return[new Cc("rotating",this.c,this.b,0,a,0)]};sn.prototype.Ib=function(){return 0};function tn(a){var b=new M(-6,-6,6,6),c=new Pf;X(c,"velocity_and_distance");jn.call(this,a,b,c,new Yc(c));this.c=c;Jg(this.Ha.c,"rgb(240,240,240)");this.c.da(!1);this.h.c(.8);this.H=new ff(.1,.15,this.C);this.Ia=!0;this.g=0;this.D=.3;this.Z=!1;nn(this,Wk(this.a));this.I(a=new Vb(this,un.Kd,vn.Kd,v(this.Dg,this),v(this.Lh,this)));nn(this,new Si(a));this.I(a=new Vb(this,un.dc,vn.dc,v(this.lg,this),v(this.yh,this)));nn(this,new Si(a));this.I(a=new O(this,un.yd,vn.yd,v(this.pg,this),v(this.Ch,this)));
  nn(this,new Vl(a));this.I(a=new O(this,un.Fd,vn.Fd,v(this.vg,this),v(this.Fh,this)));nn(this,new Vl(a));a=ic(this.H,jf.Ob);nn(this,new Vl(a));on(this);ln(this);mn(this);wn(this);this.lc()}l(tn,jn);g=tn.prototype;g.toString=function(){return""};g.Uc=function(){};g.Ja=function(){return Ka(this.H,jn.prototype.Ja.call(this))};
  function wn(a){var b=a.h.b();a.c.Eb();a.ia.reset();V(a.c,a.H);hf(a.H,a.c.a);xn(a.c,a.Ia);Jg(Xj(a.B,un.xd),"rgba(51,204,255,0.5)").ya(2);Jg(Xj(a.B,un.Qb+1),"rgb(200,200,200)");Jg(Xj(a.B,un.Qb+2),"rgb(200,200,200)");if(a.Z){var c=Z(1,3,un.dc,vn.dc);c.u(new I(-5.5,-4));a.c.s(c);Jg(Xj(a.B,c),"blue");A(Bf(a.c),function(a){null!=a.getName().match(/^FIXED.*/)&&(a.Ba([c]),c.Ba([a]))})}if(0<a.g){var d=Cf(a.c,"handle");0<a.D?d=new sn(a.c,d,new I(0,-3),a.g,a.D):(d=new Cc("turning",d,new I(0,-3),0,new I(a.g,
  0),0),d=new Ph(d));V(a.c,d)}W(a.c,b);Nc(a.c.v());yf(a.c);sk(a.f,0);rk(a.f,0);xj(a.A)}
  function xn(a,b){var c=Z(.8,6.2,un.xd,vn.xd);c.L(.5);c.xb([new I(0,-2.8)]);a.s(c);var d=b?1:.98;b=Z(d,2.5,un.Qb+1,vn.Qb+1);b.u(new I(0,2),Math.PI);a.s(b);d=Z(d,2.5,un.Qb+2,vn.Qb+2);d.u(new I(-2.5,0),Math.PI/2);a.s(d);for(var e=0;2>e;e++)for(var f=0;2>f;f++){var h=f+2*e;h=Z(4,4,un.xe+h,vn.xe+h);h.u(new I(2.507*(1-2*e),2.507*(1-2*f)),0);h.L(G);a.s(h);c.Ba([h]);h.Ba([c])}e=b.ba();f=d.ba();h=Ab(e,f);c.Ua(-Math.PI/2+Math.atan(-e.l()/f.j()));rn(a,b,new I(0,0),c,new I(0,2.8),0);rn(a,d,new I(0,0),c,new I(0,
  2.8-h),0);Qf(a)}g.pg=function(){return this.g};g.Ch=function(a){this.g=a;wn(this);Q(this,un.yd)};g.vg=function(){return this.D};g.Fh=function(a){this.D=a;wn(this);Q(this,un.Fd)};g.Dg=function(){return this.Ia};g.Lh=function(a){this.Ia=a;wn(this);Q(this,un.Kd)};g.lg=function(){return this.Z};g.yh=function(a){this.Z=a;wn(this);Q(this,un.dc)};var un={yd:"handle force",Fd:"force rotation rate",Kd:"tight fit",dc:"extra block",xd:"handle",Qb:"shuttle",xe:"fixed block"},vn=un;z("makeDoNothingApp",function(a){return new tn(a)});z("module$exports$myphysicslab$test$DoNothingTest.do_nothing_variable_setup",function(a,b){V(a,new ff(.05,.15,a.a));a.ta(.01);a.Na(.5);If(a,"serial grouped lastpass");a.da(!1);a.$(.6);b.b=new Vc(a);X(a,"velocity");b.c=!0;b.a=.025;xn(a,!0);W(a,.8);new M(-5,-5,5,5);b=Cf(a,"handle");V(a,new sn(a,b,new I(0,-3),2,.3))});
  function yn(a,b){a.ta(.01);a.Na(.5);If(a,"serial grouped lastpass");a.da(!1);a.$(.6);X(a,"velocity");b.c=!0;b.b=new Vc(a);b.a=.025;xn(a,!0);W(a,.8);new M(-5,-5,5,5);b=Cf(a,"handle");b=new Cc("turning",b,new I(0,-3),0,Jb,0);V(a,new Ph(b))}z("module$exports$myphysicslab$test$DoNothingTest.do_nothing_constant_setup",yn);z("module$exports$myphysicslab$test$DoNothingTest.do_nothing_constant_1b_setup",function(a,b){yn(a,b);b.c=!1;X(a,"none")});function zn(a,b){V(a,new ff(0,.15,a.a));a.ta(.01);a.Na(.5);a.$(.6);If(a,"serial grouped lastpass");a.ua(99999);a instanceof Pf&&X(a,"none");b.c=!0;b.a=.025;b.b=new Vc(a)}
  function An(a,b,c){switch(b){case Bn:case Cn:case Dn:case En:var d=Z(1,5,"PENDULUM");d.xb([new I(0,-2)]);d.u(new I(0,-2),0);d.T();a.s(d);var e=new I(0,2),f=new I(0,0),h=new I(-.4,-1);switch(b){case Cn:pn(a,uf,d.G(e),d,e,c,Jb);break;case Dn:pn(a,uf,d.G(h),d,h,c,Kb);case En:pn(a,uf,d.G(f),d,f,c,Jb)}pn(a,uf,d.G(e),d,e,c,Kb);b=Bc(.2,"ATTACH1").L(G);b.u(d.G(e));a.a.add(b);W(a,.8);Qf(a);break;case Fn:case Gn:case Hn:case In:case Jn:case Kn:d=Z(1,1,"connect1");e=Z(.9,1.1,"connect2");d.L(.6);e.L(.6);d.u(new I(0,
  0),0);e.u(new I(0,0),0);a.s(d);a.s(e);d.T(0);e.T(0);f=new I(0,-.4);h=new I(-.4,0);var k=new I(.4,0),m=new I(0,.4),p=new I(0,0),q=new I(-.4,.4),r=new I(.4,-.4),u=new I(0,0),x=Hb(new I(.2,.8)),C=Hb(new I(-.5,.5)),y=Hb(new I(.6,-.4));switch(b){case In:pn(a,d,r,e,u,c,y);case Hn:pn(a,d,p,e,q,c,C);case Gn:pn(a,d,k,e,m,c,Jb);case Fn:pn(a,d,f,e,h,c,x);break;case Kn:pn(a,d,k,e,m,c,Kb),pn(a,d,k,e,m,c,Jb);case Jn:pn(a,d,f,e,h,c,Kb);pn(a,d,f,e,h,c,Jb);break;default:throw Error();}W(a,.8);Qf(a);break;default:throw Error();
  }}z("module$exports$myphysicslab$test$JointTest.pendulum_1_joint_setup",function(a,b){zn(a,b);An(a,Bn,1);Cf(a,"pendulum").Ua(Math.PI/3);Qf(a);V(a,new U(5,a.a));b=new Ub("joint-line",new I(0,0),new I(4,0));a.a.add(b)});z("module$exports$myphysicslab$test$JointTest.pendulum_2_joints_setup",function(a,b){zn(a,b);An(a,Cn,1);Cf(a,"pendulum").Ua(Math.PI/3);Qf(a);V(a,new U(5,a.a))});
  z("module$exports$myphysicslab$test$JointTest.pendulum_2_joints_offset_setup",function(a,b){zn(a,b);An(a,En,1);Cf(a,"pendulum").Ua(Math.PI/3);Qf(a);V(a,new U(5,a.a));b=Ea(Ma(a.a.a),function(a){return"JOINT1"==a.getName()});null!=b&&(b=new Ub("joint1_line",b.La().add(new I(-4,0)),b.La().add(new I(4,0))),a.a.add(b));b=Ea(Ma(a.a.a),function(a){return"JOINT0"==a.getName()});null!=b&&(b=new Ub("joint0_line",b.La().add(new I(0,-4)),b.La().add(new I(0,4))),console.log("line="+b),a.a.add(b))});
  z("module$exports$myphysicslab$test$JointTest.pendulum_3_joints_offset_setup",function(a,b){zn(a,b);An(a,Dn,1);Cf(a,"pendulum").Ua(Math.PI/3);Qf(a);V(a,new U(5,a.a))});z("module$exports$myphysicslab$test$JointTest.two_blocks_1_joint_setup",function(a,b){zn(a,b);An(a,Fn,0)});z("module$exports$myphysicslab$test$JointTest.two_blocks_2_joints_setup",function(a,b){zn(a,b);An(a,Gn,0)});z("module$exports$myphysicslab$test$JointTest.two_blocks_3_joints_setup",function(a,b){zn(a,b);An(a,Hn,0)});
  z("module$exports$myphysicslab$test$JointTest.two_blocks_4_joints_setup",function(a,b){zn(a,b);An(a,In,0);b=Cf(a,"connect1");b.K(new I(0,0),6);Af(a,b);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});z("module$exports$myphysicslab$test$JointTest.two_blocks_1_dbl_joint_setup",function(a,b){zn(a,b);An(a,Jn,0)});z("module$exports$myphysicslab$test$JointTest.two_blocks_2_dbl_joint_setup",function(a,b){zn(a,b);An(a,Kn,0);b=Cf(a,"connect1");b.K(new I(0,0),6);W(a,.8);Af(a,b);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  var Bn=1,Cn=2,En=3,Dn=4,Fn=5,Gn=6,Hn=7,In=8,Jn=9,Kn=10;var Ln={ki:"chain links",vi:"walls",yf:"extra body",ci:"fixed point left",fi:"fixed point right",di:"fixed point left X",ei:"fixed point left Y",Yh:"block length",Zh:"block width",ue:"chain",wi:"wall width"};function Mn(a,b,c,d,e){this.c=ob(E(a));this.i=b||a;this.m=c;this.h=d;this.g=e}Mn.prototype.toString=function(){return""};Mn.prototype.getName=function(a){return a?this.i:this.c};Mn.prototype.R=function(a){return this.c==E(a)};function Nn(a,b,c,d,e,f){t(b)||(b=-3*Math.PI/2);t(c)||(c=Math.PI/2);n(d)||(d=!0);e=e||On.oa;f=f||Pn.oa;Mn.call(this,e,f,b,c,d);this.f=a}l(Nn,Mn);Nn.prototype.toString=function(){return""};Nn.prototype.a=function(a){return this.f*Math.cos(a)};Nn.prototype.b=function(a){return this.f*Math.sin(a)};var On={oa:"Circle"},Pn=On;function Qn(a,b){a=new Wl(b,a);for(var c=0;6>c;c++){var d=c;var e=c,f=b;var h=f.Gb()[0];2>=e||(e=f.Zb(),h=J(h,e),h=J(e,h));e=c;f=0>e||e>=Rn.length?K:Ib(new I(2==e||3==e?1:.4,0),Rn[e]);e=a;if(0>d||d>=e.b.length)throw Error();e.b[d]=h;e.c[d]=f}return a}var Rn=Array(6);Rn[0]=Math.PI;Rn[1]=0;Rn[2]=Math.PI/2;Rn[3]=-Math.PI/2;Rn[4]=Math.PI;Rn[5]=0;function Sn(a){var b=new M(-4,-6,8,6),c=new Pf;jn.call(this,a,b,c,new Yc(c));this.c=c;a=this.Ha.w;a.g=!0;a.m="10pt sans-serif";Rj(this.Ha.A,.3);this.c.da(!0);this.H=new ff(0,.15,this.C);this.D=new U(3,this.C);this.h.c(.8);this.Ta=6;this.g=1.5;nn(this,Wk(this.a));this.I(a=ac(Zb(Yb(new O(this,Tn.zb,Un.zb,v(this.ih,this),v(this.jh,this))),1),6));nn(this,new Vl(a));this.I(a=new O(this,Tn.Jd,Un.Jd,v(this.Cg,this),v(this.Kh,this)));nn(this,new Vl(a));a=ic(this.D,qf.Za);nn(this,new Vl(a));kn(this,a);a=ic(this.H,
  jf.Ob);nn(this,new Vl(a));on(this);ln(this);mn(this);Vn(this);this.lc()}l(Sn,jn);g=Sn.prototype;g.toString=function(){return""};g.Uc=function(){};g.Ja=function(){return Ka(this.H,this.D,jn.prototype.Ja.call(this))};
  function Vn(a){var b=a.h.b();a.c.Eb();a.ia.reset();Wn(a.c,a.D,a.H,a.Ta,a.o.b,a.B);if(1<=a.Ta){var c=Cf(a.c,"block1");a.Ia=Qn(a.g,c);$l(a.za,a.Ia,"left");V(a.c,a.Ia)}2<=a.Ta&&(c=Cf(a.c,"ball2"),a.Z=Qn(a.g,c),$l(a.za,a.Z,"right"),V(a.c,a.Z));W(a.c,b);yf(a.c);sk(a.f,a.c.ma());rk(a.f,a.c.ma());xj(a.A)}
  function Wn(a,b,c,d,e,f){V(a,c);hf(c,a.a);V(a,b);pf(b,a.a);c=Z(2,2,Tn.Pb+1,Un.Pb+1);c.L(G);c.u(new I(-.4,-4.6),-Math.PI/16);a.s(c);c=Y(2,Tn.ye+2,Un.ye+2);c.L(G);c.u(new I(3,-2.1),0);a.s(c);c=Z(2,2,Tn.Pb+3,Un.Pb+3);c.L(G);c.u(new I(-3.4,-4.6),Math.PI/16);a.s(c);c=Z(1.5,4,Tn.Pb+4,Un.Pb+4);c.L(G);c.u(new I(6.7,-1),-.2);a.s(c);1<=d&&(c=Z(.8,1.5,Tn.wc+1,Un.wc+1),c.u(new I(-2,-2),0),a.s(c),null!=f&&Jg(Xj(f,c),"cyan"));2<=d&&(c=Y(.8,Tn.nb+2,Un.nb+2),c.pa(c.wa()+.5*c.P(),c.Da()+.2*c.S()),c.u(new I(-1.7,1),
  0),a.s(c),null!=f&&Jg(Xj(f,c),"orange"));3<=d&&(c=Y(1,Tn.nb+2,Un.nb+2),c.u(new I(.5,1.8+a.f/2),Math.PI),a.s(c),null!=f&&Jg(Xj(f,c),"#9f3"));4<=d&&(c=Z(.8,2,Tn.wc+4,Un.wc+4),c.L(2),c.u(new I(5,0),.2),a.s(c),null!=f&&Jg(Xj(f,c),"#f6c"));5<=d&&(c=Y(.4,Tn.nb+5,Un.nb+5),c.L(1.5),c.u(new I(5.9,2)),a.s(c),null!=f&&Jg(Xj(f,c),"#39f"));6<=d&&(c=Y(1,Tn.nb+6,Un.nb+6),c.L(1),c.u(new I(-2.5,4)),a.s(c),null!=f&&Jg(Xj(f,c),"#c99"));a=Lh(a,e);b.T(a)}g.ih=function(){return this.Ta};
  g.jh=function(a){this.Ta=a;Vn(this);Q(this,Tn.zb)};g.Cg=function(){return this.g};g.Kh=function(a){this.g=a;this.Z.f=a;this.Ia.f=a;Q(this,Tn.Jd)};var Tn={zb:"number of objects",Jd:"thrust",nb:"ball",wc:"block",ye:"fixed ball",Pb:"fixed block"},Un=Tn;z("makeCurvedTestApp",function(a){return new Sn(a)});function Xn(a,b,c){if(c<b)throw Error();var d=Ma(a.c).length;if(0>b||b>=d)throw Error();if(0>c||c>=d)throw Error();this.c=a;this.a=b;this.b=c}Xn.prototype.toString=function(){return""};function Yn(a){for(var b=ae(a);;){var c=ee(a.f),d=ae(c);if(d<b)b=d,a=c;else break}c=ae(ee(a.f));return new Xn(a.a,b,c)};function Zn(a,b,c,d){t(a)||(a=-3);t(b)||(b=3);c=c||$n.oa;d=d||ao.oa;Mn.call(this,c,d,a,b,!1)}l(Zn,Mn);Zn.prototype.a=function(a){return a};Zn.prototype.b=function(a){return 3+a*a*(-7+a*a)/6};var $n={oa:"Hump"},ao=$n;function bo(a){var b=new M(-5,-3,5,5),c=new Pf;jn.call(this,a,b,c,new Yc(c));this.c=c;this.b.m.lb("black");this.b.m.wb(.1);this.h.c(1);this.c.da(!1);this.ia.c=!1;this.H=new ff(0,.15,this.C);this.D=new U(32,this.C);this.g={tc:3,Fa:.6,Vc:0,Ta:5,rf:-Math.PI/4};nn(this,Wk(this.a));this.I(a=ac(Zb(Yb(new O(this,co.zb,eo.zb,v(this.kh,this),v(this.mh,this))),1),6));nn(this,new Vl(a));a=ic(this.D,qf.Za);nn(this,new Vl(a));kn(this,a);a=ic(this.H,jf.Ob);nn(this,new Vl(a));this.I(a=new O(this,co.Ad,eo.Ad,v(this.Bg,
  this),v(this.Jh,this)));nn(this,new Vl(a));this.I(a=new O(this,co.vd,eo.vd,v(this.ng,this),v(this.Ah,this)));nn(this,new Vl(a));this.I(a=new O(this,co.Ed,eo.Ed,v(this.lh,this),v(this.nh,this)));nn(this,new Vl(a));on(this);ln(this);mn(this);fo(this);this.lc()}l(bo,jn);g=bo.prototype;g.toString=function(){return""};g.Uc=function(){};g.Ja=function(){return Ka(this.H,this.D,jn.prototype.Ja.call(this))};
  g.lc=function(a){a=Cf(this.c,"pendulum1");this.i.a.mb(a.la()+4);this.i.a.Pa(a.la()+5);this.w.a.Pa(a.la()+4);this.w.b.Pa(a.la()+5)};g.kh=function(){return this.g.Ta};g.mh=function(a){this.g.Ta=a;fo(this);Q(this,co.zb)};g.Bg=function(){return this.g.tc};g.Jh=function(a){this.g.tc=a;fo(this);Q(this,co.Ad)};g.ng=function(){return this.g.Vc};g.Ah=function(a){this.g.Vc=a;fo(this);Q(this,co.vd)};g.lh=function(){return this.g.Fa};g.nh=function(a){this.g.Fa=a;fo(this);Q(this,co.Ed)};
  function fo(a){var b=a.h.b();a.c.Eb();V(a.c,a.H);hf(a.H,a.c.a);V(a.c,a.D);pf(a.D,a.c.a);go(a.c,a.g);W(a.c,b);Nc(a.c.v());yf(a.c);sk(a.f,0);rk(a.f,0);xj(a.A)}function go(a,b){var c=b.Ta,d=b.Fa,e=a.f/2+b.Vc;c=-(2*c*d+(c-1)*e)/2+d;for(d=0;d<b.Ta;d++){var f=Ch(b.tc,b.Fa,co.Be+(d+1),eo.Be+(d+1));f.Ua(0);a.s(f);rn(a,uf,new I(c,2),f,new I(0,b.tc),1);f.T();Qf(a);c+=f.P()+e}Cf(a,"pendulum1").Ua(b.rf);Qf(a)}var co={vd:"offset",Be:"pendulum",zb:"pendulums",Ad:"pendulum length",Ed:"radius"},eo=co;
  z("makeNewtonsCradleApp",function(a){return new bo(a)});function ho(a,b,c){var d=2*Math.PI/36,e=40*d/200,f=30*d/100,h=new I(b,0);b=new I(b+.3,0);var k=h;bf(a,new ve(new I(k.j(),k.l())));for(var m=0;36>m;m++){var p=m*d,q=Ib(b,p+e);var r=.001>Math.abs(k.j()-q.j())?q.l()>k.l():k.j()>q.j();r=T(a,q,r);0==m&&c.push(r);k=Ib(b,p+e+f);r=.001>Math.abs(k.j()-q.j())?k.l()>q.l():k.j()<q.j();T(a,k,r);q=Ib(h,p+e+f+e);r=.001>Math.abs(k.j()-q.j())?k.l()>q.l()?!1:!0:q.j()<k.j();T(a,q,r);k=Ib(h,p+d);r=.001>Math.abs(k.j()-q.j())?k.l()>q.l():k.j()<q.j();T(a,k,r)}Qe(a)};var io={pe:"anchor",rd:"escape wheel",yf:"extra body",mi:"pendulum length",si:"turning force",xi:"with gears",ze:"gear"};z("module$exports$myphysicslab$test$MiscellanyTest.newtons_cradle_setup",function(a,b){a.da(!0);If(a,"serial grouped lastpass");a.$(.6);a.ta(.01);X(a,"velocity");new M(-5,-3,5,5);b.c=!1;b.b=new Vc(a);b.a=.025;go(a,{tc:3,Fa:.6,Vc:0,Ta:5,rf:-Math.PI/4});W(a,1);V(a,new ff(0,.15,a.a));V(a,new U(32,a.a))});
  z("module$exports$myphysicslab$test$MiscellanyTest.chain_setup",function(a,b){a.da(!0);If(a,"serial grouped lastpass");a.$(.6);a.ta(.01);X(a,"velocity_joints");b.c=!1;b.b=new Vc(a);b.a=.025;var c=.15*3;var d=-180;b=[];var e;for(e=0;7>e;e++){var f=new Je(Ln.ue+"-"+e,Ln.ue+"-"+e);bf(f,new ve(new I(0,0)));T(f,new I(1,0),!1);T(f,new I(1,3),!0);T(f,new I(0,3),!0);T(f,new I(0,0),!1);Xe(f);Ye(f,new I(.5,1.5));f.xa(10/12);f.Y(.8);b.push(f);a.s(f);d+=22.5;f.Ua(Math.PI*d/180);0==e&&f.qb(new I(.5,c),new I(-5,
  4),Math.PI*d/180)}for(e=0;7>e;e++)0==e&&qn(a,b[e],new I(.5,c),0),0<e&&rn(a,b[e-1],new I(.5,2.55),b[e],new I(.5,c),0),6==e&&qn(a,b[e],new I(.5,2.55),0);Qf(a);c=Rb;for(e=0;7>e;e++)d=b[e],d.T(),d=d.Qa(),c=new M(Math.min(c.c,d.ra()),Math.min(c.b,d.b),Math.max(c.a,d.a),Math.max(c.f,d.ka()));b=c;W(a,.8);b.scale(1.15);V(a,new ff(0,.15,a.a));V(a,new U(4,a.a))});
  function jo(a,b){new M(-2,-2,6,4.5);a.da(!0);If(a,"serial grouped lastpass");a.$(.6);a.ta(.01);X(a,"velocity");b.c=!0;b.b=new Vc(a);b.a=.025;var c=new I(3.27,166*.03),d=[];b=new Je(io.pe,io.pe);bf(b,new ve(new I(61*.03,3.12)));var e=T(b,new I(.24,162*.03),!1);d.push(e);T(b,new I(3.27,5.91),!0);T(b,new I(6.63,4.38),!0);T(b,new I(155*.03,3.09),!1);T(b,new I(4.77,3.81),!0);T(b,new I(2.19,141*.03),!1);T(b,new I(61*.03,3.12),!1);Qe(b);var f=c.j(),h=c.l()-4-.6;bf(b,new ve(new I(.05+f,.6+h)));e=T(b,new I(.05+
  f,4.05+h),!0);d.push(e);T(b,new I(-.05+f,4.05+h),!0);T(b,new I(-.05+f,.6+h),!1);Ne(b,new I(.05+f,.6+h),new I(f,h));Qe(b);Xe(b);b.pa(f,h);b.xb([new I(f,h)]);e=Math.sqrt(.05*.05+.36);b.xa(e*e/2);b.L(10);a.s(b);e=K.add(new I(0,4.6));b.qb(c,e,0);qn(a,b,c,0);b.T();b.qb(c,e,.13);Qf(a);c=new Je(io.ze+2,io.ze+2);ho(c,2.16,[]);Xe(c);c.xa(2.3328);c.L(.5);f=2*Math.PI/36;e=K.add(new I(4.328+.4,0));c.u(e,-f/5-.002);c.Ba([b]);b.Ba([c]);a.s(c);qn(a,c,new I(0,0),1);c.T();e=[];f=new Je(io.rd,io.rd);h=90*.03;var k=
  new I(h,0),m=new I(h+.42,0),p=k,q=m;bf(f,new ve(new I(p.j(),p.l())));for(var r=1;24>=r;r++){var u=.01>Math.abs(p.j()-q.j())?q.l()>p.l():p.j()>q.j();p=T(f,q,u);1==r&&e.push(p);var x=2*Math.PI*r/24;p=Ib(k,x);u=.01>Math.abs(p.j()-q.j())?q.l()<p.l():p.j()<q.j();T(f,p,u);q=Ib(m,x)}Qe(f);ho(f,.8*h,e);Xe(f);f.pa(0,0);f.xb([new I(0,2)]);h+=.21;f.xa(h*h/2);f.u(K,0);f.L(1);a.s(f);qn(a,f,K,1);f.T();d=Yn(d[1]);f.C=d;d=Yn(e[0]);c.C=d;d=Yn(e[1]);b.C=d;W(a,.3);b=Cf(a,io.rd);b=new Cc("turning",b,new I(2,0),0,new I(0,
  -1),0);V(a,new Ph(b));V(a,new ff(.05,.15,a.a));V(a,new U(10,a.a))}z("module$exports$myphysicslab$test$MiscellanyTest.clock_with_gears_setup",jo);
  function ko(){var a=hh("clock_gears_perf"),b=jb();lh="MiscellanyTest.clock_with_gears";var c=new Pf,d=new Yc(c);jo(c,d);var e=sh(18);th(c,e,0,.2576836,.7900146,.0072232,.0443248,.0560475,.1720124);th(c,e,1,4.728,0,-0,-0,.190146,.1462387);th(c,e,2,-0,-0,-0,0,-.2306657,-.1377898);uh(c,d,3.5,e,1E-4);lh="MiscellanyTest.clock_gears_perf";b=jb()-b;rh(b<=1.2*a,"performance",gh(b,a))}
  function lo(a,b){a.ta(.01);a.Na(.5);a.$(.6);If(a,"serial grouped lastpass");X(a,"velocity");b.c=!0;b.a=.025;b.b=new Vc(a)}
  z("module$exports$myphysicslab$test$MiscellanyTest.non_collide_edges_setup",function(a,b){lo(a,b);b=Ch(3,.6,"pendulum1");b.u(new I(0,0),5*Math.PI/4);a.s(b);var c=Y(.5,"ball");c.L(.7);c.u(new I(-.2,-2),0);var d=ae(Ma(b.c)[0]),e=ae(Ma(b.c)[2]);d=new Xn(b,d,e);c.C=d;a.s(c);d=Z(10,.5,"floor");d.L(G);d.u(new I(0,-6),0);e=d.jc();b.T(e+.6);c.T(e+.5);a.s(d);W(a,.8);V(a,new U(3,a.a));V(a,new ff(.1,.15,a.a))});
  z("module$exports$myphysicslab$test$MiscellanyTest.damping_standard_setup",function(a,b){lo(a,b);b=Y(.5,"small");b.u(new I(2,0),0);b.K(new I(0,0),2);a.s(b);b=Y(1,"large");b.u(new I(-2,0),0);b.K(new I(0,0),2);a.s(b);W(a,.8);V(a,new ff(.1,.15,a.a))});
  z("module$exports$myphysicslab$test$MiscellanyTest.three_body_spin_setup",function(a,b,c){void 0===c&&(c=0);V(a,new ff(c,.15,a.a));a.ta(.01);a.Na(.5);If(a,"serial grouped lastpass");a.da(!1);a.$(.6);X(a,"velocity");b.b=new Vc(a);b.c=!0;b.a=.025;b=Z(1,3,"block1");b.L(2);b.K(new I(-6,0),-6);a.s(b);c=Z(1,6,"block2");c.L(.2);a.s(c);var d=Z(1,3,"block3");d.Ua(Math.PI);d.L(1);d.K(new I(12,0),-6);a.s(d);c.Ba([b,d]);b.Ba([d]);d.Ba([b]);d.kf([b]);rn(a,c,new I(0,2.7),b,new I(0,-1.3),0);rn(a,c,new I(0,-2.7),
  d,new I(0,-1.3),0);Qf(a);W(a,.8);new M(-7,-7,7,7);b=[];a.qa(b,Lc(a.v()),0);id(a,b);a:if(a=Ma(a.g),b=a.length,0<b){for(c=0;c<b;c++){d=a[c];var e=d.Wc();if(.005<Math.abs(e)){rh(!1,"joints","joint not tight, tolerance="+bb(.005)+" dist="+bb(e)+" joint="+d);break a}}rh(!0,"joint_tightness")}});
  z("module$exports$myphysicslab$test$MiscellanyTest.curved_test_error_setup",function(a,b){a.da(!0);If(a,"serial grouped lastpass");a.$(.6);a.ta(.01);X(a,"velocity_and_distance");var c=new M(-4,-6,8,6);b.a=.025;b=new ff(0,.15);var d=new U(3);Wn(a,d,b,6,c,null);R(a.v(),0,51.324999999998155);R(a.v(),1,4.938388182728488);R(a.v(),2,77.95311071780354);R(a.v(),3,82.89149890053203);R(a.v(),4,-.4);R(a.v(),5,0);R(a.v(),6,-4.6);R(a.v(),7,0);R(a.v(),8,-.19634954084936207);R(a.v(),9,0);R(a.v(),10,3);R(a.v(),11,
  0);R(a.v(),12,-2.1);R(a.v(),13,0);R(a.v(),14,0);R(a.v(),15,0);R(a.v(),16,-3.4);R(a.v(),17,0);R(a.v(),18,-4.6);R(a.v(),19,0);R(a.v(),20,.19634954084936207);R(a.v(),21,0);R(a.v(),22,6.7);R(a.v(),23,0);R(a.v(),24,-1);R(a.v(),25,0);R(a.v(),26,-.2);R(a.v(),27,0);R(a.v(),28,-2.030795390390061);R(a.v(),29,4.512865458735808E-15);R(a.v(),30,-4.281663998539167);R(a.v(),31,-1.1584129699182643E-14);R(a.v(),32,.19634954084936204);R(a.v(),33,3.3977124756576173E-17);R(a.v(),34,-3.508908223390306);R(a.v(),35,-.0022134459375859725);
  R(a.v(),36,-3.071233147002327);R(a.v(),37,-.18982118035546516);R(a.v(),38,-.7162029577728759);R(a.v(),39,-.007014474875197854);R(a.v(),40,-1.4131244157697151);R(a.v(),41,-.06857331596331266);R(a.v(),42,-2.408589255520962);R(a.v(),43,.12595281822724558);R(a.v(),44,-112.72011439193216);R(a.v(),45,-3.7286560279187655);R(a.v(),46,.48658427652460706);R(a.v(),47,.23366497836499053);R(a.v(),48,-2.764524317030443);R(a.v(),49,-.19591156901509027);R(a.v(),50,3.7792677989200723);R(a.v(),51,.30948577445391096);
  R(a.v(),52,.6997935247254902);R(a.v(),53,-.022239653137489386);R(a.v(),54,-1.858830272934958);R(a.v(),55,-.1391275239412234);R(a.v(),56,-20.117731072015484);R(a.v(),57,-1.700213190810039);R(a.v(),58,-2.8164864386930573);R(a.v(),59,-.31043319580664064);R(a.v(),60,-.936849316206379);R(a.v(),61,-.2824877573186655);R(a.v(),62,88.5596358892376);R(a.v(),63,2.1012464824287935);R(a.v(),64,2);R(a.v(),65,0);R(a.v(),66,-6.5);R(a.v(),67,0);R(a.v(),68,0);R(a.v(),69,0);R(a.v(),70,8.5);R(a.v(),71,0);R(a.v(),72,
  0);R(a.v(),73,0);R(a.v(),74,0);R(a.v(),75,0);R(a.v(),76,2);R(a.v(),77,0);R(a.v(),78,6.5);R(a.v(),79,0);R(a.v(),80,0);R(a.v(),81,0);R(a.v(),82,-4.5);R(a.v(),83,0);R(a.v(),84,0);R(a.v(),85,0);R(a.v(),86,0);R(a.v(),87,0);a.ca()});
  z("module$exports$myphysicslab$test$MiscellanyTest.roller_hump_setup",function(a,b){lo(a,b);b.c=!1;X(a,"velocity_joints");b=new Rg(new Zn);a.a.add(b);var c=Z(1,3,"block");c.u(new I(-4,4),Math.PI/4);c.K(new I(0,0),0);a.s(c);var d=c.Gb()[1];b=new ch(b,c,d);Rf(a,b);Qf(a);V(a,new U(3,a.a))});
  z("module$exports$myphysicslab$test$MiscellanyTest.roller_end_point_setup",function(a,b){lo(a,b);b.c=!1;X(a,"velocity_joints");b=new Rg(new Nn(3));a.a.add(b);var c=Z(1,3,"block");c.u(new I(-4,4),Math.PI/4);c.K(new I(0,0),0);c.Y(.5);a.s(c);var d=c.Gb()[1],e=new ch(b,c,d);Rf(a,e);e=Yg(b,new I(-2,-2));Rf(a,new vm("stop point",b,c,d,e.a,!0));Qf(a);V(a,new U(3,a.a))});function mo(a,b){V(a,new ff(0,.15,a.a));a.$(.6);If(a,"serial grouped lastpass");a.ua(99999);a instanceof Pf&&(a.ta(.01),a.Na(.5),X(a,"velocity"));b.c=!1;b.a=.025;b.b=new Vc(a)}z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_wall_setup",function(a,b){mo(a,b);b=Z(1,1,"block");b.u(new I(0,2),0);b.K(new I(0,-3),0);a.s(b);b=Z(3,1,"wall");b.u(new I(0,-2),0);b.L(G);a.s(b);W(a,1)});
  function no(a,b,c){mo(a,b);b=c?Y(.5,"ball0"):Z(1,1,"block0");b.u(new I(-3,0),0);b.K(new I(3,0),0);a.s(b);b=c?Y(.5,"ball1"):Z(1,1,"block1");b.u(new I(0,0),0);a.s(b);c=c?Y(.5,"ball2"):Z(1,1,"block2");c.u(new I(1.005,0),0);a.s(c);W(a,1)}z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_two_ball_setup",function(a,b){no(a,b,!0)});z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_two_block_setup",function(a,b){no(a,b,!1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.two_hits_one_asymmetric_setup",function(a,b){mo(a,b);b=a.f;var c=Y(.5,"left");c.u(new I(-5+b/2,0),0);c.K(new I(3,0),0);a.s(c);b=Y(.5,"center");b.u(new I(0,0),0);a.s(b);b=Y(.5,"right");b.u(new I(3,0),0);b.K(new I(-1.5,0),0);a.s(b);W(a,1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_two_separate_setup",function(a,b){mo(a,b);b=Z(1,3,"block0");b.u(new I(-4,0),0);b.K(new I(3,0),0);b.L(2);a.s(b);b=Y(.5,"ball1");b.u(new I(0,1),0);a.s(b);b=Y(.5,"ball2");b.u(new I(0,-1),0);a.s(b);W(a,1)});
  function oo(a,b,c){mo(a,b);b=c?Y(.5,"ball0"):Z(1,1,"block0");b.u(new I(-3,0),0);b.K(new I(3,0),0);a.s(b);b=c?Y(.5,"ball1"):Z(1,1,"block1");b.u(new I(0,0),0);a.s(b);c=c?Y(.5,"ball2"):Z(1,1,"block2");c.u(new I(1.005,0),0);a.s(c);c=Z(1,3,"wall");c.L(G);c.u(new I(2.01,0),0);a.s(c);W(a,1)}z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_two_on_wall_ball_setup",function(a,b){oo(a,b,!0)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_two_on_wall_block_setup",function(a,b){oo(a,b,!1)});z("module$exports$myphysicslab$test$MultipleCollisionTest.center_spin_setup",function(a,b){mo(a,b);b=Z(1,3,"block0");b.u(new I(0,0),0);b.K(new I(0,0),2);a.s(b);b=Z(1,3,"block1");b.u(new I(2.8,0),Math.PI/2);a.s(b);b=Z(1,3,"block2");b.u(new I(-2.8,0),-Math.PI/2);a.s(b);W(a,1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.side_spin_setup",function(a,b){mo(a,b);b=Z(1,3,"block0");b.u(new I(0,0),Math.PI/2);a.s(b);b=Z(1,3,"block1");b.u(new I(2.8,1.001),0);b.K(new I(0,0),2);a.s(b);b=Z(1,3,"block2");b.u(new I(-2.8,1.001),Math.PI/2);a.s(b);W(a,1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.joint_collision_setup",function(a,b){mo(a,b);b=Ih(a,20,10);var c=Z(1,3,"joint1");c.u(new I(2,-4.495),Math.PI/2);var d=Z(1,3,"joint2");d.u(new I(4,-4.495),Math.PI/2);a.s(c);a.s(d);rn(a,c,new I(0,1),d,new I(0,-1),0);Qf(a);c=Z(1,3,"free1");c.u(new I(-6,-4.495),Math.PI/2);c.K(new I(3,0),0);a.s(c);c=new U(4,a.a);V(a,c);c.T(b+.5);W(a,.8)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.joint_collision_2_setup",function(a,b){mo(a,b);b=Z(1,3,"joint1");b.u(new I(2,0),Math.PI/2);var c=Z(1,3,"joint2");c.u(new I(0,0),Math.PI/2);c.K(new I(3,0),0);a.s(b);a.s(c);rn(a,b,new I(0,1),c,new I(0,-1),0);Qf(a);b=[];a.qa(b,Lc(a.v()),0);id(a,b);W(a,.8)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.joint_collision_3_setup",function(a,b){mo(a,b);b=Z(1,3,"joint1");b.u(new I(2,0),Math.PI/2);a.s(b);var c=Z(1,3,"joint2");c.u(new I(0,0),Math.PI/2);a.s(c);rn(a,b,new I(0,1),c,new I(0,-1),0);Qf(a);b=Y(.5,"free1");b.u(new I(-6,0),Math.PI/2);b.K(new I(3,0),0);a.s(b);W(a,1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.joint_collision_4_setup",function(a,b){mo(a,b);b=Z(1,3,"joint1");b.u(new I(2,0),Math.PI/2);b.K(new I(0,0),3);a.s(b);var c=Z(1,3,"joint2");c.u(new I(0,0),Math.PI/2);c.K(new I(0,0),-5);a.s(c);rn(a,b,new I(0,1),c,new I(0,-1),0);Qf(a);W(a,.8);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.joint_collision_5_setup",function(a,b){mo(a,b);b=a.f;var c=Y(.5,"body4");c.L(2);c.u(new I(1+b/2,0));a.s(c);c=Y(.5,"body1");c.L(2);c.u(new I(-5,0),0);c.K(new I(3,0),0);a.s(c);b=Z(2,1,"body2");b.u(new I(-2,0));a.s(b);c=Z(2,1,"body3");c.u(new I(-.5,0));a.s(c);rn(a,b,new I(.75,0),c,new I(-.75,0),0);Qf(a);W(a,1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.two_in_box_setup",function(a,b){mo(a,b);b=a.f;var c=Bh(3*b/2+2.2,2*b/2+1.2);c.u(new I(0,0));a.s(c);c=Y(.5,"body2");c.u(new I(-.5-b/4,0));a.s(c);c=Y(.5,"body3");c.u(new I(.5+b/4,0));c.K(new I(3,0),0);a.s(c);W(a,1)});
  z("module$exports$myphysicslab$test$MultipleCollisionTest.one_hits_two_in_box_setup",function(a,b){mo(a,b);b=a.f;var c=Bh(3*b/2+2.2,2*b/2+1.2);c.u(new I(0,0));a.s(c);c=Y(.5,"body2");c.u(new I(-.5-b/4,0));a.s(c);c=Y(.5,"body3");c.u(new I(.5+b/4,0));a.s(c);c=Y(.5,"body4");c.u(new I(-5,0));c.K(new I(3,0),0);a.s(c);W(a,1)});function po(a,b){b=n(b)?b:0;var c=Fh(15.3,1,2,Jh.Sb+"_"+qo.Dc,Kh.Sb+"_"+ro.Dc);c.u(new I(-5,-5+b),-Math.PI/4);c.L(G);a.s(c);var d=Fh(15.3,1,2,Jh.Sb+"_"+qo.Hc,Kh.Sb+"_"+ro.Hc);d.u(new I(5,-5+b),Math.PI/4);d.L(G);a.s(d);var e=Fh(1,15,3,Jh.Sc,Kh.Sc);e.u(new I(10.5,7.5+b),0);e.L(G);a.s(e);var f=Fh(1,15,1,Jh.Rc,Kh.Rc);f.u(new I(-10.5,7.5+b),0);f.L(G);a.s(f);var h=[c,d,e,f];A(h,function(a){a.Ba(h)});return c.G(new I(6.65,.5)).l()}
  function so(a,b,c){for(var d=0,e=0,f=0;;){var h=b.b+2.2+4*d+.2*d;if(h+2.2>b.ka())break;for(;;){var k=2.2+b.ra()+4*e+.2*e;if(k+2.2>b.a)break;f++;var m=c?Y(2):Z(4,4);m.u(new I(k,h));m.L(1);a.s(m);if(10<f)return;e++}e=0;d++}}
  function to(a,b,c,d,e){var f=n(f)?f:!0;for(var h=[],k=0;k<b;k++){var m=.2+ef(e)/4294967295,p=.2+ef(e)/4294967295,q=Math.PI*(ef(e)/4294967295);uo(e);if(f)var r=Z(m,p);else{var u=void 0,x=void 0;r=Math.sqrt(m*m+p*p)/2;n(x)||(x=Math.PI/4);n(u)||(u=3*Math.PI/4);for(var C=[0],y=0,w=0;3>w;w++){var H=(.5+ef(Gh)/4294967295)*(2*Math.PI-y)/(4-w);H=Math.min(Math.min(u,2*Math.PI-y-x*(3-w)),Math.max(x,H));H=Math.min(2*Math.PI,y+H);C.push(H);y=H}u=new Je(void 0,void 0);y=x=new I(r,0);bf(u,new ve(y));for(w=1;4>
  w;w++)H=new I(r*Math.cos(C[w]),r*Math.sin(C[w])),T(u,H,H.j()<y.j()),y=H;T(u,x,!1);Xe(u);u.xa(r*r/6);u.Y(.8);r=u}C=m*(ef(e)/4294967295)/4;w=p*(ef(e)/4294967295)/4;m=.9*m/2;p=.9*p/2;C<-m?C=-m:C>m&&(C=m);w<-p?w=-p:w>p&&(w=p);r.pa(C,w);r.u(new I(c,d),q);p=r.Xd();r.u(new I(c+(c-p),d),q);c=r.Yd()+.05;r.L(r.P()*r.S());a.s(r);h.push(r)}}
  function vo(a,b,c,d){var e=Z(1,1);e.L(.6);e.u(new I(b,c),d);a.s(e);var f=Z(.9,1.1);f.L(.6);f.u(new I(b,c),d);a.s(f);rn(a,e,new I(0,-.4),f,new I(-.4,0),0);rn(a,e,new I(.4,0),f,new I(0,.4),0);Qf(a)}
  function uo(a){a=a||wo;for(var b=Array(3),c=!0,d=0;3>d;d++){var e=Math.min(1,Math.max(0,.1+1.5*(ef(a)/4294967295)));.9>e&&(c=!1);b[d]=e}if(c)b=uo(a);else{a="#";b=[b[0],b[1],b[2]];for(c=0;3>c;c++)d=b[c],d=Math.floor(.5+256*d),a+=255<=d?"ff":0>=d?"00":"0123456789abcdef".charAt(Math.floor(d/16))+"0123456789abcdef".charAt(d%16);b=a}return b}
  var wo=new cf(901745),qo={ji:"number of blocks",Xh:"add block",ni:"rebuild",ti:"two piles",ai:"connected blocks",bi:"endless loop",ii:"loop time",Gc:"random seed",ui:"wall",Dc:"left",Hc:"right",ri:"square blocks"},ro=qo;z("module$exports$myphysicslab$test$PileTest.connected_blocks_pile_setup",function(a,b){new M(-3.5,-9.2,3.5,-1);V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);a.ua(12);X(a,"velocity_and_distance");b.b=new Gl(a);b.c=!0;b.a=.025;b=po(a);var c=new cf(4);to(a,5,-6,-2,c);vo(a,6,7,Math.PI/8+.05);W(a,.8);c=new U(10);V(a,c);sf(c,Bf(a));c.T(b)});
  z("module$exports$myphysicslab$test$PileTest.stable_connected_blocks_pile_setup",function(a,b){new M(-3.5,-9.2,3.5,-1);V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);a.ua(0);X(a,"velocity_and_distance");b.b=new Gl(a);b.c=!0;b.a=.025;b=po(a);var c=new cf(4);to(a,5,-6,-2,c);vo(a,6,7,Math.PI/8+.05);W(a,.8);c=a.v();R(c,28,-1.307317532081011);R(c,29,3.4568078175222356E-14);R(c,30,-7.679563403384621);R(c,31,-4.2635556397879164E-14);R(c,32,3.9269908169872414);R(c,33,-1.3993648320570288E-15);
  R(c,34,-.6338649363183791);R(c,35,2.230623502423369E-14);R(c,36,-8.36840450674311);R(c,37,-9.196703672775336E-15);R(c,38,3.926990816987241);R(c,39,-1.8602527688658332E-14);R(c,40,-.863509453866681);R(c,41,2.5327666670337238E-14);R(c,42,-7.443359658566195);R(c,43,-3.609941383157646E-14);R(c,44,16.493361431346415);R(c,45,-3.834636183127082E-14);R(c,46,-.2794896421175775);R(c,47,2.372714000478332E-14);R(c,48,-8.88957479858616);R(c,49,-5.4309467895987256E-15);R(c,50,21.205750411731103);R(c,51,-7.082394166687482E-14);
  R(c,52,.1624361210614297);R(c,53,6.727726003835136E-13);R(c,54,-8.875842608812114);R(c,55,1.6018768653977866E-12);R(c,56,-.7853981633975663);R(c,57,-1.3844587651630329E-12);R(c,58,.7732428782686775);R(c,59,-4.652887853860082E-11);R(c,60,-7.805472491546362);R(c,61,-4.652474225205978E-11);R(c,62,3.926990816987241);R(c,63,3.6456541219008105E-15);R(c,64,.19928633339146276);R(c,65,4.859438051687864E-11);R(c,66,-7.791391682401767);R(c,67,-4.718455523774639E-11);R(c,68,3.9269908169437704);R(c,69,-4.409839525917456E-12);
  a.ca();yf(a);a.ua(1);c=new U(10);V(a,c);sf(c,Bf(a));c.T(b)});
  z("module$exports$myphysicslab$test$PileTest.near_stable_connected_blocks_pile_setup",function(a,b){new M(-3.5,-9.2,3.5,-1);V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);a.ua(0);X(a,"velocity_and_distance");b.b=new Gl(a);b.c=!0;b.a=.025;b=po(a);var c=new cf(4);to(a,5,-6,-2,c);vo(a,6,7,Math.PI/8+.05);W(a,.8);c=a.v();R(c,28,-1.3074166349097716);R(c,29,-.010840525228905605);R(c,30,-7.6748558792433785);R(c,31,.03162290166164498);R(c,32,3.9269569334324403);R(c,33,.004326577793446015);
  R(c,34,-.6295172375406212);R(c,35,-.12156323274219026);R(c,36,-8.363693937673977);R(c,37,-.11589631970547537);R(c,38,3.9243199960788253);R(c,39,-.07310382168395342);R(c,40,.31893418138882307);R(c,41,-.6319951813598994);R(c,42,-6.8097160566956365);R(c,43,2.1006107619247305);R(c,44,15.6167669356595);R(c,45,6.9807796520379455);R(c,46,-.2794020111788371);R(c,47,.005559355507812818);R(c,48,-8.889415521500014);R(c,49,.012931603383049635);R(c,50,21.205702274040966);R(c,51,-.02672084560754362);R(c,52,.16264515275973984);
  R(c,53,.03730970034660824);R(c,54,-8.875487287160695);R(c,55,.0468739543956697);R(c,56,-.7852734225490905);R(c,57,.017531522195257027);R(c,58,.7681938978094821);R(c,59,-.22265049769722722);R(c,60,-7.787103915157201);R(c,61,.20258649058167544);R(c,62,3.89184653938446);R(c,63,.4490870396661657);R(c,64,.19458710272314095);R(c,65,-.23157678224607303);R(c,66,-7.753146072367401);R(c,67,-.05129863223356834);R(c,68,3.89184653938771);R(c,69,.4490870396647062);a.ca();yf(a);a.ua(1);c=new U(10);V(a,c);sf(c,Bf(a));
  c.T(b)});
  z("module$exports$myphysicslab$test$PileTest.pile_config_1_setup",function(a,b){new M(-7,0,7,8);V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);a.ua(0);X(a,"velocity_and_distance");b.b=new Gl(a);b.c=!1;b.a=.025;var c=new cf(594074265);b=po(a,9.348706704297266);to(a,3,-9.9,19,c);to(a,3,-9,16,c);vo(a,3,21,0);W(a,.8);c=a.v();R(c,28,-4.826036961610339);R(c,29,5.507262977202934);R(c,30,6.3686904268363635);R(c,31,-7.953916554586297);R(c,32,-2.4297073283893753);R(c,33,-3.2910792690296575);
  R(c,34,-.39136366049574994);R(c,35,11.596594391854405);R(c,36,6.401989888500372);R(c,37,-6.3050312680892455);R(c,38,2.833546728939748);R(c,39,11.84282384112968);R(c,40,-2.6677254408578985);R(c,41,7.500061085685241);R(c,42,4.741186660019);R(c,43,-7.976266185005914);R(c,44,8.581332736951099);R(c,45,12.121849497962163);R(c,46,-.5750827056429556);R(c,47,11.45349352174985);R(c,48,1.8528786215208863);R(c,49,-2.623975579277876);R(c,50,-4.0009341616207355);R(c,51,-11.167073162011471);R(c,52,.4901868773177362);
  R(c,53,10.209045158895574);R(c,54,.8991047151294028);R(c,55,9.426218453147095);R(c,56,-1.0250437996613715);R(c,57,58.10877825300471);R(c,58,.38386358504151985);R(c,59,-1.1422881143836392);R(c,60,3.346206103148756);R(c,61,6.623070984882051);R(c,62,23.57586164417926);R(c,63,35.37119888296379);R(c,64,-.674508123401993);R(c,65,-7.960427953540814);R(c,66,4.248616367886464);R(c,67,.683655285060861);R(c,68,-2.0251585739061584);R(c,69,-8.34224694613519);R(c,70,-1.2106565077697318);R(c,71,-9.494215020773796);
  R(c,72,4.065566370010308);R(c,73,5.146494032387025);R(c,74,-2.0251585739061584);R(c,75,-8.34224694613518);a.ca();yf(a);a.ua(0);c=new U(10);V(a,c);sf(c,Bf(a));c.T(b)});function xo(a,b){new M(-3.5,-9.2,3.5,-1);V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);X(a,"velocity");b.b=new Gl(a);b.c=!0;b.a=.025;a.ua(13);b=po(a);var c=new cf(0);to(a,10,-5.5,-2,c);W(a,.5);c=new U(3);V(a,c);sf(c,Bf(a));c.T(b)}z("module$exports$myphysicslab$test$PileTest.pile_10_random_blocks_setup",xo);
  function yo(){var a=hh("pile_10_perf"),b=jb();lh="PileTest.pile_10_random_blocks";var c=new Pf,d=new Yc(c);xo(c,d);var e=sh(84);th(c,e,0,-5,0,-5,0,-.7853982,0);th(c,e,1,5,0,-5,0,.7853982,0);th(c,e,2,10.5,0,7.5,0,0,0);th(c,e,3,-10.5,0,7.5,0,0,0);th(c,e,4,-1.4688341,0,-7.366921,-0,5.507218,-0);th(c,e,5,-1.2888741,0,-6.8611893,-0,2.3604327,0);th(c,e,6,-1.0893343,0,-7.5132601,-0,.7919455,-0);th(c,e,7,-.5829513,0,-8.0161773,-0,.7896626,0);th(c,e,8,-.0678191,-0,-8.6057224,-0,.7853285,-0);th(c,e,9,.1123147,
  -0,-7.4965551,-0,-.771069,-0);th(c,e,10,.0843676,0,-7.8743626,-0,.8066319,0);th(c,e,11,.7205631,0,-8.2682827,-0,.7924107,0);th(c,e,12,.7795149,0,-7.7446799,0,3.9304584,-0);th(c,e,13,.3485821,0,-6.9817453,-0,2.3673243,-0);jb();uh(c,d,8,e,.01);uh(c,d,10,null,rb,0,1E-5,0);ih("info: "+lh+(" collisions="+d.i.a+", steps="+d.i.c+", contacts="+c.V));b=jb()-b;lh="PileTest.pile_10_perf";rh(b<1.2*a,"performance",gh(b,a))}
  function zo(a,b){V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);X(a,"velocity");b.b=new Gl(a);b.c=!0;b.a=.025;a.ua(14);b=po(a);var c=new U(3,a.a);V(a,c);c.T(b)}z("module$exports$myphysicslab$test$PileTest.pile_uniform_balls_setup",function(a,b){zo(a,b);b=new M(-9,5,9,20);so(a,b,!0);W(a,.8)});z("module$exports$myphysicslab$test$PileTest.pile_uniform_blocks_setup",function(a,b){zo(a,b);b=new M(-9,5,9,20);so(a,b,!1);W(a,.8)});
  z("module$exports$myphysicslab$test$PileTest.pile_20_random_blocks_setup",function(a,b){new M(-3.5,-9.2,3.5,-1);V(a,new ff(.05,.15,a.a));a.da(!1);If(a,"serial grouped lastpass");a.$(.6);X(a,"velocity");b.b=new Gl(a);b.c=!0;b.a=.025;a.ua(14);b=po(a);var c=new cf(0);to(a,10,-5.5,-2,c);to(a,10,-6,-.5,c);W(a,.5);c=new U(3);V(a,c);sf(c,Bf(a));c.T(b)});function Ao(a,b){V(a,new ff(0,.15,a.a));a.ta(.01);a.Na(.5);a.$(.6);If(a,"serial grouped lastpass");X(a,"velocity");b.b=new Vc(a);b.c=!1;b.a=.01}function Bo(a,b,c){Ao(a,b);b=Z(1,3,"block");a.s(b);c=new nm(uf,new I(0,2),b,Kb,4,c);Rf(a,c);b.u(new I(0,-6),0);Qf(a);b.T();b.u(new I(6,-3),-Math.PI/4);Qf(a);c=new U(10,a.a);V(a,c);W(a,.8)}z("module$exports$myphysicslab$test$RopeTest.pendulum_rope_setup",function(a,b){Bo(a,b,1)});
  z("module$exports$myphysicslab$test$RopeTest.pendulum_rod_setup",function(a,b){Bo(a,b,2)});z("module$exports$myphysicslab$test$RopeTest.pendulum_rope_bounce_setup",function(a,b){Ao(a,b);b=Z(1,3,"block");a.s(b);var c=new nm(uf,new I(0,2),b,Kb,4,1);Rf(a,c);b.u(new I(0,-6),0);Qf(a);b.T();b.u(new I(-2,0),Math.PI/4);Af(a,b);b=new U(10,a.a);V(a,b);W(a,.8)});
  function Co(a,b,c,d){Ao(a,b);b=Z(1,3,"block");b.u(new I(-1.5,0),Math.PI/4);b.K(new I(0,-4),0);var e=Y(1,"ball");e.u(new I(1.5,0),3*Math.PI/4);e.K(new I(0,4),0);var f=new nm(b,Kb,e,new I(.2,.3),4,c);d&&(d=new Cc("constant",b,new I(0,0),0,new I(-2,0),1),V(a,new Ph(d)),b.K(new I(0,0),0),e.K(new I(0,0),0));a.s(b);a.s(e);Rf(a,f);2==c&&Qf(a);W(a,.8)}z("module$exports$myphysicslab$test$RopeTest.double_rope_spin_setup",function(a,b){Co(a,b,1,!1)});
  z("module$exports$myphysicslab$test$RopeTest.double_rod_spin_setup",function(a,b){Co(a,b,2,!1);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});z("module$exports$myphysicslab$test$RopeTest.double_rope_thrust_setup",function(a,b){Co(a,b,1,!0)});z("module$exports$myphysicslab$test$RopeTest.double_rod_thrust_setup",function(a,b){Co(a,b,2,!0)});function Do(a,b,c){V(a,new ff(void 0===c?.05:c,.15,a.a));a instanceof Pf&&(a.ta(.01),a.Na(.5),X(a,"velocity_and_distance"));a.$(.6);If(a,"serial grouped lastpass");b.b=new Vc(a);b.c=!0;b.a=.025}z("module$exports$myphysicslab$test$SpeedTest.ball_vs_wall_setup",function(a,b){Do(a,b);b=Y(.2,"fast_ball");b.L(.1);b.u(new I(-5,0),0);b.K(new I(200,153),0);b.Y(.95);a.s(b);Ih(a,12,12,.01)});
  z("module$exports$myphysicslab$test$SpeedTest.ball_vs_circle_setup",function(a,b){Do(a,b);b=Y(.2,"fast_ball");b.L(.1);b.u(new I(-5,0),0);b.K(new I(200,153),0);a.s(b);Ih(a,12,12,.01);b=Y(4,"fixBall");b.L(G);b.u(new I(0,0),0);a.s(b);W(a,.95)});z("module$exports$myphysicslab$test$SpeedTest.small_small_setup",function(a,b){Do(a,b,0);new M(-32,-12,32,12);b.b=new Gl(a);b.a=.1;b=Z(1,1,"block0");b.u(new I(-30,0),Math.PI/4);b.K(new I(100,0),0);var c=Z(1,1.3,"block1");c.u(new I(5,0));a.s(b);a.s(c);W(a,1)});function Eo(a,b,c){V(a,new ff(void 0===c?0:c,.15,a.a));a.ta(.01);a.Na(.5);a.$(.6);If(a,"serial grouped lastpass");X(a,"velocity");a.ua(99999);b.c=!0;b.a=.025;b.b=new Vc(a)}function Fo(){var a=hh("six_blocks_perf"),b=jb();Go();lh="StraightStraightTest.six_blocks_perf";b=jb()-b;rh(b<=1.2*a,"performance",gh(b,a))}
  function Ho(a,b){Eo(a,b);a.$(.6);for(b=0;6>b;b++){var c=Z(1,3,"block"+b);0==b&&c.L(.6);c.u(new I(-4.4+1.73*b,-3+b%2*2),Math.PI*(.3-.15*b));a.s(c)}b=new U(5,a.a);W(a,.6);V(a,b);a=Ih(a,12,12,1);b.T(a)}z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_settle_setup",Ho);
  function Go(){lh="StraightStraightTest.six_blocks_settle";var a=new Pf,b=new Yc(a);Ho(a,b);var c=sh(36);th(a,c,0,-4.4957656,0,-5.4912852,-0,1.570724,0);th(a,c,1,-2.487432,-0,-4.4929667,0,6.014E-4,0);th(a,c,2,-1.4838306,-0,-4.4927091,-0,-6.352E-4,0);th(a,c,3,.6040017,-0,-4.9812241,0,-1.2003959,0);th(a,c,4,3.4838254,0,-5.4911445,-0,-1.5701177,0);th(a,c,5,5.4927459,-0,-4.4907594,0,-3.1415895,0);uh(a,b,6.2,c,1E-5);uh(a,b,9,null,rb,0,.001,0)}
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_settle_2_setup",function(a,b){Ho(a,b);b.c=!1;X(a,"velocity_and_distance")});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_1_setup",function(a,b){Eo(a,b);b=Ih(a,12,12,1);for(var c=0;6>c;c++){var d=Z(1,3);if(0==c)var e=d;a.s(d)}W(a,.8);c=new U(3,a.a);V(a,c);c.T(b);if(null==e)throw Error();e=e.la()-24;b=a.v();R(b,e+24,-4.490076631581924);R(b,e+25,2.0679515313825692E-25);R(b,e+26,-5.490392097196945);R(b,e+27,0);R(b,e+28,1.570728988355649);R(b,e+29,-1.6543612251060553E-24);R(b,e+30,-1.5396242471983494);R(b,e+31,-4.0943711582070005E-5);R(b,e+32,-4.4898881738213126);
  R(b,e+33,8.353404996231836E-4);R(b,e+34,-2.6278523346345535E-4);R(b,e+35,-.001671999187052211);R(b,e+36,-.5296767271003119);R(b,e+37,9.92762060763532E-4);R(b,e+38,-4.49018008838388);R(b,e+39,.0011794589874429395);R(b,e+40,-3.01799353204607E-4);R(b,e+41,-.0023610557776990396);R(b,e+42,1.4801168847646147);R(b,e+43,-9.352577078533856E-5);R(b,e+44,-5.490056858917946);R(b,e+45,.0011493692932998238);R(b,e+46,-1.5708341618266073);R(b,e+47,1.8706997138135463E-4);R(b,e+48,-2.638125069016346);R(b,e+49,-.045351341609523976);
  R(b,e+50,-3.5270071804900893);R(b,e+51,-.0024453038919747434);R(b,e+52,9.271714397689529);R(b,e+53,-.07484736093054672);R(b,e+54,4.490094678411976);R(b,e+55,2.098397952794706E-12);R(b,e+56,-5.4902652470048166);R(b,e+57,6.294899545886009E-12);R(b,e+58,-1.5708101952854403);R(b,e+59,-4.1966191264251884E-12);a.ca()});
  function Io(a,b,c,d){n(d)||(d=!0);Eo(a,b,.05);b=0;d&&(b=Ih(a,12,12,1));for(var e=0;6>e;e++){var f=Z(1,3);if(0==e)var h=f;a.s(f)}d||(b=Ih(a,12,12,1));if(null==h)throw Error();d=h.la();h=a.v();for(e=0;36>e;e++)R(h,d+e,c[e]);W(a,.8);c=new U(3,a.a);V(a,c);c.T(b);a.ca()}
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_4_setup",function(a,b){Io(a,b,[-3.3545261663555896,-.355180346288018,-4.4091676608815025,.01888840410875564,-.33441693630855124,.78578131361648,-1.5175707648198662,.003206135053147014,-5.4907362257189956,5.436678584988201E-6,-4.712417858395409,-3.6244872808309476E-6,-5.030329202688726,-.9844534862980994,-3.109909451638245,-.17187889001353449,-.3350299277503665,.7861778657011144,-4.422188956281887,-.06277409660041239,-4.40909237120817,
  .020106263134300622,21.655729079144088,.7861180509905386,1.4901049976435212,.0023613793610671716,-5.490185485906266,.0056322362177322945,-7.853916200558516,.0016857384982070047,4.490161555800651,1.5819651323954016E-4,-5.4900738791375066,.0040804895964462965,-1.570843916633821,-.0027203695546943584]);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_5_setup",function(a,b){Io(a,b,[-5.489965075066497,.004087251835193464,-4.490052900839322,.001362247691451171,-4.6677414087053384E-5,-.0027248769565007607,-3.401717547428832,.0019117628245731183,-4.971189895635601,.008305583285810448,-1.1920467322044246,.006870863906211994,-.5748706825516253,-.0417381964456494,-5.490251890670699,-6.808027313556439E-17,-1.5709353569488083,-2.42861286636753E-17,2.426724225565317,-.04173819644564949,
  -5.4905529523168,-3.2612801348363973E-16,1.5705328359361475,1.1188966420050406E-16,4.465167990404531,-.00719303842885928,-4.741243000027946,-.016690598972297344,.981668335500221,.017218871182208717,.7783656030362079,-.029240805650546875,-4.481170584745237,2.783746992588203E-4,-1.5714036339542785,4.1296827244508794E-5])});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_6_setup",function(a,b){Io(a,b,[-2.479254054598802,-.008383172809440613,-4.490192922711039,.0012134875363453183,8.791012830956698E-5,.002427615317992623,-.4693351531726902,-.005211501828657076,-5.490287752459545,.0014093667389195456,-4.712383176065981,9.395796500458078E-4,.7911849247646761,.03453590587929963,-4.473392209630643,.10383355825723466,1.5650945215047225,-.06935148785076672,-4.489184128917945,-.0042418646209149355,-5.491555977672989,
  .00150356820555,20.420918091036057,-.0010021899368622567,2.535618102853626,.0073038373861507525,-5.491785588161739,-5.204170427930421E-18,-7.854694744724996,-8.673617379884035E-18,4.441714724437791,-.02949542212365918,-4.651840897521864,-.04573324755774091,.9731961682115491,.07207352623369913,236.15012435916688])});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_7_setup",function(a,b){Io(a,b,[-1.4008804821505663,-1.0953755183567188E-9,-4.981046079045859,-1.9992068048789671E-10,-1.200071147740437,-1.6427989772619893E-10,1.4796160598187693,1.1235988991072552E-13,-5.491714158480645,-1.2662785196137558E-15,-4.712740442557912,-8.417187575915385E-16,1.688449935615377,-1.0824993284576629E-9,-4.4820860141082655,3.777030401650401E-13,-1.5711430162348365,-1.8223005738926858E-15,-4.490145272150233,
  2.5960715059151575E-14,-5.490437318063508,4.230764788816007E-6,20.420090322954632,-5.203366672719886E-14,4.489950496597266,1.1283686080194514E-13,-5.4917274053566505,-3.0534805866899067E-17,-7.853654066004802,-2.6598913917167402E-17,4.418005502150728,-2.0572215074183382E-11,-3.945734031406925,-2.180998329736897E-10,1.1777659258720574,1.8268885795336528E-10])});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_8_setup",function(a,b){Io(a,b,[-1.4006667035152596,-9.693089413206307E-4,-4.9838649196508955,2.2302351400742795E-5,-1.202117102796731,1.829539682510507E-5,1.4797014053709832,-.0010921604658408748,-5.496521932131233,1.1762751343205065E-8,-4.71224974108439,7.842198285288454E-9,1.6885479215423251,-9.706566845123935E-4,-4.48778364199535,4.1213406048957926E-8,-1.5704902770116411,1.5105026038341254E-8,-4.490015398935664,-5.181172627948807E-4,
  -5.4919767634570285,.0015545518282173046,20.420313643816957,.0010363545502616025,4.489864055427361,-.0010921643777436155,-5.496486998294175,-4.3368086899420177E-19,-7.853455994143339,2.3852447794681098E-18,4.417991142178613,-1.8443050080908566E-5,-3.9505739533206237,-1.9531414976105667E-4,1.1779001844891648,1.6408965739089505E-4])});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_9_setup",function(a,b){Io(a,b,[-1.4098834956330757,-.011021823548695726,-4.901190292092527,.06896168332172642,-1.1329171003184435,.06015134284633006,1.1048833769390685,-.2383595895375249,-5.490575648872165,-5.985483064997513E-23,-4.7121628015794945,1.061957734850305E-22,1.6703348810645853,-.021994369069460246,-4.481173864069186,5.869360705162414E-5,-1.570496969228481,6.504411289860808E-6,-4.490089724681169,-8.470329472543003E-22,
  -5.490535827441271,2.309033496920736E-5,20.4202774547725,0,4.115016540060451,-.23835958953752487,-5.491084890522951,0,-7.854124817129153,0,4.413957328404009,-4.263125237630913E-4,-3.9479177969108523,-.004412366070905673,1.1755736147755107,.00367304369690573])});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_10_setup",function(a,b){Io(a,b,[-4.112367787413438,.39026511526212854,-3.47432218043552,-.04844606751715124,-.01681971028050594,.15444140342140358,-4.4902665319358945,.009708687447405103,-5.492362116791236,.04110771891404174,-1.5703141789281565,-.019389331575013213,-1.1117912478988092,-.08180869895105755,-4.472560662315691,-.05278060856444347,-1.5653868372165212,-.4933976799463698,-.2864037845545129,-.021580789346602885,-5.48855328848715,
  -.5111254210373286,-1.5667732606816016,-.005675550346695361,1.4297966380301976,-.6222954049493852,-4.380312958037922,-1.3388667898420845,.7202422536661243,.3569620001764969,4.358511630657416,-.1897987425234288,-5.492781293281953,1.5820678100908484E-16,-1.5724773538024814,2.7755575615628914E-17]);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_11_setup",function(a,b){Io(a,b,[-3.4807418124962246,-.0032609654797268383,-4.690642129379,.005884959813226634,-4.069471245774962,.006533340019550788,-5.490093621397956,-1.2407709188295415E-24,-4.490584738508103,4.576046549796252E-6,-3.340109945538294E-6,-4.1359030627651384E-24,1.4800261549386085,-.0027374555459506204,-5.490302215555195,3.7694317660346175E-18,-1.5708678273429248,2.5128946259988686E-18,-1.5300317991165833,-.005469762569256994,
  -5.490109925347951,3.8857812481217984E-17,1.570865119007061,1.1102214371068299E-17,4.490046868656358,-9.997577275171447E-18,-5.490157832629273,2.346783365031779E-5,1.5708320499034099,-4.2136073022102525E-18,4.47198537447647,-.0029572640614469424,-4.480593249937791,2.3091036442906875E-5,-4.71206604332963,1.807523974207076E-7],!1)});
  z("module$exports$myphysicslab$test$StraightStraightTest.six_blocks_12_setup",function(a,b){Io(a,b,[-3.9795534864733946,.5603947124399835,-4.494999999999999,-1.5563590077982844E-14,-7.348187395995754E-16,-2.9029394275278674E-16,-2.950617113946953,-.2553017864528158,-4.494999999999999,-5.3058849962594086E-15,-1.7908831144300597E-15,6.608018768607392E-14,-.5200000006730288,-9.7046021848972E-19,-5.494999999999999,-7.96944081510657E-15,-1.5707963267948968,8.726266789357274E-16,2.4849999993269716,-2.154014466284064E-15,
  -5.494999999999999,-9.922729685802491E-15,1.5707963267948963,-2.6256274349643637E-15,4.489999999326985,2.1562780968094406E-15,-4.494999999999999,-1.2431040096932952E-14,9.528498640341283E-16,-4.800359450590645E-14,5.494999999380792,-1.2931512186863026E-18,-4.494999999999999,-6.99044503042167E-15,-1.974518458830297E-16,-5.007438423172913E-16],!1);b=[];a.qa(b,Lc(a.v()),0);id(a,b)});
  z("module$exports$myphysicslab$test$StraightStraightTest.hexagon_1_setup",function(a,b){Eo(a,b);b=Math.sin(Math.PI/3);var c=new Je("hexagon",void 0),d=Math.sin(Math.PI/3),e=Math.cos(Math.PI/3);bf(c,new ve(new I(1-e,0)));T(c,new I(1+e,0),!1);T(c,new I(2,d),!1);T(c,new I(1+e,2*d),!0);T(c,new I(1-e,2*d),!0);T(c,new I(0,d),!0);T(c,new I(1-e,0),!1);Xe(c);d=Math.sqrt(3)/2;c.xa(d*d/2);c.Y(.8);c.u(new I(0,b+.009),-2*Math.PI/3);a.s(c);c=Z(1,1,"block");c.u(new I(0,2*b+.018+Math.sqrt(2)/2),Math.PI/4);a.s(c);
  b=Z(6,1,"floor");b.L(G);b.u(new I(0,-.5),0);a.s(b);W(a,.8);V(a,new U(3,a.a))});z("module$exports$myphysicslab$test$StraightStraightTest.block_block_contact_1_setup",function(a,b){Eo(a,b);b=Z(1,1,"block1");b.u(new I(-.502,0),0);b.K(new I(0,.6),0);a.s(b);b=Z(1,2.5,"block2");b.u(new I(.502,0),0);b.K(new I(0,-.6),0);a.s(b);W(a,.8);V(a,new wh(3,a.a))});
  z("module$exports$myphysicslab$test$StraightStraightTest.block_block_contact_2_setup",function(a,b){Eo(a,b);b=Z(1,1,"block1");b.u(new I(-1,0),0);b.K(new I(0,.6),0);a.s(b);b=Z(1,2,"block2");b.u(new I(1,0),0);b.K(new I(0,-.6),0);a.s(b);W(a,.8);V(a,new wh(3,a.a))});
  z("module$exports$myphysicslab$test$StraightStraightTest.ngon_block_setup",function(a,b){Eo(a,b);b=new Je("polygon-16-sides");var c=2*Math.PI/16;bf(b,new ve(new I(.75,0)));for(var d=1;16>d;d++)T(b,new I(.75*Math.cos(c*d),.75*Math.sin(c*d)),8>=d);T(b,new I(.75,0),!1);Xe(b);b.pa(0,0);b.xa(.28125);b.Y(.8);b.pa(0,-.2);b.u(new I(-.255,0),0);b.K(new I(0,.6),1);a.s(b);b=Z(1,3,"block");b.u(new I(1,0),0);b.K(new I(0,-.6),0);a.s(b);W(a,.8);V(a,new wh(3,a.a))});
  z("module$exports$myphysicslab$test$StraightStraightTest.diamonds_setup",function(a,b){Eo(a,b);b.a=.01;b=Ah(1,Math.PI/4,"diamond1");b.u(new I(-2,.5),0);a.s(b);b=Ah(2,-Math.PI/4,"diamond2");b.u(new I(2,-.5),0);a.s(b);W(a,.5);V(a,new wh(3,a.a))});z("module$exports$myphysicslab$test$StraightStraightTest.one_block1_setup",function(a,b){Eo(a,b);b=Z(1,3,"blue");b.u(new I(-4,-4));a.s(b);b=Ih(a,20,20);var c=new U(4,a.a);V(a,c);c.T(b);W(a,.8)});
  z("module$exports$myphysicslab$test$StraightStraightTest.one_block2_setup",function(a,b){Eo(a,b);X(a,"none");b=Z(1,3,"blue");b.u(new I(0,-3.495),.01);b.K(new I(0,-.3));a.s(b);b=Ih(a,10,10);var c=new U(4,a.a);V(a,c);c.T(b);W(a,.8)});z("module$exports$myphysicslab$test$StraightStraightTest.fast_close_setup",function(a,b){Eo(a,b);X(a,"none");b=Ih(a,10,10);var c=Z(1,3,"blue");c.u(new I(0,-3.495),.01);c.K(new I(0,-3));a.s(c);c=new U(4,a.a);V(a,c);c.T(b);W(a,.8)});
  z("module$exports$myphysicslab$test$StraightStraightTest.corner_collision_setup",function(a,b){Eo(a,b);b.a=.01;b=Ah(1,Math.PI/4,"diamond1");b.u(new I(-2,0),0);b.K(new I(3,0),0);a.s(b);b=Ah(1,-Math.PI/4,"diamond2");b.u(new I(2,0),0);a.s(b);W(a,.5)});z("module$exports$myphysicslab$test$StraightStraightTest.rounded_corner_collision_setup",function(a,b){Eo(a,b);b.a=.01;b=Eh("rounded1");b.u(new I(-2,0),Math.PI/4);b.K(new I(3,0),0);a.s(b);b=Eh("rounded2");b.u(new I(2,0),Math.PI/4);a.s(b);W(a,.5)});
  z("module$exports$myphysicslab$test$StraightStraightTest.oblique_corner_collision_setup",function(a,b){Eo(a,b);new M(-.04602673981896506,-.0309592659798244,.029428926297351846,.04412223980864299);a.$(.1);b.a=.025;b=Z(2,2,"fixed");b.L(G);b.u(new I(1,-1),0);a.s(b);b=Z(1,1,"moving");b.u(new I(-.525,.51),0);b.K(new I(1.5925,-.597),0);a.s(b);W(a,.5)});
  z("module$exports$myphysicslab$test$StraightStraightTest.acute_corners_setup",function(a,b){Eo(a,b,0);X(a,"velocity_and_distance_joints");b=Lh(a,new M(-4.5,-3.6,3.1,4));Ke=1;var c=Dh([new I(1,0),new I(-.5131779511732342,.858282232386085),new I(-.9697687959221418,.24402557746211612),new I(.5131779511732341,-.8582822323860851)]);a.s(c);a.s(Z(1,3));c=Dh([new I(1,0),new I(-.5168307315243816,.8560876093905182),new I(-.8145354532535083,-.5801137779721335),new I(.6155488042485365,-.7880987689295023)]);a.s(c);
  a.s(Z(1,3));a.s(Z(1,3));c=Dh([new I(1,0),new I(-.5189138250576965,.8548265567727704),new I(-.9713811395821201,.2375261704826262),new I(-.08733120618134813,-.9961793314594068)]);a.s(c);c=new U(3,a.a);W(a,.8);V(a,c);c.T(b);a=a.v();R(a,0,0);R(a,1,.03178706216753517);R(a,2,21.275092573513827);R(a,3,21.306879635681362);R(a,4,-.7);R(a,5,0);R(a,6,-4.1);R(a,7,0);R(a,8,0);R(a,9,0);R(a,10,3.5999999999999996);R(a,11,0);R(a,12,.19999999999999996);R(a,13,0);R(a,14,0);R(a,15,0);R(a,16,-.7);R(a,17,0);R(a,18,4.5);
  R(a,19,0);R(a,20,0);R(a,21,0);R(a,22,-5);R(a,23,0);R(a,24,.19999999999999996);R(a,25,0);R(a,26,0);R(a,27,0);R(a,28,-3.994175423172596);R(a,29,-3.375246109755061E-7);R(a,30,-2.7383266394583425);R(a,31,-5.942141763683848E-9);R(a,32,-1.0548398616079855);R(a,33,-9.118912363980537E-9);R(a,34,-2.003265933175177);R(a,35,-4.007266059523297E-7);R(a,36,-3.0949999992492216);R(a,37,-2.805109218609374E-8);R(a,38,-1.5707963271905572);R(a,39,1.4783921554646415E-8);R(a,40,2.1894973957584805);R(a,41,-.002607801649199815);
  R(a,42,-2.8567099904181865);R(a,43,-1.137377229716843E-13);R(a,44,.14442290824138998);R(a,45,-3.3018032752131266E-14);R(a,46,.5531761073947989);R(a,47,-.07606659236252189);R(a,48,-1.7549648725459994);R(a,49,-.0375339986382553);R(a,50,1.8055032081848377);R(a,51,-.030052137616049142);R(a,52,-1.7979653247900453);R(a,53,.186005234323005);R(a,54,-1.089999995447982);R(a,55,-1.7043644812988394E-7);R(a,56,3.141592646020941);R(a,57,2.8341393571213067E-7);R(a,58,.6357229411480702);R(a,59,.14498910247394578);
  R(a,60,-2.9733009783756574);R(a,61,-4.2449932455742765E-13);R(a,62,.9490286328488056);R(a,63,3.497165520156307E-13)});function Jo(){kh=0;var a=document.getElementById("test_results");if(!qa(a))throw Error('<p> element with id="test_results" not found');qh=a;a=new Date;ih(a.toDateString()+" "+a.toTimeString());ih("compiled 2020-02-21 12:51:06");ih("machine = "+eh());ih("browser = "+fh());ih("COMPILE_LEVEL = advanced");ih("goog.DEBUG = false");ih("Util.DEBUG = false");ih("myPhysicsLab version = 2.0.0");a=navigator;null!=a&&(ih("userAgent = "+a.userAgent),ih("platform = "+a.platform));window.MSSTream&&ih("MSStream detected: probably on Internet Explorer for Windows Phone");
  ih("NOTE: asserts are NOT enabled");mh(Go);mh(Fo);mh(yo);mh(ko);mh(ph);oh()}z("module$exports$myphysicslab$test$PerformanceTests.runTests",Jo);z("runTests",Jo);}).call(window)
  