/*

 joel.espinosa@amite.mx

 @preserve 120927

 @license LGPL - http://www.gnu.org/licenses/lgpl.html

*/

var descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,c=360/f,d=f/360,b=Math.floor;a.rangeOK=1;a.radToDeg=function(a){return a*c};a.degToRad=function(a){return a*d};a.extend=function(a,b){if(a.prototype.__proto__)a.prototype.__proto__=b.prototype;else for(var c in b.prototype)b.prototype.hasOwnProperty(c)&&(a.prototype[c]=b.prototype[c]);a.prototype.uber=b.prototype};a.convertFont=function(a){if(""==a)return a;var b=a.split(","),a="";"bold"==b[1].toLowerCase()?a+="Bold ":"italic"==b[1].toLowerCase()||

"italics"==b[1].toLowerCase()?a+="Italic ":"bold+italic"==b[1].toLowerCase()&&(a+="Italic Bold ");a+=b[2]+"px ";b=b[0].split(" ")[0].toLowerCase();return"serif"==b||"times new roman"==b||"timesroman"==b?a+"'Times New Roman'":"sansserif"==b||"arial"==b||"helvetica"==b?a+"Arial":a+"'Courier New'"};a.drawLine=function(a,c,d,f,j,k,l){a.lineWidth=l||1;a.strokeStyle=k||"black";k=a.lineWidth%2?0.5:0;a.beginPath();a.moveTo(b(c)+k,b(d)+k);a.lineTo(b(f)+k,b(j)+k);a.stroke()};a.getColor=function(a,c){if("string"==

typeof c)return c;var d=a.evalExpression(c),f=b(255*d[0][0]),j=b(255*d[0][1]),k=b(255*d[0][2]);return"rgba("+f+","+j+","+k+","+(1-d[0][3])+")"};a.getFeatures=function(){a.hasJavaSupport=navigator.javaEnabled();var b=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||b.match("android")&&!0;a.hasTouchSupport=navigator.userAgent.toLowerCase().match("qt")?!1:a.hasTouchSupport;var c=document.createElement("canvas");a.hasCanvasSupport=c.getContext&&

c.getContext("2d");a.hasCanvasSupport&&(a.ctx=document.createElement("canvas").getContext("2d"));b.match("chrome")&&(Number.prototype.toFixed=function(a){var a=a<0?0:parseInt(a),b=this.toString(),c=b.indexOf("."),d="";if(c===-1){a>0&&(d=".");for(c=0;c<a;c++)d=d+"0";return b+d}var e=b.length-c-1;if(e>=a)return b.substring(0,c+1+a);for(c=0;c<a-e;c++)d=d+"0";return b+d})};a.openExternalFile=function(a){var b=null,c;c=!1;if(window.XMLHttpRequest)try{c=new XMLHttpRequest}catch(d){c=!1}else if(window.ActiveXObject)try{c=

new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{c=new ActiveXObject("Microsoft.XMLHTTP")}catch(k){c=!1}}c.open("GET",a,!1);try{c.send(null),b=c.responseText,b.match(String.fromCharCode(65533))&&(c.open("GET",a,!1),c.overrideMimeType("text/plain; charset=ISO-8859-1"),c.send(null),b=c.responseText)}catch(l){console.log("El archivo ",a," no se pudo abrir"),b=null}return b};a.getCursorPosition=function(a){var b;a.touches?(a=a.touches[0],b=a.pageX,a=a.pageY):void 0!=a.pageX&&void 0!=a.pageY?(b=a.pageX,

a=a.pageY):(b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);return{x:b,y:a}};a.buildSimpleRegularExpressionPattern=function(a){var b=a.trim(),a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};b[0]==b[b.length-1]&&"'"==b[0]&&(a.ignoreCaps=!0,b=b.substring(1,b.length-1),"`"==b[0]&&"\u00b4"==b[b.length-1]&&(a.ignoreAcents=!0,b=b.substring(1,b.length-1)));"`"==b[0]&&"\u00b4"==b[b.length-1]&&(a.ignoreAcents=!0,

b=b.substring(1,b.length-1),b[0]==b[b.length-1]&&"'"==b[0]&&(a.ignoreCaps=!0,b=b.substring(1,b.length-1)));"*"==b[0]&&"*"!=b[b.length-1]&&(b=b.substring(1)+"$");"*"!=b[0]&&"*"==b[b.length-1]&&(b="^"+b.substring(0,b.length-1));"*"==b[0]&&"*"==b[b.length-1]&&(b=b.substring(1,b.length-1));b=b.replace(/\?/g,"[\\S\\s]{1}");a.regExp=b;return a};a.buildRegularExpresionsPatterns=function(b){for(var b=b.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|"),c,d,f=0,j=b.length;f<j;f++){c=b[f].split("&");

d=[];for(var k=0,l=c.length;k<l;k++)d.push(a.buildSimpleRegularExpressionPattern(c[k]));b[f]=d}return b};removeAcents=function(a){a=a.toString();return a.replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")};a.escorrecto=function(b,c){for(var d=a.buildRegularExpresionsPatterns(b),

f,j,c=removeAcents(c).toLowerCase(),k=0,l=d.length;k<l;k++){f=d[k];j=!0;for(var n=0,r=f.length;n<r;n++)f[n].regExp=removeAcents(f[n].regExp).toLowerCase(),j=j&&!!c.match(f[n].regExp);if(j)return 1}return 0};a.esCorrecto=function(b,c){for(var d=a.buildRegularExpresionsPatterns(b),f,j,k=0,l=d.length;k<l;k++){f=d[k];j=!0;for(var n=0,r=f.length;n<r;n++)f[n].ignoreAcents&&(c=removeAcents(c),f[n].regExp=removeAcents(f[n].regExp)),f[n].ignoreCaps&&(c=c.toLowerCase(),f[n].regExp=f[n].regExp.toLowerCase()),

j=j&&!!c.match(f[n].regExp);if(j)return 1}return 0};a.getTextWidth=function(b,c){a.ctx.font=c;return a.ctx.measureText(b).width};a.getCreativeCommonsLicenseImage=function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAYAAABjyArgAAAABHNCSVQICAgIfAhkiAAACpVJREFUaIHtWm1sU9cZfu61iUYnPP/bJgdhhDbFkVYcCrR0tLHXrVNL01wvgUJDh820tivrkpQQtpEvA4HGhDoe/dCmNfbaVa1WKszX2oUO3xC0OHESm9Hi/FhloyQq1aY5OGgq8ce7H9f3xI7txKFsdKyPdHSPz8dzz33Oe77eY46IVBzHXcUXuOkgIo4DQABwuucUeJ4Hz/NQKBTgeQUUPA9ekXryPDiOB89x4DgO4DiZBQQCJQlJSiKZlEIikZCeyQQSiSSSyQTLS1KSlSciuTEsfjtgY+UmAAAHgGRxFQqFFHjFTFyhkPJ4RUpkDhzHp+ubEiclbFISM5FIhfR4IlPkZDLJhE0X+nbBxspNUALIFFehhDLjKYWTx0/B4/FgcHAQU9GpDKIlqiVYu3YtjN8xouLRR5BIKsDzcalDEjw4cJD6cgaUJGkkANIY4iRxR3x+uN9xIxgMZpTX6XQQqgSsWlNW0Md9Xng4APSns+9BqVQyUZVKpRQUSvSK52B73oaJiYmCGqTRaND4i0aUl9+PeCKBRCKOeDwVEnHE4wlm4emW/PHExzjS9SJGg6MAAIPBAL1eDwAIBAIQRREAUKIrwY7aHfja17+a8/1XPv4ELzle+lzwbKzcJAn8fu8ZKBXKGWGVi7BIqURrcxvcx9ysglqthiAI0Gq1KC8vBwD09vYiHA7D7XZjcnKSlRVMAhoad2LxHYsRj8cRi8cRj8cQj8czpwxK4mrkKn769LOIRqMQBAF2ux1arTajseFwGPX19XC73VCpVGi3tWd91LXoNdTuqPvc8MjzMJ3tO0t9/eeo39dPQwEfXfggQIJJIEiDl9RqNbW1tVEkEqG54HQ6Sa1Ws3oluhI6399HQ4Eh8g71U1//OfL0naUzYg+99+d36XTPKTrx7nHS6XQEgMxmcwafzDP7HTL328f/kBFKdCU5eRx2Oz3+2ObPxDM2Nkbe/n7y9vfT2NhYQTwAiAcARWoOVioUUCoyLVev18Pv96O1tRVqtTprGKTDbDYjFAqxoTQaHEWn7XDGXM6zHYm0G/F5fQgGgxAEAY27ds3JL79DEASMBkcx4vOz9BGfH6PBUawqK8O996xj6b/q6sLzNhtOnj6N3Q27MD4+XhBPent+/9prMKy/DzWbt6Bm8xYY1t+HMz09c/Kkg/q8feQd8tLIhWFyHHEwy9Hr9fNabS5EIhHS6/WMx/Gig0b+OkIDw1467+0jz3nJit99/4+kK5WsNxQKFcwfCoUIAOl0OmYt8igo+cY3acUyLZV/ez09/eMnCQC1tbXRwQMHCQAdffvtgnjk9nj7+yW+u9fRj7ZZqHFnA61YpqUVy7TksNvz8uSwYMmKbc/bAEjzrdPpnNdqc0GtVsPj8bC6toO21F46ZcFcak/N8wheCsJgMGTNcRaLhVm5xWLJyNNqtTAYDBkrezAo8VRUVGDjpk0YHx/HmZ4erFimxb+mrmHrE1tx6cMPUVVdXRCPVqtFNBpF0H8RAFAp/AC/dXWjo/MQ9rQ0AwBc3c68PDJ4AKlhK23F5N1CXV0dG+o3ArVaDbvdDgCYmJjAyROn2IFFEplj27Rc73G5XDnjMnLV0ev1sB3uxEFbB954601UVVfjo8th2A53YunSpXB1OxG8dKkgHhntL0gG95vfvcrSvvfggwCAaDSKT65cycsDpASWrcnj8QCQxKmtrWWFRFGEyWSC0WiE0WiE1WrNm9fV1cXyzGYzs2LPWU+a9XLg+BmB/xO4+5570NF5CGNjY2jc2YCyb92Jd44eRcXDG1CzeQubQ+eCSqWCw+HAHaoleOWVV3KW+fTT63NySAcNjgPPcRgcHAQACILAhBFFEUajMaOSKIoQRRG1tbUwmUxZeRcuXIDT6WRcLpcLg4OD0gkwJawkriRwIBDIapjZbGaWazabs/Jz1ZmdFo1GcaanBx2dh2C+ZEHFwxsAAANeLwa8XhQXF4NbpJyTZ5FSicaGBtyxeDFLG/B6WXyZdlne9gDMgqUPlk9oK1euZAXq6+sBSPNMKBSCx+OBVqvFtm3bmCXr9XqEQiEcO3YsY48MgMWnolPSe8ClPYHS0lKIoohwOJzRMLmDZscBaQ8qiiJ0Oh1L0+l0WTw/efIptO/dh1V3rkTN5i346HIYVdXV6Og8hJqtWwviGR8fR1tLKx5/bDPa9+5D+959aGlqAgDs2r07b3syBAaHjOGaPp/IPWM2m9lkHgqFYDabWZ58+BAEgeXJSF+8JKPNPDZvfExadOSOLARyWaFKYGlyPJ2no/MQLNu348o//o6/hUJw2O3Y09KMqupqWPfvQ9ma1fPyWLZvh2X7dgCAs7sbzu5uXP/0OjZUPIItNY/nbY+M7PHxX8a69eugK9XB7XbDYrFkWetsyKenEl1Jhh9g1ZoylOhKMniKi4uxp6UZX1q8GCPDw/hZXd0N8expacb3H3oIly+HAUijTldaOiePDMmCKdOLlT6fyNbscrkwOTmJQCCA5cuXw2q1sjz5mJyeJyN9yEpnM3l7PIPmtmaoVCq4XC6YTCZWh9K8bOFwGCaTCV1dXVCpVNhRuyPrY3b/sjEnz85dDXjjrTc/E8/qNatRVV2Nqupq6EpLC+IBUs4e38ggioqKsP7e+zAVnYLZbGaW5Ha7sxYyQJoyKisr8+bJ9evr69HV1YUlqiU4/5c+TE9PYzo2jVg8hlgsLjmDEnFE/jmJA9YDbC+p1+uh1+uhVqshiiLr9PmcNNei19BxwMacNLeShzl7BoYHUFRUBGuLFe5jbqjVakQiEVZQFEU4HA7mzDEYDGhtbWUd4HA4WNn0PABYvnw5wuEwHvjuAzhs78T16WnEZgks+42TiSR8Az4cO3rr3Yw3g4cJ7B3qx6JFRTh/7jxqn5X2v3a7HXVpc9aNwOVysVPY/gP78fCGhzAdm8Z0LIZ4LIZYfJbAORzw/8vYWLlJmoPlKx2DsRwajQYAYLVas7ZOC8Hk5CRbXTUaTcoRn7rFSCaRTM3FlLpyul3BA0CSkkgkpHu0fe17AUgCmUymDB9voZicnITRaGR1G3/emHKwJ2ZETrsyYovsrMX2dgEBoKbWJvKNDFLgop+e+OETGR41v9+/IE9XuidNMAkUuOgn38gg7W3fy9L/j8LMj7rnamnI76PADTjcI5EItbW1ZTjc16xdQxc+CNBQwEdNrU23+kNvSWDX9jKaW5tQaRKgVCpx2HYYr7/2Ostb6JWRdV8b4vE4BgYG8cxTz2A+pE8P8smSiDJOmbN/5+PJV0d+R6GOpnxtWhDH7NDc2iRZ8kU/dbteJY1GU3CPaTQachxxUOCin4YCPnr51y8XXJeI5oynp83HM1/9QrhylVkoR5YFy6h7rhY1W2vYVY/o6cWJ4yfmvLZ/VHgUBkM5u9A8fvwE9lv3F9DHEnJZS3reQqyO47i8z4VgtrXOXoTn48srMACsuqsMza0tKF6qSbuNSHc3ImPfKv/xZGJ8HC902nGu99yCP+azTA35eABkCbxQsXN1UiEccwos4/7y+7GhYgPuWn0XvqJSpf46Jb9ZetHVaBTDQ8M4ffL0goVN/wjWsJtgwbl+L2T+nG9NuGkCf4EbB09EX77VjbhdQUTcvwFtwhQyXNo3TwAAAABJRU5ErkJggg==";

return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.addCSSrules=function(){var a=document.createElement("meta");a.setAttribute("name","viewport");a.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=10.0, user-scalable=yes");document.head.appendChild(a);(a=document.getElementById("StyleDescartesApps2"))&&a.parentNode.removeChild(a);a=document.createElement("style");a.type="text/css";a.id="StyleDescartesApps2";a.setAttribute("rel","stylesheet");

document.head.appendChild(a);a.innerHTML="div.DescartesAppContainer{ border: 0px solid black; position: relative; overflow: hidden; top: 0px; left: 0px; }\ndiv.DescartesLoader{ background-color : #efefef; position: absolute; overflow: hidden; -moz-box-shadow: 0px 0px 0px #888; -webkit-box-shadow: 0px 0px 100px #888; box-shadow: 0px 0px 100px #888; background-image: linear-gradient(bottom, rgb(187,187,187) 0%, rgb(239,239,239) 50%, rgb(187,187,187) 100%); background-image: -o-linear-gradient(bottom, rgb(187,187,187) 0%, rgb(239,239,239) 50%, rgb(187,187,187) 100%); background-image: -moz-linear-gradient(bottom, rgb(187,187,187) 0%, rgb(239,239,239) 50%, rgb(187,187,187) 100%); background-image: -webkit-linear-gradient(bottom, rgb(187,187,187) 0%, rgb(239,239,239) 50%, rgb(187,187,187) 100%); background-image: -ms-linear-gradient(bottom, rgb(187,187,187) 0%, rgb(239,239,239) 50%, rgb(187,187,                   187) 100%); top: 0px; left: 0px; }\ndiv.DescartesLoaderImage{ background-repeat: no-repeat; background-position: center; position: absolute; overflow: hidden; top: 0px; left: 0px; }\ncanvas.DescartesLoaderBar{ position: absolute; overflow: hidden; top: 0px; left: 0px; }\ncanvas.DescartesSpace2DCanvas, canvas.DescartesSpace3DCanvas, div.blocker{ position: absolute; overflow: hidden; left: 0px; top: 0px; }\ndiv.DescartesSpace2DContainer, div.DescartesSpace3DContainer{ position: absolute; overflow: hidden; line-height: 0px; }\ncanvas.DescartesButton{ position: absolute; cursor: pointer; }\ndiv.DescartesSpinnerContainer, div.DescartesTextFieldContainer{ background: lightgray; position: absolute; overflow: hidden; }\ninput.DescartesSpinnerField, input.DescartesTextFieldField, input.DescartesMenuField, input.DescartesScrollbarField{ font-family: Arial; padding: 0px; border: 1px inset #666666; position: absolute; top: 0px; }\nlabel.DescartesSpinnerLabel, label.DescartesMenuLabel, label.DescartesScrollbarLabel{ line-height: normal; font-family: Arial; padding-top: 0%; text-align: center; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; background-color: lightgray; position: absolute; left: 0px; top: 0px; }\ndiv.DescartesGraphicControl{ border-style: none; position: absolute; }\nlabel.DescartesTextFieldLabel{ line-height: normal; font-family: Arial; padding-top: 0%; padding-bottom: 0%; text-align: center; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; background-color: #e0e4e8; position: absolute; left: 0px; top: 0px; }\ndiv.DescartesTextAreaContainer{ position: absolute; overflow: hidden; background: #c0d0d8; }\nselect.DescartesMenuSelect{ font-family: Arial; padding-top: 0%; text-align: center; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; background-color: white; position: absolute; left: 0px; top: 0px; }\ndiv.DescartesScrollbarContainer{ background: #eeeeee; overflow: hidden; position: absolute; }\n"};

a.addCSSrules();return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.sin,c=Math.floor,d=Math.random,b=Math.round,g=String.fromCharCode;a.Krypto=function(a){this.key=(a||0).toString()};a.Krypto.prototype.getKey=function(a){for(var b=Array(256),d=0;256>d;d++)b[d]=g(this.alfanum(c(Math.abs(7.5*(f(1*d-a)+f(1.4*d+a)+f(0.6*d-a)+f(2.2*d+a))))));return b.join("")};a.Krypto.prototype.encode=function(a){var b=c(31*d());this.key=this.getKey(b);return g(this.alfanum(b))+this.encripta(a)};

a.Krypto.prototype.decode=function(a){this.key=this.getKey(this.numalfa(a.charCodeAt(0)));return this.desencripta(a.substring(1))};a.Krypto.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};a.Krypto.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;for(var f=Array(3*a.length),g,j=0,k=a.length;j<k;j++)g=256*c(a[j]+128)+b(255*d())+65536*b(255*d()),g=c((g<<this.shift(j))/256),f[3*j]=this.alfanum(g%32),f[3*j+1]=this.alfanum(g/32%

32),f[3*j+2]=this.alfanum(g/1024%32);return f};a.Krypto.prototype.desencripta=function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};a.Krypto.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;for(var b=Array(a.length/3),d,f=0,g=b.length;f<g;f++)d=this.numalfa(a[3*f])+32*this.numalfa(a[3*f+1])+1024*this.numalfa(a[3*f+2]),d=c(256*d>>this.shift(f)),d=c(d/256)%256-128,0>d&&(d+=256),b[f]=d;return b};a.Krypto.prototype.alfanum=function(a){a=c(a);return 10>

a?48+a:87+a};a.Krypto.prototype.numalfa=function(a){return 58>a?a-48:a-87};a.Krypto.prototype.stringToBytes=function(a){for(var b=Array(a.length),c=0,d=a.length;c<d;c++)b[c]=a.charCodeAt(c);return b};a.Krypto.prototype.bytesToString=function(a){for(var b=0,c=a.length;b<c;b++)a[b]=g(a[b]);return a.join("")};a.Krypto.prototype.shift=function(a){a=this.numalfa(this.key.charCodeAt(a%this.key.length));a=c(a/2%8);0==a&&(a=4);return a};a.Krypto.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<

