/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2025-03-07
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var h=0;return function(){return h<a.length?{done:!1,value:a[h++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var h="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return h?h.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var h,d=[];!(h=a.next()).done;)d.push(h.value);return d};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var h=function(){};h.prototype=a;return new h};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},h={};try{return h.__proto__=a,h.a}catch(d){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,h){a.__proto__=h;if(a.__proto__!==h)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,h){a.prototype=$jscomp.objectCreate(h.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var d=$jscomp.setPrototypeOf;d(a,h)}else for(d in h)if("prototype"!=d)if(Object.defineProperties){var c=Object.getOwnPropertyDescriptor(h,d);c&&Object.defineProperty(a,d,c)}else a[d]=h[d];a.superClass_=h.prototype};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,h,d){a!=Array.prototype&&a!=Object.prototype&&(a[h]=d.value)};$jscomp.polyfill=function(a,h,d,c){if(h){d=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var r=a[c];r in d||(d[r]={});d=d[r]}a=a[a.length-1];c=d[a];h=h(c);h!=c&&null!=h&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:h})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(a){function h(){this.batch_=null}function d(a){return a instanceof r?a:new r(function(b,c){b(a)})}if(a&&!$jscomp.FORCE_POLYFILL_PROMISE)return a;h.prototype.asyncExecute=function(a){if(null==this.batch_){this.batch_=[];var b=this;this.asyncExecuteFunction(function(){b.executeBatch_()})}this.batch_.push(a)};var c=$jscomp.global.setTimeout;h.prototype.asyncExecuteFunction=function(a){c(a,0)};h.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var g=0;g<a.length;++g){var c=a[g];a[g]=null;try{c()}catch(e){this.asyncThrow_(e)}}}this.batch_=null};h.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var r=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(m){b.reject(m)}};r.prototype.createResolveAndReject_=function(){function a(a){return function(b){d||(d=!0,a.call(c,b))}}var c=this,d=!1;
return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};r.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof r)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};r.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(m){this.reject_(m);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};r.prototype.reject_=function(a){this.settle_(2,a)};r.prototype.fulfill_=function(a){this.settle_(1,a)};r.prototype.settle_=function(a,c){if(0!=this.state_)throw Error("Cannot settle("+a+", "+c+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=c;this.executeOnSettledCallbacks_()};r.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=0;a<this.onSettledCallbacks_.length;++a)l.asyncExecute(this.onSettledCallbacks_[a]);
this.onSettledCallbacks_=null}};var l=new h;r.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};r.prototype.settleSameAsThenable_=function(a,c){var b=this.createResolveAndReject_();try{a.call(c,b.resolve,b.reject)}catch(e){b.reject(e)}};r.prototype.then=function(a,c){function b(a,b){return"function"==typeof a?function(b){try{e(a(b))}catch(y){n(y)}}:b}var e,n,f=new r(function(a,b){e=a;n=b});this.callWhenSettled_(b(a,e),b(c,n));return f};
r.prototype.catch=function(a){return this.then(void 0,a)};r.prototype.callWhenSettled_=function(a,c){function b(){switch(e.state_){case 1:a(e.result_);break;case 2:c(e.result_);break;default:throw Error("Unexpected state: "+e.state_);}}var e=this;null==this.onSettledCallbacks_?l.asyncExecute(b):this.onSettledCallbacks_.push(b)};r.resolve=d;r.reject=function(a){return new r(function(b,c){c(a)})};r.race=function(a){return new r(function(b,c){for(var e=$jscomp.makeIterator(a),n=e.next();!n.done;n=e.next())d(n.value).callWhenSettled_(b,
c)})};r.all=function(a){var b=$jscomp.makeIterator(a),c=b.next();return c.done?d([]):new r(function(a,n){function e(b){return function(e){g[b]=e;h--;0==h&&a(g)}}var g=[],h=0;do g.push(void 0),h++,d(c.value).callWhenSettled_(e(g.length-1),n),c=b.next();while(!c.done)})};return r},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(a,h){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:h})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(d){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(d||"")+"_"+h++,d)}var h=0;return a}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.generator={};
$jscomp.generator.ensureIteratorResultIsObject_=function(a){if(!(a instanceof Object))throw new TypeError("Iterator result "+a+" is not an object");};$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};
$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(a){this.yieldResult=a};
$jscomp.generator.Context.prototype.throw_=function(a){this.abruptCompletion_={exception:a,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(a){this.abruptCompletion_={return:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(a){this.abruptCompletion_={jumpTo:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(a,h){this.nextAddress=h;return{value:a}};
$jscomp.generator.Context.prototype.yieldAll=function(a,h){a=$jscomp.makeIterator(a);var d=a.next();$jscomp.generator.ensureIteratorResultIsObject_(d);if(d.done)this.yieldResult=d.value,this.nextAddress=h;else return this.yieldAllIterator_=a,this.yield(d.value,h)};$jscomp.generator.Context.prototype.jumpTo=function(a){this.nextAddress=a};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(a,h){this.catchAddress_=a;void 0!=h&&(this.finallyAddress_=h)};$jscomp.generator.Context.prototype.setFinallyBlock=function(a){this.catchAddress_=0;this.finallyAddress_=a||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(a,h){this.nextAddress=a;this.catchAddress_=h||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(a){this.catchAddress_=a||0;a=this.abruptCompletion_.exception;this.abruptCompletion_=null;return a};$jscomp.generator.Context.prototype.enterFinallyBlock=function(a,h,d){d?this.finallyContexts_[d]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=a||0;this.finallyAddress_=h||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(a,h){h=this.finallyContexts_.splice(h||0)[0];if(h=this.abruptCompletion_=this.abruptCompletion_||h){if(h.isException)return this.jumpToErrorHandler_();void 0!=h.jumpTo&&this.finallyAddress_<h.jumpTo?(this.nextAddress=h.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=a};$jscomp.generator.Context.prototype.forIn=function(a){return new $jscomp.generator.Context.PropertyIterator(a)};
$jscomp.generator.Context.PropertyIterator=function(a){this.object_=a;this.properties_=[];for(var h in a)this.properties_.push(h);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var a=this.properties_.pop();if(a in this.object_)return a}return null};$jscomp.generator.Engine_=function(a){this.context_=new $jscomp.generator.Context;this.program_=a};
$jscomp.generator.Engine_.prototype.next_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,a,this.context_.next_);this.context_.next_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(a){this.context_.start_();var h=this.context_.yieldAllIterator_;if(h)return this.yieldAllStep_("return"in h?h["return"]:function(a){return{value:a,done:!0}},a,this.context_.return);this.context_.return(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],a,this.context_.next_);this.context_.throw_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(a,h,d){try{var c=a.call(this.context_.yieldAllIterator_,h);$jscomp.generator.ensureIteratorResultIsObject_(c);if(!c.done)return this.context_.stop_(),c;var r=c.value}catch(l){return this.context_.yieldAllIterator_=null,this.context_.throw_(l),this.nextStep_()}this.context_.yieldAllIterator_=null;d.call(this.context_,r);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var a=this.program_(this.context_);if(a)return this.context_.stop_(),{value:a.value,done:!1}}catch(h){this.context_.yieldResult=void 0,this.context_.throw_(h)}this.context_.stop_();if(this.context_.abruptCompletion_){a=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(a.isException)throw a.exception;return{value:a.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(a){this.next=function(h){return a.next_(h)};this.throw=function(h){return a.throw_(h)};this.return=function(h){return a.return_(h)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(a,h){h=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(h));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(h,a.prototype);return h};
$jscomp.asyncExecutePromiseGenerator=function(a){function h(c){return a.next(c)}function d(c){return a.throw(c)}return new Promise(function(c,r){function l(a){a.done?c(a.value):Promise.resolve(a.value).then(h,d).then(l,r)}l(a.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(a){return $jscomp.asyncExecutePromiseGenerator(a())};$jscomp.asyncExecutePromiseGeneratorProgram=function(a){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a)))};
$jscomp.checkStringArgs=function(a,h,d){if(null==a)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(h instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");return a+""};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var d=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var c="";a;)if(a&1&&(c+=d),a>>>=1)d+=d;return c}},"es6","es3");
$jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(a,d){var c=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var h=c.length,l=a.length;d=Math.max(0,Math.min(d|0,c.length));for(var b=0;b<l&&d<h;)if(c[d++]!=a[b++])return!1;return b>=l}},"es6","es3");
$jscomp.polyfill("String.prototype.endsWith",function(a){return a?a:function(a,d){var c=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===d&&(d=c.length);d=Math.max(0,Math.min(d|0,c.length));for(var h=a.length;0<h&&0<d;)if(c[--d]!=a[--h])return!1;return 0>=h}},"es6","es3");$jscomp.owns=function(a,h){return Object.prototype.hasOwnProperty.call(a,h)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,h){for(var d=1;d<arguments.length;d++){var c=arguments[d];if(c)for(var r in c)$jscomp.owns(c,r)&&(a[r]=c[r])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,d,c){var h=this.length||0;0>d&&(d=Math.max(0,h+d));if(null==c||c>h)c=h;c=Number(c);0>c&&(c=Math.max(0,h+c));for(d=Number(d||0);d<c;d++)this[d]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,h,d){a instanceof String&&(a=String(a));for(var c=a.length,r=0;r<c;r++){var l=a[r];if(h.call(d,l,r,a))return{i:r,v:l}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var d=[],c=0;c<this.length;c++){var h=this[c];Array.isArray(h)&&0<a?(h=Array.prototype.flat.call(h,a-1),d.push.apply(d,h)):d.push(h)}return d}},"es9","es5");
$jscomp.polyfill("Math.trunc",function(a){return a?a:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var d=Math.floor(Math.abs(a));return 0>a?-d:d}},"es6","es3");$jscomp.polyfill("Math.sign",function(a){return a?a:function(a){a=Number(a);return 0===a||isNaN(a)?a:0<a?1:-1}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(a){return a?a:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");
$jscomp.stringPadding=function(a,h){a=void 0!==a?String(a):" ";return 0<h&&a?a.repeat(Math.ceil(h/a.length)).substring(0,h):""};$jscomp.polyfill("String.prototype.padStart",function(a){return a?a:function(a,d){var c=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(d,a-c.length)+c}},"es8","es3");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#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["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["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+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";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=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="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=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="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.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";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"]=a.drawif="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"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="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"]=a.exponentialif="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"]=a.onlyOnce="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"]=a.colorInt="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.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.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";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.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";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=a.colour=a.kolorea="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"]=a.raytrace="raytrace";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.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";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=a.rowsNorth="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=a.rowsSouth="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=a.widthEast="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=a.widthWest="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"]=a.initAnimation="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"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="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.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=a.x="x";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=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";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"]=a.font_size="font_size";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=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";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=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";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";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.slider="slider";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="cover";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";
a.shadowBlur="shadowBlur";a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.keyboard="keyboard";a.kblayout="kblayout";a.kbexp="kbexp";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return"@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(c){if(""==c)return"";h=c.split(",");d="";d+=a.getFontStyle(h[1])+" ";d+=h[2]+"px ";return d+=a.getFontName(h[0].split(" ")[0])};a.getFontName=function(d){d=d.toLowerCase();c=a.monospace_font;if("serif"===d||"times new roman"===d||"timesroman"===d||"times"===d)c=a.serif_font;else if("sansserif"===d||"arial"===d||"helvetica"===d)c=a.sansserif_font;return c};
a.getFontStyle=function(a){return r[a.toLowerCase()]||""};a.getTextWidth=function(c,b){a.ctx.font=b;return Math.round(a.ctx.measureText(c).width)};a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function h(){var a,b,f,c,g,d,h;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(e){e=Math.max(0,parseInt(void 0===e?0:e));a=this.toString();-1!==a.indexOf("e")&&(c=a.split("e"),d="-"===c[0][0]?"-":"",g="-"===d?parseFloat(c[0].substring(1)).oToFixed(11):parseFloat(c[0]).oToFixed(11),h=parseInt(c[1]),b=g.indexOf("."),g=g.replace(".",""),0>b+h?(b=0>b?1:b,a=d+"0."+"0".repeat(Math.abs(b+h))+g):a=d+g+"0".repeat(h-g.length+1));b=a.indexOf(".");
-1===b?0<e&&(a+="."+"0".repeat(e)):(f=a.length-b-1,a=f>=e?11>=e?parseFloat(a).oToFixed(e):a.substring(0,b+e+1):a+"0".repeat(e-f));return a}}if(a.loadLib)return a;var d=360/(2*Math.PI),c=2*Math.PI/360,r=Math.floor,l,b,g,m;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*d};a.degToRad=function(a){return a*c};a.getFeatures=function(){var b="";try{b=navigator.appVersion.toLowerCase()}catch(n){console.warn("navigator.appVersion is deprecated")}a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||
"ontouchstart"in window||/android/i.test(b);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);b=a.newHTML("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(b.width=b.height=1,a.ctx=a.hasCanvas,a._ratio=2);h()};a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(g=a.indexOf("."),-1!==g)){m=a.substring(g);if(0==parseFloat(m))return a.substring(0,g);for(var b=m.length-1;0<b;b--)if("0"!==m.charAt(b))return a.substring(0,g+b+1)}return a};
a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,b,f){a=void 0===a?0:a;b=void 0===b?100:b;f="linear-gradient("+(void 0===f?0:f)+"deg,";for(var e=2*a,c=a;c<b;c++)a=r(100-c-35),f+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*c-e)+"%, ";return f+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(e,c){l=e.touches?e.touches[0]:e;b=c.getBoundingClientRect();return l?{x:(l.pageX-window.scrollX-b.left)/a.cssScale,y:(l.pageY-window.scrollY-b.top)/a.cssScale}:
null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,e,c=[],g=0,d=0,h=a.length;d<h;d++)e=a.charAt(d),"'"===e&&(b=!b),b||";"!==e&&"\n"!==e||(c.push(a.substring(g,d).replace(/\n/g,"\\n")),g=d+1);c.push(a.substring(g).replace(/\n/g,"\\n"));return c};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(b){var e=a.newHTML("textarea");e.innerHTML=b;return e.value};a.newHTML=function(a,b){a=document.createElement(a);for(var e in b)a.setAttribute(e,
b[e]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function e(){Date.now()-c>=b&&(a.call(),c=Date.now());n.value=requestAnimationFrame(e)}if(!requestAnimationFrame)return setInterval(a,b);var c=Date.now(),n={};n.value=requestAnimationFrame(e);return n};a.clearInterval=
function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function e(){Date.now()-c>=b?a.call():n.value=requestAnimationFrame(e)}if(!requestAnimationFrame)return setTimeout(a,b);var c=Date.now(),n={};n.value=requestAnimationFrame(e);return n};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var a=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
a.document.write("<html>\n<head>\n<style>\nbody{text-align:center;}\niframe{width:650px;height:73px;overflow:hidden;border:1px solid black;}\ndt{font-weight:bold;margin-top:10px;}\n</style>\n</head>\n<body>\n<iframe src='https://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='https://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='https://descartesjs.org' target='_blank'>DescartesJS.org</a></h2>\n<dl>\n<dt>Dise\u00f1o funcional:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Jos\u00e9 R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver\u00e1 Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz\u00e1lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est\u00e1 bajo la licencia\n<a href='https://joinup.ec.europa.eu/software/page/eupl/licence-eupl'>EUPL v.1.1</a>\n<br>\nEl software en JavaScript est\u00e1 bajo licencia\n<a href='https://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci\u00f3n y el c\u00f3digo fuente se encuentran en :\n<br>\n<a href='https://descartes.matem.unam.mx/'>https://descartes.matem.unam.mx/</a>\n</p>\n<p>\nEste objeto, creado con Descartes, est\u00e1 licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>\n</body> </html>");
a.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openFile=function(h){if(a.cacheFiles[h])return a.cacheFiles[h];var d=null,c=new XMLHttpRequest;c.open("GET",h,!1);try{c.send(null),d=200===c.status||304===c.status?c.responseText:c.responseText||"",d=404===c.status?"":d,d.match(String.fromCharCode(65533))&&(c.open("GET",h,!1),c.overrideMimeType("text/plain;charset=ISO-8859-1"),c.send(null),d=c.responseText)}catch(r){d=null}return d};a.addExternalFileContent=function(h,
d){a.cacheFiles[h]=d};return a}(descartesJS||{});
descartesJS=function(a){function h(a){y=a.indexOf("--radial--");-1!=y&&(a=a.substring(0,y));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");l=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};l[0]==l[l.length-1]&&"'"==l[0]&&(a.ignoreCaps=!0,l=l.substring(1,l.length-1),"`"==l[0]&&"\u00b4"==l[l.length-1]&&(a.ignoreAccents=!0,l=l.substring(1,l.length-1)));"`"==l[0]&&"\u00b4"==l[l.length-1]&&(a.ignoreAccents=!0,l=l.substring(1,l.length-1),l[0]==l[l.length-1]&&"'"==l[0]&&(a.ignoreCaps=!0,l=l.substring(1,
l.length-1)));l.startsWith("\\*")&&!l.endsWith("\\*")?l=l.substring(2)+"$":!l.startsWith("\\*")&&l.endsWith("\\*")?l="^"+l.substring(0,l.length-2):l.startsWith("\\*")||l.endsWith("\\*")?l.startsWith("\\*")&&l.endsWith("\\*")&&(l=l.substring(2,l.length-2)):l="^"+l+"$";a.regExp=l.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,b){l=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=l.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),expr:b.parser.parse(a.expr[0].substring(1))};
a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),expr:b.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function c(a,b,c){b=parseFloat(b);e=a.expr[0];n=a.expr[1];f=c.eval(e.expr);v=c.eval(n.expr);q="("==e.type||"["==e.type;u=")"==n.type||"]"==n.type;return q&&b>f&&u&&b<=v?1:0}function r(a){return a.toString().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")}if(a.loadLib)return a;var l,b,g,m,e,n,f,v,q,u,y;a.buildRegularExpressionsPatterns=function(a,k){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var e=0,c=a.length;e<c;e++){b=a[e].split("&");g=[];for(var f=0,n=b.length;f<n;f++)l=b[f],-1===l.indexOf(",")||"("!==
l.charAt(0)&&"["!==l.charAt(0)||")"!==l.charAt(l.length-1)&&"]"!==l.charAt(l.length-1)?g.push(h(l)):g.push(d(l,k));a[e]=g}return a};a.escorrecto=function(e,k,f,n){f=f||a.externalEvaluator;n=n||a.buildRegularExpressionsPatterns(e,f);k=r(k);e=0;for(var g=n.length;e<g;e++){b=n[e];m=!0;for(var d=0,h=b.length;d<h;d++)m=b[d].regExp?m&&!!k.match(new RegExp(r(b[d].regExp),"i")):m&&c(b[d],k,f);if(m)return 1}return 0};a.esCorrecto=function(e,k,f,n){f=f||a.externalEvaluator;n=n||a.buildRegularExpressionsPatterns(e,
f);k+="";e=0;for(var g=n.length;e<g;e++){b=n[e];m=!0;for(var d=0,h=b.length;d<h;d++)(l=b[d].regExp)?(b[d].ignoreAccents&&(k=r(k),l=r(l)),b[d].ignoreCaps&&(k=k.toLowerCase(),l=r(l).toLowerCase()),m=m&&!!k.match(l)):m=m=m&&c(b[d],k,f);if(m)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getSvgArrowUp=
function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===d?"24c":d)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+(void 0===
d?"d00018":d)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,c,r,l,b,g,m,e,n,f,v,q,u,y,p,k,x,w,z,A=function(k,e){this.r=this.g=this.b=0;this.a=1;this.evaluator=e;this.getColor=this.getColorStr;if(!k)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(k.match(/^GradL/)){k=this.splitComa(k.substring(6,k.length-1));this.x1=this.evaluator.parser.parse(k[0]);this.y1=this.evaluator.parser.parse(k[1]);this.x2=this.evaluator.parser.parse(k[2]);
this.y2=this.evaluator.parser.parse(k[3]);this.stops=[];for(var c=4;c<k.length;c++)""!=k[c]&&(e=k[c].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(e[1]),color:"#"+e[2]}));this.getColor=this.getLinearGradient}else if(k.match(/^Pattern/))this.img_src=k.substring(8,k.length-1),this.img_src.match(d)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[k])"net"===babel[k]&&(k="rojo"),k=babel[k],this.r=
a.toHex(k.substring(1,3)),this.g=a.toHex(k.substring(3,5)),this.b=a.toHex(k.substring(5,7)),this.colorStr=k;else if(6===k.length)this.r=a.toHex(k.substring(0,2)),this.g=a.toHex(k.substring(2,4)),this.b=a.toHex(k.substring(4,6)),this.colorStr="#"+k;else if(8===k.length)this.r=a.toHex(k.substring(2,4)),this.g=a.toHex(k.substring(4,6)),this.b=a.toHex(k.substring(6,8)),this.a=1-a.toHex(k.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===k[0]){r=[];l=this.splitComa(k.substring(1,
k.length-1));k=0;for(e=l.length;k<e;k++)m=l[k],b=parseInt(m,16),m!==b.toString(16)&&m!=="0"+b.toString(16)?("["===m.charAt(0)&&"]"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1)),r.push(this.evaluator.parser.parse(m))):r.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=r[0];this.gExpr=r[1];this.bExpr=r[2];this.aExpr=r[3];this.getColor=this.getColorExp}};A.prototype.splitComa=function(a){g=[];for(var b=f=n=e=0,k=a.length;b<k;b++)v=a.charAt(b),"("===v?e++:")"===v?e--:"["===v?n++:
"]"===v?n--:","===v&&0===e&&0===n&&(g.push(a.substring(f,b)),f=b+1);g.push(a.substring(f));return g};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){c=this.evaluator;this.r=h(255*c.eval(this.rExpr));this.g=h(255*c.eval(this.gExpr));this.b=h(255*c.eval(this.bExpr));this.a=1-c.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){x=a.ctx.createLinearGradient(this.evaluator.eval(this.x1),this.evaluator.eval(this.y1),
this.evaluator.eval(this.x2),this.evaluator.eval(this.y2));for(var b=0;b<this.stops.length;b++)k=this.evaluator.eval(this.stops[b].percentage),k=0>k?0:1<k?1:k,x.addColorStop(k,this.stops[b].color);return x};A.prototype.getPattern=function(){z=this.evaluator.parent;if(w=z.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(w,"repeat")}catch(D){}return"ff00ff"};A.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.toHex=function(a){return parseInt("0x"+
a,16)};a.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");q=parseInt(a[0]).toString(16);u=parseInt(a[1]).toString(16);y=parseInt(a[2]).toString(16);p=(255-parseInt(255*parseFloat(a[3]))).toString(16);1===q.length&&(q="0"+q);1===u.length&&(u="0"+u);1===y.length&&(y="0"+y);1===p.length&&(p="0"+p);return new A(p+q+u+y)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){var c=this;this.parent=d;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=a.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);
this.additionalKeys=a.newHTML("div",{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=a.newHTML("div",{style:"position:absolute; background-color:white; margin:0; font-family:DJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",function(){c.insert("\n")});this.container.appendChild(this.newLine);
this.display.addEventListener("keydown",function(a){c.keypressed=!0;if(27===a.keyCode)c.close();else if(13===a.keyCode)c.onEnter()});this.key_pressed=!1;var h;this.delete_pressed=!1;var l;this.keyContainer.addEventListener("pointerdown",function(a){if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id){a.target.onpointerleave=function(){clearTimeout(h)};var b=a.target.textContent.trim().toLowerCase();h=setTimeout(function(){c.key_pressed=
!0;c.showAditionalKeys(b)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(l)},l=setInterval(function(){c.delete_pressed=!0;c.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=c.keyContainer&&a.target!=c.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)c.display.selectionStart=c.display.selectionEnd=Math.max(0,c.display.selectionStart-1);else if("k_right"==a.target.id)c.display.selectionStart=c.display.selectionEnd=
Math.min(c.display.value.length,c.display.selectionStart+1);else if("k_delete"==a.target.id)c.delete_pressed||c.delete(),clearTimeout(l),c.delete_pressed=!1;else if("k_\u221a"==a.target.id)c.insert("\u221a(");else if("k_space"==a.target.id)c.insert(" ");else if("k_esc"==a.target.id)c.close();else if("k_shift"==a.target.id){a=c.keyContainer.querySelectorAll("div");var b=c.additionalKeys.querySelectorAll("div");c.shift=!c.shift;c.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=
a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),b.forEach(function(a){a.textContent=a.textContent.toUpperCase()})):(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toLowerCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=".")}),b.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)c["setLayout_"+c.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)c["setLayout_"+
c.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)c.display.value="";else if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id)clearTimeout(h),c.key_pressed||(c.insert(a.target.textContent.trim()),c.additionalKeys.style.display="none"),c.key_pressed=!1;else if("k_return"==a.target.id)c.onEnter();else a=a.target.textContent.trim(),c.insert(a),c.additionalKeys.style.display="none";c.display.focus()});
this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var b=!1;this.additionalKeys.addEventListener("pointerdown",function(a){b=!0});this.additionalKeys.addEventListener("pointerup",function(a){b&&(a.target!=c.keyContainer&&a.target!=c.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),c.insert(a)),c.key_pressed=!1,c.additionalKeys.style.display="none");b=!1;c.display.focus()})};h.prototype.insert=function(a){this.display.setRangeText(a);
this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()};h.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};h.prototype.addKey=function(a,c,h){return"<div "+(c?"id='"+c+"'":"")+" "+(h?"style='"+h+"'":"")+">"+a+"</div>"};h.prototype.addKeys=function(a){var c=this,d="";a.forEach(function(a){d="object"===typeof a?
d+c.addKey(a.val,a.id,a.style):d+c.addKey(a)});return d};h.prototype.showAditionalKeys=function(a){var c=[];"."==a?c=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?c=["-","\u00d7","\u00f7","^"]:"a"==a?c=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?c=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?c=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?c=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(c=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(c);this.shift&&(this.additionalKeys.innerHTML=
this.additionalKeys.innerHTML.toUpperCase());this.additionalKeys.style.display="flex";this.additionalKeys.style.left=this.keyContainer.style.left;this.additionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"};h.prototype.setLayout_14x1=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_delete"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};h.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=
this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_delete"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};h.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_delete"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};h.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=
this.addKeys([7,8,9,{val:"\u232b",id:"k_delete"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="185px"};h.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_delete"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"};h.prototype.setLayout_11x3=
function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_delete"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1};h.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=
this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_delete"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"};h.prototype.setLayout_10x4_alfa=function(){this.keyContainer.innerHTML=
this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_delete",style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width=
"455px"};h.prototype.setLayout_10x4_num=function(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_delete"},{val:"ABC",id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};h.prototype.showCustomKB=
function(a){var c=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||c.length);for(var d=[],h,b,g=0;g<c.length;g++){h={val:c[g].textContent};if(b=c[g].getAttribute("id"))h.id=b;if(b=c[g].getAttribute("size"))h.style="width:"+(40*parseInt(b)+5*(parseInt(b)-1))+"px;transform:none !important;";d.push(h)}this.keyContainer.innerHTML=this.addKeys(d);this.keyContainer.style.width=5+45*a+"px"};h.prototype.setLayout=function(a){this.layout_mode=a;var c=document.getElementById("kb_"+a);c?this.showCustomKB(c):
"14x1"==a?this.setLayout_14x1():"7x2"==a?this.setLayout_7x2():"10x2"==a?this.setLayout_10x2():"4x4"==a?this.setLayout_4x4():"5x4"==a?this.setLayout_5x4():"11x3"==a?this.setLayout_11x3():"11x4"==a?this.setLayout_11x4():"10x4_alfa"==a?this.setLayout_10x4_alfa():"10x4_num"==a?this.setLayout_10x4_num():this.setLayout_14x1()};h.prototype.show=function(a,c,h,l,b,g,m){this.ctr=a;this.var_id=b;this.onlyText=m;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display=
"block";this.setDisplay(g);this.setLayout(c);this.keyContainer.style.left=h+"px";this.keyContainer.style.top=l+"px";this.additionalKeys.style.display="none"};h.prototype.close=function(){this.container.style.display="none";this.parent.deactivateControls();this.parent.update()};h.prototype.setDisplay=function(d){if("custom"==d.type){var c=d.x;var h=d.y;var l=d.w;var b=d.h;var g=d.fs}else h=this.container.getBoundingClientRect(),b=d.getBoundingClientRect(),c=b.left/a.cssScale-h.left/a.cssScale,h=b.top/
a.cssScale-h.top/a.cssScale,l=b.width/a.cssScale,b=b.height/a.cssScale,g=d.style.fontSize;"textarea"==d.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+c+"px;top:"+h+"px;width:"+l+"px;height:"+b+"px;font-size:"+g+";line-height:1.2em;padding:5px;font:"+d.style.font+";"),this.newLine.style.left=c+l-42+"px",this.newLine.style.top=h+b-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+c+"px;top:"+h+"px;width:"+l+"px;height:"+b+"px;font-size:"+g+";line-height:"+
b+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=d.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};h.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var c=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{c&&(a=this.parent.evaluator.eval(c))}catch(b){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),c=this.var_id.indexOf("["),
-1==c)this.parent.evaluator.setVariable(this.var_id,a);else{var h=this.var_id.indexOf(","),l=this.var_id.substring(0,c);-1==h?this.parent.evaluator.setVector(l,parseInt(this.var_id.substring(c+1)),a):this.parent.evaluator.setMatrix(l,parseInt(this.var_id.substring(c+1)),parseInt(this.var_id.substring(h+1)),a)}this.close()};a.Keyboard=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=document.head,d=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||h.appendChild(d);d=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});h.appendChild(d);d=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});h.appendChild(d);d=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});h.appendChild(d);
(h=document.getElementById("StyleDescartesApps2"))&&h.remove();h=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(h,document.head.firstChild);h.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.TextfieldCover{position:absolute;overflow:hidden;background-color:transparent;cursor:pointer;}\ninput[type=text]{-webkit-appearance:none;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField,.DescartesSliderField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesSliderLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;resize:none;border:solid #666 1px;}\n.DescartesTextAreaContainer *{border:none;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer,.DescartesSliderContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DescartesSliderContainer{background:transparent;}\n.DescartesRange{-webkit-appearance:none;appearance:none;background:transparent;cursor: pointer;}\n.DescartesRange::-webkit-slider-runnable-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-moz-range-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--track_h) / 2 - var(--thumb_size) / 2);border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DescartesRange::-moz-range-thumb{border:none;border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100)+", url('"+a.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+a.createGradient(50,100,90)+", url('"+a.getSvgArrowUp(!0)+"');}\n.DJS_Up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+a.createGradient(0,50)+", url('"+a.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100,-90)+", url('"+a.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DescartesKeyboardContainer{position:absolute;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);z-index:1000;}\n.DescartesKeysContainer{display:flex;flex-direction:row;flex-wrap:wrap;background-color:#c0c0c0;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 8px 0 rgba(0,0,0,0.75);box-sizing: content-box;}\n.DescartesKeysContainer > div, .new_line_btn{margin:5px 0 0 5px;display:inline-block;min-width:40px;min-height:40px;max-height:40px;line-height:35px;background-color:#ebeff3;font-family:"+
a.math_font+";font-size:18px;font-weight:bold;color:black;cursor:pointer;text-align:center;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 1px 2px 0 rgba(0,0,0,0.25);transform-origin:center;user-select:none;}\n.DescartesKeysContainer > div:hover, .new_line_btn:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active, .new_line_btn:active{transform:scale(0.95);}\n.DescartesKeyboardDisplay{font-family:"+a.sansserif_font+";padding:0 2px;border:solid #666 1px;text-align:left;background-color:white;position:absolute;overflow:hidden;outline:2px solid black; resize: none;}\n.custom_keyboard{display:none;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(a.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"")+"@media print{body{margin:0;padding:0;}\n.DescartesAppContainer{transform:none !important;left:0 !important;top:0 !important;}\ndiv:has(.DescartesAppContainer){overflow:unset !important;width:100% !important;height:100% !important;}}";return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sin,d=Math.floor,c=Math.random,r=Math.round,l=Math.abs,b=String.fromCharCode,g,m,e,n,f,v,q,u,y,p,k=function(a){this.key=(void 0===a?0:a).toString()};k.prototype.getKey=function(a){g=[];for(var k=0;256>k;k++)g[k]=b(this.alfanum(d(l(7.5*(h(1*k-a)+h(1.4*k+a)+h(.6*k-a)+h(2.2*k+a))))));return g.join("")};k.prototype.encode=function(a){m=d(31*c());this.key=this.getKey(m);return b(this.alfanum(m))+this.encripta(a)};k.prototype.decode=function(a){m=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(m);return this.desencripta(a.substring(1))};k.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};k.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var b=0,k=a.length;b<k;b++)y=256*d(a[b]+128)+r(255*c())+65536*r(255*c()),p=d((y<<this.shift(b))/256),v[3*b]=this.alfanum(p%32),v[3*b+1]=this.alfanum(p/32%32),v[3*b+2]=this.alfanum(p/1024%32);return v};k.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};k.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;q=Array(a.length/3);for(var b=0,k=q.length;b<k;b++)p=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),y=d(256*p>>this.shift(b)),u=d(y/256)%256-128,0>u&&(u+=256),q[b]=u;return q};k.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};k.prototype.numalfa=function(a){return a-(58>a?48:87)};k.prototype.stringToBytes=
function(a){n=[];for(var b=0,k=a.length;b<k;b++)n.push(a.charCodeAt(b));return n};k.prototype.bytesToString=function(a){for(var k=0,c=a.length;k<c;k++)a[k]=b(a[k]);return a.join("")};k.prototype.shift=function(a){e=this.key.charCodeAt(a%this.key.length);n=this.numalfa(e);f=d(n/2%8);0==f&&(f=4);return f};k.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){this.parent=d;var h=d.evaluator,l=h.parser;d=new a.Auxiliary(d);var b=this;b.delay=l.parse(c.delay?c.delay:"60");b.loop=c.loop?c.loop:!1;b.auto=void 0==c.auto?!0:c.auto;b.controls=c.controls;b.init=d.splitInstructions(l,c.init);b.doExpr=d.splitInstructions(l,c.doExpr);c.whileExpr&&(b.whileExpr=l.parse(c.whileExpr));var g,m=b.doExpr.length;b.animExec=function(){for(g=0;g<m;g++)h.eval(b.doExpr[g]);b.parent.update();b.playing&&(0<h.eval(b.whileExpr)||
b.loop)?b.timer=a.setTimeout(b.animExec,h.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};h.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};h.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};h.prototype.reinit=function(){for(var a=0,c=this.init.length;a<c;a++)this.parent.evaluator.eval(this.init[a])};
a.Animation=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(a){this.parent=a;this.evaluator=this.parent.evaluator};h.prototype.execute=function(){};a.Action=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){c=void 0===c?"":c;d=a.Action.call(this,d)||this;d.parameter=c.replace(/\\n/g,"\n").replace(/&squot;/g,"'");return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){alert(this.parameter)};a.Message=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){c=void 0===c?"":c;d=a.Action.call(this,d)||this;c=a.splitSeparator((c||"").replace(/&squot;/g,"'"));d.inst=[];for(var h,l=0,b=c.length;l<b;l++)(h=d.evaluator.parser.parse(c[l],!0))&&d.inst.push(h);return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){for(var a=0,c=this.inst.length;a<c;a++)this.evaluator.eval(this.inst[a])};a.Calculate=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){d=a.Action.call(this,d)||this;d.parameter=c.trim();d.target="_blank";return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var d=this.parameter;d.match(/^\[.*\]?/)&&(d=this.evaluator.eval(this.evaluator.parser.parse(d.substring(1,d.length-1))));var c=d.indexOf("target");-1!=c&&(this.target=d.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),d=d.substring(0,c-1));if("javascript"==d.substring(0,
10)){d=new a.SimpleText(this.parent,d.substring(11).replace(/&squot;/g,"'"));try{eval(d.toString())}catch(r){}}else"http"!=d.substring(0,4)&&(c=window.__dirname||window.location.href,d=c.substring(0,c.lastIndexOf("/")+1)+d),window.open(d,this.target)};a.OpenURL=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){c=void 0===c?"":c;d=a.Action.call(this,d)||this;d.parameter=c.trim();d.target="_blank";return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.evaluator.parser.parse(a.substring(1,a.length-1))));var c=a.indexOf("target");-1!=c&&(this.target=a.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,c-1));if("javascript"==
a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(r){}}else"http"!=a.substring(0,4)&&(c=window.__dirname||window.location.href,a=c.substring(0,c.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+",top="+(window.screen.height-this.parent.height)/2+",location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.editor?this.parent.editor.show():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.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};a.Config=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.init()};a.Init=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.clear()};a.Clear=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.play()};a.Animate=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,d=function(c,d){d=void 0===d?"":d;c=a.Action.call(this,c)||this;d.match(h)?c.filename=c.evaluator.parser.parse("'"+d.match(h)+"'"):(d.match(/^\[.*\]?/)&&(d=d.substring(1,d.length-1)),c.filename=c.evaluator.parser.parse(d));return c};$jscomp.inherits(d,a.Action);d.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c=function(a,c){this.parent=a;this.evaluator=a.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,c)};c.prototype.firstRun=function(){};c.prototype.update=function(){};c.prototype.splitInstructions=function(c,l){d=[];l=l?a.splitSeparator(l):[""];for(var b=0,g=l.length;b<g;b++)a.DEBUG.lineCount=b,(h=c.parse(l[b],!0))&&d.push(h);return d};c.prototype.getPrivateVariables=function(a,c){d=[];c=c?c.split(/;|,/):
[""];for(var b=0,g=c.length;b<g;b++)(h=a.parse(c[b],!0))&&d.push(h);b=0;for(g=d.length;b<g;b++)d[b]="assign"===d[b].type?d[b].childs[0].value:"identifier"===d[b].type?d[b].value:"";return d};c.prototype.parseExpressions=function(c){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(c,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(c,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(c,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
c.parse(this.whileExpr)};a.Auxiliary=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){d=a.Auxiliary.call(this,d,c)||this;c=d.evaluator.parser;d.expresionString=d.expresion;d.expresion=c.parse(d.expresionString);d.expresion&&c.setVariable(d.id,d.expresion);d.editable&&(d.registerTextField(),d.parent.editableRegionVisible=!0);return d};$jscomp.inherits(h,a.Auxiliary);h.prototype.registerTextField=function(){var d=a.newHTML("div"),c=a.newHTML("label");c.appendChild(document.createTextNode("___"+this.id+"=___"));var h=a.newHTML("input");
h.value=this.expresionString;h.disabled=!this.editable;d.appendChild(c);d.appendChild(h);var l=this,b=l.evaluator.parser;h.onkeydown=function(a){13==a.keyCode&&(l.expresion=b.parse(this.value),b.setVariable(l.id,l.expresion),l.parent.update())};this.parent.editableRegion.textFields.push({container:d,type:"div"})};a.Variable=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){d=a.Auxiliary.call(this,d,c)||this;d.expresion=d.evaluator.parser.parse(d.expresion);d.update();return d};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l=function(b,c){c=a.Auxiliary.call(this,b,c)||this;h=b.evaluator;d=h.parser;c.size=c.size||d.parse("3");c.expresion=c.expresion.split(";");c.parseFile=d.parse(c.file);c.update();return c};$jscomp.inherits(l,a.Auxiliary);l.prototype.update=function(){var b=this.expresion,g;h=this.evaluator;d=h.parser;this.oldFile=this.file;if(c=h.eval(this.parseFile))this.file=c;if(this.file){r=(g=document.getElementById(this.file))&&"descartes/vectorFile"==
g.type?g.text:a.openFile(this.file);if(null!=r){r=r.replace(/\r/g,"").split("\n");var m=[];g=0;for(var e=r.length;g<e;g++)""!=r[g]&&m.push(r[g]);r=m}null==r||1==r.length&&""==r[0]?(r=[],this.size=d.parse("0")):(b=r,this.size=null);null===this.size&&(this.size=d.parse(b.length+""))}var n;m=[];g=0;for(e=b.length;g<e;g++)(n=d.parse(b[g],!0))&&"assign"!=n.type&&(n=d.parse(this.id+"["+g+"]="+b[g],!0)),m.push(n);b=Array(parseInt(Math.abs(h.eval(this.size)))).fill(0);b._size_=b.length;h.vectors[this.id]=
b;h.setVariable(this.id+".long",b._size_);g=0;for(e=m.length;g<e;g++)h.eval(m[g])};a.Vector=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b=function(b,m){m=a.Auxiliary.call(this,b,m)||this;h=b.evaluator;d=h.parser;m.rows=m.rows||d.parse("3");m.columns=m.columns||d.parse("3");m.expresion=m.splitInstructions(d,m.expresion);c=h.eval(m.rows);r=h.eval(m.columns);l=[];l.type="matrix";b=0;for(var e=r;b<e;b++)l[b]=Array(c).fill(0);h.matrices[m.id]=l;m.update();return m};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){h=this.evaluator;c=h.eval(this.rows);r=h.eval(this.columns);
h.setVariable(this.id+".filas",c);h.setVariable(this.id+".columnas",r);l=h.matrices[this.id];l.rows=c;l.cols=r;for(var a=0,b=this.expresion.length;a<b;a++)h.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){var h=a.Auxiliary.call(this,d,c)||this;var l=h.evaluator;d=l.parser;c=h.id.indexOf("(");h.name=h.id.substring(0,c);h.params=h.id.substring(c+1,h.id.indexOf(")"));h.domain=h.range?d.parse(h.range):d.parse("1");h.params=""===h.params?[]:h.params.split(",");h.numParams=h.params.length;h.algorithm||(h.init="",h.doExpr="",h.whileExpr="");h.parseExpressions(d);h.expresion=d.parse(h.expresion);var b;h.functionExec=function(){h.iterations=
0;if(h.numParams<=arguments.length){for(var c=[],d=0,e=h.privateVars.length;d<e;d++)c.push(l.getVariable(h.privateVars[d])),l.setVariable(h.privateVars[d],0);var n=[];d=0;for(e=h.params.length;d<e;d++)n.push(l.getVariable(h.params[d])),l.setVariable(h.params[d],arguments[d]);d=0;for(e=h.init.length;d<e;d++)l.eval(h.init[d]);b=l.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{d=0;for(e=h.doExpr.length;d<e;d++)l.eval(h.doExpr[d]);if(++h.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+
b+" repeticiones en la funci\u00f3n << "+h.name+" >>"),0}while(0<l.eval(h.whileExpr));var f=l.eval(h.expresion);a.rangeOK=l.eval(h.domain);d=0;for(e=h.params.length;d<e;d++)l.setVariable(h.params[d],n[d]);d=0;for(e=h.privateVars.length;d<e;d++)l.setVariable(h.privateVars[d],c[d]);return f}return 0};l.setFunction(h.name,h.functionExec);return h};$jscomp.inherits(h,a.Auxiliary);a.Function=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){var h=a.Auxiliary.call(this,d,c)||this;var l=h.evaluator;h.parseExpressions(l.parser);var b;h.algorithmExec=function(){h.iterations=0;b=l.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var a=0,c=h.init.length;a<c;a++)l.eval(h.init[a]);do{a=0;for(c=h.doExpr.length;a<c;a++)l.eval(h.doExpr[a]);if(++h.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+b+" repeticiones en el algoritmo << "+h.name+" >>"),0}while(0<l.eval(h.whileExpr))};
return h};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){d=a.Auxiliary.call(this,d,c)||this;c=d.evaluator;delete d.evaluate;d.condition=c.parser.parse(d.condition);d.lastEval=!1;d.action=d.parent.lessonParser.parseAction(d);"onlyOnce"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEval&&(this.lastEval=!0,this.action.execute())});"alternate"==d.execution&&(d.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEval?(this.action.execute(),
this.lastEval=!0):!a&&this.lastEval&&(this.lastEval=!1)});"always"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return d};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.eventExec()};a.Event=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,c){var h=a.Auxiliary.call(this,d,c)||this;c=c.file;if(c)var l=(l=document.getElementById(c))&&"descartes/library"===l.type?l.text:a.openFile(c);if(l){l=a.convertHTMLEntities(l).replace(/\r/g,"").split("\n");c=0;for(var b=l.length;c<b;c++)""!==l[c].trim()&&d.lessonParser.parseAuxiliar(l[c])}return h};$jscomp.inherits(h,a.Auxiliary);a.Library=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e=function(b,c){this.parent=b;this.evaluator=b.evaluator;var e=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=e.parse("1");this.abs_coord=c&&c.type&&"text"===c.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=e.parse("(0,0)");this.family="";this.family_interval=e.parse("[0,1]");this.family_steps=e.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,18";
this.fixed=!0;this.text="";this.decimals=e.parse("2");Object.assign(this,c);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||
"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};e.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(b){return b.id===
a.spaceID})||this.parent.spaces[0]};e.prototype.getFamilyValues=function(){h=this.evaluator;d=h.eval(this.family_interval);this.familyInf=d[0][0];this.familySup=d[0][1];this.fSteps=Math.round(h.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};e.prototype.drawFamilyAux=function(a,b,e){h=this.evaluator;this.getFamilyValues();c=h.getVariable(this.family);if(0<=this.fSteps)for(var f=0,n=this.fSteps;f<=n;f++)h.setVariable(this.family,this.familyInf+
f*this.family_sep),0<h.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,b,e));h.setVariable("_Text_H_",0);h.setVariable(this.family,c)};e.prototype.draw=function(a,b){""!==this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,b));this.ctx.setLineDash([])};e.prototype.drawTrace=function(a,b){""!=this.family?this.drawFamilyAux(this.traceCtx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,
a,b))};e.prototype.rotate=function(a,b,c){g=Math.cos(c);m=Math.sin(c);return{x:a*g-b*m,y:a*m+b*g}};e.prototype.dashStyle=function(){b=this.ctx;"dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([b.lineWidth,b.lineWidth])):"dash"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,3*b.lineWidth])):"dash_dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,2*b.lineWidth,b.lineWidth,2*b.lineWidth])):b.setLineDash([])};e.prototype.drawText=function(a,b,c,e,d,g,m,k,x,w,z){a.textNode=
b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=d.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:c,y:e},b.update(a,c,e,x,w,m,z,d.getColor());else for("simpleText"===b.type&&(b=b.toString(x,w).split("\\n")),h=this.evaluator,a.fillStyle=d.getColor(),a.font=g,a.textAlign=m,a.textBaseline=k,l=1.2*this.fontSize||0,d=0,g=b.length;d<g;d++)r=b[d],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(r,c,e+l*d)),a.fillText(r,c,e+l*d)};a.Graphic=
e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m=function(a,n){this.text=n=n.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";h="'";r=c=0;for(l=-1;c<n.length;)b=n.charAt(c),g=n.charAt(c-1),"["===b&&"\\"===g?(this.textElements.push(n.substring(r,c-1)+"["),this.textElementsMacros.push("'"+n.substring(r,c-1)+"['"),r=c+1):"]"===b&&"\\"===g?(this.textElements.push(n.substring(r,c-
1)+"]"),this.textElementsMacros.push("'"+n.substring(r,c-1)+"]'"),r=c+1):"["===b&&-1===l?(this.textElements.push(n.substring(r,c)),this.textElementsMacros.push("'"+n.substring(r,c)+"'"),r=c,l++):"["===b?l++:"]"===b&&0===l?(this.textElements.push(this.evaluator.parser.parse(n.substring(r,c+1))),this.textElementsMacros.push("["+n.substring(r,c+1)+"]"),r=c+1,l--):("]"==n.charAt(c)&&(l=0>l?l:l-1),h+=n.charAt(c)),c++;this.textElements.push(n.substring(r,c));this.textElementsMacros.push("'"+n.substring(r,
c)+"'")};m.prototype.toString=function(b,c){h="";for(var e=0,n=this.textElements.length;e<n;e++)"string"===typeof this.textElements[e]?h+=this.textElements[e]:(d=this.evaluator.eval(this.textElements[e])[0][0],""!==d&&("string"===typeof d?h+=d:Infinity==d?h+="Infinity":-Infinity==d?h+="-Infinity":isNaN(d)||"NaN"==d?h+="NaN":(d=parseFloat(d),d=c?d.toFixed(b):a.removeNeedlessDecimals(d.toFixed(b)),h+=d.toString().replace(".",this.parent.decimal_symbol))));return h};a.SimpleText=m;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J,E,B,I,L,M,O,H,N,C,Q,K=function(b,k){k=a.Graphic.call(this,b,k)||this;k.width=k.width||b.evaluator.parser.parse("1");k.fillP=k.fillP||"";k.fillM=k.fillM||"";k.parseExpression();k.visible&&k.registerTextField();q=new a.R2;u=new a.R2;y=new a.R2;x=new a.R2;p=new a.R2;k.cInd=0;return k};$jscomp.inherits(K,a.Graphic);K.prototype.parseExpression=function(){if("compOperator"===this.expresion.type){var b=this.expresion.childs[0],
k=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||k.contains("y")?"identifier"!=k.type||"y"!=k.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||k.contains("x")?"identifier"!=k.type||"x"!=k.value||b.contains("x")||(this.funExpr=k,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=k,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=k,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,
this.expresion)};K.prototype.update=function(){};K.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};K.prototype.drawFamilyAux=function(a,b,k){c=this.evaluator;this.getFamilyValues();d=c.getVariable(this.family);if(0<=this.fSteps)for(var e=0,f=this.fSteps;e<=f;e++)c.setVariable(this.family,this.familyInf+e*this.family_sep),this.update(),this.drawAux(a,b,k);c.setVariable(this.family,d)};K.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};K.prototype.drawAux=function(d,P,S){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;c=this.evaluator;r=c.parser;l=this.space;b=c.eval(this.width);d.strokeStyle=this.color.getColor();d.lineWidth=b;g=r.getVariable("x");m=r.getVariable("y");e=l.w+24;n=l.h+24;f=e/9;3>f&&(f=3);v=n/7;3>v&&(v=3);0==this.cInd?(h=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;q.set(0,0);u.set(0,0);y.set(0,0);C=.25;Q=8;this.abs_coord||(C/=l.scale,
Q/=l.scale);d.beginPath();for(I=parseInt(v/2);I<n;I+=v)for(B=parseInt(f/2);B<e;B+=f){if(this.abs_coord){x.set(B,I);k=this.newt.findZero(x,C);if(null==k)continue;c.setVariable("x",k.x);c.setVariable("y",k.y);p.set(k.x,k.y)}else{x.set(l.getRelativeX(B),l.getRelativeY(I));k=this.newt.findZero(x,C);if(null==k)continue;c.setVariable("x",k.x);c.setVariable("y",k.y);p.set(l.getAbsoluteX(k.x),l.getAbsoluteY(k.y))}w=p.ix();z=p.iy();if(-12<=w&&w<e+24&&-12<=z&&z<n+24){if(h[w+12+(z+12)*l.w]===this.cInd)continue;
h[w+12+(z+12)*l.w]=this.cInd}a.rangeOK&&(d.moveTo(w,z),d.lineTo(w,z));q.x=k.x;q.y=k.y;u.x=k.x;u.y=k.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),y.x=A.x,y.y=A.y,G=D=0,F=!1;2>G;)if(F&&(y.x=-A.x,y.y=-A.y,k.x=q.x,k.y=q.y,u.x=k.x,u.y=k.y,this.abs_coord?p.set(k.x,k.y):p.set(l.getAbsoluteX(k.x),l.getAbsoluteY(k.y)),w=p.ix(),z=p.iy(),F=!1,D=0),k.x+=Q*y.x,k.y+=Q*y.y,k=this.newt.findZero(k,C),null!=k){c.setVariable("x",k.x);c.setVariable("y",k.y);y.x=k.x-u.x;y.y=k.y-u.y;y.normalize();if(0==
y.x&&0==y.y)break;u.x=k.x;u.y=k.y;this.abs_coord?p.set(k.x,k.y):p.set(l.getAbsoluteX(k.x),l.getAbsoluteY(k.y));J=parseInt(p.ix());E=parseInt(p.iy());if(J!=w||E!=z)if(L=w,M=z,w=J,z=E,-12<=w&&w<e+24&&-12<=z&&z<n+24){D=0;O=h[w+12+(z+12)*l.w];h[w+12+(z+12)*l.w]=this.cInd;for(P=1;8>P;P++)H=L+Math.round((w-L)*P/8),N=M+Math.round((z-M)*P/8),0<=H&&H<e&&0<=N&&N<n&&(h[H+12+(N+12)*l.w]=this.cInd);a.rangeOK&&(d.moveTo(L,M),d.lineTo(w,z));if(O===this.cInd)break}else F=!0,G++;else 4<++D&&(F=!0,G++)}}d.stroke()}};
K.prototype.X=function(a,b,k){k||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};K.prototype.Y=function(a,b,k){k||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};K.prototype.XX=function(a,b,k){return Math.round(this.X(a,b,k))};K.prototype.YY=function(a,b,k){return Math.round(this.Y(a,b,k))};K.prototype.extrapolate=function(b,k,c,e,f,n){for(var d=this.evaluator.getVariable(k),
g=n/2,h=0,q,m,l,p,u,v;1E-15<Math.abs(g);){q=this.evaluator.getVariable(k);m=this.evaluator.getVariable(k)+g;this.evaluator.setVariable(k,m);l=!0;try{p=f,f=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,f),0<this.evaluator.eval(b)?(u=new a.R2(Math.min(p,f),Math.max(p,f)),v=0,v=0<n?this.Singularity(Math.abs(g),k,e,q,p,m,f,u):this.Singularity(Math.abs(g),k,e,m,f,q,p,u),0<v&&(l=!1)):l=!1}catch(Z){l=!1}l?h+=g:this.evaluator.setVariable(k,q);g/=2}this.evaluator.setVariable(k,d);return new a.R2(h/
Math.abs(n),f)};K.prototype.extrapolateOnSingularity=function(b,k,c,e,f,n){e=this.evaluator.getVariable(k);for(var d=n/2,g=0,h=f,q;1E-15<Math.abs(d);){this.evaluator.setVariable(k,this.evaluator.getVariable(k)+d);q=!0;if(0<this.evaluator.eval(b))try{h=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,h),0>=this.evaluator.eval(b)&&(q=!1)}catch(X){q=!1}else q=!1;q?g+=d:this.evaluator.setVariable(k,this.evaluator.getVariable(k)-d);d/=2}if(0==g)for(d=n/2,g=n,h=f;1E-15<Math.abs(d);){this.evaluator.setVariable(k,
this.evaluator.getVariable(k)-d);q=!0;if(0<this.evaluator.eval(b))try{h=this.evaluator.eval(this.funExpr)}catch(X){q=!1}else q=!1;q?g+=-d:this.evaluator.setVariable(k,this.evaluator.getVariable(k)+d);d/=2}this.evaluator.setVariable(k,e);return new a.R2(g/Math.abs(n),h)};K.prototype.Singularity=function(a,b,k,c,e,f,n,d){if(isNaN(n)||isNaN(e)||isNaN(d.y)||isNaN(d.x)||c>=f)return 2;var g=this.evaluator.getVariable(b),h=0;try{if(1E-15>Math.abs(f-c)||1E-12>Math.abs(f-c)&&Math.abs(n-e)>Math.abs(a))return this.evaluator.setVariable(b,
g),1;var q=(c+f)/2;this.evaluator.setVariable(b,q);var m=NaN;try{m=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(m))return 5;if(Math.abs(n-e)>a){this.evaluator.setVariable(b,c-1E-12);var l=this.evaluator.eval(this.funExpr);l=(e-l)/1E-12;this.evaluator.setVariable(b,f+1E-12);var p=(this.evaluator.eval(this.funExpr)-n)/1E-12;if((10>Math.abs(p)||10>Math.abs(l))&&(0<=p&&0<=l||0>=p&&0>=l)&&4*Math.abs(p)<Math.abs((n-e)/(f-c)))return this.evaluator.setVariable(b,g),2}if(isNaN(d.x)||isNaN(d.y)||
isNaN(m))return 2;if(!(d.x<=m&&m<=d.y)){this.evaluator.setVariable(b,q);d.x=Math.min(e,m);d.y=Math.max(e,m);var u=this.Singularity(a/2,b,k,c,e,q,m,d);this.evaluator.setVariable(b,f);d.x=Math.min(n,m);d.y=Math.max(n,m);var v=this.Singularity(a/2,b,k,q,m,f,n,d);h=Math.max(u,v)}}catch(Y){h=1}this.evaluator.setVariable(b,g);return h};K.prototype.discontLR=function(a,b,k,c){var e=b+k,f=e+k,n=b-k;k=n-k;this.evaluator.setVariable("x",b);b=this.evaluator.eval(a);if(isNaN(b)||!isFinite(b)||Math.abs(b)>c)return!0;
this.evaluator.setVariable("x",e);e=this.evaluator.eval(a);if(isNaN(e)||!isFinite(e)||Math.abs(e)>c)return!0;this.evaluator.setVariable("x",f);f=this.evaluator.eval(a);if(isNaN(f)||!isFinite(f)||Math.abs(f)>c)return!0;this.evaluator.setVariable("x",n);n=this.evaluator.eval(a);if(isNaN(n)||!isFinite(n)||Math.abs(n)>c)return!0;this.evaluator.setVariable("x",k);a=this.evaluator.eval(a);if(isNaN(a)||!isFinite(a)||Math.abs(a)>c)return!0;c=3*b-4*e+f;a=3*b-4*n+a;return.8<Math.abs((c*c-a*a)/(c*c+a*a+1E-4))?
!0:!1};K.prototype.drawAuxFun1=function(b,k,c){g=this.evaluator.parser.getVariable("x");m=this.evaluator.parser.getVariable("y");a.rangeOK=1;if(this.evaluator.eval(this.drawif)){k="x";this.of_y&&(k="y");b.beginPath();b.lineWidth=this.evaluator.eval(this.width);b.strokeStyle=c.getColor();for(var e=-1;e<=this.space.w;e+=1){c=this.space.getRelativeX(e);this.evaluator.setVariable(k,c);var f=this.evaluator.eval(this.funExpr);var n=this.space.getAbsoluteX(c);f=this.space.getAbsoluteY(f);this.discontLR(this.funExpr,
c,.001,100)?b.moveTo(n,f):b.lineTo(n,f)}b.stroke();this.evaluator.parser.setVariable("x",g);this.evaluator.parser.setVariable("y",m)}};K.prototype.drawAuxFun=function(b,k,c){g=this.evaluator.parser.getVariable("x");m=this.evaluator.parser.getVariable("y");a.rangeOK=1;k="x";var e="y";this.of_y&&(k="y",e="x");var f=this.drawif,n=this.evaluator.eval(this.width),d=!1,h=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),q=this.of_y?h.ix():h.iy(),l=0,p=0,u=0,v=0,r=1/this.space.scale;h=
r*(this.of_y?-this.space.h+h.y:-h.x);var x=0;this.abs_coord&&(h=0,r=1);for(var z,y,D,A,w,J,B,L,E,G=this.of_y?this.space.h+2:this.space.w+2;u<=G;){z=!0;y=0;this.evaluator.setVariable(k,h);try{D=this.evaluator.eval(this.funExpr),isNaN(D)||(this.evaluator.setVariable(e,D),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(d?(A=Math.min(x,D),w=Math.max(x,D),J=new a.R2(A,w),y=this.Singularity(r,k,0,h-r,x,h,D,J),0===y?(x<=D?(x=J.x,D=J.y):(D=J.x,x=J.y),B=parseInt(this.of_y?this.XX(n,x,this.abs_coord):this.YY(n,
x,this.abs_coord)),l=this.abs_coord?Math.round(D):parseInt(this.of_y?this.XX(n,D,this.abs_coord):this.YY(n,D,this.abs_coord)),this.fillM&&l>q&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(q+1,this.space.h-u+.5),b.lineTo(l,this.space.h-u+.5)):(b.moveTo(u+.5,q+1),b.lineTo(u+.5,l)),b.stroke()),this.fillP&&l<q&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(q-1,this.space.h-u+.5),b.lineTo(l,this.space.h-u+.5)):(b.moveTo(u+.5,
q-1),b.lineTo(u+.5,l)),b.stroke()),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(B+.5,this.space.h-v),b.lineTo(l+.5,this.space.h-u)):(b.moveTo(v+.5,B),b.lineTo(u+.5,l)),b.stroke()):1===y?(this.evaluator.setVariable(k,h-r),L=this.extrapolate(f,k,e,0,x,r),l=this.of_y?this.XX(n,L.y,this.abs_coord):this.YY(n,L.y,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-v),b.lineTo(l+.5,this.space.h-v+Math.round(L.x))):(b.moveTo(v+
.5,p),b.lineTo(v+Math.round(L.x)+.5,l)),this.evaluator.setVariable(k,h),E=this.extrapolate(f,k,e,0,D,-r),p=this.of_y?this.XX(n,E.y,this.abs_coord):this.YY(n,E.y,this.abs_coord),l=this.of_y?this.XX(n,D,this.abs_coord):this.YY(n,D,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(l+.5,this.space.h-u)):(b.moveTo(u+.5,p),b.lineTo(u+.5,l)),b.stroke()):2===y&&(l=this.of_y?this.XX(n,D,this.abs_coord):this.YY(n,D,this.abs_coord),b.lineWidth=
n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(l+.5,this.space.h-u)):(b.moveTo(u+.5,p),b.lineTo(u+.5,l)))):(E=this.extrapolateOnSingularity(f,k,e,0,D,-r),p=this.of_y?this.XX(n,E.y,this.abs_coord):this.YY(n,E.y,this.abs_coord),l=this.of_y?this.XX(n,D,this.abs_coord):this.YY(n,D,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(u+Math.round(E.x))+.5),b.lineTo(l,this.space.h-u+.5)):(b.moveTo(u+Math.round(E.x),
p),b.lineTo(u,l)),b.stroke()),x=D):z=!1)}catch(aa){z=!1}d&&!z&&(this.evaluator.setVariable(k,h-r),this.evaluator.setVariable(e,x),L=this.extrapolate(f,k,e,0,x,r),l=parseInt(this.of_y?this.XX(n,L.y,this.abs_coord):this.YY(n,L.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(v+Math.round(L.x))+.5),b.lineTo(l,this.space.h-(v+Math.round(L.x))+.5)):(b.moveTo(v+Math.round(L.x)+.5,p),b.lineTo(v+Math.round(L.x)+
.5,l)),b.stroke()),this.evaluator.setVariable(k,h));d=z;h+=r;p=l;v=u++}this.evaluator.parser.setVariable("x",g);this.evaluator.parser.setVariable("y",m)};K.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var k=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(k.expresion=k.evaluator.parser.parse(this.value),k.parseExpression(),k.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Equation=
K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d,c,r,l,b,g,m,e=function(b,c){c=a.Graphic.call(this,b,c)||this;c.parameter=c.parameter||"t";c.parameter_interval=c.parameter_interval||b.evaluator.parser.parse("[0,1]");c.parameter_steps=c.parameter_steps||b.evaluator.parser.parse("8");c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.visible&&c.registerTextField();return c};$jscomp.inherits(e,a.Graphic);e.prototype.update=function(){d=this.evaluator;c=d.eval(this.parameter_interval);
this.paraInf=c[0][0];this.paraSup=c[0][1];this.pSteps=d.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};e.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};e.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};e.prototype.drawAux=function(c,e,v){d=this.evaluator;r=this.space;c.lineWidth=Math.max(1E-6,h(d.eval(this.width)));c.lineCap=c.lineJoin="round";c.strokeStyle=
v.getColor();l=d.getVariable(this.parameter);c.beginPath();d.setVariable(this.parameter,this.paraInf);b=d.eval(this.expresion);this.exprX=h(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0]));this.exprY=h(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1]));this.rotateExp&&(g=a.degToRad(d.eval(this.rotateExp)),m=this.rotate(b[0][0],b[0][1],g),this.exprX=h(this.abs_coord?m.x:r.getAbsoluteX(m.x)),this.exprY=h(this.abs_coord?m.y:r.getAbsoluteY(m.y)));c.moveTo(this.exprX+.5,this.exprY+.5);for(v=1;v<=this.pSteps;v++)d.setVariable(this.parameter,
this.paraInf+v*this.paraSep),b=d.eval(this.expresion),this.rotateExp&&(m=this.rotate(b[0][0],b[0][1],g),b[0][0]=m.x,b[0][1]=m.y),this.exprX=h(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0])),this.exprY=h(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&c.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(c.fillStyle=e.getColor(),c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);d.setVariable(this.parameter,
l)};e.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var c=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(a){13==a.keyCode&&(c.expresion=c.evaluator.parser.parse(this.value),c.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Curve=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,d=Math.round,c,r,l,b,g,m,e,n,f,v,q=function(b,c){c=a.Graphic.call(this,b,c)||this;c.size=c.size||b.evaluator.parser.parse("2");c.range=c.range||b.evaluator.parser.parse("[1, 100]");c.visible&&c.registerTextField();return c};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.rotateExp&&(b=this.rotate(l[0][0],l[0][1],a.degToRad(c.eval(this.rotateExp))),
this.exprX=b.x,this.exprY=b.y);e=c.eval(this.range);this.rangeInf=e[0][0];this.rangeMax=e[0][1]};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(b,e){c=this.evaluator;r=this.space;f=n=Math.ceil(c.eval(this.size)-.4);b.fillStyle=e.getColor();b.beginPath();this.rangeInf>this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=
v);e=c.getVariable("n");for(var q=this.rangeInf,k=this.rangeMax;q<=k;q++)c.setVariable("n",q),l=c.eval(this.expresion),this.exprX=l[0][0],this.exprY=l[0][1],g=d(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX)),m=d(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(g,m,n,0,h,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,c.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,
g+f,m-f,this.color,this.font,"start","alphabetic",c.eval(this.decimals),this.fixed,!0));c.setVariable("n",e)};q.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var c=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(c.expresion=c.evaluator.parser.parse(this.value),c.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Sequence=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,d=Math.round,c,r,l,b,g,m,e,n=function(b,c){c=a.Graphic.call(this,b,c)||this;c.size=c.size||b.evaluator.parser.parse("2");c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.rotateExp&&(b=this.rotate(l[0][0],l[0][1],a.degToRad(c.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};n.prototype.drawAux=function(a,b){r=this.space;a.fillStyle=b.getColor();g=d(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX));m=d(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY));e=d(this.evaluator.eval(this.size));0<e&&(a.beginPath(),a.arc(g,m,e,0,h),a.fill());this.text.hasContent&&this.text.draw(a,b,g,m)};a.Point=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d=2*Math.PI,c,r,l,b,g,m,e,n,f,v,q=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.size=c.size||b.evaluator.parser.parse("2");c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);this.endPoints=[];for(var e=0,f=l.length;e<f;e++)this.endPoints[e]={x:l[e][0],y:l[e][1]};if(this.rotateExp)for(b=a.degToRad(c.eval(this.rotateExp)),
e=0,f=this.endPoints.length;e<f;e++)this.endPoints[e]=this.rotate(this.endPoints[e].x,this.endPoints[e].y,b)};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(a,b,q){c=this.evaluator;r=this.space;a.lineWidth=Math.max(1E-6,h(c.eval(this.width)));g=c.eval(this.size);a.fillStyle=b.getColor();a.strokeStyle=q.getColor();a.lineCap="round";m=
0==a.lineWidth%2?0:.5;this.abs_coord?(e=h(this.endPoints[0].x),n=h(this.endPoints[0].y),f=h(this.endPoints[1].x),v=h(this.endPoints[1].y)):(e=h(r.getAbsoluteX(this.endPoints[0].x)),n=h(r.getAbsoluteY(this.endPoints[0].y)),f=h(r.getAbsoluteX(this.endPoints[1].x)),v=h(r.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(e+m,n+m);a.lineTo(f+m,v+m);this.dashStyle();a.stroke();0<g&&(a.beginPath(),a.arc(e,n,g,0,d),a.arc(f,v,g,0,d),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
q,parseInt((e+f)/2)-3,parseInt((n+v)/2)+3)};a.Segment=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.round,c,r,l,b,g,m,e,n,f,v,q,u,y,p=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("5");c.size=c.size||b.evaluator.parser.parse("2");c.spear=c.spear||b.evaluator.parser.parse("8");c.arrow=c.arrow||new a.Color("ee0022");c.text=new a.TextObject(c,c.text);c.endPoints=[];c.vect=new a.Vector2D(0,0);return c};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){c=this.evaluator;r=c.eval(this.expresion);
for(var b=0,e=r.length;b<e;b++)this.endPoints[b]={x:r[b][0],y:r[b][1]};if(this.rotateExp)for(l=a.degToRad(c.eval(this.rotateExp)),b=0,e=this.endPoints.length;b<e;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,l)};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};p.prototype.drawAux=function(a,l,p){c=this.evaluator;b=this.space;g=Math.max(0,
c.eval(this.width));m=Math.ceil(g/2);e=b.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;n=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=l.getColor();a.strokeStyle=p.getColor();a.lineWidth=2;this.abs_coord?(f=d(this.endPoints[0].x),v=d(this.endPoints[0].y),q=d(this.endPoints[1].x),u=d(this.endPoints[1].y)):(f=d(b.getAbsoluteX(this.endPoints[0].x)),v=d(b.getAbsoluteY(this.endPoints[0].y)),q=d(b.getAbsoluteX(this.endPoints[1].x)),
u=d(b.getAbsoluteY(this.endPoints[1].y)));y=Math.max(0,c.eval(this.spear));a.save();a.translate(f,v);this.abs_coord?a.rotate(this.angle):(n*=e,a.rotate(-this.angle));a.beginPath();a.moveTo(-m,h(-m));a.lineTo(h(n-y-g),h(-m));a.lineTo(h(n-2*y),h(-y-m));a.lineTo(h(n),0);a.lineTo(h(n-2*y),h(y+m));a.lineTo(h(n-y-g),h(m));a.lineTo(-m,h(m));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,p,parseInt((f+q)/2)-3,parseInt((v+u)/2)+3)};a.Arrow=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d,c,r,l,b,g,m=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.endPoints=[];return c};$jscomp.inherits(m,a.Graphic);m.prototype.update=function(){d=this.evaluator;r=d.eval(this.expresion);for(var b=0,c=r.length;b<c;b++)this.endPoints[b]={x:r[b][0],y:r[b][1]};if(this.rotateExp)for(l=a.degToRad(d.eval(this.rotateExp)),b=0,c=this.endPoints.length;b<c;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,
this.endPoints[b].y,l)};m.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};m.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};m.prototype.drawAux=function(a,n,f){d=this.evaluator;c=this.space;a.lineWidth=Math.max(1E-6,h(d.eval(this.width)));a.strokeStyle=f.getColor();a.lineCap=a.lineJoin="round";b=h(this.abs_coord?this.endPoints[0].x:c.getAbsoluteX(this.endPoints[0].x));g=h(this.abs_coord?this.endPoints[0].y:c.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(b+0,g+0);f=1;for(var e=this.endPoints.length;f<e;f++)b=h(this.abs_coord?this.endPoints[f].x:c.getAbsoluteX(this.endPoints[f].x)),g=h(this.abs_coord?this.endPoints[f].y:c.getAbsoluteY(this.endPoints[f].y)),a.lineTo(b+0,g+0);this.fill&&(a.fillStyle=n.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d=Math.min,c=Math.max,r=Math.abs,l,b,g,m,e,n,f,v,q,u,y=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.border_radius=c.border_radius||b.evaluator.parser.parse("0");c.endPoints=[];return c};$jscomp.inherits(y,a.Graphic);y.prototype.update=function(){l=this.evaluator;m=l.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.w=150;this.h=100;this.rotateExp&&(g=this.rotate(m[0][0],
m[0][1],a.degToRad(l.eval(this.rotateExp))),this.exprX=g.x,this.exprY=g.y);4<=m[0].length&&(this.w=m[0][2],this.h=m[0][3]);m[1]&&2==m[1].length&&(this.w=m[1][0],this.h=m[1][1]);this.w=c(0,this.w);this.h=c(0,this.h)};y.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};y.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};y.prototype.drawAux=function(a,k,g,m){l=this.evaluator;b=this.space;a.lineWidth=Math.max(1E-6,h(l.eval(this.width)));
a.strokeStyle=g.getColor();a.lineCap="round";a.lineJoin="miter";e=h(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+0;n=h(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+0;f=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;q=d(c(0,l.eval(this.border_radius)),.5*r(f),.5*r(v));u=this.abs_coord?1:-1;a.beginPath();0!==q?(a.moveTo(e+q,n),a.lineTo(e+f-q,n),a.quadraticCurveTo(e+f,n,e+f,n+u*q),a.lineTo(e+f,n+v-u*q),a.quadraticCurveTo(e+f,n+v,e+f-q,n+v),a.lineTo(e+q,
n+v),a.quadraticCurveTo(e,n+v,e,n+v-u*q),a.lineTo(e,n+u*q),a.quadraticCurveTo(e,n,e+q,n),a.lineTo(e+q,n)):(a.moveTo(e,n),a.lineTo(e+f,n),a.lineTo(e+f,n+v),a.lineTo(e,n+v),a.lineTo(e,n));this.fill&&(a.fillStyle=k.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d=Math.min,c=Math.max,r=Math.acos,l=Math.sqrt,b=Math.PI,g=b/2,m=2*b,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J,E,B,I,L=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.center=c.center||b.evaluator.parser.parse("(0,0)");c.radius=c.radius||b.evaluator.parser.parse("1");c.init=c.init||"0";c.end=c.end||"90";c.init.match(/^_\(/)&&(c.initFlag=!0,c.init=c.init.substring(1));c.end.match(/^_\(/)&&
(c.endFlag=!0,c.end=c.end.substring(1));c.initExpr=b.evaluator.parser.parse(c.init);c.endExpr=b.evaluator.parser.parse(c.end);c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(L,a.Graphic);L.prototype.update=function(){e=this.evaluator;n=e.eval(this.center);this.exprX=n[0][0];this.exprY=n[0][1];f=0;this.rotateExp&&(f=a.degToRad(e.eval(this.rotateExp)),v=Math.cos(f),q=Math.sin(f),u=this.exprX*v-this.exprY*q,y=this.exprX*q+this.exprY*v,this.exprX=u,this.exprY=y);var h=e.eval(this.initExpr),
J=e.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(p=h[0][0],k=h[0][1],x=J[0][0],w=J[0][1],this.vectors?this.abs_coord&&(k=-k,w=-w):(p-=this.exprX,k=-k+this.exprY,x-=this.exprX,w=-w+this.exprY,this.abs_coord||(k=-k,w=-w)),z=0==p?0>k?3*g:g:r(1*p/l(p*p+k*k)),A=0==x?0>w?3*g:g:r(1*x/l(x*x+w*w)),z+=f,A+=f,0<p&&0<k&&this.abs_coord&&(z=m-z),0<p&&0>k&&!this.abs_coord&&(z=m-z),0>p&&0>k&&!this.abs_coord&&(z=m-z),0>p&&0<k&&this.abs_coord&&
(z=m-z),0<x&&0<w&&this.abs_coord&&(A=m-A),0<x&&0>w&&!this.abs_coord&&(A=m-A),0>x&&0>w&&!this.abs_coord&&(A=m-A),0>x&&0<w&&this.abs_coord&&(A=m-A),this.initFlag?(D=z,z=A,A=D):(D=d(z,A),G=c(z,A),z=D,A=G,A-z>b&&this.abs_coord&&(z=G,A=D),A-z<=b&&!this.abs_coord&&(z=G,A=D)),this.iniAng=z,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(h)+f,this.endAng=a.degToRad(J)+f,this.drawAngle=!0)};L.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};L.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};L.prototype.drawAux=function(a,b,c){e=this.evaluator;F=this.space;B=Math.max(0,e.eval(this.radius));a.lineWidth=Math.max(1E-6,h(e.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(J=h(this.exprX),E=h(this.exprY)):(J=h(F.getAbsoluteX(this.exprX)),E=h(F.getAbsoluteY(this.exprY)),B*=F.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(I=this.iniAng,this.iniAng=
this.endAng,this.endAng=I);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(J,E),a.arc(J,E,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(J,E,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,J,E)};a.Arc=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("0");c.align||(c.align="left");c.anchor||(c.anchor="top_left");c.shadowColor=c.shadowColor?c.shadowColor.getColor():"transparent";c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){h=this.evaluator;d=h.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(c=this.rotate(d[0][0],
d[0][1],a.degToRad(h.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y)};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};b.prototype.drawAux=function(a,b){this.abs_coord?(r=parseInt(this.exprX),l=parseInt(this.exprY)):(r=parseInt(this.space.getAbsoluteX(this.exprX)),l=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,r,l)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d,c,r,l,b,g,m,e,n,f,v,q,u,y=function(b,c){c=a.Graphic.call(this,b,c)||this;c.file=c.file||"";c.inirot=c.inirot||b.evaluator.parser.parse("0");c.img=new Image;c.scaleX=c.scaleY=1;c.ratio=b.ratio;b=c.expresion.getChildren();c.x_e=b[0];c.y_e=b[1];2<b.length&&(c.centered=!0,c.s_x_e=b[2],c.s_y_e=3<b.length?b[3]:b[2]);c.evaluator.eval(c.clip)&&(c.clip=c.clip.getChildren());c.update();return c};$jscomp.inherits(y,a.Graphic);y.prototype.update=
function(){d=this.evaluator;v=d.eval(this.x_e);q=d.eval(this.y_e);this.exprX=v;this.exprY=q;this.rotateExp&&(c=this.rotate(v,q,a.degToRad(d.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y);this.centered&&(this.scaleX=d.eval(this.s_x_e),this.scaleY=d.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));u=this;if((r=d.eval(this.file))||""==r)this.img=this.parent.getImage(r),this.img.ready||this.img.addEventListener("load",function(a){u.space.update(!0)})};y.prototype.draw=
function(){a.Graphic.prototype.draw.call(this)};y.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};y.prototype.drawAux=function(c){d=this.evaluator;this.img&&this.img.ready&&this.img.complete&&(this.clip?(n=d.eval(this.clip[2]),f=d.eval(this.clip[3])):(n=this.img.width,f=this.img.height,this.img.canvas&&(n=h(n/this.img.ratio),f=h(f/this.img.ratio))),l=this.centered?0:h(n/2),b=this.centered?0:h(f/2),g=h(this.abs_coord?this.exprX:this.space.getAbsoluteX(this.exprX)),m=h(this.abs_coord?
this.exprY:this.space.getAbsoluteY(this.exprY)),e=a.degToRad(-d.eval(this.inirot)),c.save(),c.translate(g+l,m+b),c.rotate(e),this.opacity&&(c.globalAlpha=d.eval(this.opacity)),c.scale(this.scaleX,this.scaleY),this.clip?this.img.canvas?c.drawImage(this.img,d.eval(this.clip[0])*this.img.ratio,d.eval(this.clip[1])*this.img.ratio,n*this.img.ratio,f*this.img.ratio,-n/2,-f/2,n,f):c.drawImage(this.img,d.eval(this.clip[0]),d.eval(this.clip[1]),n,f,-n/2,-f/2,n,f):c.drawImage(this.img,-n/2,-f/2,n,f),c.restore())};
a.Image=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e=document.createElement("canvas").getContext("2d");e.canvas.width=1;e.canvas.height=1;var n=function(b,c){return a.Graphic.call(this,b,c)||this};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){h=this.evaluator.eval(this.expresion);this.exprX=h[0][0];this.exprY=h[0][1]};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,
this.trace)};n.prototype.drawAux=function(a,n){n=n.getColor();e.clearRect(0,0,1,1);e.fillStyle=n;e.fillRect(0,0,1,1);n=(new Uint32Array(e.getImageData(0,0,1,1).data.buffer))[0];g=a.getImageData(0,0,this.space.w,this.space.h);m=new Uint32Array(g.data.buffer);this.abs_coord?(d=parseInt(this.exprX),c=parseInt(this.exprY)):(d=parseInt(this.space.getAbsoluteX(this.exprX)),c=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>d||0>c||d>=this.space.w||c>=this.space.h)){r=[d,c];var f=g.width;l=0>d||0>c||
d>=f||c>=g.height?-1:m[d+c*f];for(b=0;0<r.length&&!(b++,c=r.pop(),d=r.pop(),f=g.width,l==(0>d||0>c||d>=f||c>=g.height?-1:m[d+c*f])&&(m[d+c*g.width]=n,r.push(d-1,c),r.push(d+1,c),r.push(d,c-1),r.push(d,c+1)),b>=this.space.w*this.space.h*8););a.putImageData(g,0,0)}};a.Fill=n;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var d=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),c=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,l=function(b,g){var m=a.Graphic.call(this,b,g)||this;m.hasExpresion=m.hasExpresion||!1;m.inirot=m.inirot||b.evaluator.parser.parse("0");m.inipos=m.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(m,g);m.hasExpresion=void 0!==m.expresion;m.graphics=[];b=b.lessonParser;var e=new a.Tokenizer;
if(!m.hasExpresion)return m;"'"!==m.expresion.charAt(0)&&(m.expresion="'"+m.expresion+"'");m.expresion=m.evaluator.parser.parse(m.expresion);g=m.evaluator.eval(m.expresion);if(g)var n=(n=document.getElementById(g))&&"descartes/macro"==n.type?n.text:a.openFile(g);if(n){var f=a.convertHTMLEntities(n).replace(/\r/g,"").split("\n");n=[];g=0;for(var l=f.length;g<l;g++)if(f[g].trim()){var q=f[g].indexOf("=");if(-1!==q){q=b.split(f[g]);for(var u=0,r=q.length;u<r;u++)if(q[u]&&1<q.length&&("id"===h[q[u][0]]||
"type"===h[q[u][0]])){n.push(q);break}}}u=function(b,c){c=e.tokenize(c.replace(/&squot;/g,"'"));for(var k=0,f=c.length;k<f;k++)if("identifier"==c[k].type&&!a.reservedIds.match("-"+c[k].value+"-")||"R"===c[k].value||"G"===c[k].value||"B"===c[k].value)c[k].value=m.name+"."+c[k].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+e.flatTokens(c)};g=0;for(l=n.length;g<l;g++){var p=(r=n[g]||[],r[0])&&"id"===r[0][0];f=0;for(q=r.length;f<q;f++){var k=r[f][0].indexOf(".");-1===k||p?k=h[r[f][0]]:(k=h[r[f][0].substring(k+
1)],r[f][0]=m.name+"."+r[f][0]);if(!("font"===k||"font_family"===k||("fill"===k||"color"===k||"border"===k||"arrow"===k)&&"("!==r[f][1].charAt(0)||"file"===k&&r[f][1].match(c)||"id"!==k&&void 0!==h[r[f][1]])||"radius"===k)if("text"==k)if(r[f][1].match(/\{\\rtf1/))k=r[f][1],k=k.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),k=k.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),r[f][1]=k;else{var x=b.parseText(r[f][1]).textElementsMacros;for(var w=
0,z=x.length;w<z;w++){k=e.tokenize(x[w].replace(/&squot;/g,"'"));for(var A=0,D=k.length;A<D;A++)if("identifier"===k[A].type&&!a.reservedIds.match("-"+k[A].value+"-")||"R"===k[A].value||"G"===k[A].value||"B"===k[A].value)k[A].value=m.name+"."+k[A].value;k=e.flatTokens(k).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");x[w]=k.substring(1,k.length-1)}r[f][1]=x.join("")}else{x=r[f][1].replace(/&squot;/g,"'").split(";");w=0;for(z=x.length;w<z;w++){k=e.tokenize(x[w].replace(/\\n/g,";"));
A=0;for(D=k.length;A<D;A++)if("identifier"===k[A].type&&!a.reservedIds.match("-"+k[A].value+"-")||"R"===k[A].value||"G"===k[A].value||"B"===k[A].value)k[A].value=m.name+"."+k[A].value;x[w]=e.flatTokens(k)}r[f][1]=x.join(";")}}}g=0;for(l=n.length;g<l;g++)if(n[g][0]){u="";r=!1;f=0;for(q=n[g].length;f<q;f++)"type"===h[n[g][f][0]]&&d.match("-"+h[n[g][f][1]]+"-")&&(r=!0),u=u+n[g][f][0]+"='"+n[g][f][1]+"' ";n[g]=u+(r?" space='"+m.spaceID+"'":"");r?m.graphics.push(b.parseGraphic(n[g],m.abs_coord,m.background,
m.inirot)):b.parseAuxiliar(n[g])}}return m};$jscomp.inherits(l,a.Graphic);l.prototype.update=function(){r=this.evaluator.eval(this.inipos);this.iniPosX=r[0][0];this.iniPosY=r[0][1]};l.prototype.drawAux=function(a){for(var b=0,c=this.graphics.length;b<c;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=l;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sqrt,d=Math.sin,c=Math.cos,r=Math.abs,l,b,g,m,e,n,f,v,q,u,y,p,k,x,w,z=function(a,b,c,k){this.x=a||0;this.y=b||0;this.z=c||0;this.w=k||0;this.adjustDec()};z.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,b,c,k,e,f,n,d,g,h,q,m,l,u,p,r){this.a00=a||0;this.a01=b||0;this.a02=c||0;this.a03=k||0;this.a10=e||0;this.a11=f||0;this.a12=n||0;this.a13=d||0;
this.a20=g||0;this.a21=h||0;this.a22=q||0;this.a23=m||0;this.a30=l||0;this.a31=u||0;this.a32=p||0;this.a33=r||0};A.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};A.prototype.multiplyVector4=function(a){return new z(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};A.prototype.translate=function(a){return new A(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};A.prototype.rotateX=function(a){b=d(a);g=c(a);v=this.a10;q=this.a11;u=this.a12;
y=this.a13;p=this.a20;k=this.a21;x=this.a22;w=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,v*g+p*b,q*g+k*b,u*g+x*b,y*g+w*b,v*-b+p*g,q*-b+k*g,u*-b+x*g,y*-b+w*g,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){b=d(a);g=c(a);m=this.a00;e=this.a01;n=this.a02;f=this.a03;p=this.a20;k=this.a21;x=this.a22;w=this.a23;return new A(m*g+p*-b,e*g+k*-b,n*g+x*-b,f*g+w*-b,this.a10,this.a11,this.a12,this.a13,m*b+p*g,e*b+k*g,n*b+x*g,f*b+w*g,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){b=d(a);g=c(a);m=this.a00;e=this.a01;n=this.a02;f=this.a03;v=this.a10;q=this.a11;u=this.a12;y=this.a13;return new A(m*g+v*b,e*g+q*b,n*g+u*b,f*g+y*b,m*-b+v*g,e*-b+q*g,n*-b+u*g,f*-b+y*g,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return h(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){l=a.norm3D(b);if(0===l)return{x:0,y:0,z:0};if(1===l)return{x:b.x,y:b.y,z:b.z};l=1/l;return{x:b.x*l,y:b.y*l,z:b.z*l}};a.dotProduct3D=function(a,b){return a.x*
b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};a.add3D=function(a,b){return{x:a.x+b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,c){return r(a.x-b.x)<=c&&r(a.y-b.y)<=c&&r(a.z-b.z)<=c};a.Vector4D=z;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function d(a,b){a.textNode=null;a.lineCap=g;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);q=1;for(u=this.projVert.length;q<u;q++)a.lineTo(this.projVert[q].x,this.projVert[q].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=b.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function c(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";f=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.fontSize=Math.max(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,f)}function r(a){a.textNode=null;a.lineCap=g;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function l(b,c,k){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
c),a.subtract3D(b,k)))}if(a.loadLib)return a;var b=2*Math.PI,g=lineJoin="round",m,e,n,f,v,q,u,y,p,k,x,w,z,A=function(a,b){Object.assign(this,a);this.space=b;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=h:"face"===this.type?(this.normal=l(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=d):"text"===this.type?this.draw=c:"edge"===this.type&&(this.draw=r);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};A.prototype.computeDepth=function(b){this.space=b;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};q=0;for(u=this.vertices.length;q<u;q++)this.spaceVertices[q]=b.rotateVertex(this.vertices[q]),this.average.x+=this.spaceVertices[q].x,this.average.y+=this.spaceVertices[q].y,this.average.z+=this.spaceVertices[q].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=b.project(this.average);this.depth=a.norm3D(a.subtract3D(b.eye,this.average));2<this.vertices.length&&(this.normal=l(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));q=0;for(u=this.vertices.length;q<u;q++)this.newSpaceVert[q]=this.spaceVertices[q],this.projVert[q]=this.newProjVert[q]=b.project(this.spaceVertices[q]);2<this.vertices.length&&(this.direction=l(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;q=0;for(u=this.vertices.length;q<u;q++)y=a.norm3D(a.subtract3D(this.spaceVertices[q],b.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,y),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,y);q=0;for(u=this.vertices.length;q<u;q++)this.minx>this.projVert[q].x&&(this.minx=this.projVert[q].x),this.maxx<this.projVert[q].x&&(this.maxx=this.projVert[q].x),this.miny>this.projVert[q].y&&(this.miny=this.projVert[q].y),
this.maxy<this.projVert[q].y&&(this.maxy=this.projVert[q].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];q=0;for(u=this.vertices.length;q<u;q++)(1E-8<Math.abs(this.vertices[q].x-this.vertices[(q+1)%u].x)||1E-8<Math.abs(this.vertices[q].y-this.vertices[(q+1)%u].y)||1E-8<Math.abs(this.vertices[q].z-this.vertices[(q+1)%u].z)||1E-8<Math.abs(this.vertices[q].w-this.vertices[(q+1)%u].w))&&v.push(this.vertices[q]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};A.prototype.drawText=
function(b,c,k,f,d,g,h,q,l,u,p){m=this.evaluator;b.textNode=c;g=m.eval(this.offset_dist);h=-a.degToRad(m.eval(this.offset_angle));k+=g*Math.cos(h);f+=g*Math.sin(h);b.textNode.pos={x:k,y:f};c.hasContent&&(c.draw(b,d,k,f,!0),n=this.fromPoint?c.textNodes.metrics.w/2:0,e=this.fromPoint?c.textNodes.metrics.h/2:0,c.draw(b,d,k-n,f-e))};A.prototype.splitFace=function(b){if(this.intersects(b)){var c=i2=null,k=ix2=0,e,f;var n=this.vertices;var d=b.vertices;var g=0;for(f=d.length;g<f;g++){var h=this.intersection(d[g],
d[(g+1)%f]);if(null!==h)if(null===c){if(c=h,k=g,2===d.length){i2=c;break}}else if(!a.equals3DEpsilon(h,c,1E-8)){i2=h;ix2=g;break}}if(null!==c&&null!==i2){g=this.isInterior(c)||this.isInterior(i2);var q=e=null;if(!g&&3<=d.length)for(f=0,n=n.length;f<n;f++)if(h=b.intersection(this.vertices[f],this.vertices[(f+1)%n]),null!==h)if(null===e)e=h;else if(!a.equals3DEpsilon(h,e,1E-8)){q=h;break}if(g||null!==e&&null!==q&&b.isInterior(e)&&b.isInterior(q)){q=!0;n=h=null;if(2===d.length)a.equals3DEpsilon(c,d[0],
1E-8)||a.equals3DEpsilon(c,d[1],1E-8)?q=!1:(h=[],h[0]=d[0],h[1]=c,n=[],n[0]=c,n[1]=d[1]);else for(h=[],n=[],g=f=e=0;g<d.length;g++)g<k?h[e++]=d[g]:g==k?(h[e++]=d[g],h[e++]=c,n[f++]=c):g<ix2?n[f++]=d[g]:g==ix2?(n[f++]=d[g],n[f++]=i2,h[e++]=i2):h[e++]=d[g];if(q){c=[];c[0]=new A({vertices:h,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);c[0].removeDoubles();c[0].normal=b.normal;c[1]=new A({vertices:n,type:"face",frontColor:b.frontColor,backColor:b.backColor,
edges:b.edges,model:b.model},this.space);c[1].removeDoubles();c[1].normal=b.normal;if(2<c[0].vertices.length)return 2<c[1].vertices.length?c:[c[0]];if(2<c[1].vertices.length)return[c[1]]}}}}return[b]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(b){var c=this.vertices;var k=b.vertices;if(0<c.length){var e=a.dotProduct3D(k[0],b.normal);var f=a.dotProduct3D(c[0],b.normal);if(1E-8>Math.abs(e-f))return!0;for(var n=1,d=
c.length;n<d;n++)if(k=a.dotProduct3D(c[n],b.normal),1E-8>Math.abs(e-k)||k>e&&f<e||k<e&&f>e)return!0}return!1};A.prototype.intersection=function(b,c){var k=this.vertices;if(0<k.length){c=a.subtract3D(c,b);var e=a.dotProduct3D(c,this.normal);if(0!==e&&(k=a.dotProduct3D(a.subtract3D(k[0],b),this.normal)/e,-1E-8<k&&1.00000001>k))return a.add3D(b,a.scalarProduct3D(c,k))}return null};A.prototype.isInterior=function(b){var c=this.vertices;if(0<c.length)for(var k=0,e=a.subtract3D(c[0],b),f=0,n=c.length;f<
n;f++){var d=a.subtract3D(c[(f+1)%n],b),g=a.dotProduct3D(a.crossProduct3D(e,d),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(e,d))break}else{if(0>k&&0<g||0<k&&0>g)return!1;e=d;k=g}}return!0};A.prototype.inFrontOf=function(a,b,c){if(this.minDistanceToEye>=b.maxDistanceToEye||this.maxx<=b.minx||this.minx>=b.maxx||this.maxy<=b.miny||this.miny>=b.maxy)return!1;for(w=0;3>w;w++)if(p=null,p=0===w?this.intersections(b):1===w?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=p&&0<p.length){for(z=
0;z<p.length;z++)a.push(p[z]);q=0;for(u=p.length;q<u;q++){k=p[q];x=this.space.rayFromEye(k.x,k.y);try{t=this.distanceToEyeAlong(x)-b.distanceToEyeAlong(x);if(t<=-c)return!0;if(t>=c)return!1}catch(J){}}}return!1};A.prototype.intersections=function(b){for(var c=[],k,e,f,n=new a.R2,d=this.newSpaceVert,g=b.newSpaceVert,h=this.newProjVert,q=b.newProjVert,m=0,l=d.length;m<l;m++){b=d[m];k=d[(m+1)%l];for(var u=0,p=g.length;u<p;u++)e=g[u],f=g[(u+1)%p],b!=e&&b!=f&&k!=e&&k!=f&&(e=n.intersection(h[m],h[(m+1)%
l],q[u],q[(u+1)%p]),null!=e&&c.push(e))}return c};A.prototype.distanceToEyeAlong=function(b){b=a.dotProduct3D(this.normal,b);if(1E-6<Math.abs(b))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/b;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var b=[],c=this.newSpaceVert,k=this.newProjVert,e=0,f=c.length;e<f;e++)!a.isVertex(c[e])&&a.appearsToContain(k[e])&&b.push(k[e]);return b};A.prototype.appearsToContain=function(a){for(var b=
0,c,k=this.newProjVert,e=0,f=this.newSpaceVert.length;e<f;e++){c=(k[e].x-a.x)*(k[(e+1)%f].y-a.y)-(k[(e+1)%f].x-a.x)*(k[e].y-a.y);if(0!=b)if(1E-8>Math.abs(c)){if(1E-8<Math.abs(k[e].x-k[(e+1)%f].x))return Math.min(k[e].x,k[(e+1)%f].x)<=a.x+1E-8&&a.x<=Math.max(k[e].x,k[(e+1)%f].x)+1E-8;if(1E-8<Math.abs(k[e].y-k[(e+1)%f].y))return Math.min(k[e].y,k[(e+1)%f].y)<=a.y+1E-8&&a.y<=Math.max(k[e].y,k[(e+1)%f].y)+1E-8}else if(0<b&&0>c||0>b&&0<c)return!1;b=c}return!0};A.prototype.isVertex=function(b){for(var c=
this.newSpaceVert,k=0,e=c.length;k<e;k++)if(a.equals3DEpsilon(b,c[k],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var b=[],c=0,e,f=a.length,n=a.length-1;-1<n;n--)e=a.charAt(n),0==c?"="==e&&(c=1):1==c?" "!=e&&(c="<"===e||">"===e?0:2):2==c&&" "==e&&(b.unshift(a.substring(n+1,f)),f=n,c=0);b.unshift(a.substring(0,f));return b}if(a.loadLib)return a;var d={x:0,y:0,z:0},c,r,l,b,g,m=a.degToRad,e,n=function(b,c){this.parent=b;this.evaluator=b.evaluator;var e=b.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=e.parse("1");this.abs_coord=!1;this.family="";this.family_interval=e.parse("[0,1]");this.family_steps=e.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=e.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=e.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=e.parse("(0,0,0)");this.model="color";Object.assign(this,c);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=e.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style=
"Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=e.parse(this.inirot);this.endrot=e.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};n.prototype.getSpace=function(){for(var a=this.parent.spaces,b,c=0,
e=a.length;c<e;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};n.prototype.getFamilyValues=function(){c=this.evaluator;r=c.eval(this.family_interval);this.familyInf=r[0][0];this.familySup=r[0][1];this.fSteps=Math.round(c.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};n.prototype.buildFamilyPrimitives=function(){c=this.evaluator;this.getFamilyValues();l=c.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)c.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,c.eval(this.drawif)&&this.buildPrimitives();c.setVariable(this.family,l)};n.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};n.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(m(b[0][0])),this.inirotM=
this.inirotM.rotateX(m(b[0][1])),this.inirotM=this.inirotM.rotateZ(m(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(m(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(m(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.inipos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(d);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(m(b[0][0])),this.endrotM=this.endrotM.rotateX(m(b[0][1])),this.endrotM=this.endrotM.rotateZ(m(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(m(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(m(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.endpos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(d)};n.prototype.transformVertex=function(a){this.inirotEuler?g=
this.inirotM.multiplyVector4(a):(g=this.inirotM_X.multiplyVector4(a),g=this.inirotM_Y.multiplyVector4(g),g=this.inirotM_Z.multiplyVector4(g));g=this.iniposM.multiplyVector4(g);this.endrotEuler?g=this.endrotM.multiplyVector4(g):(g=this.endrotM_X.multiplyVector4(g),g=this.endrotM_Y.multiplyVector4(g),g=this.endrotM_Z.multiplyVector4(g));g=this.endposM.multiplyVector4(g);this.macroChildren&&(g=this.applyMacroTransform(g));g.adjustDec();return g};n.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
g=this.macro_inirotM.multiplyVector4(a):(g=this.macro_inirotM_X.multiplyVector4(a),g=this.macro_inirotM_Y.multiplyVector4(g),g=this.macro_inirotM_Z.multiplyVector4(g));g=this.macro_iniposM.multiplyVector4(g);this.macro_endrotEuler?g=this.macro_endrotM.multiplyVector4(g):(g=this.macro_endrotM_X.multiplyVector4(g),g=this.macro_endrotM_Y.multiplyVector4(g),g=this.macro_endrotM_Z.multiplyVector4(g));return g=this.macro_endposM.multiplyVector4(g)};n.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],c=0,e=a.length;c<e;c++)""!==a[c].trim()&&(b=b.concat(h(a[c])));c=0;for(e=b.length;c<e;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};n.prototype.splitFace=function(a){for(var b=0,c=this.primitives.length;b<c;b++)if(e=[],"face"===this.primitives[b].type){for(var n=0,f=a.primitives.length;n<f;n++)"face"===a.primitives[n].type?e=e.concat(this.primitives[b].splitFace(a.primitives[n])):e.push(a.primitives[n]);a.primitives=e}};a.Graphic3D=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b=function(b,c){return a.Graphic3D.call(this,b,c)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();d=h.eval(this.expresion);c=d[0][0];r=d[0][1];l=d[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,r,l,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:h.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||h.parser.parse("10"),this.offset_angle=this.offset_angle||h.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,r,l,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:h.eval(this.decimals),fixed:this.fixed,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(n,a.Graphic3D);n.prototype.buildPrimitives=function(){m=this.evaluator;this.updateMVMatrix();g=m.getVariable("u");m.setVariable("u",this.Nu);e=m.eval(this.expresion);h=e[0][0];d=e[0][1];c=e[0][2];r=e[1][0];l=e[1][1];b=e[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
d,c,1)),this.transformVertex(new a.Vector4D(r,l,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:m.eval(this.width)},this.space));m.setVariable("u",g)};a.Segment3D=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n,f,v,q,u,y=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.parameter=c.parameter||"t";c.parameter_interval=c.parameter_interval||b.evaluator.parser.parse("[0,1]");c.parameter_steps=c.parameter_steps||b.evaluator.parser.parse("8");c.expresion=c.parseExpression();return c};$jscomp.inherits(y,a.Graphic3D);y.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();r=h.getVariable("x");l=h.getVariable("y");b=h.getVariable("z");
d=h.getVariable("u");c=h.getVariable("v");h.setVariable("u",0);h.setVariable("v",0);g=parseInt(h.eval(this.Nu));m=parseInt(h.eval(this.Nv));e=[];for(f=0;f<=g;f++)for(h.setVariable("u",f/g),v=0;v<=m;v++){h.setVariable("v",v/m);q=0;for(u=this.expresion.length;q<u;q++)h.eval(this.expresion[q]);e.push(this.transformVertex(new a.Vector4D(h.getVariable("x"),h.getVariable("y"),h.getVariable("z"),1)))}var p=this.color.getColor(),k=this.backcolor.getColor(),x=this.edges?this.edges.getColor():"";for(f=0;f<
g;f++)for(v=0;v<m;v++)n=[],n.push(e[v+f*m+f]),n.push(e[v+1+f*m+f]),n.push(e[v+2+(f+1)*m+f]),n.push(e[v+1+(f+1)*m+f]),this.primitives.push(new a.Primitive3D({vertices:n,type:"face",frontColor:p,backColor:k,edges:x,model:this.model},this.space));h.setVariable("x",r);h.setVariable("y",l);h.setVariable("z",b);h.setVariable("u",d);h.setVariable("v",c)};a.Surface3D=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(e,a.Graphic3D);e.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();m=g.eval(this.expresion);for(var e=this.color.getColor(),f=0,v=m.length-1;f<v;f++)h=m[f][0],d=m[f][1],c=m[f][2],r=m[f+1][0],l=m[f+1][1],b=m[f+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
d,c,1)),this.transformVertex(new a.Vector4D(r,l,b,1))],type:"edge",frontColor:e,lineWidth:g.eval(this.width)},this.space))};a.Polygon3D=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.expresion=c.parseExpression();return c};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();r=g.getVariable("x");l=g.getVariable("y");b=g.getVariable("z");c=g.getVariable("u");g.setVariable("u",0);d=g.eval(this.Nu);h=[];for(var e=0;e<=d;e++){g.setVariable("u",e/d);for(var n=0,f=
this.expresion.length;n<f;n++)g.eval(this.expresion[n]);h.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}e=0;for(n=h.length-1;e<n;e++)this.primitives.push(new a.Primitive3D({vertices:[h[e],h[e+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:g.eval(this.width)},this.space));this.fill&&2<h.length&&this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));g.setVariable("x",r);g.setVariable("y",b);g.setVariable("z",l);g.setVariable("u",c)};a.Curve3D=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n,f,v=function(b,c){return a.Graphic3D.call(this,b,c)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){n=this.evaluator;this.updateMVMatrix();f=n.eval(this.expresion);h=f[0][0];d=f[0][1];c=f[0][2];r=f[1][0];l=f[1][1];b=f[1][2];g=f[2][0];m=f[2][1];e=f[2][2];var q=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,d,c,1)),this.transformVertex(new a.Vector4D(g,
m,e,1)),this.transformVertex(new a.Vector4D(r,l,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:q,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){d=this.evaluator;this.updateMVMatrix();c=d.eval(this.expresion);h=[];for(var l=c.length-1;0<=l;l--)h.push(this.transformVertex(new a.Vector4D(c[l][0],c[l][1],c[l][2],1)));l=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:l,model:this.model},this.space))};a.Face3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("2");c.length=c.length||b.evaluator.parser.parse("2");return c};$jscomp.inherits(g,a.Graphic3D);g.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();h=b.eval(this.Nu);d=[this.transformVertex(new a.Vector4D(0,0,0,1))];c=b.eval(this.width)/2;r=b.eval(this.length)/2;l=2*Math.PI/h;for(var g=0;g<h;g++)d.push(this.transformVertex(new a.Vector4D(c*
Math.cos(l*g),r*Math.sin(l*g),0,1)));var e=this.color.getColor(),n=this.backcolor.getColor(),f=this.edges?this.edges.getColor():"";for(g=0;g<h;g++)this.primitives.push(new a.Primitive3D({vertices:[d[0],g+2<=h?d[g+2]:d[1],d[g+1]],type:"face",frontColor:e,backColor:n,edges:f,model:this.model},this.space))};a.Polireg3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l=function(b,c){b=a.Graphic3D.call(this,b,c)||this;b.shadowColor=b.shadowColor?b.shadowColor.getColor():"transparent";return b};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){h=this.evaluator;d=h.eval(this.expresion);c=d[0][0];r=d[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(c,r,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:h.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=l;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var d=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),c=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,l,b=0,g=function(g,e){var n=a.Graphic.call(this,g,e)||this;n.expresion=n.expresion||void 0;n.inirot=n.inirot||"(0,0,0)";n.inirotEuler=n.inirotEuler||!1;n.inipos=n.inipos||g.evaluator.parser.parse("(0,0,0)");n.endrot=
n.endrot||"(0,0,0)";n.endrotEuler=n.endrotEuler||!1;n.endpos=n.endpos||g.evaluator.parser.parse("(0,0,0)");n.name=n.name||"_descartes_empty_name_"+b++;Object.assign(n,e);n.inirot.match("Euler")&&(n.inirot=n.inirot.replace("Euler",""),n.inirotEuler=!0);n.endrot.match("Euler")&&(n.endrot=n.endrot.replace("Euler",""),n.endrotEuler=!0);n.inirot=n.evaluator.parser.parse(n.inirot);n.endrot=n.evaluator.parser.parse(n.endrot);n.inirotM=new a.Matrix4x4;n.inirotM_X=new a.Matrix4x4;n.inirotM_Y=new a.Matrix4x4;
n.inirotM_Z=new a.Matrix4x4;n.iniposM=new a.Matrix4x4;n.endrotM=new a.Matrix4x4;n.endrotM_X=new a.Matrix4x4;n.endrotM_Y=new a.Matrix4x4;n.endrotM_Z=new a.Matrix4x4;n.endposM=new a.Matrix4x4;n.graphics=[];g=g.lessonParser;var f=new a.Tokenizer;if(void 0==n.expresion)return n;"'"!==n.expresion.charAt(0)&&(n.expresion="'"+n.expresion+"'");n.expresion=n.evaluator.parser.parse(n.expresion);e=n.evaluator.eval(n.expresion);if(e)var l=(l=document.getElementById(e))&&"descartes/macro"==l.type?l.text:a.openFile(e);
if(l){var q=a.convertHTMLEntities(l).replace(/\r/g,"").split("\n");l=[];e=0;for(var m=q.length;e<m;e++){var r=q[e].indexOf("=");if(-1!==r){r=g.split(q[e]);for(var p=0,k=r.length;p<k;p++)if(r[p]&&1<r.length&&("id"===h[r[p][0]]||"type"===h[r[p][0]])){l.push(r);break}}}e=0;for(m=l.length;e<m;e++){k=(p=l[e]||[],p[0])&&"id"===p[0][0];var x=!1;q=0;for(r=p.length;q<r;q++){var w=p[q][0].indexOf(".");-1===w||k?w=h[p[q][0]]:(w=h[p[q][0].substring(w+1)],p[q][0]=n.name+"."+p[q][0]);"type"===w&&"surface"===h[p[q][1]]&&
(x=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==p[q][1].charAt(0)||"file"===w&&p[q][1].match(c)||"id"!==w&&void 0!==h[p[q][1]])||"width"===w||"height"===w||"length"===w)if(x&&"expresion"===w){var z=p[q][1].split(" ");for(var A="",D=0,G=z.length;D<G;D++){for(var F=z[D].replace(/&squot;/g,"'").split(";"),J=0,E=F.length;J<E;J++){w=f.tokenize(F[J].replace(/\\n/g,";"));for(var B=0,I=w.length;B<I;B++)if("identifier"===w[B].type&&!(a.reservedIds+
"-x-y-z-u-v-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=n.name+"."+w[B].value;F[J]=f.flatTokens(w)}A+=F.join(";")+" "}p[q][1]=A}else if("text"==w)if(p[q][1].match(/\{\\rtf1/)){w=p[q][1];var L=n;z=function(b,c){c=f.tokenize(c.replace(/&squot;/g,"'"));for(var k=0,e=c.length;k<e;k++)if("identifier"==c[k].type&&!a.reservedIds.match("-"+c[k].value+"-")||"R"===c[k].value||"G"===c[k].value||"B"===c[k].value)c[k].value=L.name+"."+c[k].value;return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+f.flatTokens(c)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,z);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,z);p[q][1]=w}else{z=g.parseText(p[q][1]).textElementsMacros;A=0;for(D=z.length;A<D;A++){w=f.tokenize(z[A].replace(/&squot;/g,"'"));G=0;for(F=w.length;G<F;G++)if("identifier"===w[G].type&&!a.reservedIds.match("-"+w[G].value+"-")||"R"===w[G].value||"G"===w[G].value||"B"===w[G].value)w[G].value=n.name+"."+w[G].value;
w=f.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");z[A]=w.substring(1,w.length-1)}p[q][1]=z.join("")}else{F=p[q][1].replace(/&squot;/g,"'").split(";");J=0;for(E=F.length;J<E;J++){w=f.tokenize(F[J].replace(/\\n/g,";"));B=0;for(I=w.length;B<I;B++)if("identifier"===w[B].type&&!(a.reservedIds+"-Euler-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=n.name+"."+w[B].value;F[J]=f.flatTokens(w)}p[q][1]=F.join(";")}}}e=0;for(m=
l.length;e<m;e++)if(l[e][0]){p="";k=!1;q=0;for(r=l[e].length;q<r;q++)"type"===h[l[e][q][0]]&&d.match("-"+h[l[e][q][1]]+"-")&&(k=!0),p=p+l[e][q][0]+"='"+l[e][q][1]+"' ";l[e]=p+(k?" space='"+n.spaceID+"'":"");k?n.graphics.push(g.parse3DGraphic(l[e],n.abs_coord,n.background,n.inirot)):g.parseAuxiliar(l[e])}}e=0;for(m=n.graphics.length;e<m;e++)n.graphics[e].macroChildren=!0;return n};$jscomp.inherits(g,a.Graphic);g.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();
var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var b=0,c=this.fSteps;b<=c;b++)evaluator.setVariable(this.family,this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};g.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};g.prototype.updateMacro=function(){this.updateTransformation();
if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var b=this.graphics.length;a<b;a++)r=this.graphics[a],r.macro_inirotEuler=this.inirotEuler,r.macro_inirotM=this.inirotM,r.macro_inirotM_X=this.inirotM_X,r.macro_inirotM_Y=this.inirotM_Y,r.macro_inirotM_Z=this.inirotM_Z,r.macro_iniposM=this.iniposM,r.macro_endrotEuler=this.endrotEuler,r.macro_endrotM=this.endrotM,r.macro_endrotM_X=this.endrotM_X,r.macro_endrotM_Y=this.endrotM_Y,r.macro_endrotM_Z=
this.endrotM_Z,r.macro_endposM=this.endposM,r.update();a=0;for(b=this.graphics.length;a<b;a++){r=this.graphics[a];if(r.split||this.split)for(var c=a+1;c<b;c++)l=this.graphics[c],(l.split||this.split)&&r.splitFace(l);this.primitives=this.primitives.concat(r.primitives||[])}};g.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),
this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);tmpExpr=this.evaluator.eval(this.endrot);
this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.endpos);
translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};g.prototype.drawAux=function(a){};a.Macro3D=g;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(a,b,c,k,e){d.call(this,a/p,a/p,a/p,k,e)}function d(a,b,c,e,f){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,e,f)||(this.vertices=[new k(a,c,b,1),new k(a,-c,b,1),new k(a,c,-b,1),new k(a,-c,-b,1),new k(-a,c,b,1),new k(-a,-c,b,1),new k(-a,c,-b,1),new k(-a,-c,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,c,e,f))}function c(a,b,c,e,f){a/=2;if(!this.changeGeometry(a,b,c,e,f)){var n=2*Math.PI/3,d=2*a*Math.sqrt(2)/3,g=-a/
3,h=d*Math.cos(n)+0*Math.sin(n);n=-d*Math.sin(n)+0*Math.cos(n);this.vertices=[new k(0,0,a,1),new k(h,n,g,1),new k(h,-n,g,1),new k(d,0,g,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,c,e,f)}}function r(a,b,c,e,f){a/=2;this.changeGeometry(a,b,c,e,f)||(this.vertices=[new k(0,0,a,1),new k(a,0,0,1),new k(-a,0,0,1),new k(0,a,0,1),new k(0,-a,0,1),new k(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,c,e,f))}function l(b,
c,e,f,n){b/=Math.PI;if(!this.changeGeometry(b,c,e,f,n)){B=b/1.6180339887;I=1.6180339887*b;this.vertices=[new k(b,b,b,1),new k(b,b,-b,1),new k(b,-b,b,1),new k(b,-b,-b,1),new k(-b,b,b,1),new k(-b,b,-b,1),new k(-b,-b,b,1),new k(-b,-b,-b,1),new k(0,B,I,1),new k(0,B,-I,1),new k(0,-B,I,1),new k(0,-B,-I,1),new k(B,I,0,1),new k(B,-I,0,1),new k(-B,I,0,1),new k(-B,-I,0,1),new k(I,0,B,1),new k(I,0,-B,1),new k(-I,0,B,1),new k(-I,0,-B,1)];L=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(N=this.vertices.length;H<
N;H++)this.vertices[H]=L.multiplyVector4(this.vertices[H]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,c,e,f,n)}}function b(b,c,e,f,n){b/=3.8;if(!this.changeGeometry(b,c,e,f,n)){I=1.6180339887*b;this.vertices=[new k(0,b,I,1),new k(0,b,-I,1),new k(0,-b,I,1),new k(0,-b,-I,1),new k(b,I,0,1),new k(b,-I,0,1),new k(-b,I,0,1),new k(-b,-I,0,1),
new k(I,0,b,1),new k(I,0,-b,1),new k(-I,0,b,1),new k(-I,0,-b,1)];this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];L=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);H=0;for(N=this.vertices.length;H<N;H++)this.vertices[H]=L.multiplyVector4(this.vertices[H]);this.updateValues(b,c,e,f,n)}}function g(a,b,c,e,f){a/=2;this.isSphere?c=b=a:(b/=2,c/=2);if(!this.changeGeometry(a,
b,c,e,f)){this.vertices=[new k(0,0,b,1)];for(H=1;H<e;H++)for(F=H*u/e,C=0;C<f;C++)G=C*y/f,z=a*v(F)*q(G),A=c*v(F)*v(G),D=b*q(F),this.vertices.push(new k(z,A,D,1));this.vertices.push(new k(0,0,-b,1));this.faces=[];for(H=0;H<f;H++)this.faces.push([0,(H+1)%f+1,H%f+1]);for(H=1;H<e-1;H++)for(C=0;C<f;C++)this.faces.push([C+1+(H-1)*f,(C+1)%f+1+(H-1)*f,(C+1)%f+1+H*f,C+1+H*f]);for(H=0;H<f;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-f+H,this.vertices.length-1-f+(H+1)%f]);this.updateValues(a,
b,c,e,f)}}function m(a,b,c,e,f){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,e,f)){this.vertices=[];for(H=0;H<f;H++)for(C=0;C<e;C++)z=a*(f-H)/f*q(C*y/e),A=c*(f-H)/f*v(C*y/e),D=b-2*H*b/f,this.vertices.push(new k(z,A,D,1));this.vertices.push(new k(0,0,-b,1));this.faces=[];for(H=0;H<f-1;H++)for(C=0;C<e;C++)this.faces.push([C+H*e,(C+1)%e+H*e,(C+1)%e+(H+1)*e,C+(H+1)*e]);for(H=0;H<e;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-e+H,this.vertices.length-1-e+(H+1)%e]);this.updateValues(a,
b,c,e,f)}}function e(a,b,c,e,f){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,e,f)){this.vertices=[];for(H=0;H<f+1;H++)for(C=0;C<e;C++)z=a*q(C*y/e),A=c*v(C*y/e),D=b-2*H*b/f,this.vertices.push(new k(z,A,D,1));this.faces=[];for(H=0;H<f;H++)for(C=0;C<e;C++)this.faces.push([C+H*e,(C+1)%e+H*e,(C+1)%e+(H+1)*e,C+(H+1)*e]);this.updateValues(a,b,c,e,f)}}function n(a,b,c,e,f){a/=2;b/=2;c/=2;J=x.eval(this.R);E=x.eval(this.r);if(!this.changeGeometry(a,b,c,e,f)){this.vertices=[];for(H=0;H<f+1;H++)for(C=0;C<e;C++)z=
-(J+E*v(y*C/e))*v(y*H/f),A=(J+E*v(y*C/e))*q(y*H/f),D=E*q(y*C/e),this.vertices.push(new k(z,A,D,1));this.faces=[];for(H=0;H<f;H++)for(C=0;C<e;C++)this.faces.push([C+H*e,C+(H+1)*e,(C+1)%e+(H+1)*e,(C+1)%e+H*e]);this.updateValues(a,b,c,e,f)}}function f(){this.vertices=[];this.faces=[];H=0;for(N=this.fileData.length;H<N;H++)M=this.fileData[H],M.match(/^V\(/)?(O=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new k(O[0]||0,O[1]||0,O[2]||0,1))):M.match(/^F\(/)&&(O=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var v=Math.sin,q=Math.cos,u=Math.PI,y=2*u,p=Math.sqrt(3),k,x,w,z,A,D,G,F,J,E,B,I,L,M,O,H,N,C,Q,K=function(q,p){p=a.Graphic3D.call(this,q,p)||this;p.width=p.width||q.evaluator.parser.parse("2");p.height=p.height||q.evaluator.parser.parse("2");p.length=p.length||q.evaluator.parser.parse("2");p.R=p.R||q.evaluator.parser.parse("2");p.r=p.r||q.evaluator.parser.parse("1");k=a.Vector4D;switch(p.subType){case "cube":p.buildGeometry=
h;break;case "box":p.buildGeometry=d;break;case "tetrahedron":p.buildGeometry=c;break;case "octahedron":p.buildGeometry=r;break;case "sphere":p.isSphere=!0;case "ellipsoid":p.buildGeometry=g;break;case "dodecahedron":p.buildGeometry=l;break;case "icosahedron":p.buildGeometry=b;break;case "cone":p.buildGeometry=m;break;case "cylinder":p.buildGeometry=e;break;case "torus":p.buildGeometry=n;break;case "mesh":p.fileData=a.openFile(p.evaluator.eval(p.file)).split(/\r/),p.buildGeometry=f}return p};$jscomp.inherits(K,
a.Graphic3D);K.prototype.buildPrimitives=function(){x=this.evaluator;this.updateMVMatrix();this.buildGeometry(x.eval(this.width),x.eval(this.height),x.eval(this.length),x.eval(this.Nu),x.eval(this.Nv));var b=this.color.getColor(),c=this.backcolor.getColor(),e=this.edges?this.edges.getColor():"";H=0;for(N=this.faces.length;H<N;H++){w=[];C=0;for(Q=this.faces[H].length;C<Q;C++)w.push(this.transformVertex(this.vertices[this.faces[H][C]]));this.primitives.push(new a.Primitive3D({vertices:w,type:"face",
frontColor:b,backColor:c,edges:e,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,b,c,e,k){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===c&&this.oldNu===e&&this.oldNv===k};K.prototype.updateValues=function(a,b,c,e,k){this.oldWidth=a;this.oldHeight=b;this.oldLength=c;this.oldNv=k;this.oldNu=e};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,d=Math.min,c=Math.PI,r=Math.cos,l=Math.sin,b=Math.abs,g=Math.round,m,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J,E=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};E.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};E.prototype.copy=function(){return new E(this.x,this.y)};E.prototype.ix=function(){return g(h(d(this.x,32E3),-32E3))};E.prototype.iy=function(){return g(h(d(this.y,32E3),-32E3))};E.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};E.prototype.norm2=function(){return this.x*this.x+this.y*this.y};E.prototype.norm=function(){return Math.sqrt(this.norm2())};E.prototype.distance=function(a){e=this.copy();e.sub(a);return e.norm()};E.prototype.dot=function(a){return this.x*a.x+this.y*a.y};E.prototype.det=function(a){return this.x*a.y-this.y*a.x};E.prototype.mul=function(a){this.x*=a;this.y*=a};E.prototype.div=function(a){this.x/=a;this.y/=a};E.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};E.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};E.prototype.normalize=function(){m=this.norm();0!=m&&this.div(m)};E.prototype.rotR90=function(){m=this.x;this.x=this.y;this.y=-m};E.prototype.rotL90=function(){m=this.x;this.x=-this.y;this.y=m};E.prototype.rot=function(a){n=this.copy();q=r(a);u=l(a);this.x=n.x*q-n.y*u;this.y=n.x*u+n.y*q};E.prototype.rot2=function(a){this.rot(a*c/180)};E.prototype.intersection=function(a,c,e,n){y=c.x-a.x;p=e.x-n.x;k=e.x-a.x;x=c.y-a.y;w=e.y-n.y;z=e.y-a.y;J=y*
w-p*x;return 1E-6<b(J)?(f=(k*w-z*p)/J,v=(-k*x+z*y)/J,0<=f&&1>=f&&0<=v&&1>=v?new E(a.x+y*f,a.y+x*f):null):(c.x-e.x)*z!=(c.y-e.y)*k?null:a.x!=c.x?(A=d(a.x,c.x),D=h(a.x,c.x),A<=e.x&&e.x<=D?e:A<=n.x&&n.x<=D?n:null):e.x!=n.x?(G=d(e.x,n.x),F=h(e.x,n.x),G<=a.x&&a.x<=F?a:G<=c.x&&c.x<=F?c:null):a.y!=c.y?(A=d(a.y,c.y),D=h(a.y,c.y),A<=e.y&&e.y<=D?e:A<=n.y&&n.y<=D?n:null):e.y!=n.y?(G=d(e.y,n.y),F=h(e.y,n.y),G<=a.y&&a.y<=F?a:G<=c.y&&c.y<=F?c:null):a.x==e.x&&a.y==e.y?a:null};a.R2=E;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n=function(c,n){this.evaluator=c;this.constraint=n;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];b=
new a.R2(0,0);l=new a.R2(0,0);e=new a.R2(0,0)};n.prototype.getUnitNormal=function(){this.normal.normalize();return e.set(this.normal.x,this.normal.y)};n.prototype.gradient=function(a){h=this.evaluator;b.x=0;b.y=0;g=h.getVariable("x");m=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);h.setVariable("x",h.getVariable("x")+1E-6);d=h.eval(this.constraint);b.x=(d-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;h.setVariable("x",h.getVariable("x")-1E-6);h.setVariable("y",
h.getVariable("y")+1E-6);d=h.eval(this.constraint);b.y=(d-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;h.setVariable("x",g);h.setVariable("y",m);return b};n.prototype.findZero=function(a,b,e){h=this.evaluator;l.x=a.x;l.y=a.y;g=h.getVariable("x");m=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return l;h.setVariable("x",g);h.setVariable("y",m);for(var f=0;16>f;f++)if(c=l.x,r=l.y,this.normal=
this.gradient(l),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),l.x=c+this.normal.x,l.y=r+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=l.x-a.x,this.normal.y=l.y-a.y),l;return e?l:null};a.R2Newton=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(a,c){this.x=a;this.y=c};h.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};h.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};h.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};h.AXIS_X=new h(1,0);h.AXIS_Y=new h(0,1);a.Vector2D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.round,c,r,l,b,g,m,e,n,f,v,q,u,y,p=function(b,c){this.parent=b;this.evaluator=b.evaluator;var e=this.parser=b.evaluator.parser;this.id="GraphicControl"!==c.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==c.type?100:350;this.h="Video"!==c.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==c.type&&"Audio"!==c.type&&"Video"!==c.type?"TextArea"!==c.type?this.expresion=e.parse("(0,0,100,23)"):
(this.expresion=e.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=e.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("Scrollbar"==c.gui?"e0e4e8":"222222");this.colorInt="cc0022";"Scrollbar"==c.gui?this.colorInt="182C61":"GraphicControl"!==c.type&&(this.colorInt="f0f8ff");this.colorInt=new a.Color(this.colorInt);this.font_size=e.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=
this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=e.parse("1");this.activeif=e.parse("1");this.valueExpr=e.parse("0");this.decimals=e.parse("2");this.min=e.parse("-Infinity");this.max=e.parse("Infinity");this.incr=e.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,c);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");this.name=void 0==this.name||"_._"==this.name||"_nada_"==this.name||"_void_"==this.name?"":
this.name;c=this.evaluator.eval(this.expresion);this.x=d(c[0][0]);this.y=d(c[0][1]);4==c[0].length&&(this.w=d(c[0][2]),this.h=d(c[0][3]));this.actionExec=b.lessonParser.parseAction(this)};p.prototype.init=function(){};p.prototype.update=function(){};p.prototype.draw=function(){};p.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,c=a.length;b<c;b++){var e=a[b];if(e.id===this.spaceID)return e.addCtr(this),this.zIndex=e.zIndex,this.space=e,e.numCtrContainer}else{if("external"===
this.region)return this.parent.externalSpace.addCtr(this),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.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numCtrContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+"Space"].controls.push(this),this.parent[this.region+
"Space"].container}a[0].addCtr(this);this.zIndex=a[0].zIndex;return a[0].numCtrContainer};p.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};p.prototype.updatePositionAndSize=function(){l=b=g=m=!1;e=this.evaluator.eval(this.expresion);n=d(e[0][0]);l=d(this.x)!==n;this.x=n;n=d(e[0][1]);b=d(this.y)!==n;this.y=n;4===e[0].length&&(n=d(e[0][2]),g=d(this.w)!==n,this.w=n,n=d(e[0][3]),m=d(this.h)!==n,this.h=n);if(g||m||
l||b)this.init(!0,!0),this.draw()};p.prototype.formatOutputValue=function(a){y=this.parent;f=a+"";v=this.evaluator.eval(this.decimals);q=f.indexOf(".");-1!=q&&(u=f.substring(q+1),u.length>v&&(f=parseFloat(f).toFixed(v)));this.fixed&&(f=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(f)&&(f=this.fixed?parseFloat(f).toExponential(v):parseFloat(f).toExponential(),f=f.toUpperCase().replace("+",""));return f.replace(".",y.decimal_symbol)};p.prototype.updateAndExecAction=function(){this.parent.updateControls();
"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()};p.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);c=b*b;for(a=0;a<b;a++)r=h(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+r*r*192/c/255+")")};a.Control=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.abs,c=/[\w\.\-//]*(\.gif)/gi,r,l,b,g,m,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J,E,B,I,L,M,O,H,N,C,Q,K,R,P,S,T=function(b,c){var e=a.Control.call(this,b,c)||this;e.imageSrc=c.imageSrc||"";e.image=c.image||new Image;e.imageOver=c.imageOver||new Image;e.imageDown=c.imageDown||new Image;e.flat=c.flat||!1;e.borderColor=c.borderColor||!1;e.text_align=c.text_align||"center_center";e.image_align=c.image_align||"center_center";e.font_family=a.getFontName(c.font_family||
"arial");e.ratio=b.ratio;-1===e.font_size&&(e.noFSize=!0);e.borderColor&&(e.borderColor=new a.Color(e.borderColor));e.text_align=e.text_align.split("_");e.image_align=e.image_align.split("_");e.old_name=e.name;e.name.match(/^\[.*\]?/)?e.name=e.parser.parse(e.name.substring(1,e.name.length-1)):e.name=e.parser.parse("'"+e.name+"'");e.classContainer=e.cssClass?" "+e.cssClass+" ":"";e.extra_style=e.imageSrc.trim().match("^_STYLE_")?e.imageSrc.trim().substring(8):e.extra_style||"";e.imageSrc.trim().match("^_STYLE_")&&
(e.imageSrc="vacio.gif");if(e.extra_style){e.customStyle=!0;e.btnStyle=[];e.conStyle=[];e.conStyle.textBorder=3;b=e.extra_style.split("|");for(var k,f=0,n=b.length;f<n;f++)c=b[f],k=c.match(/rgb/g),c.match("class=")?e.classContainer=" "+c.substring(6):c.match("border=")?(e.btnStyle.push({type:"border-style",value:"solid"}),e.btnStyle.push({type:"border-width",value:c.substring(7).trim()+"px"})):c.match("borderRadius=")?(e.btnStyle.push({type:"border-radius",value:c.substring(13).trim()+"px"}),e.conStyle.push({type:"border-radius",
value:c.substring(13).trim()+"px"})):c.match("borderColor=")?e.btnStyle.push({type:"border-color",value:(k?"":"#")+c.substring(12).trim()}):c.match("overColor=")?e.conStyle.overColor=(k?"":"#")+c.substring(10).trim():c.match("downColor=")?e.conStyle.downColor=(k?"":"#")+c.substring(10).trim():c.match("font=")?e.conStyle.font=c.substring(5).trim().toLowerCase():c.match("inactiveColor=")?e.conStyle.inactiveColor=(k?"":"#")+c.substring(14).trim():c.match("inactiveColorBorder=")?e.conStyle.inactiveColorBorder=
(k?"":"#")+c.substring(20).trim():c.match("shadowTextBlur=")?e.conStyle.shadowTextBlur=parseFloat(c.substring(15).trim()):c.match("shadowTextOffsetX=")?e.conStyle.shadowTextOffsetX=parseFloat(c.substring(18).trim()):c.match("shadowTextOffsetY=")?e.conStyle.shadowTextOffsetY=parseFloat(c.substring(18).trim()):c.match("shadowTextColor=")?e.conStyle.shadowTextColor=(k?"":"#")+c.substring(16).trim():c.match("shadowBoxBlur=")?e.conStyle.shadowBoxBlur=parseFloat(c.substring(14).trim()):c.match("shadowBoxOffsetX=")?
e.conStyle.shadowBoxOffsetX=parseFloat(c.substring(17).trim()):c.match("shadowBoxOffsetY=")?e.conStyle.shadowBoxOffsetY=parseFloat(c.substring(17).trim()):c.match("shadowBoxColor=")?e.conStyle.shadowBoxColor=(k?"":"#")+c.substring(15).trim():c.match("shadowInsetBoxBlur=")?e.conStyle.shadowInsetBoxBlur=parseFloat(c.substring(19).trim()):c.match("shadowInsetBoxOffsetX=")?e.conStyle.shadowInsetBoxOffsetX=parseFloat(c.substring(22).trim()):c.match("shadowInsetBoxOffsetY=")?e.conStyle.shadowInsetBoxOffsetY=
parseFloat(c.substring(22).trim()):c.match("shadowInsetBoxColor=")?e.conStyle.shadowInsetBoxColor=(k?"":"#")+c.substring(20).trim():c.match("textBorder=")?e.conStyle.textBorder=parseFloat(c.substring(11).trim()):c.match("flat=")?e.flat=1==parseInt(c.substring(5).trim()):c.match("imgSizeW=")?e.imgSizeW=parseFloat(c.substring(9))||0:c.match("imgSizeH=")&&(e.imgSizeH=parseFloat(c.substring(9))||0)}e.imageSrc.match("_COLORES_")&&(b=e.imageSrc.split("_"),e.colorInt=new a.Color(b[2]),e.color=new a.Color(b[3]),
e.font_size=e.parser.parse(b[5]),e.imageSrc="");e.imageSrc.match(/^\[.*\]?/)?e.imageSrc=e.parser.parse(e.imageSrc.substring(1,e.imageSrc.length-1)):e.imageSrc=e.parser.parse("'"+e.imageSrc+"'");b=e.evaluator.eval(e.imageSrc).toString().trim();if(""!=b)if(c=b.substr(0,b.lastIndexOf(".")),k=b.substr(b.lastIndexOf(".")),b.match(/vacio.gif$/i))e.imageSrc=e.parser.parse("'vacio.gif'"),e.image.ready=1,e.emptyImage={ready:!0},e.parser.parse("'vacio.gif'");else if(e.image=e.parent.getImage(b),c)try{e.imageOver=
e.parent.getImage(c+"_over"+k),e.imageDown=e.parent.getImage(c+"_down"+k)}catch(X){}e.container=a.newHTML("div",{class:"DescartesButtonContainer"+e.classContainer,id:e.id,style:"width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+";"});e.btn=a.newHTML("canvas",{width:e.w*e.ratio,height:e.h*e.ratio,style:"position:absolute;left:0;top:0;width:"+e.w+"px;height:"+e.h+"px;"});e.ctx=e.btn.getContext("2d");e.ctx.imageSmoothingEnabled=!1;e.tooltip&&(e.btn.title=e.tooltip);e.container.appendChild(e.btn);
e.addControlContainer(e.container);e.addEvents();e.init();return e};$jscomp.inherits(T,a.Control);T.prototype.init=function(c){r=this.evaluator;G=this.container;l=this.btn;b=this.ctx;g=r.eval(this.expresion);this.x=g[0][0];this.y=g[0][1];4==g[0].length&&(this.w=parseInt(g[0][2]),this.h=parseInt(g[0][3]));l.width=this.w*this.ratio;l.height=this.h*this.ratio;l.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+this.h+"px;box-sizing:border-box;");G.setAttribute("style",
"width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var e=0,k=this.btnStyle.length;e<k;e++)l.style[this.btnStyle[e].type]=this.btnStyle[e].value;if(this.conStyle){e=0;for(k=this.conStyle.length;e<k;e++)G.style[this.conStyle[e].type]=this.conStyle[e].value;if(this.conStyle.shadowBoxColor){e=this.conStyle.shadowBoxOffsetX||0;k=this.conStyle.shadowBoxOffsetY||2;var f=this.conStyle.shadowBoxBlur||2;G.style.boxShadow=
e+"px "+k+"px "+f+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(e=this.conStyle.shadowInsetBoxOffsetX||0,k=this.conStyle.shadowInsetBoxOffsetY||-2,f=this.conStyle.shadowInsetBoxBlur||1,l.style.boxShadow=e+"px "+k+"px "+f+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.noFSize&&(this.font_size=r.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=r.eval(this.font_size);this.createGradient(this.w,this.h);G.style.display=0<r.eval(this.drawif)?"block":
"none";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&
this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(c)};T.prototype.update=function(){r=this.evaluator;G=this.container;l=this.btn;this.activeIfValue=0<r.eval(this.activeif);
this.drawIfValue=0<r.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(G.style.display="block",this.draw(),G.style.cursor=l.style.cursor=this.activeIfValue?"pointer":"not-allowed",G.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(G.style.display="none",this.buttonClick=!1)};T.prototype.draw=function(d){G=this.container;r=this.evaluator;l=this.btn;b=this.ctx;e=r.eval(this.name);this.text_object.draw(a.ctx,"#000000",0,0);e=this.text_object.textNodes.toStr();
n=this.evaluator.eval(this.imageSrc).toString().trim();if(!d&&(F=this.over===this.oldOver,J=this.buttonClick===this.oldButtonClick,E=this.activeIfValue===this.oldActiveIfValue,B=this.drawIfValue===this.oldDrawIfValue,I=e===this.oldName,L=n===this.oldImageSrc,M=this.colorInt.getColor()===this.oldBackColor,O=this.color.getColor()===this.oldTextColor,H=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=
this.drawIfValue,this.oldName=e,this.oldImageSrc=n,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,F&&J&&E&&B&&I&&L&&M&&O&&H))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);m=this.fs_evaluated;G.setAttribute("data-name",e);n?(f="vacio.gif"===n?this.emptyImage:this.parent.getImage(n),N=n.substr(0,n.lastIndexOf(".")),C=n.substr(n.lastIndexOf(".")),Q=N+"_over"+C,K=N+"_down"+C,R="vacio.gif"===n?this.emptyImage:this.parent.getImage(Q),
P="vacio.gif"===n?this.emptyImage:this.parent.getImage(K)):P=R=f=this.emptyImage;b.clearRect(0,0,this.w,this.h);q=u=0;this.buttonClick&&(q=u=1);this.text_object.draw(b,this.color.getColor(),0,0,!0);y=this.text_object.textNodes.metrics.w;p=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?A=h(this.w/2+q)-.5:"left"==this.text_align[1]?A=y/2+5+q:"right"==this.text_align[1]&&(A=this.w-y/2+q-5);"center"==this.text_align[0]?D=h(this.h/2+u)-.5:"top"==this.text_align[0]?D=p/2+u+4:"bottom"==
this.text_align[0]&&(D=this.h-p/2+u-3);if(f){if(k=this.imgSizeW?this.imgSizeW:f.width,x=this.imgSizeH?this.imgSizeH:f.height,"center"==this.image_align[1]?w=parseInt((this.w-k)/2)+q:"left"==this.image_align[1]?w=q:"right"==this.image_align[1]&&(w=this.w-k+q),"center"==this.image_align[0]?z=parseInt((this.h-x)/2)+u:"top"==this.image_align[0]?z=u:"bottom"==this.image_align[0]&&(z=this.h-x+u),f&&f.ready)if(f!==this.emptyImage&&f.complete)if(n.match(c))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage=
"url('"+n+"')",this.btn.style.backgroundPosition=w+"px "+z+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?G.style.backgroundColor=S:(b.fillStyle=S,b.fillRect(0,0,this.w,this.h));b.drawImage(f,0,0,f.width,f.height,w,z,k,x)}else this.emptyImage&&this.customStyle&&(S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?
G.style.backgroundColor=S:(b.fillStyle=S,b.fillRect(0,0,this.w,this.h)))}else S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?(G.style.backgroundColor=S,this.flat||(this.buttonClick||(this.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),this.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),this.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h))):(b.fillStyle=S,b.fillRect(0,0,this.w,
this.h));this.activeIfValue&&(R!==this.emptyImage&&this.over&&R.ready&&R.complete?Q.match(c)?(this.btn.style.backgroundImage="url('"+Q+"')",this.btn.style.backgroundPosition=w+"px "+z+"px"):b.drawImage(R,w,z):this.customStyle&&this.conStyle.overColor&&this.over&&(G.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?P!==this.emptyImage&&this.buttonClick&&P.ready&&P.complete?K.match(c)?(this.btn.style.backgroundImage="url('"+K+"')",this.btn.style.backgroundPosition=w+"px "+z+"px"):b.drawImage(P,
w,z):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(G.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!f&&(b.fillStyle="rgba(0,0,0,0.09)",b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(b.lineWidth=this.conStyle.textBorder,b.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(b.lineWidth=parseInt(m/6),b.strokeStyle=this.borderColor.getColor());this.text_object.draw(b,
this.color.getColor(),A,D);this.underlined&&(b.strokeStyle=this.color.getColor(),b.lineWidth=h(m/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(A-y/2+q,D+h(m/2)+h(m/5)-1.5),b.lineTo(A+y/2+q,D+h(m/2)+h(m/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?G.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=w;this._image_pos_y=z};T.prototype.drawLine=function(a,b,c,
e,k,f,n){a.lineWidth=void 0===n?1:n;a.strokeStyle=void 0===f?"black":f;v=a.lineWidth%2*.5;a.beginPath();a.moveTo(h(b)+v,h(c)+v);a.lineTo(h(e)+v,h(k)+v);a.stroke()};T.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(d(this.colorInt.r-this.color.r)+d(this.colorInt.g-this.color.g)+d(this.colorInt.b-this.color.b))/255)};T.prototype.buttonPressed=function(){this.updateAndExecAction()};T.prototype.addEvents=function(){function b(c,e,n){a.clearTimeout(f);k.buttonClick&&
k.drawIfValue&&k.activeIfValue&&(e.call(k),c=n?c:100,f=a.setTimeout(function(){b(c,e,!1)},c))}function c(c){this.focus();c.preventDefault();c.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();k.whichBtn=a.whichBtn(c);"L"==k.whichBtn&&k.activeIfValue&&(k.buttonClick=!0,k.draw(),"calculate"==k.action&&(k.evaluator.setVariable(k.id,k.evaluator.eval(k.valueExpr)),b(1E3,k.buttonPressed,!0)),k.btn.removeEventListener("touchend",e),k.btn.addEventListener("touchend",e),
k.btn.removeEventListener("mouseup",e),k.btn.addEventListener("mouseup",e))}function e(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(k.activeIfValue||k.buttonClick)k.buttonClick=!1,k.draw(),"calculate"!=k.action&&(k.evaluator.setVariable(k.id,k.evaluator.eval(k.valueExpr)),k.buttonPressed()),k.btn.removeEventListener("touchend",e),k.btn.removeEventListener("mouseup",e);k.parent.update()}var k=this,f;k.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=
!1;this.btn.addEventListener("touchstart",c);this.btn.addEventListener("mousedown",c);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();k.over=!0;k.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=null;b.preventDefault();b.stopPropagation();k.over=!1;k.buttonClick=!1;k.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;k.buttonClick=!1})};a.Button=T;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n,f,v,q,u,y=function(b,c){c=a.Control.call(this,b,c)||this;c.flat=c.image_dec_src&&c.image_inc_src;c.btn_pos=c.btn_pos||"v_left";c.horizontal="h_left"===c.btn_pos||"h_right"===c.btn_pos||"h_left_right"===c.btn_pos;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.tabindex=++c.parent.tabindex;c.name_str=c.name;c.initial_value=0;try{c.initial_value=
c.evaluator.eval(c.parser.parse(c.valueExprString))}catch(x){console.log(x)}c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:c.id});c.divUp=a.newHTML("div",{class:"DJS_Up"});c.divDown=a.newHTML("div",{class:"DJS_Down"});c.field=a.newHTML("input",{type:"text",id:c.id+"_spinner",class:"DescartesSpinnerField",tabindex:c.tabindex});c.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});
c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.label);c.container.appendChild(c.field);c.container.appendChild(c.divUp);c.container.appendChild(c.divDown);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);c.addControlContainer(c.container);f=c.evaluator.parser.parse("1");c.originalIncr=c.incr;if(0>c.evaluator.eval(c.decimals)||0===c.evaluator.eval(c.incr))b=c.evaluator.eval(c.incr),0<b?(c.incr=c.evaluator.parser.parse(parseInt(b).toString()),
c.originalIncr=c.incr):c.incr=f;c.image_dec_src&&(c.image_dec_src.match(/^\[.*\]?/)?c.image_dec_src=c.parser.parse(c.image_dec_src.substring(1,c.image_dec_src.length-1)):c.image_dec_src=c.parser.parse("'"+c.image_dec_src+"'"),c.old_image_dec_src=c.evaluator.eval(c.image_dec_src).toString().trim(),c.image_dec=c.parent.getImage(c.old_image_dec_src));c.image_inc_src&&(c.image_inc_src.match(/^\[.*\]?/)?c.image_inc_src=c.parser.parse(c.image_inc_src.substring(1,c.image_inc_src.length-1)):c.image_inc_src=
c.parser.parse("'"+c.image_inc_src+"'"),c.old_image_inc_src=c.evaluator.eval(c.image_inc_src).toString().trim(),c.image_inc=c.parent.getImage(c.old_image_inc_src));c.addEvents();c.init();return c};$jscomp.inherits(y,a.Control);y.prototype.init=function(b,c){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();var e=this.label.textContent;c||(this.value=this.validateValue(h.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<h.eval(this.font_size)?h.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var k=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font);
if(this.horizontal){b=parseInt(this.h);var f=parseInt(this.w/2-b),n=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(f=this.w-2*b,k=0);f<n&&(f=n);""==e&&(f=0);this.w-f-b<k&&(f=this.w-b-k);0>f&&(f=0);e=this.w-(f+2*b);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;");this.divUp.setAttribute("style","width:"+b+"px;height:"+b+"px;"+("h_left"===this.btn_pos?
"left:"+(f+b):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+b+"px;height:"+b+"px;left:"+(f+("h_right"===this.btn_pos?e:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;left:"+(b+f+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;");this.cover.setAttribute("style","width:"+e+"px;height:"+
this.h+"px;left:"+(b+f+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;")}else b=2+parseInt(this.h/2),f=parseInt(this.w/2-b/2),n=a.getTextWidth(e+"__",this.fieldFontSize+"px "+a.sansserif_font),this.visible||(f=this.w-b,k=0),f<n&&(f=n),""==e&&(f=0),this.w-f-b<k&&(f=this.w-b-k),0>f&&(f=0),e=this.w-(f+b),this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;"),
k="width:"+b+"px;left:"+(f+("v_right"===this.btn_pos?e:0))+"px;",this.divUp.setAttribute("style",k+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",k+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;"+(this.flat?"border-width:0;":"")),this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?b:0)+f)+"px;"),this.cover.setAttribute("style",
"width:"+e+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?b:0)+f)+"px;");this.field.value=c;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+f+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=f*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&this.image_dec.ready&&(this.divDown.style["background-image"]=
"url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);h.setVariable(this.id,this.value)};y.prototype.update=function(){h=this.evaluator;0>h.eval(this.decimals)?(d=h.eval(this.incr),0<d?this.originalIncr=this.incr=h.parser.parse(parseInt(d).toString()):this.incr=f):this.incr=0!==h.eval(this.originalIncr)?
this.originalIncr:f;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),this.old_image_dec_src!==v&&(this.divDown.style["background-image"]=
"url("+v+")",this.old_image_dec_src=v));this.image_inc&&(q=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==q&&(this.divUp.style["background-image"]="url("+q+")",this.image_inc_src=q));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(c=this.field.value,r=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==r&&this.field.value!=c&&(this.value=
this.validateValue(c),this.field.value=this.formatOutputValue(this.value)),h.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(u=this.label_color.getColor())||"CanvasGradient"!==u.constructor.name&&"CanvasPattern"!==u.constructor.name||(this.label_ctx.fillStyle=u,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,
this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};y.prototype.updateStyle=function(){this.divUp.style.borderStyle=
this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=
this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"};y.prototype.validateValue=function(a){h=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");l=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(l)&&(l=0);m=h.eval(this.min);e=h.eval(this.max);""===m&&(m=-Infinity);
""===e&&(e=Infinity);l=Math.min(Math.max(l,m),e);this.discrete&&(b=h.eval(this.incr),l=0==b?0:this.initial_value+b*Math.round((l-this.initial_value)/b));g=h.eval(this.decimals);0>=g&&(g=0);return l=parseFloat(parseFloat(l).toFixed(g))};y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};y.prototype.changeValue=function(a){this.activeIfValue&&
(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};y.prototype.addEvents=function(){function b(c,e,k){a.clearTimeout(q);if(g.up||g.down)e.call(g),c=k?c:10,q=a.setTimeout(function(){b(c,e)},c)}function c(c){c.preventDefault();g.whichBtn=a.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.up=!0,b(h,g.increase,!0))}function e(c){c.preventDefault();g.whichBtn=a.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&
(g.down=!0,b(h,g.decrease,!0))}function f(b){g.up=!1;a.clearTimeout(q);g.updateStyle()}function d(b){g.down=!1;a.clearTimeout(q);g.updateStyle()}n=a.hasTouchSupport;var g=this,h=n?500:200,q;g.divUp.oncontextmenu=g.divDown.oncontextmenu=g.field.oncontextmenu=g.label.oncontextmenu=g.cover.oncontextmenu=function(){return!1};this.label.addEventListener("touchstart",a.preventDefault);this.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("keydown",function(a){13==a.keyCode&&
g.changeValue(g.field.value)});this.divUp.addEventListener("touchstart",c);this.divUp.addEventListener("mousedown",c);this.divDown.addEventListener("touchstart",e);this.divDown.addEventListener("mousedown",e);this.divUp.addEventListener("mouseout",function(b){g.up=!1;a.clearTimeout(q);b.preventDefault();g.updateStyle()});this.divDown.addEventListener("mouseout",function(b){g.down=!1;a.clearTimeout(q);b.preventDefault();g.updateStyle()});this.divUp.addEventListener("touchend",f);window.addEventListener("touchend",
f);this.divUp.addEventListener("mouseup",f);window.addEventListener("mouseup",f);this.divDown.addEventListener("touchend",d);window.addEventListener("touchend",d);this.divDown.addEventListener("mouseup",d);window.addEventListener("mouseup",d);document.addEventListener("visibilitychange",function(b){g.up=!1;g.down=!1;a.clearTimeout(q);g.updateStyle()});this.field.addEventListener("blur",function(a){g.drawIfValue&&g.changeValue(g.field.value,!0)});g.field.addEventListener("click",function(a){this.focus()});
g.cover.addEventListener("click",function(a){a=g.evaluator.eval(g.kbexp);g.activeIfValue&&g.parent.keyboard.show(g,g.kblayout,a[0][0]||0,a[0][1]||0,g.id,g.field,g.onlyText)})};a.Spinner=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c=function(c,d){var b=a.Control.call(this,c,d)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.typeCtr="checkbox";b.pressed=d.pressed||!1;b.radio_group=(d.radio_group||"").trim();""!==b.radio_group&&(b.typeCtr="radio");b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+
"'");b.tabindex=++b.parent.tabindex;b.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:b.id});b.checkbox=a.newHTML("input",{type:b.typeCtr,id:b.id+b.typeCtr,class:"DescartesCheckbox",tabindex:b.tabindex});""!==b.radio_group&&b.checkbox.setAttribute("name",b.radio_group);b.checkbox.internalID=b.id;b.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.dummyLabel=a.newHTML("label",{"for":b.id+b.typeCtr});b.value=b.evaluator.eval(b.valueExpr);
b.evaluator.setVariable(b.id,b.value);b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.checkbox);b.containerControl.appendChild(b.dummyLabel);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(c,a.Control);c.prototype.init=function(c){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();this.labelFontSize=0<h.eval(this.font_size)?h.eval(this.font_size):a.getFieldFontSize(this.h);c=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");"right"==this.position?(this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+c+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+c+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+c+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";")):(this.dummyLabel.setAttribute("style",
"position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+c+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";left:"+this.h+"px"));this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.width=c*this.ratio;this.label.height=
this.h*this.ratio;this.update()};c.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==h.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),h.setVariable(this.id,this.value);else{this.value=h.getVariable(this.id);h.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var c=-1;if(this.pressed){for(var b=a.length-1;0<=b;b--)h.setVariable(a[b].internalID,0),a[b].checked=!1;h.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;h.setVariable(this.radio_group,this.id);this.pressed=0}else{for(b=a.length-1;0<=b;b--)c=0!=h.getVariable(a[b].internalID)?b:c,h.setVariable(a[b].internalID,
0),a[b].checked=!1;0<=c&&(h.setVariable(a[c].internalID,1),a[c].checked=!0,h.setVariable(this.radio_group,a[c].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(d=this.label_color.getColor())||"CanvasGradient"!==d.constructor.name&&"CanvasPattern"!==d.constructor.name||
(this.label_ctx.fillStyle=d,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,
0,0,1,0,0)};c.prototype.addEvents=function(){var c=this;c.checkbox.oncontextmenu=c.label.oncontextmenu=c.dummyLabel.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);c.dummyLabel.addEventListener("mousedown",a.preventDefault);c.checkbox.addEventListener("click",function(){c.pressed=!0;c.updateAndExecAction()})};a.Checkbox=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name.trim()+"'");void 0===c.valueExprString&&(c.valueExprString=c.onlyText?"0":"");c.emptyString=!1;c.ok=0;c.tabindex=++c.parent.tabindex;
c.regExpDecimalSymbol=new RegExp("\\"+c.parent.decimal_symbol,"g");if(c.answer)if(c.answer.match("krypto_")&&(c.answer=(new a.Krypto).decode(c.answer.substring(7))),c.answerPattern=c.answer,c.answer=a.buildRegularExpressionsPatterns(c.answer,c.evaluator),c.onlyText){var e=c.answerPattern.indexOf("|");c.firstAnswer=-1==e?c.answerPattern:c.answerPattern.substring(0,e)}else c.firstAnswer=c.parser.parse(c.answerPattern.substring(1,c.answerPattern.indexOf(",")));c.onlyText&&(c.valueExprString.match(/^'/)&&
c.valueExprString.match(/'$/)||(c.valueExpr=c.evaluator.parser.parse("'"+c.valueExprString+"'")),c.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},c.formatOutputValue=function(a){return a.toString()});c.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:c.id});c.field=a.newHTML("input",{type:"text",id:c.id+"TextField",class:"DescartesTextFieldField",tabindex:c.tabindex});c.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.containerControl.appendChild(c.label);c.containerControl.appendChild(c.field);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.containerControl.appendChild(c.cover);c.activoStr=c.id+".activo";c.activeStr=c.id+".active";c.addControlContainer(c.containerControl);c.addEvents();c.init();return c};$jscomp.inherits(m,a.Control);m.prototype.init=function(b){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();
var c=this.label.textContent;b||(this.value=this.validateValue(h.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<h.eval(this.font_size)?h.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,
italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var e=a.getTextWidth(b+"_",this.fieldFontSize+"px "+a.sansserif_font),g=parseInt(this.w/2),d=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(g=this.w,e=0);g<d&&(g=d);""==c&&(g=0);this.w-g<e&&(g=this.w-e);0>g&&(g=0);c=this.w-g;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.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+g+"px; font-family:"+("Serif"==this.font_family?a.serif_font:"Monospaced"==this.font_family?a.monospace_font:a.sansserif_font)+";");this.field.value=b;this.cover.setAttribute("style",";width:"+c+"px;height:"+this.h+"px;left:"+g+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+
this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=g*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};m.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=
this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(d=this.field.value,c=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===c&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),h.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,
this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(g=this.label_color.getColor())||"CanvasGradient"!==g.constructor.name&&"CanvasPattern"!==g.constructor.name||(this.label_ctx.fillStyle=g,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};m.prototype.validateValue=function(a){if(""===a||"''"==a)return"";h=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");r=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(r)&&(r=0);l=h.eval(this.min);b=h.eval(this.max);
""===l&&(l=-Infinity);""===b&&(b=Infinity);r<l&&(r=l);r>b&&(r=b);this.discrete&&(a=h.eval(this.incr),r=0===a?0:a*Math.round(r/a));return r=parseFloat(parseFloat(r).toFixed(h.eval(this.decimals)))};m.prototype.formatOutputValue=function(b){return""===b?"":a.Control.prototype.formatOutputValue.call(this,b)};m.prototype.changeValue=function(a){this.activeIfValue&&(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.updateAndExecAction())};m.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};m.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};m.prototype.deactivate=function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)};m.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=
b.label.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("mousedown",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update()});this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&
13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()});b.cover.addEventListener("click",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update();a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.TextField=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.abs,d,c,r,l,b,g,m,e,n,f,v,q=function(b,e){function f(b){g.options=b.split(",");g.menuOptions=[];g.strValue=[];b=0;for(var e=g.options.length;b<e;b++){var k=g.customSplit(g.options[b]);1==k.length?(g.menuOptions.push(k[0]),g.strValue.push(b.toString())):2==k.length&&(g.menuOptions.push(k[0]),""==k[1]?g.strValue.push(b.toString()):g.strValue.push(k[1]))}b=0;for(e=g.menuOptions.length;b<e;b++)g.menuOptions[b].match(/^\[/)&&g.menuOptions[b].match(/\]$/)?
g.menuOptions[b]=d.parse(g.menuOptions[b].substring(1,g.menuOptions[b].length-1)):g.menuOptions[b]=d.parse("'"+g.menuOptions[b]+"'");b=0;for(e=g.strValue.length;b<e;b++)g.strValue[b].match(/^\[/)&&g.strValue[b].match(/\]$/)?g.strValue[b]=d.parse(g.strValue[b].substring(1,g.strValue[b].length-1)):g.strValue[b]=d.parse(g.strValue[b]);g.select.innerHTML="";b=0;for(e=g.menuOptions.length;b<e;b++)k=a.newHTML("option"),k.innerHTML=c.eval(g.menuOptions[b]),g.select.appendChild(k);return 0}var k,g=k=a.Control.call(this,
b,e)||this;g.label_color=g.label_color||new a.Color("e0e4e8",b.evaluator);g.label_text_color=g.label_text_color||new a.Color("000000",b.evaluator);g.options=e.options||"";d=g.parser;c=g.evaluator;g.ok=0;g.tabindex=++g.parent.tabindex;g.answer&&(g.answer.match("krypto_")&&(g.answer=(new a.Krypto).decode(g.answer.substring(7))),g.answer=parseInt(g.answer.split(",")[0].replace("[",""))||0);g.name_str=g.name;g.name.match(/^\[.*\]?/)?g.name=g.parser.parse(g.name.substring(1,g.name.length-1)):g.name=g.parser.parse("'"+
g.name+"'");g.evaluator.setFunction(g.id+".setOptions",f);g.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:g.id});g.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});g.label_ctx=g.label.getContext("2d");g.ratio=b.ratio;g.select=a.newHTML("select",{id:g.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:g.tabindex});g.field=a.newHTML("input",{type:"text",id:g.id+"_menuField",class:"DescartesMenuField",tabindex:g.tabindex});f(g.options);g.containerControl.appendChild(g.label);
g.containerControl.appendChild(g.select);g.visible&&g.containerControl.appendChild(g.field);g.cover=a.newHTML("div",{class:"TextfieldCover"});g.keyboard&&g.visible&&g.containerControl.appendChild(g.cover);g.addControlContainer(g.containerControl);g.addEvents();g.init();return k};$jscomp.inherits(q,a.Control);q.prototype.init=function(b){c=this.evaluator;this.label.innerHTML=c.eval(this.name).toString();var e=this.label.textContent;this.fieldFontSize=0<c.eval(this.font_size)?c.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var f=0,k=0;this.value=b?this.value:c.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var g=0,d=this.menuOptions.length;g<d;g++)b=a.getTextWidth(c.eval(this.menuOptions[g]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>f&&(f=b,k=g);f+=25;b=a.getTextWidth(this.formatOutputValue(c.eval(this.strValue[k])),this.fieldFontSize+"px "+a.sansserif_font)+7;k=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==e&&(k=0);this.visible||(b=0);for(e=this.w-b-k;e<f&&0<k;)k--,e++;for(;e<f&&0<b;)b--,e++;for(;k+e+b+1<this.w;)e++,
b++;f=k;g=f+e;b=this.w-g;d=this.formatOutputValue(c.eval(this.strValue[this.indexValue]));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.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+k+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=k*this.ratio;this.label.height=
this.h*this.ratio;this.field.value=d;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+g+"px;");this.cover.setAttribute("style","width:"+b+"px;height:"+this.h+"px;left:"+g+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;left:"+f+"px;");this.select.selectedIndex=this.indexValue;c.setVariable(this.id,parseFloat(d.replace(this.parent.decimal_symbol,".")));this.update()};
q.prototype.update=function(){c=this.evaluator;this.activeIfValue=0<c.eval(this.activeif);this.drawIfValue=0<c.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=(c.eval(this.menuOptions[a])||
"").replace(/\\u002C/g,",");this.value=c.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);c.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/
2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.customSplit=function(a){g=!1;m="";e=0;for(n=-1;e<a.length;){f=a.charAt(e);if("["===f&&-1===n){if(g||""!=m)m+="\u00a6";n++}else"["===f?n++:"]"===f&&0===n?(g=!0,n--):"]"==a.charAt(e)&&(n=0>n?n:n-1);m+=a.charAt(e);e++}return m.split("\u00a6")};q.prototype.getIndex=function(a){a=
parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));r=-1;l=Infinity;for(var c=0,e=this.strValue.length;c<e;c++)b=h(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=l&&(l=b,r=c);return r};q.prototype.changeValue=function(a,b){this.activeIfValue&&(b&&(this.indexValue=this.getIndex(a),this.value=this.evaluator.eval(this.strValue[this.indexValue]),this.field.value=this.formatOutputValue(this.indexValue),this.select.selectedIndex=this.indexValue),this.evaluator.setVariable(this.id,
this.value),this.updateAndExecAction())};q.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);b.select.addEventListener("change",function(a){b.value=b.evaluator.eval(b.strValue[this.selectedIndex]);b.field.value=b.formatOutputValue(b.value);b.evaluator.setVariable(b.id,b.field.value);b.changeValue();
a.preventDefault()});b.field.addEventListener("keydown",function(a){13==a.keyCode&&(b.indexValue=b.getIndex(b.field.value),b.value=b.evaluator.eval(b.strValue[b.indexValue]),b.field.value=b.formatOutputValue(b.indexValue),b.select.selectedIndex=b.indexValue,b.changeValue())});b.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){b.field.focus()});b.cover.addEventListener("click",function(a){a=b.evaluator.eval(b.kbexp);
b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.Menu=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d,c,r,l,b,g,m,e,n,f,v,q,u,y,p,k,x,w,z=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);
c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(z,a.Control);z.prototype.init=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.value=this.validateValue(d.eval(this.valueExpr));r=
this.formatOutputValue(this.value);l=this.evaluator.eval(this.expresion);this.x=l[0][0];this.y=l[0][1];4==l[0].length&&(this.w=l[0][2],this.h=l[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(r);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};z.prototype.initScroll=function(b){c=this;d=c.evaluator;c.label.innerHTML=d.eval(c.name).toString();x=c.label.textContent;var e="v"===c.orientation?parseInt(19+5*(c.h-100)/100):c.h;c.fieldFontSize=0<
d.eval(c.font_size)?d.eval(c.font_size):"v"===c.orientation?e-parseInt(c.h/20)-1:a.getFieldFontSize(e);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},c.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);b=a.getTextWidth(b+"_",c.fieldFontSize+"px "+a.sansserif_font);var k=c.parent.getSpaceById(c.spaceID).h;c.labelHeight=""==x?0:e;c.fieldHeight=""==c.visible?0:e;if("v"===c.orientation)c.canvasWidth=c.w,c.canvasHeight=c.h-c.labelHeight-c.fieldHeight,18<=c.canvasHeight+c.y-k&&(c.canvasHeight=k),e=c.fieldHeight,b=e+c.canvasHeight,c.canvasX=0,c.canvasY=c.fieldHeight,c.labelWidth=c.w,c.labelY=b,c.upWidth=c.downW=c.w,c.upHeight=c.downH=c.w,c.upX=0,c.upY=c.fieldHeight,c.downX=0,c.downY=b-c.downH,
c.fieldWidth=c.w,c.fieldX=0,c.scrollHandlerW=c.w,c.scrollHandlerH=parseInt((c.canvasHeight-c.upHeight-c.downH-c.labelHeight-c.fieldHeight)/10),c.scrollHandlerH=c.canvasHeight-c.upHeight-c.downH-c.labelHeight-c.fieldHeight>2*c.w?c.w:c.scrollHandlerH,c.scrollHandlerH=15>c.scrollHandlerH?15:c.scrollHandlerH,c.limInf=b-c.downH-c.scrollHandlerH,c.limSup=e+c.downH;else{e=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);c.labelWidth=e;c.fieldWidth=b;""==x&&(c.labelWidth=0);c.visible||(c.fieldWidth=
0);for(b=c.w-c.fieldWidth-c.labelWidth;58>b&&0<c.labelWidth;)c.labelWidth--,b++;for(;58>b&&0<c.fieldWidth;)c.fieldWidth--,b++;e=c.labelWidth;k=e+b;c.fieldWidth=c.w-k;c.canvasWidth=b;c.canvasHeight=c.h;c.canvasX=c.labelWidth;c.canvasY=0;c.fieldX=c.canvasWidth+c.labelWidth;c.labelHeight=c.h;c.labelY=0;c.upWidth=c.downW=c.h;c.upHeight=c.downH=c.h;c.upX=k-c.downW;c.upY=0;c.downX=c.labelWidth;c.downY=0;c.scrollHandlerW=parseInt((c.canvasWidth-c.upWidth-c.downW)/10);c.scrollHandlerW=c.canvasWidth-c.upWidth-
c.downW>2*c.h?c.h:c.scrollHandlerW;c.scrollHandlerW=15>c.scrollHandlerW?15:c.scrollHandlerW;c.scrollHandlerH=c.h;c.limInf=e+c.downW;c.limSup=e+c.canvasWidth-c.downW-c.scrollHandlerW}c.container.setAttribute("style","width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.canvas.setAttribute("width",c.w+"px");c.canvas.setAttribute("height",c.h+"px");c.canvas.setAttribute("style","position:absolute;left:0;top:0;");c.ctx=c.canvas.getContext("2d");c.ctx.imageSmoothingEnabled=
!1;c.divUp.setAttribute("style","width:"+c.upWidth+"px;height:"+c.upHeight+"px;left:"+c.upX+"px;top:"+c.upY+"px;");c.divDown.setAttribute("style","width:"+c.downW+"px;height:"+c.downH+"px;left:"+c.downX+"px;top:"+c.downY+"px;");c.scrollHandler.setAttribute("style","width:"+c.scrollHandlerW+"px;height:"+c.scrollHandlerH+"px;left:"+("v"===c.orientation?0:c.limInf)+"px;top:"+("v"===c.orientation?c.limInf:0)+"px;");c.field.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.fieldWidth+"px;height:"+
c.fieldHeight+"px;left:"+c.fieldX+"px;top:0;");c.cover.setAttribute("style","width:"+c.fieldWidth+"px;height:"+c.fieldHeight+"px;left:"+c.fieldX+"px;top:0;");0===c.fieldHeight&&(c.field.style.display="none");c.label.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.labelWidth+"px;height:"+c.labelHeight+"px;line-height:"+c.labelHeight+"px;left:0;top:"+c.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=c.labelWidth*
this.ratio;this.label.height=c.labelHeight*this.ratio};z.prototype.update=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(d.getVariable(this.id));a==this.value||
0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);d.setVariable(this.id,this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(w=this.label_color.getColor())||"CanvasGradient"!==w.constructor.name&&"CanvasPattern"!==
w.constructor.name||(this.label_ctx.fillStyle=w,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/
this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};z.prototype.draw=function(){c=this;b=c.ctx;m=h(this.w);g=h(this.h);b.fillStyle=this.color.getColor();b.fillRect(0,0,m,g);b.fillStyle="black";b.beginPath();"h"===c.orientation?(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(parseInt(c.labelWidth)+.5,.5,m-1-parseInt(c.labelWidth),g-1),b.lineWidth=Math.ceil(12*c.upWidth/100)||1,b.strokeStyle=c.colorInt.getColor(),b.moveTo(c.downX+62.215*c.upWidth/100,20*c.downH/100),b.lineTo(c.downX+
32.449*c.upWidth/100,c.downH/2),b.lineTo(c.downX+62.215*c.upWidth/100,80*c.downH/100),b.moveTo(c.upX+32.449*c.upWidth/100,20*c.downH/100),b.lineTo(c.upX+62.215*c.upWidth/100,c.downH/2),b.lineTo(c.upX+32.449*c.upWidth/100,80*c.downH/100),b.stroke(),n=h(c.pos),e=Math.ceil(g/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(n+.5,e,h(c.scrollHandlerW),g-2*e)):(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(.5,.5,m-1,g-parseInt(c.labelHeight)-.5),b.lineWidth=Math.ceil(12*c.upWidth/100)||
1,b.strokeStyle=c.colorInt.getColor(),b.moveTo(20*c.upWidth/100,c.h-c.labelHeight-70*c.downH/100),b.lineTo(50*c.upWidth/100,c.h-c.labelHeight-40.237*c.downH/100),b.lineTo(80*c.upWidth/100,c.h-c.labelHeight-70*c.downH/100),b.moveTo(20*c.upWidth/100,c.upY+70*c.downH/100),b.lineTo(50*c.upWidth/100,c.upY+40.237*c.downH/100),b.lineTo(80*c.upWidth/100,c.upY+70*c.downH/100),b.stroke(),n=h(c.pos),e=Math.ceil(m/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(e,n+.5,m-2*e,h(c.scrollHandlerH)));c.activeIfValue||
(b.fillStyle="rgba(255,255,255,0.5)",b.fillRect(0,0,b.canvas.width,b.canvas.height))};z.prototype.validateValue=function(a){d=this.evaluator;f=a.toString();f=parseFloat(f.replace(this.parent.decimal_symbol,"."));isNaN(f)&&(f=0);this.minimo=d.eval(this.min);f<this.minimo&&(this.value=null,f=this.minimo);this.maximo=d.eval(this.max);f>this.maximo&&(this.value=null,f=this.maximo);v=this.incr;f=0!=v?f*v/v:0;this.fixed&&(f=parseFloat(parseFloat(f).toFixed(d.eval(this.decimals))));return f};z.prototype.increase=
function(){this.changeValue(parseFloat(this.value)+this.incr)};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};z.prototype.increase10=function(){e=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+e):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+e)};z.prototype.decrease10=function(){e=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/
10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-e):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-e)};z.prototype.changeValue=function(a){this.activeIfValue&&(q=this.validateValue(a),q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};z.prototype.changeValueForScrollMovement=function(){d=
this.evaluator;u=this.limInf;y=this.limSup;p=d.eval(this.min);k=d.eval(this.max);v=this.incr;q=h((this.pos-u)*(k-p)/(y-u)/v)*v+p;q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};z.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;u=this.limInf;y=this.limSup;p=d.eval(this.min);k=d.eval(this.max);v=this.incr;this.pos=(this.value-p)*(y-u)/(k-p)+u;this.scrollHandler.style["h"==
this.orientation?"left":"top"]=this.pos+"px"};z.prototype.addEvents=function(){function b(c,e,k,f){a.clearTimeout(r);(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-f)&&(e.call(p),c=k?c:30,r=a.setTimeout(function(){b(c,e,!1,f)},c))}function c(c){c.preventDefault();p.whichBtn=a.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.clickPos=a.getCursorPosition(c,p.container),p.canvasClick=!0,"h"==p.orientation?p.clickPos.x<p.prePos?b(350,p.decrease10,!0,p.minimo):b(350,p.increase10,!0,p.maximo):p.clickPos.y<
p.prePos?b(350,p.increase10,!0,p.maximo):b(350,p.decrease10,!0,p.minimo))}function e(b){p.canvasClick=!1;a.clearTimeout(r)}function k(b){1==p.canvasClick&&(p.clickPos=a.getCursorPosition(b,p.container),b.preventDefault())}function f(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",d,!1);a.preventDefault()}function g(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("touchend",g,!1);window.removeEventListener("touchmove",
d,!1);a.preventDefault()}function d(b){var c=a.getCursorPosition(b,p.container);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-c.x),p.pos<p.limInf&&(p.pos=p.limInf),p.pos>p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.scrollHandlerW+"px;height:"+p.h+"px;left:"+p.pos+"px;top:0;")):(p.pos=p.prePos-(p.initPos.y-c.y),p.pos>p.limInf&&(p.pos=p.limInf),p.pos<p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.w+"px;height:"+p.scrollHandlerH+"px;left:0;top:"+
p.pos+"px;"));p.changeValueForScrollMovement();b.preventDefault()}function n(c){c.preventDefault();p.whichBtn=a.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.up=!0,b(350,p.increase,!0,p.maximo))}function h(c){c.preventDefault();p.whichBtn=a.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.down=!0,b(350,p.decrease,!0,p.minimo))}function q(b){p.down=!1;a.clearTimeout(r);b.preventDefault()}function l(b){p.up=!1;a.clearTimeout(r);p.draw()}function m(b){p.down=!1;a.clearTimeout(r);p.draw()}var p=this,
r;p.canvas.oncontextmenu=p.divUp.oncontextmenu=p.divDown.oncontextmenu=p.label.oncontextmenu=p.field.oncontextmenu=p.scrollHandler.oncontextmenu=p.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});this.field.addEventListener("blur",function(a){p.drawIfValue&&p.changeValue(p.field.value,!0)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",
q);window.addEventListener("touchend",e);window.addEventListener("mouseup",e);this.canvas.addEventListener("touchmove",k);this.canvas.addEventListener("mousemove",k);this.scrollHandler.addEventListener("touchstart",function(b){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(b,p.container),window.addEventListener("touchend",g),window.addEventListener("touchmove",d),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){p.activeIfValue&&(p.scrollClick=!0,
p.initPos=a.getCursorPosition(b,p.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",d),b.preventDefault())});this.divUp.addEventListener("touchstart",n);this.divUp.addEventListener("mousedown",n);this.divDown.addEventListener("touchstart",h);this.divDown.addEventListener("mousedown",h);this.divUp.addEventListener("mouseout",function(b){p.up=!1;a.clearTimeout(r);b.preventDefault()});this.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",l);
window.addEventListener("mouseup",l);window.addEventListener("touchend",m);window.addEventListener("mouseup",m);p.cover.addEventListener("click",function(a){a=p.evaluator.eval(p.kbexp);p.activeIfValue&&p.parent.keyboard.show(p,p.kblayout,a[0][0]||0,a[0][1]||0,p.id,p.field,p.onlyText)})};a.Scrollbar=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d,c,r,l,b,g,m,e,n,f,v,q=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesSliderContainer",
id:c.id});c.field=a.newHTML("input",{type:"text",id:c.id+"slider",class:"DescartesSliderField"});c.sliderCtr=a.newHTML("input",{type:"range",id:c.id+"range",min:0,max:100,step:"any",class:"DescartesRange"});c.label=a.newHTML("canvas",{class:"DescartesSliderLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.label);c.container.appendChild(c.field);c.container.appendChild(c.sliderCtr);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);
c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(q,a.Control);q.prototype.init=function(){d=this.evaluator;this.value=this.validateValue(d.eval(this.valueExpr));r=this.formatOutputValue(this.value);l=this.evaluator.eval(this.expresion);this.x=l[0][0];this.y=l[0][1];4==l[0].length&&(this.w=l[0][2],this.h=l[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initSlider(r);this.changeSliderPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};
q.prototype.initSlider=function(b){c=this;d=c.evaluator;c.label.innerHTML=d.eval(c.name).toString();f=c.label.textContent;var e="v"===c.orientation?parseInt(19+5*(c.h-100)/100):c.h;c.fieldFontSize=0<d.eval(c.font_size)?d.eval(c.font_size):"v"===c.orientation?e-parseInt(c.h/20)-1:a.getFieldFontSize(e);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),
font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},c.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);b=a.getTextWidth(b+"_",c.fieldFontSize+"px "+a.sansserif_font);var g=c.parent.getSpaceById(c.spaceID).h;c.labelHeight=""==f?0:e;c.fieldHeight=""==c.visible?0:e;if("v"===c.orientation)c.canvasWidth=c.w,c.canvasHeight=c.h-c.labelHeight-c.fieldHeight,18<=c.canvasHeight+c.y-g&&(c.canvasHeight=g),e=
c.fieldHeight+c.canvasHeight,c.canvasX=0,c.canvasY=c.fieldHeight,c.labelWidth=c.w,c.labelY=e,c.upWidth=c.downW=c.w,c.upHeight=c.downH=c.w,c.fieldWidth=c.w,c.fieldX=0,c.sliderCtr.style="position:absolute;left:0;top:"+c.canvasY+"px;width:"+c.canvasHeight+"px;height:"+c.canvasWidth+"px;transform-origin:"+c.canvasWidth/2+"px "+c.canvasWidth/2+"px;transform:rotate(90deg);margin:0;padding:0;--thumb_size:"+c.canvasWidth+"px;--track_h:"+parseInt(c.canvasWidth/3)+"px;";else{e=this.text_object.textNodes.metrics.w+
parseInt(this.fieldFontSize);c.labelWidth=e;c.fieldWidth=b;""==f&&(c.labelWidth=0);c.visible||(c.fieldWidth=0);for(b=c.w-c.fieldWidth-c.labelWidth;58>b&&0<c.labelWidth;)c.labelWidth--,b++;for(;58>b&&0<c.fieldWidth;)c.fieldWidth--,b++;e=c.labelWidth;c.fieldWidth=c.w-(e+b);c.canvasWidth=b;c.canvasHeight=c.h;c.canvasX=c.labelWidth;c.canvasY=0;c.fieldX=c.canvasWidth+c.labelWidth;c.labelHeight=c.h;c.labelY=0;c.upWidth=c.downW=c.h;c.upHeight=c.downH=c.h;c.sliderCtr.style="position:absolute;left:"+c.canvasX+
"px;top:0;width:"+c.canvasWidth+"px;height:"+c.canvasHeight+"px;margin:0;padding:0;--thumb_size:"+c.canvasHeight+"px;--track_h:"+parseInt(c.canvasHeight/3)+"px;"}c.container.setAttribute("style","width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.field.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.fieldWidth+"px;height:"+c.fieldHeight+"px;left:"+c.fieldX+"px;top:0;");c.cover.setAttribute("style","width:"+c.fieldWidth+"px;height:"+c.fieldHeight+
"px;left:"+c.fieldX+"px;top:0;");0===c.fieldHeight&&(c.field.style.display="none");c.label.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.labelWidth+"px;height:"+c.labelHeight+"px;line-height:"+c.labelHeight+"px;left:0;top:"+c.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=c.labelWidth*this.ratio;this.label.height=c.labelHeight*this.ratio};q.prototype.update=function(){d=this.evaluator;this.activeIfValue=
0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(d.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeSliderPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);d.setVariable(this.id,
this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?
(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.draw=function(){c=this;this.sliderCtr.style.setProperty("--track_color",this.color.getColor());this.sliderCtr.style.setProperty("--thumb_color",
this.colorInt.getColor());this.sliderCtr.value=this.pos};q.prototype.validateValue=function(a){d=this.evaluator;b=a.toString();b=parseFloat(b.replace(this.parent.decimal_symbol,"."));isNaN(b)&&(b=0);this.minimo=d.eval(this.min);b<this.minimo&&(this.value=null,b=this.minimo);this.maximo=d.eval(this.max);b>this.maximo&&(this.value=null,b=this.maximo);g=d.eval(this.incr);b=0!=g?b*g/g:0;this.fixed&&(b=parseFloat(parseFloat(b).toFixed(d.eval(this.decimals))));return b};q.prototype.changeValue=function(a){this.activeIfValue&&
(m=this.validateValue(a),m!=this.value&&(this.value=m,this.field.value=this.formatOutputValue(m),this.changeSliderPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};q.prototype.changeValueForSliderMovement=function(){d=this.evaluator;e=d.eval(this.min);n=d.eval(this.max);g=d.eval(this.incr);m=h(this.pos*(n-e)/100/g)*g+e;m!=this.value&&(this.value=m,this.field.value=this.formatOutputValue(m),d.setVariable(this.id,this.value),this.parent.updateControls(),
this.actionExec.execute(),this.parent.update())};q.prototype.changeSliderPositionFromValue=function(){d=this.evaluator;e=d.eval(this.min);n=d.eval(this.max);g=d.eval(this.incr);this.pos=100*(this.value-e)/(n-e)};q.prototype.addEvents=function(){var a=this;a.label.oncontextmenu=a.field.oncontextmenu=a.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(b){13==b.keyCode&&a.changeValue(a.field.value)});this.field.addEventListener("blur",function(b){a.drawIfValue&&
a.changeValue(a.field.value,!0)});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)});a.sliderCtr.addEventListener("input",function(b){a.pos=b.target.value;a.changeValueForSliderMovement()})};a.Slider=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c=function(c,d){var b=a.Control.call(this,c,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;c=b.evaluator.eval(b.expresion);4==c[0].length?(b.w=c[0][2],b.h=c[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(g){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(g){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(g){}return 0});
b.evaluator.setFunction(b.id+".currentTime",function(a){try{b.audio.currentTime=parseFloat(a)}catch(m){}return 0});b.audio.addEventListener("timeupdate",function(){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime);b.evaluator.setVariable(b.id+".playing",b.audio.paused?0:1);b.evaluator.setVariable(b.id+".duration",b.audio.duration)});return b};$jscomp.inherits(c,a.Control);c.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};c.prototype.update=
function(){h=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=h.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(d=0<h.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",d!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Audio=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c=function(c,d){var b=a.Control.call(this,c,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;h=b.evaluator;c=h.eval(b.expresion);4==c[0].length?(b.w=c[0][2],b.h=c[0][3]):(b.w=null,b.h=null);c=b.file;d=c.lastIndexOf(".");-1!=d&&(c=b.file.substring(0,d));b.video=a.newHTML("video",{poster:c+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(d=a.newHTML("source",{src:c+".mp4",type:"video/mp4"}),b.video.appendChild(d));b.video.canPlayType("video/ogg")&&(d=a.newHTML("source",{src:c+".ogg",type:"video/ogg"}),b.video.appendChild(d),d=a.newHTML("source",{src:c+".ogv",type:"video/ogg"}),b.video.appendChild(d));b.video.canPlayType("video/webm")&&
(d=a.newHTML("source",{src:c+".webm",type:"video/webm"}),b.video.appendChild(d));b.addControlContainer(b.video);h.setFunction(b.id+".play",function(){try{b.video.play()}catch(g){}return 0});h.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(g){}return 0});h.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(g){}return 0});h.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(m){}return 0});b.video.addEventListener("timeupdate",
function(a){h.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(c,a.Control);c.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};c.prototype.update=function(){h=this.evaluator;(d=0<h.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",d!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Video=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r=function(c,b){var g=a.Control.call(this,c,b)||this;g.font_family=b.font_family||"sansserif";g.style=b.style||",PLAIN,";g.font_size=b.font_size||12;typeof("number"!==g.font_size)&&(g.font_size=g.evaluator.eval(g.font_size));g.font=g.font_family+g.style+g.font_size;g.evaluator.setVariable(g.id+"._scroll_x",0);g.evaluator.setVariable(g.id+"._scroll_y",0);g.region="interior";g.tabindex=++g.parent.tabindex;if(g.answer){g.answer.match("krypto_")&&
(g.answer=(new a.Krypto).decode(g.answer.substring(7)));var d=g.parent.lessonParser.parseText(g.answer)}g.containerControl=a.newHTML("div",{class:"DescartesTextAreaContainer",id:g.id,spellcheck:"false"});g.textArea=a.newHTML("textarea",{class:"DescartesTextAreaContainer",spellcheck:"false"});g.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});g.showButton=a.newHTML("div",{class:"DJS_Gradient"});g.containerControl.appendChild(g.textArea);g.containerControl.appendChild(g.textAreaAnswer);
g.containerControl.appendChild(g.showButton);g.cover=a.newHTML("div",{class:"TextfieldCover"});g.keyboard&&g.containerControl.appendChild(g.cover);g.addControlContainer(g.containerControl);g.showAnswer=!1;g.text=g.rawText||"";d&&"simpleText"!==d.type&&(g.answer=g.text.hasFormula?"":d.toHTML());g.evaluator.setVariable(g.id,g.text);var e;g.evaluator.setFunction(g.id+".insertAtCursor",function(a){e=g.textArea.selectionStart+a.length;g.textArea.value=g.textArea.value.substring(0,g.textArea.selectionStart)+
a+g.textArea.value.substring(g.textArea.selectionEnd);g.textArea.selectionStart=g.textArea.selectionEnd=e;g.textArea.focus();return 0});g.evaluator.setFunction(g.id+".update",function(){g.update()});g.evaluator.setFunction(g.id+".scrollTo",function(a){g.textArea.scrollTop=a});g.addEvents();g.init();return g};$jscomp.inherits(r,a.Control);r.prototype.init=function(){d=this.answer?28:4;h=this.evaluator;var c=this.text.replace(/\\n/g,"\n");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+
this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var b="padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-d)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",b);this.textArea.value=c;this.textAreaAnswer.setAttribute("style",b+"display:"+(this.showAnswer?"block":"none")+";");this.textAreaAnswer.innerHTML="<span>"+this.answer+"</span>";this.showButton.setAttribute("style",
"width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:"+(this.answer?"block":"none")+";");this.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+a.sansserif_font+';">S</span>';this.cover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:0px;top:0px;");this.update()};r.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=
0<h.eval(this.drawif);h.getVariable(this.id)!==this.oldValue&&(this.textArea.value=(h.getVariable(this.id)||"").replace(/\\n/g,"\n"));c=this.textArea.value||"";c="\n"===c.charAt(c.length-1)?c.substring(0,c.length-1):c;c=c.replace(/\n/g,"\\n").replace(/\s/g," ");h.setVariable(this.id,c);this.oldFieldValue=c;this.oldValue=h.getVariable(this.id);this.activeIfValue?this.textArea.removeAttribute("disabled"):this.textArea.setAttribute("disabled",!0);this.containerControl.style.display=this.drawIfValue?
"block":"none";this.textArea.style["overflow-x"]=0<h.getVariable(this.id+"._scroll_x")?"auto":"unset";this.textArea.style["overflow-y"]=0<h.getVariable(this.id+"._scroll_y")?"auto":"unset";this.updatePositionAndSize()};r.prototype.changeValue=function(a){this.textArea.value=a;this.update()};r.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=this;b.cover.oncontextmenu=function(){return!1};b.showButton.addEventListener("mousedown",function(a){a.preventDefault();b.showAnswer=!b.showAnswer;
b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S"});b.showButton.addEventListener("mouseup",a);b.showButton.addEventListener("mouseout",a);b.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});b.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});b.textArea.addEventListener("keydown",
function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});b.cover.addEventListener("pointerdown",function(a){a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.textArea,!0)})};a.TextArea=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,d,c,r,l,b,g,m,e,n,f,v,q,u=function(b,e){var k=a.Control.call(this,b,e)||this;c=b.evaluator.parser;k.spaceID=e.spaceID||"";k.text=e.text||"";k.size=e.size||c.parse("4");k.font=e.font||"Serif,PLAIN,12";k.image=new Image;k.image.onload=function(){this.ready=1};k.imageSrc=e.imageSrc||"";k.imageSrc.match(/^\[.*\]?/)?k.imageSrc=k.parser.parse(k.imageSrc.substring(1,k.imageSrc.length-1)):k.imageSrc=k.parser.parse("'"+k.imageSrc+"'");k.font=a.convertFont(k.font);
k.constraintExpr&&(k.constraint=c.parse(k.constraintExpr),"(expr)"==k.constraint.type&&(k.constraint=c.parse(k.constraintExpr.substring(1,k.constraintExpr.length-1))),"compOperator"==k.constraint.type?(b=k.constraint.childs[0],e=k.constraint.childs[1],"identifier"!=b.type||"y"!=b.value||e.contains("y")?"identifier"!=b.type||"x"!=b.value||e.contains("x")?k.newt=new a.R2Newton(k.evaluator,k.constraint):(k.constVar="y",k.noConstVar="x",k.evalConst=k.evalConstXoY,k.constraint=e):(k.constVar="x",k.noConstVar=
"y",k.evalConst=k.evalConstXoY,k.constraint=e)):k.constraint=null,f=new a.R2(0,0));k.container=k.getContainer();k.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:k.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+k.zIndex+";"});k.ctx=k.space.ctx;k.container.appendChild(k.mouseCatcher);k.addEvents();k.xStr=k.id+".x";k.yStr=k.id+".y";k.activoStr=k.id+".activo";k.activeStr=k.id+".active";k.mX=k.space.id+".mouse_x";k.mY=k.space.id+".mouse_y";k.mClicked=
k.space.id+".mouse_clicked";k.mClicIzq=k.space.id+".clic_izquierdo";k.init();return k};$jscomp.inherits(u,a.Control);u.prototype.init=function(b){d=this.evaluator;v=a.hasTouchSupport;b||(b=d.eval(this.expresion),this.x=b[0][0],this.y=b[0][1],d.setVariable(this.xStr,this.x),d.setVariable(this.yStr,this.y));this.img_src_eval=d.eval(this.imageSrc).toString().trim();""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*d.eval(this.size),this.height=2*d.eval(this.size),
this._w=v&&48>this.width?48:this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/
2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";d.setVariable(this.activoStr,0);d.setVariable(this.activeStr,0);this.setImage=!1;this.update()};u.prototype.update=function(){d=this.evaluator;d.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.x=d.getVariable(this.xStr);this.y=d.getVariable(this.yStr);r=this.space.getAbsoluteX(this.x);l=this.space.getAbsoluteY(this.y);
this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(r-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(l-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){d=this.evaluator;this.drawIfValue&&(e=this.ctx,n=this.space.backgroundCtx,r=parseInt(this.space.getAbsoluteX(this.x))+.5,l=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(r,l),this.image.ready?(b=this.image.width/2,g=this.image.height/
2,this.image.complete&&!this.setImage&&e.drawImage(this.image,parseInt(r-b),parseInt(l-g)),this.trace&&(n.save(),n.translate(r,l),n.scale(parseInt(b),parseInt(g)),n.beginPath(),n.arc(0,0,1,0,h),n.restore(),n.lineWidth=1,n.strokeStyle=this.trace.getColor(),n.stroke())):(b=parseInt(this.width/2),e.beginPath(),e.arc(r,l,b,0,h),e.fillStyle=this.colorInt.getColor(),e.fill(),e.lineWidth=1,e.strokeStyle=this.color.getColor(),e.stroke(),this.active&&(e.strokeStyle=this.colorInt.borderColor(),e.beginPath(),
e.arc(r,l,b-2,0,h),e.stroke()),this.trace&&(n.strokeStyle=this.trace.getColor(),n.beginPath(),n.arc(r,l,b,0,h),n.stroke())))};u.prototype.evalConst=function(){f.set(this.x,this.y);m=this.newt.findZero(f,1/this.space.scale,!0);this.x=m.x;this.y=m.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};u.prototype.evalConstXoY=function(){d=this.evaluator;q=d.getVariable(this.constVar);d.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=d.eval(this.constraint);
d.setVariable(this.xStr,this.x);d.setVariable(this.yStr,this.y);d.setVariable(this.constVar,q)};u.prototype.drawText=function(a,b){e=this.ctx;d=this.evaluator;"simpleText"==this.text.type?(e.fillStyle=this.color.getColor(),e.font=this.font,e.textBaseline="alphabetic",e.fillText(this.text.toString(d.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))):(e.fillStyle=this.color.getColor(),e.strokeStyle=this.color.getColor(),e.textBaseline="alphabetic",this.text.draw(e,
parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};u.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,e=a.length;c<e;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,
0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};u.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();d.whichBtn=a.whichBtn(b);"L"==d.whichBtn&&d.activeIfValue&&(d.parent.deactivateControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,1),d.evaluator.setVariable(d.activeStr,1),d.evaluator.setVariable(d.mClicked,0),d.evaluator.setVariable(d.mClicIzq,0),d.posAnte=a.getCursorPosition(b,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),
y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mX,d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.mY,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",e),window.addEventListener("mouseup",c),window.addEventListener("mousemove",e))}function c(b){document.body.focus();b.preventDefault();b.stopPropagation();d.evaluator.setVariable(d.mClicked,1);d.evaluator.setVariable(d.mClicIzq,1);if(d.activeIfValue||d.active)d.click=
!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",e),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",e),g=a.getCursorPosition(b,d.container)||g,d.posX=d.prePos.x-(d.posAnte.x-g.x),d.posY=d.prePos.y-(d.posAnte.y-g.y),d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX)),d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY)),d.evaluator.setVariable(d.mX,d.space.getRelativeX(g.x)),d.evaluator.setVariable(d.mY,d.space.getRelativeY(g.y)),
d.parent.updateControls(),d.parent.update(),d.mouseCatcher.style.left=d.space.getAbsoluteX(d.x)-d._w/2+"px",d.mouseCatcher.style.top=d.space.getAbsoluteY(d.y)-d._h/2+"px";b=d.evaluator.getVariable(d.activeStr);d.parent.deactivateControls();d.parent.updateControls();d.evaluator.setVariable(d.activoStr,b);d.evaluator.setVariable(d.activeStr,b);d.parent.update()}function e(b){b.preventDefault();d.evaluator.setVariable(d.mClicked,0);d.evaluator.setVariable(d.mClicIzq,0);g=a.getCursorPosition(b,d.container);
d.posX=d.prePos.x-(d.posAnte.x-g.x);d.posY=d.prePos.y-(d.posAnte.y-g.y);d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX));d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY));d.evaluator.setVariable(d.mX,d.space.getRelativeX(g.x));d.evaluator.setVariable(d.mY,d.space.getRelativeY(g.y));80<Date.now()-f&&(d.parent.updateControls(),d.parent.update(),f=Date.now())}var f=0,g,d=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",
b);this.mouseCatcher.addEventListener("mousedown",b);this.mouseCatcher.addEventListener("mouseover",function(a){d.over=!0});this.mouseCatcher.addEventListener("mouseout",function(a){d.over=!1;d.click=!1})};a.GraphicControl=u;return a}(descartesJS||{});
descartesJS=function(a,h){var d,c,r,l,b,g,m,e,n,f;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var q=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,u,y,p,k,x,w,z,A,D,G,F,J,E,B,I,L,M,O,H,N,C,Q,K,R,P,S,T,W,V,U=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};U.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,e=a.length;c<
e;c++)switch(p=a[c][0],k=a[c][1],y=h[p],y){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[y]=parseInt(k);break;case "about":case "config":case "init":case "clear":b[y]="true"===h[k];break;default:console.warn("Propiedad de botones no identificada: <"+p+"> valor: <"+k+">")}return b};U.prototype.parseSpace=function(b){x={};b=this.split(b);for(var c=0,e=b.length;c<e;c++)switch(p=b[c][0],k=b[c][1],y=h[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Space",y){case "type":if("R2"===
k||"R3"===k)k=h[k];x[y]=k;break;case "id":a.DEBUG.idName=k;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":x[y]=k;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":x[y]="true"===h[k];break;case "bg_display":case "render":x[y]=h[k];break;case "border_color":case "net":case "net10":case "axes":case "text":x[y]=""!=k?"false"===h[k]?"":new a.Color(k,this.parent.evaluator):"";break;case "O.x":x.OxExpr=
k;break;case "O.y":x.OyExpr=k;break;case "image":x.imageSrc=k;break;case "x":u=k;"%"===u[u.length-1]?(x.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=k;x.xExpr=this.parser.parse(u);break;case "y":u=k;"%"===u[u.length-1]?(x.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=k;x.yExpr=this.parser.parse(u);break;case "width":u=k.trim();x.wModExpr=u;"%"===u[u.length-1]?(x.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(k),u!=k&&(u=this.parent.container.width,x._w_=k.trim()));x.w=u;break;case "height":u=k.trim();x.hModExpr=u;"%"===u[u.length-1]?(x.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(k),u!=k&&(u=this.parent.container.height,x._h_=k.trim()));x.h=u;break;case "drawif":""!=k&&(x.drawif=this.parser.parse(k));break;case "scale":u=parseFloat(k);isNaN(u)&&(u=48);x.scale=u;break;case "background":x.background=new a.Color(k,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
p+"> valor: <"+k+">")}return new a["Space"+x.type](this.parent,x)};U.prototype.parseControl=function(b){w={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,e=b.length;c<e;c++)switch(p=b[c][0],k=b[c][1],y=h[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Control",y){case "type":u=h[k.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");w.type=v(u);break;case "gui":u=h[k];"textfield"===u&&(u="TextField");w[y]=v(u);break;case "id":a.DEBUG.idName=k;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":case "info":w[y]=
k;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":w[y]=h[k];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":w[y]="true"===h[k];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":w[y]=new a.Color(k,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
k&&(w[y]=this.parser.parse(k));break;case "constraint":w.constraintExpr=k;break;case "image":w.imageSrc=k;break;case "image_dec":w.image_dec_src=k;break;case "image_inc":w.image_inc_src=k;break;case "space":w.spaceID=k;break;case "expresion":w.expresion=this.parser.parse(k.replace(")(",","));case "kbexp":w.kbexp=this.parser.parse(k.replace(")(",","));break;case "borderColor":w[y]="false"===h[k]?"":k;break;case "bold":"false"!=h[k]&&(w.bold="bold");break;case "italics":"false"!=h[k]&&(w.italics="italic");
break;case "underlined":"false"!=h[k]&&(w.underlined=!0);break;case "value":var f=k.replace(/&squot;/g,"'");f.match(/^\|/)&&(f="'"+f.substring(1),f.match(/\|$/)&&(f=f.substring(0,f.length-1)+"'"));w.valueExpr=this.parser.parse(f);w.valueExprString=f;break;case "incr":0!=k&&(w.incr=this.parser.parse(k));break;case "exponentialif":w.exponentialif=parseFloat(k);break;case "text":w.rawText=k;f=this.parseText(k);for(var d=0,g=f.length;d<g;d++)f[d]=this.parser.parse(f[d],!1);w.text=f;break;default:d=p.indexOf("."),
f=h[p.substring(0,d)],d=h[p.substring(d+1)],"parameter"===f&&"font"===d?w.parameterFont=k:"Explanation"===f&&"font"===d?w.ExplanationFont=k:"tooltip"===f&&"font"===d?w.tooltipFont=k:console.warn("Propiedad de control no identificada: <"+p+"> valor: <"+k+">")}return new a["Numeric"===w.type?w.gui:w.type](this.parent,w)};U.prototype.parseGraphic=function(b,c,e,f){z={rotateExp:f,parameter:"t"};b=this.split(b);f=0;for(var d=b.length;f<d;f++)if(p=b[f][0],k=b[f][1],y=h[p],a.DEBUG.paramName=p,a.DEBUG.objectName=
"Graphic",""!=k)switch(y){case "type":a.DEBUG.idName=k;z[y]=v(h[k]);break;case "align":case "anchor":case "lineDash":z[y]=h[k];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":z[y]="true"===h[k];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":z[y]="false"===h[k]?"":new a.Color(k,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":z[y]=
k;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==k&&(z[y]=this.parser.parse(k));break;case "font_size":k=k.trim();k.match(/^\[.*\]?/)&&(k=k.substring(1,k.length-1));""!==k&&(z[y]=this.parser.parse(k));break;case "space":z.spaceID=k;break;case "expresion":""!==k&&("Macro"!==z.type?(z.expresion=this.parser.parse(k),z.expresionString=k):z.expresion=k);break;
case "text":z.text=k;break;case "file":var g=k.replace(/&squot;/g,"'").trim();"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=g.substring(1,g.length-1));g.match(q)&&(g="'"+g+"'");g.startsWith("data:image/")?z.file=this.parser.parse("'"+g+"'"):z.file=this.parser.parse(g);break;case "border":""!=k&&"false"!=h[k]&&(z.border=new a.Color(k,this.parent.evaluator));break;default:if(void 0!=z.family&&p.substring(0,z.family.length+1)===z.family+".")switch(h[p.substring(z.family.length+1)]){case "interval":""!=
k&&(z.family_interval=this.parser.parse(k));break;case "steps":""!=k&&(z.family_steps=this.parser.parse(k))}else if(void 0!=z.parameter&&p.match(z.parameter+"."))switch(z.parameter!==p.substring(0,p.indexOf(z.parameter)+z.parameter.length)&&(z.parameter=p.substring(0,p.indexOf(z.parameter)+z.parameter.length)),h[p.substring(z.parameter.length+1)]){case "interval":""!=k&&(z.parameter_interval=this.parser.parse(k));break;case "steps":""!=k&&(z.parameter_steps=this.parser.parse(k))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+
p+"> valor: <"+k+">")}c&&(z.abs_coord=c);e&&(z.background=e);return new a[z.type](this.parent,z)};U.prototype.parse3DGraphic=function(b,c,e,f){z={rotateExp:f,parameter:"t"};b=this.split(b);c=0;for(e=b.length;c<e;c++)switch(p=b[c][0],k=b[c][1],y=h[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Graphic3D",y){case "type":a.DEBUG.idName=k;u=h[k];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":z.subType=
u,u="OtherGeometry"}z[y]=v(u);break;case "model":case "align":case "anchor":case "lineDash":z[y]=h[k];break;case "shadowColor":case "fill":z[y]="false"===h[k]?"":new a.Color(k,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":z[y]="true"===h[k];break;case "edges":"false"===h[k]?z[y]="":("true"===h[k]&&(k="808080"),z[y]=new a.Color(k,this.parent.evaluator));break;case "border":""!=k&&"false"!=h[k]&&(z.border=new a.Color(k,this.parent.evaluator));
break;case "color":case "backcolor":z[y]=new a.Color(k,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":""!=k&&(z[y]=this.parser.parse(k));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":z[y]=
k;break;case "space":z.spaceID=k;break;case "expresion":"Macro"!=z.type&&"Curve"!=z.type&&"Surface"!=z.type?(z.expresion=this.parser.parse(k),z.expresionString=k):z.expresion=k.replace(/\\n/g,";");break;case "text":z.text=k;break;case "file":f=k.replace(/&squot;/g,"'");"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));f.match(/./)&&(f="'"+f+"'");z.file=this.parser.parse(f);break;default:void 0!==z.family&&p.substring(0,z.family.length+1)===z.family+"."?"interval"===h[p.substring(z.family.length+
1)]?""!=k&&(z.family_interval=this.parser.parse(k)):""!=k&&(z.family_steps=this.parser.parse(k)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+p+"> valor: <"+k+">")}return new a[z.type+"3D"](this.parent,z)};U.prototype.parseAuxiliar=function(b){A={};b=this.split(b);for(var c=0,e=b.length;c<e;c++)b[c][1]=b[c][1].replace(/&squot;/g,"'");c=0;for(e=b.length;c<e;c++)switch(p=b[c][0],k=b[c][1],y=h[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Auxiliar",y){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=k;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[y]=k.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[y]="true"===h[k];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[y]=this.parser.parse(k);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[y]=
h[k];break;default:var f=p.indexOf("."),d=h[p.substring(0,f)];f=h[p.substring(f+1)];"parameter"===d&&"font"===f?A.parameterFont=k:console.warn("Propiedad del auxiliar no identificada: <"+p+"> valor: <"+k+">")}A.sequence?A.type="sequence":A.constant?A.type="constant":A.algorithm&&A.evaluate?A.type="algorithm":A.array&&!A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="vector":A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="matrix":A.event&&")"!=A.id.charAt(A.id.length-1)?A.type="event":"library"===
A.type?A.type="library":")"===A.id.charAt(A.id.length-1)?A.type="function":A.type="variable";a.DEBUG.typeName=A.type;switch(A.type){case "sequence":new a.Function(this.parent,A);break;case "constant":b=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":b=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,A));break;case "library":new a.Library(this.parent,A);break;case "variable":new a.Variable(this.parent,A);break;default:new a.Function(this.parent,A)}};U.prototype.parseAction=function(b){D=b.action;G=b.parent;F=b.parameter;return D?new (a[v(D)])(G,F):{execute:function(){}}};U.prototype.parseAnimation=function(b){var c={};
b=this.split(b);for(var e=0,f=b.length;e<f;e++)switch(p=b[e][0],k=b[e][1],y=h[p],y){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[y]=k.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[y]="true"===h[k];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+p+">  <"+k+">")}return new a.Animation(this.parent,c)};U.prototype.parsePleca=function(h,q){h=this.split(h);c=d="";r=0;l="#536891";b="white";g=
"left";m="";e="SansSerif,BOLD,20";n="SansSerif,PLAIN,18";f=void 0;for(var u=0,v=h.length;u<v;u++)switch(p=h[u][0],k=h[u][1],p){case "title":d=k;break;case "subtitle":c=k;break;case "subtitlines":r=k;break;case "bgcolor":""!=k&&(l=(new a.Color(k,this.parent.evaluator)).getColor());break;case "fgcolor":""!=k&&(b=(new a.Color(k,this.parent.evaluator)).getColor());break;case "align":""!=k&&(g=k);break;case "titleimage":m=k;break;case "titlefont":e=""!=k?a.convertFont(k):a.convertFont(e);break;case "subtitlefont":n=
""!=k?a.convertFont(k):a.convertFont(n);break;default:console.warn("Propiedad de la pleca no identificada: <"+p+">  <"+k+">")}if(""===d&&""===c)return a.newHTML("div");O=n.substring(0,n.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=m&&(H=this.parent.getImage(m),N=H.height);f=a.newHTML("div",{id:"descartesPleca"});N?(f.setAttribute("style","position:absolute;left:0;top:0;text-align:"+g+";width:"+q+"px;height:"+N+"px;background-color:"+l+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
H.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),f.appendChild(H)):f.setAttribute("style","position:absolute;left:0;top:0;text-align:"+g+";width:"+q+"px;background:"+l+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+e+";overflow:hidden;white-space:nowrap;"});C.innerHTML=d;Q=a.newHTML("div");if(1===parseInt(r)){T=0;K=a.newHTML("div");K.innerHTML=c;document.body.appendChild(K);P=O;do P-=
T,K.setAttribute("style","padding:0;margin:0;font:"+n+";font-size:"+P+"px;width:"+(q-30)+"px;line-height:"+P+"px;"),R=K.offsetHeight,S=R/P,T=1;while(1<S&&8<P);document.body.removeChild(K);Q.setAttribute("style","padding:0;margin:0;font:"+n+";font-size:"+P+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else Q.setAttribute("style","padding:0;margin:0;font:"+n+";line-height:1em;");Q.innerHTML=c;f.appendChild(C);f.appendChild(Q);f.imageHeight=N;return f};U.prototype.split=function(a){if("string"!==
typeof a)return[];J=[];a=(a||"").replace(/\\'/g,"\u2019");E=B=L=0;for(I=M=!1;E<a.length;)" "!==a.charAt(E)||I||E++," "===a.charAt(E)||I||(I=!0,L=E),"="!==a.charAt(E)||"'"!==a.charAt(E+1)||M||(M=!0,J[B]=[a.substring(L,E)],L=E+2,E+=2),M&&"'"===a.charAt(E)&&(I=M=!1,J[B].push(a.substring(L,E)),B++),"="!==a.charAt(E)||"'"===a.charAt(E+1)||M||(J[B]=[a.substring(L,E)],L=E+1,E++,W=a.substring(E).indexOf("="),-1===W?V=W=a.length:(W+=E,V=a.substring(E,W).lastIndexOf(" "),V=-1===V?a.length:V+E),J[B].push(a.substring(L,
V)),B++,I=!1,E=V),E++;return J};U.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=U;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(a,c){if(0==c)return 1;if(0>c)return NaN;if(0<=a||b(c)===c)return Math.pow(a,c);if(0>a){var e=1/c,f=b(e);if(f===e&&1===f%2)return-Math.pow(-a,c)}return NaN}function d(a,b){y=[];y.type="matrix";y.rows=a;y.cols=b;k=0;for(x=b;k<x;k++)y[k]=Array(a).fill(0);return y}function c(a,b){q=a.rows;u=a.cols;y=d(q,u);var c;for(k=0;k<q;k++)for(p=0;p<u;p++){for(x=c=0;x<u;x++)c+=a[x][k]*b[p][x];y[p][k]=c}return y}function r(a,b,c){for(var e=d(c.length-1,c.length-1),f=0,k=e.length;f<
k;f++)for(var g=0;g<k;g++)e[f][g]=f<a?g<b?c[f][g]:c[f][g+1]:f<b?c[f+1][g]:c[f+1][g+1];return e}function l(a){if(1<a.cols){for(var b=0,c=1,e=0,f=a.cols;e<f;e++)b+=c*a[0][e]*l(r(0,e,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var b=Math.floor,g={},m,e,n,f,v,q,u,y,p,k,x,w=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};w.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};w.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
w.prototype.replaceLastChild=function(a){n=this.childs.length-1;e=this.childs[n];e.parent=null;this.childs[n]=a;a.parent=this;return a};w.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,c=this.childs.length;b<c;b++)if(this.childs[b].contains(a))return!0;return!1};w.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new w("compOperator","=="),v.addChild(this),v.addChild(new w("number","0")),f=this.getRoot(),f.setAllEvalFun(),
f):this};w.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=0,b=this.childs.length;a<b;a++)if("square_bracket"===this.childs[a].type||"parentheses"===this.childs[a].type)this.childArray=this.childArray.concat(this.childs[a].childs);return this.childArray}return null};w.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};w.prototype.setEvalFun=
function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var e;this.evaluate=function(a,b){e=a.variables[this.value];if("object"===typeof e&&void 0==e.length)return e.evaluate(a);void 0==e&&(b||a.matrices[this.value]?e=a.matrices[this.value]:
a.vectors[this.value]&&(e=a.vectors[this.value]));return void 0!==e?e:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var f;this.evaluate=function(a){try{return f=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==f?f:0}catch(M){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return f=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==f?f:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var n,v,x;this.evaluate=function(a){n=[];for(var b=0,c=this.childs[0].childs.length;b<c;b++)n[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){m=0<n.length?n[0]:0;if("number"==typeof m)return"NaN";m.match(",")&&parseFloat(m.replace(",","."))==m.replace(",",".")&&(m=m.replace(",","."));if(void 0==g[m]){v=m.match(/:=/g)?!0:!1;if(m.match(";")){var e=
!1,f=[],k=0;b=0;for(c=m.length;b<c;b++){var d=m.charAt(b);"'"===d&&(e=!e);e||";"!==d||(f.push(m.substring(k,b)),k=b+1)}f.push(m.substring(k));m="("+f.join(")(")+")"}g[m]=a.parser.parse(m,v)}x=a.eval(g[m]);return void 0!=x?x:NaN}return a.functions[this.value].apply(a,n)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(b){var c=this.childs[0].evaluate(b,!0);b=this.childs[1].evaluate(b,!0);if("matrix"!==c.type||"matrix"!==b.type)return"number"==typeof c&&"string"==typeof b?c=a.removeNeedlessDecimals(c.toString()):
"string"==typeof c&&"number"==typeof b&&(b=a.removeNeedlessDecimals(b.toString())),c+b;q=c.rows;u=c.cols;y=d(q,u);for(k=0;k<q;k++)for(p=0;p<u;p++)y[p][k]=c[p][k]+b[p][k];return y}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b-a;q=b.rows;u=b.cols;y=d(q,u);for(k=0;k<q;k++)for(p=0;p<u;p++)y[p][k]=b[p][k]-a[p][k];return y}:"*"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,
!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:c(b,a)}:"/"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var e=d(a.length,a.length),f=l(a);if(0===f)a=0;else{f=1/f;if(1<a.length)for(var k=0,g=a.length;k<g;k++){var n=f;for(var h=0;h<g;h++)e[h][k]=n*l(r(k,h,a)),n=-n;f=-f}else e[0][0]=f;a=e}b=0===a?d(b.rows,b.cols):c(b,a);return b}:"%"===this.value?this.evaluate=
function(a){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return c-b(c/a)*a}:"^"===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?h(b,a):1/h(b,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+(1E-8>Math.abs(b-a)):+(b===a)}:"!="===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&
"number"==typeof a?+!(1E-8>Math.abs(b-a)):+(b!==a)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):
this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);
else for(var e=0;e<b;e++){var f=[];for(var k=0,d=this.childs[e].childs.length;k<d;k++)f.push(this.childs[e].childs[k].evaluate(a));c[e]=f}return c};else if("assign"===this.type){var J,w=this.childs[0],B=this.childs[1],I=w.childs[0]?w.childs[0].childs:null;this.evaluate=1===w.childs.length&&"square_bracket"===w.childs[0].type&&1===I.length?function(a){J=B.evaluate(a);a.setVector(w.value,I[0].evaluate(a),J);return J}:1===w.childs.length&&"square_bracket"===w.childs[0].type&&2===I.length?function(a){J=
B.evaluate(a);a.setMatrix(w.value,I[0].evaluate(a),I[1].evaluate(a),J);return J}:function(a){J=B.evaluate(a);return J.type?a.matrices[w.value]=J:"object"!==typeof a.variables[w.value]?a.variables[w.value]=J:0}}};a.Node=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e=/^\s+/,n=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,f=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,q=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,y=/^[\?:]/,p=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,k=/^\[|^\]/,x=/^\(|^\)/,w=/^,/,z=/^;/,A=/\|/g,D=/\|\*/g,G=/\*\|/g,F=/^\/\//g,J=/:\/\//g,E,B=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
I=function(){};I.prototype.tokenize=function(B){function E(a,c,e){d.push({type:a,value:c});b=b.slice(e);r+=e;m=a}if(h=B){B=B.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});B=B.replace(/&sup(.+?);/g,"^$1 ");B=B.replace(/&squot;/g,"'");B.match(/=\|\*/g)&&(B=B.replace(D,"'").replace(G,"'"));B.match(/=\|/g)&&(B=B.replace(A,"'"));var I=B.trim();"|"==I.charAt(0)&&"|"==I.charAt(I.length-1)&&(B=I.replace(A,"'"))}d=[];c=!1;r=0;b=B;for(m="";B&&r<B.length;)if(c=
r,"'"==b[0]){for(g=1;"'"!=b[g];)if(g<b.length)g++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+h+"\u300b");return}l=b.substring(1,g);E("string",l,l.length+2)}else{if(l=b.match(F))if(b.match(J))continue;else{r=2*B.length;break}if(l=b.match(e))b=b.slice(l[0].length),r+=l[0].length;else if(l=b.match(p))l[0]=l[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),E("operator",l[0],l[0].length);else if(l=b.match(n))"number"===m&&d.push({type:"operator",
value:"*"}),E("identifier",l[0],l[0].length);else if(l=b.match(f))E("number",l[0],l[0].length);else if(l=b.match(v))I=l[0],"#"==I&&(I="!="),E("compOperator",I,l[0].length);else if(l=b.match(q))I=l[0],"||"==I?I="|":"&&"==I?I="&":"~"==I&&(I="!"),E("boolOperator",I,l[0].length);else if((l=b.match(u))&&!b.match(/^==/))E("assign",l[0],l[0].length);else if(l=b.match(y))E("conditional",l[0],l[0].length);else if(l=b.match(k))E("square_bracket",l[0],l[0].length);else if(l=b.match(x))"("==l&&"number"===m&&
d.push({type:"operator",value:"*"}),E("parentheses",l[0],l[0].length);else if(l=b.match(w))E("separator",l[0],l[0].length);else if(178===b.charCodeAt(0))d.push({type:"operator",value:"^"}),E("number",2,1);else if(179===b.charCodeAt(0))d.push({type:"operator",value:"^"}),E("number",3,1);else if(l=b.match(z))E("final_of_expression",l[0],l[0].length);else if(c==r){a.DEBUG.setError(a.DEBUG.EXPRESSION,h);return}}return d};I.prototype.flatTokens=function(a,b){a=a||[];b=b||"";E="";for(var c=0,e=a.length;c<
e;c++)E="string"==a[c].type?E+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(B)?E+a[c].value:E+b+a[c].value;return E};a.Tokenizer=I;return a}(descartesJS||{});
descartesJS=function(a){function h(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function d(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-_NUM_MAX_ITE_ALG_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-device-dispositivo-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-piso-ceil-techo-round-redondeo-trunc-truncamiento-min-max-_Trace_-_Print_-_Num_-isNumber-esN\u00famero-random-aleatorio-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_SaveSpace_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-DJS.squote-DJS.comma-DJS.w-DJS.h-");
var c=Date.now(),r,l,b,g,m,e,n,f,v,q,u,y,p=function(b){this.evaluator=b;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};p.prototype.setDefinition=function(a,b){this.definitions[a]=b};p.prototype.getDefinition=function(a){return this.definitions[a]};p.prototype.setVariable=function(a,b){this.variables[a]=b};p.prototype.getVariable=function(a){return this.variables[a]};
p.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};p.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};p.prototype.setMatrix=function(a,b,c,e){this.matrices[a][b][c]=e};p.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};p.prototype.setFunction=function(a,b){this.functions[a]=b};p.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||
(this.functions[a]=function(){return 0});return this.functions[a]};p.prototype.parse=function(c,d){(b=this.tokenizer.tokenize(c))||(b=[]);g=null;d=!d||!1;r=f=n=e=0;for(l=b.length;r<l;r++){v=b[r];q=v.value;u=v.type;if("identifier"===u)if(r+1<l&&"parentheses"===b[r+1].type&&"("===b[r+1].value)this.getFunction(q);else if(r+1<l&&"square_bracket"===b[r+1].type&&"["===b[r+1].value)b[r+3]&&"square_bracket"===b[r+3].type&&"]"===b[r+3].value?this.getVector(q):this.getMatrix(q);else{var k=q.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);
k&&(this.variables[(k[1]||k[2]||k[3]||k[4]||k[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(q,!0)}"assign"===u&&d&&":="!=q&&(u="compOperator",q="==");if("assign"===u)if(m=new a.Node(u,q),null!=g)if("identifier"===g.type)g.parent&&g.parent.replaceLastChild(m),m.addChild(g),g=m,d=!0;else if("square_bracket"===g.type)m.addChild(g.parent),g=m,d=!0;else{m.type="compOperator";m.value="==";for(d=!0;g.parent&&h(g.parent.value)>=h(m.value);)g=g.parent;g.parent&&g.parent.replaceLastChild(m);m.addChild(g);
g=m}else{console.info("Error1: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===q||"square_bracket"===u&&"["===q)if(m=new a.Node(u,q),"("===q&&e++,"["===q&&n++,null===g)"("===q&&(new a.Node("(expr)","(expr)")).addChild(m),"["===q&&(new a.Node("[expr]","[expr]")).addChild(m),g=m;else if("operator"===g.type||"boolOperator"===g.type||"compOperator"===g.type||"conditional"===g.type||"assign"===g.type)g.addChild(m),g=m;else if("sign"===
g.type)g.addChild(m),g=m;else if("parentheses"===g.type&&"("===g.value)g.addChild(m),g=m;else if("square_bracket"===g.type&&"["===g.value)g.addChild(m),g=m;else if("parentheses"===g.type&&"()"===g.value)g.parent.addChild(m),g=m;else if("square_bracket"===g.type&&"[]"===g.value)g.parent.addChild(m),g=m;else if("identifier"===g.type)g.addChild(m),g=m;else{console.info("Error2: en la expresi\u00f3n \u300a "+c+" \u300b, en el token ["+r+"] {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&
")"===q)if(e--,null===g)console.info("Error3: en la expresi\u00f3n \u300a "+c+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;g&&g.parent&&("("!=g.value||"("==g.value&&"parentheses"!=g.type);)g=g.parent;if(g&&"("===g.value)g.value="()";else break}else if("square_bracket"===u&&"]"===q)if(n--,null===g)console.info("Error5: en la expresi\u00f3n \u300a "+c+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;g&&g.parent&&("["!=g.value||"["==g.value&&"square_bracket"!=g.type);)g=g.parent;if(g&&
"["===g.value)g.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(m=new a.Node(u,q),null===g)g=m;else if("operator"===g.type||"compOperator"===g.type||"boolOperator"===g.type||"parentheses"===g.type&&"("===g.value||"square_bracket"===g.type&&"["===g.value||"sign"===g.type||"conditional"===g.type||"assign"===g.type)g.addChild(m),g=m;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
c);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(m=new a.Node(u,q),null===g)if("-"===q||"+"===q)m.type="sign",m.value="sign"+q,g=m;else if("!"===q)g=m;else{console.info("Error8: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("operator"===g.type||"compOperator"===g.type||"boolOperator"===g.type||"assign"===g.type||"conditional"===g.type||"square_bracket"===g.type&&"["===g.value&&("-"===q||"+"===q||"!"===q)||"parentheses"===
g.type&&"("===g.value&&("-"===q||"+"===q||"!"===q)){if("-"===q||"+"===q)m.type="sign",m.value="sign"+q;g.addChild(m);g=m}else if("number"===g.type||"parentheses"===g.type&&"()"===g.value||"square_bracket"===g.type&&"[]"===g.value||"string"===g.type||"identifier"===g.type||"conditional"===g.type||"assign"===g.type){for(;g.parent&&h(g.parent.value)>=h(m.value);)g=g.parent;g.parent&&g.parent.replaceLastChild(m);m.addChild(g);g=m}else{console.info("Error9: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+
q+", tipo: "+u+"}");break}else if("conditional"===u)if(m=new a.Node(u,q),null!=g)if("?"===m.value){for(f++;g.parent&&h(g.parent.value)>h(m.value);)g=g.parent;g.parent&&g.parent.replaceLastChild(m);m.addChild(g);g=m}else{for(f--;g&&g.parent&&("?"!=g.value||"?"==g.value&&"conditional"!=g.type);)g=g.parent;if(g&&"?"===g.value)g.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("separator"===u)if(null!=g)for(;g.parent&&"("!=g.value&&"["!=g.value;)g=g.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}0<e&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,c);0>e&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,c);0<n&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
c);0>n&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,c);0!=f&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,c);(y=g?g.getRoot():null)&&y.setAllEvalFun();return y};p.prototype.registerDefaultValues=function(){var b=this;b.variables._NUM_MAX_ITE_ALG_=1E5;b.variables.rnd=Math.random;b.variables.pi=b.variables["\u03c0"]=Math.PI;b.variables.e=Math.E;b.variables.Infinity=Infinity;b.variables["-Infinity"]=-Infinity;b.variables.isTouch=b.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;b.variables.device=b.variables.dispositivo=
function(){var a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"mobile":"desktop"}();Object.defineProperties(b.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});
b.variables["DJS.squote"]="\\u0027";b.variables["DJS.comma"]="\\u002C";b.functions.sqr=function(a){return a*a};b.functions.sqrt=b.functions["ra\u00edz"]=Math.sqrt;b.functions.exp=Math.exp;b.functions.log=Math.log;b.functions.log10=Math.log10?Math.log10:function(a){return Math.log(a)/Math.log(10)};b.functions.abs=Math.abs;b.functions.ent=function(a){return Math.trunc(parseFloat(a)+1E-16*Math.sign(a))};b.functions.sgn=Math.sign;b.functions.ind=function(a){return a?1:0};b.functions.sin=b.functions.sen=
Math.sin;b.functions.cos=Math.cos;b.functions.tan=Math.tan;b.functions.cot=function(a){return 1/Math.tan(a)};b.functions.sec=function(a){return 1/Math.cos(a)};b.functions.csc=function(a){return 1/Math.sin(a)};b.functions.sinh=b.functions.senh=Math.sinh?Math.sinh:function(a){return(Math.exp(a)-Math.exp(-a))/2};b.functions.cosh=Math.cosh?Math.cosh:function(a){return(Math.exp(a)+Math.exp(-a))/2};b.functions.tanh=Math.tanh?Math.tanh:function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};
b.functions.coth=function(a){return 1/b.functions.tanh(a)};b.functions.sech=function(a){return 1/b.functions.cosh(a)};b.functions.csch=function(a){return 1/b.functions.sinh(a)};b.functions.asin=b.functions.asen=Math.asin;b.functions.acos=Math.acos;b.functions.atan=Math.atan;b.functions.atan2=Math.atan2;b.functions.floor=b.functions.piso=Math.floor;b.functions.ceil=b.functions.techo=Math.ceil;b.functions.round=b.functions.redondeo=Math.round;b.functions.trunc=b.functions.truncamiento=Math.trunc;b.functions.min=
Math.min;b.functions.max=Math.max;b.functions._Trace_=b.functions._Print_=function(){console.info.apply(console,arguments);return 0};b.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};b.functions.isNumber=b.functions["esN\u00famero"]=function(a){return Number.isFinite(a)?1:0};b.functions.random=b.functions.aleatorio=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?1:parseFloat(b);a>b&&(b=$jscomp.makeIterator([b,
a]),a=b.next().value,b=b.next().value);return a+Math.random()*(b-a)};b.functions._Stop_Audios_=function(){b.evaluator.parent.stopAudios()};b.functions.esCorrecto=function(c,e,f){return a.esCorrecto(c,e,b.evaluator,f)};b.functions.escorrecto=function(c,e,f){return a.escorrecto(c,e,b.evaluator,f)};window.parent!==window&&(b.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},b.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},
"*");return 0},b.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});b.functions.toFixed=b.functions._NumToStr_=b.functions._NumACadena_=function(a,c){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(c||0)).replace(".",b.evaluator.parent.decimal_symbol)};b.functions.charAt=b.functions._charAt_=b.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};b.functions.substring=
b.functions._substring_=b.functions._subcadena_=function(a,b,c){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);c=isNaN(parseInt(c))?0:parseInt(c);return 0<=b&&0<=c?a.substring(b,c):0>b&&0<=c?a.substring(c):0>c&&0<=b?a.substring(b):""};b.functions.strLength=b.functions._length_=b.functions._longitud_=function(a){return(a||"").toString().length};b.functions.indexOf=b.functions._indexOf_=b.functions["_\u00edndiceDe_"]=function(a,b){return(a||"").toString().indexOf((b||"").toString())};b.functions.lastIndexOf=
function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};b.functions.replace=b.functions._replace_=b.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var e=a.indexOf(b);0<=e;)a=a.substring(0,e)+c+a.substring(e+b.length),e=a.indexOf(b,e+c.length);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};b.functions.trim=function(a){return(a||
"").toString().trim()};b.functions._Load_=function(b){var c="";b&&(c=(c=document.getElementById(b))&&"descartes/archivo"==c.type?c.text:a.openFile(b));return c||""};b.functions._GetValues_=function(a,c){return b.functions._ExecBlock_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._GetMatrix_=function(a,c){return b.functions._StrToMatrix_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._MatrixToStr_=function(c){var e=b.matrices[c];
if(e){for(var f="<"+c+">\\n",d=b.getVariable(c+".columnas_usadas")||e.cols||0,g=b.getVariable(c+".filas_usadas")||e.rows||0,n,k=0;k<d;k++){for(var h=0;h<g;h++)n=e[k][h],void 0!==n&&("string"==typeof n?n="'"+n+"'":"number"==typeof n&&(n=a.removeNeedlessDecimals(n.toFixed(6))),f+=n+(h<g-1?" \u00a6 ":""));f=f.replace(/(\u00A6 )$/g,"")+"\\n"}return f+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var e=[],f=!1,g=!1;e.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var n=
0,k=a.length;n<k;n++)a[n].match("<"+c+">")?(g=!0,f=a[n].trim().split("<"+c+">"),2==f.length&&""!=f[1]&&e.push(f[1].split(String.fromCharCode("166")).map(d)),f=!0):(a[n].match("</"+c+">")&&(f=a[n].trim().split("</"+c+">"),2==f.length&&""!=f[0]&&e.push(f[0].split(String.fromCharCode("166")).map(d)),f=!1,n=a.length),f&&e.push(a[n].split(String.fromCharCode("166")).map(d)));b.matrices[c]=e;b.matrices[c].rows=e&&e[0]&&e[0].length?e[0].length:0;b.matrices[c].cols=e&&e.length?e.length:0;b.setVariable(c+
".filas",b.matrices[c].rows);b.setVariable(c+".columnas",b.matrices[c].cols)}return g?"OK":"ERROR"};b.functions._GetVector_=function(a,c){return b.functions._StrToVector_(b.functions._Load_(a),c)};b.functions._VectorToStr_=function(a){var c=b.vectors[a];if(c){for(var e="<"+a+">\\n",f=b.getVariable(a+".long_usada")||c._size_||0,d,g=0;g<f;g++)d=c[g],void 0!==d?("number"==typeof d&&(d=parseFloat(d)),e+=d+"\\n"):e+="0\\n";return e+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var e=[],
f=!1,g=!1;e.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var n=0,k=a.length;n<k;n++)a[n].match("<"+c+">")?f=g=!0:(a[n].match("</"+c+">")&&(f=!1,n=a.length),f&&e.push(d(a[n])));e._size_=e.length;b.vectors[c]=e;b.setVariable(c+".long",e.length);b.setVariable(c+".long_usada",e.length)}return g?"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var e=[],f=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);
for(var d=0,g=a.length;d<g;d++)a[d].match("<"+c+">")?(f=a[d].trim().split("<"+c+">"),2==f.length&&""!=f[1]&&(e=e.concat(f[1].split(String.fromCharCode("166")))),f=!0):a[d].match("</"+c+">")?(f=a[d].trim().split("</"+c+">"),2==f.length&&""!=f[0]&&(e=e.concat(f[0].split(String.fromCharCode("166")))),f=!1):f&&(e=e.concat(a[d].split(String.fromCharCode("166"))));d=0;for(g=e.length;d<g;d++)f=e[d].split("="),f[0]=f[0].trim(),2==f.length&&""!=f[0]&&(isNaN(parseFloat(f[1]))?b.setVariable(f[0],f[1].replace(/^\s|\s$/g,
"").replace(/^'|'$/g,"")):b.setVariable(f[0],parseFloat(f[1])))}return 0};var e=a.newHTML("a",{target:"_blank"}),f,g=null;a.newBlobContent=null;b.functions._Save_=function(d,n){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(c=Date.now(),document.body.appendChild(e),g=n.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),f=new Blob(["\ufeff",g],{type:"text/plain;charset=utf-8"}),e.setAttribute("href",window.URL.createObjectURL(f)),e.setAttribute("download",
d),g!=a.newBlobContent&&(e.click(),a.newBlobContent=g),document.body.removeChild(e));return 0};var n=a.newHTML("a",{target:"_blank"});b.functions._SaveSpace_=function(e,f){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(c=Date.now(),document.body.appendChild(n),g=f,n.setAttribute("href",g),n.setAttribute("download",e),g!=a.newBlobContent&&(n.click(),a.newBlobContent=g),document.body.removeChild(n));return 0};var h,q,l=a.newHTML("input",{type:"file"});l.addEventListener("change",function(c){h=
c.target.files;q=new FileReader;q.onload=function(c){a.addExternalFileContent(h[0].name,c.target.result);b.setVariable("DJS.fileName",h[0].name);b.setVariable("DJS.fileContent",c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());l.value=""};0<h.length&&q.readAsText(h[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(b._callback=a,l.click(),c=Date.now());return 0};b.functions._AnchoDeCadena_=
b.functions._strWidth_=function(b,c,e,f){return a.getTextWidth(b,a.convertFont(c+","+e+","+f))};b.functions.R=b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/255};b.functions.G=b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};b.functions.B=b.functions._Azul_=b.functions._Blue_=function(b){return(new a.Color(b)).b/255};b.functions.HSV2RGB=function(a,b,c){a=parseInt(a)%360;b*=c;var e=b*(1-Math.abs(a/60%2-1));c-=b;if(0<=a&&60>a){var f=b;var d=
e;var g=0}else 60<=a&&120>a?(f=e,d=b,g=0):120<=a&&180>a?(f=0,d=b,g=e):180<=a&&240>a?(f=0,d=e,g=b):240<=a&&300>a?(f=e,d=0,g=b):300<=a&&360>a&&(f=b,d=0,g=e);f=parseInt(255*(f+c));d=parseInt(255*(d+c));g=parseInt(255*(g+c));return""+f.toString(16).padStart(2,"0")+d.toString(16).padStart(2,"0")+g.toString(16).padStart(2,"0")};b.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=function(c){this.parent=c;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,d){this.definitions[a]=d};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,d){this.variables[a]=d};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(a,d,l){d=0>d?0:h(d);this.vectors[a][d]=l};d.prototype.getVector=function(a,d){d=0>d?0:h(d);return this.vectors[a][d]};d.prototype.setMatrix=function(a,d,l,b){d=0>d?0:h(d);l=0>l?0:h(l);void 0==this.matrices[a][d]&&(this.matrices[a][d]=[]);this.matrices[a][d][l]=b};d.prototype.getMatrix=function(a,d,l){d=0>d?0:h(d);l=0>l?0:h(l);return this.matrices[a][d][l]};d.prototype.setFunction=function(a,d){this.functions[a]=d};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new d;a.Evaluator=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n,f,v,q,u,y,p=function(b,c){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==c;this.textStr=(c||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;c.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=c,this.textNodes=(new a.RTFParser(b.evaluator)).parse(c.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};p.prototype.drawText=function(e,f,g,n,q){h=this.evaluator.eval(this.decimals);d=this.evaluator.eval(this.parent.width);
c=this.evaluator.eval(this.parent.font_size);r=f.getColor?f.getColor():f;l=this.textToString(this.text,h,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=l.indexOf("[")&&(l=this.textToString(this.parseSimpleText(l),h,this.fixed));if(this.oldTextStr!==l||this.oldWidth!==d||this.oldSize!==c||this.oldColor!==r||this.oldPosX!==g||this.oldPoxY!==n)b=new a.TextStyle({size:c,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:r,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(l,this.evaluator,b),this.textNodes.update(g,n,h,this.fixed,this.align,this.anchor,r,d);q||this.textNodes.draw(e);this.oldTextStr=l;this.oldWidth=
d;this.oldSize=c;this.oldColor=r;this.oldPosX=g;this.oldPoxY=n};p.prototype.drawRTF=function(a,b,c,e,f){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,e,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));f||this.textNodes.draw(a)};p.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");g=[];m="'";n=e=0;f=-1;for(u=a.length;e<u;)v=a.charAt(e),q=a.charAt(e-1),"["===v&&"\\"===q?(g.push(a.substring(n,e-1)+"["),n=e+1):"]"===v&&"\\"===q?(g.push(a.substring(n,e-1)+"]"),n=e+1):"["===v&&-1===f?(g.push(a.substring(n,e)),n=e,f++):"["===v?f++:"]"===v&&0===f?(g.push(this.evaluator.parser.parse(a.substring(n,e+1))),n=e+1,f--):("]"==a.charAt(e)&&(f=0>f?f:f-1),m+=a.charAt(e)),e++;g.push(a.substring(n,e));return g};p.prototype.textToString=function(b,c,e){m="";if("rtfNode"!==
b.type)for(var f=0,d=b.length;f<d;f++)"string"===typeof b[f]?m+=b[f]:(y=this.evaluator.eval(b[f])[0][0],""!==y&&("string"===typeof y?m+=y:Infinity===y?m+="Infinity":-Infinity===y?m+="-Infinity":isNaN(y)||"NaN"===y?m+="NaN":(y=parseFloat(y),y=e?y.toFixed(c):a.removeNeedlessDecimals(y.toFixed(c)),m+=y.toString().replace(".",this.decimal_symbol))));return m};a.TextObject=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d=function(){};d.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var c=[],d=null,b=0,g=a.length;a.charAt(0);var m=!1,e=!1,n=0;h="";for(var f=0;f<g;f++){var v=a.charAt(f);var q=a.charAt(f+1);"\\"===v&&"$"===q&&(e=!0);"{"===v?n++:"}"===v&&(n--,e&&0===n&&(e=!1));e?"_"===v?"{"===q?h+="\\subindex":(h+="\\subindex{"+q+"}",f++):"^"===v?"{"===q?h+="\\superindex":(h+="\\superindex{"+q+"}",f++):h+=v:h+=v}a=h;q=a.charAt(0);for(g=a.length;b<
g;)v=q,q=a.charAt(b+1),m&&("{"===v||"["===v||"\\"===v||" "===v?(m=!1," "===v&&(d={type:"ignore"},c.push(d))):d.value+=v),m||"\\"!==v?m||"{"!==v&&"["!==v?m||"}"!==v&&"]"!==v?m||(d&&"text"===d.type?d.value+=v:d&&"ignore"===d.type?(c.pop(),d=c[c.length-1]):(d={type:"text",value:v},c.push(d))):(d={type:"close",value:v},c.push(d)):(d={type:"open",value:v},c.push(d)):(m=!0,d={type:"command",value:""},c.push(d)),b++;return c};a.DescarTeXTokenizer=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(){this.tokenizer=new a.DescarTeXTokenizer};h.prototype.parse=function(d,c,h){d=this.tokenizer.tokenize(d);var l=new a.TextNode("","textBlock",h,null),b=new a.TextNode("","textLineBlock",h.clone(),null);l.addChild(b);for(var g=[],m=void 0,e=h,n=[h],f,r,q,u,y=!1,p=0,k=d.length;p<k;p++)if("text"===d[p].type)if("color_parameter"===m)r=new a.Color(d[p].value,c);else if("text_size_parameter"===m)q=parseFloat(d[p].value);else if("textLineBlock"===
b.nodeType){f=d[p].value.split(" ");for(var x=0,w=f.length;x<w;x++)""!==f[x]&&b.addChild(new a.TextNode(f[x],"text",e.clone(),null)),x+1<w&&b.addChild(new a.TextNode(" ","space",e.clone(),null))}else b.addChild(new a.TextNode(d[p].value,"text",e.clone(),null));else"command"===d[p].type&&"curlyBracketOpen"===d[p].value?b.addChild(new a.TextNode("{","text",e.clone(),null)):"command"===d[p].type&&"curlyBracketClose"===d[p].value?b.addChild(new a.TextNode("}","text",e.clone(),null)):"command"===d[p].type&&
"squareBracketOpen"===d[p].value?b.addChild(new a.TextNode("[","text",e.clone(),null)):"command"===d[p].type&&"squareBracketClose"===d[p].value?b.addChild(new a.TextNode("]","text",e.clone(),null)):"command"===d[p].type&&"newline"===d[p].value?(0===b.children.length&&b.addChild(new a.TextNode("","text",e.clone(),null)),b=new a.TextNode("","textLineBlock",h.clone(),null),l.addChild(b)):"command"===d[p].type&&"b"===d[p].value?(m="bold",g.push(m)):"command"===d[p].type&&"i"===d[p].value?(m="italic",
g.push(m)):"command"===d[p].type&&"o"===d[p].value?(m="overline",g.push(m)):"command"===d[p].type&&"u"===d[p].value?(m="underline",g.push(m)):"command"===d[p].type&&"color"===d[p].value?(m="color",g.push(m)):"command"===d[p].type&&"ts"===d[p].value?(m="text_size",g.push(m)):"command"===d[p].type&&"sansserif"===d[p].value.toLowerCase()?(m="sansserif",g.push(m)):"command"===d[p].type&&"serif"===d[p].value.toLowerCase()?(m="serif",g.push(m)):"command"===d[p].type&&"monospace"===d[p].value.toLowerCase()?
(m="monospace",g.push(m)):"command"===d[p].type&&"c"===d[p].value?(m="center",g.push(m)):"command"===d[p].type&&"l"===d[p].value?(m="left",g.push(m)):"command"===d[p].type&&"r"===d[p].value?(m="right",g.push(m)):"command"===d[p].type&&"j"===d[p].value?(m="justify",g.push(m)):"command"===d[p].type&&"$"===d[p].value?(m="formula",g.push(m),y=!0):"command"===d[p].type&&"sum"===d[p].value?(m="sum",g.push(m)):"command"===d[p].type&&"prod"===d[p].value?(m="prod",g.push(m)):"command"===d[p].type&&"int"===
d[p].value?(m="integral",g.push(m)):"command"===d[p].type&&"lim"===d[p].value?(m="limit",g.push(m)):"command"===d[p].type&&"sqrt"===d[p].value?(m="radical",g.push(m)):"command"===d[p].type&&"subindex"===d[p].value?(m="subIndex",g.push(m)):"command"===d[p].type&&"superindex"===d[p].value?(m="superIndex",g.push(m)):"command"===d[p].type&&"frac"===d[p].value?(m="numerator",g.push(m)):"open"===d[p].type&&"{"===d[p].value&&void 0!==m?"bold"===m||"italic"===m||"overline"===m||"underline"===m?(e=e.clone(),
e[m]=!0,n.push(e)):"sansserif"===m?(e=e.clone(),e.family="sansserif",n.push(e)):"serif"===m?(e=e.clone(),e.family="serif",n.push(e)):"monospace"===m?(e=e.clone(),e.family="monospaced",n.push(e)):"text_size"===m?m="text_size_parameter":"text_size_text"===m?(e=e.clone(),e.size=q,n.push(e)):"color"===m?m="color_parameter":"color_text"===m?(e=e.clone(),e.color=r,n.push(e)):"center"===m||"left"===m||"right"===m||"justify"===m?(e=e.clone(),e.align=m,n.push(e),b=new a.TextNode("","textLineBlock",e.clone(),
null),l.addChild(b)):"formula"===m?(e=e.clone(),n.push(e),u=new a.TextNode("","formula",e.clone(),null),b.addChild(u),b=u):"subIndex"===m||"superIndex"===m?y?(e=e.clone(),n.push(e),u=new a.TextNode("",m,e.clone(),null),b.addChild(u),b=u):b.addChild(new a.TextNode("subIndex"===m?"_":"^","text",e.clone(),null)):"radical"===m?y&&(u=new a.TextNode("","radical",e.clone(),null),b.addChild(u),b=u,e=e.clone(),n.push(e),u=new a.TextNode("","index",e.clone(),null),b.addChild(u),b=u,m="index"):"index"===m?y&&
(n.pop(),e=n[n.length-1],u=new a.TextNode("","radicand",e.clone(),null),b.addChild(u),b=u,m="radicand"):"sum"===m||"integral"===m||"limit"===m||"prod"===m?y&&(u=new a.TextNode("",m,e.clone(),null),b.addChild(u),b=u,e=e.clone(),n.push(e),u=new a.TextNode("","from",e.clone(),null),b.addChild(u),b=u,m="from",g[g.length-1]=m):"from"===m?y&&(u=new a.TextNode("","to",e.clone(),null),b.addChild(u),b=u,m="to",g[g.length-1]=m):"to"===m?y&&(n.pop(),e=n[n.length-1],u=new a.TextNode("","what",e.clone(),null),
b.addChild(u),b=u,m="what",g[g.length-1]=m):"numerator"===m?y&&(u=new a.TextNode("","fraction",e.clone(),null),b.addChild(u),b=u,e=e.clone(),n.push(e),u=new a.TextNode("","numerator",e.clone(),null),b.addChild(u),b=u,m="numerator"):"denominator"===m&&(u=new a.TextNode("",m,e.clone(),null),b.addChild(u),b=u):"close"===d[p].type&&"}"===d[p].value&&void 0!==m&&("bold"===m||"italic"===m||"overline"===m||"underline"===m||"color_text"===m||"color"===m||"text_size_text"===m||"text_size"===m||"sansserif"===
m||"serif"===m||"monospace"===m?(n.pop(),e=n[n.length-1],g.pop(),m=g[g.length-1]):"color_parameter"===m?m="color_text":"text_size_parameter"===m?m="text_size_text":"center"===m||"left"===m||"right"===m||"justify"===m?(n.pop(),e=n[n.length-1],g.pop(),m=g[g.length-1],d[p+1]&&"command"===d[p+1].type&&"newline"===d[p+1].value?b=l:(b=new a.TextNode("","textLineBlock",e.clone(),null),l.addChild(b))):"formula"===b.nodeType?(y=!1,n.pop(),e=n[n.length-1],g.pop(),m=g[g.length-1],b=b.parent):"subIndex"===b.nodeType||
"superIndex"===b.nodeType?y&&(n.pop(),e=n[n.length-1],g.pop(),m=g[g.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(g.pop(),m=g[g.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(g.pop(),m=g[g.length-1],b=b.parent.parent):"numerator"===b.nodeType?(m="denominator",b=b.parent):"denominator"===b.nodeType&&(n.pop(),e=n[n.length-1],g.pop(),m=g[g.length-1],b=b.parent.parent));var z,A,D=null,G=[];l.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)z=a.children[b],A=a.children[b+1],"text"===z.nodeType&&"text"===A.nodeType&&z.style.equals(A.style)?(null===D&&(D=z,u=z.clone(),D.changeNodeType("word"),D.value="___"+u.value,D.addChild(u)),u=A.clone(),D.addChild(u),G.push(A),D.value+=u.value):D=null});G.forEach(function(a){a.parent.removeChild(a)});l.normalize();l.adjustFontSize();return l};a.DescarTeXParser=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};d.prototype.clone=function(){return new d(Object.assign({},this))};d.prototype.set=function(a){Object.assign(this,a)};d.prototype.equals=function(a){var c=!0,d;for(d in this)this.hasOwnProperty(d)&&(c=c&&this[d]===a[d]);return c};d.prototype.toString=function(c){/arial|sansserif/i.test(this.family)?
h=a.sansserif_font:/times|serif/i.test(this.family)?h=c?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(h=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+h).trim()};a.TextStyle=d;return a}(descartesJS||{});
descartesJS=function(a){function h(a,b){for(var c=0,e=0;e<b;e++)c+=a[e];return c}function d(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((m[a].ascent+25)*c/m[a].unitsPerEm);b.descent=Math.ceil(Math.abs((m[a].descent-25)*c/m[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var c=!1,r="#000000",l=2,b=!1,g=function(b,c,f,d){this.type="rtfNode";this.evaluator=d;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=b;this.style=f;this.changeNodeType(c);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};g.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=
this.drawTextLineBlock;break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;
case "integral":this.draw=this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};g.prototype.clone=function(){for(var a=new g(this.value,this.nodeType,this.style.clone()),b=0,c=this.children.length;b<c;b++)a.addChild(this.children[b].clone());return a};g.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};g.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,c=this.children.length;b<c;b++)a+=this.children[b].stringify()+(b==c-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};g.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};g.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};g.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};g.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};g.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,c=this.parent.children.length;b<c;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};g.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};g.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,e=this.children.length;c<e;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};g.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};g.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};g.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,c=a.length;b<c;b++)0===a[b].children.length&&a[b].addChild(new g("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(c=a.length;b<c;b++){var d=a[b];(null===d.prevSibling()||null!==d.prevSibling()&&"text"!==d.prevSibling().nodeType)&&d.parent.insertBefore(d,
new g("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&d.parent.insertAfter(d,new g("","text",d.parent.style))}return this};g.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,c=a.length;b<c;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};g.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,e=this.children.length;c<e;c++)"text"===this.children[c].nodeType&&
a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=
b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};g.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,e=this.children.length;c<e;c++)this.children[c].propagateStyle(a,b)};g.prototype.update=function(a,c,d,g,h,m,y,p){l=d;b=g;r=y;this.metrics.w=this.metrics.h=0;y=c;if(20<=p)for(d=0;d<this.children.length;d++)this.children[d].breakLines(p);d=0;for(g=this.children.length;d<g;d++){var e=this.children[d];
e.updateLine();e.metrics.offsetX=a;e.metrics.y=c;c+=parseInt(e.metrics.ascent+.5);e.metrics.offsetY=c;h=parseInt(e.metrics.descent+.5)+parseInt(1.5+.05*e.style.size);c+=h;this.metrics.h+=e.metrics.h;this.metrics.w=Math.max(this.metrics.w,e.metrics.w)}c=y;m=m||"";m.match("right")?a-=this.metrics.w:m.match("_center")&&(a-=this.metrics.w/2);m.match("bottom")?c-=this.metrics.h:m.match("center_")&&(c-=this.metrics.h/2);m=this.children;d=0;for(g=m.length;d<g;d++)"left"===m[d].style.align?m[d].metrics.offsetX=
a:"right"===m[d].style.align?m[d].metrics.offsetX=a+this.metrics.w-m[d].metrics.w:"center"===m[d].style.align?m[d].metrics.offsetX=a+(this.metrics.w-m[d].metrics.w)/2:"justify"===m[d].style.align&&20<=p&&(h=d<g-1?m[d+1].value:null,m[d].metrics.offsetX=a,"wrap"===h&&m[d].justifyAux(p)),m[d].metrics.y=c,c+=parseInt(m[d].metrics.ascent+.5),m[d].metrics.offsetY=c,h=parseInt(m[d].metrics.descent+.5)+parseInt(1.5+.05*m[d].style.size),c+=h};g.prototype.breakLines=function(b){for(var c,e=0,d=!1,h=[],m=0,
l=this.children.length;m<l;m++)c=this.children[m],d?h.push(c):("text"===c.nodeType||"space"===c.nodeType?(a.ctx.font=c.style.toString(),c.metrics.w=a.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),e+=c.metrics.w,e>b&&"space"!==c.nodeType&&0<m&&(d=!0,h.push(c)));if(0<h.length)for(b=new g("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),m=0,l=h.length;m<l;m++)h[m].parent&&h[m].parent.removeChild(h[m]),b.addChild(h[m])};
g.prototype.updateLine=function(b){var c=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var e=this.metrics.descent=0,g=this.children,h,m=0,l=g.length;m<l;m++){h=g[m];if("text"===h.nodeType){a.ctx.font=h.style.toString();var p=""!==h.value?h.value:a.in_editor?"\u200a":"";h.metrics=d(a.ctx.font);h.metrics.w=a.ctx.measureText(p).width;h.metrics.offsetX=e;Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===h.nodeType?(a.ctx.font=h.style.toString(),h.metrics=d(a.ctx.font),h.metrics.w=m===l-1?0:b?b:a.ctx.measureText(" ").width,h.metrics.offsetX=e,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===h.nodeType&&(h.updateLine(),h.metrics.offsetX_aux=e,Object.defineProperties(h.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===h.nodeType&&(a.ctx.font=h.styleString,p=""!==h.value?h.value:a.in_editor?"\u200a":"",h.metrics=d(a.ctx.font),h.metrics.w=a.ctx.measureText(p).width,h.metrics.offsetX=e,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),h.clickCatcher||(h.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+h.metrics.w+"px;height:"+
h.metrics.h+"px;cursor:pointer;"}),h.clickCatcher.rtfNode=h,h.clickCatcher.action=new a.OpenURL(this.evaluator.parent,h.URL),h.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===h.nodeType&&(h.componentNumCtrl=this.evaluator.parent.getControlByCId(h.value),a.ctx.font=h.styleString,h.metrics=d(a.ctx.font),h.metrics.w=h.componentNumCtrl.w,h.metrics.h=h.componentNumCtrl.h,h.metrics.offsetX=e,Object.defineProperties(h.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===h.nodeType?(h.componentSpace=this.evaluator.parent.getSpaceByCId(h.value),a.ctx.font=h.styleString,h.metrics=d(a.ctx.font),h.metrics.w=h.componentSpace.w,h.metrics.h=h.componentSpace.h,h.metrics.offsetX=e,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===h.nodeType&&(h.updateFormula(),
h.metrics.marginX=h.metrics.marginY=h.metrics.paddingX=h.metrics.paddingY=0,h.metrics.offsetX_aux=e,Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),h.metrics.w+=2*h.metrics.paddingX,h.metrics.ascent+=h.metrics.paddingY,h.metrics.descent+=h.metrics.paddingY,h.metrics.h+=2*h.metrics.paddingY,e+=2*h.metrics.marginX);
this.metrics.w+=h.metrics.w+2*h.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,h.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,h.metrics.descent);e+=h.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};g.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var g=this.children,f,m=0,q={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},r=0,y=g.length;r<y;r++){f=g[r];if("text"===f.nodeType){a.ctx.font=f.style.toString(!0);var p=""!==f.value?f.value:a.in_editor?"\u200a":"";f.metrics=d(a.ctx.font);f.metrics.w=a.ctx.measureText(p).width;f.metrics.offsetX=m;Object.defineProperties(f.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});m+=c.metrics.marginX}else if("dynamicText"===f.nodeType){p=void 0===
f.decimals?l:f.evaluator.eval(f.decimals);var k=void 0===f.fixed?b:f.fixed,x=f.evaluator.eval(f.value);parseFloat(x).toString()===x.toString()&&(x=k?parseFloat(x).toFixed(p):a.removeNeedlessDecimals(parseFloat(x).toFixed(p)),x=(""+x).replace(".",f.decimal_symbol));f.evalValue=x;a.ctx.font=f.style.toString(!0);f.metrics=d(a.ctx.font);f.metrics.marginX=0;f.metrics.paddingX=0;f.metrics.w=a.ctx.measureText(x).width+2*f.metrics.paddingX;f.metrics.offsetX_aux=m;Object.defineProperties(f.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY}}});m+=2*f.metrics.marginX}if("superIndex"===f.nodeType)p=f,p.updateFormula(),p.metrics.marginX=0,p.metrics.paddingX=0,p.metrics.paddingY=0,p.metrics.offsetX_aux=m,p.metrics.prevChild=q,Object.defineProperties(p.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),p.metrics.w+=2*p.metrics.paddingX,p.metrics.ascent+=p.metrics.paddingY,p.metrics.descent+=p.metrics.paddingY,p.metrics.h+=2*p.metrics.paddingY,p.metrics.tmp_ascent=p.metrics.h+(p.metrics.prevChild.metrics.ascent-p.metrics.prevChild.metrics.descent)/2,m+=2*p.metrics.marginX;else if("subIndex"===f.nodeType)p=f,p.updateFormula(),
p.metrics.marginX=0,p.metrics.paddingX=0,p.metrics.paddingY=0,p.metrics.offsetX_aux=m,p.metrics.prevChild=q,Object.defineProperties(p.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),p.metrics.w+=p.metrics.paddingX,p.metrics.ascent+=p.metrics.paddingY,
p.metrics.descent+=p.metrics.paddingY,p.metrics.h+=2*p.metrics.paddingY,this.metrics.descent=p.metrics.ascent+(p.metrics.prevChild.metrics.descent-p.metrics.prevChild.metrics.ascent)/2+p.metrics.descent,m+=p.metrics.marginX;else if("fraction"===f.nodeType){k=f;k.updateFormula();p=k.children;x=p[0];p=p[1];k.metrics.marginX=parseInt(.5+.075*this.style.size);k.metrics.paddingX=0;k.metrics.paddingY=0;var w=Math.max(x.metrics.w,p.metrics.w)+2*k.metrics.paddingX;k.metrics.prevChild=q;k.metrics.offsetX_aux=
m;var z=parseInt(-q.metrics.descent+4*q.metrics.h/9);Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+z}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-z}}});Object.defineProperties(x.metrics,{parent:{value:k},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(p.metrics,{parent:{value:k},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});k.metrics.w=
w;k.metrics.ascent=x.metrics.h+z+2*k.metrics.paddingY;k.metrics.descent=p.metrics.h-z+2*k.metrics.paddingY;k.metrics.h=x.metrics.h+p.metrics.h+4*k.metrics.paddingY;m+=2*k.metrics.marginX}else if("radical"===f.nodeType){q=f;q.updateFormula();p=q.children;k=p[0];var A=p[1];q.metrics.marginX=parseInt(1.5+.075*this.style.size);q.metrics.paddingX=parseInt(1.5+.075*this.style.size);q.metrics.paddingY=parseInt(1.5+.05*this.style.size);q.metrics.offsetX_aux=m;Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});p=q.style.size;q.radicalSign={w:p,scaleX:p/722,scaleY:A.metrics.h/1E3};x=parseInt(k.metrics.w-2*q.radicalSign.w/3);Object.defineProperties(q.radicalSign,{parent:{value:q},displaceIndex:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return c.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(k.metrics,{parent:{value:q},displaceIndex:{value:x},fontSize:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:q},
displaceIndex:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});x=k.metrics.w<2*q.radicalSign.w/3?q.radicalSign.w:parseInt(k.metrics.w+q.radicalSign.w/3);q.metrics.w=x+2*q.metrics.paddingX+A.metrics.w;q.metrics.ascent=Math.max(A.metrics.ascent,k.metrics.h+2*p/5)+
q.metrics.paddingY;q.metrics.descent=A.metrics.descent+q.metrics.paddingY;q.metrics.h=q.metrics.ascent+q.metrics.descent;m+=2*q.metrics.marginX}else if("sum"===f.nodeType){k=f;k.updateFormula();p=k.children;x=p[0];w=p[1];var D=p[2];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=m;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=f.style.toString();var G=d(a.ctx.font);q=parseInt(1.2*G.h);p=parseInt(.5+780*q/1E3);k.sigmaSign={w:p,h:q,scale:q/1E3};var F=Math.max(w.metrics.w,x.metrics.w,k.sigmaSign.w);k.sigmaSign.parent=k;Object.defineProperties(k.sigmaSign,{sumWidth:{value:F},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return c.metrics.offsetY+G.descent-(this.h+G.h)/2}}});p=G.descent-w.metrics.descent-(q+G.h)/2-k.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:k},sumWidth:{value:F},newBaselineTo:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
q=x.metrics.ascent+G.descent+(q-G.h)/2+k.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:k},sumWidth:{value:F},newBaselineFrom:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(D.metrics,{parent:{value:k},sumWidth:{value:F},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});k.metrics.w=F+D.metrics.w+3*k.metrics.paddingX;k.metrics.ascent=Math.max(D.metrics.ascent,-p+w.metrics.ascent)+k.metrics.paddingY;k.metrics.descent=Math.max(D.metrics.descent,q+x.metrics.descent)+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;
m+=2*k.metrics.marginX}else if("integral"===f.nodeType){k=f;k.updateFormula();p=k.children;x=p[0];w=p[1];D=p[2];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=m;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=f.style.toString();G=d(a.ctx.font);F=parseInt(1.2*G.h);var J=parseInt(10.5+529*F/1E3);k.sign={w:J,h:F,scale:F/1E3};k.sign.parent=k;Object.defineProperties(k.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+G.descent-(this.h+G.h)/2}}});p=G.descent-(F+G.h)/2-w.metrics.descent+F/3;Object.defineProperties(w.metrics,{parent:{value:k},integralWidth:{value:J},
newBaselineTo:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});q=G.descent+x.metrics.ascent/2;Object.defineProperties(x.metrics,{parent:{value:k},integralWidth:{value:J},newBaselineFrom:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});J=Math.max(parseInt(3*J/5)+w.metrics.w,parseInt(2*J/5+x.metrics.w))+k.metrics.paddingX;Object.defineProperties(D.metrics,{parent:{value:k},whatDisplace:{value:J},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});k.metrics.w=J+D.metrics.w+2*k.metrics.paddingX;k.metrics.ascent=Math.max(D.metrics.ascent,-p+w.metrics.ascent)+k.metrics.paddingY;k.metrics.descent=Math.max(D.metrics.descent,q+x.metrics.descent,F-k.metrics.ascent)+k.metrics.paddingY;k.metrics.h=Math.max(k.metrics.ascent+k.metrics.descent,F);m+=2*k.metrics.marginX}else if("prod"===f.nodeType)k=f,k.updateFormula(),p=k.children,x=p[0],w=p[1],D=p[2],k.metrics.marginX=parseInt(1.5+
.075*this.style.size),k.metrics.paddingX=parseInt(1.5+.075*this.style.size),k.metrics.paddingY=parseInt(1.5+.05*this.style.size),k.metrics.offsetX_aux=m,Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),a.ctx.font=f.style.toString(),G=d(a.ctx.font),q=parseInt(1.2*G.h),p=parseInt(.5+
876*q/1E3),k.piSign={w:p,h:q,scale:q/1E3},F=Math.max(w.metrics.w,x.metrics.w,k.piSign.w),k.piSign.parent=k,Object.defineProperties(k.piSign,{prodWidth:{value:F},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+G.descent-(this.h+G.h)/2}}}),p=G.descent-w.metrics.descent-(q+G.h)/2-k.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:k},prodWidth:{value:F},newBaselineTo:{value:p},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}}),q=x.metrics.ascent+G.descent+(q-G.h)/2+k.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:k},prodWidth:{value:F},newBaselineFrom:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(D.metrics,{parent:{value:k},prodWidth:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return c.metrics.offsetY}}}),
k.metrics.w=F+D.metrics.w+3*k.metrics.paddingX,k.metrics.ascent=Math.max(D.metrics.ascent,-p+w.metrics.ascent)+k.metrics.paddingY,k.metrics.descent=Math.max(D.metrics.descent,q+x.metrics.descent)+k.metrics.paddingY,k.metrics.h=k.metrics.ascent+k.metrics.descent,m+=2*k.metrics.marginX;else if("limit"===f.nodeType){q=f;q.updateFormula();p=q.children;var E=p[0];k=p[1];p=p[2];q.metrics.marginX=parseInt(1.5+.075*this.style.size);q.metrics.paddingX=parseInt(1.5+.075*this.style.size);q.metrics.paddingY=
parseInt(1.5+.05*this.style.size);q.metrics.offsetX_aux=m;Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=f.style.toString();G=d(a.ctx.font);x=parseInt(.5+a.ctx.measureText("l\u00edm").width);w=parseInt(.5+a.ctx.measureText("\u2192").width);D=Math.max(x,E.metrics.w+w+k.metrics.w);
q.limitText={parent:q};Object.defineProperties(q.limitText,{limitWidth:{value:D},limitTextWidth:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});x=G.descent+Math.max(E.metrics.ascent,k.metrics.ascent,2*G.ascent/3)+q.metrics.paddingY;q.limitArrow={parent:q};Object.defineProperties(q.limitArrow,{newBaseline:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+E.metrics.w}},y:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(E.metrics,{parent:{value:q},newBaseline:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(k.metrics,{parent:{value:q},arrowWidth:{value:w},newBaseline:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+E.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(p.metrics,{parent:{value:q},limitWidth:{value:D},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
q.metrics.w=D+p.metrics.w+3*q.metrics.paddingX;q.metrics.ascent=Math.max(p.metrics.ascent,G.ascent)+q.metrics.paddingY;w=0;p=Math.max(E.metrics.descent,k.metrics.descent,p.metrics.descent);if(0!=E.metrics.h||0!=k.metrics.h)w=x,p=Math.max(E.metrics.descent,k.metrics.descent,p-w);q.metrics.descent=w+p+q.metrics.paddingY;q.metrics.h=q.metrics.ascent+q.metrics.descent;m+=2*q.metrics.marginX}else if("matrix"===f.nodeType){x=f;x.updateFormula();p=x.children;w=x.rows;D=x.columns;x.metrics.marginX=parseInt(1.5+
.075*this.style.size);x.metrics.paddingX=parseInt(5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=m;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=f.style.toString();G=d(a.ctx.font);F=[];J=[];q=0;for(var B=w*D;q<B;q++){var I=
parseInt(q/D);var L=q%D;F[I]=Math.max(F[I]||0,p[q].metrics.h);J[L]=Math.max(J[L]||0,p[q].metrics.w)}var M=(1+D)*x.metrics.paddingX;for(q=0;q<D;q++)M+=J[q];var O=(1+w)*x.metrics.paddingY;for(q=0;q<w;q++)O+=F[q];k=G.descent-G.h/2;q=0;for(B=w*D;q<B;q++)I=parseInt(q/D),L=q%D,p[q].metrics.offsetX_aux=h(J,L)+(J[L]-p[q].metrics.w)/2+L*x.metrics.paddingX,p[q].metrics.offsetY_aux=h(F,I)+(F[I]-p[q].metrics.h)/2+(1+I)*x.metrics.paddingY,Object.defineProperties(p[q].metrics,{parent:{value:x},matrixH:{value:O},
dispY:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.w=M;x.metrics.ascent=O/2-k;x.metrics.descent=O/2+k;x.metrics.h=x.metrics.ascent+x.metrics.descent;m+=2*x.metrics.marginX}else if("defparts"===f.nodeType){x=f;x.updateFormula();p=f.children;
w=f.parts;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=m;Object.defineProperties(x.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=
f.style.toString();G=d(a.ctx.font);D=0;F=x.metrics.paddingY;k=G.descent-G.h/2;for(q=0;q<w;q++)p[q].metrics.offsetY_aux=F,D=Math.max(D,p[q].metrics.w),F+=p[q].metrics.h+x.metrics.paddingY,Object.defineProperties(p[q].metrics,{parent:{value:x},dispY:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=F;x.metrics.w=D+4*x.metrics.paddingX;x.metrics.ascent=F/2-k;x.metrics.descent=F/2+k;x.metrics.h=x.metrics.ascent+x.metrics.descent;m+=2*x.metrics.marginX}else if("numerator"===f.nodeType||"denominator"===f.nodeType||"index"===f.nodeType||"radicand"===f.nodeType||"from"===f.nodeType||"to"===f.nodeType||"what"===f.nodeType||"element"===f.nodeType)f.updateFormula(),f.metrics.paddingX=parseInt(1.5+.075*this.style.size),f.metrics.paddingY=
parseInt(1.5+.05*this.style.size),f.metrics.ascent+=f.metrics.paddingY,f.metrics.descent+=f.metrics.paddingY,f.metrics.h=f.metrics.ascent+f.metrics.descent,1==f.children.length&&"text"==f.children[0].nodeType&&""==f.children[0].value?(f.metrics.w=0,a.in_editor||(f.metrics.ascent=f.metrics.descent=f.metrics.h=0)):f.metrics.w+=2*f.metrics.paddingX;q=f;this.metrics.ascent=Math.max(this.metrics.ascent,f.metrics.tmp_ascent||f.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,f.metrics.descent);
this.metrics.w+=f.metrics.w+2*f.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;m+=f.metrics.w}};g.prototype.justifyAux=function(a){for(var b=0,c=0,e=0,d=this.children.length;e<d-1;e++)"space"===this.children[e].nodeType?b++:c+=this.children[e].metrics.w;this.updateLine((a-c)/b)};g.prototype.drawTextBlock=function(a){a.fillStyle=r;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.shadowColor="transparent"};g.prototype.drawTextLineBlock=function(a){for(var b=0,e=this.children.length;b<e;b++)c=!1,this.children[b].draw(a)};g.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,e=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(c);a.beginPath();this.style.overline&&(a.rect(b,e-this.metrics.ascent+
parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,e+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var d=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,e);a.strokeStyle=
d}a.fillText(this.value,b,e)}};g.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};g.prototype.drawSpace=function(a){};g.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,e=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(c);a.beginPath();this.style.overline&&(a.rect(b,e-this.metrics.ascent+parseInt(1+this.style.size/
25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,e+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,e);this.drawBorder(a,"blue")};g.prototype.drawHyperlink=function(a){var b=this.metrics.x,e=this.metrics.y;this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,
a.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=e-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,e-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(c);a.beginPath();a.rect(b,e+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,e)};g.prototype.drawFormula=function(a){for(var b=0,e=this.children.length;b<e;b++)c=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};g.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};g.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?
parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.lineWidth/=Math.max(this.radicalSign.scaleX,this.radicalSign.scaleY));a.save();a.font="1000px DJS_symbol";a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);this.style.border&&a.strokeText("\u221a",-70,800);a.fillText("\u221a",-70,800);a.restore();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-
.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSum=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=1.9*this.sigmaSign.w+"px DJS_symbol";this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin=
"round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h));a.fillText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h);for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawIntegral=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=1.5*this.sign.w+"px DJS_symbol";this.style.border&&
(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4));a.fillText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4);for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawProd=function(a){a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=1.5*this.piSign.w+"px DJS_symbol";this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h));a.fillText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h);for(var b=0,c=this.children.length;b<
c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor());
a.font=this.style.toString();this.style.border&&a.strokeText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&(this.style.border&&a.strokeText("\u2192",this.limitArrow.x,this.limitArrow.y),a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y));this.drawBorder(a,"blue")};g.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=
c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-
b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-
b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+
b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+
this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y-
b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+
b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+
this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};g.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=
null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-
5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);
a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};
g.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};g.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=
this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};g.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};var m={sansserif:{ascent:1854,descent:-434,lineGap:67,
capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=String.fromCharCode,d,c,r,l,b,g,m,e,n,f,v,q=function(){};q.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];c="";l=r=0;g=a.charAt(0);m=!1;for(e="text";r<a.length;)b=g,g=a.charAt(r+1),m?"\\"===g||"{"===g||"}"===
g||" "===g||";"===g?(m=!1,c+=b," "===g?(r++,g=a.charAt(r+1),v=!0):v=!1,(n=c.match(/^'([0-9a-f]{2})/))?(f="","text"===e&&(f=d.pop().value),c=f+=h(parseInt(n[1],16))+c.substring(3)):(n=c.match(/^u[0-9]+/))?(f="","text"===e&&(f=d.pop().value),c=f+=h(n[0].substring(1))):("{"===c||"}"===c||"\\"==b?(d.push({type:"text",value:c+(v?" ":"")}),e="text"):(d.push({type:"controlWord",value:c}),e="controlWord"),c="")):"{"==b||"}"==b||"\\"==b?(m=!1,d.push({type:"text",value:b}),e="text"):c+=b:"\\"===b?(m=!0,""!==
c&&(d.push({type:"text",value:c}),e="text",c="")):"{"===b?(l++,""!==c&&(d.push({type:"text",value:c}),c=""),d.push({type:"openBlock",value:l}),e="openBlock"):"}"===b?(""!==c&&(d.push({type:"text",value:c}),c=""),d.push({type:"closeBlock",value:l}),e="closeBlock",l--):c+=b,r++;""!==c&&d.push({type:"text",value:c});return d};a.RTFTokenizer=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,d,c,r,l,b,g,m,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J,E,B,I,L,M,O,H,N=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};N.prototype.parse=function(C){d=this.tokenizer.tokenize(C);c={};l=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(r=d[0].value;"closeBlock"!==d[l].type&&d[l].value!==r;)c[d[l].value]=d[l+2].value.substring(0,d[l+2].value.length-1),l+=3;l++}b={};g=0;if("openBlock"===d[l].type&&"colortbl"===d[l+1].value){r=
d[l++].value;for(l++;"closeBlock"!==d[l].type&&d[l].value!==r;)m=parseInt(d[l++].value.substring(3)).toString(16),e=parseInt(d[l++].value.substring(5)).toString(16),n=parseInt(d[l++].value.substring(4)).toString(16),";"===d[l].value&&l++,b[g++]="#"+(2>m.length?"0"+m:m)+(2>e.length?"0"+e:e)+(2>n.length?"0"+n:n);l++}y=u=q=null;M=L=I=D=A=z=w=x=k=p=!1;G=[new a.TextStyle];F=G[0];E=J=-1;B=[];f=O=new a.TextNode("","textBlock",F,this.evaluator);v=new a.TextNode("","textLineBlock",F,this.evaluator);f.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;C=l;for(var N=d.length;C<N;C++){if("controlWord"==d[C].type)if(c[d[C].value])F.set({family:c[d[C].value]});else if(d[C].value.match(/^fs(\d+)/))F.set({size:parseInt(d[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==d[C].value)F.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==d[C].value)F.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==d[C].value)F.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==d[C].value)F.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==d[C].value)F.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==d[C].value)F.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==d[C].value)F.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==d[C].value)F.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(d[C].value.match(/^cf(\d+)/))F.set({color:b[parseInt(d[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=F.color);else if("par"==d[C].value){f=new a.TextNode("","textLineBlock",F.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(f);v=f}else if("mjaformula"==d[C].value)O.hasFormula=!0,E=J,p=!0,f=new a.TextNode("","formula",F.clone(),this.evaluator),v.addChild(f),v=f,B[B.length-1]=f;else if("fraction"==d[C].value||"radicand"==d[C].value||"radical"==d[C].value||"what"==d[C].value||"sum"==d[C].value||"integral"==
d[C].value||"limit"==d[C].value){var K=B[B.length-2].style.clone();f=new a.TextNode("",d[C].value,K,this.evaluator);B[B.length-2].addChild(f);B[B.length-1]=f}else"index"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(parseInt(K.size-.5*K.size),8),f=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-2].addChild(f),B[B.length-1]=f):"to"==d[C].value||"from"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(parseInt(K.size-.2*K.size),8),f=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-
2].addChild(f),B[B.length-1]=f):"num"==d[C].value||"den"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(Math.round(K.size-.1*K.size),8),"num"==d[C].value?f=new a.TextNode("","numerator",K,this.evaluator):"den"==d[C].value&&(f=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(f),B[B.length-1]=f):"subix"==d[C].value||"supix"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(Math.floor(K.size-.33*K.size),8),"subix"==d[C].value?f=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==d[C].value&&(f=new a.TextNode("","superIndex",K,this.evaluator)),f.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(f),B[B.length-1]=f):"defparts"==d[C].value||"matrix"==d[C].value||"element"==d[C].value?(K=B[B.length-2].style.clone(),f=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-2].addChild(f),B[B.length-1]=f,"defparts"==d[C].value?y=f:"matrix"==d[C].value&&(u=f,u.matrix_type=0)):"parts"==d[C].value?D=!0:"type"==d[C].value?w=!0:"rows"==d[C].value?z=!0:"columns"==
d[C].value?A=!0:"expr"==d[C].value?(O.stableWidth=!1,k=!0):"decimals"==d[C].value?x=!0:"fixed1"==d[C].value?q.fixed=!0:"fixed0"==d[C].value?q.fixed=!1:"component"!=d[C].value&&("NumCtrl"==d[C].value?I=!0:"Space"==d[C].value?L=!0:"hyperlink"==d[C].value&&(M=!0));if("text"==d[C].type)if(D)y.parts=parseInt(d[C].value),D=!1;else if(w)u.matrix_type=parseInt(d[C].value),w=!1;else if(z)u.rows=parseInt(d[C].value),z=!1;else if(A)u.columns=parseInt(d[C].value),A=!1;else if(x)q.decimals=this.evaluator.parser.parse(d[C].value+
""),x=!1;else if(M){H=d[C].value.split("|")[0];K=F.clone();f=new a.TextNode(H,"hyperlink",K,this.evaluator);f.URL=d[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(f);M=!1}else if(I)f=new a.TextNode(d[C].value,"componentNumCtrl",F.clone(),this.evaluator),v.addChild(f),I=!1;else if(L)f=new a.TextNode(d[C].value,"componentSpace",F.clone(),this.evaluator),v.addChild(f),L=!1;else if(k)K=B[B.length-2].style.clone(),H=this.evaluator.parser.parse(d[C].value),
f=new a.TextNode(H,"dynamicText",K,this.evaluator),B[B.length-2].addChild(f),q=B[B.length-1]=f,k=!1;else if(k||p)!k&&p&&(H=d[C].value,f=new a.TextNode(H,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(f));else{H=d[C].value;f=new a.TextNode(H,"text",F.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(f)}else if("openBlock"==d[C].type)J=d[C].value,F=F.clone(),G.push(F),B.push(null);else if("closeBlock"==
d[C].type)d[C].value==E&&(E=-1,p=!1,v=v.parent),G.pop(),F=G[G.length-1],B.pop();else if("("==d[C].type||")"==d[C].type)K=B[B.length-1].style.clone(),K.italic="",f=new a.TextNode(d[C].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(f);else if("+"==d[C].type||"-"==d[C].type||"*"==d[C].type||"="==d[C].type)f=new a.TextNode(d[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(f)}return O.normalize()};a.RTFParser=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g,m,e,n,f,v=function(b,e){this.parent=b;d=this.evaluator=this.parent.evaluator;c=d.parser;this.id="";this.type="2D";this.xExpr=c.parse("0");this.yExpr=c.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=c.parse("1");this.fixed=!1;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=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!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.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=
b.displaceRegionWest||0;Object.assign(this,e);this.initSpace()};v.prototype.initSpace=function(){var a=this;h=a.parent;d=a.evaluator;r=a.id;a.resizable||(a.displaceRegionNorth=h.displaceRegionNorth||0,a.displaceRegionSouth=h.displaceRegionSouth||0,a.displaceRegionEast=h.displaceRegionEast||0,a.displaceRegionWest=h.displaceRegionWest||0,m=parseInt(h.container.width),g=parseInt(h.container.height),void 0!=a.wExpr&&(a.w=parseInt(m-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(g-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=d.parser.parse((parseInt(m-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=d.parser.parse((parseInt(g-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=d.eval(a.xExpr)+a.displaceRegionWest,a.y=d.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&
(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(l=g-a.y,a.h>l&&(a.h=l)):(l=a.h+a.y,a.h=l>=g?g:l),0<=a.x?(b=m-a.x,a.w>b&&(a.w=b)):(b=a.w+a.x,a.w=b>=m?m:b));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=h.getImage(a.imageSrc));a.OxExpr&&(n=a.OxExpr,"%"===n[n.length-1]?a.Ox=a.w*parseFloat(n)/100:(e=parseFloat(n),e!=n&&(e=0),a.Ox=e));a.OyExpr&&(f=a.OyExpr,"%"===f[f.length-1]?a.Oy=a.h*parseFloat(f)/100:(e=parseFloat(f),e!=f&&(e=0),a.Oy=e));d.setVariable(r+"._w",
a.w);d.setVariable(r+"._h",a.h);d.setVariable(r+".escala",d.getVariable(r+".escala")||a.scale);d.setVariable(r+".Ox",d.getVariable(r+".Ox")||a.Ox);d.setVariable(r+".Oy",d.getVariable(r+".Oy")||a.Oy);d.setVariable(r+".mouse_x",0);d.setVariable(r+".mouse_y",0);d.setVariable(r+".mouse_pressed",0);d.setVariable(r+".mouse_clicked",0);d.setVariable(r+".clic_izquierdo",0);a.w_2=a.w/2;a.h_2=a.h/2;d.setFunction(r+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};
v.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};v.prototype.getRelativeY=
function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d=function(c){h=this;h.parent=c;h.width=228;h.vSpace=25;h.container=a.newHTML("div",{style:"box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:"+(h.width+27)+"px;height:460px;"});h.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(h.width+27)+"px;height:"+h.vSpace+
"px;line-height:"+h.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});h.movable.innerHTML="Descartes";h.container.appendChild(h.movable);h.ctrs=[]};d.prototype.init=function(){function c(b){h.newPos=a.getCursorPosition(b,document.body);h.container.style.left=h.initialPosition.x+(h.newPos.x-h.oldPos.x)*a.cssScale+"px";h.container.style.top=h.initialPosition.y+(h.newPos.y-h.oldPos.y)*a.cssScale+"px"}function d(a){a.preventDefault();document.body.removeEventListener("mousemove",
c);document.body.removeEventListener("mouseup",d)}h=this;document.body.appendChild(this.container);for(var l=h.parent.evaluator.parser,b=0,g=h.ctrs.length;b<g;b++)h.ctrs[b].expresion=l.parse("(0,"+(h.vSpace+23+35*b)+","+h.width+",35)"),h.ctrs[b].update();h.numCtr=g;b=new a.Button(h.parent,{region:"external",name:"english"==h.language?"about":"cr\u00e9ditos",font_size:l.parse("15"),expresion:l.parse("(0,"+h.vSpace+","+h.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(h.parent,
{region:"external",name:"config",font_size:l.parse("15"),action:"config",expresion:l.parse("("+h.width/2+","+h.vSpace+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"init":"inicio",font_size:l.parse("15"),action:"init",expresion:l.parse("(0,"+(h.vSpace+23+35*g)+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"clear":"limpiar",font_size:l.parse("15"),action:"clear",expresion:l.parse("("+h.width/
2+","+(h.vSpace+23+35*g)+","+h.width/2+",25)")})).update();l=new a.Button(h.parent,{region:"external",name:"english"==h.language?"close":"cerrar",font_size:l.parse("15"),expresion:l.parse("("+h.width/4+","+(h.vSpace+46+35*g)+","+h.width/2+",25)")});l.update();l.btn.addEventListener("click",function(a){h.hide()});h.setPositionAndSize();h.movable.addEventListener("mousedown",function(b){b.preventDefault();h.oldPos=a.getCursorPosition(b,document.body);h.initialPosition={x:h.container.offsetLeft,y:h.container.offsetTop};
document.body.addEventListener("mousemove",c);document.body.addEventListener("mouseup",d)});h.hide()};d.prototype.addCtr=function(a){this.ctrs.push(a)};d.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};d.prototype.hide=function(){this.container.style.display="none"};d.prototype.setPositionAndSize=function(){h=this;var a=h.vSpace+46+35*h.numCtr+25+10;h.container.style.left=Math.max(parseInt(window.innerWidth-h.width)/2,0)+"px";h.container.style.top="5px";h.container.style.height=
window.innerHeight<h.vSpace+75?h.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.round,c=2*Math.PI,r=a.convertFont("Serif,BOLD+ITALIC,16"),l=a.convertFont("Monospaced,PLAIN,12"),b,g,m,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J,E,B,I,L,M,O,H,N,C,Q,K,R,P=function(c,e){b=e=a.Space.call(this,c,e)||this;b.ratio=c.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio+"px",height:b.h*b.ratio+"px"});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio+"px",
height:b.h*b.ratio+"px"});b.canvas.style=b.backCanvas.style=(0<b.border_width?"border:"+b.border_width+"px solid "+b.border_color.getColor()+";":"")+(b.border_radius?"border-radius:"+b.border_radius+"px;":"");b.canvas.style.zIndex=b.zIndex;b.canvas.style.width=b.backCanvas.style.width=b.w+"px";b.canvas.style.height=b.backCanvas.style.height=b.h+"px";b.ctx=b.canvas.getContext("2d");b.backCtx=b.backCanvas.getContext("2d");b.ctx.imageSmoothingEnabled=b.backCtx.imageSmoothingEnabled=!1;b.canvas.ratio=
b.ratio;b.backCanvas.ratio=b.ratio;b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.numCtrContainer=a.newHTML("div",{id:b.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.container=a.newHTML("div",{id:b.id,class:"DescartesSpace2DContainer",style:"z-index:"+b.zIndex+";"});b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);
b.container.appendChild(b.numCtrContainer);c.container.insertBefore(b.container,c.loader);var d=b.id+".image";b.parent.images[d]=b.canvas;b.parent.images[d].ready=1;b.parent.images[d].complete=b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);d=b.id+".back";b.parent.images[d]=b.backCanvas;b.parent.images[d].ready=1;b.parent.images[d].complete=b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);d=b.id+".";b.OxStr=d+"Ox";b.OyStr=d+"Oy";b.scaleStr=d+"escala";b.wStr=d+"_w";b.hStr=d+"_h";
b.mxStr=d+"mouse_x";b.myStr=d+"mouse_y";b.mpressedStr=d+"mouse_pressed";b.mclickedStr=d+"mouse_clicked";b.mclickIzqStr=d+"clic_izquierdo";b.click=0;b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};c.evaluator.setVariable(b.id+"._refresh_back_",1);return e};$jscomp.inherits(P,a.Space);P.prototype.init=function(){b=this;this.initSpace();b.canvas&&(b.old_w=
b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px")};P.prototype.update=function(a){b=this;g=b.evaluator;m=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),Q=b.evaluator.eval(b.hModExpr),b.old_w!=C||b.old_h!=Q)b.w=C,b.h=Q,b.w_2=b.w/2,b.h_2=b.h/2,g.setVariable(b.wStr,b.w),g.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,
b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",a=!0}else g.setVariable(b.wStr,b.w),g.setVariable(b.hStr,b.h);b.drawIfValue=0<g.eval(b.drawif);if(b.drawIfValue){n=b.x!==g.eval(b.xExpr)+b.displaceRegionWest;f=b.y!==g.eval(b.yExpr)+m.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||n||f||b.drawBefore!==b.drawIfValue||b.Ox!==g.getVariable(b.OxStr)||
b.Oy!==g.getVariable(b.OyStr)||b.scale!==g.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=n?g.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=f?g.eval(b.yExpr)+m.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=g.getVariable(b.OxStr);b.Oy=g.getVariable(b.OyStr);b.scale=g.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));g.setVariable(b.scaleStr,b.scale);if(n||f)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display=
"block";b.drawTrace=!b.spaceChange&&(!b.fixed&&!b.click||b.fixed);b.spaceChange&&(b.backCtx.setTransform(b.ratio,0,0,b.ratio,0,0),b.drawBackground());b.ctx.setTransform(b.ratio,0,0,b.ratio,0,0);b.draw()}else b.container.style.display="none"};P.prototype.drawBackground=function(){b=this;g=b.evaluator;e=b.backCtx;e.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);e.fillStyle=b.backColor=b.background.getColor();e.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&
b.image.complete&&("topleft"===b.bg_display?e.drawImage(b.image,0,0):"stretch"===b.bg_display?e.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(e.fillStyle=e.createPattern(b.image,"repeat"),e.fillRect(0,0,b.w,b.h)):"imgcenter"===b.bg_display&&e.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));q=b.scale;u=0;for(y=0>b.w+b.h?0:b.w+b.h;q>y;)q/=10,u++;for(;q<y/10;)q*=10;e.lineWidth=1;""!==b.net&&(e.strokeStyle=b.net.getColor(),b.drawMarks(e,q/10,-1));""!==b.net10&&(e.strokeStyle=
b.net10.getColor(),b.drawMarks(e,q,-1));if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");e.strokeStyle=b.axes.getColor();e.beginPath();"no"!=b.x_axis&&""!==b.x_axis&&(e.moveTo(0,h(b.h/2+b.Oy)+.5),e.lineTo(b.w,h(b.h/2+b.Oy)+.5));"no"!=b.y_axis&&""!==b.y_axis&&(e.moveTo(h(b.w/2+b.Ox)+.5,0),e.lineTo(h(b.w/2+b.Ox)+.5,b.h));e.lineWidth=1.2;e.stroke();e.lineWidth=1;b.drawMarks(e,q,4,a);b.drawMarks(e,q/2,2,a);b.drawMarks(e,q/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)e.fillStyle=""!==
b.axes?b.axes.getColor():"#000",e.font=r,e.textAlign="right",e.textBaseline="alphabetic","no"!=b.x_axis&&e.fillText(b.x_axis,h(b.w)-2,h(b.h/2+b.Oy)+12),"no"!=b.y_axis&&e.fillText(b.y_axis,h(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(e.fillStyle=b.axes.getColor(),e.font=r,e.textAlign="start",e.textBaseline="bottom",q>(b.w+b.h)/2?b.drawNumbers(e,q/5,q<=b.scale?u+1:u):q>(b.w+b.h)/4?b.drawNumbers(e,q/2,q<=b.scale?u+1:u):b.drawNumbers(e,q,u));a=0;for(var c=this.backGraphics.length;a<c;a++)this.backGraphics[a].draw()};
P.prototype.draw=function(){b=this;e=b.ctx;g.getVariable(b.id+"._refresh_back_")&&e.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,d=b.graphics.length;a<d;a++)v=b.graphics[a],""!==v.trace&&b.drawTrace&&v.drawTrace(),v.draw();a=0;for(d=b.graphicsCtr.length;a<d;a++)b.graphicsCtr[a].draw();""!=b.text&&b.click&&"L"===b.whichBtn&&(e.save(),e.strokeStyle=e.fillStyle=b.text.getColor(),e.lineWidth=1,e.font=l,e.textAlign="center",e.textBaseline="alphabetic",E=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(parseInt(b.scale).toString().length+
1),B=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(parseInt(b.scale).toString().length+1),I="("+E+","+B+")",L=h(e.measureText(I).width/2),M=b.getAbsoluteX(b.mouse_x),O=b.getAbsoluteY(b.mouse_y),H=h(M),N=h(O-10),H+L>b.w?H=b.w-L:0>H-L&&(H=L),N+1>b.h?N=b.h:0>N-14&&(N=15),e.fillText(I,H,N),e.beginPath(),e.arc(M,O,2.5,0,c,!0),e.stroke(),e.restore())};P.prototype.drawMarks=function(a,b,c,e){p=this.w;k=this.h;F=D=0;G=p;J=k;z=h(p/2+this.Ox);A=h(k/2+this.Oy);0<=c&&(D=z-c,G=z+c,F=A-c,J=A+c);a.beginPath();
if(!e||e&&!e.match("x"))for(c=-d(z/b);(x=z+d(c*b))<p;c++)a.moveTo(x+.5,F+.5),a.lineTo(x+.5,J+.5);if(!e||e&&!e.match("y"))for(c=-d(A/b);(w=A+d(c*b))<k;c++)a.moveTo(D+.5,w+.5),a.lineTo(G+.5,w+.5);a.stroke()};P.prototype.drawNumbers=function(a,b,c){p=this.w;k=this.h;z=h(p/2+this.Ox);A=h(k/2+this.Oy);for(c=-d(z/b);(x=z+d(c*b))<p;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),x+1,A-2);for(c=-d(A/b);(w=A+d(c*b))<k;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),
z+5,w+5)};P.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.click=0,f.evaluator.setVariable(f.mpressedStr,0),f.evaluator.setVariable(f.mclickedStr,1),f.evaluator.setVariable(f.mclickIzqStr,1),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),f.parent.update()}function c(b){document.activeElement.blur();
window.focus();b.stopPropagation();b.preventDefault();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);"R"===f.whichBtn&&(window.removeEventListener("mousemove",d),f.posZoom==f.posZoomNew&&a.showConfig&&(f.parent.externalSpace.show(),f.posZoom=!1,f.posZoomNew=!0));window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c);f.parent.deactivateControls();f.parent.update()}function e(b){f.posAnte=
a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.evaluator.setVariable(f.mclickedStr,0);f.evaluator.setVariable(f.mclickIzqStr,0);f.parent.update()}function d(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function g(b){b.preventDefault();
b.stopPropagation();f.fixed||(f.posNext=a.getCursorPosition(b,f.container),K=f.posAnte.x-f.posNext.x,R=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-K),f.evaluator.setVariable(f.OyStr,f.Oy-R));e(b)}var f=this;f.posZoom=f.posZoomNew=null;f.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",e);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+
".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.parent.clearClick(),f.click=1,f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),f.parent.deactivateControls(),e(a),window.addEventListener("touchmove",g),window.addEventListener("touchend",b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",e);this.canvas.addEventListener("mousedown",function(b){window.focus();
document.activeElement.blur();b.stopPropagation();b.preventDefault();f.parent.clearClick();f.click=1;f.parent.deactivateControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,window.addEventListener("mousemove",d))):"L"===f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),e(b),window.addEventListener("mousemove",
g),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c)})};a.Space2D=P;return a}(descartesJS||{});
descartesJS=function(a){var h,d,c;function r(b,c){H=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));N=a.add3D(b,a.scalarProduct3D(H,-2));C=a.norm3D(N);return 0!==C?a.scalarProduct3D(N,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var l=Math.floor,b=Math.max,g=Math.cos,m=Math.sin,e,n,f,v,q,u,y,p,k,x,w,z,A,D,G,F,J=[],E,B,I,L,M,O,H,N,C,Q,K,R=function(b,c){f=c=a.Space.call(this,b,c)||this;f.ratio=b.ratio;f.backCanvas=a.newHTML("canvas",{id:f.id+"_background",width:f.w*f.ratio+"px",height:f.h*
f.ratio+"px"});f.canvas=a.newHTML("canvas",{id:f.id+"_canvas",width:f.w*f.ratio+"px",height:f.h*f.ratio+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+f.zIndex+";"});f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.canvas.ratio=f.ratio;f.canvas.style=f.backCanvas.style=(0<f.border_width?"border:"+f.border_width+"px solid "+f.border_color.getColor()+";":"")+(f.border_radius?"border-radius:"+f.border_radius+"px;":"");var e=f.id+".image";f.parent.images[e]=f.canvas;f.parent.images[e].ready=
1;f.parent.images[e].complete=!0;f.parent.images[e].canvas=!0;f.evaluator.setVariable(e,e);f.graphicControlContainer=a.newHTML("div",{id:f.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+f.zIndex+";"});f.numCtrContainer=a.newHTML("div",{id:f.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+f.zIndex+";"});f.container=a.newHTML("div",{id:f.id,class:"DescartesSpace3DContainer",style:"z-index:"+f.zIndex+";"});f.container.appendChild(f.backCanvas);f.container.appendChild(f.canvas);
f.container.appendChild(f.graphicControlContainer);f.container.appendChild(f.numCtrContainer);b.container.insertBefore(f.container,b.loader);f.eye={x:0,y:0,z:0};f.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];e=0;for(var d=f.lights.length;e<d;e++)f.lights[e]=a.normalize3D(f.lights[e]);f.light3={x:0,y:0,z:0};f.intensity=[.4,.5,.3,0];f.userIntensity=0;f.dim=1;f.tmpIntensity=[];f.OxStr=f.id+".Ox";f.OyStr=f.id+".Oy";f.scaleStr=f.id+".escala";f.wStr=f.id+"._w";f.hStr=f.id+
"._h";f.obsStr=f.id+".observador";f.ojoXStr=f.id+".Ojo.x";f.ojoYStr=f.id+".Ojo.y";f.ojoZStr=f.id+".Ojo.z";f.rotZStr=f.id+".rot.z";f.rotYStr=f.id+".rot.y";f.userIDimStr=f.id+".userIlum.dim";f.userIIStr=f.id+".userIlum.I";f.userIxStr=f.id+".userIlum.x";f.userIyStr=f.id+".userIlum.y";f.userIzStr=f.id+".userIlum.z";f.evaluator.setVariable(f.rotZStr,0);f.evaluator.setVariable(f.rotYStr,0);f.evaluator.setVariable(f.userIDimStr,f.dim);f.evaluator.setVariable(f.userIIStr,f.userIntensity);f.evaluator.setVariable(f.userIxStr,
0);f.evaluator.setVariable(f.userIyStr,0);f.evaluator.setVariable(f.userIzStr,0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},f);f.evaluator.setFunction(f.id+"._X3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(f);return K.projVert[0].x});f.evaluator.setFunction(f.id+"._Y3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(f);return K.projVert[0].y});f.resizable&&(f.wModExpr=b.evaluator.parser.parse(f.wModExpr),
f.hModExpr=b.evaluator.parser.parse(f.hModExpr));f.addEvents();return c};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){f=this;f.initSpace();f.canvas&&(f.old_w=f.w,f.old_h=f.h,f.canvas.width=f.backCanvas.width=f.w*f.ratio,f.canvas.height=f.backCanvas.height=f.h*f.ratio,f.canvas.style.width=f.backCanvas.style.width=f.w+"px",f.canvas.style.height=f.backCanvas.style.height=f.h+"px");f.w_2=f.w/2;f.h_2=f.h/2;f.w_plus_h=f.w+f.h;f.oldMouse={x:0,y:0};f.S={x:f.h/1080*-20.6*(40/f.scale),y:0,z:0};
f.Ojo={x:3*f.w_2,y:0,z:0};f.evaluator.setVariable(f.ojoXStr,f.Ojo.x);f.evaluator.setVariable(f.ojoYStr,f.Ojo.y);f.evaluator.setVariable(f.ojoZStr,f.Ojo.z)};R.prototype.update=function(a){f=this;e=f.evaluator;n=f.parent;e.setVariable(f.wStr,f.w);e.setVariable(f.hStr,f.h);f.drawIfValue=0<e.eval(f.drawif);if(f.drawIfValue){f.resizable&&(wModExpr=f.evaluator.eval(f.wModExpr),hModExpr=f.evaluator.eval(f.hModExpr),f.old_w!=wModExpr||f.old_h!=hModExpr)&&(f.w=wModExpr,f.h=hModExpr,f.w_2=f.w/2,f.h_2=f.h/2,
e.setVariable(f.wStr,f.w),e.setVariable(f.hStr,f.h),f.old_w=f.w,f.old_h=f.h,f.canvas.width=f.backCanvas.width=f.w*f.ratio,f.canvas.height=f.backCanvas.height=f.h*f.ratio,f.canvas.style.width=f.backCanvas.style.width=f.w+"px",f.canvas.style.height=f.backCanvas.style.height=f.h+"px",a=!0,f.S={x:f.h/1080*-20.6*(40/f.scale),y:0,z:0},f.Ojo={x:3*f.w_2,y:0,z:0},f.evaluator.setVariable(f.ojoXStr,f.Ojo.x),f.evaluator.setVariable(f.ojoYStr,f.Ojo.y),f.evaluator.setVariable(f.ojoZStr,f.Ojo.z));u=f.x!==e.eval(f.xExpr)+
f.displaceRegionWest;y=f.y!==e.eval(f.yExpr)+n.plecaHeight+f.displaceRegionNorth;f.spaceChange=a||u||y||f.drawBefore!==f.drawIfValue||f.Ox!==e.getVariable(f.OxStr)||f.Oy!==e.getVariable(f.OyStr)||f.Ojo.x!==e.getVariable(f.ojoXStr)||f.Ojo.y!==e.getVariable(f.ojoYStr)||f.Ojo.z!==e.getVariable(f.ojoZStr)||f.scale!==e.getVariable(f.scaleStr);f.x=u?e.eval(f.xExpr)+f.displaceRegionWest:f.x;f.y=y?e.eval(f.yExpr)+n.plecaHeight+f.displaceRegionNorth:f.y;f.Ojo.x=e.getVariable(f.ojoXStr);f.Ojo.y=e.getVariable(f.ojoYStr);
f.Ojo.z=e.getVariable(f.ojoZStr);f.Ox=e.getVariable(f.OxStr);f.Oy=e.getVariable(f.OyStr);f.scale=e.getVariable(f.scaleStr);f.drawBefore=f.drawIfValue;if(a||void 0==f.observer){a=0;for(var c=f.parent.controls.length;a<c;a++)f.parent.controls[a].id===f.obsStr&&(Q=!0);f.observer=Q?e.getVariable(f.obsStr)||2.5*f.w_plus_h:2.5*f.w_plus_h;f.observer=b(f.observer,.25*f.w_plus_h);e.setVariable(f.obsStr,f.observer)}1E-6>f.scale?(f.scale=1E-6,e.setVariable(f.scaleStr,1E-6)):1E6<f.scale&&(f.scale=1E6,e.setVariable(f.scaleStr,
1E6));if(u||y)f.container.style.left=f.x+"px",f.container.style.top=f.y+"px";f.container.style.display="block";f.dim=e.getVariable(f.userIDimStr);f.userIntensity=e.getVariable(f.userIIStr);f.light3={x:parseInt(e.getVariable(f.userIxStr)),y:parseInt(e.getVariable(f.userIyStr)),z:parseInt(e.getVariable(f.userIzStr))};f.updateCamera();f.ctx.setTransform(f.ratio,0,0,f.ratio,0,0);f.draw()}else f.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};
R.prototype.rotateVertex=function(b){x=a.degToRad(f.evaluator.getVariable(f.rotZStr));w=g(x);z=m(x);h=b.x*w-b.y*z;d=b.x*z+b.y*w;c=b.z;x=a.degToRad(f.evaluator.getVariable(f.rotYStr));w=g(x);z=m(x);return{x:c*z+h*w,y:d,z:c*w-h*z}};R.prototype.project=function(a){f=this;this.evaluator.getVariable("URL.oldProj");var b=f.eye.x/(a.x-f.eye.x);return{x:f.getAbsoluteX(b*(f.eye.y-a.y)),y:f.getAbsoluteY(b*(f.eye.z-a.z)),z:f.eye.x-a.x}};R.prototype.computeColor=function(b,c,e){"object"!=typeof b&&(b.match("rgba")?
b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1))));L=a.subtract3D(this.eye,c.average);M=a.norm3D(L);O=a.scalarProduct3D(L,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);F=a.norm3D(this.lights[3]);for(var d=0,f=this.intensity.length-1;d<f;d++)J[d]=this.intensity[d]*this.dim;J[3]=this.userIntensity*this.userIntensity/F||0;E=e?this.dim/2:this.dim/4;B=0;I=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);d=0;for(f=this.lights.length;d<f;d++)e?(B=Math.max(0,a.dotProduct3D(r(this.lights[d],
I),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[d],I)),E+=J[d]*B;E=Math.min(E,1);A=l(b.r*E);D=l(b.g*E);G=l(b.b*E);return"rgba("+A+","+D+","+G+","+b.a+")"};R.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===
this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];
for(var c=a+1;c<b;c++)q=this.graphics[c],v.splitFace(q),q.splitFace(v);this.primitives=this.primitives.concat(v.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)q=this.graphics[c],q.split&&v.splitFace(q);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);
else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);for(var e=[],d=[],f=0,g=a.length,h=.001,k,n;;){k=g;for(c=0;c<b;c++)if(!a[c].drawn){n=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(e,a[m],h)){n=!1;break}n&&(g--,d[f++]=a[c],a[c].drawn=!0)}if(0==g)break;else if(g==k){if(h*=10,.1<
h){for(c=0;c<b;c++)a[c].drawn||(d[f++]=a[c],a[c].drawn=!0);break}}else h=.001}for(c=0;c<b;c++)d[c].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);window.removeEventListener("touchmove",f,!1);window.removeEventListener("touchend",
b,!1);a.preventDefault();g.parent.update()}function c(b){document.body.focus();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);b.preventDefault();"R"===g.whichBtn&&(window.removeEventListener("mousemove",d,!1),g.posZoom==g.posZoomNew&&a.showConfig&&g.parent.externalSpace.show());window.removeEventListener("mousemove",f,!1);window.removeEventListener("mouseup",c,!1);g.parent.update()}function e(b){g.posAnte=a.getCursorPosition(b,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=
g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.id+".mouse_x",g.mouse_x);g.evaluator.setVariable(g.id+".mouse_y",g.mouse_y);g.parent.update()}function d(b){b.preventDefault();g.posZoomNew=a.getCursorPosition(b,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.posObserverNew=a.getCursorPosition(b,g.container).x;g.evaluator.setVariable(g.obsStr,g.tempObserver-2.5*(g.posObserver-g.posObserverNew));g.parent.update()}function f(b){if(!g.fixed&&
g.click){p=(g.getAbsoluteX(g.oldMouse.x)-g.getAbsoluteX(g.mouse_x))/4;k=(-g.getAbsoluteY(g.oldMouse.y)+g.getAbsoluteY(g.mouse_y))/4;if(p!==g.disp.x||k!==g.disp.y)g.alpha=a.degToRad(g.evaluator.getVariable(g.rotZStr)),g.beta=a.degToRad(-g.evaluator.getVariable(g.rotYStr)),g.alpha=a.radToDeg(g.alpha)-p,g.beta=a.radToDeg(g.beta)-k,g.evaluator.setVariable(g.rotZStr,g.alpha),g.evaluator.setVariable(g.rotYStr,-g.beta),g.disp.x=p,g.disp.y=k,g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y);
e(b);b.preventDefault()}}var g=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();g.click=1;g.evaluator.setVariable(g.id+".mouse_pressed",1);g.parent.deactivateControls();g.posAnte=a.getCursorPosition(c,g.container);g.oldMouse.x=g.getRelativeX(g.posAnte.x);g.oldMouse.y=g.getRelativeY(g.posAnte.y);e(c);window.addEventListener("touchmove",f);window.addEventListener("touchend",b);c.preventDefault()});
this.canvas.addEventListener("mousedown",function(b){document.body.focus();g.click=1;g.parent.deactivateControls();g.whichBtn=a.whichBtn(b);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posObserver=a.getCursorPosition(b,g.container).x,g.posObserverNew=g.posObserver,g.posZoom=a.getCursorPosition(b,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,g.tempObserver=g.observer,window.addEventListener("mousemove",d))):"L"==g.whichBtn&&(g.evaluator.setVariable(g.id+".mouse_pressed",
1),g.posAnte=a.getCursorPosition(b,g.container),g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y),e(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,c,r,l,b,g=function(b,c){var e=a.Space.call(this,b,c)||this;h=e.parent.evaluator;void 0!=e._w_&&(b=h.parser.parse(e._w_),e._w_="number"!=b.type?b:void 0);void 0!=e._h_&&(b=h.parser.parse(e._h_),e._h_="number"!=b.type?b:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";e.file.match(/^\[/)&&e.file.match(/\]$/)?e.file=h.parser.parse(e.file.substring(1,e.file.length-1)):e.file.match(/^'/)&&e.file.match(/'$/)?
e.file=h.parser.parse(e.file):e.file=h.parser.parse("'"+e.file+"'");e.oldFile=h.eval(e.file);e.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=a.newHTML("div",{id:e.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+
e.zIndex+";background-repeat:no-repeat;background-position:center;"});e.container.appendChild(e.MyIFrame);e.imageSrc&&(e.container.style.backgroundImage="url("+e.imageSrc+")");e.parent.container.insertBefore(e.container,e.parent.loader);e.MyIFrame.onload=function(b){var c=this;e.evaluator.setFunction(e.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
e.evaluator.setFunction(e.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var e=a.cacheFiles[b];else e=(e=document.getElementById(b))&&"descartes/embed"===e.type?e.textContent:a.openFile(b),e=(e=(new DOMParser).parseFromString(e,"text/html").querySelector("ajs"))?e.innerHTML:"",a.cacheFiles[b]=e;c.contentWindow.postMessage({type:"change_config",filename:b,content:e},"*")}return 0});
e.evaluator.setFunction(e.id+".changeContent",function(a){a&&(a=(a=(new DOMParser).parseFromString(a.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?a.innerHTML:"",c.contentWindow.postMessage({type:"change_content",content:a},"*"))});e.ImReady=!e.isFirefox;e.isFirefox||(e.container.style.visibility="visible",e.container.style.opacity="1",e.container.style.zIndex=e.zIndex,e.container.style.display=e.drawIfValue?"block":"none");e.MyIFrame.style.visibility="visible";e.container.style.backgroundImage=
""};e.update=e.iframeUpdate;e.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(g,a.Space);g.prototype.init=function(){l=this;l.initSpace();l.MyIFrame&&Object.assign(l.MyIFrame.style,{width:l.w+"px",height:l.h+"px"})};g.prototype.iframeUpdate=function(a){h=this.evaluator;this.drawIfValue=0<h.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=
this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);d=this.x!==h.eval(this.xExpr)+this.displaceRegionWest;c=this.y!==h.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=d?h.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=c?h.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=h.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=
a+"px",this.w=a));void 0!=this._h_&&(a=h.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(d||c)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";r=h.eval(this.file);r!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?
this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),this.MyIFrame.style.visibility="hidden",this.oldFile=r,this.MyIFrame.contentWindow.location.replace(r));b=h.getVariable(this.id+"._scroll");1==b?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==b?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};
a.SpaceHTMLIFrame=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=1,d=function(c){this.children=c.children;this.lessonParser=c.lessonParser;this.images=c.images;this.images.length=c.images.length;this.audios=c.audios;this.audios.length=c.audios.length;this.descartesApp=c;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});c.imgLoader?(c.loader.style.backgroundColor="transparent",this.imgLoader.setAttribute("style","background-image:url("+
c.imgLoader+");background-size:contain;")):(h=c.width<c.height?c.width/1144:c.height/1092,h=2.5<h?2.5:h,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*h+"px;"),this.progress.setAttribute("style","visibility:visible;left:"+(c.width-726*h)/2+"px;top:"+(33.5*c.height/100+940*h/2)+"px;width:"+726*h+"px;height:"+14*h+"px;"));c.loader.appendChild(this.imgLoader);c.loader.appendChild(this.progress);c.firstRun=!1;this.initPreloader()};
d.prototype.initPreloader=function(){var c=this,d=c.children,h=c.images,b=c.audios,g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,m=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,e;var n=0;for(e=d.length;n<e;n++)if("rtf"!==d[n].name){if(d[n].value.match(/'macro'|'makro'/g)){var f="";var v=void 0;var q=c.lessonParser.split(d[n].value);var u=0;for(var y=q.length;u<y;u++)"expresion"===babel[q[u][0]]&&(f=q[u][1]);f&&(v=(v=document.getElementById(f))&&"descartes/macro"==v.type?v.text:a.openFile(f));if(v&&
(v=v.match(g)))for(f=0,u=v.length;f<u;f++)q=v[f],q.toLowerCase().match(/vacio.gif$/)||""==q.substring(0,q.length-4)||(h[q]=new Image,h[q].addEventListener("load",function(){this.ready=1}),h[q].addEventListener("error",function(){this.errorload=1}),h[q].src=q)}if(v=d[n].value.match(g))for(f=0,u=v.length;f<u;f++)q=v[f],q.toLowerCase().match(/vacio.gif$/)||""==q.substring(0,q.length-4)||(h[q]=new Image,h[q].addEventListener("load",function(){this.ready=1}),h[q].addEventListener("error",function(){this.errorload=
1}),h[q].src=q);if(v=d[n].value.match(m))for(f=0,q=v.length;f<q;f++)c.initAudio(v[f])}for(var p in h)h.hasOwnProperty(p)&&c.images.length++;for(var k in b)b.hasOwnProperty(k)&&c.audios.length++;var x=c.images.length+c.audios.length;0<x&&c.progress.setAttribute("max",x);var w,z=function(){w=0;for(var e in h)h.hasOwnProperty(e)&&(h[e].ready||h[e].errorload)&&w++;for(var d in b)b.hasOwnProperty(d)&&(b[d].ready||b[d].errorload)&&w++;c.progress.setAttribute("value",w);w!=x?c.timer=a.setTimeout(z,1):c.descartesApp.initBuildApp()};
z()};d.prototype.initAudio=function(c){var d=this.audios;d[c]=new Audio(c);d[c].filename=c;var h=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo "+c+" no puede ser reproducido"),this.errorload=1):(d[c]=new Audio(this.filename.replace("mp3","ogg")),d[c].filename=this.filename.replace("mp3","ogg"),d[c].addEventListener("canplaythrough",h),d[c].addEventListener("load",
h),d[c].addEventListener("error",b),d[c].load())};d[c].addEventListener("canplaythrough",h);d[c].addEventListener("load",h);d[c].addEventListener("error",b);a.hasTouchSupport?(d[c].load(),d[c].play(),a.setTimeout(function(){d[c].pause()},20),d[c].ready=1):d[c].load()};a.DescartesLoader=d;return a}(descartesJS||{});
descartesJS=function(a){function h(){d=window.innerWidth/this.width;c=window.innerHeight/this.height;a.cssScale=r=Math.min(d,c);this.container.style.transformOrigin="0 0";this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";d<c?(this.container.style.left="0",this.container.style.top="50%",this.container.style.transform="translate3d(0px,0px,0px) scale("+r+") translate(0,-50%)"):(this.container.style.left="50%",this.container.style.top=
"0",this.container.style.transform="translate3d(0px,0px,0px) scale("+r+") translate(-50%,0)")}if(a.loadLib)return a;var d,c,r,l=function(b){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=b;this.parentC=b.parentNode;this.width=parseFloat(b.getAttribute("width"));this.height=parseFloat(b.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=b.getElementsByTagName("param");
this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.keyboard=new a.Keyboard(this);this.scaleToFit=function(){};this.init()};l.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",this.height);this.evaluator.setVariable("DJS.container_w",this.width);this.evaluator.setVariable("DJS.container_h",this.height);this.getURLParameters();
this.lessonParser=new a.LessonParser(this);var b,c=$jscomp.makeIterator(this.children);for(b=c.next();!b.done;b=c.next())if(b=b.value,"Buttons"==babel[b.name])this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value);else if("image_loader"==b.name)this.imgLoader=b.value;else if("expand"==b.name)this.expand=b.value;else if("docBase"==b.name)document.head.appendChild(a.newHTML("base",{id:"descartesJS_base",href:b.value}));else if(b.name.startsWith("E_"))break;this.externalSpace&&document.body.removeChild(this.externalSpace.container);
this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),
delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(c=a.newHTML("style",
{rel:"stylesheet",type:"text/css",id:"StyleDescartesAppsPrint"}),document.head.insertBefore(c,document.head.firstChild),c.innerHTML="@page{margin:0cm;size:"+this.width+"px "+this.height+"px;}",this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.scaleToFit=h,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.container.width=this.width=window.innerWidth;this.container.height=this.height=window.innerHeight;this.container.setAttribute("style",
"width:"+this.width+"px;height:"+this.height+"px;");this.evaluator.setVariable("DJS.container_w",this.container.width);this.evaluator.setVariable("DJS.container_h",this.container.height);try{this.update()}catch(n){}if(this.spaces)for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,b.initSpace(),b.init(),b.update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()};l.prototype.initBuildApp=
function(){a.showConfig=!0;var b,c=this.lessonParser,d=[],e=[],h=[],f=[],l=[],q=[],r=$jscomp.makeIterator(this.children);for(b=r.next();!b.done;b=r.next())b=b.value,"editable"==babel[b.name]?a.showConfig="false"!=babel[b.value]:"language"==babel[b.name]?this.language=b.value:"Buttons"==babel[b.name]?this.buttonsConfig=c.parseButtonsConfig(b.value):"decimal_symbol"==babel[b.name]?(this.decimal_symbol=b.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g")):"version"==babel[b.name]?
this.version=parseInt(b.value):b.name.startsWith("E_")?(b.value.match(/'HTMLIFrame'/)&&this.nIframes++,d.push(b.value)):b.name.startsWith("C_")?e.push(b.value):b.name.startsWith("A_")?h.push(b.value):b.name.startsWith("G_")?(b.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),f.push(b.value)):b.name.startsWith("S_")?l.push(b.value):"Animation"==babel[b.name]&&q.push(b.value);b=0;for(var y=d.length;b<
y;b++)r=c.parseSpace(d[b]),this.spaces.push(r),this.zIndex++;r=0;for(b=f.length;r<b;r++)if(a.DEBUG.elemIndex=r,d=c.parseGraphic(f[r]))this.editableRegionVisible=this.editableRegionVisible||d.visible,d.space.addGraph(d);f=0;for(r=l.length;f<r;f++)(d=c.parse3DGraphic(l[f]))&&d.space.addGraph(d,!0);l=0;for(f=e.length;l<f;l++)this.controls.push(c.parseControl(e[l]));e=0;for(l=h.length;e<l;e++)c.parseAuxiliar(h[e]);h=0;for(e=q.length;h<e;h++)this.animation=c.parseAnimation(q[h]);this.configRegions();this.updateAuxiliaries();
this.updateAuxiliaries();c=0;for(q=this.controls.length;c<q;c++)this.controls[c].init();this.updateControls();this.updateSpaces(!0);this.finishInit()};l.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",
href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(m){console.warn("CustomEvents not supported in this browser")}var c=this;this.evaluator.setFunction("openKB",function(a,b,d,g,h,l,r,y,p,
k,x){c.keyboard.show(null,a,b,d,g,{x:h,y:l,w:r,h:y,fs:p+"px",value:k+"",type:"custom",tagName:"textfield"},x)});this.readyApp=!0};l.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var b=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-c)/2);window.resizeTo(b,c);a.onResize()};l.prototype.configRegions=function(){var b=this.evaluator.parser,
c=this.buttonsConfig||{},d=this.container,e=100,h=100,f=0,l=0,q=0,r=0,y=0,p=this.northSpace.controls,k=this.southSpace.controls;var x=this.eastSpace.controls;var w=this.westSpace.controls;if(0<c.rowsNorth||0<p.length||c.about||c.config){0>=c.rowsNorth?(f=c.height,c.rowsNorth=1):f=c.height*c.rowsNorth;var z=this.northSpace.container;z.id="descartesJS_north";z.setAttribute("style","width:"+d.width+"px;height:"+f+"px;left:0;top:0;");d.insertBefore(z,this.loader);z=d.width;var A=0;c.about?(A=e,z-=A):
e=0;c.config&&(z-=100);for(var D=Math.ceil(p.length/c.rowsNorth),G=z/D,F=0,J=p.length;F<J;F++)p[F].expresion=b.parse("("+(A+F%D*G)+","+c.height*Math.floor(F/D)+","+G+","+c.height+")"),p[F].init();c.about&&(p=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse("15"),expresion:b.parse("(0,0,"+e+","+f+")")}),p.actionExec={execute:a.showAbout},p.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse("15"),action:"config",
expresion:b.parse("("+(z+e)+",0,100,"+f+")")})).update()}if(0<c.rowsSouth||0<k.length||c.init||c.clear){0>=c.rowsSouth?(l=c.height,c.rowsSouth=1):l=c.height*c.rowsSouth;e=d.width;z=0;c.init?(z=h,e-=z):h=0;c.clear&&(e-=100);p=this.southSpace.container;p.id="descartesJS_south";p.setAttribute("style","width:"+d.width+"px;height:"+l+"px;left:0;bottom:0;");d.insertBefore(p,this.loader);p=Math.ceil(k.length/c.rowsSouth);A=e/p;D=0;for(G=k.length;D<G;D++)k[D].expresion=b.parse("("+(z+D%p*A)+","+c.height*
Math.floor(D/p)+","+A+","+c.height+")"),k[D].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse("15"),action:"init",expresion:b.parse("(0,0,"+h+","+l+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse("15"),action:"clear",expresion:b.parse("("+(e+h)+",0,100,"+l+")")})).update()}if(0<x.length)for(h=d.height-f-l,r=c.widthEast,k=this.eastSpace.container,k.id="descartesJS_east",
k.setAttribute("style","width:"+r+"px;height:"+h+"px;right:0;top:"+f+"px;"),d.insertBefore(k,this.loader),h=0,k=x.length;h<k;h++)x[h].expresion=b.parse("(0,"+c.height*h+","+r+","+c.height+")"),x[h].init();if(0<w.length)for(x=d.height-f-l,y=c.widthWest,h=this.westSpace.container,h.id="descartesJS_west",h.setAttribute("style","width:"+y+"px;height:"+x+"px;left:0;top:"+f+"px;"),d.insertBefore(h,this.loader),x=0,h=w.length;x<h;x++)w[x].expresion=b.parse("(0,"+c.height*x+","+y+","+c.height),w[x].init();
if(this.editableRegionVisible)for(q=c.height,b=this.editableRegion.container,b.id="descartesJS_editableRegion",b.setAttribute("style","position:absolute;width:"+d.width+"px;height:"+q+"px;left:0;top:"+(d.height-l-c.height)+"px;"),d.insertBefore(b,this.loader),c=this.editableRegion.textFields,d=d.width/c.length,w=a.getFieldFontSize(q),x=0,h=c.length;x<h;x++)"div"==c[x].type?(b.appendChild(c[x].container),c[x].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(d-4)+"px;height:"+
q+"px;position:absolute;left:"+x*d+"px;top:0;"),k=c[x].container.firstChild,k.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+w+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+q+"px;text-align:center;line-height:"+q+"px;"),e=k.offsetWidth,k.style.width=e+"px",k.firstChild.textContent=k.firstChild.textContent.substring(3,k.firstChild.textContent.length-3),c[x].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+
w+"px;width:"+(d-e)+"px;height:"+q+"px;position:absolute;left:"+e+"px;top:0;border:2px groove white;")):(b.appendChild(c[x]),c[x].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+w+"px;width:"+d+"px;height:"+q+"px;position:absolute;left:"+x*d+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=f;this.displaceRegionSouth=l+(q||0);this.displaceRegionEast=r;this.displaceRegionWest=y;f=$jscomp.makeIterator(this.spaces);for(l=f.next();!l.done;l=f.next())l.value.init()};l.prototype.update=
function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};l.prototype.clearClick=function(){for(var a=$jscomp.makeIterator(this.spaces),c=a.next();!c.done;c=a.next())c.value.clearClick()};l.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var b=$jscomp.makeIterator(this.controls),c=b.next();!c.done;c=b.next())c.value.buttonClick=!1};l.prototype.deactivateControls=function(){if(this.controls)for(var a=$jscomp.makeIterator(this.controls),
c=a.next();!c.done;c=a.next())c=c.value,c.deactivate&&c.deactivate()};l.prototype.updateAuxiliaries=function(){for(var a=$jscomp.makeIterator(this.auxiliaries),c=a.next();!c.done;c=a.next())c.value.update()};l.prototype.updateEvents=function(){for(var a=$jscomp.makeIterator(this.events),c=a.next();!c.done;c=a.next())c.value.update()};l.prototype.updateControls=function(){for(var a=$jscomp.makeIterator(this.controls),c=a.next();!c.done;c=a.next())c.value.update()};l.prototype.updateSpaces=function(a){for(var b=
$jscomp.makeIterator(this.spaces),c=b.next();!c.done;c=b.next())c.value.update(a)};l.prototype.clear=function(){for(var a=$jscomp.makeIterator(this.spaces),c=a.next();!c.done;c=a.next())c=c.value,c.spaceChange=!0,c.drawBackground&&c.drawBackground()};l.prototype.play=function(){this.animation.play()};l.prototype.stop=function(){this.animation.stop()};l.prototype.reinitAnimation=function(){this.animation.reinit()};l.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&
this.audios[a].pause&&(this.audios[a].pause(),this.audios[a].currentTime=0)};l.prototype.getImage=function(a){if(a){if(this.images[a])return this.images[a];var b=this.images;b[a]=new Image;b[a].addEventListener("load",function(){this.ready=1});b[a].addEventListener("error",function(){this.ready=0;this.errorload=1});b[a].src=a;return b[a]}return new Image};l.prototype.getAudio=function(b){var c=this.audios;if(b){if(!c[b]){b.lastIndexOf(".");c[b]=new Audio(b);var d=function(a){this.ready=1};c[b].addEventListener("canplaythrough",
d);var e=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(c[b]=new Audio(b.replace("mp3","ogg")),c[b].addEventListener("canplaythrough",d),c[b].addEventListener("load",d),c[b].addEventListener("error",e),c[b].load())};c[b].addEventListener("error",e);c[b].play();a.setTimeout(function(){c[b].pause()},15)}return c[b]}return new Audio};l.prototype.getControlByCId=function(a){return this.getControlById(a,
!0)};l.prototype.getControlById=function(a,c){c=c?"cID":"id";for(var b=$jscomp.makeIterator(this.controls),e=b.next();!e.done;e=b.next())if(e=e.value,e[c]==a)return e;return{update:function(){},w:0,h:0}};l.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};l.prototype.getSpaceById=function(a,c){c=c?"cID":"id";for(var b=$jscomp.makeIterator(this.spaces),e=b.next();!e.done;e=b.next())if(e=e.value,e[c]==a)return e;return{update:function(){},w:0,h:0}};l.prototype.getURLParameters=function(){var a=
window.location.href,c=a.indexOf("?");if(-1!=c)for(a=decodeURIComponent(a.substring(c+1)).split("&"),a=$jscomp.makeIterator(a),c=a.next();!c.done;c=a.next())c=c.value.split("="),2==c.length&&this.evaluator.setVariable("URL."+c[0],+c[1]==+c[1]?parseFloat(c[1]):c[1])};l.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);a.backCanvas&&
(a.backCanvas=a.backCtx=null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&delete this.images[a]};a.DescartesApp=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(h,d){h="Error: "+h+" en\u300a "+d+" \u300b";var c="";switch(a.DEBUG.objectName){case "Auxiliar":d="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])c=" en la l\u00ednea "+(a.DEBUG.lineCount+1);h+=d+"\u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d"+c+".";break;case "Graphic":h+="En el gr\u00e1fico #"+(a.DEBUG.elemIndex+1)+" de tipo \u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(h)}};return a}(descartesJS||{});
descartesJS=function(a){function h(){d().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function d(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|DescartesWeb2_0/i.test(a.getAttribute("code"))})}function c(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function r(b){var d,l;return $jscomp.asyncExecutePromiseGeneratorProgram(function(b){switch(b.nextAddress){case 1:return b.setCatchFinallyBlocks(2),
d=[],["descartesJS_serif","descartesJS_sansserif","descartesJS_monospace","DJS_symbol","DJS_math"].forEach(function(a){d.push(document.fonts.load("20px "+a));d.push(document.fonts.load("bold 20px "+a));d.push(document.fonts.load("italic 20px "+a));d.push(document.fonts.load("bold italic 20px "+a))}),b.yield(Promise.all(d),4);case 4:b.leaveTryBlock(3);break;case 2:return l=b.enterCatchBlock(),console.log(l),b.return();case 3:a.getFeatures(),a.hasCanvas?(window.scrollTo(0,100),c(),h(),window.addEventListener("resize",
a.onResize),window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}",b.jumpToEnd()}})}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();
a.onResize=function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var l={};a.onMessage=function(b){if(0<a.apps.length){var c=b.data;c&&("set"===c.type?"string"==typeof c.value||"number"==typeof c.value?a.apps[0].evaluator.setVariable(c.name,c.value):c.value&&void 0!=c.value.rows?a.apps[0].evaluator.matrices[c.name]=c.value:a.apps[0].evaluator.vectors[c.name]=c.value:"update"===c.type?a.apps[0].update():"exec"===c.type?(b=a.apps[0].evaluator.getFunction(c.name))&&b.apply(a.apps[0].evaluator,c.value.toString().split(",")):
"isResizeNeeded"===c.type?b.source.postMessage({type:"doResize"},"*"):"doResize"===c.type?0<a.apps.length&&a.apps[0].adjustSize():"change_config"===c.type?(l[c.filename]?b=l[c.filename]:(b=a.newHTML("div"),b.innerHTML=c.content,b=b.getElementsByTagName("param"),l[c.filename]=b),a.apps[0].children=b,a.apps[0].init()):"change_content"===c.type&&(b=a.newHTML("div"),b.innerHTML=c.content,b=b.getElementsByTagName("param"),a.apps[0].children=b,a.apps[0].init()))}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",
r),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(b){window.addEventListener(b,function(b){a.onResize(b)})}));return a}(descartesJS||{});