a?255:a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Animation=function(f,c){this.parent=f;var d=f.evaluator,b=d.parser,g=new a.Auxiliary(f);this.delay=c.delay?b.parse(c.delay):b.parse("60");this.loop=c.loop?c.loop:!1;this.auto=void 0==c.auto&&2==this.parent.version?!0:c.auto;this.controls=c.controls;this.init=g.splitInstructions(b,c.init);this.doExpr=g.splitInstructions(b,c.doExpr);c.whileExpr&&(this.whileExpr=b.parse(c.whileExpr));var e=this;this.animationExec=function(){for(var a=

0,b=e.doExpr.length;a<b;a++)d.evalExpression(e.doExpr[a]);e.parent.update();if(e.playing&&(d.evalExpression(e.whileExpr)>0||e.loop))e.timer=setTimeout(e.animationExec,d.evalExpression(e.delay));else{e.stop();e.parent.update()}};this.playing=!1;this.auto&&this.play()};a.Animation.prototype.play=function(){this.playing?this.stop():(this.reinit(),this.playing=!0,this.timer=setTimeout(this.animationExec,this.parent.evaluator.evalExpression(this.delay)))};a.Animation.prototype.stop=function(){this.playing=

!1;clearInterval(this.timer)};a.Animation.prototype.reinit=function(){for(var a=0,c=this.init.length;a<c;a++)this.parent.evaluator.evalExpression(this.init[a])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Action=function(a){this.parent=a;this.evaluator=this.parent.evaluator};a.Action.prototype.execute=function(){};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Message=function(f,c){a.Action.call(this,f,c);this.parameter=c};a.extend(a.Message,

a.Action);a.Message.prototype.execute=function(){alert(this.parameter)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Calculate=function(f,c){a.Action.call(this,f,c);var d=this.evaluator,b=d.parser;this.parameter=c.replace(/&squot;/g,"'");this.parameter=this.parameter.replace(/;/g,"\\n");this.parameter=this.parameter.split("\\n")||[""];for(var g=[],e,h=0,i=this.parameter.length;h<i;h++)(e=b.parse(this.parameter[h],!0))&&g.push(e);this.parameter=g;this.actionExec=function(){for(var a=

0,b=this.parameter.length;a<b;a++)d.evalExpression(this.parameter[a])}};a.extend(a.Calculate,a.Action);a.Calculate.prototype.execute=function(){this.actionExec()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.OpenURL=function(f,c){a.Action.call(this,f,c);this.parameter=c;this.target="_blank";var d=this.parameter.indexOf("target");-1!=d&&(this.target=this.parameter.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),this.parameter=this.parameter.substring(0,

d-1));"javascript"==this.parameter.substring(0,10)?(this.javascript=!0,this.parameter=this.parameter.substring(11).replace(/&squot;/g,"'"),this.actionExec=function(){eval(this.parameter)}):("http://"!=this.parameter.substring(0,7)&&(this.parameter=window.location.href.substring(0,window.location.href.lastIndexOf("/")+1)+this.parameter),this.actionExec=function(){window.open(this.parameter,this.target)})};a.extend(a.OpenURL,a.Action);a.OpenURL.prototype.execute=function(){this.actionExec()};return a}(descartesJS||

{}),descartesJS=function(a){if(a.loadLib)return a;a.OpenScene=function(f,c){a.Action.call(this,f,c);this.parameter=c;this.target="_blank";var d=this.parameter.indexOf("target");-1!=d&&(this.target=this.parameter.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),this.parameter=this.parameter.substring(0,d-1));"javascript"==this.parameter.substring(0,10)?(this.javascript=!0,this.parameter=this.parameter.substring(11).replace(/&squot;/g,"'"),this.actionExec=function(){eval(this.parameter)}):

("http://"!=this.parameter.substring(0,7)&&(this.parameter=window.location.href.substring(0,window.location.href.lastIndexOf("/")+1)+this.parameter),this.actionExec=function(){window.open(this.parameter,this.target)})};a.extend(a.OpenScene,a.Action);a.OpenScene.prototype.execute=function(){this.actionExec()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.About=function(f,c){a.Action.call(this,f,c);this.urlAbout=null;""!=c&&(this.urlAbout=window.location.href.substring(0,

window.location.href.lastIndexOf("/")+1)+c)};a.extend(a.About,a.Action);a.About.prototype.execute=function(){console.log(this.urlAbout);if(this.urlAbout)var a=window.open(this.urlAbout,"_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes");else a=window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes"),a.document.write("<hmtl><head><title>Cr\u00e9ditos</title></head><body><h1>Aqu\u00ed van los cr\u00e9ditos</h1></body></html>")};return a}(descartesJS||

{}),descartesJS=function(a){if(a.loadLib)return a;a.Config=function(f,c){a.Action.call(this,f,c)};a.extend(a.Config,a.Action);a.Config.prototype.execute=function(){window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%; height:100%;'>"+this.parent.applet.outerHTML+"</xmp>")};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Init=function(f,c){a.Action.call(this,f,c)};a.extend(a.Init,a.Action);

a.Init.prototype.execute=function(){this.parent.init()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Clear=function(f,c){a.Action.call(this,f,c)};a.extend(a.Clear,a.Action);a.Clear.prototype.execute=function(){this.parent.clear()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Animate=function(f,c){a.Action.call(this,f,c)};a.extend(a.Animate,a.Action);a.Animate.prototype.execute=function(){this.parent.play()};return a}(descartesJS||{}),descartesJS=

function(a){if(a.loadLib)return a;a.InitAnimation=function(f,c){a.Action.call(this,f,c)};a.extend(a.InitAnimation,a.Action);a.InitAnimation.prototype.execute=function(){this.parent.reinitAnimation()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.PlayAudio=function(f,c){a.Action.call(this,f,c);this.filenameExpr=this.evaluator.parser.parse("'"+c.split(" ")[0].trim()+"'");this.filename=this.evaluator.evalExpression(this.filenameExpr);this.theAudio=this.parent.getAudio(this.filename)};

a.extend(a.PlayAudio,a.Action);a.PlayAudio.prototype.execute=function(){this.filename=this.evaluator.evalExpression(this.filenameExpr);theAudio=this.parent.getAudio(this.filename);theAudio.paused?theAudio.play():(theAudio.pause(),theAudio.currentTime=0.1)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Auxiliary=function(a,c){this.parent=a;this.evaluator=this.parent.evaluator;var d=a.evaluator.parser;this.expresion=this.id="";this.evaluate="onlyOnce";this.size=d.parse("3");

this.rows=d.parse("3");this.columns=d.parse("3");for(var b in c)c.hasOwnProperty(b)&&(this[b]=c[b])};a.Auxiliary.prototype.firstRun=function(){};a.Auxiliary.prototype.update=function(){};a.Auxiliary.prototype.splitInstructions=function(a,c){for(var d,b=[],c=c?c.split(";"):[""],g=0,e=c.length;g<e;g++)(d=a.parse(c[g],!0))&&b.push(d);return b};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Variable=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator.parser;this.expresionString=

this.expresion;(this.expresion=d.parse(this.expresionString))&&d.setVariable(this.id,this.expresion);this.editable&&this.registerTextField()};a.extend(a.Variable,a.Auxiliary);a.Variable.prototype.registerTextField=function(){var a=document.createElement("div"),c=document.createElement("label");c.appendChild(document.createTextNode("_"+this.id+"=_"));var d=document.createElement("input");d.value=this.expresionString;d.disabled=!this.editable;a.appendChild(c);a.appendChild(d);var b=this;d.onkeydown=

function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.evaluator.parser.setVariable(b.id,b.expresion),b.parent.update())};this.parent.editableRegion.textFields.push({container:a,type:"div"})};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Constant=function(f,c){a.Auxiliary.call(this,f,c);this.expresion=this.evaluator.parser.parse(this.expresion);this.update()};a.extend(a.Constant,a.Auxiliary);a.Constant.prototype.update=function(){this.evaluator.setVariable(this.id,

this.evaluator.evalExpression(this.expresion))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Vector=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator,b=d.parser;this.expresion=this.expresion.split(";");var g;if(this.file){var e=document.getElementById(this.file);e&&"descartes/vectorFile"==e.type?(g=e.text,"\n"==g[0]&&(g=g.substring(1))):g=a.openExternalFile(this.file);null!=g&&(g=g.split("\n"));null==g||1==g.length&&""==g[0]?(g=[],this.size=0):(this.expresion=

[],this.size=null);for(var h,i=0,e=0,j=g.length;e<j;e++)g[e].match(/./)&&(this.expresion[i]=this.id+"["+i+"]="+g[e],i++,(h=g[e].match(/[\w-//]*(.png|.jpg|.gif|.svg|.PNG|.JPG|.GIF|.SVG)/g))&&this.parent.getImage(h));null==this.size&&(this.size=b.parse(this.expresion.length+""))}e=0;for(j=this.expresion.length;e<j;e++)(g=b.parse(this.expresion[e],!0))&&"asign"!=g.type&&(g=b.parse(this.id+"["+e+"]="+this.expresion[e],!0)),this.expresion[e]=g;j=d.evalExpression(this.size);b=[];for(e=0;e<j;e++)b.push(0);

d.vectors[this.id]=b;this.update()};a.extend(a.Vector,a.Auxiliary);a.Vector.prototype.update=function(){var a=this.evaluator;a.setVariable(this.id+".long",a.evalExpression(this.size));for(var c=0,d=this.expresion.length;c<d;c++)a.evalExpression(this.expresion[c])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Matrix=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator;this.expresion=this.splitInstructions(d.parser,this.expresion);for(var b=d.evalExpression(this.rows),

g=[],e,h=0,i=d.evalExpression(this.columns);h<i;h++){e=[];for(var j=0,k=b;j<k;j++)e.push(0);g[h]=e}d.matrices[this.id]=g;this.update()};a.extend(a.Matrix,a.Auxiliary);a.Matrix.prototype.update=function(){var a=this.evaluator;a.setVariable(this.id+".filas",a.evalExpression(this.rows));a.setVariable(this.id+".columnas",a.evalExpression(this.columns));for(var c=0,d=this.expresion.length;c<d;c++)a.evalExpression(this.expresion[c])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;

a.Function=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator,b=d.parser,g=this.id.indexOf("(");this.name=this.id.substring(0,g);this.params=this.id.substring(g+1,this.id.length-1);this.domain=this.range?b.parse(this.range):b.parse("1");this.params=""==this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;this.init=this.splitInstructions(b,this.init);this.doExpr=this.splitInstructions(b,this.doExpr);this.whileExpr&&(this.whileExpr=b.parse(this.whileExpr));this.expresion=

b.parse(this.expresion);var e=this;this.functionExec=this.algorithm?function(){if(e.numberOfParams==arguments.length){for(var b=[],c=0,f=e.params.length;c<f;c++){b[c]=d.getVariable(e.params[c]);d.setVariable(e.params[c],arguments[c])}c=0;for(f=e.init.length;c<f;c++)d.evalExpression(e.init[c]);do{c=0;for(f=e.doExpr.length;c<f;c++)d.evalExpression(e.doExpr[c])}while(d.evalExpression(e.whileExpr)>0);var g=d.evalExpression(e.expresion);a.rangeOK=d.evalExpression(e.domain);c=0;for(f=e.params.length;c<

f;c++)d.setVariable(e.params[c],b[c]);return g}return 0}:function(){if(e.numberOfParams==arguments.length){for(var b=[],c=0,f=e.params.length;c<f;c++){b[c]=d.getVariable(e.params[c]);d.setVariable(e.params[c],arguments[c])}var g=d.evalExpression(e.expresion);a.rangeOK=d.evalExpression(e.domain);c=0;for(f=e.params.length;c<f;c++)d.setVariable(e.params[c],b[c]);return g}return 0};d.setFunction(this.name,this.functionExec)};a.extend(a.Function,a.Auxiliary);return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;

a.AuxSequence=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator,b=d.parser,g=this.id.indexOf("(");this.name=this.id.substring(0,g);this.params=this.id.substring(g+1,this.id.length-1);this.domain=this.range?b.parse(this.range):b.parse("1");this.params=""==this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;this.init=this.splitInstructions(b,this.init);this.doExpr=this.splitInstructions(b,this.doExpr);this.whileExpr&&(this.whileExpr=b.parse(this.whileExpr));this.expresion=

b.parse(this.expresion);var e=this;this.functionExec=this.algorithm?function(){if(e.numberOfParams==arguments.length){for(var b=[],c=0,f=e.params.length;c<f;c++){b[c]=d.getVariable(e.params[c]);d.setVariable(e.params[c],arguments[c])}c=0;for(f=e.init.length;c<f;c++)d.evalExpression(e.init[c]);do{c=0;for(f=e.doExpr.length;c<f;c++)d.evalExpression(e.doExpr[c])}while(d.evalExpression(e.whileExpr)>0);var g=d.evalExpression(e.expresion);a.rangeOK=d.evalExpression(e.domain);c=0;for(f=e.params.length;c<

f;c++)d.setVariable(e.params[c],b[c]);return g}return 0}:function(){if(e.numberOfParams==arguments.length){for(var b=[],c=0,f=e.params.length;c<f;c++){b[c]=d.getVariable(e.params[c]);d.setVariable(e.params[c],arguments[c])}var g=d.evalExpression(e.expresion);a.rangeOK=d.evalExpression(e.domain);c=0;for(f=e.params.length;c<f;c++)d.setVariable(e.params[c],b[c]);return g}return 0};d.setFunction(this.name,this.functionExec)};a.extend(a.AuxSequence,a.Auxiliary);return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;

a.Algorithm=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator,b=d.parser;this.init=this.splitInstructions(b,this.init);this.doExpr=this.splitInstructions(b,this.doExpr);this.whileExpr&&(this.whileExpr=b.parse(this.whileExpr));this.algorithmExec=function(){for(var a=0,b=this.init.length;a<b;a++)d.evalExpression(this.init[a]);do{a=0;for(b=this.doExpr.length;a<b;a++)d.evalExpression(this.doExpr[a])}while(d.evalExpression(this.whileExpr)>0)}};a.extend(a.Algorithm,a.Auxiliary);a.Algorithm.prototype.update=

function(){this.algorithmExec();"onlyOnce"==this.evaluate&&(this.update=function(){})};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Event=function(f,c){a.Auxiliary.call(this,f,c);var d=this.evaluator;this.condition=d.parser.parse(this.condition);this.lastEvaluation=!1;this.action=this.parent.lessonParser.parseAction(this);"onlyOnce"==this.execution&&(this.eventExec=function(){0<d.evalExpression(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});

"alternate"==this.execution&&(this.eventExec=function(){var a=d.evalExpression(this.condition)>0;if(this.parent.version==3){if(a!=this.lastEvaluation){this.action.execute();this.lastEvaluation=a?true:false}}else if(a&&!this.lastEvaluation){this.action.execute();this.lastEvaluation=true}else if(!a&&this.lastEvaluation)this.lastEvaluation=false});"always"==this.execution&&(this.eventExec=function(){d.evalExpression(this.condition)>0&&this.action.execute()})};a.extend(a.Event,a.Auxiliary);a.Event.prototype.update=

function(){this.eventExec()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Graphic=function(f,c){this.parent=f;var d=this.parent.evaluator.parser;this.evaluator=f.evaluator;this.spaceID="E0";this.type="";this.background=!1;2!=this.parent.version?(this.color="#20303a",this.parent.arquimedes&&(this.color="black")):this.color="blue";this.drawif=d.parse("1");this.abs_coord=!1;this.family=this.trace="";this.family_interval=d.parse("[0,1]");this.family_steps=d.parse("8");this.parameter=

"t";this.parameter_interval=d.parse("[0,1]");this.parameter_steps=d.parse("8");this.fillM=this.fillP=this.fill="";this.width=-1;this.editable=!1;this.info="";this.font="Monospaced,PLAIN,12";this.fixed=!0;this.size=d.parse("2");this.text="";this.decimals=d.parse("2");this.spear=d.parse("8");this.arrow="#ee0022";this.center=d.parse("(0,0)");this.radius=d.parse("1");this.init=d.parse("0");this.end=d.parse("90");this.file="";this.inirot=d.parse("0");for(var b in c)c.hasOwnProperty(b)&&(this[b]=c[b]);

void 0==this.expresion&&"macro"!=this.type&&(this.expresion=d.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backgroundCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backgroundCanvas.getContext("2d"));this.font=a.convertFont(this.font)};a.Graphic.prototype.getSpace=function(){for(var a=this.parent.spaces,c,d=0,b=a.length;d<b;d++)if(c=a[d],c.id==this.spaceID)return c;return a[0]};a.Graphic.prototype.getFamilyValues=

function(){var a=this.evaluator,c=a.evalExpression(this.family_interval);this.familyInf=c[0][0];this.familySup=c[0][1];this.fSteps=Math.round(a.evalExpression(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};a.Graphic.prototype.drawFamilyAux=function(a,c,d){var b=this.evaluator;this.getFamilyValues();var g=b.getVariable(this.family);if(0<=this.fSteps)for(var e=0,h=this.fSteps;e<=h;e++)b.setVariable(this.family,this.familyInf+e*this.family_sep),0<b.evalExpression(this.drawif)&&

(this.update(),this.drawAux(a,c,d));b.setVariable("_Text_H_",0);b.setVariable(this.family,g)};a.Graphic.prototype.draw=function(a,c){""!=this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.evalExpression(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,c))};a.Graphic.prototype.drawTrace=function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.evalExpression(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,c))};a.Graphic.prototype.drawText=function(f,

c,d,b,g,e,h,i,j,k){if("rtfNode"==c.type)f.fillStyle=g,f.strokeStyle=g,f.textBaseline="alphabetic",c.draw(f,d,b,j,k,h);else{var d=d+(e.match("Arial")?-2:e.match("Times")?-2:0),l=this.evaluator;f.fillStyle=a.getColor(l,g);f.font=e;f.textAlign=h;f.textBaseline=i;this.fontSize=(this.fontSize=e.match(/(\d+)px/))?this.fontSize[1]:"10";this.border&&(f.strokeStyle=a.getColor(l,this.border),f.lineWidth=parseFloat(this.fontSize)/12);e=1.2*this.fontSize;if(c[0]&&c[0].type){h=0;for(i=c.length;h<i;h++)g=l.evalExpression(c[h],

j,k),this.border&&f.strokeText(g,d,b+e*h),f.fillText(g,d,b+e*h)}else{h=0;for(i=c.length;h<i;h++)g=c[h],this.border&&f.strokeText(g,d,b+e*h),f.fillText(g,d,b+e*h)}}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,c=2*Math.PI;a.Equation=function(c,b){a.Graphic.call(this,c,b);this.width=-1==this.width?this.evaluator.parser.parse("1"):this.width;this.generateStroke();this.parseExpresion();(this.visible=2==this.parent.version&&void 0==this.visible?!0:!1)&&this.registerTextField()};

a.extend(a.Equation,a.Graphic);a.Equation.prototype.parseExpresion=function(){if("compOperator"==this.expresion.type){var c=this.expresion.childs[0],b=this.expresion.childs[1];"identifier"==c.type&&"y"==c.value&&!b.contains("y")?(this.funExpr=b,this.drawAux=this.drawAuxFunY):"identifier"==b.type&&"y"==b.value&&!c.contains("y")?(this.funExpr=c,this.drawAux=this.drawAuxFunY):"identifier"==c.type&&"x"==c.value&&!b.contains("x")?(this.funExpr=b,this.drawAux=this.drawAuxFunX):"identifier"==b.type&&"x"==

b.value&&!c.contains("x")&&(this.funExpr=b,this.drawAux=this.drawAuxFunX)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};a.Equation.prototype.generateStroke=function(){this.auxCanvas=document.createElement("canvas");var a=parseInt(this.evaluator.evalExpression(this.width));this.width_2=parseInt(a/2)||1;this.auxCanvas.setAttribute("width",a);this.auxCanvas.setAttribute("height",a);this.auxCtx=this.auxCanvas.getContext("2d");this.auxCtx.beginPath();this.auxCtx.arc(this.width_2,this.width_2,

this.width_2,0,2*Math.PI,!1);this.auxCtx.fill()};a.Equation.prototype.update=function(){};a.Equation.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};a.Equation.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Equation.prototype.drawAux=function(c,b,g){c.lineWidth=1;var b=this.evaluator,e=b.parser,h=this.space;a.getColor(b,this.color);c.fillStyle=g;g=b.evalExpression(this.width);

f(g);e.getVariable("x");e.getVariable("y");var g=h.w,e=h.h,i=f(g/8);3>i&&(i=3);var j=f(e/8);3>j&&(j=3);for(var k=[],l=new a.R2,n=new a.R2,r=new a.R2,o,p,q,m,t,v,u,s,y,x=f(j/2);x<e;x+=j)for(var z=f(i/2);z<g;z+=i)if(this.abs_coord?(p=this.newt.findZero(new a.R2(z,x)),b.setVariable("x",p.x),b.setVariable("y",p.y),o=new a.R2(p.x,p.y)):(p=this.newt.findZero(new a.R2(h.getRelativeX(z),h.getRelativeY(x))),b.setVariable("x",p.x),b.setVariable("y",p.y),o=new a.R2(h.getAbsoluteX(p.x),h.getAbsoluteY(p.y))),

q=f(o.ix()),m=f(o.iy()),!(0>q||q>=g||0>m||m>=e||k[q+m*h.w]))if(k[q+m*h.w]=!0,l.x=p.x,l.y=p.y,n.x=p.x,n.y=p.y,t=this.newt.getUnitNormal(),!(0==t.x&&0==t.y)){t.rotL90();r.x=t.x;r.y=t.y;u=v=0;for(s=!1;2>u;){s&&(r.x=-t.x,r.y=-t.y,p.x=l.x,p.y=l.y,n.x=p.x,n.y=p.y,o=this.abs_coord?new a.R2(p.x,p.y):new a.R2(h.getAbsoluteX(p.x),h.getAbsoluteY(p.y)),q=o.ix(),m=o.iy(),s=!1,v=0);this.abs_coord?(p.x+=r.x,p.y+=r.y):(p.x+=r.x/h.scale,p.y+=r.y/h.scale);p=this.newt.findZero(p);b.setVariable("x",p.x);b.setVariable("y",

p.y);r.x=p.x-n.x;r.y=p.y-n.y;r.normalize();if(0==r.x&&0==r.y)break;n.x=p.x;n.y=p.y;o=this.abs_coord?new a.R2(p.x,p.y):new a.R2(h.getAbsoluteX(p.x),h.getAbsoluteY(p.y));y=f(o.ix());o=f(o.iy());if(y!=q||o!=m)if(q=y,m=o,0<=q&&q<g&&0<=m&&m<e)if(v=0,k[q+m*h.w])break;else k[q+m*h.w]=!0,a.rangeOK&&c.drawImage(this.auxCanvas,q-this.width_2,m-this.width_2);else s=!0,u++;else 4<++v&&(s=!0,u++)}}};a.Equation.prototype.drawAuxFunY=function(c){var b=this.evaluator,f=this.space,e=f.w,h=1/f.scale,i=f.getAbsoluteY(0),

j=b.evalExpression(this.width),k=a.getColor(b,this.color),l=a.getColor(b,this.fillM),n=a.getColor(b,this.fillP);c.fillStyle=k;var r=f.getRelativeX(0),o,p,q,m;b.setVariable("x",r);for(var t=f.getAbsoluteX(r),v=f.getAbsoluteY(b.evalExpression(this.funExpr)),u=0,s,y,x=1;x<e;x++){o=r+x*h;b.setVariable("x",o);p=b.evalExpression(this.funExpr);b.setVariable("y",p);q=f.getAbsoluteX(o);m=f.getAbsoluteY(p);s=Math.min(u,p);y=Math.max(u,p);s={min:s,max:y};if(void 0!==p&&a.rangeOK&&b.evalExpression(this.drawif)&&

!this.hasSingularity(h,o,"x",o-h,u,o,p,s)){if(this.fillM||this.fillP)c.lineWidth=1,c.strokeStyle=m>i?l:n,c.beginPath(),c.moveTo(q+0.5,m),c.lineTo(q+0.5,i),c.stroke();c.lineWidth=j;c.strokeStyle=k;c.beginPath();c.moveTo(t,v);c.lineTo(q,m);c.stroke()}u=p||0;t=q;v=m}};a.Equation.prototype.drawAuxFunX=function(c){var b=this.evaluator,f=this.space,e=f.h,h=1/f.scale,i=f.getAbsoluteX(0),j=b.evalExpression(this.width),k=a.getColor(b,this.color),l=a.getColor(b,this.fillM),n=a.getColor(b,this.fillP);c.fillStyle=

k;var r=f.getRelativeY(e),o,p,q,m;b.setVariable("y",r);for(var t=f.getAbsoluteX(b.evalExpression(this.funExpr)),v=f.getAbsoluteY(r),u=0,s,y,x=1;x<e;x++){o=r+x*h;b.setVariable("y",o);p=b.evalExpression(this.funExpr);b.setVariable("x",p);q=f.getAbsoluteX(p);m=f.getAbsoluteY(o);s=Math.min(u,p);y=Math.max(u,p);s={min:s,max:y};if(void 0!==o&&a.rangeOK&&b.evalExpression(this.drawif)&&!this.hasSingularity(h,o,"y",o-h,u,o,p,s)){if(this.fillM||this.fillP)c.lineWidth=1,c.strokeStyle=q>i?l:n,c.beginPath(),c.moveTo(q,

m+0.5),c.lineTo(i,m+0.5),c.stroke();c.lineWidth=j;c.strokeStyle=k;c.beginPath();c.moveTo(t,v);c.lineTo(q,m);c.stroke()}u=p||0;t=q;v=m}};a.Equation.prototype.hasSingularity=function(a,b,c,f,h,i,j,k){if(1.0E-12>Math.abs(i-f)||1.0E-8>Math.abs(i-f)&&Math.abs(j-h)>Math.abs(a))return!0;var l=!1,l=(f+i)/2;this.evaluator.setVariable(c,l);var n=this.evaluator.evalExpression(this.funExpr);k.min<=n&&n<=k.max?l=!1:(k.x=Math.min(k.min,n),k.y=Math.max(k.max,n),l=this.hasSingularity(a,b,c,f,h,l,n,k)||this.hasSingularity(a,

b,c,l,n,i,j,k));this.evaluator.setVariable(c,b);return l};a.drawPixel=function(a,b,f,e){a.moveTo(b,f);a.arc(b,f,e,0,c,!1)};a.Equation.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parseExpresion(),b.parent.update())};this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;

a.Curve=function(f,c){a.Graphic.call(this,f,c);this.width=-1==this.width?this.evaluator.parser.parse("1"):this.width;(this.visible=2==this.parent.version&&void 0==this.visible?!0:!1)&&this.registerTextField()};a.extend(a.Curve,a.Graphic);a.Curve.prototype.update=function(){var a=this.evaluator,c=a.evalExpression(this.parameter_interval);this.paraInf=c[0][0];this.paraSup=c[0][1];this.pSteps=a.evalExpression(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:

0};a.Curve.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Curve.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Curve.prototype.drawAux=function(f,c,d){var b=this.evaluator,g=this.space,e=this.evaluator.evalExpression(this.width);0>=e&&(e=1.0E-6);f.lineWidth=e;f.lineCap="round";f.lineJoin="round";f.fillStyle=a.getColor(b,c);f.strokeStyle=a.getColor(b,d);c=b.getVariable(this.parameter);f.beginPath();b.setVariable(this.parameter,this.paraInf);

e=b.evalExpression(this.expresion);this.exprX=this.abs_coord?e[0][0]:g.getAbsoluteX(e[0][0]);this.exprY=this.abs_coord?e[0][1]:g.getAbsoluteY(e[0][1]);var h,i,j;this.rotateExp&&(h=a.degToRad(this.evaluator.evalExpression(this.rotateExp)),i=Math.cos(h),h=Math.sin(h),e=this.exprX*i-this.exprY*h,j=this.exprX*h+this.exprY*i,this.exprX=e,this.exprY=j);f.moveTo(this.exprX+0.5,this.exprY+0.5);for(d=1;d<=this.pSteps;d++)b.setVariable(this.parameter,this.paraInf+d*this.paraSep),e=b.evalExpression(this.expresion),

this.exprX=this.abs_coord?e[0][0]:g.getAbsoluteX(e[0][0]),this.exprY=this.abs_coord?e[0][1]:g.getAbsoluteY(e[0][1]),this.rotateExp&&(e=this.exprX*i-this.exprY*h,j=this.exprX*h+this.exprY*i,this.exprX=e,this.exprY=j),f.lineTo(this.exprX+0.5,this.exprY+0.5);this.fill&&f.fill();f.stroke();b.setVariable(this.parameter,c)};a.Curve.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var c=this;a.onkeydown=function(a){13==a.keyCode&&

(c.expresion=c.evaluator.parser.parse(this.value),c.parent.update())};this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI;a.Sequence=function(c,d){a.Graphic.call(this,c,d)};a.extend(a.Sequence,a.Graphic);a.Sequence.prototype.update=function(){var c=this.evaluator,d=c.evalExpression(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];if(this.rotateExp){var b=a.degToRad(c.evalExpression(this.rotateExp)),d=Math.cos(b),

f=Math.sin(b),b=this.exprX*d-this.exprY*f,d=this.exprX*f+this.exprY*d;this.exprX=b;this.exprY=d}c=c.evalExpression(this.range);this.rangeInf=c[0][0];this.rangeMax=c[0][1]};a.Sequence.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Sequence.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Sequence.prototype.drawAux=function(c,d){var b=this.evaluator,g,e,h,i=Math.ceil(b.evalExpression(this.size)-0.4);c.fillStyle=a.getColor(b,d);c.beginPath();

this.rangeInf>this.rangeMax&&(h=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=h);for(var j=b.getVariable("n"),k=this.rangeInf,l=this.rangeMax;k<=l;k++)b.setVariable("n",k),h=b.evalExpression(this.expresion),this.exprX=h[0][0],this.exprY=h[0][1],this.abs_coord?g=h[0][1]:(g=this.space.getAbsoluteX(h[0][0]),e=this.space.getAbsoluteY(h[0][1])),c.moveTo(g,e),c.arc(g,e,i,0,f,!0);b.setVariable("n",j);c.fill();this.text!=[""]&&this.uber.drawText.call(this,c,this.text,g+i,e-i,this.color,this.font,

"start","alphabetic",b.evalExpression(this.decimals),this.fixed)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI;a.Point=function(c,d){a.Graphic.call(this,c,d)};a.extend(a.Point,a.Graphic);a.Point.prototype.update=function(){var c=this.evaluator,d=c.evalExpression(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];if(this.rotateExp){var d=a.degToRad(c.evalExpression(this.rotateExp)),c=Math.cos(d),b=Math.sin(d),d=this.exprX*c-this.exprY*b,c=this.exprX*b+

this.exprY*c;this.exprX=d;this.exprY=c}};a.Point.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Point.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Point.prototype.drawAux=function(c,d){var b=this.evaluator,g=this.abs_coord?this.exprX:this.space.getAbsoluteX(this.exprX),e=this.abs_coord?this.exprY:this.space.getAbsoluteY(this.exprY),h=Math.ceil(b.evalExpression(this.size)-0.4);c.fillStyle=a.getColor(b,d);c.beginPath();c.arc(g,

e,h,0,f,!0);c.fill();this.text!=[""]&&this.uber.drawText.call(this,c,this.text,g+h,e-h,this.color,this.font,"start","alphabetic",b.evalExpression(this.decimals),this.fixed)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI;a.Segment=function(c,d){a.Graphic.call(this,c,d);this.width=-1==this.width?this.evaluator.parser.parse("1"):this.width};a.extend(a.Segment,a.Graphic);a.Segment.prototype.update=function(){var c=this.evaluator,d=c.evalExpression(this.expresion);

this.endPoints=[];for(var b=0,f=d.length;b<f;b++)this.endPoints[b]={x:d[b][0],y:d[b][1]};if(this.rotateExp)for(var b=a.degToRad(c.evalExpression(this.rotateExp)),c=Math.cos(b),d=Math.sin(b),e,h,b=0,f=this.endPoints.length;b<f;b++)e=this.endPoints[b].x*c-this.endPoints[b].y*d,h=this.endPoints[b].x*d+this.endPoints[b].y*c,this.endPoints[b].x=e,this.endPoints[b].y=h};a.Segment.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Segment.prototype.drawTrace=function(){this.uber.drawTrace.call(this,

this.trace,this.trace)};a.Segment.prototype.drawAux=function(c,d,b){var g=this.evaluator,e=g.evalExpression(this.width);0>=e&&(e=1.0E-6);c.lineWidth=e;e=g.evalExpression(this.size);c.fillStyle=a.getColor(g,d);c.strokeStyle=a.getColor(g,b);c.lineCap="round";var d=10+c.lineWidth,b=0==c.lineWidth%2?0:0.5,h,i,j,k;this.abs_coord?(h=this.endPoints[0].x,i=this.endPoints[0].y,j=this.endPoints[1].x,k=this.endPoints[1].y):(h=this.space.getAbsoluteX(this.endPoints[0].x),i=this.space.getAbsoluteY(this.endPoints[0].y),

j=this.space.getAbsoluteX(this.endPoints[1].x),k=this.space.getAbsoluteY(this.endPoints[1].y));e=g.evalExpression(this.size);0>e&&(e=0);c.beginPath();c.moveTo(h+b,i+b);c.lineTo(j+b,k+b);this.text!=[""]&&this.uber.drawText.call(this,c,this.text,(h+j)/2+d,(i+k)/2-d,this.color,this.font,"start","alphabetic",g.evalExpression(this.decimals),this.fixed);c.stroke();c.beginPath();c.arc(h,i,e,0,f,!0);c.arc(j,k,e,0,f,!0);c.fill()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=

Math.floor;a.Arrow=function(c,d){a.Graphic.call(this,c,d);this.width=-1==this.width?this.evaluator.parser.parse("5"):this.width};a.extend(a.Arrow,a.Graphic);a.Arrow.prototype.update=function(){var c=this.evaluator,d=c.evalExpression(this.expresion);this.endPoints=[];for(var b=0,f=d.length;b<f;b++)this.endPoints[b]={x:d[b][0],y:d[b][1]};if(this.rotateExp)for(var b=a.degToRad(c.evalExpression(this.rotateExp)),c=Math.cos(b),d=Math.sin(b),e,h,b=0,f=this.endPoints.length;b<f;b++)e=this.endPoints[b].x*

c-this.endPoints[b].y*d,h=this.endPoints[b].x*d+this.endPoints[b].y*c,this.endPoints[b].x=e,this.endPoints[b].y=h};a.Arrow.prototype.draw=function(){this.uber.draw.call(this,this.arrow,this.color)};a.Arrow.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.arrow,this.trace)};a.Arrow.prototype.drawAux=function(c,d,b){var g=this.evaluator,e=this.space;g.evalExpression(this.size);var h=g.evalExpression(this.width);1>h&&(h=1);var i=Math.ceil(h/2),j=e.scale;this.vect=new a.Vector2D(this.endPoints[1].x-

this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);var k=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);c.fillStyle=a.getColor(g,d);c.strokeStyle=a.getColor(g,b);c.lineWidth=1;var l,n,r;this.abs_coord?(d=this.endPoints[0].x,l=this.endPoints[0].y,n=this.endPoints[1].x,e=this.endPoints[1].y):(d=e.getAbsoluteX(this.endPoints[0].x),l=e.getAbsoluteY(this.endPoints[0].y),n=e.getAbsoluteX(this.endPoints[1].x),e=e.getAbsoluteY(this.endPoints[1].y));r=g.evalExpression(this.spear);

0>r&&(r=0);c.save();c.translate(d,l,k);this.abs_coord?0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?c.rotate(this.angle):c.rotate(-this.angle):(k*=j,0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?c.rotate(-this.angle):c.rotate(this.angle));c.beginPath();c.moveTo(-i+0.5,f(-i)+0.5);c.lineTo(f(k-r-h)+0.5,f(-i)+0.5);c.lineTo(f(k-2*r)+0.5,f(-r-i)+0.5);c.lineTo(f(k)+0.5,0);c.lineTo(f(k-2*r)+0.5,f(r+i)-0.5);c.lineTo(f(k-r-h)+0.5,f(i)-0.5);c.lineTo(-i+0.5,f(i)-0.5);c.closePath();

c.stroke();c.fill();c.restore();this.text!=[""]&&this.uber.drawText.call(this,c,this.text,(d+n)/2,(l+e)/2,b,this.font,"start","alphabetic",g.evalExpression(this.decimals),this.fixed)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Polygon=function(f,c){a.Graphic.call(this,f,c);this.width=-1==this.width?this.evaluator.parser.parse("1"):this.width};a.extend(a.Polygon,a.Graphic);a.Polygon.prototype.update=function(){var f=this.evaluator,c=f.evalExpression(this.expresion);

this.endPoints=[];for(var d=0,b=c.length;d<b;d++)this.endPoints[d]={x:c[d][0],y:c[d][1]};if(this.rotateExp)for(var d=a.degToRad(f.evalExpression(this.rotateExp)),f=Math.cos(d),c=Math.sin(d),g,e,d=0,b=this.endPoints.length;d<b;d++)g=this.endPoints[d].x*f-this.endPoints[d].y*c,e=this.endPoints[d].x*c+this.endPoints[d].y*f,this.endPoints[d].x=g,this.endPoints[d].y=e};a.Polygon.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Polygon.prototype.drawTrace=function(){this.uber.drawTrace.call(this,

this.trace,this.trace)};a.Polygon.prototype.drawAux=function(f,c,d){var b=this.evaluator,g=b.evalExpression(this.width);0>=g&&(g=1.0E-6);f.lineWidth=g;f.fillStyle=a.getColor(b,c);f.strokeStyle=a.getColor(b,d);f.lineCap="round";f.lineJoin="round";c=0==this.ctx.lineWidth%2?0:0.5;d=this.abs_coord?this.endPoints[0].x:this.space.getAbsoluteX(this.endPoints[0].x);b=this.abs_coord?this.endPoints[0].y:this.space.getAbsoluteY(this.endPoints[0].y);f.beginPath();f.moveTo(d+c,b+c);for(var g=1,e=this.endPoints.length;g<

e;g++)d=this.abs_coord?this.endPoints[g].x:this.space.getAbsoluteX(this.endPoints[g].x),b=this.abs_coord?this.endPoints[g].y:this.space.getAbsoluteY(this.endPoints[g].y),f.lineTo(d+c,b+c);this.fill&&f.fill();f.stroke()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor;a.Arc=function(c,d){a.Graphic.call(this,c,d);this.width=-1==this.width?this.evaluator.parser.parse("1"):this.width};a.extend(a.Arc,a.Graphic);a.Arc.prototype.update=function(){var c=this.evaluator,

d=c.evalExpression(this.center);this.exprX=d[0][0];this.exprY=d[0][1];if(this.rotateExp){var b=a.degToRad(c.evalExpression(this.rotateExp)),d=Math.cos(b),f=Math.sin(b),b=this.exprX*d-this.exprY*f,d=this.exprX*f+this.exprY*d;this.exprX=b;this.exprY=d}b=c.evalExpression(this.init);d=c.evalExpression(this.end);if("(expr)"==this.init.type&&"(expr)"==this.end.type||"[expr]"==this.init.type&&"[expr]"==this.end.type||"(expr)"==this.init.type&&"[expr]"==this.end.type||"[expr]"==this.init.type&&"(expr)"==

this.end.type){this.vectors=!0;var c=b[0][0],f=b[0][1],e=d[0][0],h=d[0][1],d=Math.acos((1*c+0*f)/Math.sqrt(c*c+f*f)),b=Math.acos((1*e+0*h)/Math.sqrt(e*e+h*h));0<c&&0<f&&!this.abs_coord&&(d=2*Math.PI-d);0<c&&0>f&&this.abs_coord&&(d=2*Math.PI-d);0>c&&0>f&&this.abs_coord&&(d=2*Math.PI-d);0>c&&0<f&&!this.abs_coord&&(d=2*Math.PI-d);0<e&&0<h&&!this.abs_coord&&(b=2*Math.PI-b);0<e&&0>h&&this.abs_coord&&(b=2*Math.PI-b);0>e&&0>h&&this.abs_coord&&(b=2*Math.PI-b);0>e&&0<h&&!this.abs_coord&&(b=2*Math.PI-b);c=

Math.min(d,b);f=Math.max(d,b);d=c;b=f;b-d>Math.PI&&this.abs_coord&&(d=f,b=c);b-d<=Math.PI&&!this.abs_coord&&(d=f,b=c);this.iniAng=d;this.endAng=b}else this.vectors=!1,this.iniAng=a.degToRad(b),this.endAng=a.degToRad(d)};a.Arc.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Arc.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Arc.prototype.drawAux=function(c,d,b){var g=this.evaluator,e=this.space,h=this.abs_coord?f(this.exprX)+0.5:f(e.getAbsoluteX(this.exprX))+

0.5,i=this.abs_coord?f(this.exprY)+0.5:f(e.getAbsoluteY(this.exprY))+0.5,j=g.evalExpression(this.radius);if(!this.vectors&&this.iniAng>this.endAng){var k=this.iniAng;this.iniAng=this.endAng;this.endAng=k}0>j&&(j=0);k=!1;this.abs_coord||(j*=e.scale,this.vectors||(this.iniAng=-this.iniAng,this.endAng=-this.endAng,k=!0));this.vectors&&(k=this.abs_coord?!1:!0);e=g.evalExpression(this.width);0>=e&&(e=1.0E-6);c.lineWidth=e;c.lineCap="round";c.fillStyle=a.getColor(g,d);c.strokeStyle=a.getColor(g,b);this.fill&&

(c.beginPath(),c.moveTo(h,i),c.arc(h,i,j,this.iniAng,this.endAng,k),c.fill());c.beginPath();c.arc(h,i,j,this.iniAng,this.endAng,k);c.stroke();this.text!=[""]&&this.uber.drawText.call(this,c,this.text,h+1,i-1,this.color,this.font,"start","alphabetic",g.evalExpression(this.decimals),this.fixed)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Fill=function(f,c){a.Graphic.call(this,f,c)};a.extend(a.Fill,a.Graphic);a.Fill.prototype.update=function(){};a.Fill.prototype.draw=

function(){this.uber.draw.call(this,this.color,this.color)};a.Fill.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Fill.prototype.drawAux=function(){};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Text=function(f,c){a.Graphic.call(this,f,c);this.align||(this.align="start");-1==this.width&&(this.width=this.evaluator.parser.parse("0"));this.abs_coord=!0};a.extend(a.Text,a.Graphic);a.Text.prototype.update=function(){var f=this.evaluator,

c=f.evalExpression(this.expresion);this.exprX=c[0][0];this.exprY=c[0][1];if(this.rotateExp){var c=a.degToRad(f.evalExpression(this.rotateExp)),f=Math.cos(c),d=Math.sin(c),c=this.exprX*f-this.exprY*d,f=this.exprX*d+this.exprY*f;this.exprX=c;this.exprY=f}};a.Text.prototype.draw=function(){this.uber.draw.call(this,this.color)};a.Text.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.color)};a.Text.prototype.drawAux=function(a,c){var d=this.splitText(this.text);this.text!=[""]&&this.uber.drawText.call(this,

a,d,parseFloat(this.exprX)+5,parseFloat(this.exprY),c,this.font,this.align,"hanging",this.evaluator.evalExpression(this.decimals),this.fixed)};a.Text.prototype.splitText=function(a){var c=this.evaluator.evalExpression(this.width),d,b,g=[];this.ctx.font=this.font;this.fontSize=(this.fontSize=this.font.match(/(\d+)px/))?this.fontSize[1]:"10";if(20<=c&&"undefined"!=a.type){for(var e=0,h=a.length;e<h;e++)d=this.evaluator.evalExpression(a[e],this.evaluator.evalExpression(this.decimals),this.fixed).trim(),

b=this.ctx.measureText(d).width,b>c?g=g.concat(this.splitWords(d,c)):g.push(d);a=Math.floor(1.2*this.fontSize)*g.length;this.evaluator.setVariable("_Text_H_",a);return g}this.evaluator.setVariable("_Text_H_",0);this.evaluator.setVariable("_Text_W_",1E3);return a};a.Text.prototype.splitWords=function(a,c){var d=a,b=[],g,e,h,i,j=!1;do h=Math.floor(d.length*(c/this.ctx.measureText(d).width))+1,g=d.slice(0,h),""!=g&&" "==g[0]&&(d=d.slice(1),g=d.slice(0,h)),j=d[h-1]&&d[h]&&" "!=d[h-1]&&" "!=d[h],i=g.lastIndexOf(" "),

e=this.ctx.measureText(g).width,e>=c?(h=-1!=i?i:h-1,g=d.slice(0,h)):j&&-1!=i&&(h=i,g=d.slice(0,h)),b.push(g),d=d.slice(h);while(""!=d);return b};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Image=function(f,c){a.Graphic.call(this,f,c);this.img=new Image;this.scaleY=this.scaleX=1;this.update()};a.extend(a.Image,a.Graphic);a.Image.prototype.update=function(){var f=this.evaluator,c=f.evalExpression(this.expresion);this.exprX=c[0][0];this.exprY=c[0][1];if(this.rotateExp){var d=

a.degToRad(f.evalExpression(this.rotateExp)),b=Math.cos(d),g=Math.sin(d),d=this.exprX*b-this.exprY*g,b=this.exprX*g+this.exprY*b;this.exprX=d;this.exprY=b}if(4==c[0].length&&(this.centered=!0,this.scaleX=c[0][2],0==this.scaleX&&(this.scaleX=1.0E-5),this.scaleY=c[0][3],0==this.scaleY))this.scaleY=1.0E-5;if(c[1]&&2==c[1].length&&(this.centered=!0,this.scaleX=c[1][0],0==this.scaleX&&(this.scaleX=1.0E-5),this.scaleY=c[1][1],0==this.scaleY))this.scaleY=1.0E-5;if((f=f.evalExpression(this.file))||""==f)this.img=

this.parent.getImage(f)};a.Image.prototype.draw=function(){this.uber.draw.call(this)};a.Image.prototype.drawTrace=function(){this.uber.drawTrace.call(this)};a.Image.prototype.drawAux=function(f){var c=this.evaluator;if(this.img&&this.img.ready&&this.img.complete){var d=this.centered?0:this.img.width/2,b=this.centered?0:this.img.height/2,g=this.abs_coord?this.exprX:this.space.getAbsoluteX(this.exprX),e=this.abs_coord?this.exprY:this.space.getAbsoluteY(this.exprY),h=a.degToRad(-c.evalExpression(this.inirot));

f.translate(g+d,e+b);f.rotate(h);f.scale(this.scaleX,this.scaleY);this.opacity&&(f.globalAlpha=c.evalExpression(this.opacity));f.drawImage(this.img,-this.img.width/2,-this.img.height/2);f.setTransform(1,0,0,1,0,0);f.globalAlpha=1}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Macro=function(f,c){a.Graphic.call(this,f,c);this.graphics=[];var d=f.lessonParser,b=new a.Tokenizer,g;for(g in c)c.hasOwnProperty(g)&&(this[g]=c[g]);if(void 0!=this.expresion){this.expresion.match("'")||

(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);g=this.expresion.value;var e,h=2;g&&((e=document.getElementById(g))&&"descartes/macro"==e.type?(e=e.text,h=3):(e=a.openExternalFile(g),e.match("tipo_de_macro")||(e=null)));var i="|";if(e){e=e.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,"\u00c9").replace(/&Iacute;/g,

"\u00cd").replace(/&Oacute;/g,"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/\&gt;/g,">").replace(/\&lt;/g,"<").replace(/\&amp;/g,"&").split("\n").slice(h);var j,k;g=0;for(h=e.length;g<h;g++)e[g]&&(e[g]=d.split(e[g]),e[g]&&e[g][0]&&e[g][0][0]&&"id"==e[g][0][0]&&(j=e[g][0][1],k=j.indexOf("("),-1!=k&&(j=j.substring(0,k)),i+=j+"|"));var l,n,r,o;g=0;for(h=e.length;g<h;g++){l=e[g]||[];j=0;for(k=l.length;j<k;j++)if(n=babel[l[j][0]],r=l[j][0].indexOf("."),

-1!=r&&(n=babel[l[j][0].substring(r+1)]),!("id"!=n&&"text"!=n&&"expresion"!=n&&"interval"!=n&&"steps"!=n&&"drawif"!=n&&"size"!=n&&"width"!=n&&"center"!=n&&"radius"!=n&&"init"!=n&&"end"!=n&&"inirot"!=n&&"do"!=n&&"while"!=n&&"file"!=n&&"fill"!=n&&"color"!=n))if("text"==n)if(l[j][1].match(/\{\\rtf1/)){n=l[j][1];var p=this;o=function(a,c){for(var d=b.tokenize(c.replace(/\&squot;/g,"'")),f=0,e=d.length;f<e;f++)if(d[f].type=="identifier"&&i.match("\\|"+d[f].value+"\\|"))d[f].value=p.name+"."+d[f].value;

else if(d[f].type=="identifier"&&(r=d[f].value.indexOf("."))!=-1&&i.match("\\|"+d[f].value.substring(0,r)+"\\|"))d[f].value=p.name+"."+d[f].value;return(a.match(/^\\expr/)?"\\expr ":"\\decimals ")+b.flatTokens(d)};n=n.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.']*)/gi,o);n=n.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.']*)/gi,o);l[j][1]=n}else{o=d.parseText(l[j][1]);for(var q=0,m=o.length;q<m;q++){n=b.tokenize(o[q].replace(/\&squot;/g,"'"));for(var t=0,v=n.length;t<

v;t++)"identifier"==n[t].type&&i.match("\\|"+n[t].value+"\\|")&&(n[t].value=this.name+"."+n[t].value);n=b.flatTokens(n).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");o[q]=n.substring(1,n.length-1)}l[j][1]=o.join("\\n")}else{n=b.tokenize(l[j][1].replace(/\&squot;/g,"'"));o=0;for(q=n.length;o<q;o++)if("identifier"==n[o].type&&i.match("\\|"+n[o].value+"\\|"))n[o].value=this.name+"."+n[o].value;else if("identifier"==n[o].type&&-1!=(r=n[o].value.indexOf("."))&&i.match("\\|"+n[o].value.substring(0,

r)+"\\|"))n[o].value=this.name+"."+n[o].value;l[j][1]=b.flatTokens(n)}}g=0;for(h=e.length;g<h;g++)if(e[g][0]){l="";j=0;for(k=e[g].length;j<k;j++)e[g][j]="type"!=babel[e[g][j][0]]?e[g][j][0]+"='"+e[g][j][1]+"' ":"espacio='"+this.spaceID+"' "+e[g][j][0]+"='"+e[g][j][1]+"' ",l+=e[g][j];e[g]=l;l.match(/^espacio/)?this.graphics.push(d.parseGraphic(e[g],this.abs_coord,this.background,this.inirot)):d.parseAuxiliar(e[g])}}}};a.extend(a.Macro,a.Graphic);a.Macro.prototype.update=function(){if(this.inipos){var a=

this.evaluator.evalExpression(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}};a.Macro.prototype.drawAux=function(a){for(var c=0,d=this.graphics.length;c<d;c++)this.inipos&&(this.graphics[c].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale)),this.graphics[c].draw(),a.setTransform(1,0,0,1,0,0)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,c=Math.min;a.R2=function(a,b){this.x=

a||0;this.y=b||0};a.R2.prototype.copy=function(){return new a.R2(this.x,this.y)};a.R2.prototype.ix=function(){return Math.round(f(c(this.x,32E3),-32E3))};a.R2.prototype.iy=function(){return Math.round(f(c(this.y,32E3),-32E3))};a.R2.prototype.equals=function(a){return this.x==a.x&&this.y==a.y};a.R2.prototype.norm2=function(){return this.x*this.x+this.y*this.y};a.R2.prototype.norm=function(){return Math.sqrt(this.norm2())};a.R2.prototype.distance=function(a){var b=this.copy();b.sub(a);return b.norm()};

a.R2.prototype.dot=function(a){return this.x*a.x+this.y*a.y};a.R2.prototype.det=function(a){return this.x*a.y-this.y*a.x};a.R2.prototype.mul=function(a){this.x*=a;this.y*=a};a.R2.prototype.div=function(a){this.x/=a;this.y/=a};a.R2.prototype.add=function(a){this.x+=a.x;this.y+=a.y};a.R2.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};a.R2.prototype.normalize=function(){var a=this.norm();0!=a&&this.div(a)};a.R2.prototype.rotR90=function(){var a=this.x;this.x=this.y;this.y=-a};a.R2.prototype.rotL90=

function(){var a=this.x;this.x=-this.y;this.y=a};a.R2.prototype.rot=function(a){var b=this.copy(),c=Math.cos(a),a=Math.sin(a);this.x=b.x*c-b.y*a;this.y=b.x*a+b.y*c};a.R2.prototype.rot=function(a){this.rot(a*Math.PI/180)};a.R2.prototype.intersection=function(d,b,g,e){var h=b.x-d.x,i=g.x-e.x,j=g.x-d.x,k=b.y-d.y,l=g.y-e.y,n=g.y-d.y,r=h*l-i*k;return 1.0E-6<Math.abs(r)?(b=(j*l-n*i)/r,g=(-j*k+n*h)/r,0<=b&&1>=b&&0<=g&&1>=g?new a.R2(d.x+h*b,d.y+k*b):null):(b.x-g.x)*n!=(b.y-g.y)*j?null:d.x!=b.x?(h=c(d.x,b.x),

d=f(d.x,b.x),h<=g.x&&g.x<=d?g:h<=e.x&&e.x<=d?e:null):g.x!=e.x?(h=c(g.x,e.x),g=f(g.x,e.x),h<=d.x&&d.x<=g?d:h<=b.x&&b.x<=g?b:null):d.y!=b.y?(h=c(d.y,b.y),d=f(d.y,b.y),h<=g.y&&g.y<=d?g:h<=e.y&&e.y<=d?e:null):g.y!=e.y?(h=c(g.y,e.y),g=f(g.y,e.y),h<=d.y&&d.y<=g?d:h<=b.y&&b.y<=g?b:null):d.x==g.x&&d.y==g.y?d:null};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.R2Newton=function(a,c){this.evaluator=a;this.constraint=c;if("=="==this.constraint.value||"<"==this.constraint.value||

"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0]};a.R2Newton.prototype.getUnitNormal=function(){this.normal.normalize();return this.normal.copy()};a.R2Newton.prototype.gradient=function(f){var c=this.evaluator,d=new a.R2(0,0),b=c.getVariable("x"),

g=c.getVariable("y");c.setVariable("x",f.x);c.setVariable("y",f.y);this.f0=c.evalExpression(this.constraint);c.setVariable("x",c.getVariable("x")+1.0E-12);f=c.evalExpression(this.constraint);d.x=(f-this.f0)/1.0E-12;d.x=NaN!=d.x?d.x:Infinity;c.setVariable("x",c.getVariable("x")-1.0E-12);c.setVariable("y",c.getVariable("y")+1.0E-12);f=c.evalExpression(this.constraint);d.y=(f-this.f0)/1.0E-12;d.y=NaN!=d.y?d.y:Infinity;c.setVariable("x",b);c.setVariable("y",g);return d};a.R2Newton.prototype.findZero=

function(a){var c=this.evaluator,d=a.copy(),b=c.getVariable("x"),g=c.getVariable("y");c.setVariable("x",a.x);c.setVariable("y",a.y);this.f0=c.evalExpression(this.constraint);if("menor"==this.sign&&0>=this.f0||"mayor"==this.sign&&0<=this.f0)return d;c.setVariable("x",b);c.setVariable("y",g);for(g=0;256>g;g++)if(c=d.x,b=d.y,this.normal=this.gradient(d),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),d.x=c+this.normal.x,d.y=b+this.normal.y,1.0E-6>this.normal.norm()){0==this.normal.x&&

0==this.normal.y&&(this.normal.x=d.x-a.x,this.normal.y=d.y-a.y);break}return d};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI;a.GraphicControl=function(c,d){this.parent=c;this.evaluator=c.evaluator;var b=this.evaluator.parser;this.id="G";this.type="";this.spaceID="E0";this.text="";this.expresion=b.parse("(0,0)");this.y=this.x=0;this.size=b.parse("4");this.fixed=2!=this.parent.version?!1:!0;this.color="#0000ff";this.colorInt="#ff0000";this.font="Monospaced,PLAIN,12";

this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.drawif=b.parse("1");this.activeif=b.parse("1");this.tooltip="";this.tooltipFont="Monospace 12px";this.Explanation="";this.ExplanationFont="Monospace 12px";this.decimals=b.parse("2");this.zIndex=-1;for(var f in d)d.hasOwnProperty(f)&&(this[f]=d[f]);this.font=a.convertFont(this.font);this.constraintExpr&&(this.constraint=b.parse(this.constraintExpr),"(expr)"==this.constraint.type&&(this.constraint=b.parse(this.constraintExpr.substring(1,

this.constraintExpr.length-1))),"compOperator"==this.constraint.type?this.newt=new a.R2Newton(this.evaluator,this.constraint):this.constraint=null);this.container=this.getContainer();this.space=this.getSpace();this.mouseCacher=document.createElement("div");this.mouseCacher.setAttribute("class","DescartesGraphicControl");this.mouseCacher.setAttribute("id",this.id);this.mouseCacher.setAttribute("tabindex","-1");this.ctx=this.space.ctx;this.container.appendChild(this.mouseCacher);this.init();this.registerMouseEvents()};

a.GraphicControl.prototype.init=function(){var c=this.evaluator;this.mouseCacher.style.display=0<c.evalExpression(this.drawif)?"block":"none";var d=c.evalExpression(this.expresion);this.x=d[0][0];this.y=d[0][1];c.setVariable(this.id+".x",this.x);c.setVariable(this.id+".y",this.y);""!=this.imageSrc&&!this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.image=this.parent.getImage(this.imageSrc),this.width=this.image.width,this.height=this.image.height):(this.width=2*c.evalExpression(this.size),this.height=

2*c.evalExpression(this.size));this._w=a.hasTouchSupport&&70>this.width?70:this.width;this._h=a.hasTouchSupport&&70>this.height?70:this.height;this.constraint&&(d=this.newt.findZero(new a.R2(this.x,this.y)),this.x=d.x,this.y=d.y,c.setVariable(this.id+".x",this.x),c.setVariable(this.id+".y",this.y));this.mouseCacher.setAttribute("style","background-color: rgba(255, 255, 255, 0); width: "+this._w+"px; height: "+this._h+"px; z-index: "+this.zIndex+";");this.mouseCacher.style.left=parseInt(this.space.getAbsoluteX(this.x)-

this._w/2)+"px";this.mouseCacher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";c.setVariable(this.id+".activo",0)};a.GraphicControl.prototype.update=function(){var c=this.evaluator;this.x=c.getVariable(this.id+".x");this.y=c.getVariable(this.id+".y");var d=this.space.getAbsoluteX(this.x),b=this.space.getAbsoluteY(this.y);this.mouseCacher.style.left=d-this._w/2+"px";this.mouseCacher.style.top=b-this._h/2+"px";this.mouseCacher.style.display=0<c.evalExpression(this.activeif)?"block":

"none";this.constraint&&(d=this.newt.findZero(new a.R2(this.x,this.y)),this.x=d.x,this.y=d.y,c.setVariable(this.id+".x",this.x),c.setVariable(this.id+".y",this.y));this.draw()};a.GraphicControl.prototype.draw=function(){var c=this.evaluator;if(0<c.evalExpression(this.drawif)){var d=this.ctx,b=this.space.backgroundCtx,g=this.space.getAbsoluteX(this.x),e=this.space.getAbsoluteY(this.y);""!=this.text&&this.drawText(g,e);if(this.image.ready)this.image.complete&&d.drawImage(this.image,g-this.image.width/

2,e-this.image.height/2),this.trace&&(b.save(),b.translate(g,e),b.scale(this.image.width/2,this.image.height/2),b.beginPath(),b.arc(0,0,1,0,f,!1),b.restore(),b.lineWidth=1,b.strokeStyle=a.getColor(c,this.trace),b.stroke());else if(d.beginPath(),d.arc(g,e,this.width/2,0,f,!1),d.fillStyle=a.getColor(c,this.colorInt),d.fill(),d.lineWidth=1,d.strokeStyle=a.getColor(c,this.color),d.stroke(),this.active&&(d.beginPath(),d.arc(g,e,this.width/2-2,0,f,!1),d.strokeStyle="black",d.stroke()),this.trace)b.lineWidth=

1,b.strokeStyle=a.getColor(c,this.trace),b.beginPath(),b.arc(g,e,this.width/2,0,f,!1),b.stroke()}};a.GraphicControl.prototype.drawText=function(c,d){var b=this.ctx,f=this.evaluator;b.fillStyle=a.getColor(f,this.color);b.font=this.font;b.textBaseline="alphabetic";f=f.evalExpression(this.text[0],f.evalExpression(this.decimals),this.fixed);b.fillText(f,c+1+this.width/2,d-1-this.height/2)};a.GraphicControl.prototype.getContainer=function(){for(var a=this.parent.spaces,d,b=0,f=a.length;b<f;b++)if(d=a[b],

d.id==this.spaceID)return d.addCtr(this),this.zIndex=d.zIndex,d.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;return a[0].graphicControlContainer};a.GraphicControl.prototype.getSpace=function(){for(var a=this.parent.spaces,d=0,b=a.length;d<b;d++)if(a[d].id==this.spaceID)return a[d];return a[0]};a.GraphicControl.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.id+".activo",0)};a.GraphicControl.prototype.registerMouseEvents=function(){function c(c){c.preventDefault();

i.whichButton=null==c.which?2>c.button?"LEFT":4==c.button?"MIDDLE":"RIGHT":2>c.which?"LEFT":2==c.which?"MIDDLE":"RIGHT";"LEFT"==i.whichButton&&0<i.evaluator.evalExpression(i.activeif)&&i.over&&(i.parent.deactivateGraphiControls(),i.click=!0,i.active=!0,i.evaluator.setVariable(i.id+".activo",1),i.posAnte=i.getCursorPosition(c),i.prePos={x:i.space.getAbsoluteX(i.x),y:i.space.getAbsoluteY(i.y)},a.hasTouchSupport?(window.addEventListener("touchmove",f,!1),window.addEventListener("touchend",b,!1)):(window.addEventListener("mouseup",

b,!1),window.addEventListener("mousemove",f,!1)))}function d(c){0<i.evaluator.evalExpression(i.activeif)&&(i.parent.deactivateGraphiControls(),i.click=!0,i.active=!0,i.posAnte=i.getCursorPosition(c),i.prePos={x:i.space.getAbsoluteX(i.x),y:i.space.getAbsoluteY(i.y)},a.hasTouchSupport?(window.addEventListener("touchmove",f,!1),window.addEventListener("touchend",b,!1)):(window.addEventListener("mouseup",b,!1),window.addEventListener("mousemove",f,!1)));c.preventDefault()}function b(c){if(0<i.evaluator.evalExpression(i.activeif)||

i.active)i.click=!1,c.preventDefault(),a.hasTouchSupport?(window.removeEventListener("touchmove",f,!1),window.removeEventListener("touchend",b,!1)):(window.removeEventListener("mouseup",b,!1),window.removeEventListener("mousemove",f,!1)),i.parent.update(),i.mouseCacher.style.left=i.space.getAbsoluteX(i.x)-i._w/2+"px",i.mouseCacher.style.top=i.space.getAbsoluteY(i.y)-i._h/2+"px"}function f(b){var c=i.getCursorPosition(b);i.posX=i.prePos.x-(i.posAnte.x-c.x);i.posY=i.prePos.y-(i.posAnte.y-c.y);if(i.constraint){var c=

i.space.getRelativeX(i.posX),d=i.space.getRelativeY(i.posY),c=i.newt.findZero(new a.R2(c,d));i.x=c.x;i.y=c.y;i.evaluator.setVariable(i.id+".x",i.x);i.evaluator.setVariable(i.id+".y",i.y)}else i.evaluator.setVariable(i.id+".x",i.space.getRelativeX(i.posX)),i.evaluator.setVariable(i.id+".y",i.space.getRelativeY(i.posY));i.parent.updateControls();i.parent.update();b.preventDefault()}function e(){i.over=!0;i.mouseCacher.style.cursor="pointer"}function h(){i.over=!1;i.mouseCacher.style.cursor="";i.click=

!1}this.active=this.over=this.click=!1;this.mouseCacher.oncontextmenu=function(){return!1};var i=this;a.hasTouchSupport?this.mouseCacher.addEventListener("touchstart",d,!1):(this.mouseCacher.addEventListener("mousedown",c,!1),this.mouseCacher.addEventListener("mouseover",e,!1),this.mouseCacher.addEventListener("mouseout",h,!1));this.mouseCacher.addEventListener("blur",function(){console.log("en blur")},!1)};a.GraphicControl.prototype.getCursorPosition=function(c){c=a.getCursorPosition(c);return{x:c.x-

(this.space.container.offsetLeft+this.space.container.parentNode.offsetLeft),y:c.y-(this.space.container.offsetTop+this.space.container.parentNode.offsetTop)}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Control=function(a,c){this.parent=a;this.evaluator=a.evaluator;var d=this.parser=a.evaluator.parser;this.id="C";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w=100;this.h=23;"text"!=c.type?this.expresion=d.parse("(0,0,100,23)"):(this.expresion=d.parse("(0,0,300,200)"),

this.w=300,this.h=200);this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color="#222222";this.colorInt="#f0f8ff";this.underlined=this.italics=this.bold="";this.font_size=d.parse("12");this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.imageOver=new Image;this.imageOver.onload=function(){this.ready=1};this.imageDown=new Image;this.imageDown.onload=function(){this.ready=1};this.parameter=this.action="";this.parameterFont="Monospace 12px";this.drawif=d.parse("1");

this.activeif=d.parse("1");this.tooltip="";this.tooltipFont="Monospace 12px";this.Explanation="";this.ExplanationFont="Monospace 12px";this.cID=this.msg_pos="";this.valueExpr=d.parse("0");this.decimals=d.parse("2");this.min=d.parse("-Infinity");this.max=d.parse("Infinity");this.incr=d.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;for(var b in c)c.hasOwnProperty(b)&&(this[b]=c[b]);void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");d=this.evaluator.evalExpression(this.expresion);

this.x=d[0][0];this.y=d[0][1];4==d[0].length&&(this.w=d[0][2],this.h=d[0][3]);this.name="_._"==this.name||"_nada_"==this.name||"_void_"==this.name?"":this.name;this.actionExec=this.parent.lessonParser.parseAction(this)};a.Control.prototype.init=function(){};a.Control.prototype.update=function(){};a.Control.prototype.draw=function(){};a.Control.prototype.getContainer=function(){var a=this.parent.spaces,c;if("interior"==this.region)for(var d=0,b=a.length;d<b;d++){if(c=a[d],c.id==this.spaceID)return c.addCtr(this),

this.zIndex=c.zIndex,c.numericalControlContainer}else{if("external"==this.region)return this.parent.externalSpace.container;if("scenario"==this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.scenarioRegion.scenarioSpace.addCtr(this),this.zIndex=this.parent.scenarioRegion.scenarioSpace.zIndex,this.parent.scenarioRegion.scenarioSpace.numericalControlContainer):this.parent.externalSpace.container;if("north"==this.region)return this.parent.northSpace.controls.push(this),

this.parent.northSpace.container;if("south"==this.region)return this.parent.southSpace.controls.push(this),this.parent.southSpace.container;if("east"==this.region)return this.parent.eastSpace.controls.push(this),this.parent.eastSpace.container;if("west"==this.region)return this.parent.westSpace.controls.push(this),this.parent.westSpace.container;if("special"==this.region)return this.parent.specialSpace.controls.push(this),this.parent.specialSpace.container}a[0].addCtr(this);this.zIndex=a[0].zIndex;

return a[0].numericalControlContainer};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor;a.Button=function(c,d){a.Control.call(this,c,d);this.name="["==this.name.charAt(0)&&this.name.charAt(this.name.length-1)?this.parser.parse(this.name.substring(1,this.name.length-1)):this.parser.parse("'"+this.name+"'");var b;this.imageSrc.match("_COLORES_")&&(b=this.imageSrc.split("_"),this.colorInt=b[2],this.color=b[3],this.font_size=this.parser.parse(b[5]),this.imageSrc=

"");this.imageSrc="["==this.imageSrc.charAt(0)&&this.imageSrc.charAt(this.imageSrc.length-1)?this.parser.parse(this.imageSrc.substring(1,this.imageSrc.length-1)):this.parser.parse("'"+this.imageSrc+"'");b=this.evaluator.evalExpression(this.imageSrc);if(""!=b){var f=b.substr(0,b.lastIndexOf(".")),e=b.substr(b.lastIndexOf("."));b.toLowerCase().match(/vacio.gif$/)?(this.image.ready=1,3==this.parent.version&&(this.name=this.parser.parse("")),this.parser.parse("'vacio.gif'")):(this.image=this.parent.getImage(b),

this.imageOver=this.parent.getImage(f+"_over"+e),this.imageDown=this.parent.getImage(f+"_down"+e))}b=this.getContainer();this.canvas=document.createElement("canvas");this.canvas.setAttribute("class","DescartesButton");this.canvas.setAttribute("id",this.id);this.canvas.setAttribute("width",this.w+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.canvas.style.display=0<this.evaluator.evalExpression(this.drawif)?

"block":"none";this.ctx=this.canvas.getContext("2d");b.childNodes[0]?b.insertBefore(this.canvas,b.childNodes[0]):b.appendChild(this.canvas);this.registerMouseEvents();this.init()};a.extend(a.Button,a.Control);a.Button.prototype.init=function(){var a=this.canvas,d=this.evaluator.evalExpression(this.expresion);this.x=d[0][0];this.y=d[0][1];4==d[0].length&&(this.w=parseInt(d[0][2]),this.h=parseInt(d[0][3]));a.setAttribute("width",this.w+"px");a.setAttribute("height",this.h+"px");a.setAttribute("style",

"left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.createGradient(this.w,this.h);this.draw()};a.Button.prototype.update=function(){var a=!1,d=!1,b=!1,f=!1;0<this.evaluator.evalExpression(this.drawif)?(this.canvas.style.display="block",this.draw()):(this.click=!1,this.canvas.style.display="none");this.evaluator.evalExpression(this.activeif);var e=this.evaluator.evalExpression(this.expresion),a=this.x!=e[0][0],d=this.y!=e[0][1];this.x=e[0][0];this.y=e[0][1];4==e[0].length&&(b=

this.w!=e[0][2],f=this.h!=e[0][3],this.w=e[0][2],this.h=e[0][3]);(b||f)&&this.createGradient(this.canvas.width,this.canvas.height);if(b||f||a||d)this.canvas.setAttribute("width",this.w+"px"),this.canvas.setAttribute("height",this.h+"px"),this.canvas.setAttribute("style","left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";"),this.draw()};a.Button.prototype.createGradient=function(a,d){this.linearGradient=this.ctx.createLinearGradient(0,0,0,d);for(var b=d*d,g,e=0;e<d;e++)g=f(e-35*d/100),

this.linearGradient.addColorStop(e/d,"rgba(0,0,0,"+192*g*g/b/255+")")};a.Button.prototype.draw=function(){var c=this.evaluator.evalExpression(this.font_size),d=this.evaluator.evalExpression(this.name),b=this.evaluator.evalExpression(this.imageSrc),g;g="vacio.gif"==b?{ready:!0}:this.parent.getImage(b);var e=this.ctx;e.clearRect(0,0,this.w,this.h);var h=0,i=0;this.click&&(i=h=1);g&&g.ready?(""!=g.src||!b.toLowerCase().match(/vacio.gif$/))&&g.complete&&e.drawImage(g,(this.w-g.width)/2+h,(this.h-g.height)/

2+i):(e.fillStyle=a.getColor(this.evaluator,this.colorInt),e.fillRect(0,0,this.w,this.h),this.click||(a.drawLine(e,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,"+128/255+")"),a.drawLine(e,0,0,0,this.h,"rgba(0,0,0,"+24/255+")"),a.drawLine(e,1,0,1,this.h,"rgba(0,0,0,"+8/255+")")),e.fillStyle=this.linearGradient,e.fillRect(0,0,this.w,this.h));""!=this.imageOver.src&&this.imageOver.ready&&this.over&&e.drawImage(this.imageOver,(this.w-g.width)/2+h,(this.h-g.height)/2+i);""!=this.imageDown.src&&this.imageDown.ready&&

this.click?e.drawImage(this.imageDown,(this.w-g.width)/2+h,(this.h-g.height)/2+i):this.click&&(e.save(),a.drawLine(e,0,0,0,this.h-2,"gray"),a.drawLine(e,0,0,this.w-1,0,"gray"),e.fillStyle="rgba(0, 0, 0,"+24/255+")",e.fillRect(0,0,this.w,this.h),e.restore());e.fillStyle=a.getColor(this.evaluator,this.color);e.font=this.italics+" "+this.bold+" "+c+"px Arial";e.textAlign="center";e.textBaseline="middle";e.strokeStyle=a.getColor(this.evaluator,this.colorInt);e.lineWidth=c/12;this.stroke!=this.fillStyle&&

e.strokeText(d,f(this.w/2+h)+0.5,f(this.h/2+i)+0.5);e.fillText(d,f(this.w/2+h)+0.5,f(this.h/2+i)+0.5);this.underlined&&(d=e.measureText(d).width,e.strokeStyle=a.getColor(this.evaluator,this.color),e.lineWidth=f(c/10),e.lineCap="round",e.beginPath(),e.moveTo((this.w-d)/2+h,f(this.h+c)/2+e.lineWidth/2-1.5+i),e.lineTo((this.w+d)/2+h,f(this.h+c)/2+e.lineWidth/2-1.5+i),e.stroke());this.evaluator.evalExpression(this.activeif)||(e.fillStyle="rgba(240,240,240,"+160/255+")",e.fillRect(0,0,this.w,this.h))};

a.Button.prototype.bottonPressed=function(){this.parent.updateControls();"init"==this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!=this.action&&this.parent.update()};a.Button.prototype.registerMouseEvents=function(){function c(a,b,d){i.click?(b.call(i),a=d?a:30,k=setTimeout(function(){c(a,b)},a)):clearInterval(k)}function d(a){a.preventDefault();i.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":

"RIGHT";"LEFT"==i.whichButton&&0<i.evaluator.evalExpression(i.activeif)&&(i.click=!0,i.draw(),i.evaluator.setVariable(i.id,i.evaluator.evalExpression(i.valueExpr)),"calculate"==i.action&&c(j,i.bottonPressed,!0),h?window.addEventListener("touchend",b,!1):window.addEventListener("mouseup",b,!1))}function b(a){if(0<i.evaluator.evalExpression(i.activeif)||i.click)i.click=!1,i.draw(),"calculate"!=i.action&&i.bottonPressed(),a.preventDefault(),h?window.removeEventListener("touchend",b,!1):window.removeEventListener("mouseup",

b,!1)}function f(){i.over=!0;i.draw()}function e(){i.over=!1;i.click=!1;i.draw()}var h=a.hasTouchSupport;this.canvas.oncontextmenu=function(){return!1};var i=this,j=900,k;this.over=this.click=!1;h?this.canvas.addEventListener("touchstart",d,!1):(this.canvas.addEventListener("mousedown",d,!1),this.canvas.addEventListener("mouseover",f,!1),this.canvas.addEventListener("mouseout",e,!1))};return a}(descartesJS||{}),descartesJS=function(a){function f(a,d,b,f){a.fillStyle=f||"black";a.beginPath();a.moveTo(d[0],

b[0]);for(var f=1,e=d.length;f<e;f++)a.lineTo(d[f],b[f]);a.fill()}if(a.loadLib)return a;a.Spinner=function(c,d){a.Control.call(this,c,d);this.tabindex=++this.parent.tabindex;var b=this.getContainer();this.containerControl=document.createElement("div");this.canvas=document.createElement("canvas");this.divUp=document.createElement("div");this.divDown=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.txtLabel=document.createTextNode(this.name);

this.label.appendChild(this.txtLabel);""!=this.name.trim()&&this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.field);this.containerControl.appendChild(this.canvas);this.containerControl.appendChild(this.divUp);this.containerControl.appendChild(this.divDown);b.childNodes[0]?b.insertBefore(this.containerControl,b.childNodes[0]):b.appendChild(this.containerControl);this.init();this.registerMouseEvents();this.draw()};a.extend(a.Spinner,a.Control);a.Spinner.prototype.init=

function(){var c=this.evaluator;this.value=this.validateValue(c.evalExpression(this.valueExpr));var d=this.formatOutputValue(this.value);this.fieldFontSize=Math.floor(this.h-0.25*this.h);var b=a.getTextWidth(d+"0",this.fieldFontSize+"px Arial"),f=2+this.h/2,e=this.w/2-f/2,h=a.getTextWidth(this.name,this.fieldFontSize+"px Arial");this.visible||(e=this.w-f,b=0);e<h&&(e=h);""==this.name&&(e=0);this.w-e-f<b&&(e=this.w-f-b);0>e&&(e=0);b=this.w-(e+f);this.containerControl.setAttribute("class","DescartesSpinnerContainer");

this.containerControl.setAttribute("style","width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.containerControl.style.display=0<c.evalExpression(this.drawif)?"block":"none";this.canvas.setAttribute("width",f+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","position: absolute; left: "+e+"px; top: 0px;");this.ctx=this.canvas.getContext("2d");this.divUp.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+

f+"px; height : "+this.h/2+"px; left: "+e+"px; top: 0px;");this.divDown.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+f+"px; height : "+this.h/2+"px; left: "+e+"px; top: "+this.h/2+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",this.id+"_spinner");this.field.value=d;this.field.setAttribute("class","DescartesSpinnerField");this.field.setAttribute("style","font-family: Arial; font-size: "+this.fieldFontSize+

"px; width : "+(b-2)+"px; height : "+(this.h-2)+"px; left: "+(f+e)+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.disabled=0<c.evalExpression(this.activeif)?!1:!0;this.label.setAttribute("class","DescartesSpinnerLabel");this.label.setAttribute("style","font-family: Arial; font-size:"+this.fieldFontSize+"px; width: "+e+"px; height: "+this.h+"px;");c.setVariable(this.id,this.value);this.createGradient(this.h/2,this.h)};a.Spinner.prototype.update=function(){var a=this.evaluator,

d=!1,b=!1,f=!1,e=!1;this.field.disabled=0<a.evalExpression(this.activeif)?!1:!0;0<a.evalExpression(this.drawif)?(this.containerControl.style.display="block",this.draw()):(this.click=!1,this.containerControl.style.display="none");var h=a.evalExpression(this.expresion),d=this.x!=h[0][0],b=this.y!=h[0][1];this.x=h[0][0];this.y=h[0][1];4==h[0].length&&(f=this.w!=h[0][2],e=this.h!=h[0][3],this.w=h[0][2],this.h=h[0][3]);(f||e)&&this.createGradient(this.canvas.width,this.canvas.height);var h=this.field.value,

i=this.value;this.value=this.validateValue(a.getVariable(this.id));this.field.value=this.formatOutputValue(this.value);this.value==i&&this.field.value!=h&&(this.value=this.validateValue(h),this.field.value=this.formatOutputValue(this.value));if(f||e||d||b)this.init(),this.draw();a.setVariable(this.id,this.value)};a.Spinner.prototype.createGradient=function(a,d){this.linearGradient=this.ctx.createLinearGradient(0,0,0,d);for(var b=d*d,f,e=0;e<d;e++)f=Math.floor(e-40*d/100),this.linearGradient.addColorStop(e/

d,"rgba(0,0,0,"+192*f*f/b/255+")")};a.Spinner.prototype.draw=function(){var c=this.ctx,d=this.canvas.width,b=this.canvas.height;c.save();c.fillStyle="#f0f8ff";c.fillRect(0,0,d,b);c.fillStyle=this.linearGradient;c.fillRect(0,0,d,b);var g,e;this.up?(g="gray",e="#f0f8ff"):(g="#f0f8ff",e="gray");a.drawLine(c,0,0,d,0,g);a.drawLine(c,0,0,0,b/2,g);a.drawLine(c,0,b/2,d,b/2,e);this.down?(g="gray",e="#f0f8ff"):(g="#f0f8ff",e="gray");a.drawLine(c,0,b/2+1,d,b/2+1,g);a.drawLine(c,0,b/2+1,0,b,g);a.drawLine(c,0,

b-1,d,b-1,e);g=[d/2,d/5-1,d-d/5+1];e=[b/8+1,b/8+1+b/4,b/8+1+b/4];var h=0<this.evaluator.evalExpression(this.activeif);f(c,g,e,h?"#2244cc":"#8888aa");e=[b-b/8,b-b/8-b/4,b-b/8-b/4];f(c,g,e,h?"#d00018":"#aa8888");c.fillStyle="rgba(0,0,0,"+24/255+")";this.up&&c.fillRect(0,0,d,b/2);this.down&&c.fillRect(0,b/2,d,b)};a.Spinner.prototype.validateValue=function(a){var d=this.evaluator;(a=parseFloat(d.evalExpression(d.parser.parse(a.toString().replace(this.parent.decimal_symbol,".")))))||(a=0);a<d.evalExpression(this.min)&&

(a=d.evalExpression(this.min));a>d.evalExpression(this.max)&&(a=d.evalExpression(this.max));if(this.discrete)var b=d.evalExpression(this.incr),a=0==b?0:b*Math.round(a/b);return a=parseFloat(parseFloat(a).toFixed(d.evalExpression(this.decimals)))};a.Spinner.prototype.formatOutputValue=function(a){var d=a+"",b=this.evaluator.evalExpression(this.decimals),f=d.indexOf(".");-1!=f&&d.substring(f+1).length>b&&(d=parseFloat(d).toFixed(b));if(this.fixed&&(2!=this.parent.version||2==this.parent.version&&!this.exponentialif))d=

parseFloat(a).toFixed(b);this.exponentialif&&0!=parseFloat(d)&&(d=this.fixed&&2!=this.parent.version?parseFloat(d).toExponential(b):parseFloat(d).toExponential(),d=d.toUpperCase(),d=d.replace("+",""));return d=d.replace(".",this.parent.decimal_symbol)};a.Spinner.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.evalExpression(this.incr))};a.Spinner.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.evalExpression(this.incr))};a.Spinner.prototype.changeValue=

function(a){0<this.evaluator.evalExpression(this.activeif)&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.parent.updateControls(),"init"==this.action&&(this.click=!1),this.actionExec.execute(),this.parent.updateControls(),"animate"!=this.action&&this.parent.update())};a.Spinner.prototype.registerMouseEvents=function(){function c(a,b,d){k.up||k.down?(b.call(k),a=d?a:30,n=setTimeout(function(){c(a,b)},a)):clearInterval(n)}

function d(a){a.preventDefault();k.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":"RIGHT";"LEFT"==k.whichButton&&0<k.evaluator.evalExpression(k.activeif)&&(k.up=!0,c(l,k.increase,!0),k.draw())}function b(a){a.preventDefault();k.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":"RIGHT";"LEFT"==k.whichButton&&0<k.evaluator.evalExpression(k.activeif)&&(k.down=!0,c(l,k.decrease,!0),

k.draw())}function f(a){k.up=!1;clearInterval(n);k.draw();a.preventDefault()}function e(a){k.down=!1;clearInterval(n);k.draw();a.preventDefault()}function h(a){k.up=!1;clearInterval(n);k.draw();a.preventDefault()}function i(a){k.down=!1;clearInterval(n);k.draw();a.preventDefault()}var j=a.hasTouchSupport;this.divUp.oncontextmenu=function(){return!1};this.divDown.oncontextmenu=function(){return!1};var k=this,l=j?500:200,n;this.field.addEventListener("keydown",function(a){13==a.keyCode&&k.changeValue(k.field.value)},

!1);j?this.divUp.addEventListener("touchstart",d,!1):this.divUp.addEventListener("mousedown",d,!1);j?this.divDown.addEventListener("touchstart",b,!1):this.divDown.addEventListener("mousedown",b,!1);j||this.divUp.addEventListener("mouseout",f,!1);j||this.divDown.addEventListener("mouseout",e,!1);j?(this.divUp.addEventListener("touchend",h,!1),window.addEventListener("touchend",h,!1)):(this.divUp.addEventListener("mouseup",h,!1),window.addEventListener("mouseup",h,!1));j?(this.divDown.addEventListener("touchend",

i,!1),window.addEventListener("touchend",i,!1)):(this.divDown.addEventListener("mouseup",i,!1),window.addEventListener("mouseup",i,!1))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.TextField=function(f,c){a.Control.call(this,f,c);void 0===this.valueExprString&&(this.valueExprString="");this.emptyString=!1;this.ok=0;this.tabindex=++this.parent.tabindex;if(this.answer)if(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answerPattern=

this.answer,this.onlyText){this.answer=a.buildRegularExpresionsPatterns(this.answer);var d=this.answerPattern.indexOf("|");this.firstAnswer=-1==d?this.answerPattern:this.answerPattern.substring(0,d)}else this.buildRangeExpresions(),this.firstAnswer=this.parser.parse(this.answerPattern.substring(1,this.answerPattern.indexOf(",")));if(this.onlyText){if(!this.valueExprString.match(/^'/)||!this.valueExprString.match(/^'/))this.valueExpr=this.evaluator.parser.parse("'"+this.valueExprString+"'");this.validateValue=

function(a){return a=="''"||a=="'"?"":a};this.formatOutputValue=function(a){return a.toString()};this.evaluateAnswer=this.evaluateTextualAnswer}d=this.getContainer();""==this.name.trim()&&(this.name="");this.containerControl=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.txtLabel=document.createTextNode(this.name);this.label.appendChild(this.txtLabel);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.field);

d.childNodes[0]?d.insertBefore(this.containerControl,d.childNodes[0]):d.appendChild(this.containerControl);this.init();this.registerMouseEvents();this.draw()};a.extend(a.TextField,a.Control);a.TextField.prototype.init=function(){evaluator=this.evaluator;this.value=evaluator.evalExpression(this.valueExpr);this.value=this.validateValue(this.value);var f=this.formatOutputValue(this.value);this.fieldFontSize=Math.floor(this.h-0.25*this.h);var c=this.w/2,d=a.getTextWidth(f+"0",this.fieldFontSize+"px Arial"),

b=a.getTextWidth(this.name,this.fieldFontSize+"px Arial");c<b&&(c=b);""==this.name&&(c=0);this.w-c<d&&(c=this.w-d);0>c&&(c=0);d=this.w-c;this.containerControl.setAttribute("class","DescartesTextFieldContainer");this.containerControl.setAttribute("style","width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.containerControl.style.display=0<evaluator.evalExpression(this.drawif)?"block":"none";this.field.setAttribute("type","text");this.field.setAttribute("id",

this.id+"TextField");this.field.value=f;this.field.setAttribute("class","DescartesTextFieldField");this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width : "+d+"px; height : "+(this.h-2)+"px; left: "+c+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.disabled=0<evaluator.evalExpression(this.activeif)?!1:!0;this.label.setAttribute("class","DescartesTextFieldLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+c+"px; height: "+

this.h+"px;");evaluator.setVariable(this.id,this.value);this.oldValue=this.value};a.TextField.prototype.update=function(){evaluator=this.evaluator;var a=!1,c=!1,d=!1,b=!1;this.field.disabled=0<evaluator.evalExpression(this.activeif)?!1:!0;0<evaluator.evalExpression(this.drawif)?(this.containerControl.style.display="block",this.draw()):this.containerControl.style.display="none";var g=evaluator.evalExpression(this.expresion),a=this.x!=g[0][0],c=this.y!=g[0][1];this.x=g[0][0];this.y=g[0][1];4==g[0].length&&

(d=this.w!=g[0][2],b=this.h!=g[0][3],this.w=g[0][2],this.h=g[0][3]);(d||b||a||c)&&this.init();a=this.field.value;c=this.value;this.value=this.validateValue(evaluator.getVariable(this.id));this.field.value=this.formatOutputValue(this.value);this.value===c&&this.field.value!=a&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value));evaluator.setVariable(this.id,this.value)};a.TextField.prototype.validateValue=function(a){if(""===a||"''"==a)return"";var c=this.evaluator;

(a=parseFloat(c.evalExpression(c.parser.parse(a.toString().replace(this.parent.decimal_symbol,".")))))||(a=0);a<c.evalExpression(this.min)&&(a=c.evalExpression(this.min));a>c.evalExpression(this.max)&&(a=c.evalExpression(this.max));if(this.discrete)var d=c.evalExpression(this.incr),a=0==d?0:d*Math.round(a/d);return a=parseFloat(parseFloat(a).toFixed(c.evalExpression(this.decimals)))};a.TextField.prototype.formatOutputValue=function(a){if(""===a)return"";var c=a+"",d=this.evaluator.evalExpression(this.decimals),

b=c.indexOf(".");-1!=b&&c.substring(b+1).length>d&&(c=parseFloat(c).toFixed(d));this.fixed&&(c=parseFloat(a).toFixed(d));this.exponentialif&&(c=c.toExponential(d),c=c.toUpperCase(),c=c.replace("+",""));return c=c.replace(".",this.parent.decimal_symbol)};a.TextField.prototype.changeValue=function(a){0<this.evaluator.evalExpression(this.activeif)&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,

this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.parent.updateControls(),"init"==this.action&&(this.click=!1),this.actionExec.execute(),this.parent.updateControls(),"animate"!=this.action&&this.parent.update())};a.TextField.prototype.evaluateAnswer=function(){var a=this.evaluator;parseFloat(this.value);for(var c,d,b,g,e,h,i,j=0,k=this.answer.length;j<k;j++)if(g=this.answer[j][0],h=this.answer[j][1],c=a.evalExpression(g.expression),d=a.evalExpression(h.expression),b="("==g.type,g=

"["==g.type,e=")"==h.type,h="]"==h.type,i=this.value,b&&e&&i>c&&i<d||b&&h&&i>c&&i<=d||g&&e&&i>=c&&i<d||g&&h&&i>=c&&i<=d)return 1;return 0};a.TextField.prototype.buildRangeExpresions=function(){var a;this.answer=this.answer.split("|");for(var c=0,d=this.answer.length;c<d;c++)this.answer[c]=this.answer[c].trim(),this.answer[c]=this.answer[c].split(","),a=this.answer[c][0].trim(),this.answer[c][0]={type:a[0],expression:this.evaluator.parser.parse(a.substring(1))},a=this.answer[c][1].trim(),this.answer[c][1]=

{type:a[a.length-1],expression:this.evaluator.parser.parse(a.substring(0,a.length-1))}};a.TextField.prototype.evaluateTextualAnswer=function(){for(var f=this.value,c,d,b,g=0,e=this.answer.length;g<e;g++){d=this.answer[g];b=!0;for(var h=0,i=d.length;h<i;h++)c=d[h],c.ignoreAcents&&(f=a.replaceAcents(f),c.regExp=a.replaceAcents(c.regExp)),c.ignoreCaps&&(f=f.toLowerCase(),c.regExp=c.regExp.toLowerCase()),b=b&&!!f.match(c.regExp);if(b)return 1}return 0};a.TextField.prototype.getFirstAnswer=function(){return this.answer?

this.onlyText?this.firstAnswer:this.evaluator.evalExpression(this.firstAnswer):""};a.TextField.prototype.registerMouseEvents=function(){var a=this;this.field.addEventListener("blur",function(){a.update()},!1);this.field.addEventListener("keydown",function(c){0<a.evaluator.evalExpression(a.activeif)&&13==c.keyCode&&a.changeValue(a.field.value,!0)},!1)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Menu=function(f,c){a.Control.call(this,f,c);var d=this.parser;this.options=

this.options?this.options.split(","):[];this.menuOptions=[];this.strValue=[];for(var b,g=0,e=this.options.length;g<e;g++)b=this.options[g].split(/[\[\]]/,2),1==b.length?(this.menuOptions.push(b[0]),this.strValue.push(g.toString())):2==b.length&&(this.menuOptions.push(b[0]),""==b[1]?this.strValue.push(g.toString()):this.strValue.push(b[1]));g=0;for(e=this.strValue.length;g<e;g++)this.strValue[g]=d.parse(this.strValue[g]);d=this.getContainer();this.containerControl=document.createElement("div");this.label=

document.createElement("label");this.txtLabel=document.createTextNode(this.name);this.label.appendChild(this.txtLabel);this.select=document.createElement("select");g=0;for(e=this.menuOptions.length;g<e;g++)b=document.createElement("option"),b.innerHTML=this.menuOptions[g],this.select.appendChild(b);this.field=document.createElement("input");this.init();this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.select);this.visible&&this.containerControl.appendChild(this.field);

d.childNodes[0]?d.insertBefore(this.containerControl,d.childNodes[0]):d.appendChild(this.containerControl);this.registerMouseEvents()};a.extend(a.Menu,a.Control);a.Menu.prototype.init=function(){var f=this.evaluator;this.fieldFontSize=Math.floor(this.h-3-0.25*(this.h-3));var c=0,d=0,b=0;this.value=f.evalExpression(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var g=0,e=this.menuOptions.length;g<e;g++)b=a.getTextWidth(this.menuOptions[g],this.fieldFontSize+"px Arial"),b>c&&(c=b,d=g);

c+=25;b=a.getTextWidth(this.formatOutputValue(f.evalExpression(this.strValue[d])),this.fieldFontSize+"px Arial")+7;d=a.getTextWidth(this.name,this.fieldFontSize+"px Arial")+10;""==this.name&&(d=0);this.visible||(b=0);for(g=this.w-b-d;g<c&&0<d;)d--,g++;for(;g<c&&0<b;)b--,g++;for(;d+g+b+1<this.w;)g++,b++;var c=d,e=c+g,b=this.w-e,h=this.formatOutputValue(f.evalExpression(this.strValue[this.indexValue]));this.containerControl.setAttribute("class","DescartesSpinnerContainer");this.containerControl.setAttribute("style",

"width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.containerControl.style.display=0<f.evalExpression(this.drawif)?"block":"none";this.label.setAttribute("class","DescartesMenuLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+d+"px; height: "+this.h+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",this.id+"menu");this.field.value=h;this.field.setAttribute("class","DescartesMenuField");

this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width : "+b+"px; height : "+(this.h-2)+"px; left: "+e+"px;");this.field.disabled=0<f.evalExpression(this.activeif)?!1:!0;this.select.setAttribute("id",this.id+"menuSelect");this.select.setAttribute("class","DescartesMenuSelect");this.select.setAttribute("style","text-align: left; font-size: "+this.fieldFontSize+"px; width : "+g+"px; height : "+this.h+"px; left: "+c+"px; border-color: #7a8a99; border-width: 1.5px; border-style: solid; background-color: #eeeeee;");

this.select.selectedIndex=this.indexValue;this.select.disabled=0<f.evalExpression(this.activeif)?!1:!0;f.setVariable(this.id,parseFloat(h))};a.Menu.prototype.update=function(){var a=this.evaluator,c=!1,d=!1,b=!1,g=!1,c=0<a.evalExpression(this.activeif);this.field.disabled=c?!1:!0;this.select.disabled=c?!1:!0;0<a.evalExpression(this.drawif)?(this.containerControl.style.display="block",this.draw()):(this.click=!1,this.containerControl.style.display="none");var e=a.evalExpression(this.expresion),c=this.x!=

e[0][0],d=this.y!=e[0][1];this.x=e[0][0];this.y=e[0][1];4==e[0].length&&(b=this.w!=e[0][2],g=this.h!=e[0][3],this.w=e[0][2],this.h=e[0][3]);if(b||g||c||d)this.init(),this.draw();this.value=a.getVariable(this.id);this.field.value=this.formatOutputValue(this.value);a.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))};a.Menu.prototype.getIndex=function(a){for(var a=parseFloat(a.toString().replace(this.parent.decimal_symbol,".")),c=-1,d=Infinity,

b,g=0,e=this.strValue.length;g<e;g++)b=Math.abs(a-parseFloat(this.evaluator.evalExpression(this.strValue[g]))),b<=d&&(d=b,c=g);return c};a.Menu.prototype.formatOutputValue=function(a){var c=a+"",d=this.evaluator.evalExpression(this.decimals),b=c.indexOf(".");-1!=b&&c.substring(b+1).length>d&&(c=parseFloat(c).toFixed(d));this.fixed&&(c=parseFloat(a).toFixed(d));this.exponentialif&&(c=c.toExponential(d),c=c.toUpperCase(),c=c.replace("+",""));return c=c.replace(".",this.parent.decimal_symbol)};a.Menu.prototype.changeValue=

function(){0<this.evaluator.evalExpression(this.activeif)&&(this.evaluator.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.updateControls(),"animate"!=this.action&&this.parent.update())};a.Menu.prototype.registerMouseEvents=function(){var a=this;this.select.oncontextmenu=function(){return!1};this.select.addEventListener("change",function(c){a.value=a.evaluator.evalExpression(a.strValue[this.selectedIndex]);a.field.value=a.formatOutputValue(a.value);

a.evaluator.setVariable(a.id,a.field.value);a.changeValue();c.preventDefault()},!1);this.field.addEventListener("keydown",function(c){13==c.keyCode&&(a.indexValue=a.getIndex(a.field.value),a.value=a.evaluator.evalExpression(a.strValue[a.indexValue]),a.field.value=a.formatOutputValue(a.indexValue),a.select.selectedIndex=a.indexValue,a.changeValue())},!1)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor;a.Scrollbar=function(c,d){a.Control.call(this,c,d);this.orientation=

this.w>=this.h?"horizontal":"vertical";var b=this.getContainer();this.containerControl=document.createElement("div");this.canvas=document.createElement("canvas");this.divUp=document.createElement("div");this.divDown=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.scrollManipulator=document.createElement("div");this.txtLabel=document.createTextNode(this.name);this.label.appendChild(this.txtLabel);this.containerControl.appendChild(this.label);

this.containerControl.appendChild(this.canvas);this.containerControl.appendChild(this.divUp);this.containerControl.appendChild(this.divDown);this.containerControl.appendChild(this.field);this.containerControl.appendChild(this.scrollManipulator);b.childNodes[0]?b.insertBefore(this.containerControl,b.childNodes[0]):b.appendChild(this.containerControl);this.init();this.registerMouseEvents();this.draw()};a.extend(a.Scrollbar,a.Control);a.Scrollbar.prototype.init=function(){var a=this.evaluator;this.incr=

0==a.evalExpression(this.decimals)?1:(a.evalExpression(this.max)-a.evalExpression(this.min))/100;this.value=this.validateValue(a.evalExpression(this.valueExpr));var d=this.formatOutputValue(this.value),b=this.evaluator.evalExpression(this.expresion);this.x=b[0][0];this.y=b[0][1];4==b[0].length&&(this.w=b[0][2],this.h=b[0][3]);this.orientation=this.w>=this.h?"horizontal":"vertical";"vertical"==this.orientation?this.initVertical(d):this.initHorizontal(d);a.setVariable(this.id,this.value);a=this.value;

this.value=null;this.changeValue(a);this.prePos=this.pos;this.draw()};a.Scrollbar.prototype.initVertical=function(c){this.fieldFontSize=f(this.w-0.25*this.w);this.fieldFontSize=17.25;a.getTextWidth(c+"0",this.fieldFontSize+"px Arial");var d=this.parent.getSpaceById(this.spaceID).h;this.labelHeight=""==this.name?0:23;var b=""==this.visible?0:23;this.canvasHeight=this.h-this.labelHeight-b;18<=this.canvasHeight+this.y-d&&(this.canvasHeight=d);d=b+this.canvasHeight;this.upHeight=this.downHeight=15;this.scrollManipulatorHeight=

parseInt((this.canvasHeight-this.upHeight-this.downHeight-this.labelHeight)/10);this.scrollManipulatorHeight=15>this.scrollManipulatorHeight?15:this.scrollManipulatorHeight;this.scrollManipulatorLimInf=d-this.downHeight-this.scrollManipulatorHeight;this.scrollManipulatorLimSup=b+this.downHeight;this.containerControl.setAttribute("class","DescartesScrollbarContainer");this.containerControl.setAttribute("style","width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+

this.zIndex+";");this.containerControl.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none";this.canvas.setAttribute("width",this.w+"px");this.canvas.setAttribute("height",this.canvasHeight+"px");this.canvas.setAttribute("style","position: absolute; left: 0px; top: "+b+"px;");this.ctx=this.canvas.getContext("2d");this.divDown.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+this.w+"px; height : "+this.upHeight+"px; left: 0px; top: "+

(d-this.downHeight)+"px;");this.divUp.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+this.w+"px; height : "+this.downHeight+"px; left: 0px; top: 0px;");this.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+this.w+"px; height : "+this.scrollManipulatorHeight+"px; left: 0px; top: "+this.scrollManipulatorLimInf+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",

this.id+"scrollbar");this.field.value=c;this.field.setAttribute("class","DescartesScrollbarField");this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width : "+this.w+"px; height : "+b+"px; left: 0px; top: 0px;");this.field.disabled=0<this.evaluator.evalExpression(this.activeif)?!1:!0;this.label.setAttribute("class","DescartesScrollbarLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+this.w+"px; height: "+this.labelHeight+"px; left: 0px; top: "+

d+"px;");this.txtLabel=document.createTextNode(this.name)};a.Scrollbar.prototype.initHorizontal=function(c){this.fieldFontSize=f(this.h-0.25*this.h);var d=a.getTextWidth(c+"0",this.fieldFontSize+"px Arial");this.labelWidth=a.getTextWidth(this.name,this.fieldFontSize+"px Arial");""==this.name&&(this.labelWidth=0);this.visible||(d=0);for(var b=this.w-d-this.labelWidth;58>b&&0<this.labelWidth;)this.labelWidth--,b++;for(;58>b&&0<d;)d--,b++;var g=this.labelWidth,e=g+b,d=this.w-e;this.canvasWidth=b;this.upWidth=

this.downWidth=15;this.scrollManipulatorWidth=parseInt((this.canvasWidth-this.upWidth-this.downWidth)/10);this.scrollManipulatorWidth=15>this.scrollManipulatorWidth?15:this.scrollManipulatorWidth;this.scrollManipulatorLimInf=g+this.downWidth;this.scrollManipulatorLimSup=g+this.canvasWidth-this.downWidth-this.scrollManipulatorWidth;this.containerControl.setAttribute("class","DescartesScrollbarContainer");this.containerControl.setAttribute("style","width: "+this.w+"px; height: "+this.h+"px; left: "+

this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.containerControl.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none";this.canvas.setAttribute("width",this.canvasWidth+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","position: absolute; left: "+g+"px; top: 0px;");this.ctx=this.canvas.getContext("2d");this.divUp.setAttribute("style","cursor: pointer; position: absolute; width : "+this.upWidth+"px; height : "+this.h+"px; left: "+

(e-this.downWidth)+"px; top: 0px;");this.divDown.setAttribute("style","cursor: pointer; position: absolute; width : "+this.downWidth+"px; height : "+this.h+"px; left: "+this.labelWidth+"px; top: 0px;");this.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+this.scrollManipulatorWidth+"px; height : "+this.h+"px; left: "+this.scrollManipulatorLimInf+"px; top: 0px;");this.field.setAttribute("type","text");this.field.setAttribute("id",

this.id+"scrollbar");this.field.value=c;this.field.setAttribute("class","DescartesScrollbarField");this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width : "+d+"px; height : "+(this.h-2)+"px; left: "+(this.canvasWidth+this.labelWidth)+"px;");this.field.disabled=0<this.evaluator.evalExpression(this.activeif)?!1:!0;this.label.setAttribute("class","DescartesScrollbarLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+this.labelWidth+"px; height: "+

this.h+"px;");this.txtLabel=document.createTextNode(this.name)};a.Scrollbar.prototype.update=function(){var a=this.evaluator,d=!1,b=!1,f=!1,e=!1;this.incr=0==a.evalExpression(this.decimals)?1:(a.evalExpression(this.max)-a.evalExpression(this.min))/100;this.field.disabled=0<a.evalExpression(this.activeif)?!1:!0;0<a.evalExpression(this.drawif)?(this.containerControl.style.display="block",this.draw()):this.containerControl.style.display="none";var h=a.evalExpression(this.expresion),d=this.x!=h[0][0],

b=this.y!=h[0][1];this.x=h[0][0];this.y=h[0][1];4==h[0].length&&(f=this.w!=h[0][2],e=this.h!=h[0][3],this.w=h[0][2],this.h=h[0][3]);this.value=this.validateValue(a.getVariable(this.id));this.field.value=this.formatOutputValue(this.value);if(f||e||d||b)this.init(),this.draw();a.setVariable(this.id,this.value);this.draw()};a.Scrollbar.prototype.createGradient=function(a,d){this.linearGradient=this.ctx.createLinearGradient(0,0,0,d);for(var b=d*d,g,e=0;e<d;e++)g=f(e-40*d/100),this.linearGradient.addColorStop(e/

d,"rgba(0,0,0,"+192*g*g/b/255+")")};a.Scrollbar.prototype.draw=function(){var a=this.ctx;if("horizontal"==this.orientation){var d=f(this.h),b=f(this.upWidth),g=f(this.canvasWidth-this.upWidth);a.clearRect(0,0,this.canvasWidth,this.h);a.strokeStyle="#7a8a99";a.strokeRect(0,0,b+0.5,d);a.strokeRect(g+0.5,0,b,d);var e=4;a.fillStyle=this.up?"black":"#333333";a.beginPath();a.moveTo(e,d/2);a.lineTo(b-e,d/2-7);a.lineTo(b-e,d/2+7);a.closePath();a.moveTo(g+1+b-e,d/2);a.lineTo(g+1+e,d/2-7);a.lineTo(g+1+e,d/

2+7);a.closePath();a.fill();a.strokeRect(0,0.5,this.canvasWidth+0.5,d-1);e=f(this.pos-this.labelWidth);a.fillStyle="#ccdcec";a.fillRect(e+0.5,0,f(this.scrollManipulatorWidth),d);a.strokeStyle="#6382bf";a.strokeRect(e+0.5,0,f(this.scrollManipulatorWidth),d);b=f(this.scrollManipulatorWidth/2);a.beginPath();a.moveTo(e+b+0.5-2,3);a.lineTo(e+b+0.5-2,d-3);a.moveTo(e+b+0.5,3);a.lineTo(e+b+0.5,d-3);a.moveTo(e+b+0.5+2,3);a.lineTo(e+b+0.5+2,d-3)}else d=f(this.w),b=f(this.upHeight),g=f(this.canvasHeight-this.upHeight),

a.clearRect(0,0,this.w,this.canvasHeight),a.strokeStyle="#7a8a99",a.strokeRect(0.5,2.5,d-0.5,b),a.strokeRect(0.5,g-0.5,d-0.5,b),e=4,a.fillStyle=this.down?"black":"#333333",a.beginPath(),a.moveTo(d/2,e+2),a.lineTo(d/2-7,b-e+2),a.lineTo(d/2+7,b-e+2),a.closePath(),a.moveTo(d/2,g+b-e),a.lineTo(d/2-7,g+e),a.lineTo(d/2+7,g+e),a.closePath(),a.fill(),a.strokeRect(0.5,1.5,d-0.5,this.canvasHeight-1.5),e=f(this.pos),a.fillStyle="#ccdcec",a.fillRect(0,e+0.5,this.w,f(this.scrollManipulatorHeight)),a.strokeStyle=

"#6382bf",a.strokeRect(0,e+0.5,this.w,f(this.scrollManipulatorHeight)),b=f(this.scrollManipulatorHeight/2),a.beginPath(),a.moveTo(3,e+b+0.5-2),a.lineTo(d-3,e+b+0.5-2),a.moveTo(3,e+b+0.5),a.lineTo(d-3,e+b+0.5),a.moveTo(3,e+b+0.5+2),a.lineTo(d-3,e+b+0.5+2);a.stroke()};a.Scrollbar.prototype.validateValue=function(a){var d=this.evaluator,a=a.toString();(a=parseFloat(a.replace(this.parent.decimal_symbol,".")))||(a=0);this.minimo=d.evalExpression(this.min);a<this.minimo&&(this.value=null,a=this.minimo);

this.maximo=d.evalExpression(this.max);a>this.maximo&&(this.value=null,a=this.maximo);var b=this.incr,a=0!=b?a*b/b:0;this.fixed&&(a=parseFloat(parseFloat(a).toFixed(d.evalExpression(this.decimals))));return a};a.Scrollbar.prototype.formatOutputValue=function(a){var d=a+"",b=this.evaluator.evalExpression(this.decimals),f=d.indexOf(".");-1!=f&&d.substring(f+1).length>b&&(d=parseFloat(d).toFixed(b));this.fixed&&(d=parseFloat(a).toFixed(b));this.exponentialif&&(d=d.toExponential(b),d=d.toUpperCase(),

d=d.replace("+",""));return d=d.replace(".",this.parent.decimal_symbol)};a.Scrollbar.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};a.Scrollbar.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};a.Scrollbar.prototype.increase10=function(){var a=(this.evaluator.evalExpression(this.max)-this.evaluator.evalExpression(this.min))/10;"horizontal"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+a):this.clickPos.y<

this.prePos&&this.changeValue(parseFloat(this.value)+a)};a.Scrollbar.prototype.decrease10=function(){var a=(this.evaluator.evalExpression(this.max)-this.evaluator.evalExpression(this.min))/10;"horizontal"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-a):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-a)};a.Scrollbar.prototype.changeValue=function(a){0<this.evaluator.evalExpression(this.activeif)&&(a=this.validateValue(a),a!=this.value&&

(this.value=a,this.field.value=this.formatOutputValue(a),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.updateControls(),"animate"!=this.action&&this.parent.update()))};a.Scrollbar.prototype.changeValueForScrollMovement=function(){var a=this.evaluator,d=this.scrollManipulatorLimInf,b=this.scrollManipulatorLimSup,g=a.evalExpression(this.min),e=a.evalExpression(this.max),h=this.incr,

d=f((this.pos-d)*(e-g)/(b-d)/h)*h+g;d!=this.value&&(this.value=d,this.field.value=this.formatOutputValue(d),a.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};a.Scrollbar.prototype.changeScrollPositionFromValue=function(){var a=this.evaluator,d=this.scrollManipulatorLimInf,b=this.scrollManipulatorLimSup,f=a.evalExpression(this.min),a=a.evalExpression(this.max);this.pos=(this.value-f)*(b-d)/(a-f)+d;"horizontal"==this.orientation?this.scrollManipulator.setAttribute("style",

"background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+this.scrollManipulatorWidth+"px; height : "+this.h+"px; left: "+this.pos+"px; top: 0px;"):this.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+this.w+"px; height : "+this.scrollManipulatorHeight+"px; left: 0px; top: "+this.pos+"px;")};a.Scrollbar.prototype.registerMouseEvents=function(){function c(a,b,d,f){(m.up||m.down||m.canvasClick)&&

1.0E-7<Math.abs(m.value-f)?(b.call(m),a=d?a:30,u=setTimeout(function(){c(a,b,!1,f)},a)):clearInterval(u)}function d(a){a.preventDefault();m.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":"RIGHT";"LEFT"==m.whichButton&&0<m.evaluator.evalExpression(m.activeif)&&(m.clickPos=m.getCursorPosition(a),m.canvasClick=!0,"horizontal"==m.orientation?m.clickPos.x<m.prePos?c(v,m.decrease10,!0,m.minimo):c(v,m.increase10,!0,m.maximo):m.clickPos.y<m.prePos?

c(v,m.increase10,!0,m.maximo):c(v,m.decrease10,!0,m.minimo))}function b(a){m.canvasClick=!1;clearInterval(u);a.preventDefault()}function f(a){!0==m.canvasClick&&(m.clickPos=m.getCursorPosition(a),a.preventDefault())}function e(a){0<m.evaluator.evalExpression(m.activeif)&&(m.scrollClick=!0,m.initPos=m.getCursorPosition(a),window.addEventListener("mouseup",i,!1),window.addEventListener("mousemove",k,!1),a.preventDefault())}function h(a){0<m.evaluator.evalExpression(m.activeif)&&(m.scrollClick=!0,m.initPos=

m.getCursorPosition(a),window.addEventListener("touchend",j,!1),window.addEventListener("touchmove",onToucheMove_scrollManipulator,!1),a.preventDefault())}function i(a){m.scrollClick=!1;m.prePos=m.pos;window.removeEventListener("mouseup",i,!1);window.removeEventListener("mousemove",k,!1);a.preventDefault()}function j(a){m.scrollClick=!1;m.prePos=m.pos;window.removeEventListener("touchend",j,!1);window.removeEventListener("touchmove",k,!1);a.preventDefault()}function k(a){var b=m.getCursorPosition(a);

"horizontal"==m.orientation?(m.pos=m.prePos-(m.initPos.x-b.x),m.pos<m.scrollManipulatorLimInf&&(m.pos=m.scrollManipulatorLimInf),m.pos>m.scrollManipulatorLimSup&&(m.pos=m.scrollManipulatorLimSup),m.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+m.scrollManipulatorWidth+"px; height : "+m.h+"px; left: "+m.pos+"px; top: 0px;")):(m.pos=m.prePos-(m.initPos.y-b.y),m.pos>m.scrollManipulatorLimInf&&(m.pos=m.scrollManipulatorLimInf),

m.pos<m.scrollManipulatorLimSup&&(m.pos=m.scrollManipulatorLimSup),m.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+m.w+"px; height : "+m.scrollManipulatorHeight+"px; left: 0px; top: "+m.pos+"px;"));m.changeValueForScrollMovement();a.preventDefault()}function l(a){a.preventDefault();m.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":"RIGHT";"LEFT"==m.whichButton&&

0<m.evaluator.evalExpression(m.activeif)&&(m.up=!0,c(v,m.increase,!0,m.maximo))}function n(a){a.preventDefault();m.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":"RIGHT";"LEFT"==m.whichButton&&0<m.evaluator.evalExpression(m.activeif)&&(m.down=!0,c(v,m.decrease,!0,m.minimo))}function r(a){m.up=!1;clearInterval(u);a.preventDefault()}function o(a){m.down=!1;clearInterval(u);a.preventDefault()}function p(a){m.up=!1;clearInterval(u);a.preventDefault()}

function q(a){m.down=!1;clearInterval(u);a.preventDefault()}var m=this,t=a.hasTouchSupport,v=t?500:200,u;this.canvas.oncontextmenu=function(){return!1};this.divUp.oncontextmenu=function(){return!1};this.divDown.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&m.changeValue(m.field.value)},!1);t?this.canvas.addEventListener("touchstart",d,!1):this.canvas.addEventListener("mousedown",d,!1);t||this.divDown.addEventListener("mouseout",o,!1);t?window.addEventListener("touchend",

b,!1):window.addEventListener("mouseup",b,!1);t?this.canvas.addEventListener("touchmove",f,!1):this.canvas.addEventListener("mousemove",f,!1);t?this.scrollManipulator.addEventListener("touchstart",h,!1):this.scrollManipulator.addEventListener("mousedown",e,!1);t?this.divUp.addEventListener("touchstart",l,!1):this.divUp.addEventListener("mousedown",l,!1);t?this.divDown.addEventListener("touchstart",n,!1):this.divDown.addEventListener("mousedown",n,!1);t||this.divUp.addEventListener("mouseout",r,!1);

t||this.divDown.addEventListener("mouseout",o,!1);t?window.addEventListener("touchend",p,!1):window.addEventListener("mouseup",p,!1);t?window.addEventListener("touchend",q,!1):window.addEventListener("mouseup",q,!1)};a.Scrollbar.prototype.getCursorPosition=function(c){c=a.getCursorPosition(c);return{x:c.x-(this.containerControl.offsetLeft+this.containerControl.parentNode.offsetLeft+this.containerControl.parentNode.parentNode.offsetLeft),y:c.y-(this.containerControl.offsetTop+this.containerControl.parentNode.offsetTop+

this.containerControl.parentNode.parentNode.offsetTop)}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Audio=function(f,c){a.Control.call(this,f,c);var d=this.getContainer(),b=this.evaluator.evalExpression(this.expresion);4==b[0].length?(this.w=b[0][2],this.h=b[0][3]):(this.w=100,this.h=28);if(b=navigator.userAgent.toLowerCase().match("firefox")&&!0)this.audioContainer=document.createElement("div"),this.audioContainer.setAttribute("style","overflow: hidden; position: absolute; width: "+

this.w+"px; height: 35px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.audio=this.parent.getAudio(this.file);this.autoplay&&(this.audio.setAttribute("autoplay","autoplay"),this.audio.play());this.loop&&this.audio.setAttribute("loop","loop");this.audio.setAttribute("controls","controls");b?(this.audio.setAttribute("style","position: absolute; width: "+this.w+"px; height: 100px; left: 0px; top: -65px;"),this.audioContainer.appendChild(this.audio)):this.audio.setAttribute("style",

"position: absolute; width: "+this.w+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");d.childNodes[0]?b?d.insertBefore(this.audioContainer,d.childNodes[0]):d.insertBefore(this.audio,d.childNodes[0]):b?d.appendChild(this.audioContainer):d.appendChild(this.audio)};a.extend(a.Audio,a.Control);a.Audio.prototype.update=function(){var a=this.evaluator;0<a.evalExpression(this.drawif)?this.audio.style.display="block":(this.audio.style.display="none",this.audio.pause());a=a.evalExpression(this.expresion);

this.x=a[0][0];this.y=a[0][1];4==a[0].length&&(this.w=a[0][2],this.h=a[0][3])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Video=function(f,c){a.Control.call(this,f,c);var d=this.evaluator,b=this.getContainer(),g=this.evaluator.evalExpression(this.expresion);4==g[0].length?(this.w=g[0][2],this.h=g[0][3]):this.h=this.w=null;this.video=document.createElement("video");0<d.evalExpression(this.drawif)?this.video.style.display="block":(this.video.style.display="none",this.video.pause());

this.autoplay&&this.video.setAttribute("autoplay","autoplay");this.loop&&this.video.setAttribute("loop","loop");this.video.setAttribute("controls","controls");this.poster&&this.video.setAttribute("poster",this.poster);this.w&&(this.video.setAttribute("width",this.w),this.video.setAttribute("height",this.h));this.video.setAttribute("style","position: absolute; overflow: hidden; left: "+this.x+"px; top: "+this.y+"px;");d=this.file;g=this.file.lastIndexOf(".");-1!=g&&(d=this.file.substring(0,g));g=document.createElement("source");

g.setAttribute("src",d+".ogg");g.setAttribute("type","video/ogg");this.video.appendChild(g);g=document.createElement("source");g.setAttribute("src",d+".mp4");g.setAttribute("type","video/mp4");this.video.appendChild(g);g=document.createElement("source");g.setAttribute("src",d+".webm");g.setAttribute("type","video/webm");this.video.appendChild(g);b.childNodes[0]?b.insertBefore(this.video,b.childNodes[0]):b.appendChild(this.video)};a.extend(a.Video,a.Control);a.Video.prototype.update=function(){var a=

this.evaluator;0<a.evalExpression(this.drawif)?this.video.style.display="block":(this.video.style.display="none",this.video.pause());a=a.evalExpression(this.expresion);this.x=a[0][0];this.y=a[0][1];4==a[0].length&&(this.w=a[0][2],this.h=a[0][3])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor;a.TextArea=function(c,d){a.Control.call(this,c,d);this.region="interior";this.tabindex=++this.parent.tabindex;this.answer&&this.answer.match("krypto_")&&(this.answer=

(new a.Krypto).decode(this.answer.substring(7)));var b=this.getContainer();this.containerControl=document.createElement("div");this.textArea=document.createElement("div");this.textAreaAnswer=document.createElement("div");this.showButton=document.createElement("div");this.activeCover=document.createElement("div");this.containerControl.appendChild(this.textArea);this.containerControl.appendChild(this.textAreaAnswer);this.containerControl.appendChild(this.showButton);this.containerControl.appendChild(this.activeCover);

b.childNodes[0]?b.insertBefore(this.containerControl,b.childNodes[0]):b.appendChild(this.containerControl);this.showAnswer=!1;this.text=void 0==this.text.type?this.rawText:this.text.hasFormula?this.rawText:this.text.toHTML();b=this.parent.lessonParser.parseText(this.answer);void 0!=b.type&&!this.text.hasFormula&&(this.answer=b.toHTML());this.evaluator.setVariable(this.id,this.text);this.drawButton();this.init();this.registerMouseEvents()};a.extend(a.TextArea,a.Control);a.TextArea.prototype.init=function(){var c=

this.answer?28:8;evaluator=this.evaluator;this.text=evaluator.getVariable(this.id);this.containerControl.setAttribute("class","DescartesTextAreaContainer");this.containerControl.setAttribute("style","width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.containerControl.style.display=0<evaluator.evalExpression(this.drawif)?"block":"none";this.containerControl.setAttribute("spellcheck","false");this.textArea.setAttribute("class","DescartesTextAreaContainer");

this.textArea.setAttribute("style","width: "+(this.w-8)+"px; height: "+(this.h-c)+"px; left: 4px; top: 4px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");this.textArea.setAttribute("contenteditable","true");this.textArea.innerHTML="<span style='position: relative; top: 10px; left: 10px; white-space: nowrap;' >"+this.text+"</span>";this.textAreaAnswer.setAttribute("class","DescartesTextAreaContainer");this.textAreaAnswer.setAttribute("style","width: "+(this.w-8)+

"px; height: "+(this.h-c)+"px; left: 4px; top: 4px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");this.textAreaAnswer.style.display=this.showAnswer?"block":"none";this.textAreaAnswer.innerHTML="<span style='position: relative; top: 10px; left: 10px; white-space: nowrap;'>"+this.answer+"</span>";this.showButton.setAttribute("style","width: 20px; height: 16px; position: absolute; bottom: 4px; right: 4px; cursor: pointer;");this.showButton.style.backgroundImage="url("+

this.imageUnPush+")";this.showButton.innerHTML="<span style='position: relative; top: 2px; text-align: center; font: 9px Arial'> S </span>";this.activeCover.setAttribute("style","position: absolute; width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px;");this.activeCover.style.display=0<evaluator.evalExpression(this.activeif)?"none":"block"};a.TextArea.prototype.drawButton=function(){var c=document.createElement("canvas");c.setAttribute("width",20);c.setAttribute("height",

16);for(var d=c.getContext("2d"),b=d.createLinearGradient(0,0,0,16),g,e=0;16>e;e++)g=f(e-5.6),b.addColorStop(e/16,"rgba(0,0,0,"+192*g*g/256/255+")");d.lineWidth=1;d.fillStyle="white";d.fillRect(0,0,20,16);d.fillStyle=b;d.fillRect(0,0,20,16);a.drawLine(d,19,0,19,16,"rgba(0,0,0,"+128/255+")");a.drawLine(d,0,0,0,16,"rgba(0,0,0,"+24/255+")");a.drawLine(d,1,0,1,16,"rgba(0,0,0,"+8/255+")");this.imageUnPush=c.toDataURL();d.fillStyle="white";d.fillRect(0,0,20,16);d.fillStyle=b;d.fillRect(0,0,20,16);a.drawLine(d,

0,0,0,14,"gray");a.drawLine(d,0,0,19,0,"gray");d.fillStyle="rgba(0, 0, 0,"+24/255+")";d.fillRect(0,0,this.w,this.h);this.imagePush=c.toDataURL()};a.TextArea.prototype.update=function(){evaluator=this.evaluator;evaluator.setVariable(this.id,this.text);var a=!1,d=!1,b=!1,f=!1;this.activeCover.style.display=0<evaluator.evalExpression(this.activeif)?"none":"block";this.containerControl.style.display=0<evaluator.evalExpression(this.drawif)?"block":"none";var e=evaluator.evalExpression(this.expresion),

a=this.x!=e[0][0],d=this.y!=e[0][1];this.x=e[0][0];this.y=e[0][1];4==e[0].length&&(b=this.w!=e[0][2],f=this.h!=e[0][3],this.w=e[0][2],this.h=e[0][3]);(b||f||a||d)&&this.init()};a.TextArea.prototype.registerMouseEvents=function(){function a(b){b.preventDefault();d.showButton.style.backgroundImage="url("+d.imageUnPush+")"}var d=this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();d.showAnswer=!d.showAnswer;d.textAreaAnswer.style.display=d.showAnswer?"block":"none";d.showButton.childNodes[0].childNodes[0].textContent=

d.showAnswer?"T":"S";d.showButton.style.backgroundImage="url("+d.imagePush+")"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.LessonParser=function(a){this.parent=a;this.parser=this.parent.evaluator.parser};a.LessonParser.prototype.parseButtonsConfig=function(a){for(var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23},a=this.split(a),d,b,g=0,e=a.length;g<e;g++)switch(d=

a[g][0],b=a[g][1],babel[d]){case "rowsNorth":c.rowsNorth=parseInt(b);break;case "rowsSouth":c.rowsSouth=parseInt(b);break;case "widthEast":c.widthEast=parseInt(b);break;case "widthWest":c.widthWest=parseInt(b);break;case "height":c.height=parseInt(b);break;case "about":c.about="true"==babel[b];break;case "config":c.config="true"==babel[b];break;case "init":c.init="true"==babel[b];break;case "clear":c.clear="true"==babel[b];break;default:console.log("----- attributo de Espacio no identificado: <"+

d+"> valor: <"+b+"> -----")}return c};a.LessonParser.prototype.parseSpace=function(f){for(var c={},d,f=this.split(f),b,g=0,e=f.length;g<e;g++)switch(d=f[g][0],b=f[g][1],babel[d]){case "type":c.type=b;break;case "id":c.id=b;break;case "x":d=b;d="%"==d[d.length-1]?(this.parent.container.width*parseFloat(d)/100).toString():b;c.xExpr=this.parser.parse(d);break;case "y":d=b;d="%"==d[d.length-1]?(this.parent.container.height*parseFloat(d)/100).toString():b;c.yExpr=this.parser.parse(d);break;case "width":d=

b;"%"==d[d.length-1]?d=this.parent.container.width*parseFloat(d)/100:(d=parseFloat(b),d!=b&&(d=this.parent.container.width));c.w=d;break;case "height":d=b;"%"==d[d.length-1]?d=this.parent.container.height*parseFloat(d)/100:(d=parseFloat(b),d!=b&&(d=this.parent.container.height));c.h=d;break;case "drawif":c.drawif=this.parser.parse(b);break;case "fixed":c.fixed="true"==babel[b];break;case "scale":d=parseFloat(b);d!=b&&(d=48);c.scale=d;break;case "O.x":c.OxExpr=b;break;case "O.y":c.OyExpr=b;break;case "image":c.imageSrc=

b;break;case "bg_display":c.bg_display=babel[b];break;case "background":c.background=this.convertColor(b);break;case "net":c.net="false"==babel[b]?"":this.convertColor(b);break;case "net10":c.net10="false"==babel[b]?"":this.convertColor(b);break;case "axes":c.axes="false"==babel[b]?"":this.convertColor(b);break;case "text":c.text="false"==babel[b]?"":this.convertColor(b);break;case "numbers":c.numbers="true"==babel[b];break;case "x-axis":c.x_axis=b;break;case "y-axis":c.y_axis=b;break;case "sensitive_to_mouse_movements":c.sensitive_to_mouse_movements=

"true"==babel[b];break;case "cID":c.cID=b;break;case "R3":c.R3="true"==babel[b];break;case "render":c.render=babel[b];break;case "split":c.split="true"==babel[b];break;case "file":c.file=b;break;default:console.log("----- attributo de Espacio no identificado: <"+d+"> valor: <"+b+"> -----")}if("R2"==c.type||2==this.parent.version)return new a.Space2D(this.parent,c);if("R3"==c.type)console.log("Los espacios 3D no funcionan.");else{if("AP"==c.type)return new a.SpaceAP(this.parent,c);if("HTMLIFrame"==

c.type)return new a.SpaceHTML_IFrame(this.parent,c)}};a.LessonParser.prototype.parseControl=function(f){for(var c={},f=this.split(f),d,b,g=0,e=f.length;g<e;g++)switch(d=f[g][0],b=f[g][1],babel[d]){case "id":c.id=b;break;case "type":c.type=babel[b.trim()];break;case "gui":c.gui=babel[b];break;case "region":c.region=babel[b];break;case "space":c.spaceID=b;break;case "name":c.name=b;break;case "expresion":c.expresion=this.parser.parse(b.replace(")(",","));break;case "fixed":c.fixed="true"==babel[b];

break;case "visible":c.visible="true"==babel[b];break;case "color":c.color=this.convertColor(b);break;case "colorInt":c.colorInt=this.convertColor(b);break;case "bold":"false"!=babel[b]&&(c.bold="bold");break;case "italics":"false"!=babel[b]&&(c.italics="italic");break;case "underlined":"false"!=babel[b]&&(c.underlined=!0);break;case "font_size":c.font_size=this.parser.parse(b);break;case "image":c.imageSrc=b;break;case "action":c.action=babel[b];break;case "parameter":c.parameter=b;break;case "drawif":c.drawif=

this.parser.parse(b);break;case "activeif":c.activeif=this.parser.parse(b);break;case "tooltip":c.tooltip=b;break;case "tooltipFont":c.tooltipFont=b;break;case "Explanation":c.Explanation=b;break;case "ExplanationFont":c.ExplanationFont=b;break;case "msg_pos":c.msg_pos=babel[b];break;case "cID":c.cID=b;break;case "value":d=b.replace(/&squot;/g,"'");d.match(/^\|/)&&(d="'"+d.substring(1),d.match(/\|$/)&&(d=d.substring(0,d.length-1)+"'"));c.valueExpr=this.parser.parse(d);c.valueExprString=d;break;case "decimals":c.decimals=

this.parser.parse(b);break;case "min":c.min=this.parser.parse(b);break;case "max":c.max=this.parser.parse(b);break;case "incr":c.incr=this.parser.parse(b);break;case "discrete":c.discrete="true"==babel[b];break;case "onlyText":c.onlyText="true"==babel[b];break;case "evaluate":c.evaluate="true"==babel[b];break;case "answer":c.answer=b;break;case "exponentialif":c.exponentialif=parseFloat(b);break;case "size":c.size=this.parser.parse(b);break;case "constraint":c.constraintExpr=b;break;case "text":c.rawText=

b;d=this.parseText(b);b=0;for(var h=d.length;b<h;b++)d[b]=this.parser.parse(d[b],!1);c.text=d;break;case "trace":c.trace=this.convertColor(b);break;case "options":c.options=b;break;case "font":c.font=b;break;case "file":c.file=b;break;case "autoplay":c.autoplay="true"==babel[b];break;case "loop":c.loop="true"==babel[b];break;case "controls":c.controls="true"==babel[b];break;case "poster":c.poster=babel[b];break;default:var i=d.indexOf("."),h=babel[d.substring(0,i)],i=babel[d.substring(i+1)];if("parameter"==

h&&"font"==i){c.parameterFont=b;break}else if("Explanation"==h&&"font"==i){c.ExplanationFont=b;break}else if("tooltip"==h&&"font"==i){c.tooltipFont=b;break}console.log("----- attributo de control no identificado: <"+d+"> valor: <"+b+"> -----")}if("numeric"==c.type){if(void 0==c.gui||"spinner"==c.gui)return new a.Spinner(this.parent,c);if("button"==c.gui)return new a.Button(this.parent,c);if("textfield"==c.gui)return new a.TextField(this.parent,c);if("menu"==c.gui)return new a.Menu(this.parent,c);

if("scrollbar"==c.gui)return new a.Scrollbar(this.parent,c)}else{if("video"==c.type)return new a.Video(this.parent,c);if("audio"==c.type)return new a.Audio(this.parent,c);if("graphic"==c.type)return new a.GraphicControl(this.parent,c);if("text"==c.type)return new a.TextArea(this.parent,c)}};a.LessonParser.prototype.parseGraphic=function(f,c,d,b){for(var b={rotateExp:b,parameter:"t"},f=this.split(f),g,e,h=0,i=f.length;h<i;h++)switch(g=f[h][0],e=f[h][1],babel[g]){case "space":b.spaceID=e;break;case "type":b.type=

babel[e];break;case "background":b.background="true"==babel[e];break;case "color":b.color=this.convertColor(e);break;case "drawif":b.drawif=this.parser.parse(e);break;case "abs_coord":b.abs_coord="true"==babel[e];break;case "expresion":"macro"!=b.type?(b.expresion=this.parser.parse(e),b.expresionString=e):b.expresion=e;break;case "trace":b.trace=this.convertColor(e);break;case "family":b.family=e;break;case "parameter":b.parameter=e;break;case "fill":b.fill=this.convertColor(e);break;case "fillP":b.fillP=

this.convertColor(e);break;case "fillM":b.fillM=this.convertColor(e);break;case "width":b.width=this.parser.parse(e);break;case "visible":b.visible="true"==babel[e];break;case "editable":b.editable="true"==babel[e];break;case "info":b.info=e;break;case "text":g=this.parseText(e);e=0;for(var j=g.length;e<j;e++)g[e]=this.parser.parse(g[e],!1);b.text=g;break;case "font":b.font=e;break;case "fixed":b.fixed="true"==babel[e];break;case "decimals":b.decimals=this.parser.parse(e);break;case "size":b.size=

this.parser.parse(e);break;case "spear":b.spear=this.parser.parse(e);break;case "arrow":b.arrow=this.convertColor(e);break;case "center":b.center=this.parser.parse(e);break;case "radius":b.radius=this.parser.parse(e);break;case "init":b.init=this.parser.parse(e);break;case "end":b.end=this.parser.parse(e);break;case "vectors":b.vectors="true"==babel[e];break;case "file":g=e.replace(/&squot;/g,"'");"["==g.charAt(0)&&"]"==g.charAt(g.length-1)&&(g=g.substring(1,g.length-1));g.match(/.jpg$|.png$|.gif$|.svg$/)&&

(g="'"+g+"'");b.file=this.parser.parse(g);break;case "inirot":b.inirot=this.parser.parse(e);break;case "opacity":b.opacity=this.parser.parse(e);break;case "inipos":b.inipos=this.parser.parse(e);break;case "name":b.name=e;break;case "range":b.range=this.parser.parse(e);break;case "border":"false"!=babel[e]&&(b.border=this.convertColor(e));break;case "align":b.align=babel[e];break;default:if(void 0!=b.family&&g.substring(0,b.family.length+1)==b.family+"."){switch(babel[g.substring(b.family.length+1)]){case "interval":b.family_interval=

this.parser.parse(e);break;case "steps":b.family_steps=this.parser.parse(e)}break}if(void 0!=b.parameter&&g.substring(0,b.parameter.length+1)==b.parameter+"."){switch(babel[g.substring(b.parameter.length+1)]){case "interval":b.parameter_interval=this.parser.parse(e);break;case "steps":b.parameter_steps=this.parser.parse(e)}break}console.log("----- attributo del grafico no identificado: <"+g+"> valor: <"+e+"> -----")}c&&(b.abs_coord=c);d&&(b.background=d);if("equation"==b.type)return new a.Equation(this.parent,

b);if("curve"==b.type)return new a.Curve(this.parent,b);if("sequence"==b.type)return new a.Sequence(this.parent,b);if("point"==b.type)return new a.Point(this.parent,b);if("segment"==b.type)return new a.Segment(this.parent,b);if("arrow"==b.type)return new a.Arrow(this.parent,b);if("polygon"==b.type)return new a.Polygon(this.parent,b);if("arc"==b.type)return new a.Arc(this.parent,b);if("text"==b.type)return new a.Text(this.parent,b);if("image"==b.type)return new a.Image(this.parent,b);if("macro"==b.type)return new a.Macro(this.parent,

b)};a.LessonParser.prototype.parse3DGraphic=function(f,c,d,b){for(var c={rotateExp:b,parameter:"t"},f=this.split(f),g,e,d=0,b=f.length;d<b;d++)switch(g=f[d][0],e=f[d][1],babel[g]){case "space":c.spaceID=e;break;case "type":c.type=babel[e];break;case "background":c.background="true"==babel[e];break;case "color":c.color=this.convertColor(e);break;case "drawif":c.drawif=this.parser.parse(e);break;case "expresion":"macro"!=c.type&&"curve"!=c.type&&"surface"!=c.type?(c.expresion=this.parser.parse(e),c.expresionString=

e):c.expresion=e;break;case "family":c.family=e;break;case "parameter":c.parameter=e;break;case "width":c.width=this.parser.parse(e);break;case "length":c.length=this.parser.parse(e);break;case "text":g=this.parseText(e);e=0;for(var h=g.length;e<h;e++)g[e]=this.parser.parse(g[e],!1);c.text=g;break;case "font":c.font=e;break;case "fixed":c.fixed="true"==babel[e];break;case "decimals":c.decimals=this.parser.parse(e);break;case "model":c.model=babel[e];break;case "edges":c.edges="true"==babel[e];break;

case "Nu":c.Nu=this.parser.parse(e);break;case "Nv":c.Nu=this.parser.parse(e);break;case "name":c.name=e;break;case "backcolor":c.backcolor=this.convertColor(e);break;case "inirot":c.inirot=this.parser.parse(e);break;case "endrot":c.endrot=this.parser.parse(e);break;case "inipos":c.inipos=this.parser.parse(e);break;case "endpos":c.endpos=this.parser.parse(e);break;default:if(void 0!=c.family&&g.substring(0,c.family.length+1)==c.family+"."){switch(babel[g.substring(c.family.length+1)]){case "interval":c.family_interval=

this.parser.parse(e);break;case "steps":c.family_steps=this.parser.parse(e)}break}if(void 0!=c.parameter&&g.substring(0,c.parameter.length+1)==c.parameter+"."){switch(babel[g.substring(c.parameter.length+1)]){case "interval":c.parameter_interval=this.parser.parse(e);break;case "steps":c.parameter_steps=this.parser.parse(e)}break}console.log("----- attributo del grafico no identificado: <"+g+"> valor: <"+e+"> -----")}if("point"==c.type)return new a.Point3D(this.parent,c);if("segment"==c.type)return new a.Segment3D(this.parent,

c);if("polygon"==c.type)return new a.Polygon3D(this.parent,c);if("curve"==c.type)return new a.Curve3D(this.parent,c);if("triangle"==c.type)return new a.Triangle3D(this.parent,c);if("face"==c.type)return new a.Face3D(this.parent,c);if("polireg"==c.type)return new a.Polireg3D(this.parent,c);if("surface"==c.type)return new a.Surface3D(this.parent,c);if("text"==c.type)return new a.Text3D(this.parent,c);console.log(c.type)};a.LessonParser.prototype.parseAuxiliar=function(f){for(var c={},f=this.split(f),

d=0,b=f.length;d<b;d++)f[d][1]=f[d][1].replace(/&squot;/g,"'");for(var g,e,d=0,b=f.length;d<b;d++)switch(g=f[d][0],e=f[d][1],babel[g]){case "id":c.id=e;break;case "editable":c.editable="true"==babel[e];break;case "constant":c.constant="true"==babel[e];break;case "array":c.array="true"==babel[e];break;case "file":c.file=e;break;case "matrix":c.matrix="true"==babel[e];break;case "rows":c.rows=this.parser.parse(e);break;case "columns":c.columns=this.parser.parse(e);break;case "algorithm":c.algorithm=

"true"==babel[e];break;case "init":c.init=e;break;case "do":c.doExpr=e;break;case "while":c.whileExpr=e;break;case "range":c.range=e;break;case "expresion":c.expresion=e;break;case "size":c.size=this.parser.parse(e);break;case "evaluate":c.evaluate=babel[e];break;case "event":c.event=babel[e];break;case "condition":c.condition=e;break;case "execution":c.execution=babel[e];break;case "msg_pos":c.msg_pos=babel[e];break;case "action":c.action=babel[e];break;case "parameter":c.parameter=e;break;case "sequence":c.sequence=

"true"==babel[e];break;default:var h=g.indexOf("."),i=babel[g.substring(0,h)],h=babel[g.substring(h+1)];if("parameter"==i&&"font"==h){c.parameterFont=e;break}console.log("----- attributo de auxiliar no identificado: <"+g+"> valor: <"+e+"> -----")}c.sequence?new a.AuxSequence(this.parent,c):c.constant?(f=new a.Constant(this.parent,c),c.evaluate&&"always"==c.evaluate&&this.parent.auxiliaries.push(f)):c.algorithm&&c.evaluate?this.parent.auxiliaries.push(new a.Algorithm(this.parent,c)):c.array&&!c.matrix&&

")"!=c.id.charAt(c.id.length-1)?(f=new a.Vector(this.parent,c),c.evaluate&&"always"==c.evaluate&&this.parent.auxiliaries.push(f)):c.matrix&&")"!=c.id.charAt(c.id.length-1)?(f=new a.Matrix(this.parent,c),c.evaluate&&"always"==c.evaluate&&this.parent.auxiliaries.push(f)):c.event&&")"!=c.id.charAt(c.id.length-1)?this.parent.events.push(new a.Event(this.parent,c)):")"==c.id.charAt(c.id.length-1)?new a.Function(this.parent,c):new a.Variable(this.parent,c)};a.LessonParser.prototype.parseAction=function(f){var c=

f.action,d=f.parent,f=f.parameter;if(c)switch(c){case "message":return new a.Message(d,f);case "calculate":return new a.Calculate(d,f);case "openURL":return new a.OpenURL(d,f);case "openScene":return new a.OpenScene(d,f);case "about":return new a.About(d,f);case "config":return new a.Config(d,f);case "init":return new a.Init(d,f);case "clear":return new a.Clear(d,f);case "animate":return new a.Animate(d,f);case "initAnimation":return new a.InitAnimation(d,f);case "playAudio":return new a.PlayAudio(d,

f);default:console.log("----- Accion no soportada aun: <"+c+"> -----")}else return{execute:function(){}}};a.LessonParser.prototype.parseAnimation=function(f){for(var c={},f=this.split(f),d,b,g=0,e=f.length;g<e;g++)switch(d=f[g][0],b=f[g][1],babel[d]){case "delay":c.delay=b;break;case "controls":c.controls="true"==babel[b];break;case "auto":c.auto="true"==babel[b];break;case "loop":c.loop="true"==babel[b];break;case "init":c.init=b;break;case "do":c.doExpr=b;break;case "while":c.whileExpr=b;break;

case "id":c.id=b;break;case "algorithm":c.algorithm="true"==babel[b];break;case "evaluate":c.evaluate="true"==babel[b];break;default:console.log("----- attributo de la animacion no identificado: <"+d+">  <"+b+"> -----")}return new a.Animation(this.parent,c)};a.LessonParser.prototype.parsePleca=function(f,c){var f=this.split(f),d,b,g,e,h,i,j,k,l;b=d="";g=0;e="#536891";h="white";i="left";j="";k="SansSerif,BOLD,20";l="SansSerif,PLAIN,18";for(var n,r,o=0,p=f.length;o<p;o++)switch(n=f[o][0],r=f[o][1],

n){case "title":d=r;break;case "subtitle":b=r;break;case "subtitlines":g=r;break;case "bgcolor":""!==r&&(e="#"+a.getColor(this.evaluator,r));break;case "fgcolor":""!==r&&(h="#"+a.getColor(this.evaluator,r));break;case "align":""!==r&&(i=r);break;case "titleimage":j=r;break;case "titlefont":k=""!==r?a.convertFont(r):a.convertFont(k);break;case "subtitlefont":l=""!==r?a.convertFont(r):a.convertFont(l);break;default:console.log("----- attributo de la pleca no identificado: <"+n+">  <"+r+"> -----")}n=

l.substring(0,l.indexOf("px"));n=n.substring(n.lastIndexOf(" "));var q,m;""!=j&&(q=this.parent.getImage(j),m=q.height);j=document.createElement("div");j.setAttribute("id","descartesPleca");m?(j.setAttribute("style","position: absolute; left: 0px; top: 0px; text-align: "+i+"; width: "+(c-30)+"px; height: "+(m-16)+"px; background: "+e+"; color: "+h+"; padding-top: 8px; padding-bottom: 8px; padding-left: 15px; padding-right: 15px; margin: 0px; overflow: hidden; z-index: 100;"),q.setAttribute("style",

"position: absolute; left: 0px; top: 0px; z-index: -1; width: 100%; height: 100%"),j.appendChild(q)):j.setAttribute("style","position: absolute; left: 0px; top: 0px; text-align: "+i+"; width: "+(c-30)+"px; background: "+e+"; color: "+h+"; padding-top: 8px; padding-bottom: 8px; padding-left: 15px; padding-right: 15px; margin: 0px; z-index: 100;");e=document.createElement("div");e.setAttribute("style","padding: 0px; margin: 0px; font: "+k+"; overflow: hidden; white-space: nowrap;");e.innerHTML=d;d=

document.createElement("div");if(1==parseInt(g)){h=0;g=document.createElement("div");g.innerHTML=b;document.body.appendChild(g);k=n;do k-=h,g.setAttribute("style","padding: 0px; margin: 0px; font: "+l+"; font-size: "+k+"px; width: "+(c-30)+"px; line-height: "+k+"px;"),h=g.offsetHeight,i=h/k,h=1;while(1<i&&8<k);document.body.removeChild(g);d.setAttribute("style","padding: 0px; margin: 0px; font: "+l+"; font-size: "+k+"px; line-height: 110%; overflow: hidden; white-space: nowrap;")}else d.setAttribute("style",

"padding: 0px; margin: 0px; font: "+l+"; line-height: 110%;");d.innerHTML=b;j.appendChild(e);j.appendChild(d);j.imageHeight=m;return j};a.LessonParser.prototype.split=function(a){for(var a=(a||"").replace(/\\'/g,"\u2019"),c=[],d=0,b=0,g=!1,e=0,h=!1,i=!1;d<a.length;)" "==a.charAt(d)&&!g&&d++," "!=a.charAt(d)&&!g&&(g=!0,e=d),"="==a.charAt(d)&&"'"==a.charAt(d+1)&&!h&&(h=!0,c[b]=[a.substring(e,d)],e=d+2,d+=2),h&&"'"==a.charAt(d)&&(g=h=!1,c[b].push(a.substring(e,d)),b++),"="==a.charAt(d)&&"'"!=a.charAt(d+

1)&&!h&&(i=!0,c[b]=[a.substring(e,d)],e=d+1,d++),i&&" "==a.charAt(d)&&(g=i=!1,c[b].push(a.substring(e,d)),b++),i&&d==a.length-1&&c[b].push(a.substring(e,a.length)),d++;return c};a.LessonParser.prototype.splitComa=function(a){for(var c=[],d=[],b=0,g=0,e=a.length;g<e;g++)"("==a.charAt(g)?d.push(g):")"==a.charAt(g)?d.pop():","==a.charAt(g)&&0==d.length&&(c.push(a.substring(b,g)),b=g+1);c.push(a.substring(b));return c};a.LessonParser.prototype.convertColor=function(a){if(babel[a])return"net"==babel[a]?

"red":babel[a];if(6==a.length)return"#"+a;if(8==a.length)return"rgba("+parseInt("0x"+a.substring(2,4),16)+","+parseInt("0x"+a.substring(4,6),16)+","+parseInt("0x"+a.substring(6,8),16)+","+(1-parseInt("0x"+a.substring(0,2),16)/255)+")";if("("==a[0]){for(var c="(",a=this.splitComa(a.substring(1,a.length-1)),d,b=0,g=a.length;b<g;b++)d=parseInt(a[b],16),a[b]!=d.toString(16)?("["==a[b].charAt(0)&&"]"==a[b].charAt(a[b].length-1)&&(a[b]=a[b].substring(1,a[b].length-1)),c=c+a[b]+(b<g-1?",":")")):c=c+d/255+

(b<g-1?",":")");return this.parser.parse(c)}return"#aa0000"};a.LessonParser.prototype.parseText=function(f){if(f.match(/^\{\\rtf1/))return(new a.RTFParser(this.parent.evaluator)).parse(f.substring(10,f.length-1));for(var f=f.split("\\n"),c=0,d=f.length;c<d;c++)f[c]=this.parseTextElement(f[c]);return f};a.LessonParser.prototype.parseTextElement=function(a){for(var a=a.replace(/&squot;/g,"'"),c="'",d=0,b=-1;d<a.length;)"["==a.charAt(d)&&"\\"==a.charAt(d-1)?c=c.substring(0,c.length-1)+"[":"]"==a.charAt(d)&&

"\\"==a.charAt(d-1)?c=c.substring(0,c.length-1)+"]":"["==a.charAt(d)&&-1==b?(b++,c+="'+("):"["==a.charAt(d)?(b++,c+=a.charAt(d)):"]"==a.charAt(d)&&0==b?(b--,c+=")+'"):("]"==a.charAt(d)&&(b=0>b?b:b-1),c+=a.charAt(d)),d++;return c+"'"};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Node=function(a,c){this.sep="";this.type=a;this.value=c;this.parent=null;this.childs=[]};a.Node.prototype.getRoot=function(){return null==this.parent?this:this.parent.getRoot()};a.Node.prototype.addChild=

function(a){a.parent=this;this.childs.push(a)};a.Node.prototype.replaceLastChild=function(a){var c=this.childs.length-1;this.childs[c].parent=null;this.childs[c]=a;a.parent=this;return a};a.Node.prototype.toString=function(){var a="tipo: "+this.type+", valor: "+this.value+"\n";this.sep="   "+(this.parent?this.parent.sep:"");for(var c=0,d=this.childs.length;c<d;c++)a+=this.sep+this.childs[c].toString();return a};a.Node.prototype.contains=function(a){if(this.value==a)return!0;for(var c=0,d=this.childs.length;c<

d;c++)if(this.childs[c].contains(a))return!0;return!1};a.Node.prototype.equalToMinus=function(){if("compOperator"==this.type){this.type="operator";this.value="-";var f=new a.Node("compOperator","=="),c=new a.Node("number","0");f.addChild(this);f.addChild(c);return this.getRoot()}return this};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Tokenizer=function(){};a.Tokenizer.prototype.tokenize=function(a){var c=a;a&&(a=a.replace(/\\u(\S+) /g,function(a,b){return String.fromCharCode(parseInt(b,

16))}),a=a.replace(/\&sup(.+);/g,"^$1 "),a=a.replace(/&squot;/g,"'"),a.match(/\=\|\*/g)&&(a=a.replace("|*","'","g").replace("*|","'","g")));for(var d=[],b=!1,g=0,e,h=a,i=0,j="",k=function(a,b,c){d.push({type:a,value:b});h=h.slice(c);g=g+c;i++;j=a};a&&g<a.length;)if(b=g,"'"==h[0]){for(e=1;"'"!=h[e];)if(e<h.length)e++;else{console.log(">Error, simbolo no conocido: ["+h+"], en la cadena <<"+c+">>");return}e=h.substring(1,e);k("string",e,e.length+2)}else if(e=h.match(/^\s+/))h=h.slice(e[0].length),g+=

e[0].length,i++;else if(e=h.match(/^[a-zA-Z_\u00C0-\u021B]+[a-zA-Z_0-9\u00C0-\u021B]*([.]*[0-9a-zA-Z_\u00C0-\u021B]+[0-9]*)*/))"number"===j&&d.push({type:"operator",value:"*"}),k("identifier",e[0],e[0].length);else if(e=h.match(/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/))k("number",e[0],e[0].length);else if(e=h.match(/^==|^!=|^<=|^<|^>=|^>|^#/))b=e[0],"#"==b&&(b="!="),k("compOperator",b,e[0].length);else if(e=h.match(/^\!|^\~|^\&\&|^\&|^\|\||^\|/))b=e[0],"||"==b?b="|":"&&"==b?b="&":"~"==b&&(b="!"),k("boolOperator",

b,e[0].length);else if((e=h.match(/^=/))&&!h.match(/^==/))k("asign",e[0],e[0].length);else if(e=h.match(/^[\?\:]/))k("conditional",e[0],e[0].length);else if(e=h.match(/^[\+\-\*\/\%\^]/))k("operator",e[0],e[0].length);else if(e=h.match(/^\[|^\]/))k("square_bracket",e[0],e[0].length);else if(e=h.match(/^\(|^\)/))k("parentheses",e[0],e[0].length);else if(e=h.match(/^,/))k("separator",e[0],e[0].length);else if(e=h.match(/^;/))k("final_of_expresion",e[0],e[0].length);else if(b==g){console.log("Error, simbolo no conocido: ["+

h+"], en la cadena <<"+c+">>");return}return d};a.Tokenizer.prototype.flatTokens=function(a){for(var a=a||[],c="",d=0,b=a.length;d<b;d++)c="string"==a[d].type?c+"&squot;"+a[d].value+"&squot;":c+a[d].value;return c};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Parser=function(f){this.evaluator=f;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.variables.rnd=Math.random;this.variables.pi=Math.PI;this.variables.e=Math.E;

this.variables.Infinity=Infinity;this.variables["-Infinity"]=-Infinity;this.functions.sqr=function(a){return a*a};this.functions.sqrt=this.functions["ra\u00edz"]=Math.sqrt;this.functions.exp=Math.exp;this.functions.log=Math.log;this.functions.log10=function(a){return Math.log(a)/Math.log(10)};this.functions.abs=Math.abs;this.functions.ent=Math.floor;this.functions.sgn=function(a){return 0<a?1:0>a?-1:0};this.functions.ind=function(a){return a?1:0};this.functions.sin=this.functions.sen=Math.sin;this.functions.cos=

Math.cos;this.functions.tan=Math.tan;this.functions.cot=function(a){return 1/Math.tan(a)};this.functions.sec=function(a){return 1/Math.cos(a)};this.functions.csc=function(a){return 1/Math.sin(a)};this.functions.sinh=this.functions.senh=function(a){return(Math.exp(a)-Math.exp(-a))/2};this.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};this.functions.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};this.functions.coth=function(a){return 1/this.functions.tanh(a)};

this.functions.sech=function(a){return 1/this.functions.cosh(a)};this.functions.csch=function(a){return 1/this.functions.sinh(a)};this.functions.asin=this.functions.asen=Math.asin;this.functions.acos=Math.acos;this.functions.atan=Math.atan;this.functions.min=Math.min;this.functions.max=Math.max;this.functions.esCorrecto=function(c,d){return a.esCorrecto(c,d)};this.functions.escorrecto=function(c,d){return a.escorrecto(c,d)};window.parent.location.href!==window.location.href&&(this.functions["parent.set"]=

function(a,d){window.parent.postMessage({type:"set",name:a,value:d},"*")},this.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},"*")},this.functions["parent.get"]=function(a,d){window.parent.postMessage({type:"get",name:a,value:d},"*")},this.functions["parent.exec"]=function(a,d){window.parent.postMessage({type:"exec",name:a,value:d},"*")})};a.Parser.prototype.setVariable=function(a,c){this.variables[a]=c};a.Parser.prototype.getVariable=function(a){this.variables.hasOwnProperty(a)||

(this.variables[a]=0);return this.variables[a]};a.Parser.prototype.setVector=function(a,c,d){this.vectors[a][c]=d};a.Parser.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};a.Parser.prototype.setMatrix=function(a,c,d,b){this.matrices[a][c][d]=b};a.Parser.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};a.Parser.prototype.setFunction=function(a,c){this.functions[a]=

c};a.Parser.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};a.Parser.prototype.parse=function(f,c){var d=this.tokenizer.tokenize(f);d||(d=[]);for(var b=null,g,c=!c||!1,e=0,h=0,i=0,j,k,l=0,n=d.length;l<n;l++)if(g=d[l],j=g.value,k=g.type,"identifier"==k&&(l+1<n&&"parentheses"==d[l+1].type&&"("==d[l+1].value?this.getFunction(j):l+1<n&&"square_bracket"==d[l+1].type&&"["==d[l+1].value?d[l+3]&&"square_bracket"==d[l+3].type&&

"]"==d[l+3].value?this.getVector(j):this.getMatrix(j):this.getVariable(j)),"asign"==k&&c&&(k="compOperator",j="=="),"asign"==k)if(g=new a.Node(k,j),null!=b)if("identifier"==b.type)b.parent&&b.parent.replaceLastChild(g),g.addChild(b),b=g,c=!0;else if("square_bracket"==b.type)g.addChild(b.parent),b=g,c=!0;else{g.type="compOperator";g.value="==";for(c=!0;b.parent&&this.precedence(b.parent.value)>=this.precedence(g.value);)b=b.parent;b.parent&&b.parent.replaceLastChild(g);g.addChild(b);b=g}else{console.log("Error1: en la expresion <<"+

f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}else if("parentheses"==k&&"("==j||"square_bracket"==k&&"["==j)if(g=new a.Node(k,j),"("==j&&e++,"["==j&&h++,null==b)"("==j&&(b=new a.Node("(expr)","(expr)"),b.addChild(g)),"["==j&&(b=new a.Node("[expr]","[expr]"),b.addChild(g)),b=g;else if("operator"==b.type||"boolOperator"==b.type||"compOperator"==b.type||"conditional"==b.type||"asign"==b.type)b.addChild(g),b=g;else if("sign"==b.type)b.addChild(g),b=g;else if("parentheses"==b.type&&"("==b.value)b.addChild(g),

b=g;else if("square_bracket"==b.type&&"["==b.value)b.addChild(g),b=g;else if("parentheses"==b.type&&"()"==b.value)b.parent.addChild(g),b=g;else if("square_bracket"==b.type&&"[]"==b.value)b.parent.addChild(g),b=g;else if("identifier"==b.type)b.addChild(g),b=g;else{console.log("Error2: en la expresion <<"+f+">>, en el token ["+l+"] {valor: "+j+", tipo: "+k+"}");break}else if("parentheses"==k&&")"==j)if(e--,null==b)console.log("Error3: en la expresion <<"+f+">>, en el token (valor:"+j+", tipo:"+k);else{for(;b&&

b.parent&&"("!=b.value;)b=b.parent;if(b&&"("==b.value)b.value="()";else{console.log("Error4: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}}else if("square_bracket"==k&&"]"==j)if(h--,null==b)console.log("Error5: en la expresion <<"+f+">>, en el token (valor:"+j+", tipo:"+k);else{for(;b&&b.parent&&"["!=b.value;)b=b.parent;if(b&&"["==b.value)b.value="[]";else{console.log("Error6: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}}else if("number"==

k||"string"==k||"identifier"==k)if(g=new a.Node(k,j),null==b)b=g;else if("operator"==b.type||"compOperator"==b.type||"boolOperator"==b.type||"parentheses"==b.type&&"("==b.value||"square_bracket"==b.type&&"["==b.value||"sign"==b.type||"conditional"==b.type||"asign"==b.type)b.addChild(g),b=g;else{console.log("Error7: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}else if("operator"==k||"compOperator"==k||"boolOperator"==k)if(g=new a.Node(k,j),null==b)if("-"==j||"+"==j)g.type=

"sign",g.value="sign"+j,b=g;else if("!"==j)b=g;else{console.log("Error8: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}else if("operator"==b.type||"compOperator"==b.type||"boolOperator"==b.type||"asign"==b.type||"conditional"==b.type||"square_bracket"==b.type&&"["==b.value&&("-"==j||"+"==j||"!"==j)||"parentheses"==b.type&&"("==b.value&&("-"==j||"+"==j||"!"==j)){if("-"==j||"+"==j)g.type="sign",g.value="sign"+j;b.addChild(g);b=g}else if("number"==b.type||"parentheses"==

b.type&&"()"==b.value||"square_bracket"==b.type&&"[]"==b.value||"string"==b.type||"identifier"==b.type||"conditional"==b.type||"asign"==b.type){for(;b.parent&&this.precedence(b.parent.value)>=this.precedence(g.value);)b=b.parent;b.parent&&b.parent.replaceLastChild(g);g.addChild(b);b=g}else{console.log("Error9: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}else if("conditional"==k)if(g=new a.Node(k,j),null!=b)if("?"==g.value){for(i++;b.parent&&this.precedence(b.parent.value)>

this.precedence(g.value);)b=b.parent;b.parent&&b.parent.replaceLastChild(g);g.addChild(b);b=g}else{for(i--;b&&b.parent&&"?"!=b.value;)b=b.parent;if(b&&"?"==b.value)b.value="?:";else{console.log("Error10: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}}else{console.log("Error11: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}else if("separator"==k)if(null!=b)for(;b.parent&&"("!=b.value&&"["!=b.value;)b=b.parent;else{console.log("Error12: en la expresion <<"+

f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}else{console.log("Error13: en la expresion <<"+f+">>, en el token {valor: "+j+", tipo: "+k+"}");break}0<e&&alert("Error, faltan parentesis por cerrar: "+f);0>e&&alert("Error, faltan parentesis por abrir: "+f);0<h&&alert("Error, faltan corchetes por cerrar: "+f);0>h&&alert("Error, faltan corchetes por abrir: "+f);0!=i&&alert("Error, condicional incompleta: "+f);return b?b.getRoot():null};a.Parser.prototype.precedence=function(a){switch(a){case "=":return 1;

case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "&":return 6;case "|":return 6;case "<":return 4;case "<=":return 4;case ">":return 4;case ">=":return 4;case "==":return 4;case "!=":return 4;case "+":return 5;case "-":return 5;case "/":return 6;case "*":return 6;case "sign-":return 6;case "sign+":return 6;case "!":return 7;case "^":return 7;case "%":return 7;default:return 8}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;

var f=Math.floor;a.Evaluator=function(c){this.parent=c;this.parser=new a.Parser;this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices};a.Evaluator.prototype.setVariable=function(a,d){this.variables[a]=d};a.Evaluator.prototype.getVariable=function(a){return this.variables[a]};a.Evaluator.prototype.setVector=function(a,d,b){d=0>d?0:f(d);this.vectors[a][d]=b};a.Evaluator.prototype.getVector=function(a,d){d=0>d?0:

f(d);return this.vectors[a][d]};a.Evaluator.prototype.setMatrix=function(a,d,b,g){d=0>d?0:f(d);b=0>b?0:f(b);this.matrices[a][d][b]=g};a.Evaluator.prototype.getMatrix=function(a,d,b){d=0>d?0:f(d);b=0>b?0:f(b);return this.matrices[a][d][b]};a.Evaluator.prototype.setFunction=function(a,d){this.functions[a]=d};a.Evaluator.prototype.getFunction=function(a){return this.functions[a]};a.Evaluator.prototype.evalExpression=function(a,d,b){this.decimals=void 0==d||0>d?2:d;this.fixed=b||!1;a=this.evalAux(a);

return void 0==a?0:a};a.Evaluator.prototype.evalAux=function(a){if(null==a)return 0;var d=a.type,b=a.childs,g=a.value;if("number"==d)return parseFloat(g);if("string"==d)return g;if("identifier"==d&&0==b.length){if("rnd"==g)return Math.random();b=this.variables[g];return"object"==typeof b?this.evalAux(b):b}if("square_bracket"==d)return this.evalAux(b[0]);if("identifier"==d&&"square_bracket"==b[0].type&&1==b[0].childs.length){var e=this.evalAux(b[0].childs[0]);try{return this.vectors[g][0>e?0:f(e)]}catch(h){return 0}}else if("identifier"==

d&&"square_bracket"==b[0].type&&1<b[0].childs.length){e=this.evalAux(b[0].childs[0]);b=this.evalAux(b[0].childs[1]);try{return this.matrices[g][0>e?0:f(e)][0>b?0:f(b)]}catch(i){return 0}}else{if("identifier"==d&&"parentheses"==b[0].type){for(var j=[],d=0,e=b[0].childs.length;d<e;d++)j.push(this.evalAux(b[0].childs[d]));if("_Eval_"==g){if(!a.previousExpression||a.previousExpression!=j[0])a.previousExpression=j[0],a.previousParse=this.parser.parse(j[0]);return this.evalAux(a.previousParse)}return this.functions[g].apply(this,

j)}if("operator"==d){d=void 0==this.decimals||0>this.decimals?2:this.decimals;a=this.fixed||!1;e=this.evalAux(b[0]);b=this.evalAux(b[1]);if("+"==g)return"string"===typeof e&&"number"==typeof b?(b=a?b.toFixed(parseFloat(d)):parseFloat(b.toFixed(parseFloat(d))),b=(""+b).replace(".",this.parent.decimal_symbol)+"",e+b):"number"===typeof e&&"string"==typeof b?(g=a?e.toFixed(parseFloat(d)):parseFloat(e.toFixed(parseFloat(d))),g=(""+g).replace(".",this.parent.decimal_symbol)+"",g+b):e+b;if("-"==g)return e-

b;if("*"==g)return e*b;if("/"==g)return e/b;if("%"==g)return e-f(e/b)*b;if("^"==g)return Math.pow(e,b)}else if("compOperator"==d){e=this.evalAux(b[0]);b=this.evalAux(b[1]);if("<"==g)return(e<b)+0;if("<="==g)return(e<=b)+0;if(">"==g)return(e>b)+0;if(">="==g)return(e>=b)+0;if("=="==g)return(e==b)+0;if("!="==g)return(e!=b)+0}else if("boolOperator"==d){e=1==this.evalAux(b[0])?1:0;if("&"==g)return e?1==this.evalAux(b[1])?1:0:0;if("|"==g)return e?1:1==this.evalAux(b[1])?1:0;if("!"==g)return!e+0}else{if("conditional"==

d)return e=this.evalAux(b[0]),0<e?this.evalAux(b[1]):this.evalAux(b[2]);if("sign"==d)return"sign+"==g?this.evalAux(b[0]):-this.evalAux(b[0]);if("parentheses"==d)return this.evalAux(b[0]);if("(expr)"==d||"[expr]"==d){e=b.length;g=[];if(1==e&&1==b[0].childs.length&&"(expr)"==d)g=this.evalAux(b[0].childs[0]);else for(d=0;d<e;d++){for(var a=[],j=0,k=b[d].childs.length;j<k;j++)a.push(this.evalAux(b[d].childs[j]));g[d]=a}return g}"asign"==d?(g=b[0],b=b[1],1==g.childs.length&&"square_bracket"==g.childs[0].type?

(e=g.childs[0].childs,1==e.length?(e=this.evalAux(e[0]),e=0>e?0:f(e),this.vectors[g.value][e]=this.evalAux(b)):2==e.length&&(d=this.evalAux(e[0]),e=this.evalAux(e[1]),d=0>d?0:f(d),e=0>e?0:f(e),this.matrices[g.value][d][e]=this.evalAux(b))):this.variables[g.value]=this.evalAux(b)):console.log("Error en la evaluacion, expresion desconocida <"+g+"> \n"+a)}}};return a}(descartesJS||{}),descartesJS=function(a){var f,c,d;if(a.loadLib)return a;var b=2,g=!1;a.RTFNode=function(a,b,c,d){this.evaluator=a;this.type=

"rtfNode";this.value=b;this.nodeType=c;this.style=d;this.styleString=d.toString();this.color=d.textColor;this.underline=d.textUnderline;this.overline=d.textOverline;this.parent=null;this.childs=[];"textBlock"==this.nodeType?this.draw=this.drawTextBlock:"textLineBlock"==this.nodeType?this.draw=this.drawTextLineBlock:"formula"==this.nodeType?this.draw=this.drawFormula:"superIndex"==this.nodeType?this.draw=this.drawSuperIndex:"subIndex"==this.nodeType?this.draw=this.drawSubIndex:"dynamicText"==this.nodeType?

(this.draw=this.drawDynamicText,this.decimal_symbol=this.evaluator.parent.decimal_symbol):"fraction"==this.nodeType?this.draw=this.drawFraction:"numerator"==this.nodeType||"denominator"==this.nodeType?this.draw=this.drawNumDen:"radical"==this.nodeType?this.draw=this.drawRadical:"limit"==this.nodeType?this.draw=this.drawLimit:"integral"==this.nodeType?this.draw=this.drawIntegral:"sum"==this.nodeType?this.draw=this.drawSum:"matrix"==this.nodeType?this.draw=this.drawMatrix:"defparts"==this.nodeType?

this.draw=this.drawDefparts:"text"==this.nodeType||"newLine"==this.nodeType?this.draw=this.drawText:"mathSymbol"==this.nodeType?this.draw=this.drawMathSymbol:"index"==this.nodeType||"radicand"==this.nodeType||"from"==this.nodeType||"to"==this.nodeType||"what"==this.nodeType||"element"==this.nodeType?this.draw=this.drawGenericBlock:"componentNumCtrl"==this.nodeType?this.draw=this.drawComponentNumCtrl:"componentSpace"==this.nodeType&&(this.draw=this.drawComponentSpace)};a.RTFNode.prototype.getRoot=

function(){return null==this.parent?this:this.parent.getRoot()};a.RTFNode.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};d=c=f=0;a.RTFNode.prototype.getTextMetrics=function(){if("textBlock"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);for(var e=0,h=this.childs.length;e<h;e++)this.childs[e].getTextMetrics()}else if("textLineBlock"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),this.getBlockMetric();else if("newLine"==this.nodeType){this.spaceWidth=

a.getTextWidth(" ",this.styleString);var i=a.getFontMetrics(this.styleString);this.baseline=i.baseline;this.descent=i.descent;this.ascent=i.ascent;this.width=i.width;this.height=i.height}else if("text"==this.nodeType||"dynamicText"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);i=a.getFontMetrics(this.styleString);this.baseline=i.baseline;this.descent=i.descent;this.ascent=i.ascent;var e=this.value,j;"string"!=typeof this.value&&(h=void 0==this.decimals?b:this.evaluator.evalExpression(this.decimals),

j=void 0==this.fixed?g:this.fixed,e=this.evaluator.evalExpression(this.value,h,j),parseFloat(e)==e&&(e=parseFloat(e).toFixed(h),e=j?e:parseFloat(e),e=e.toString().replace(".",this.decimal_symbol)),e+=" ");this.width=a.getTextWidth(e,this.styleString);this.height=i.height}else if("formula"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),this.getBlockMetric();else if("superIndex"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),h=f,i=c,h=d,e=a.getFontMetrics(this.styleString),

this.getBlockMetric(),0>this.height&&(this.ascent=e.ascent,this.descent=e.descent,this.height=this.ascent+this.descent,this.width=1.5*this.spaceWidth),e=h/2-i+this.height,this.superIndexPos=e-this.ascent,this.ascent=e,this.descent=i,this.baseline=this.ascent,this.height=this.ascent+this.descent;else if("subIndex"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),h=f,i=c,e=a.getFontMetrics(this.styleString),this.getBlockMetric(),0>this.height&&(this.ascent=e.ascent,this.descent=e.descent,

this.height=this.ascent+this.descent,this.width=1.5*this.spaceWidth),this.subIndexPos=i+1,this.ascent=h,this.descent=this.subIndexPos+this.descent,this.baseline=this.ascent,this.height=this.ascent+this.descent;else if("fraction"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);i=c;h=d;j=this.childs[0];var o=this.childs[1],e=a.getFontMetrics(j.styleString);j.getBlockMetric();o.getBlockMetric();0>j.height&&(j.height=e.height,j.width=this.spaceWidth);0>o.height&&(o.height=e.height,

o.width=this.spaceWidth);this.height=j.height+o.height-1;this.ascent=j.height+h/2-i;this.descent=this.height-this.ascent;this.baseline=this.ascent;this.width=Math.max(j.width,o.width)+this.spaceWidth+8}else if("radical"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);i=this.childs[0].style.clone();if(1===this.childs.length)this.childs[1]=new a.RTFNode(this.evaluator,"","radicand",i),this.childs[1].addChild(this.childs[0]),this.childs[0]=new a.RTFNode(this.evaluator,"","index",

i);else if("index"!==this.childs[0].nodeType||"radicand"!==this.childs[1].nodeType){j=new a.RTFNode(this.evaluator,"","radicand",i);e=0;for(h=this.childs.length;e<h;e++)j.addChild(this.childs[e]);this.childs=[];this.childs[0]=new a.RTFNode(this.evaluator,"","index",i);this.childs[1]=j}i=this.childs[0];e=this.childs[1];i.getBlockMetric();e.getBlockMetric();this.ascent=e.height/2<i.height?e.height/2+i.height+2-e.descent:e.ascent+4;this.descent=e.descent;this.baseline=this.ascent;this.height=this.ascent+

this.descent;this.width=i.width+e.width+4*this.spaceWidth}else if("sum"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),i=this.childs[0],h=this.childs[1],j=this.childs[2],i.getBlockMetric(),h.getBlockMetric(),j.getBlockMetric(),-1==i.ascent&&(o=a.getFontMetrics(i.styleString),i.ascent=o.ascent,i.descent=o.descent,i.height=o.height),-1==h.ascent&&(o=a.getFontMetrics(h.styleString),h.ascent=o.ascent,h.descent=o.descent,h.height=o.height),e=a.getFontMetrics(this.styleString),this.ascent=

e.height+h.height>j.ascent?e.height-e.descent+h.height:j.ascent,this.descent=i.height>j.descent?i.height+e.descent:j.descent,this.baseline=this.ascent,this.height=this.ascent+this.descent,e=this.style.clone(),e.fontType="Times New Roman",e.Bold="bold",e=e.toString(),e=a.getTextWidth(String.fromCharCode(8721),e),this.width=Math.max(i.width,h.width,e)+Math.max(j.width,this.spaceWidth)+this.spaceWidth;else if("integral"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),i=this.childs[0],

h=this.childs[1],j=this.childs[2],i.getBlockMetric(),h.getBlockMetric(),j.getBlockMetric(),-1==i.ascent&&(o=a.getFontMetrics(i.styleString),i.ascent=o.ascent,i.descent=o.descent,i.height=o.height),-1==h.ascent&&(o=a.getFontMetrics(h.styleString),h.ascent=o.ascent,h.descent=o.descent,h.height=o.height),e=a.getFontMetrics(this.styleString),this.ascent=e.height+h.height>j.ascent?e.height-e.descent+h.height:j.ascent,this.descent=i.height>j.descent?i.height+e.descent:j.descent,this.baseline=this.ascent,

this.height=this.ascent+this.descent,e=this.style.clone(),e.fontSize*=1.5,e.fontType="Times New Roman",e.Bold="bold",e=e.toString(),e=a.getTextWidth(String.fromCharCode(8747),e),this.width=Math.max(i.width,h.width,e)+Math.max(j.width,this.spaceWidth)+2*this.spaceWidth;else if("limit"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),i=this.childs[0],h=this.childs[1],j=this.childs[2],e=a.getFontMetrics(this.styleString),i.getBlockMetric(),h.getBlockMetric(),j.getBlockMetric(),-1==

i.ascent&&(o=a.getFontMetrics(i.styleString),i.ascent=o.ascent,i.descent=o.descent,i.height=o.height),-1==h.ascent&&(o=a.getFontMetrics(h.styleString),h.ascent=o.ascent,h.descent=o.descent,h.height=o.height),-1==j.ascent&&(o=a.getFontMetrics(j.styleString),j.ascent=o.ascent,j.descent=o.descent,j.height=o.height),this.ascent=j.ascent,this.descent=Math.max(e.height,j.descent),this.baseline=this.ascent,this.height=this.ascent+this.descent,e=a.getTextWidth(" "+String.fromCharCode(8594),this.styleString),

0==i.width&&(i.width=this.spaceWidth),0==h.width&&(h.width=this.spaceWidth),0==j.width&&(j.width=this.spaceWidth),this.width=h.width+i.width+j.width+e+this.spaceWidth;else if("matrix"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);e=a.getFontMetrics(this.styleString);i=c;j=e.ascent;for(var o=e.descent,p=e.height,q=this.spaceWidth,m,t,e=0,h=this.childs.length;e<h;e++)this.childs[e].getBlockMetric(),m=this.childs[e].height,t=this.childs[e].width,p<m&&(p=m,j=this.childs[e].ascent,

o=this.childs[e].descent),q<t&&(q=t);this.childWidth=q+2*this.spaceWidth;this.childHeight=p;this.childAscent=j;this.childDescent=o;this.height=this.rows*p;this.ascent=this.height/2+i;this.descent=this.height-this.ascent;this.width=this.columns*this.childWidth+this.spaceWidth}else if("defparts"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);e=a.getFontMetrics(this.styleString);i=c;j=e.ascent;o=e.descent;p=e.height;q=this.spaceWidth;e=0;for(h=this.childs.length;e<h;e++)this.childs[e].getBlockMetric(),

m=this.childs[e].height,t=this.childs[e].width,p<m&&(p=m,j=this.childs[e].ascent,o=this.childs[e].descent),q<t&&(q=t);this.childWidth=q+2*this.spaceWidth;this.childHeight=p;this.childAscent=j;this.childDescent=o;this.height=this.parts*p;this.ascent=this.height/2+i;this.descent=this.height-this.ascent;this.width=q+this.spaceWidth/2}else"mathSymbol"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),i=a.getFontMetrics(this.styleString),this.baseline=i.baseline,this.descent=i.descent,

this.ascent=i.ascent,this.width=a.getTextWidth(this.value,this.styleString)+a.getTextWidth(" ",this.styleString),this.height=i.height):"componentNumCtrl"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),this.componentNumCtrl=this.evaluator.parent.getControlByCId(this.value),this.height=this.ascent=this.descent=this.baseline=0,this.width=this.componentNumCtrl.w):"componentSpace"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),this.componentSpace=this.evaluator.parent.getSpaceByCId(this.value),

this.height=this.ascent=this.descent=this.baseline=0,this.width=this.componentSpace.w):console.log("elemento no conocido",this.nodeType)};a.RTFNode.prototype.getBlockMetric=function(){this.width=0;for(var a=-1,b=-1,e,g=0,h=this.childs.length;g<h;g++){e=this.childs[g];e.getTextMetrics();childAscent=e.ascent;childDescent=e.descent;this.width+=e.width;var i=childDescent;e=e.height;f=childAscent;c=i;d=e;b<childAscent&&(b=childAscent);a<childDescent&&(a=childDescent)}this.ascent=b;this.descent=a;this.baseline=

this.ascent;this.height=this.ascent+this.descent};a.RTFNode.prototype.drawTextBlock=function(a,c,d,e,f,h){this.stableWidth||(this.getTextMetrics(),b=e,g=f);for(var i=f=e=0,j=this.childs.length;i<j;i++)0<i&&(f+=this.childs[i-1].height),"center"==h?e=-this.childs[i].width/2:"right"==h&&(e=-this.childs[i].width),this.childs[i].draw(a,c+e,d+f)};a.RTFNode.prototype.drawTextLineBlock=function(b,c,d){for(var e=0,f=0,g=this.childs.length;f<g;f++)0<f&&(e+=this.childs[f-1].width,"formula"==this.childs[f-1].nodeType&&

(e+=2*a.getTextWidth(" ",this.childs[f].styleString))),this.childs[f].draw(b,c+e,d+this.baseline)};a.RTFNode.prototype.drawFormula=function(a,b,c){for(var d=0,e=0,f=this.childs.length;e<f;e++)0<e&&(d+=this.childs[e-1].width),this.childs[e].draw(a,b+this.spaceWidth+d,c)};a.RTFNode.prototype.drawText=function(a,b,c){null!=this.color&&(a.fillStyle=this.color);a.font=this.styleString;a.textAlign="start";a.textBaseline="alphabetic";a.fillText(this.value,b-1,c);if(this.underline){var d="bold"==this.style.textBold,

e=d?1:0.5;a.lineWidth=d?2:1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b-1,parseInt(c+this.descent/2)+e);a.lineTo(b-1+this.width,parseInt(c+this.descent/2)+e);a.stroke()}this.overline&&(e=(d="bold"==this.style.textBold)?2:1.5,a.lineWidth=d?2:1,null!=this.color&&(a.strokeStyle=this.color),a.beginPath(),a.moveTo(b-1,parseInt(c-this.ascent)+e),a.lineTo(b-1+this.width,parseInt(c-this.ascent)+e),a.stroke())};a.RTFNode.prototype.drawDynamicText=function(c,d,e){var f=Math.floor(0.5*

this.spaceWidth),h=void 0==this.decimals?b:this.evaluator.evalExpression(this.decimals),i=void 0==this.fixed?g:this.fixed,j=this.evaluator.evalExpression(this.value,h,i);parseFloat(j)==j&&(j=i?parseFloat(j).toFixed(h):parseFloat(parseFloat(j).toFixed(h)),j=(""+j).replace(".",this.decimal_symbol));null!=this.color&&(c.fillStyle=this.color);c.font=this.styleString;c.textAlign="start";c.textBaseline="alphabetic";this.width=a.getTextWidth(j,this.styleString);c.fillText(j,f+d,e);this.underline&&(i=(h=

"bold"==this.style.textBold)?1:0.5,c.lineWidth=h?2:1,null!=this.color&&(c.strokeStyle=this.color),c.beginPath(),c.moveTo(f+d-1,parseInt(e+this.descent/2)+i),c.lineTo(f+d-1+this.width,parseInt(e+this.descent/2)+i),c.stroke());this.overline&&(i=(h="bold"==this.style.textBold)?2:1.5,c.lineWidth=h?2:1,null!=this.color&&(c.strokeStyle=this.color),c.beginPath(),c.moveTo(f+d-1,parseInt(e-this.ascent)+i),c.lineTo(f+d-1+this.width,parseInt(e-this.ascent)+i),c.stroke());this.width+=2*f};a.RTFNode.prototype.drawRadical=

function(a,b,c){var d=Math.floor(this.spaceWidth);this.childs[0].draw(a,b,Math.floor(c+this.childs[1].descent-this.childs[1].height/2-this.childs[0].descent));this.childs[1].draw(a,b+1.5*d+this.childs[0].width,c);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b,Math.floor(c+this.childs[1].descent-this.childs[1].height/2));a.lineTo(b+this.childs[0].width,Math.floor(c+this.childs[1].descent-this.childs[1].height/2));a.lineTo(b+this.childs[0].width+0.5*d,c+this.childs[1].descent);

a.lineTo(b+this.childs[0].width+1*d,c-this.childs[1].ascent);a.lineTo(b+this.childs[0].width+2*d+this.childs[1].width,c-this.childs[1].ascent);a.stroke()};a.RTFNode.prototype.drawFraction=function(a,b,c){this.childs[0].draw(a,b+(this.width-this.childs[0].width)/2,c-this.ascent);this.childs[1].draw(a,b+(this.width-this.childs[1].width)/2,c-this.ascent+this.childs[0].height-1);var d=Math.floor(0.5*this.spaceWidth);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b+d,

parseInt(c-this.ascent+this.childs[0].height)+0.5);a.lineTo(b-d+this.width-1,parseInt(c-this.ascent+this.childs[0].height)+0.5);a.stroke()};a.RTFNode.prototype.drawNumDen=function(a,b,c){for(var d=0,e=0,f=this.childs.length;e<f;e++)0<e&&(d+=this.childs[e-1].width),this.childs[e].draw(a,b+d,c+this.baseline)};a.RTFNode.prototype.drawSubIndex=function(a,b,c){for(var d=0,e=0,f=this.childs.length;e<f;e++)0<e&&(d+=this.childs[e-1].width),this.childs[e].draw(a,b+d,c+this.subIndexPos)};a.RTFNode.prototype.drawSuperIndex=

function(a,b,c){for(var d=0,e=0,f=this.childs.length;e<f;e++)0<e&&(d+=this.childs[e-1].width),this.childs[e].draw(a,b+d,c-this.superIndexPos)};a.RTFNode.prototype.drawLimit=function(b,c,d){var e=a.getFontMetrics(this.styleString),f=" "+String.fromCharCode(8594),g=a.getTextWidth(f,this.styleString);this.childs[0].draw(b,c,d+e.descent+this.childs[0].ascent);this.childs[1].draw(b,c+this.childs[0].width+g,d+e.descent+this.childs[1].ascent);this.childs[2].draw(b,c+g+this.childs[0].width+this.childs[1].width,

d);null!=this.color&&(b.fillStyle=this.color);b.font=this.styleString;b.textAlign="start";b.textBaseline="alphabetic";b.fillText("l\u00edm",c+this.childs[0].width,d);b.fillText(f,c+this.childs[0].width,d+e.descent+this.childs[0].ascent)};a.RTFNode.prototype.drawIntegral=function(b,c,d){var e=this.style.clone();e.fontSize*=1.5;e.fontType="Times New Roman";e.Bold="bold";var e=e.toString(),f=a.getTextWidth(String.fromCharCode(8747),e),g=a.getFontMetrics(e),h=Math.max(this.childs[0].width,this.childs[1].width,

Math.floor(1.5*f));this.childs[0].draw(b,c+f,d+g.descent+this.childs[0].ascent);this.childs[1].draw(b,c+f+this.spaceWidth/2,d-this.ascent+this.childs[1].ascent);this.childs[2].draw(b,c+h+f,d);null!=this.color&&(b.fillStyle=this.color);b.font=e;b.textAlign="start";b.textBaseline="alphabetic";b.fillText(String.fromCharCode(8747),c,d+g.descent/2)};a.RTFNode.prototype.drawSum=function(b,c,d){var e=this.style.clone();e.fontType="Times New Roman";e.Bold="bold";var e=e.toString(),f=a.getTextWidth(String.fromCharCode(8721),

e),g=a.getFontMetrics(this.styleString),h=Math.max(this.childs[0].width,this.childs[1].width,f);this.childs[0].draw(b,c+(h-this.childs[0].width)/2,d+g.descent+this.childs[0].ascent);this.childs[1].draw(b,c+(h-this.childs[1].width)/2,d-g.ascent-this.childs[1].descent);this.childs[2].draw(b,c+h,d);null!=this.color&&(b.fillStyle=this.color);b.font=e;b.textAlign="start";b.textBaseline="alphabetic";b.fillText(String.fromCharCode(8721),c+Math.floor((h-f)/2),d-5)};a.RTFNode.prototype.drawMatrix=function(a,

b,c){for(var d,e,f=0,g=this.childs.length;f<g;f++)d=f%this.columns,e=Math.floor(f/this.columns),this.childs[f].draw(a,2*this.spaceWidth+b+d*this.childWidth,c-this.ascent+this.childAscent+e*this.childHeight);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(Math.floor(b+this.spaceWidth)+0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.spaceWidth/2)+0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.spaceWidth/2)+0.5,c+this.descent+0.5);a.lineTo(Math.floor(b+this.spaceWidth)+

0.5,c+this.descent+0.5);a.moveTo(Math.floor(b+this.width-this.spaceWidth)-0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.width-this.spaceWidth/2)-0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.width-this.spaceWidth/2)-0.5,c+this.descent+0.5);a.lineTo(Math.floor(b+this.width-this.spaceWidth)-0.5,c+this.descent+0.5);a.stroke()};a.RTFNode.prototype.drawDefparts=function(a,b,c){for(var d=0,e=this.childs.length;d<e;d++)this.childs[d].draw(a,b+this.spaceWidth/4,c-this.ascent+this.childAscent+d%this.parts*

this.childHeight);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(Math.floor(b+this.spaceWidth/3)+0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.spaceWidth/6)+0.5,c-this.ascent+0.5+(this.spaceWidth/3-this.spaceWidth/6));a.lineTo(Math.floor(b+this.spaceWidth/6)+0.5,c+this.descent-this.height/2-(this.spaceWidth/3-this.spaceWidth/6));a.lineTo(b+0.5,c+this.descent-this.height/2);a.lineTo(Math.floor(b+this.spaceWidth/6)+0.5,c+this.descent-this.height/2+(this.spaceWidth/

3-this.spaceWidth/6));a.lineTo(Math.floor(b+this.spaceWidth/6)+0.5,c+this.descent+0.5-(this.spaceWidth/3-this.spaceWidth/6));a.lineTo(Math.floor(b+this.spaceWidth/3)+0.5,c+this.descent+0.5);a.stroke()};a.RTFNode.prototype.drawMathSymbol=function(a,b,c){a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color,a.fillStyle=this.color);a.beginPath();"("==this.value?(a.moveTo(b+this.spaceWidth,c-this.parent.ascent+this.height/10),a.quadraticCurveTo(b+this.spaceWidth/5,c+this.parent.descent-this.parent.height/

2,b+this.spaceWidth,c+this.parent.descent-this.height/10),a.stroke()):")"==this.value?(a.moveTo(b+this.spaceWidth,c-this.parent.ascent+this.height/10),a.quadraticCurveTo(b+this.spaceWidth+4*this.spaceWidth/5,c+this.parent.descent-this.parent.height/2,b+this.spaceWidth,c+this.parent.descent-this.height/10),a.stroke()):(a.font=this.styleString,a.textAlign="center",a.textBaseline="alphabetic",a.fillText(this.value,b+this.width/2,c))};a.RTFNode.prototype.drawGenericBlock=function(a,b,c){for(var d=0,e=

0,f=this.childs.length;e<f;e++)0<e&&(d+=this.childs[e-1].width),this.childs[e].draw(a,b+d,c)};a.RTFNode.prototype.drawComponentNumCtrl=function(a,b,c){this.getTextMetrics();this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+b+","+(c-this.parent.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")")};a.RTFNode.prototype.drawComponentSpace=function(a,b,c){this.getTextMetrics();this.componentSpace.xExpr=this.evaluator.parser.parse(b+"");this.componentSpace.yExpr=this.evaluator.parser.parse(c-

this.parent.ascent+"")};a.RTFNode.prototype.draw=function(a,b,c){console.log(">>> Dibujo desconocido ",this.nodeType);this.childs[0].draw(a,b,c)};var e=document.createElement("span");e.appendChild(document.createTextNode("\u00c1p Texto"));var h=document.createElement("div");h.setAttribute("style","display: inline-block; width: 1px; height: 0px;");var i=document.createElement("div");i.setAttribute("style","margin: 0; padding: 0;");i.appendChild(e);i.appendChild(h);var j={};a.getFontMetrics=function(a){if(j[a])return j[a];

e.setAttribute("style","font: "+a+"; margin: 0; padding: 0;");document.body.appendChild(i);var b={};h.style.verticalAlign="baseline";b.ascent=h.offsetTop-e.offsetTop;h.style.verticalAlign="bottom";b.height=h.offsetTop-e.offsetTop;b.descent=b.height-b.ascent;b.baseline=b.ascent;document.body.removeChild(i);return j[a]=b};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.RTFTokenizer=function(){};a.RTFTokenizer.prototype.tokenize=function(a){a&&(a=a.replace(/(\\\w+)(\\u\d+)/g,

"$1 $2"),a=a.replace(/\\u(\d+) /g,function(a,b){return String.fromCharCode(parseInt(b))}),a=a.replace(/\\{/g,String.fromCharCode(0)),a=a.replace(/\\}/g,String.fromCharCode(1)),a=a.replace(/&squot;/g,"'"),a=a.replace(/&amp;/g,"&"),a=a.replace(/&lt;/g,"<"),a=a.replace(/&gt;/g,">"));for(var c=[],d=a,b=0,g=0,e,h,i,j,k=function(a,e,f){c.push({type:a,value:e});d=d.slice(f);b=b+f};a&&b<a.length;)if(h=b,"{"==d[0])g++,k("openBlock",g,1);else if("}"==d[0])k("closeBlock",g,1),g--,""==d&&(b=a.length);else{if((e=

d.match(/^\\{/))&&e[1]){console.log("aqui");return}if((e=d.match(/^\\([\w\*]*)\\/))&&e[1])e=e[1],k("controlWord",e,e.length+1),b-=1;else if((e=d.match(/^\\(\w*)\s/))&&e[1])e=e[1],k("controlWord",e,e.length+2);else if((e=d.match(/^\\(\w*)\{/))&&e[1])e=e[1],k("controlWord",e,e.length+1),b-=1;else if((e=d.match(/^\\(\w*)\}/))&&e[1])e=e[1],k("controlWord",e,e.length+1),b-=1;else if((e=d.match(/^\\(\w*)\;\\/))&&e[1])e=e[1],k("controlWord",e,e.length+2),b-=1;else if((e=d.match(/^\\(\w*)\;\}/))&&e[1])e=

e[1],k("controlWord",e,e.length+2),b-=1;else if((e=d.match(/^\\(\w*)/))&&e[1])e=e[1],k("controlWord",e,e.length+1),b=a.length;else if("{"!=d[0]&&"}"!=d[0]&&"\\"!=d[0])e=d.indexOf("{"),h=d.indexOf("}"),i=d.indexOf("\\"),j=d.length,e=-1==e?j+1:e,h=-1==h?j+1:h,i=-1==i?j+1:i,e=Math.min(e,h,i),-1!=e&&0!=e?(k("text",d.substring(0,e).replace(String.fromCharCode(0),"{").replace(String.fromCharCode(1),"}"),e),""==d&&(b=a.length)):(k("text",d.replace(String.fromCharCode(0),"{").replace(String.fromCharCode(1),

"}"),d.length+1),b=a.length);else if(h==b){console.log("Error, simbolo no conocido: <<["+d+"]>>");return}}return c};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.RTFParser=function(f){this.evaluator=f;this.tokenizer=new a.RTFTokenizer};a.RTFParser.prototype.parse=function(f){var f=this.tokenizer.tokenize(f),f=checkMathSymboslInFormula(f),c={},d,b=2;if("openBlock"==f[0].type&&"fonttbl"==f[1].value){for(d=f[0].value;"closeBlock"!=f[b].type&&f[b].value!=d;)c[f[b].value]=

f[b+2].value.substring(0,f[b+2].value.length-1),b+=3;b++}var g={},e=0,h,i,j;if("openBlock"==f[b].type&&"colortbl"==f[b+1].value){d=f[b++].value;for(b++;"closeBlock"!=f[b].type&&f[b].value!=d;)h=parseInt(f[b++].value.substring(3)).toString(16),i=parseInt(f[b++].value.substring(5)).toString(16),j=parseInt(f[b++].value.substring(4)).toString(16),g[e++]="#"+(2>h.length?"0"+h:h)+(2>i.length?"0"+i:i)+(2>j.length?"0"+j:j);b++}d=new a.RTFNode(this.evaluator,"","textBlock","",!1,"");e=new a.RTFNode(this.evaluator,

"","textLineBlock","",!1,"");d.addChild(e);for(var k,l,n,r=j=i=h=!1,o=!1,p=!1,q=[new a.FontStyle(20,"Arial","","",!1,!1,null)],m=q[0],t=!0,v=-1,u=-1,s=[],y=!1,x=!1,z=!1,B=!1,C=f.length;b<C;b++)if("controlWord"==f[b].type&&c[f[b].value])m.fontType=c[f[b].value];else if("controlWord"==f[b].type&&f[b].value.match(/^fs(\d+)/))m.fontSize=parseInt(f[b].value.match(/^fs(\d+)/)[1]/2);else if("controlWord"==f[b].type&&"b"==f[b].value)m.textBold="bold";else if("controlWord"==f[b].type&&"b0"==f[b].value)m.textBold=

"";else if("controlWord"==f[b].type&&"i"==f[b].value)m.textItalic="italic";else if("controlWord"==f[b].type&&"i0"==f[b].value)m.textItalic="";else if("controlWord"==f[b].type&&"ul"==f[b].value)m.textUnderline=!0;else if("controlWord"==f[b].type&&"ulnone"==f[b].value)m.textUnderline=!1;else if("controlWord"==f[b].type&&"ol"==f[b].value)m.textOverline=!0;else if("controlWord"==f[b].type&&"olnone"==f[b].value)m.textOverline=!1;else if("controlWord"==f[b].type&&f[b].value.match(/^cf(\d+)/))m.textColor=

g[parseInt(f[b].value.substring(2))];else if("openBlock"==f[b].type)v=f[b].value,m=m.clone(),q.push(m),s.push(null);else if("closeBlock"==f[b].type)f[b].value==u&&(u=-1,h=!1,e=e.parent),q.pop(),m=q[q.length-1],s.pop();else if("controlWord"==f[b].type&&"par"==f[b].value){e.addChild(new a.RTFNode(this.evaluator,"","newLine",m.clone()));d=new a.RTFNode(this.evaluator,"","textLineBlock",m.clone());if("textBlock"!=e.nodeType)for(e=e.parent;"textBlock"!=e.nodeType;)e=e.parent;e.addChild(d);e=d}else if("controlWord"==

f[b].type&&"mjaformula"==f[b].value)y=!0,u=v,h=!0,d=new a.RTFNode(this.evaluator,"","formula",m.clone()),e.addChild(d),e=d,s[s.length-1]=d;else if("controlWord"==f[b].type&&("fraction"==f[b].value||"radicand"==f[b].value||"radical"==f[b].value||"what"==f[b].value||"sum"==f[b].value||"integral"==f[b].value||"limit"==f[b].value)){var w=s[s.length-2].style.clone();d=new a.RTFNode(this.evaluator,"",f[b].value,w);s[s.length-2].addChild(d);s[s.length-1]=d}else if("controlWord"==f[b].type&&"index"==f[b].value||

"to"==f[b].value||"from"==f[b].value)w=s[s.length-2].style.clone(),w.fontSize=parseInt(w.fontSize-0.2*w.fontSize),8>w.fontSize&&(w.fontSize=8),d=new a.RTFNode(this.evaluator,"",f[b].value,w),s[s.length-2].addChild(d),s[s.length-1]=d;else if("controlWord"==f[b].type&&("num"==f[b].value||"den"==f[b].value))w=s[s.length-2].style.clone(),w.fontSize=Math.round(w.fontSize-0.1*w.fontSize),8>w.fontSize&&(w.fontSize=8),"num"==f[b].value?d=new a.RTFNode(this.evaluator,"","numerator",w):"den"==f[b].value&&(d=

new a.RTFNode(this.evaluator,"","denominator",w)),s[s.length-2].addChild(d),s[s.length-1]=d;else if("controlWord"==f[b].type&&("subix"==f[b].value||"supix"==f[b].value))w=s[s.length-2].style.clone(),w.fontSize=Math.floor(w.fontSize-w.fontSize/3),8>w.fontSize&&(w.fontSize=8),"subix"==f[b].value?d=new a.RTFNode(this.evaluator,"","subIndex",w):"supix"==f[b].value&&(d=new a.RTFNode(this.evaluator,"","superIndex",w)),d.originalStyle=s[s.length-2].style.clone(),s[s.length-2].addChild(d),s[s.length-1]=d;

else if("controlWord"==f[b].type&&("defparts"==f[b].value||"matrix"==f[b].value||"element"==f[b].value))w=s[s.length-2].style.clone(),d=new a.RTFNode(this.evaluator,"",f[b].value,w),s[s.length-2].addChild(d),s[s.length-1]=d,"defparts"==f[b].value?n=d:"matrix"==f[b].value&&(l=d);else if("controlWord"==f[b].type&&"parts"==f[b].value)p=!0;else if("text"==f[b].type&&p)n.parts=parseInt(f[b].value),p=!1;else if("controlWord"==f[b].type&&"rows"==f[b].value)r=!0;else if("text"==f[b].type&&r)l.rows=parseInt(f[b].value),

r=!1;else if("controlWord"==f[b].type&&"columns"==f[b].value)o=!0;else if("text"==f[b].type&&o)l.columns=parseInt(f[b].value),o=!1;else if("controlWord"==f[b].type&&"expr"==f[b].value)t=!1,i=!0;else if("controlWord"==f[b].type&&"decimals"==f[b].value)j=!0;else if("text"==f[b].type&&j)k.decimals=this.evaluator.parser.parse(parseInt(f[b].value)+""),j=!1;else if("controlWord"==f[b].type&&"fixed1"==f[b].value)k.fixed=!0;else if("controlWord"==f[b].type&&"fixed0"==f[b].value)k.fixed=!1;else if(!("controlWord"==

f[b].type&&"component"==f[b].value))if("controlWord"==f[b].type&&"NumCtrl"==f[b].value)x=!0;else if("controlWord"==f[b].type&&"Space"==f[b].value)z=!0;else if("controlWord"==f[b].type&&"hyperlink"==f[b].value)B=!0;else if("text"==f[b].type&&B){textContent=f[b].value.split("|")[0];w=m.clone();w.textUnderline=!0;w.textColor="blue";d=new a.RTFNode(this.evaluator,textContent,"text",w);if("textLineBlock"!=e.nodeType)for(e=e.parent;"textLineBlock"!=e.nodeType;)e=e.parent;e.addChild(d);B=!1}else if("text"==

f[b].type&&x)d=new a.RTFNode(this.evaluator,f[b].value,"componentNumCtrl",m.clone()),e.addChild(d),x=!1;else if("text"==f[b].type&&z)d=new a.RTFNode(this.evaluator,f[b].value,"componentSpace",m.clone()),e.addChild(d),z=!1;else if("text"==f[b].type&&i)w=s[s.length-2].style.clone(),textContent=this.evaluator.parser.parse("''+("+f[b].value+")"),d=new a.RTFNode(this.evaluator,textContent,"dynamicText",w),s[s.length-2].addChild(d),k=s[s.length-1]=d,i=!1;else if("text"==f[b].type&&!i&&!h){textContent=f[b].value;

d=new a.RTFNode(this.evaluator,textContent,"text",m.clone());if("textLineBlock"!=e.nodeType)for(e=e.parent;"textLineBlock"!=e.nodeType;)e=e.parent;e.addChild(d)}else if("text"==f[b].type&&!i&&h)textContent=f[b].value,d=new a.RTFNode(this.evaluator,textContent,"text",s[s.length-1].style.clone()),s[s.length-1].addChild(d);else if("("==f[b].type||")"==f[b].type||"+"==f[b].type||"-"==f[b].type||"*"==f[b].type||"="==f[b].type)d=new a.RTFNode(this.evaluator,f[b].type,"mathSymbol",s[s.length-1].style.clone()),

s[s.length-1].addChild(d);if(null!=e){var A=e.getRoot();A.stableWidth=t;A.getTextMetrics();A.hasFormula=y}return A};a.FontStyle=function(a,c,d,b,g,e,h){this.fontSize=a;this.fontType=c;this.textItalic=d;this.textBold=b;this.textUnderline=g;this.textOverline=e;this.textColor=h};a.FontStyle.prototype.toString=function(){return(this.textBold+" "+this.textItalic+" "+this.fontSize+"px "+this.fontType).trim()};a.FontStyle.prototype.toCSS=function(){var a="style='font-family: "+this.fontType+"; font-size: "+

this.fontSize+"px; ";this.textUnderline&&!this.textOverline&&(a+="text-decoration: underline; ");!this.textUnderline&&this.textOverline&&(a+="text-decoration: overline; ");this.textUnderline&&this.textOverline&&(a+="text-decoration: underline overline; ");this.textBold&&!this.textItalic&&(a+="font-style: normal; font-weight: bold; ");!this.textBold&&this.textItalic&&(a+="font-style: italic; font-weight: normal; ");this.textBold&&this.textItalic&&(a+="font-style: italic; font-weight: bold; ");!this.textBold&&

!this.textItalic&&(a+="font-style: normal; font-weight: normal; ");this.textColor&&(a+="color: "+this.textColor+"; ");return a+"'"};a.FontStyle.prototype.clone=function(){return new a.FontStyle(this.fontSize,this.fontType,this.textItalic,this.textBold,this.textUnderline,this.textOverline,this.textColor)};checkMathSymboslInFormula=function(a){for(var c=[],d=!1,b=!1,g=[],e=0,h=a.length;e<h;e++){"openBlock"==a[e].type&&g.push(a[e].value);"closeBlock"==a[e].type&&(g.pop(),0>=g.length&&(d=!1));if("controlWord"==

a[e].type&&("expr"==a[e].value||"decimals"==a[e].value))b=!0;"controlWord"==a[e].type&&"mjaformula"==a[e].value&&(d=!0);if("text"==a[e].type&&d&&!b){for(var i=0,j=a[e].value,k="",l=0,n=j.length;l<n;l++)if("("==j.charAt(l)||")"==j.charAt(l)||"+"==j.charAt(l)||"-"==j.charAt(l)||"*"==j.charAt(l)||"="==j.charAt(l))k=j.substring(i,l),""!=k&&c.push({type:"text",value:k}),c.push({type:j.charAt(l),value:j.charAt(l)}),i=l+1;k=j.substring(i,l);""!=k&&c.push({type:"text",value:k})}else c.push(a[e]),"text"==

a[e].type&&b&&(b=!1)}return c};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor;a.Space=function(a,d){this.parent=a;this.evaluator=this.parent.evaluator;var b=this.evaluator.parser;this.values=d;this.type="R2";this.xExpr=b.parse("0");this.yExpr=b.parse("0");this.w=parseInt(a.container.width);this.h=parseInt(a.container.height);this.drawif=b.parse("1");this.fixed=2!=this.parent.version?!1:!0;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=

function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background="descinst.com.mja.descartes.DescartesJS.class"==this.parent.code||this.parent.arquimedes?"#f0f8fa":"#ffffff";this.net=2!=this.parent.version?"#c0c0c0":"";this.net10=2!=this.parent.version?"#808080":"";this.axes=2!=this.parent.version?"#808080":"";this.text="#ffafaf";this.numbers=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphics=[];

this.zIndex=a.zIndex;this.plecaHeight=this.parent.plecaHeight||0;this.displaceRegionNorth=this.parent.displaceRegionNorth||0;this.displaceRegionWest=this.parent.displaceRegionWest||0;for(var f in d)d.hasOwnProperty(f)&&(this[f]=d[f]);this.init()};a.Space.prototype.init=function(){this.displaceRegionNorth=this.parent.displaceRegionNorth||0;this.displaceRegionWest=this.parent.displaceRegionWest||0;var a=this.parent,d=this.evaluator,b=this.id,f,e=parseInt(this.parent.container.height),h=parseInt(this.parent.container.width);

d.setVariable(b+"._w",this.w);d.setVariable(b+"._h",this.h);this.x=d.evalExpression(this.xExpr)+this.displaceRegionWest;this.y=d.evalExpression(this.yExpr)+this.plecaHeight+this.displaceRegionNorth;this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px");if(!this.parent.hackChafaParaQueFuncionenLasEscenasDeArquimedes||"_BASE_"==this.id)(0<=this.y?(f=e-this.y,this.h>f&&(this.h=f)):(f=this.h+this.y,this.h=f>=e?e:f),0<=this.x)?(f=h-this.x,this.w>f&&(this.w=f)):(f=

this.w+this.x,this.w=f>=h?h:f);if(""!=this.imageSrc||!this.imageSrc.toLowerCase().match(/vacio.gif$/))this.image=a.getImage(this.imageSrc);this.OxExpr&&(h=this.OxExpr,"%"==h[h.length-1]?this.Ox=this.w*parseFloat(h)/100:(a=parseFloat(h),a!=h&&(a=0),this.Ox=a));this.OyExpr&&(h=this.OyExpr,"%"==h[h.length-1]?this.Oy=this.h*parseFloat(h)/100:(a=parseFloat(h),a!=h&&(a=0),this.Oy=a));2!=this.parent.version?(d.setVariable(b+"._w",this.w),d.setVariable(b+"._h",this.h),d.setVariable(b+".escala",this.scale),

d.setVariable(b+".Ox",this.Ox),d.setVariable(b+".Oy",this.Oy),d.setVariable(b+".mouse_x",0),d.setVariable(b+".mouse_y",0),d.setVariable(b+".mouse_pressed",0)):(d.setVariable("_w",this.w),d.setVariable("_h",this.h),d.setVariable("escala",this.scale),d.setVariable("Ox",this.Ox),d.setVariable("Oy",this.Oy),d.setVariable("mouse_x",0),d.setVariable("mouse_y",0),d.setVariable("mouse_pressed",0))};a.Space.prototype.addCtr=function(a){this.ctrs.push(a)};a.Space.prototype.addGraph=function(a){this.graphics.push(a)};

a.Space.prototype.getRelativeX=function(a){return(a-f(this.w/2+this.Ox))/this.scale};a.Space.prototype.getRelativeY=function(a){return(-a+f(this.h/2+this.Oy))/this.scale};a.Space.prototype.getAbsoluteX=function(a){return a*this.scale+f(this.w/2+this.Ox)};a.Space.prototype.getAbsoluteY=function(a){return-a*this.scale+f(this.h/2+this.Oy)};a.Space.prototype.findOffset=function(){var a=this.container,d;for(this.offsetTop=this.offsetLeft=0;a;){d=null;a.getAttribute&&(d=a.getAttribute("class"));if(d&&("DescartesSpace2DContainer"==

d||"DescartesAppContainer"==d))this.offsetLeft+=a.offsetLeft,this.offsetTop+=a.offsetTop;a=a.parentNode}};a.Space.prototype.getCursorPosition=function(c){c=a.getCursorPosition(c);return{x:c.x-this.offsetLeft,y:c.y-this.offsetTop}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,c=Math.round,d=2*Math.PI;a.Space2D=function(b,c){a.Space.call(this,b,c);this.backgroundCanvas=document.createElement("canvas");this.backgroundCanvas.setAttribute("id",this.id+"_background");

this.backgroundCanvas.setAttribute("width",this.w+"px");this.backgroundCanvas.setAttribute("height",this.h+"px");this.backgroundCtx=this.backgroundCanvas.getContext("2d");this.canvas=document.createElement("canvas");this.canvas.setAttribute("id",this.id+"_canvas");this.canvas.setAttribute("width",this.w+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("class","DescartesSpace2DCanvas");this.canvas.setAttribute("style","z-index: "+this.zIndex+";");this.ctx=this.canvas.getContext("2d");

this.graphicControlContainer=document.createElement("div");this.graphicControlContainer.setAttribute("id",this.id+"_graphicControls");this.graphicControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+this.zIndex+";");this.numericalControlContainer=document.createElement("div");this.numericalControlContainer.setAttribute("id",this.id+"_numericalControls");this.numericalControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+this.zIndex+

";");this.container=document.createElement("div");this.container.setAttribute("id",this.id);this.container.setAttribute("class","DescartesSpace2DContainer");this.container.setAttribute("style","left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.parent.arquimedes&&"#f0f8fa"===a.getColor(this.evaluator,this.background)&&this.container.setAttribute("style","left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+"; border: 1px solid #b8c4c8;");this.container.appendChild(this.backgroundCanvas);

this.container.appendChild(this.canvas);this.container.appendChild(this.graphicControlContainer);this.container.appendChild(this.numericalControlContainer);b.container.insertBefore(this.container,b.loader);this.findOffset();this.parent.images[this.id+".image"]=this.canvas;this.parent.images[this.id+".image"].ready=1;this.parent.images[this.id+".image"].complete=!0;this.evaluator.setVariable(this.id+".image",this.id+".image");this.parent.images[this.id+".back"]=this.backgroundCanvas;this.parent.images[this.id+

".back"].ready=1;this.parent.images[this.id+".back"].complete=!0;this.evaluator.setVariable(this.id+".back",this.id+".back");this.drawBefore=0<this.evaluator.evalExpression(this.drawif);"descartesJS_scenario"!==this.id&&this.registerMouseEvents()};a.extend(a.Space2D,a.Space);a.Space2D.prototype.update=function(a){var c=2!=this.parent.version?this.id+".Ox":"Ox",d=2!=this.parent.version?this.id+".Oy":"Oy",f=2!=this.parent.version?this.id+".escala":"escala",i=this.evaluator;i.setVariable(this.id+"._w",

this.w);i.setVariable(this.id+"._h",this.h);var j=this.x!=i.evalExpression(this.xExpr)+this.displaceRegionWest,k=this.y!=i.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.spaceChange=a||j||k||this.drawBefore!=0<i.evalExpression(this.drawif)||this.Ox!=i.getVariable(c)||this.Oy!=i.getVariable(d)||this.scale!=i.getVariable(f);this.x=j?i.evalExpression(this.xExpr)+this.displaceRegionWest:this.x;this.y=k?i.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:

this.y;this.Ox=i.getVariable(c);this.Oy=i.getVariable(d);this.scale=i.getVariable(f);this.drawBefore=0<i.evalExpression(this.drawif);1.0E-6>this.scale?(this.scale=1.0E-6,i.setVariable(f,0)):1E6<this.scale&&(this.scale=1E6,i.setVariable(f,1E6));j&&(this.container.style.left=this.x+"px");k&&(this.container.style.top=this.y+"px");(j||k)&&this.findOffset();if(0<i.evalExpression(this.drawif)){this.container.style.display="block";c=0;for(d=this.graphics.length;c<d;c++)a=this.graphics[c],""!=a.trace&&!this.spaceChange&&

!this.click&&!a.background&&a.drawTrace();this.drawBackground();this.draw()}else this.container.style.display="none"};a.Space2D.prototype.drawBackground=function(){if(this.spaceChange){var b=this.evaluator,c=this.backgroundCtx;c.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height);c.fillStyle=a.getColor(b,this.background);c.fillRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"==this.bg_display?

c.drawImage(this.image,0,0):"stretch"==this.bg_display?c.drawImage(this.image,0,0,this.w,this.h):"patch"==this.bg_display?(c.fillStyle=c.createPattern(this.image,"repeat"),c.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"==this.bg_display&&c.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));for(var d=this.scale,h=0,i=0>this.w+this.h?0:this.w+this.h;d>i;)d/=10,h++;for(;d<i/10;)d*=10;c.lineWidth=1;""!=this.net&&(c.strokeStyle=a.getColor(b,this.net),this.drawMarks(c,

d/10,-1));""!=this.net10&&(c.strokeStyle=a.getColor(b,this.net10),this.drawMarks(c,d,-1));""!=this.axes&&(c.strokeStyle=a.getColor(b,this.axes),c.beginPath(),c.moveTo(f(this.w/2+this.Ox)+0.5,0),c.lineTo(f(this.w/2+this.Ox)+0.5,this.h),c.moveTo(0,f(this.h/2+this.Oy)+0.5),c.lineTo(this.w,f(this.h/2+this.Oy)+0.5),c.stroke(),this.drawMarks(c,d,4),this.drawMarks(c,d/2,2),this.drawMarks(c,d/2/5,1));if(""!=this.x_axis||""!=this.y_axis)c.fillStyle=a.getColor(b,this.axes),c.font="12px Arial",c.textAlign="right",

c.textBaseline="top",c.fillText(this.x_axis,f(this.w)-2,f(this.h/2+this.Oy)),c.fillText(this.y_axis,f(this.w/2+this.Ox)-2,0);this.numbers&&""!=this.axes&&(c.fillStyle=a.getColor(b,this.axes),c.font="12px Arial",c.textAlign="start",c.textBaseline="bottom",d>(this.w+this.h)/2?this.drawNumbers(c,d/5,d<=this.scale?h+1:h):d>(this.w+this.h)/4?this.drawNumbers(c,d/2,d<=this.scale?h+1:h):this.drawNumbers(c,d,h));b=0;for(c=this.graphics.length;b<c;b++)d=this.graphics[b],d.background&&d.draw()}};a.Space2D.prototype.draw=

function(){var b=this.ctx,c;b.clearRect(0,0,this.canvas.width,this.canvas.height);for(var e=0,h=this.graphics.length;e<h;e++)c=this.graphics[e],c.background||c.draw();e=0;for(h=this.ctrs.length;e<h;e++)c=this.ctrs[e],"graphic"==c.type&&c.draw();if(""!=this.text&&this.click&&"LEFT"==this.whichButton){b.fillStyle=a.getColor(this.evaluator,this.text);b.strokeStyle=b.fillStyle;b.font="12px Courier New";b.textAlign="center";b.textBaseline="bottom";e=1>=this.scale?this.mouse_x.toFixed(0):this.mouse_x.toFixed(this.scale.toString().length);

h=1>=this.scale?this.mouse_y.toFixed(0):this.mouse_y.toFixed(this.scale.toString().length);e="("+e+","+h+")";h=b.measureText(e).width;c=this.getAbsoluteX(this.mouse_x);var i=this.getAbsoluteY(this.mouse_y),j=f(c),k=f(i-10);j+h/2>this.w?j=this.w-h/2:0>j-h/2&&(j=h/2);k+1>this.h?k=this.h:0>k-14&&(k=15);b.fillText(e,j,k);b.beginPath();b.arc(c,i,2.5,0,d,!0);b.stroke()}};a.Space2D.prototype.drawMarks=function(a,d,e){var h=this.w,i=this.h,j,k=0,l=h,n=0,r=i,o=f(h/2+this.Ox),p=f(i/2+this.Oy);0<=e&&(k=o-e,

l=o+e,n=p-e,r=p+e);a.beginPath();for(e=-c(o/d);(j=o+c(e*d))<h;e++)a.moveTo(j+0.5,n+0.5),a.lineTo(j+0.5,r+0.5);for(e=-c(p/d);(h=p+c(e*d))<i;e++)a.moveTo(k+0.5,h+0.5),a.lineTo(l+0.5,h+0.5);a.stroke()};a.Space2D.prototype.drawNumbers=function(a,d){for(var e=this.w,h=this.h,i,j=f(e/2+this.Ox),k=f(h/2+this.Oy),l=-c(j/d);(i=j+c(l*d))<e;l++)a.fillText(parseFloat((l*d/this.scale).toFixed(4)),i+2,k-2);for(l=-c(k/d);(e=k+c(l*d))<h;l++)a.fillText(parseFloat((-l*d/this.scale).toFixed(4)),j+2,e-2)};a.Space2D.prototype.registerMouseEvents=

function(){function b(a){l.click=1;l.parent.evaluator.setVariable(l.id+".mouse_pressed",1);l.parent.deactivateGraphiControls();i(a);window.addEventListener("touchmove",k,!1);window.addEventListener("touchend",c,!1);(!l.fixed||l.sensitive_to_mouse_movements)&&a.preventDefault()}function c(a){l.click=0;l.parent.evaluator.setVariable(l.id+".mouse_pressed",0);window.removeEventListener("touchmove",k,!1);window.removeEventListener("touchend",c,!1);a.preventDefault();l.parent.update()}function d(a){l.click=

1;l.parent.evaluator.setVariable(l.id+".mouse_pressed",1);l.parent.deactivateGraphiControls();l.whichButton=null==a.which?2>a.button?"LEFT":4==a.button?"MIDDLE":"RIGHT":2>a.which?"LEFT":2==a.which?"MIDDLE":"RIGHT";"RIGHT"==l.whichButton&&(window.addEventListener("mouseup",h,!1),l.fixed||(l.clickPosForZoom=l.getCursorPosition(a).y,l.tempScale=l.scale,window.addEventListener("mousemove",j,!1)));"LEFT"==l.whichButton&&(l.parent.evaluator.setVariable(l.id+".mouse_pressed",1),i(a),window.addEventListener("mousemove",

k,!1),window.addEventListener("mouseup",h,!1));a.preventDefault()}function h(a){l.click=0;l.parent.evaluator.setVariable(l.id+".mouse_pressed",0);a.preventDefault();"RIGHT"==l.whichButton&&window.removeEventListener("mousemove",j,!1);l.sensitive_to_mouse_movements||window.removeEventListener("mousemove",k,!1);window.removeEventListener("mouseup",h,!1);l.parent.update()}function i(a){l.posAnte=l.getCursorPosition(a);l.mouse_x=l.getRelativeX(l.posAnte.x);l.mouse_y=l.getRelativeY(l.posAnte.y);l.parent.evaluator.setVariable(l.id+

".mouse_x",l.mouse_x);l.parent.evaluator.setVariable(l.id+".mouse_y",l.mouse_y);l.parent.update()}function j(a){l.clickPosForZoomNew=l.getCursorPosition(a).y;l.evaluator.setVariable(2!=l.parent.version?l.id+".escala":"escala",l.tempScale+l.tempScale/45*((l.clickPosForZoom-l.clickPosForZoomNew)/10));l.parent.update();a.preventDefault()}function k(a){if(!l.fixed){l.posNext=l.getCursorPosition(a);var b=f(l.posAnte.x-l.posNext.x),c=f(l.posAnte.y-l.posNext.y),d=2!=l.parent.version?l.id+".Oy":"Oy";l.parent.evaluator.setVariable(2!=

l.parent.version?l.id+".Ox":"Ox",l.Ox-b);l.parent.evaluator.setVariable(d,l.Oy-c);l.posAnte.x-=b;l.posAnte.y-=c}l.click&&i(a);(!l.fixed||l.sensitive_to_mouse_movements)&&a.preventDefault()}var l=this,n=a.hasTouchSupport;this.canvas.oncontextmenu=function(){return!1};n&&(this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",i,!1),this.canvas.addEventListener("touchstart",b,!1));n||(this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",i,!1),this.canvas.addEventListener("mousedown",

d,!1))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.SpaceAP=function(f,c){a.Space.call(this,f,c);this.exportarVars=this.importarVars=null;var d=f.evaluator;this.file=this.file.match(/^\[/)&&this.file.match(/\]$/)?d.parser.parse(this.file.substring(1,this.file.length-1)):this.file.match(/^\'/)&&this.file.match(/\'$/)?d.parser.parse(this.file):d.parser.parse("'"+this.file+"'");this.oldFile=d.evalExpression(this.file);this.initFile()};a.extend(a.SpaceAP,a.Space);a.SpaceAP.prototype.initFile=

function(){this.firstUpdate=!0;var f;if(this.oldFile){var c=document.getElementById(this.oldFile);f=c&&"descartes/spaceApFile"==c.type?c.text:a.openExternalFile(this.oldFile);null!=f&&(f=f.split("\n"))}if(f&&f.toString().match(/<applet/gi)){for(var c="",d=!1,b=0,g=f.length;b<g&&!(f[b].match("<applet")&&(d=!0),d&&(c+=f[b]),f[b].match("</applet"));b++);b=document.createElement("div");b.innerHTML=c;b.firstChild.setAttribute("width",this.w);b.firstChild.setAttribute("height",this.h);c=this.descApp?this.descApp.container:

null;this.descApp=new a.DescartesApp(b.firstChild);this.descApp.container.setAttribute("class","DescartesAppContainer");this.descApp.container.setAttribute("style","position: absolute; overflow: hidden; background-color: "+this.background+"; width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");c?this.parent.container.replaceChild(this.descApp.container,c):this.parent.container.insertBefore(this.descApp.container,this.parent.loader);c=this.descApp.spaces;

b=0;for(g=c.length;b<g;b++)c[b].findOffset();this.descApp.container.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none";var e=this;this.descApp.update=function(){this.updateAuxiliaries();this.updateEvents();this.updateControls();this.updateSpaces();e.exportar()}}else c=this.descApp?this.descApp.container:null,this.descApp={},this.descApp.container=document.createElement("div"),this.descApp.container.setAttribute("class","DescartesAppContainer"),b="position: absolute; overflow: hidden; background-color: "+

this.background+"; width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";",this.image&&("topleft"==this.bg_display?b+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat;":"stretch"==this.bg_display?b+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat; background-size: 100% 100%;":"patch"==this.bg_display?b+="background-image: url("+this.imageSrc+");":"center"==this.bg_display&&(b+="background-image: url("+

this.imageSrc+"); background-repeat:no-repeat; background-position: center center;")),this.descApp.container.setAttribute("style",b),c?this.parent.container.replaceChild(this.descApp.container,c):this.parent.container.insertBefore(this.descApp.container,this.parent.loader),this.descApp.container.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none"};a.SpaceAP.prototype.update=function(){var a=this.evaluator.evalExpression(this.file);if(this.oldFile!=a)this.oldFile=a,this.initFile();

else{var a=this.x!=this.evaluator.evalExpression(this.xExpr),c=this.y!=this.evaluator.evalExpression(this.yExpr)+this.plecaHeight;this.x=a?this.evaluator.evalExpression(this.xExpr):this.x;this.y=c?this.evaluator.evalExpression(this.yExpr)+this.plecaHeight:this.y;a&&(this.descApp.container.style.left=this.x+"px");c&&(this.descApp.container.style.top=this.y+"px");if(a||c)for(var a=this.descApp.spaces,c=0,d=a.length;c<d;c++)a[c].findOffset();this.descApp.container.style.display=0<this.evaluator.evalExpression(this.drawif)?

"block":"none";if(this.firstUpdate&&(this.firstUpdate=!1,null==this.importarVars)){this.importarVars=[];for(var b in this.evaluator.variables)this.evaluator.variables.hasOwnProperty(b)&&b.match(/^public./)&&this.importarVars.push({varName:b,value:this.evaluator.getVariable(b)})}this.importar()}};a.SpaceAP.prototype.importar=function(){for(var a,c=!1,d=0,b=this.importarVars.length;d<b;d++)a=this.evaluator.getVariable(this.importarVars[d].varName),a!=this.importarVars[d].value&&(this.importarVars[d].value=

a,this.descApp.evaluator.setVariable(this.importarVars[d].varName,this.importarVars[d].value),c=!0);c&&this.descApp.update()};a.SpaceAP.prototype.exportar=function(){};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.SpaceHTML_IFrame=function(f,c){a.Space.call(this,f,c);var d=this.parent.evaluator;this.file=this.file.match(/^\[/)&&this.file.match(/\]$/)?d.parser.parse(this.file.substring(1,this.file.length-1)):this.file.match(/^\'/)&&this.file.match(/\'$/)?d.parser.parse(this.file):

d.parser.parse("'"+this.file+"'");this.oldFile=d.evalExpression(this.file);this.MyIFrame=document.createElement("iframe");this.MyIFrame.setAttribute("src",this.oldFile);this.MyIFrame.setAttribute("id",this.id);this.MyIFrame.setAttribute("marginheight",0);this.MyIFrame.setAttribute("marginwidth",0);this.MyIFrame.setAttribute("frameborder",0);this.MyIFrame.setAttribute("scrolling","auto");this.MyIFrame.setAttribute("style","position: absolute; width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+

"px; top: "+this.y+"px;");this.MyIFrame.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none";this.parent.container.insertBefore(this.MyIFrame,this.parent.loader);var b=this;this.MyIFrame.onload=function(){var a=this;b.evaluator.setFunction(b.id+".set",function(b,c){a.contentWindow.postMessage({type:"set",name:b,value:c},"*")});b.evaluator.setFunction(b.id+".update",function(){a.contentWindow.postMessage({type:"update"},"*")});b.evaluator.setFunction(b.id+".get",function(b,c){a.contentWindow.postMessage({type:"get",

name:b,value:c},"*")});b.evaluator.setFunction(b.id+".exec",function(b,c){a.contentWindow.postMessage({type:"exec",name:b,value:c},"*")})};this.evaluator.setVariable(this.id+"._scroll",0)};a.extend(a.SpaceHTML_IFrame,a.Space);a.SpaceHTML_IFrame.prototype.update=function(a){a&&(this.y=this.x=Math.Infinity);var a=this.evaluator,c=this.x!=a.evalExpression(this.xExpr)+this.displaceRegionWest,d=this.y!=a.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=c?a.evalExpression(this.xExpr)+

this.displaceRegionWest:this.x;this.y=d?a.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;var b=a.evalExpression(this.file);b!=this.oldFile&&(this.oldFile=b,this.MyIFrame.setAttribute("src",b));c&&(this.MyIFrame.style.left=this.x+"px");d&&(this.MyIFrame.style.top=this.y+"px");this.MyIFrame.style.display=0<a.evalExpression(this.drawif)?"block":"none";this.scrollVar=a.getVariable(this.id+"._scroll");1==this.scrollVar?this.MyIFrame.setAttribute("scrolling","yes"):-1==

this.scrollVar?this.MyIFrame.setAttribute("scrolling","no"):this.MyIFrame.setAttribute("scrolling","auto")};return a}(descartesJS||{}),babel=function(a){a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.no=a.ez=a.non=a["n\u00e3o"]="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a["sim "]="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto="#000000";a.maxenta=a.magenta="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=

"#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise="#00ffff";a.verde=a.green=a.verd=a.berdea=a.vert="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho="#ff0000";a.pink=a.rosa=a.arrosa=a.rose="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro="#404040";a.gris=a.gray=a.grisa=a.cinza="#808080";a.grisClaro=a.lightGray=

a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a.colour=a.color=a.kolorea=a.couleur=a.cor="color";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=

"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a.texto=a.text=a.testua=a.texte=

"text";a["cr\u00e9ditos"]=a.about=a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=

a["preencher+"]="fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.ancho=a.width=a.ample=a.zabalera=a.large=a.largura="width";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=

a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";

a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte="text";a.punto=a.point=a.punt=a.puntu=a.ponto="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem="image";a["Versi\u00f3n"]=

a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=a["num\u00e9rique"]=

"numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.texto=a.text=a.testu=a.texte="text";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer="do";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto="while";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=

a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]="function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=

"x-axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]="y-axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=

a.radi=a.erradio=a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=a.controis=

"controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.alto=a.height=a.alt=a.altu=a.haut=a.altura="height";a.x=a.left="x";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.ancho=a.profundidade=a.amplada="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.alto=a.height=a["al\u00e7ada"]=a.altu=a.hauteur=a.alto=a.altura=

a["al\u00e7ada"]="height";a.color_reverso=a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.macro=

a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";

a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]="raytrace";a.imagen=a.bg_image=a.imatge=a.irudia=a.imaxe=a.imagem_de_fundo="image";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=

a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.center=a.zentratu=a["centr\u00e9e"]=a.centrado="center";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=

a.files_sud="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]="initAnimation";a["Explicaci\u00f3n"]=

a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";

a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]="openURL";a["abrir Escena"]=

a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=

a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.imagen=a.image=a.imatge=a.irundia=a.imaxe=a.imagem="image";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=

a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra="left";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=

a.reproduire=a.reproduzir="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]="activeif";a.rotfin=a.finrot=a.bukrot="endrot";a.posfin=a.finpos=a.bukpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]="editable";a.tipo=a.type=a.tipus=a.mota="type";a.R2="R2";a.R3="R3";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=

a["fonte pontos"]="font_size";a.SansSerif="SansSerif";a.Serif="Serif";a.Monoespaciada=a.Monospaced=a.Monoespazada="Monospaced";a["ecuaci\u00f3n"]=a.equation=a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.punto=a.dot=a.punt=a.puntu=a.point=a.ponto="point";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes=

"columns";a.solo_texto=a.only_text=a.seulement_texte=a["s\u00f3_texto"]=a.tan_sols_texte="onlyText";a.evaluar=a.evaluate="evaluate";a.respuesta=a.answer="answer";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]=

"audio";a.autoplay="autoplay";a.loop="loop";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";return a}(babel||{}),descartesJS=function(a){if(a.loadLib)return a;a.Vector2D=function(a,c){this.x=a;this.y=c};a.Vector2D.AXIS_X=new a.Vector2D(1,0);a.Vector2D.AXIS_Y=new a.Vector2D(0,1);a.Vector2D.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};a.Vector2D.prototype.dotProduct=function(a){return this.x*

a.x+this.y*a.y};a.Vector2D.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.DescartesApp=function(c){this.applet=c;this.externalVariables={};this.parentContainer=c.parentNode;this.width=c.getAttribute("width");this.height=c.getAttribute("height");this.decimal_symbol=".";this.childs=c.getElementsByTagName("param");this.code=c.getAttribute("code");this.saveState=

[];this.images={};this.images.length=-1;this.audios={};this.audios.length=-1;this.evaluator=new a.Evaluator(this);this.lessonParser=new a.LessonParser(this);this.firstRun=!0;this.arquimedes=this.code.match("descinst.DescartesWeb2_0.class");this.licenseW2="{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;\\f1\\fcharset0 Arial;\\f2\\fcharset0 Arial;\\f3\\fcharset0 Arial;\\f4\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________ \\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una  {\\*\\hyperlink licencia Creative Commons|http://creativecommons.org/licenses/by-nc-sa/2.5/es/}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con DescartesWeb2.0, que es un producto de c\u00f3digo abierto del  {\\*\\hyperlink Ministerio de Educaci\u00f3n de Espa\u00f1a|http://recursostic.educacion.es/descartes/web/DescartesWeb2.0/} y\\par                                        el {\\*\\hyperlink Instituto de Matem\u00e1ticas|http://arquimedes.matem.unam.mx/} de la Universidad Nacional Aut\u00f3noma de M\u00e9xico, cedido bajo licencia {\\*\\hyperlink EUPL v 1.1|/resources/eupl_v1.1es.pdf}, con {\\*\\hyperlink c\u00f3digo en Java|http://recursostic.educacion.es/descartes/web/source/}.}";

this.licenseA="{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;\\f1\\fcharset0 Arial;\\f2\\fcharset0 Arial;\\f3\\fcharset0 Arial;\\f4\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________ \\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una  {\\*\\hyperlink licencia Creative Commons|http://creativecommons.org/licenses/by-nc-sa/2.5/es/}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Arqu\u00edmedes, que es un producto de c\u00f3digo abierto del  {\\*\\hyperlink Ministerio de Educaci\u00f3n de Espa\u00f1a|http://recursostic.educacion.es/descartes/web/DescartesWeb2.0/} y\\par                                        el {\\*\\hyperlink Instituto de Matem\u00e1ticas|http://arquimedes.matem.unam.mx/} de la Universidad Nacional Aut\u00f3noma de M\u00e9xico, cedido bajo licencia {\\*\\hyperlink EUPL v 1.1|/resources/eupl_v1.1es.pdf}, con {\\*\\hyperlink c\u00f3digo en Java|http://recursostic.educacion.es/descartes/web/source/}.}";

this.hackChafaParaQueFuncionenLasEscenasDeArquimedes=!1;if(this.arquimedes){for(var c=this.childs,d,b=0,f=0,e=0,h=c.length;e<h;e++)d=c[e],"rtf_height"==d.name&&(b=parseInt(d.value)),"Buttons"==babel[d.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(d.value),f=this.buttonsConfig.height);b&&(this.height=b+f+70)}this.init()};a.DescartesApp.prototype.init=function(){this.spaces=[];this.externalSpace={container:document.createElement("div"),controls:[]};this.northSpace={container:document.createElement("div"),

controls:[]};this.southSpace={container:document.createElement("div"),controls:[]};this.eastSpace={container:document.createElement("div"),controls:[]};this.westSpace={container:document.createElement("div"),controls:[]};this.specialSpace={container:document.createElement("div"),controls:[]};this.editableRegion={container:document.createElement("div"),textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.numberOfIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&

this.parentContainer.removeChild(this.container);this.container=document.createElement("div");this.loader=document.createElement("div");this.parentContainer.appendChild(this.container);this.container.width=this.width;this.container.height=this.height;this.container.setAttribute("class","DescartesAppContainer");this.container.setAttribute("style","width: "+this.width+"px; height:"+this.height+"px;");this.container.appendChild(this.loader);this.loader.width=this.width;this.loader.height=this.height;

this.loader.setAttribute("class","DescartesLoader");this.loader.setAttribute("style","width: "+this.width+"px; height:"+this.height+"px; z-index: 1000;");if(this.firstRun){var a=this,d="url("+f(this.loader.width,this.loader.height)+")";this.imageLoader=document.createElement("div");this.imageLoader.width=this.width;this.imageLoader.height=this.height;this.imageLoader.setAttribute("class","DescartesLoaderImage");this.imageLoader.setAttribute("style","background-image: "+d+"; width: "+this.width+"px; height:"+

this.height+"px;");this.loader.appendChild(this.imageLoader);d=new Image;d.onload=function(){a.imageLoader.setAttribute("style","background-image: url("+this.src+"); width: "+a.width+"px; height:"+a.height+"px; top: 0px; left: 0px")};d.src="images/DescartesLoader.png";this.loaderBar=document.createElement("canvas");this.loaderBar.width=this.width;this.loaderBar.height=this.height;this.loaderBar.setAttribute("class","DescartesLoaderBar");this.loaderBar.setAttribute("style","width: "+this.width+"px; height:"+

this.height+"px;");this.loaderBar.ctx=this.loaderBar.getContext("2d");this.loader.appendChild(this.loaderBar);this.barWidth=Math.floor(this.loader.width/10);this.barHeight=Math.floor(this.loader.height/70);this.timer=setInterval(function(){a.drawLoaderGraph(a.loaderBar.ctx,a.loaderBar.width,a.loaderBar.height)},10);this.firstRun=!1;this.initPreloader()}else this.initBuildApp()};a.DescartesApp.prototype.initAudio=function(c){var d=this;this.audios[c]=new Audio(c);this.audios[c].filename=c;var b=function(){this.ready=

1},f=function(){!this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))&&"mp3"==this.filename.substring(this.filename.length-3)?(d.audios[c]=new Audio(this.filename.replace("mp3","ogg")),d.audios[c].filename=this.filename.replace("mp3","ogg"),d.audios[c].addEventListener("canplaythrough",b,!1),d.audios[c].addEventListener("load",b,!1),d.audios[c].addEventListener("error",f,!1),d.audios[c].load()):(console.log("El archivo '"+c+"' no puede ser reproducido"),this.errorload=1)};this.audios[c].addEventListener("canplaythrough",

b,!1);this.audios[c].addEventListener("load",b,!1);this.audios[c].addEventListener("error",f,!1);a.hasTouchSupport?(this.audios[c].load(),this.audios[c].play(),setTimeout(function(){console.log("detenido");d.audios[c].pause()},10),this.audios[c].ready=1):this.audios[c].load()};a.DescartesApp.prototype.initPreloader=function(){this.images["lib/DescartesCCLicense.png"]=a.getCreativeCommonsLicenseImage();this.images["lib/DescartesCCLicense.png"].addEventListener("load",function(){this.ready=1},!1);this.images["lib/DescartesCCLicense.png"].addEventListener("error",

function(){this.errorload=1},!1);for(var c,d=0,b=this.childs.length;d<b;d++){var f=this.childs[d].value.match(/[\w-//]*(.png|.jpg|.gif|.svg|.PNG|.JPG|.GIF|.SVG)/g);if(f)for(var e=0,h=f.length;e<h;e++)c=f[e],!c.toLowerCase().match(/vacio.gif$/)&&""!=c.substring(0,c.length-4)&&(this.images[c]=new Image,this.images[c].addEventListener("load",function(){this.ready=1},!1),this.images[c].addEventListener("error",function(){this.errorload=1},!1),this.images[c].src=c);if(c=this.childs[d].value.match(/[\w-//]*(\.ogg|\.oga|\.mp3|\.wav|\.OGG|\.OGA\.MP3|\.WAV)/g)){e=

0;for(h=c.length;e<h;e++)f=c[e],this.initAudio(f)}this.childs[d].value.match(/vector|array|bektore|vecteur|matriz/g)&&this.childs[d].value.match(/archivo|file|fitxer|artxibo|fichier|arquivo/g)&&this.lessonParser.parseAuxiliar(this.childs[d].value)}var i=this,j;for(j in this.images)this.images.hasOwnProperty(j)&&this.images.length++;for(j in this.audios)this.audios.hasOwnProperty(j)&&this.audios.length++;var k=function(){i.readys=0;var a=i.images.length,b;for(b in i.images)i.images.hasOwnProperty(b)&&

(i.images[b].ready||i.images[b].errorload)&&i.readys++;var c=i.audios.length;for(b in i.audios)i.audios.hasOwnProperty(b)&&(i.audios[b].ready||i.audios[b].errorload)&&i.readys++;i.readys!=a+c?setTimeout(k,30):i.initBuildApp()};k()};a.DescartesApp.prototype.getImage=function(a){if(a)return this.images[a]||(this.images[a]=new Image,this.images[a].src=a,this.images[a].addEventListener("load",function(){this.ready=1},!1),this.images[a].addEventListener("error",function(){this.errorload=1},!1)),this.images[a]};

a.DescartesApp.prototype.getAudio=function(a){var d=this;if(!this.audios[a]){this.audios[a]=new Audio(a);this.audios[a].addEventListener("canplaythrough",function(){this.ready=1},!1);var b=function(){!this.canPlayType("audio/"+a.substring(a.length-3))&&"mp3"==a.substring(a.length-3)?(d.audios[a]=new Audio(a.replace("mp3","ogg")),d.audios[a].addEventListener("canplaythrough",onCanPlayThrough,!1),d.audios[a].addEventListener("load",onCanPlayThrough,!1),d.audios[a].addEventListener("error",b,!1),d.audios[a].load()):

(console.log("El archivo '"+a+"' no puede ser reproducido"),this.errorload=1)};this.audios[a].addEventListener("error",b,!1);this.audios[a].play();setTimeout(function(){d.audios[a].pause()},10)}return this.audios[a]};a.DescartesApp.prototype.drawLoaderGraph=function(a,d,b){var f=2*(this.barWidth-2)/(this.images.length+this.audios.length);a.translate(d/2,b-50);a.scale(2,2);a.strokeRect(-this.barWidth,-this.barHeight,2*this.barWidth,this.barHeight);a.fillStyle="gray";a.fillRect(-this.barWidth+2,-this.barHeight+

2,2*(this.barWidth-2),this.barHeight-4);a.fillStyle="#1f375d";a.fillRect(-this.barWidth+2,-this.barHeight+2,this.readys*f,this.barHeight-4);a.setTransform(1,0,0,1,0,0)};var f=function(a,d){var b=document.createElement("canvas");b.width=a;b.height=d;var f=b.getContext("2d");f.save();f.strokeStyle="#1f375d";f.fillStyle="#1f375d";f.lineCap="round";f.lineWidth=2;f.beginPath();f.translate((a-360)/2,(d-195)/2);f.scale(3,3);f.moveTo(3,25);f.lineTo(3,1);f.lineTo(21,1);f.bezierCurveTo(33,1,41,15,41,25);f.stroke();

f.beginPath();f.moveTo(1,63);f.lineTo(1,64);f.moveTo(5,62);f.lineTo(5,64);f.moveTo(9,61);f.lineTo(9,64);f.moveTo(13,60);f.lineTo(13,64);f.moveTo(17,58);f.lineTo(17,64);f.moveTo(21,56);f.lineTo(21,64);f.moveTo(25,53);f.lineTo(25,64);f.moveTo(29,50);f.lineTo(29,64);f.moveTo(33,46);f.lineTo(33,64);f.moveTo(37,41);f.lineTo(37,64);f.moveTo(41,32);f.lineTo(41,64);f.stroke();f.font="20px Arial";f.fillText("escartes",45,33);f.fillText("JS",98,64);f.restore();return b.toDataURL()};a.DescartesApp.prototype.initBuildApp=

function(){for(var a=this.childs,d=this.lessonParser,b=[],f=[],e=[],h=[],i=[],j=[],k=0,l=a.length;k<l;k++){childs_i=a[k];if("pleca"==childs_i.name){var n=d.parsePleca(childs_i.value,this.width);this.container.insertBefore(n,this.loader);this.plecaHeight=n.imageHeight?n.imageHeight:n.offsetHeight}"Buttons"==babel[childs_i.name]?this.buttonsConfig=d.parseButtonsConfig(childs_i.value):"decimal_symbol"==babel[childs_i.name]?this.decimal_symbol=childs_i.value:"version"==babel[childs_i.name]?this.version=

parseInt(childs_i.value):"language"==babel[childs_i.name]?this.language=childs_i.value:"enable"==babel[childs_i.getAttribute("enable")]?this.enable=babel[childs_i.getAttribute("enable")]:"rtf"==childs_i.name?(n=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45,h.push("space='descartesJS_scenario' type='text' expresion='[10,20]' background='yes' text='"+childs_i.value.replace(/'/g,"&squot;")+"'"),h.push("space='descartesJS_scenario' type='text' expresion='[10,"+(n-25)+"]' background='yes' text='"+

this.licenseA+"'"),h.push("space='descartesJS_scenario' type='image' expresion='[15,"+n+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")):"E"==childs_i.name.charAt(0)?(childs_i.value.match(/'HTMLIFrame'/)&&this.numberOfIframes++,childs_i.value.match("'_BASE_'")&&(this.hackChafaParaQueFuncionenLasEscenasDeArquimedes=!0),b.push(childs_i.value)):"C"==childs_i.name.charAt(0)&&"_"==childs_i.name.charAt(1)?f.push(childs_i.value):"A"==childs_i.name.charAt(0)&&"Animation"!=babel[childs_i.name]?

e.push(childs_i.value):"G"==childs_i.name.charAt(0)?h.push(childs_i.value):"S"!=childs_i.name.charAt(0)&&"Animation"==babel[childs_i.name]&&j.push(childs_i.value)}this.scenarioRegion={container:document.createElement("div"),scroll:0};this.scenarioRegion.container.setAttribute("id","descartesJS_Scenario_Region");this.scenarioRegion.scenarioSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_scenario' fondo='blanco' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+this.width+

"' alto='"+this.height+"'");this.scenarioRegion.container.appendChild(this.scenarioRegion.scenarioSpace.container);this.arquimedes&&(this.container.appendChild(this.scenarioRegion.container),this.spaces.push(this.scenarioRegion.scenarioSpace));k=0;for(l=b.length;k<l;k++)a=d.parseSpace(b[k]),this.arquimedes&&this.scenarioRegion.container.appendChild(a.container),this.spaces.push(a),this.zIndex++;k=0;for(l=h.length;k<l;k++)if(b=d.parseGraphic(h[k]))b.visible&&(this.editableRegionVisible=!0),b.space.addGraph(b);

k=0;for(l=i.length;k<l;k++)(b=d.parse3DGraphic(i[k]))&&b.space.addGraph(b);k=0;for(l=f.length;k<l;k++)this.controls.push(d.parseControl(f[k]));k=0;for(l=e.length;k<l;k++)d.parseAuxiliar(e[k]);k=0;for(l=j.length;k<l;k++)this.animation=d.parseAnimation(j[k]);this.configRegions();this.updateAuxiliaries();k=0;for(l=this.controls.length;k<l;k++)this.controls[k].init();this.updateControls();this.updateSpaces(!0);var r=this;this.numberOfIframes?setTimeout(function(){r.finishInit()},250*this.numberOfIframes):

this.finishInit()};a.DescartesApp.prototype.finishInit=function(){this.update();this.loader.style.display="none";this.parentContainer.style="overflow: hidden;";clearTimeout(this.timer);this.enable&&(this.blocker=document.createElement("div"),this.blocker.setAttribute("class","blocker"),this.blocker.setAttribute("style","width: "+this.width+"px; height: "+this.height+"px"),this.container.appendChild(this.blocker))};a.DescartesApp.prototype.configRegions=function(){var c=this.evaluator.parser,d=this.buttonsConfig,

b=this.container,f=0,e=0,h=0,i=h=0,j=0,k=0,l=0,n=0,k=this.northSpace.controls,r=this.southSpace.controls,o=this.eastSpace.controls,p=this.westSpace.controls;if(0<d.rowsNorth||0<k.length||d.about||d.config){0>=d.rowsNorth?(f=d.height,d.rowsNorth=1):f=d.height*d.rowsNorth;var q=this.northSpace.container;q.setAttribute("id","descartesJS_northRegion");q.setAttribute("style","width: "+b.width+"; height: "+f+"px; background: #c0c0c0; position: absolute; left: 0px; top: 0px; z-index: 100;");b.insertBefore(q,

this.loader);var j=b.width,m=0;d.about&&(m=100,j-=m);d.config&&(j-=100);for(var q=Math.ceil(k.length/d.rowsNorth),t=j/q,h=0,v=k.length;h<v;h++)k[h].expresion=c.parse("("+(m+t*(h%q))+","+d.height*Math.floor(h/q)+","+t+","+d.height+")"),k[h].drawif=c.parse("1");if(d.about){var u;"espa\u00f1ol"==this.language?u="cr\u00e9ditos":"english"==this.language&&(u="about");new a.Button(this,{region:"north",name:u,font_size:c.parse("15"),expresion:c.parse("(0, 0, 100, "+f+")")})}d.config&&("espa\u00f1ol"==this.language?

u="config":"english"==this.language&&(u="config"),new a.Button(this,{region:"north",name:u,font_size:c.parse("15"),action:"config",expresion:c.parse("("+(j+100)+", 0, 100, "+f+")")}))}if(0<d.rowsSouth||0<r.length||d.init||d.clear){0>=d.rowsSouth?(e=d.height,d.rowsSouth=1):e=d.height*d.rowsSouth;k=b.width;m=0;d.init&&(m=100,k-=m);d.clear&&(k-=100);q=this.southSpace.container;q.setAttribute("id","descartesJS_southRegion");q.setAttribute("style","width: "+b.width+"; height: "+e+"px; background: #c0c0c0; position: absolute; left: 0px; top: "+

(b.height-e)+"px; z-index: 100;");b.insertBefore(q,this.loader);q=Math.ceil(r.length/d.rowsSouth);t=k/q;h=0;for(v=r.length;h<v;h++)r[h].expresion=c.parse("("+(m+t*(h%q))+","+d.height*Math.floor(h/q)+","+t+","+d.height+")"),r[h].drawif=c.parse("1");d.init&&("espa\u00f1ol"==this.language?u="inicio":"english"==this.language&&(u="init"),new a.Button(this,{region:"south",name:u,font_size:c.parse("15"),action:"init",expresion:c.parse("(0, 0, 100, "+e+")")}));d.clear&&("espa\u00f1ol"==this.language?u="limpiar":

"english"==this.language&&(u="clear"),new a.Button(this,{region:"south",name:u,font_size:c.parse("15"),action:"clear",expresion:c.parse("("+(k+100)+", 0, 100, "+e+")")}))}if(0<o.length){h=b.height-f-e;l=d.widthEast;q=this.eastSpace.container;q.setAttribute("id","descartesJS_eastRegion");q.setAttribute("style","width: "+l+"; height: "+h+"px; background: #c0c0c0; position: absolute; left: "+(b.width-l)+"px; top: "+f+"px; z-index: 100;");b.insertBefore(q,this.loader);h=0;for(v=o.length;h<v;h++)o[h].expresion=

c.parse("(0,"+d.height*h+","+l+","+d.height+")"),o[h].drawif=c.parse("1")}if(0<p.length){h=b.height-f-e;n=d.widthWest;q=this.westSpace.container;q.setAttribute("id","descartesJS_westRegion");q.setAttribute("style","width: "+n+"; height: "+h+"px; background: #c0c0c0; position: absolute; left: 0px; top: "+f+"px; z-index: 100;");b.insertBefore(q,this.loader);h=0;for(v=p.length;h<v;h++)p[h].expresion=c.parse("(0,"+d.height*h+","+n+","+d.height+")"),p[h].drawif=c.parse("1")}if(this.editableRegionVisible){i=

d.height;q=this.editableRegion.container;q.setAttribute("id","descartesJS_editableRegion");q.setAttribute("style","width: "+b.width+"px; height: "+i+"px; position: absolute; left: 0px; top: "+(b.height-e-d.height)+"px; z-index: 100; background: #c0c0c0; overflow: hidden;");b.insertBefore(q,this.loader);c=this.editableRegion.textFields;d=b.width/c.length;h=0;for(v=c.length;h<v;h++)"div"==c[h].type?(q.appendChild(c[h].container),c[h].container.setAttribute("style","font-family: Arial; width: "+(d-4)+

"px; height: "+(i-5)+"px; position: absolute; left: "+h*d+"px; top: 0px; border: 2px groove white;"),p=c[h].container.firstChild,u=p.offsetWidth,p.setAttribute("style","font-family: Arial; padding-top: 0%; background-color: lightgray; position: absolute; left: 0px; top: 0px; width: "+u+"px;"),p.firstChild.textContent=p.firstChild.textContent.substring(1,p.firstChild.textContent.length-1),c[h].container.lastChild.setAttribute("style","font-family: 'Courier New'; width: "+(d-u-8)+"px; height: "+(i-

9)+"px; position: absolute; left: "+u+"px; top: 0px; border: 2px groove white;")):(q.appendChild(c[h]),c[h].setAttribute("style","font-family: 'Courier New'; width: "+d+"px; height: "+i+"px; position: absolute; left: "+h*d+"px; top: 0px; border: 2px groove white;"))}this.displaceRegionNorth=f;this.displaceRegionWest=n;b.width-=l;b.height=b.height-e-i;h=0;for(v=this.spaces.length;h<v;h++)this.spaces[h].init("joel")};a.DescartesApp.prototype.update=function(){this.updateAuxiliaries();this.updateEvents();

this.updateControls();this.updateSpaces()};a.DescartesApp.prototype.deactivateGraphiControls=function(){for(var a,d=0,b=this.controls.length;d<b;d++)a=this.controls[d],"graphic"==a.type&&a.deactivate()};a.DescartesApp.prototype.updateAuxiliaries=function(){for(var a=0,d=this.auxiliaries.length;a<d;a++)this.auxiliaries[a].update()};a.DescartesApp.prototype.updateEvents=function(){for(var a=0,d=this.events.length;a<d;a++)this.events[a].update()};a.DescartesApp.prototype.updateControls=function(){for(var a=

0,d=this.controls.length;a<d;a++)this.controls[a].update()};a.DescartesApp.prototype.updateSpaces=function(a){for(var d=0,b=this.spaces.length;d<b;d++)this.spaces[d].update(a)};a.DescartesApp.prototype.clear=function(){for(var a=0,d=this.spaces.length;a<d;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground()};a.DescartesApp.prototype.play=function(){this.animation&&this.animation.play()};a.DescartesApp.prototype.stop=function(){this.animation&&this.animation.stop()};a.DescartesApp.prototype.reinitAnimation=

function(){this.animation&&this.animation.reinit()};a.DescartesApp.prototype.getControlById=function(a){for(var d,b=0,f=this.controls.length;b<f;b++)if(d=this.controls[b],d.id==a)return d;return{update:function(){}}};a.DescartesApp.prototype.getSpaceByCId=function(a){for(var d,b=0,f=this.spaces.length;b<f;b++)if(d=this.spaces[b],d.cID==a)return d;return{update:function(){},w:0}};a.DescartesApp.prototype.getSpaceById=function(a){for(var d,b=0,f=this.spaces.length;b<f;b++)if(d=this.spaces[b],d.id==

a)return d;return{update:function(){},w:0}};a.DescartesApp.prototype.getControlByCId=function(a){for(var d,b=0,f=this.controls.length;b<f;b++)if(d=this.controls[b],d.cID==a)return d;return{update:function(){},w:0}};a.DescartesApp.prototype.getState=function(){var a=this.evaluator.variables,d,b="",f;for(f in a)a.hasOwnProperty(f)&&(d=a[f],"string"==typeof d&&(d="'"+d+"'"),"rnd"!=f&&"pi"!=f&&"e"!=f&&"Infinity"!=f&&"-Infinity"!=f&&"object"!=typeof d&&(b=""!=b?b+"\n"+f+"="+d:f+"="+d));return b};a.DescartesApp.prototype.setState=

function(a){for(var a=a.split("\\n"),d,b=0,f=a.length;b<f;b++)d=this.evaluator.parser.parse(a[b],!0),this.evaluator.evalExpression(d),this.saveState.push(d)};a.DescartesApp.prototype.getEvaluation=function(){for(var a=0,d=0,b="",f=0,e=this.controls.length;f<e;f++)"textfield"==this.controls[f].gui&&this.controls[f].evaluate&&(a++,d+=this.controls[f].ok,this.controls[f].value=""==this.controls[f].value?"''":this.controls[f].value,b+=" \\n "+this.controls[f].id+"="+this.controls[f].value+"|"+this.controls[f].ok);

return"questions="+a+" \\n correct="+d+" \\n wrong="+(a-d)+b};a.DescartesApp.prototype.showSolution=function(){for(var a=0,d=this.controls.length;a<d;a++)"textfield"==this.controls[a].gui&&this.controls[a].evaluate&&this.controls[a].changeValue(this.controls[a].getFirstAnswer());this.update()};a.DescartesApp.prototype.showAnswer=function(){for(var a=0,d=this.saveState.length;a<d;a++)this.evaluator.evalExpression(this.saveState[a]);this.update()};return a}(descartesJS||{}),descartesJS=function(a){function f(){var a=

document.getElementById("StyleDescartesApps");a&&a.parentNode.removeChild(a);a=document.createElement("style");a.id="StyleDescartesApps";a.type="text/css";a.setAttribute("rel","stylesheet");a.innerHTML="applet.DescartesJS {display:none;} applet {display:none;}";document.head.appendChild(a)}function c(){for(var b=0,c=a.apps.length;b<c;b++)for(var d=0,f=a.apps[b].spaces.length;d<f;d++)a.apps[b].spaces[d].findOffset()}function d(){a.getFeatures();if(a.hasCanvasSupport){for(var b=document.getElementsByTagName("*"),

d=[],e=0,f=b.length;e<f;e++)"DescartesAppContainer"==b[e].className&&d.push(b[e]);e=0;for(f=d.length;e<f;e++)d[e].parentNode.removeChild(d[e]);for(var d=document.getElementsByTagName("applet"),b=[],f=0,i=d.length;f<i;f++)e=d[f],(e.getAttribute("code").match("DescartesJS")||e.getAttribute("code").match("Descartes.class")||e.getAttribute("code").match("descinst.DescartesWeb2_0.class"))&&b.push(e);e=0;for(f=b.length;e<f;e++)d=b[e],a.apps.push(new a.DescartesApp(d)),d.className="DescartesJS";document.getElementById("StyleDescartesApps").innerHTML=

"applet.DescartesJS {display:none;}";window.addEventListener("resize",c,!1)}else document.getElementById("StyleDescartesApps").innerHTML="applet {display:block;}"}a.apps=[];a.getDescartesApps=function(){return a.apps};(!window.hasOwnProperty("debugDescartesJS")||!debugDescartesJS)&&f();a.receiveMessage=function(b){if(0!==a.apps.length)if((b=b.data)&&"set"===b.type)a.apps[0].evaluator.setVariable(b.name,b.value);else if(b&&"update"===b.type)a.apps[0].update();else if(b&&"exec"===b.type){var c=a.apps[0].evaluator.getFunction(b.name),

d=[];""!==b.value&&(d=b.value.toString().split(","));c&&c.apply(a.evaluator,d)}};void 0===a.loadLib&&(a.loadLib=!0,window.addEventListener("load",d,!1),window.addEventListener("message",a.receiveMessage,!1));return a}(descartesJS||{});

