/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2025-06-26
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(b){var a=0;return function(){return a<b.length?{done:!1,value:b[a++]}:{done:!0}}};$jscomp.arrayIterator=function(b){return{next:$jscomp.arrayIteratorImpl(b)}};$jscomp.makeIterator=function(b){var a="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return a?a.call(b):$jscomp.arrayIterator(b)};$jscomp.arrayFromIterator=function(b){for(var a,c=[];!(a=b.next()).done;)c.push(a.value);return c};
$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$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(b){var a=function(){};a.prototype=b;return new a};$jscomp.underscoreProtoCanBeSet=function(){var b={a:!0},a={};try{return a.__proto__=b,a.a}catch(c){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(b,a){b.__proto__=a;if(b.__proto__!==a)throw new TypeError(b+" is not extensible");return b}:null;
$jscomp.inherits=function(b,a){b.prototype=$jscomp.objectCreate(a.prototype);b.prototype.constructor=b;if($jscomp.setPrototypeOf){var c=$jscomp.setPrototypeOf;c(b,a)}else for(c in a)if("prototype"!=c)if(Object.defineProperties){var h=Object.getOwnPropertyDescriptor(a,c);h&&Object.defineProperty(b,c,h)}else b[c]=a[c];b.superClass_=a.prototype};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,a,c){b!=Array.prototype&&b!=Object.prototype&&(b[a]=c.value)};$jscomp.polyfill=function(b,a,c,h){if(a){c=$jscomp.global;b=b.split(".");for(h=0;h<b.length-1;h++){var p=b[h];p in c||(c[p]={});c=c[p]}b=b[b.length-1];h=c[b];a=a(h);a!=h&&null!=a&&$jscomp.defineProperty(c,b,{configurable:!0,writable:!0,value:a})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(b){function a(){this.batch_=null}function c(a){return a instanceof p?a:new p(function(b,d){b(a)})}if(b&&!$jscomp.FORCE_POLYFILL_PROMISE)return b;a.prototype.asyncExecute=function(a){if(null==this.batch_){this.batch_=[];var b=this;this.asyncExecuteFunction(function(){b.executeBatch_()})}this.batch_.push(a)};var h=$jscomp.global.setTimeout;a.prototype.asyncExecuteFunction=function(a){h(a,0)};a.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var d=a[b];a[b]=null;try{d()}catch(g){this.asyncThrow_(g)}}}this.batch_=null};a.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var p=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(n){b.reject(n)}};p.prototype.createResolveAndReject_=function(){function a(a){return function(g){d||(d=!0,a.call(b,g))}}var b=this,d=!1;
return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};p.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof p)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)}};p.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(n){this.reject_(n);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};p.prototype.reject_=function(a){this.settle_(2,a)};p.prototype.fulfill_=function(a){this.settle_(1,a)};p.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};p.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=0;a<this.onSettledCallbacks_.length;++a)d.asyncExecute(this.onSettledCallbacks_[a]);
this.onSettledCallbacks_=null}};var d=new a;p.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};p.prototype.settleSameAsThenable_=function(a,b){var d=this.createResolveAndReject_();try{a.call(b,d.resolve,d.reject)}catch(g){d.reject(g)}};p.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{g(a(b))}catch(x){c(x)}}:b}var g,c,m=new p(function(a,b){g=a;c=b});this.callWhenSettled_(d(a,g),d(b,c));return m};
p.prototype.catch=function(a){return this.then(void 0,a)};p.prototype.callWhenSettled_=function(a,b){function c(){switch(g.state_){case 1:a(g.result_);break;case 2:b(g.result_);break;default:throw Error("Unexpected state: "+g.state_);}}var g=this;null==this.onSettledCallbacks_?d.asyncExecute(c):this.onSettledCallbacks_.push(c)};p.resolve=c;p.reject=function(a){return new p(function(b,d){d(a)})};p.race=function(a){return new p(function(b,d){for(var g=$jscomp.makeIterator(a),e=g.next();!e.done;e=g.next())c(e.value).callWhenSettled_(b,
d)})};p.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?c([]):new p(function(a,e){function g(b){return function(g){q[b]=g;h--;0==h&&a(q)}}var q=[],h=0;do q.push(void 0),h++,c(d.value).callWhenSettled_(g(q.length-1),e),d=b.next();while(!d.done)})};return p},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(b,a){this.$jscomp$symbol$id_=b;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:a})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function b(c){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(c||"")+"_"+a++,c)}var a=0;return b}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.asyncIterator;b||(b=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(b){$jscomp.initSymbolIterator();b={next:b};b[$jscomp.global.Symbol.iterator]=function(){return this};return b};$jscomp.generator={};
$jscomp.generator.ensureIteratorResultIsObject_=function(b){if(!(b instanceof Object))throw new TypeError("Iterator result "+b+" 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(b){this.yieldResult=b};
$jscomp.generator.Context.prototype.throw_=function(b){this.abruptCompletion_={exception:b,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(b){this.abruptCompletion_={return:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(b){this.abruptCompletion_={jumpTo:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(b,a){this.nextAddress=a;return{value:b}};
$jscomp.generator.Context.prototype.yieldAll=function(b,a){b=$jscomp.makeIterator(b);var c=b.next();$jscomp.generator.ensureIteratorResultIsObject_(c);if(c.done)this.yieldResult=c.value,this.nextAddress=a;else return this.yieldAllIterator_=b,this.yield(c.value,a)};$jscomp.generator.Context.prototype.jumpTo=function(b){this.nextAddress=b};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(b,a){this.catchAddress_=b;void 0!=a&&(this.finallyAddress_=a)};$jscomp.generator.Context.prototype.setFinallyBlock=function(b){this.catchAddress_=0;this.finallyAddress_=b||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(b,a){this.nextAddress=b;this.catchAddress_=a||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(b){this.catchAddress_=b||0;b=this.abruptCompletion_.exception;this.abruptCompletion_=null;return b};$jscomp.generator.Context.prototype.enterFinallyBlock=function(b,a,c){c?this.finallyContexts_[c]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=b||0;this.finallyAddress_=a||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(b,a){a=this.finallyContexts_.splice(a||0)[0];if(a=this.abruptCompletion_=this.abruptCompletion_||a){if(a.isException)return this.jumpToErrorHandler_();void 0!=a.jumpTo&&this.finallyAddress_<a.jumpTo?(this.nextAddress=a.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=b};$jscomp.generator.Context.prototype.forIn=function(b){return new $jscomp.generator.Context.PropertyIterator(b)};
$jscomp.generator.Context.PropertyIterator=function(b){this.object_=b;this.properties_=[];for(var a in b)this.properties_.push(a);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var b=this.properties_.pop();if(b in this.object_)return b}return null};$jscomp.generator.Engine_=function(b){this.context_=new $jscomp.generator.Context;this.program_=b};
$jscomp.generator.Engine_.prototype.next_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,b,this.context_.next_);this.context_.next_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(b){this.context_.start_();var a=this.context_.yieldAllIterator_;if(a)return this.yieldAllStep_("return"in a?a["return"]:function(a){return{value:a,done:!0}},b,this.context_.return);this.context_.return(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],b,this.context_.next_);this.context_.throw_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(b,a,c){try{var h=b.call(this.context_.yieldAllIterator_,a);$jscomp.generator.ensureIteratorResultIsObject_(h);if(!h.done)return this.context_.stop_(),h;var p=h.value}catch(d){return this.context_.yieldAllIterator_=null,this.context_.throw_(d),this.nextStep_()}this.context_.yieldAllIterator_=null;c.call(this.context_,p);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var b=this.program_(this.context_);if(b)return this.context_.stop_(),{value:b.value,done:!1}}catch(a){this.context_.yieldResult=void 0,this.context_.throw_(a)}this.context_.stop_();if(this.context_.abruptCompletion_){b=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(b.isException)throw b.exception;return{value:b.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(b){this.next=function(a){return b.next_(a)};this.throw=function(a){return b.throw_(a)};this.return=function(a){return b.return_(a)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(b,a){a=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(a,b.prototype);return a};
$jscomp.asyncExecutePromiseGenerator=function(b){function a(a){return b.next(a)}function c(a){return b.throw(a)}return new Promise(function(h,p){function d(b){b.done?h(b.value):Promise.resolve(b.value).then(a,c).then(d,p)}d(b.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(b){return $jscomp.asyncExecutePromiseGenerator(b())};$jscomp.asyncExecutePromiseGeneratorProgram=function(b){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(b)))};
$jscomp.checkStringArgs=function(b,a,c){if(null==b)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return b+""};
$jscomp.polyfill("String.prototype.repeat",function(b){return b?b:function(a){var b=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var h="";a;)if(a&1&&(h+=b),a>>>=1)b+=b;return h}},"es6","es3");
$jscomp.polyfill("String.prototype.startsWith",function(b){return b?b:function(a,b){var c=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var p=c.length,d=a.length;b=Math.max(0,Math.min(b|0,c.length));for(var l=0;l<d&&b<p;)if(c[b++]!=a[l++])return!1;return l>=d}},"es6","es3");
$jscomp.polyfill("String.prototype.endsWith",function(b){return b?b:function(a,b){var c=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===b&&(b=c.length);b=Math.max(0,Math.min(b|0,c.length));for(var p=a.length;0<p&&0<b;)if(c[--b]!=a[--p])return!1;return 0>=p}},"es6","es3");$jscomp.stringPadding=function(b,a){b=void 0!==b?String(b):" ";return 0<a&&b?b.repeat(Math.ceil(a/b.length)).substring(0,a):""};
$jscomp.polyfill("String.prototype.padStart",function(b){return b?b:function(a,b){var c=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(b,a-c.length)+c}},"es8","es3");$jscomp.owns=function(b,a){return Object.prototype.hasOwnProperty.call(b,a)};$jscomp.assign="function"==typeof Object.assign?Object.assign:function(b,a){for(var c=1;c<arguments.length;c++){var h=arguments[c];if(h)for(var p in h)$jscomp.owns(h,p)&&(b[p]=h[p])}return b};
$jscomp.polyfill("Object.assign",function(b){return b||$jscomp.assign},"es6","es3");$jscomp.polyfill("Array.prototype.fill",function(b){return b?b:function(a,b,h){var c=this.length||0;0>b&&(b=Math.max(0,c+b));if(null==h||h>c)h=c;h=Number(h);0>h&&(h=Math.max(0,c+h));for(b=Number(b||0);b<h;b++)this[b]=a;return this}},"es6","es3");$jscomp.findInternal=function(b,a,c){b instanceof String&&(b=String(b));for(var h=b.length,p=0;p<h;p++){var d=b[p];if(a.call(c,d,p,b))return{i:p,v:d}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");$jscomp.polyfill("Object.is",function(b){return b?b:function(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}},"es6","es3");
$jscomp.polyfill("Array.prototype.includes",function(b){return b?b:function(a,b){var c=this;c instanceof String&&(c=String(c));var p=c.length;b=b||0;for(0>b&&(b=Math.max(b+p,0));b<p;b++){var d=c[b];if(d===a||Object.is(d,a))return!0}return!1}},"es7","es3");$jscomp.polyfill("String.prototype.includes",function(b){return b?b:function(a,b){return-1!==$jscomp.checkStringArgs(this,a,"includes").indexOf(a,b||0)}},"es6","es3");
$jscomp.polyfill("Array.prototype.flat",function(b){return b?b:function(a){a=void 0===a?1:Number(a);for(var b=[],h=0;h<this.length;h++){var p=this[h];Array.isArray(p)&&0<a?(p=Array.prototype.flat.call(p,a-1),b.push.apply(b,p)):b.push(p)}return b}},"es9","es5");$jscomp.polyfill("Math.trunc",function(b){return b?b:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var b=Math.floor(Math.abs(a));return 0>a?-b:b}},"es6","es3");
$jscomp.polyfill("Math.sign",function(b){return b?b:function(a){a=Number(a);return 0===a||isNaN(a)?a:0<a?1:-1}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(b){return b?b:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");
var babel=function(b){if(b.loadLib)return b;b.loadLib=!0;b.no=b.ez=b.non=b["n\u00e3o"]=b.falso=b["false"]=b.fals=b.gezurra=b.faux=b.fals="false";b["s\u00ed"]=b.yes=b.bai=b.oui=b.si=b.sim=b.verdadero=b["true"]=b.veritable=b.egia=b.vrai=b.verdadeiro=b.veritable="true";b.negro=b.black=b.negre=b.beltza=b.noir=b.preto=b["#000000"]="#000000";b.maxenta=b.magenta=b["#ff00ff"]="#ff00ff";b.azul=b.blue=b.blau=b.urdina=b.bleu=b["#0000ff"]="#0000ff";b.turquesa=b.cyan=b.turkesa=b.turquoise=b["#00ffff"]="#00ffff";
b.verde=b.green=b.verd=b.berdea=b.vert=b["#00ff00"]="#00ff00";b.amarillo=b.yellow=b.groc=b.horia=b.jaune=b.amarelo=b["#ffff00"]="#ffff00";b.naranja=b.orange=b.taronja=b.laranja=b.laranxa=b["#ffc800"]="#ffc800";b.rojo=b.red=b.vermell=b.gorria=b.rouge=b.vermello=b.vermelho=b["#ff0000"]="#ff0000";b.pink=b.rosa=b.arrosa=b.rose=b["#ffafaf"]="#ffafaf";b.grisObscuro=b.darkGray=b.grisFosc=b["gris iluna"]=b.grisObscur=b.grisEscuro=b.cinzaEscuro=b["#404040"]="#404040";b.gris=b.gray=b.grisa=b.cinza=b["#808080"]=
"#808080";b.grisClaro=b.lightGray=b.grisClar=b["gris argia"]=b.grisClair=b.cinzaClaro=b["#c0c0c0"]="#c0c0c0";b.blanco=b.white=b.blanc=b.zuria=b.branco=b["#ffffff"]="#ffffff";b.escala=b.scale=b.eskala=b["\u00e9chelle"]="scale";b.nombre=b.name=b.nom=b.izena=b.nome="name";b.ikusgai=b["vis\u00edvel"]=b.visible="visible";b.rastro=b.trace=b.rastre=b.arrastoa="trace";b.fondo=b.background=b.fons=b.hondoa=b.fond=b.fundo="background";b["par\u00e1metro"]=b.parameter=b.parametroa=b["par\u00e2metro"]=b["par\u00e0metre"]=
"parameter";b["sucesi\u00f3n"]=b.sequence=b["successi\u00f3"]=b.segida=b.succession=b["seq\u00fc\u00eancia"]="sequence";b["tama\u00f1o"]=b.size=b.neurria=b.taille=b.tamanho=b["grand\u00e0ria"]="size";b.decimales=b.decimals=b.hamartarra=b["d\u00e9cimales"]=b.decimais="decimals";b.red=b.net=b.xarxa=b.sarea=b["r\u00e9seau"]=b.rede=b.malha="net";b.red10=b.net10=b.xarxa10=b.sarea10=b["r\u00e9seau10"]=b.rede10=b.malha10="net10";b.ejes=b.axes=b.eixos=b.ardatzak=b.eixes="axes";b["cr\u00e9ditos"]=b.about=
b["cr\u00e8dits"]=b.kreditoak=b["cr\u00e9dits"]=b.sobre="about";b.config=b.konfig=b["configura\u00e7\u00e3o"]="config";b.inicio=b.init=b.inici=b.hasiera=b.commencement=b["in\u00edcio"]="init";b.limpiar=b.clear=b.neteja=b.ezabatu=b.nettoye=b.limpar="clear";b.incr=b.gehi=b.incremento="incr";b.min=b.inf="min";b.max=b.sup=b["m\u00e1x"]="max";b.relleno=b.fill=b.ple=b.betea=b.plein=b.recheo=b.preencher="fill";b["relleno+"]=b["fill+"]=b["ple+"]=b["betea+"]=b["plein+"]=b["recheo+"]=b["preencher+"]=b.fillP=
"fillP";b["relleno-"]=b["fill-"]=b["ple-"]=b["betea-"]=b["plein-"]=b["recheo-"]=b["preencher-"]=b.fillM="fillM";b.flecha=b.arrow=b.fletxa=b.gezia=b["fl\u00e8che"]=b.frecha=b.seta="arrow";b.punta=b.spear=b.muturra=b.pointe=b.ponta="spear";b["regi\u00f3n"]=b.region=b["regi\u00f3"]=b.eskualde=b["r\u00e9gion"]=b["rexi\u00f3n"]=b["regi\u00e3o"]="region";b.norte=b.north=b.nord=b.ipar="north";b.sur=b.south=b.sud=b.hego=b.sul="south";b.este=b.east=b.est=b.ekialde=b.leste="east";b.oeste=b.west=b.oest=b.hegoalde=
b.ouest="west";b.exterior=b.external=b.kanpoalde=b.externo="external";b["expresi\u00f3n"]=b.expresion=b["expresi\u00f3"]=b.adierazpen=b["express\u00e3o"]="expresion";b.tipo=b.type=b.tipus=b.mota="type";b["posici\u00f3n"]=b.position=b["posici\u00f3"]=b.posizio=b["posi\u00e7\u00e3o"]="position";b["constricci\u00f3n"]=b.constraint=b["constricci\u00f3"]=b.beharte=b.constriction=b["constrici\u00f3n"]=b["restri\u00e7\u00e3o"]="constraint";b.valor=b.value=b.balio=b.valeur="value";b["ecuaci\u00f3n"]=b.equation=
b["equaci\u00f3"]=b.ekuazio=b["\u00e9quation"]=b["equa\u00e7\u00e3o"]="equation";b.curva=b.curve=b.corba=b.kurba=b.courbe="curve";b.texto=b.text=b.testu=b.texte=b.testua="text";b.punto=b.point=b.punt=b.puntu=b.ponto=b.dot="point";b.segmento=b.segment=b.zuzenki="segment";b.arco=b.arc=b.arku="arc";b["pol\u00edgono"]=b.polygon=b["pol\u00edgon"]=b.poligono=b.polygone="polygon";b.imagen=b.image=b.imatge=b.irudi=b.imaxe=b.imagem=b.bg_image=b.irudia=b.imagem_de_fundo=b.irundia="image";b["Versi\u00f3n"]=
b.Version=b["Versi\u00f3"]=b["Vers\u00e3o"]=b.version="version";b.Idioma=b.Language=b.Hizkuntza=b.Langue=b.language="language";b["O.x"]="O.x";b["O.y"]="O.y";b.Botones=b.Buttons=b.Botons=b.Botoiak=b.Boutons=b["Bot\u00f3ns"]=b["Bot\u00f5es"]=b.Botons="Buttons";b["Animaci\u00f3n"]=b.Animation=b["Animaci\u00f3"]=b.Animazio=b["Anima\u00e7\u00e3o"]="Animation";b.constante=b.constant=b.Konstante="constant";b.fuente=b.font=b.iturri=b.source=b.fonte="font";b["num\u00e9rico"]=b.numeric=b["num\u00e8ric"]=b.zenbakizko=
b["num\u00e9rique"]="numeric";b["gr\u00e1fico"]=b.graphic=b["gr\u00e0fic"]=b.grafiko=b.graphique="graphic";b.hacer=b["do"]=b.fer=b.egin=b.faire=b.facer=b.fazer=b.doExpr="doExpr";b.mientras=b["while"]=b.mentre=b.bitartean=b["tandis que"]=b.mentres=b.enquanto=b.whileExpr="whileExpr";b.evaluar=b.evaluate=b.avalua=b.ebaluatu=b["\u00e9valuer"]=b.avaliar="evaluate";b.variable=b.aldagaia=b["vari\u00e1vel"]="variable";b["funci\u00f3n"]=b["function"]=b["funci\u00f3"]=b.funtzio=b.fonction=b["fun\u00e7\u00e3o"]=
"function";b.algoritmo=b.algorithm=b.algorisme=b.algorithme="algorithm";b.vector=b.array=b.bektore=b.vecteur=b.matriz="array";b["dibujar-si"]=b["draw-if"]=b["marraztu-baldin"]=b["dessiner-si"]=b["debuxar-se"]=b["desenhar-se"]=b["dibuixa-si"]=b.drawif="drawif";b.dominio=b.range=b.domini=b["izate-eremua"]=b.domain=b["dom\u00ednio"]="range";b.pausa=b.delay=b.eten="delay";b["eje-x"]=b["x-axis"]=b["eix-x"]=b["x-ardatza"]=b["axe-x"]=b["eixe-x"]=b["eixo-x"]=b.x_axis="x_axis";b["eje-y"]=b["y-axis"]=b["eix-y"]=
b["y-ardatza"]=b["axe-y"]=b["eixe-y"]=b["eixo-y"]=b.y_axis="y_axis";b["n\u00fameros"]=b.numbers=b.nombres=b.zenbakiak="numbers";b["exponencial-si"]=b["exponential-if"]=b["esponentzial-baldin"]=b["exponentiel-si"]=b["exponencial-se"]=b.exponentialif="exponentialif";b.familia=b.family=b["fam\u00edlia"]=b.famille="family";b.intervalo=b.interval=b.tarte=b.intervalle="interval";b.pasos=b.steps=b.passos=b.pausoak=b.pas="steps";b.centro=b.center=b.centre=b.zentro="center";b.radio=b.radius=b.radi=b.erradio=
b.rayon=b.raio="radius";b.fin=b.end=b.fi=b.bukaera=b.fim="end";b["una-sola-vez"]=b["only-once"]=b["una-sola-vegada"]=b["behin-bakarrik"]=b["une-seule-fois"]=b["unha-soa-vez"]=b["apenas-uma-vez"]=b.onlyOnce="onlyOnce";b.siempre=b.always=b.sempre=b.beti=b.toujours="always";b["color-int"]=b["int-colour"]=b["barruko-kolore"]=b["couleur-int"]=b["cor-int"]=b.colorInt="colorInt";b.repetir=b.loop=b.repeteix=b.errepikatu=b["r\u00e9p\u00e9ter"]="loop";b.controles=b.controls=b.kontrolak=b["contr\u00f4les"]=
b.controis="controls";b.animar=b.animate=b.anima=b.animatu=b.animer="animate";b.auto="auto";b.y=b.top="y";b.espacio=b.space=b.espai=b.espazio=b.espace=b.espazo=b["espa\u00e7o"]="space";b.Nu="Nu";b.Nv="Nv";b.alto=b.height=b.alt=b.altu=b.haut=b.altura=b["al\u00e7ada"]=b.hauteur=b.alto="height";b.ancho=b.depth=b.amplada=b.zabalera=b.largeur=b.profundidade=b.amplada=b.width=b.ample=b.large=b.largura="width";b.largo=b.length=b.llargada=b.luzera=b.longueur=b.longo=b.comprimento=b.llargada="length";b.color_reverso=
b.backcolor=b.color_revers=b["atzealde kolorea"]=b.couleur_revers=b.cor_reverso=b.cor_de_fundo="backcolor";b.aristas=b.edges=b.arestes=b.ertzak=b["ar\u00eates"]=b.arestas="edges";b.rotini=b.inirot="inirot";b.posini=b.inipos="inipos";b["tri\u00e1ngulo"]=b.triangle=b.hirukia=b["tri\u00e2ngulo"]="triangle";b.cara=b.face=b.aurpegi="face";b.polireg=b.regpoly=b["pol\u00edgonoRegular"]="polireg";b.superficie=b.surface=b["superf\u00edcie"]=b.azalera="surface";b.cubo=b.cube=b.cub=b.kubo="cube";b["paralelep\u00edpedo"]=
b.box=b["paral\u00b7lelep\u00edpede"]=b.paralelepipedo=b["parall\u00e9l\u00e9pip\u00e8de"]="box";b.cono=b.cone=b.con=b.kono=b["c\u00f4ne"]="cone";b.cilindro=b.cylinder=b.cilindre=b.zilindro=b.cylindre="cylinder";b.esfera=b.sphere=b["sph\u00e8re"]="sphere";b.tetraedro=b.tetrahedron=b.tetraedre=b["t\u00e9tra\u00e8dre"]="tetrahedron";b.octaedro=b.octahedron=b.octaedre=b.oktaedro=b["octa\u00e8dre"]="octahedron";b.dodecaedro=b.dodecahedron=b.dodecaedre=b.dodekaedro=b["dod\u00e9ca\u00e8dre"]="dodecahedron";
b.icosaedro=b.icosahedron=b.icosaedre=b.ikosaedro=b["icosa\u00e8dre"]="icosahedron";b.elipsoide=b.ellipsoid=b["el\u00b7lipsoide"]=b["ellipso\u00efde"]=b["elips\u00f3ide"]="ellipsoid";b.macro=b.makro="macro";b.id="id";b.modelo=b.model=b.eredu=b["mod\u00e8le"]="model";b.color=b.kolore=b.couleur=b.cor=b.colour=b.kolorea="color";b.luz=b.light=b.llum=b.argia=b["lumi\u00e8re"]="light";b.metal=b.metall=b["m\u00e9tal"]="metal";b.alambre=b.wire=b.filferro=b.alanbre=b["fil de fer"]=b.arame="wire";b.cortar=
b.split=b.talla=b.moztu=b.couper=b.dividir="split";b.despliegue=b.render=b.desplegament=b.zabaltze=b["d\u00e8ploiement"]=b.despregamento=b.processar="render";b.orden=b.sort=b.ordre=b.ordena=b.orde=b.ordenar="sort";b.pintor=b.painter=b.margolari=b.peintre="painter";b["trazado de rayos"]=b["ray trace"]=b["tra\u00e7at de raigs"]=b["izpi trazadura"]=b["trace de rayons"]=b["trazado de raios"]=b["tra\u00e7ado de raios"]=b.raytrace="raytrace";b.despl_imagen=b.bg_display=b.despl_imatge=b["irudi desplazamendu"]=
b.despl_image=b.despr_imaxe=b["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";b["arr-izq"]=b.topleft=b["dalt-esq"]=b["goi-ezk"]=b["au-dessus-gau"]=b["arr-esq"]=b["acima-esquerda"]="topleft";b["expand."]=b.stretch=b.hedatu=b["expandir "]="stretch";b.mosaico=b.patch=b.mosaic=b.mosaiko=b["mosa\u00efque"]="patch";b.centrada=b.zentratu=b["centr\u00e9e"]=b.centrado=b.imgcenter="imgcenter";b.archivo=b.file=b.fitxer=b.artxibo=b.fichier=b.arquivo="file";b.filas_norte=b.rows_north=b.files_nord=b["HTML kodea"]=
b.files_nord=b.filas_norte=b.linhas_norte=b.files_nord=b.rowsNorth="rowsNorth";b.filas_sur=b.rows_south=b.files_sud=b.ipar_lerro=b.files_sud=b.filas_sur=b.linhas_sul=b.files_sud=b.rowsSouth="rowsSouth";b.ancho_este=b.width_east=b.ample_est=b.hego_lerro=b.ample_est=b.ancho_leste=b.largura_leste=b.ample_est=b.widthEast="widthEast";b.ancho_oeste=b.width_west=b.ample_oest=b.ekialde_zabalera=b.ample_ouest=b.ancho_oeste=b.largura_oeste=b.ample_oest=b.widthWest="widthWest";b.fijo=b.fixed=b.fix=b.hegoalde_zabalera=
b.fixe=b.fixo="fixed";b["Reiniciar Animaci\u00f3n"]=b["Init Animation"]=b["Reinicia Animaci\u00f3"]=b.finko=b["Recommencer l'Animation"]=b["Reiniciar Anima\u00e7\u00e3o"]=b.initAnimation="initAnimation";b["Explicaci\u00f3n"]=b.Explanation=b.Azalpena=b.Explication=b["Explica\u00e7\u00e3o"]=b["Explicaci\u00f3"]="Explanation";b.tooltip=b.dica="tooltip";b.discreto=b.discrete=b.discret=b.diskretu="discrete";b.interfaz=b.gui=b["interf\u00edcie"]=b.interfaze=b["interface"]="gui";b.pulsador=b.spinner=b.polsador=
b.pultsadore=b.bouton="spinner";b["campo de texto"]=b.textfield=b["camp de text"]=b["testu esarrua"]=b["champ de texte"]="textfield";b["men\u00fa"]=b.choice=b.menu=b.escolha="menu";b.barra=b.scrollbar=b.barre="scrollbar";b.opciones=b.options=b.opcions=b.aukerak=b["opci\u00f3ns"]=b["op\u00e7\u00f5es"]="options";b.interior=b.barruko=b["int\u00e9rieur"]="interior";b["condici\u00f3n"]=b.condition=b["condici\u00f3"]=b.baldintza=b["condi\u00e7\u00e3o"]="condition";b["acci\u00f3n"]=b.action=b["acci\u00f3"]=
b.ekintza=b["a\u00e7\u00e3o"]="action";b.evento=b.event=b.esdeveniment=b.gertaera=b["\u00e9v\u00e9nement"]="event";b["abrir URL"]=b["open URL"]=b["obre URL"]=b["URL zabaldu"]=b["ouvrir URL"]=b.openURL="openURL";b["abrir Escena"]=b["open Scene"]=b["obre Escena"]=b["eszena zabaldu"]=b["ouvrir Escena"]=b["abrir Cena"]=b.openScene="openScene";b["bot\u00f3n"]=b.button=b["bot\u00f3"]=b.botoi=b.bouton=b["bot\u00e3o"]="button";b.mensaje=b.message=b.mezua=b.mensaxe=b.mensagem=b.missatge="message";b.alternar=
b.alternate=b.alterna=b.txandakatu=b.alterner="alternate";b["ejecuci\u00f3n"]=b.execution=b["execuci\u00f3"]=b.gauzatze=b["ex\u00e9cution"]=b["execuci\u00f3n"]=b["execu\u00e7\u00e3o"]="execution";b.calcular=b.calculate=b.calcula=b.kalkulatu=b.calculer="calculate";b.coord_abs=b.abs_coord=b.koor_abs="abs_coord";b.negrita=b.bold=b.negreta=b.lodi=b["caract\u00e8re gras"]=b.negra=b.negrito="bold";b.cursiva=b.italics=b.etzana=b.italique=b["it\u00e1lico"]="italics";b.subrayada=b.underlined=b.subratllat=
b.azpimarratua=b.soulignement=b["subli\u00f1ada"]=b.sublinhado="underlined";b.pos_mensajes=b.msg_pos=b.pos_missatges=b.mezuen_pos=b.pos_messages=b.pos_mensaxes="msg_pos";b.izquierda=b.left=b.esquerra=b.eskerrean=b.gauche=b.esquerda=b.esquerda=b.esquerra=b.x="x";b.derecha=b.right=b.dreta=b.eskuinan=b.droite=b.dereita=b.direita=b.dreta="right";b["sensible_a_los_movimientos_del_rat\u00f3n"]=b.sensitive_to_mouse_movements=b["sensible_als_moviments_del_ratol\u00ed"]=b["xagu mugimenduarekiko sentikorra"]=
b.sensible_aux_mouvements_du_souris=b.sensible_aos_movementos_do_rato=b["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";b.reproducir=b.play=b.reprodueix=b.erreproduzitu=b.reproduire=b.reproduzir=b.playAudio="playAudio";b["activo-si"]=b["active-if"]=b["actiu-si"]=b["altiboa-baldin"]=b["actif-si"]=b["activo-se"]=b["ativo-se"]=b.activeif="activeif";b.rotfin=b.finrot=b.bukrot=b.endrot="endrot";b.posfin=b.finpos=b.bukpos=b.endpos="endpos";b.editable=b.editagarria=b["edit\u00e1vel"]=
"editable";b.R2="2D";b.R3="3D";b.vectores=b.bektoreak=b.vecteurs=b.vetores=b.vectors="vectors";b["fuente puntos"]=b["font size"]=b["font punts"]=b["puntu iturria"]=b["source points"]=b["fonte puntos"]=b["fonte pontos"]=b.font_size="font_size";b.escenario=b.scenario=b.escenari=b.agertoki=b["sc\u00e8ne"]=b["cen\u00e1rio"]="scenario";b.cID="cID";b.matriz=b.matrix=b.matriu=b.matrice="matrix";b.filas=b.rows=b.files="rows";b.columnas=b.columns=b.colonnes="columns";b.solo_texto=b.only_text=b.seulement_texte=
b["s\u00f3_texto"]=b.tan_sols_texte=b.onlyText="onlyText";b.respuesta=b.answer="answer";b.peso=b.weight=b.pes="weight";b.decimal_symbol=b["signo decimal"]=b["decimal symbol"]="decimal_symbol";b.info="info";b.library="library";b.color_contorn_text=b.color_text_border=b.color_borde_texto=b.muga_testuaren_kolorea=b.couleur_contour_texte=b.cor_borde_texto=b.colore_bordo_testo=b.cor_borda_texto=b.color_contorn_text=b.border="border";b.video=b["vid\u00e9o"]="video";b.audio=b["\u00e0udio"]="audio";b.autoplay=
"autoplay";b.poster="poster";b.opacidad=b.opacity=b["opacit\u00e9"]=b.opacitat=b.opacidade="opacity";b.alinear=b.align=b["ali\u00f1ar"]=b.aligner="align";b.anchor="anchor";b.a_left="left";b.a_center="center";b.a_right="right";b.a_justify="justify";b.a_top_left="top_left";b.a_top_center="top_center";b.a_top_right="top_right";b.a_center_left="center_left";b.a_center_center="center_center";b.a_center_right="center_right";b.a_bottom_left="bottom_left";b.a_bottom_center="bottom_center";b.a_bottom_right=
"bottom_right";b.malla=b.mesh="mesh";b.local=b.Local="local";b.rectangle=b["rect\u00e1ngulo"]="rectangle";b.lineDash="lineDash";b.solid="solid";b.dot="dot";b.dash="dash";b.dash_dot="dash_dot";b.offset_dist="offset_dist";b.offset_angle="offset_angle";b.flat="flat";b.borderColor="borderColor";b.text_align="text_align";b.image_align="image_align";b.checkbox="checkbox";b.torus=b.toro="torus";b.R="R";b.r="r";b.border_radius="border_radius";b.radio_group="radio_group";b.font_family="font_family";b.resizable=
"resizable";b.slider="slider";b.antialias="antialias";b.image_loader="image_loader";b.expand="expand";b.cover=b.cubrir="cover";b.fit=b.escalar="fit";b.code="code";b.doc="doc";b.image_dec="image_dec";b.image_inc="image_inc";b.btn_pos="btn_pos";b.border_width="border_width";b.border_color="border_color";b.v_left="v_left";b.v_right="v_right";b.h_left="h_left";b.h_right="h_right";b.h_left_right="h_left_right";b.label_color="label_color";b.label_text_color="label_text_color";b.shadowColor="shadowColor";
b.shadowBlur="shadowBlur";b.shadowOffsetX="shadowOffsetX";b.shadowOffsetY="shadowOffsetY";b.border_size="border_size";b.clip="clip";b.keyboard="keyboard";b.kblayout="kblayout";b.kbexp="kbexp";b.extra_style="extra_style";return b}(babel||Object.create(null)),descartesJS=function(b){if(b.loadLib)return b;b.addFonts=function(){var a={sansserif:{},serif:{},monospace:{},math:{}};a.sansserif.normal_bold=" ";
a.sansserif.italic_bold=" ";
a.sansserif.italic_normal=" ";
a.sansserif.normal_normal=" ";
a.monospace.normal_bold=" ";
a.monospace.italic_bold=" ";
a.monospace.italic_normal=" ";
a.monospace.normal_normal=" ";
a.serif.normal_bold=" ";
a.serif.italic_bold=" ";
a.serif.italic_normal=" ";
a.serif.normal_normal=" ";
a.math.normal_bold=a.math.italic_bold=" ";
a.math.italic_normal=a.math.normal_normal=" ";
for(var b=[["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]],h="",p=$jscomp.makeIterator(["sansserif","monospace","serif","math"]),d=p.next();!d.done;d=p.next()){d=d.value;for(var l=$jscomp.makeIterator(b),e=l.next();!e.done;e=l.next())e=e.value,h+="@font-face{font-family:'DJS_"+d+"';src:url('data:font/woff2;charset=utf-8;base64,"+a[d][e[0]+"_"+e[1]]+"') format('woff2');font-style:"+e[0]+";font-weight:"+e[1]+";} "}return h};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.addSymbolFont=function(){for(var a="",b=$jscomp.makeIterator([["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]]),h=b.next();!h.done;h=b.next())h=h.value,a+="@font-face{font-family:'DJS_symbol';src:url('data:font/woff2;charset=utf-8;base64, ') format('woff2');font-style:"+
h[0]+";font-weight:"+h[1]+";} ";return a};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};b.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";b.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";b.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";b.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";b.convertFont=function(d){if(""==d)return"";a=d.split(",");c="";c+=b.getFontStyle(a[1])+" ";c+=a[2]+"px ";return c+=b.getFontName(a[0].split(" ")[0])};b.getFontName=function(a){a=a.toLowerCase();h=b.monospace_font;/sansserif|arial|helvetica/.test(a)?h=b.sansserif_font:/serif|times/.test(a)&&(h=b.serif_font);return h};b.getFontStyle=function(a){return p[a.toLowerCase()]||""};
b.getTextWidth=function(a,c){b.ctx.font=c;return Math.round(b.ctx.measureText(a).width)};b.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 b}(descartesJS||{});
descartesJS=function(b){function a(){var a,b,d,e,c,h,l;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(g){g=Math.max(0,parseInt(void 0===g?0:g));a=this.toString();-1!==a.indexOf("e")&&(e=a.split("e"),h="-"===e[0][0]?"-":"",c="-"===h?parseFloat(e[0].substring(1)).oToFixed(11):parseFloat(e[0]).oToFixed(11),l=parseInt(e[1]),b=c.indexOf("."),c=c.replace(".",""),0>b+l?(b=0>b?1:b,a=h+"0."+"0".repeat(Math.abs(b+l))+c):a=h+c+"0".repeat(l-c.length+1));b=a.indexOf(".");
-1===b?0<g&&(a+="."+"0".repeat(g)):(d=a.length-b-1,a=d>=g?11>=g?parseFloat(a).oToFixed(g):a.substring(0,b+g+1):a+"0".repeat(g-d));return a}}if(b.loadLib)return b;var c=360/(2*Math.PI),h=2*Math.PI/360,p=Math.floor,d,l,e,n;b.rangeOK=1;b.cssScale=1;b.radToDeg=function(a){return a*c};b.degToRad=function(a){return a*h};b.getFeatures=function(){var g="";try{g=navigator.appVersion.toLowerCase()}catch(q){console.warn("navigator.appVersion is deprecated")}b.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||
"ontouchstart"in window||/android/i.test(g);b.isIOS=/iPad|iPhone/i.test(navigator.userAgent);g=b.newHTML("canvas");b.hasCanvas=g.getContext&&g.getContext("2d");b.hasCanvas&&(g.width=g.height=1,b.ctx=b.hasCanvas,b._ratio=2);a()};b.removeNeedlessDecimals=function(a){if("string"==typeof a&&(e=a.indexOf("."),-1!==e)){n=a.substring(e);if(0==parseFloat(n))return a.substring(0,e);for(var b=n.length-1;0<b;b--)if("0"!==n.charAt(b))return a.substring(0,e+b+1)}return a};b.whichBtn=function(a){return a.pointerType&&
("touch"===a.pointerType||"pen"===a.pointerType)||a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};b.createGradient=function(a,b,d){a=void 0===a?0:a;b=void 0===b?100:b;d="linear-gradient("+(void 0===d?0:d)+"deg,";for(var g=2*a,e=a;e<b;e++)a=p(100-e-35),d+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*e-g)+"%, ";return d+"rgba(0,0,0,0.1) 100%)"};b.getCursorPosition=function(a,e){d=a;a.touches&&0<a.touches.length&&(d=a.touches[0]);if(!d||"undefined"===typeof d.clientX)return null;l=e.getBoundingClientRect();
return{x:(d.clientX-l.left)/b.cssScale,y:(d.clientY-l.top)/b.cssScale}};b.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,g,d=[],e=0,c=0,h=a.length;c<h;c++)g=a.charAt(c),"'"===g&&(b=!b),b||";"!==g&&"\n"!==g||(d.push(a.substring(e,c).replace(/\n/g,"\\n")),e=c+1);d.push(a.substring(e).replace(/\n/g,"\\n"));return d};b.preventDefault=function(a){a.stopPropagation();a.preventDefault();return!1};b.convertHTMLEntities=function(a){var g=b.newHTML("textarea");g.innerHTML=a;return g.value};
b.newHTML=function(a,b){a=document.createElement(a);for(var g in b)a.setAttribute(g,b[g]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;b.setInterval=function(a,b){function g(){Date.now()-d>=b&&(a.call(),d=Date.now());e.value=requestAnimationFrame(g)}if(!requestAnimationFrame)return setInterval(a,
b);var d=Date.now(),e={};e.value=requestAnimationFrame(g);return e};b.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};b.setTimeout=function(a,b){function g(){Date.now()-d>=b?a.call():e.value=requestAnimationFrame(g)}if(!requestAnimationFrame)return setTimeout(a,b);var d=Date.now(),e={};e.value=requestAnimationFrame(g);return e};b.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};b.showAbout=function(){window.open("https://arquimedes.matem.unam.mx/Descartes5/creditos/",
"cr\u00e9ditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0")};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.cacheFiles=Object.create(null);b.openFile=function(a){if(b.cacheFiles[a])return b.cacheFiles[a];var c=null,h=new XMLHttpRequest;h.open("GET",a,!1);try{h.send(null),c=200===h.status||304===h.status?h.responseText:h.responseText||"",c=404===h.status?"":c,c.match(String.fromCharCode(65533))&&(h.open("GET",a,!1),h.overrideMimeType("text/plain;charset=ISO-8859-1"),h.send(null),c=h.responseText)}catch(p){c=null}return c};b.addExternalFileContent=function(a,
c){b.cacheFiles[a]=c};return b}(descartesJS||{});
descartesJS=function(b){function a(a){a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");p=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};/^'.*'$/.test(p)&&(a.ignoreCaps=!0,p=p.slice(1,-1),/^`.*\u00b4$/.test(p)&&(a.ignoreAccents=!0,p=p.slice(1,-1)));/^`.*\u00b4$/.test(p)&&(a.ignoreAccents=!0,p=p.slice(1,-1),/^'.*'$/.test(p)&&(a.ignoreCaps=!0,p=p.slice(1,-1)));p.startsWith("\\*")&&!p.endsWith("\\*")?p=p.substring(2)+"$":!p.startsWith("\\*")&&p.endsWith("\\*")?p="^"+p.substring(0,p.length-2):p.startsWith("\\*")||
p.endsWith("\\*")?p.startsWith("\\*")&&p.endsWith("\\*")&&(p=p.substring(2,p.length-2)):p="^"+p+"$";a.regExp=p.replace(/\?/g,"[\\S\\s]{1}");return a}function c(a,b){a=void 0===a?"":a;var g={},d=a.match(/^\s*(\(|\[)(.*)(\)|\])\s*$/);d?(g.type=d[1]+d[3],d=d[2].split(","),g.min=b.parser.parse(d[0]),g.max=b.parser.parse(d[1])):(g.type="[]",g.min=g.max=b.parser.parse(a));return g}function h(a){return(void 0===a?"":a).toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}if(b.loadLib)return b;var p,
d,l,e;b.answerRegEx=function(b,g,e){b=void 0===b?"":b;e&&/^\(|\)$/.test(b)&&(b=b.slice(1,-1));b=b.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var m=0,q=b.length;m<q;m++){d=b[m].split("&");l=[];for(var h=$jscomp.makeIterator(d),p=h.next();!p.done;p=h.next())p=p.value,e?l.push(a(p)):l.push(c(p,g));b[m]=l}return b};b.esCorrecto=function(a,b,d){b=(void 0===b?"":b)+"";a=$jscomp.makeIterator(a);for(var g=a.next();!g.done;g=a.next()){g=g.value;e=!0;g=$jscomp.makeIterator(g);for(var c=g.next();!c.done;c=
g.next())if(c=c.value,p=c.regExp)c.ignoreAccents&&(b=h(b),p=h(p)),c.ignoreCaps&&(b=b.toLowerCase(),p=h(p).toLowerCase()),e=e&&!!b.match(p);else{var q;if(q=e){q=b;var l=d;q=parseFloat(q);var n=l.eval(c.min);l=l.eval(c.max);l=")"==c.type[1]?q<l:q<l||1E-9>Math.abs(l-q);q=("("==c.type[0]?n<q:n<q||1E-9>Math.abs(n-q))&&l}e=q}if(e)return 1}return 0};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.loaderImg=new Image;b.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>");b.getSvgArrowUp=
function(a,b){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===b?"24c":b)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};b.getSvgArrowDown=function(a,b){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===
b?"d00018":b)+'"/></svg>')};b.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>")};b.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>")};
b.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 b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,h,p,d,l,e,n,g,q,m,f,w,u,x,r,v,z,y,A,B=function(a,g){this.r=this.g=this.b=0;this.a=1;this.evaluator=g;this.getColor=this.getColorStr;if(!a)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(/^GradL/.test(a)){a=this.splitComa(a.substring(6,a.length-1));this.x1=this.evaluator.parser.parse(a[0]);this.y1=this.evaluator.parser.parse(a[1]);this.x2=this.evaluator.parser.parse(a[2]);
this.y2=this.evaluator.parser.parse(a[3]);this.stops=[];for(var e=4;e<a.length;e++)""!=a[e]&&(g=a[e].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(g[1]),color:"#"+g[2]}));this.getColor=this.getLinearGradient}else if(/^Pattern/.test(a))this.img_src=a.substring(8,a.length-1),this.img_src.match(c)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[a])"net"===babel[a]&&(a="rojo"),a=babel[a],this.r=
b.toHex(a.substring(1,3)),this.g=b.toHex(a.substring(3,5)),this.b=b.toHex(a.substring(5,7)),this.colorStr=a;else if(6===a.length)this.r=b.toHex(a.substring(0,2)),this.g=b.toHex(a.substring(2,4)),this.b=b.toHex(a.substring(4,6)),this.colorStr="#"+a;else if(8===a.length)this.r=b.toHex(a.substring(2,4)),this.g=b.toHex(a.substring(4,6)),this.b=b.toHex(a.substring(6,8)),this.a=1-b.toHex(a.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===a[0]){p=[];d=this.splitComa(a.substring(1,
a.length-1));a=0;for(g=d.length;a<g;a++)n=d[a],l=parseInt(n,16),n!==l.toString(16)&&n!=="0"+l.toString(16)?("["===n.charAt(0)&&"]"===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),p.push(this.evaluator.parser.parse(n))):p.push(this.evaluator.parser.parse((l/255).toString()));this.rExpr=p[0];this.gExpr=p[1];this.bExpr=p[2];this.aExpr=p[3];this.getColor=this.getColorExp}};B.prototype.splitComa=function(a){e=[];for(var b=m=q=g=0,d=a.length;b<d;b++)f=a[b],"("===f?g++:")"===f?g--:"["===f?q++:"]"===
f?q--:","===f&&0===g&&0===q&&(e.push(a.substring(m,b)),m=b+1);e.push(a.substring(m));return e};B.prototype.getColorStr=function(){return this.colorStr};B.prototype.getColorExp=function(){h=this.evaluator;this.r=a(255*h.eval(this.rExpr));this.g=a(255*h.eval(this.gExpr));this.b=a(255*h.eval(this.bExpr));this.a=1-h.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};B.prototype.getLinearGradient=function(){h=this.evaluator;z=b.ctx.createLinearGradient(h.eval(this.x1),h.eval(this.y1),
h.eval(this.x2),h.eval(this.y2));for(var a=0;a<this.stops.length;a++)v=h.eval(this.stops[a].percentage),v=0>v?0:1<v?1:v,z.addColorStop(v,this.stops[a].color);return z};B.prototype.getPattern=function(){A=this.evaluator.parent;if(y=A.getImage(this.evaluator.eval(this.img_src)))try{return b.ctx.createPattern(y,"repeat")}catch(D){}return"ff00ff"};B.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};b.toHex=function(a){return parseInt("0x"+a,16)};b.RGBAToHexColor=function(a){a=
a.substring(5,a.length-1).split(",");w=parseInt(a[0]).toString(16).padStart(2,"0");u=parseInt(a[1]).toString(16).padStart(2,"0");x=parseInt(a[2]).toString(16).padStart(2,"0");r=(255-parseInt(255*parseFloat(a[3]))).toString(16).padStart(2,"0");return new B(r+w+u+x)};b.Color=B;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){var c=this;this.parent=a;this.container=b.newHTML("div",{class:"DescartesKeyboardContainer"});this.display=b.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=b.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);this.additionalKeys=b.newHTML("div",
{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=b.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=this.delete_pressed=!1;var p,d;this.keyContainer.addEventListener("pointerdown",function(a){if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(a.target.id)){a.target.onpointerleave=function(){clearTimeout(p)};var b=a.target.textContent.trim().toLowerCase();p=setTimeout(function(){c.key_pressed=!0;c.showAditionalKeys(b)},600)}else"k_del"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(d)},
d=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_del"==a.target.id)c.delete_pressed||
c.delete(),clearTimeout(d),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|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(a.target.id))clearTimeout(p),
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 l=!1;this.additionalKeys.addEventListener("pointerdown",function(a){l=!0});this.additionalKeys.addEventListener("pointerup",function(a){l&&(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");l=!1;c.display.focus()})};a.prototype.insert=function(a){this.display.setRangeText(a);this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()};a.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,
this.display.selectionStart-1));this.display.setRangeText("")};a.prototype.addKey=function(a,b,p){return"<div "+(b?"id='"+b+"'":"")+" "+(p?"style='"+p+"'":"")+">"+a+"</div>"};a.prototype.addKeys=function(a){var b=this,c="";a.forEach(function(a){c="object"===typeof a?c+b.addKey(a.val,a.id,a.style):c+b.addKey(a)});return c};a.prototype.showAditionalKeys=function(a){var b=[];"."==a?b=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?b=["-","\u00d7","\u00f7","^"]:"a"==a?b=["\u00e1","\u00e0","\u00e4","\u00e2"]:
"e"==a?b=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?b=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?b=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(b=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(b);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"};
a.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_del"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};a.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_del"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};a.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=
this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_del"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};a.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,{val:"\u232b",id:"k_del"},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"};a.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=
this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_del"},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"};a.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_del"},{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};a.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_del"},"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"};a.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_del",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"};a.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_del"},
{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"};a.prototype.showCustomKB=function(a){var b=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||b.length);var c=[],d,l;b=$jscomp.makeIterator(b);for(d=b.next();!d.done;d=b.next()){var e=d.value;d={val:e.textContent};if(l=e.getAttribute("id"))d.id=l;if(l=e.getAttribute("size"))d.style=
"width:"+(40*parseInt(l)+5*(parseInt(l)-1))+"px;transform:none !important;";c.push(d)}this.keyContainer.innerHTML=this.addKeys(c);this.keyContainer.style.width=5+45*a+"px"};a.prototype.setLayout=function(a){this.layout_mode=a;var b=document.getElementById("kb_"+a);b?this.showCustomKB(b):"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()};a.prototype.show=function(a,b,p,d,l,e,n){this.ctr=a;this.var_id=l;this.onlyText=n;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(e);this.setLayout(b);this.keyContainer.style.left=p+"px";this.keyContainer.style.top=d+"px";this.additionalKeys.style.display="none"};a.prototype.close=function(){this.container.style.display=
"none";this.parent.deactivateControls();this.parent.update()};a.prototype.setDisplay=function(a){if("custom"==a.type){var c=a.x;var p=a.y;var d=a.w;var l=a.h;var e=a.fs}else p=this.container.getBoundingClientRect(),l=a.getBoundingClientRect(),c=l.left/b.cssScale-p.left/b.cssScale,p=l.top/b.cssScale-p.top/b.cssScale,d=l.width/b.cssScale,l=l.height/b.cssScale,e=a.style.fontSize;"textarea"==a.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+c+"px;top:"+p+"px;width:"+d+"px;height:"+l+
"px;font-size:"+e+";line-height:1.2em;padding:5px;font:"+a.style.font+";"),this.newLine.style.left=c+d-42+"px",this.newLine.style.top=p+l-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+c+"px;top:"+p+"px;width:"+d+"px;height:"+l+"px;font-size:"+e+";line-height:"+l+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=a.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};a.prototype.onEnter=
function(){var a=this.display.value;if(!this.onlyText){var b=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{b&&(a=this.parent.evaluator.eval(b))}catch(l){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),b=this.var_id.indexOf("["),-1==b)this.parent.evaluator.setVariable(this.var_id,a);else{var p=this.var_id.indexOf(","),d=this.var_id.substring(0,b);-1==p?this.parent.evaluator.setVector(d,parseInt(this.var_id.substring(b+1)),a):this.parent.evaluator.setMatrix(d,
parseInt(this.var_id.substring(b+1)),parseInt(this.var_id.substring(p+1)),a)}this.close()};b.Keyboard=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=document.head,c=b.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});a.querySelector("meta[name=viewport]")||a.appendChild(c);c=b.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});a.appendChild(c);c=b.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});a.appendChild(c);c=b.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});a.appendChild(c);(a=
document.getElementById("StyleDescartesApps2"))&&a.remove();a=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(a,document.head.firstChild);a.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.DescartesSpaceIframe{position:absolute;left:0;top:0;width:inherit;height:inherit;}\n.DescartesSpaceIframeContainer{position:absolute;background-repeat:no-repeat;background-position:center;}\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("+
b.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("+b.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:"+
b.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;  outline: none;}\n.DescartesSpinnerField:focus,.DescartesTextFieldField:focus,.DescartesMenuField:focus,.DescartesScrollbarField:focus,.DescartesSliderField:focus{border:2px solid #3f88fb;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesSliderLabel,.DescartesTextFieldLabel{font-family:"+
b.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{cursor:pointer;background-color:transparent;touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;border:solid #666 1px;}\n.DescartesTextArea {position:absolute;padding:5px;left:2px;top:2px;background-color:white;text-align:left;border:none;outline:none;resize:none;}\n.DescartesTextArea:focus {outline:3px solid #3f88fb;}\n.DescartesMenuSelect{font-family:"+
b.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('"+b.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:"+
b.createGradient(50,100)+", url('"+b.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+b.createGradient(50,100,90)+", url('"+b.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:"+b.createGradient(0,50)+", url('"+b.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
b.createGradient(50,100,-90)+", url('"+b.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:"+
b.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:"+b.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"+
(b.addSymbolFont?b.addSymbolFont():"")+(b.addFonts?b.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 b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.sin,c=Math.floor,h=Math.random,p=Math.round,d=Math.abs,l=String.fromCharCode,e,n,g,q,m,f,w,u,x,r,v=function(a){this.key=(void 0===a?0:a).toString()};v.prototype.getKey=function(b){e=[];for(var g=0;256>g;g++)e[g]=l(this.alfanum(c(d(7.5*(a(1*g-b)+a(1.4*g+b)+a(.6*g-b)+a(2.2*g+b))))));return e.join("")};v.prototype.encode=function(a){n=c(31*h());this.key=this.getKey(n);return l(this.alfanum(n))+this.encripta(a)};v.prototype.decode=function(a){n=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(n);return this.desencripta(a.substring(1))};v.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};v.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;f=Array(3*a.length);for(var b=0,g=a.length;b<g;b++)x=256*c(a[b]+128)+p(255*h())+65536*p(255*h()),r=c((x<<this.shift(b))/256),f[3*b]=this.alfanum(r%32),f[3*b+1]=this.alfanum(r/32%32),f[3*b+2]=this.alfanum(r/1024%32);return f};v.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};v.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;w=Array(a.length/3);for(var b=0,g=w.length;b<g;b++)r=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),x=c(256*r>>this.shift(b)),u=c(x/256)%256-128,0>u&&(u+=256),w[b]=u;return w};v.prototype.alfanum=function(a){return(10>a?48:87)+c(a)};v.prototype.numalfa=function(a){return a-(58>a?48:87)};v.prototype.stringToBytes=
function(a){q=[];for(var b=0,g=a.length;b<g;b++)q.push(a.charCodeAt(b));return q};v.prototype.bytesToString=function(a){for(var b=0,g=a.length;b<g;b++)a[b]=l(a[b]);return a.join("")};v.prototype.shift=function(a){g=this.key.charCodeAt(a%this.key.length);q=this.numalfa(g);m=c(q/2%8);0==m&&(m=4);return m};v.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};b.Krypto=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(a,c){var d=this;d.parent=a;var l=a.evaluator;a=l.parser;d.delay=a.parse(c.delay?c.delay:"60");d.loop=c.loop?c.loop:!1;d.auto=void 0==c.auto?!0:c.auto;d.controls=c.controls;b.parseExpr(d,c,a);d.animExec=function(){for(var a=$jscomp.makeIterator(d.doExpr),c=a.next();!c.done;c=a.next())l.eval(c.value);d.parent.update();d.playing&&(0<l.eval(d.whileExpr)||d.loop)?d.timer=b.setTimeout(d.animExec,l.eval(d.delay)):(d.stop(),d.pause=!1,d.parent.update())};
d.playing=!1;d.auto&&d.play()};c.prototype.play=function(){a=this;a.playing?(a.pause=!0,a.stop()):(a.pause||a.reinit(),a.playing=!0,a.pause=!1,a.timer=b.setTimeout(a.animExec,Math.max(10,a.parent.evaluator.eval(a.delay))))};c.prototype.stop=function(){this.playing=!1;b.clearTimeout(this.timer)};c.prototype.reinit=function(){for(var a=$jscomp.makeIterator(this.init),b=a.next();!b.done;b=a.next())this.parent.evaluator.eval(b.value)};b.Animation=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.parent=a;this.parameter=(void 0===b?"":b).replace(/\\n/g,"\n").replace(/&squot;/g,"'")};a.prototype.execute=function(){alert(this.parameter)};b.Message=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=this;this.parent=a;h=b.splitSeparator(((void 0===h?"":h)||"").replace(/&squot;/g,"'"));this.inst=h.map(function(a){return c.parent.evaluator.parser.parse(a,!0)}).filter(function(a){return a})};a.prototype.execute=function(){for(var a=$jscomp.makeIterator(this.inst),b=a.next();!b.done;b=a.next())this.parent.evaluator.eval(b.value)};b.Calculate=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.parent=a;this.param=b.trim();this.target="_blank"};a.prototype.execute=function(a){a=void 0===a?"":a;var c=this.param,d=c.match(/^(.*)\s*target=(.*)/);d&&(c=d[1].trim(),this.target=d[2].trim());/^\[.*\]$/.test(c)&&(c=this.parent.evaluator.eval(this.parent.evaluator.parser.parse(c.slice(1,-1))));if(d=c.match(/^javascript:(.*)$/)){c=new b.SimpleText(this.parent,d[1].replace(/&squot;/g,"'"));try{(new Function(c.toString()))()}catch(l){}}else/^(http|www)/.test(c)||
(d=window.__dirname||window.location.href,c=d.substring(0,d.lastIndexOf("/")+1)+c),c.startsWith("www.")&&(c="https://"+c),window.open(c,this.target,a)};var c=function(b,c){return a.call(this,b,c)||this};$jscomp.inherits(c,a);c.prototype.execute=function(){a.prototype.execute.call(this,"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")};
b.OpenURL=a;b.OpenScene=c;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.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>")};b.Config=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.init()};b.Init=a;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.clear()};b.Clear=a;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.play()};b.Animate=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.reinitAnimation()};b.InitAnimation=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){b=void 0===b?"":b;this.parent=a;(a=b.match(/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi))?this.filename=this.parent.evaluator.parser.parse("'"+a+"'"):(/^\[.*\]$/.test(b)&&(b=b.slice(1,-1)),this.filename=this.parent.evaluator.parser.parse(b))};a.prototype.execute=function(){var a=this.parent.getAudio(this.parent.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=0)};b.PlayAudio=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p=function(b,c){a=this;a.parent=b;a.evaluator=b.evaluator;a.id=a.expresion=a.init=a.privateVars=a.doExpr=a.whileExpr="";a.evaluate="onlyOnce";Object.assign(a,c)};p.prototype.firstRun=function(){};p.prototype.update=function(){};b.splitInstructions=function(a,c){c=c?b.splitSeparator(c):[""];return c.map(function(d,c){b.DEBUG.lineCount=c;return a.parse(d,!0)}).filter(function(a){return a})};b.parseExpr=function(a,c,e){b.DEBUG.pName="inicio";a.init=
b.splitInstructions(e,c.init);b.DEBUG.pName="local";a.privateVars=b.getPrivateVariables(e,c.local);b.DEBUG.pName="hacer";a.doExpr=b.splitInstructions(e,c.doExpr);b.DEBUG.pName="mientras";a.whileExpr=e.parse(c.whileExpr)};b.getPrivateVariables=function(a,b){c=[];b=b?b.split(/;|,/):[""];b=$jscomp.makeIterator(b);for(var d=b.next();!d.done;d=b.next())(h=a.parse(d.value,!0))&&c.push(h);a=0;for(b=c.length;a<b;a++)c[a]="assign"===c[a].type?c[a].childs[0].value:"identifier"===c[a].type?c[a].value:"";return c};
b.Auxiliary=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){h=b.Auxiliary.call(this,a,h)||this;var c=h.evaluator;h.expresionString=h.expresion;h.expresion=c.parser.parse(h.expresionString);h.expresion&&c.setVariable(h.id,h.expresion);h.editable&&(h.registerTextField(),a.editableRegionVisible=!0);return h};$jscomp.inherits(a,b.Auxiliary);a.prototype.registerTextField=function(){var a=this,h=a.evaluator,p=b.newHTML("div"),d=b.newHTML("label");d.appendChild(document.createTextNode("___"+a.id+"=___"));
var l=b.newHTML("input");l.value=a.expresionString;l.disabled=!a.editable;p.appendChild(d);p.appendChild(l);l.onkeydown=function(b){13==b.keyCode&&(a.expresion=parser.parse(this.value),h.setVariable(a.id,a.expresion),a.parent.update())};a.parent.editableRegion.textFields.push({container:p,type:"div"})};b.Variable=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){a=b.Auxiliary.call(this,a,h)||this;a.expresion=a.evaluator.parser.parse(a.expresion);a.update();return a};$jscomp.inherits(a,b.Auxiliary);a.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};b.Constant=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l=function(d,c){a=c=b.Auxiliary.call(this,d,c)||this;h=d.evaluator.parser;a.size=a.size||h.parse("3");a.expresion=a.expresion.split(";");a.parseFile=h.parse(a.file);a.update();return c};$jscomp.inherits(l,b.Auxiliary);l.prototype.update=function(){var e=this;a=this;var l=a.expresion,g;c=a.evaluator;h=c.parser;a.oldFile=a.file;if(p=c.eval(a.parseFile))a.file=p;a.file&&(d=(g=document.getElementById(a.file))&&"descartes/vectorFile"==g.type?
g.text:b.openFile(a.file),null!=d&&(d=d.replace(/\r/g,"").split("\n"),d=d.filter(function(a){return""!==a.trim()})),null==d||1==d.length&&""==d[0]?(d=[],a.size=h.parse("0")):(l=d,a.size=null),null===a.size&&(a.size=h.parse(l.length+"")));var q,m;l=l.map(function(b,g){(m=h.parse(b,!0))&&"assign"!==m.type&&(q=NaN,","==e.parent.decimal_symbol&&(q=parseFloat(b.replace(",","."))),m=h.parse(a.id+"["+g+"]="+(isNaN(q)?b:q),!0));return m});g=Array(parseInt(Math.abs(c.eval(a.size)))).fill(0);g._size_=g.length;
c.vectors[a.id]=g;c.setVariable(a.id+".long",g._size_);l=$jscomp.makeIterator(l);for(g=l.next();!g.done;g=l.next())c.eval(g.value)};b.Vector=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n=/'[^']*'|"[^"]*"|[^,']+/g,g=/'[^']*'|"[^"]*"|[^;']+/g,q=function(m,q){a=q=b.Auxiliary.call(this,m,q)||this;c=m.evaluator;h=c.parser;a.rows=a.rows||h.parse("3");a.columns=a.columns||h.parse("3");if(a.file){var f=document.getElementById(a.file);e=f&&"descartes/matrixFile"==f.type?f.text:b.openFile(a.file);var u,x;null!=e&&(d=0,p=null,e=e.replace(/\r/g,"").split("\n"),a.expresion=[],e.forEach(function(b){b&&(u="."==m.decimal_symbol?b.trim().match(n)||
[]:b.trim().match(g)||[],null==p&&(p=u.length),u.forEach(function(b,g){b=b.trim();x="."==m.decimal_symbol?parseFloat(b):parseFloat(b.replace(",","."));isNaN(x)&&!/^'.*'$/.test(b)?(x=b.replace(/^"(.*)"$/,"$1"),x="'"+x+"'"):(","==m.decimal_symbol&&(b=b.replace(",",".")),x=b);a.expresion.push(h.parse(a.id+"["+d+","+g+"]:="+x))}),d++)}),a.rows=h.parse(p+""),a.columns=h.parse(d+""));if(null==e||1==e.length&&""==e[0])a.expresion=[],a.rows=h.parse("0"),a.columns=h.parse("0")}else a.expresion=b.splitInstructions(h,
a.expresion),p=c.eval(a.rows),d=c.eval(a.columns);l=[];l.type="matrix";f=0;for(var r=d;f<r;f++)l[f]=Array(p).fill(0);c.matrices[a.id]=l;a.update();return q};$jscomp.inherits(q,b.Auxiliary);q.prototype.update=function(){a=this;c=a.evaluator;l=c.matrices[a.id];l.rows=c.eval(a.rows);l.cols=c.eval(a.columns);c.setVariable(a.id+".filas",l.rows);c.setVariable(a.id+".columnas",l.cols);for(var b=$jscomp.makeIterator(a.expresion),g=b.next();!g.done;g=b.next())c.eval(g.value)};b.Matrix=q;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=b.Auxiliary.call(this,a,h)||this;var d=c.evaluator;a=d.parser;h=c.id.indexOf("(");c.name=c.id.substring(0,h);c.params=c.id.substring(h+1,c.id.indexOf(")"));c.domain=c.range?a.parse(c.range):a.parse("1");c.params=""===c.params?[]:c.params.split(",");c.numParams=c.params.length;c.algorithm||(c.init=c.doExpr=c.whileExpr="");b.parseExpr(c,c,a);c.expresion=a.parse(c.expresion);var l;c.functionExec=function(){var a=arguments,h=0;if(c.numParams<=
arguments.length){for(var g=[],q=$jscomp.makeIterator(c.privateVars),m=q.next();!m.done;m=q.next())m=m.value,g.push(d.getVariable(m)),d.setVariable(m,0);var f=[];c.params.forEach(function(b,g){f.push(d.getVariable(b));d.setVariable(b,a[g])});q=$jscomp.makeIterator(c.init);for(m=q.next();!m.done;m=q.next())d.eval(m.value);l=d.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{q=$jscomp.makeIterator(c.doExpr);for(m=q.next();!m.done;m=q.next())d.eval(m.value);if(++h>l)return console.warn("se ha excedido el l\u00edmite de "+
l+" repeticiones en la funci\u00f3n \u00ab"+c.name+"\u00bb"),0}while(0<d.eval(c.whileExpr));h=d.eval(c.expresion);b.rangeOK=d.eval(c.domain);c.params.forEach(function(a,b){d.setVariable(a,f[b])});c.privateVars.forEach(function(a,b){d.setVariable(a,g[b])});return h}return 0};d.setFunction(c.name,c.functionExec);return c};$jscomp.inherits(a,b.Auxiliary);b.Function=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h=function(a,c){a=b.Auxiliary.call(this,a,c)||this;b.parseExpr(a,a,a.evaluator.parser);return a};$jscomp.inherits(h,b.Auxiliary);h.prototype.algorithmExec=function(){var b=0;c=this.evaluator;a=c.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var d=$jscomp.makeIterator(this.init),l=d.next();!l.done;l=d.next())c.eval(l.value);do{d=$jscomp.makeIterator(this.doExpr);for(l=d.next();!l.done;l=d.next())c.eval(l.value);if(++b>a)return console.warn("se ha excedido el l\u00edmite de "+
a+" repeticiones en el algoritmo \u00ab"+this.name+"\u00bb"),0}while(0<c.eval(this.whileExpr))};h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};b.Algorithm=h;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=b.Auxiliary.call(this,a,h)||this;a=c.evaluator;delete c.evaluate;c.condition=a.parser.parse(c.condition);c.lastEval=!1;c.action=c.parent.lessonParser.parseAction(c);"onlyOnce"==c.execution&&(c.eventExec=function(){0<c.evaluator.eval(c.condition)&&!c.lastEval&&(c.lastEval=!0,c.action.execute())});"alternate"==c.execution&&(c.eventExec=function(){var a=0<c.evaluator.eval(c.condition);a&&!c.lastEval?(c.action.execute(),c.lastEval=
!0):!a&&c.lastEval&&(c.lastEval=!1)});"always"==c.execution&&(c.eventExec=function(){0<c.evaluator.eval(c.condition)&&c.action.execute()});return c};$jscomp.inherits(a,b.Auxiliary);a.prototype.update=function(){this.eventExec()};b.Event=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=b.Auxiliary.call(this,a,h)||this;h=h.file;var d=null;h&&(d=(d=document.getElementById(h))&&"descartes/library"===d.type?d.text:b.openFile(h));if(d)for(d=b.convertHTMLEntities(d).replace(/\r/g,"").split("\n"),h=$jscomp.makeIterator(d),d=h.next();!d.done;d=h.next())d=d.value,""!==d.trim()&&a.lessonParser.parseAuxiliar(d);return c};$jscomp.inherits(a,b.Auxiliary);b.Library=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g=function(g,c){a=this;a.parent=g;a.evaluator=g.evaluator;var d=a.evaluator.parser;a.spaceID=a.type=a.trace=a.family=a.text="";a.background=a.visible=a.editable=!1;a.drawif=d.parse("1");a.abs_coord=c&&c.type&&"text"===c.type.toLowerCase();a.color=new b.Color("20303a");a.expresion=d.parse("(0,0)");a.family_interval=d.parse("[0,1]");a.family_steps=d.parse("8");a.font="SansSerif,PLAIN,"+(5<=a.parent.version?"18":"12");a.fixed=!0;a.decimals=
d.parse("2");Object.assign(this,c);a.space=a.getSpace();a.canvas=a.background?a.space.backCanvas:a.space.canvas;a.ctx=a.canvas.getContext("2d");a.trace&&(a.traceCtx=a.space.backCtx);a.font_str=a.font;a.font=b.convertFont(a.font);a.fontSize=a.font.match(/([\d\.]+)px/);a.fontSize=a.fontSize?parseFloat(a.fontSize[1]):10;a.font_style=b.getFontStyle(a.font_str.split(",")[1]);if("boolean"===typeof a.bold||"boolean"===typeof a.italics)a.font_style=(a.italics?"Italic ":"")+(a.bold?"Bold ":"");a.font_family||
(a.font_family=a.font_str.split(",")[0]);a.font_family=b.getFontName(a.font_family);"undefined"===typeof a.font_size&&(a.font_size=g.evaluator.parser.parse(a.fontSize.toString()))};g.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};g.prototype.getFamilyValues=function(){a=this;c=a.evaluator;var b=$jscomp.makeIterator(c.eval(a.family_interval)[0]);a.fInf=b.next().value;a.fSup=b.next().value;a.fSteps=Math.round(c.eval(a.family_steps));
a.fSep=0<a.fSteps?(a.fSup-a.fInf)/a.fSteps:0};g.prototype.drawFamilyAux=function(b,g,d){a=this;c=a.evaluator;a.getFamilyValues();h=c.getVariable(a.family);if(0<=a.fSteps)for(var e=0,q=a.fSteps;e<=q;e++)c.setVariable(a.family,a.fInf+e*a.fSep),0<c.eval(a.drawif)&&(a.update(),a.drawAux(b,g,d));c.setVariable("_Text_H_",0);c.setVariable(a.family,h)};g.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([])};g.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))};g.prototype.rotate=function(a,b,g){e=Math.cos(g);n=Math.sin(g);return{x:a*e-b*n,y:a*n+b*e}};g.prototype.dashStyle=function(){l=this.ctx;l.lineCap="butt";switch(this.lineDash){case "dot":l.setLineDash([l.lineWidth,l.lineWidth]);break;case "dash":l.setLineDash([4*l.lineWidth,3*l.lineWidth]);break;
case "dash_dot":l.setLineDash([4*l.lineWidth,2*l.lineWidth,l.lineWidth,2*l.lineWidth]);break;default:l.lineCap="round",l.setLineDash([])}};g.prototype.drawText=function(a,b,g,e,l,h,r,n,z,y,A){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=l.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:g,y:e},b.update(a,g,e,z,y,r,A,l.getColor());else for("simpleText"===b.type&&(b=b.toString(z,y).split("\\n")),c=this.evaluator,a.fillStyle=l.getColor(),a.font=h,a.textAlign=r,a.textBaseline=
n,d=1.2*this.fontSize||0,l=0,h=b.length;l<h;l++)p=b[l],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(p,g,e+d*l)),a.fillText(p,g,e+d*l)};b.Graphic=g;return b}(descartesJS||{});
descartesJS=function(b){function a(a,c,d){d=void 0===d?"":d;for(var g=$jscomp.makeIterator(a),e=g.next();!e.done;e=g.next())if(e=e.value,"identifier"===e.type&&!(b.reservedIds+d).match("-"+e.value+"-")||"R"===e.value||"G"===e.value||"B"===e.value)e.value=c+"."+e.value;return a}function c(b,c,d,g){c=d.tokenize(c.replace(/&squot;/g,"'"));c=a(c,g);return/^\\expr/.test(b)?"\\expr ":"\\decimals "+d.flatTokens(c)}if(b.loadLib)return b;var h,p=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,d=function(d,
e,n,g){var q;h=q=b.Graphic.call(this,d,e)||this;h.hasExpresion=h.hasExpresion||!1;h.graphics=[];Object.assign(h,e);h.hasExpresion=void 0!==h.expresion;if(!h.hasExpresion)return q;"'"!==String(h.expresion).charAt(0)&&(h.expresion="'"+h.expresion+"'");h.expresion=h.evaluator.parser.parse(h.expresion);e=h.evaluator.eval(h.expresion);if(e)var m=(m=document.getElementById(e))&&"descartes/macro"===m.type?m.text:b.openFile(e);if(m){e=b.convertHTMLEntities(m).replace(/\r/g,"").split("\n");m=[];d=d.lessonParser;
var f=new b.Tokenizer,l;e=$jscomp.makeIterator(e);for(l=e.next();!l.done;l=e.next())if(l=l.value,l.includes("=")){l=d.split(l);for(var u=$jscomp.makeIterator(l),x=u.next();!x.done;x=u.next())if((x=x.value)&&1<l.length&&("id"===babel[x[0]]||"type"===babel[x[0]])){m.push(l);break}}x=0;for(var r=m.length;x<r;x++){l=(e=m[x]||[],e[0])&&"id"===e[0][0];u=!1;for(var v=0,z=e.length;v<z;v++){var y=e[v][0];var A=e[v][1];var B=y.indexOf(".");-1===B||l?B=babel[y]:(B=babel[y.substring(B+1)],e[v][0]=h.name+"."+
y);"type"===B&&"surface"===babel[A]&&(u=!0);if(n.includes("3D")){if(("font"===B||"font_family"===B||("fill"===B||"color"===B||"backcolor"===B||"arrow"===B)&&"("!==e[v][1].charAt(0)||"file"===B&&e[v][1].match(p)||"id"!==B&&void 0!==babel[e[v][1]])&&"width"!==B&&"height"!==B&&"length"!==B)continue}else if(("font"===B||"font_family"===B||("fill"===B||"color"===B||"border"===B||"arrow"===B)&&"("!==e[v][1].charAt(0)||"file"===B&&e[v][1].match(p)||"id"!==B&&void 0!==babel[e[v][1]])&&"radius"!==B)continue;
if(u&&"expresion"===B){for(var D=e[v][1].split(" "),I="",E=0,G=D.length;E<G;E++){for(var H=D[E].replace(/&squot;/g,"'").split(";"),C=0,J=H.length;C<J;C++)y=a(H[C].replace(/\\n/g,";"),h.name,n.includes("3D")?"-x-y-z-u-v-":""),H[C]=f.flatTokens(y);I+=H.join(";")+" "}e[v][1]=I}if("text"===B)if(/\{\\rtf1/.test(A))A=A.replace(/\\expr\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,function(a,b){return c(a,b,f,h.name)}).replace(/\\decimals\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,function(a,
b){return c(a,b,f,h.name)});else{A=d.parseText(A).txtEleMacros;B=0;for(D=A.length;B<D;B++)y=f.tokenize(A[B].replace(/&squot;/g,"'")),y=a(y,h.name),A[B]=f.flatTokens(y).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]"),A[B]=A[B].slice(1,-1);A=A.join("")}else{A=A.replace(/&squot;/g,"'").split(";");B=0;for(D=A.length;B<D;B++)y=f.tokenize(A[B].replace(/\\n/g,";")),y=a(y,h.name,n.includes("3D")?"-Euler-":""),A[B]=f.flatTokens(y);A=A.join(";")}e[v][1]=A}}u=0;for(x=m.length;u<x;u++)if(m[u][0]){e=
"";l=!1;r=0;for(v=m[u].length;r<v;r++)"type"===babel[m[u][r][0]]&&g.includes("-"+babel[m[u][r][1]]+"-")&&(l=!0),e+=m[u][r][0]+"='"+m[u][r][1]+"' ";m[u]=e+(l?" space='"+h.spaceID+"'":"");l?h.graphics.push(d[n](m[u],h.abs_coord,h.background,h.inirot)):d.parseAuxiliar(m[u])}}return q};$jscomp.inherits(d,b.Graphic);b.BaseMacro=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n=function(b,c){this.text=c=c.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.txtEle=[];this.txtEleMacros=[];this.parent=b;this.evaluator=b.evaluator;this.type="simpleText";a="'";p=h=0;for(d=-1;h<c.length;)l=c.charAt(h),e=c.charAt(h-1),"["===l&&"\\"===e?(this.txtEle.push(c.substring(p,h-1)+"["),this.txtEleMacros.push("'"+c.substring(p,h-1)+"['"),p=h+1):"]"===l&&"\\"===e?(this.txtEle.push(c.substring(p,h-1)+"]"),this.txtEleMacros.push("'"+
c.substring(p,h-1)+"]'"),p=h+1):"["===l&&-1===d?(this.txtEle.push(c.substring(p,h)),this.txtEleMacros.push("'"+c.substring(p,h)+"'"),p=h,d++):"["===l?d++:"]"===l&&0===d?(this.txtEle.push(this.evaluator.parser.parse(c.substring(p,h+1))),this.txtEleMacros.push("["+c.substring(p,h+1)+"]"),p=h+1,d--):("]"==c.charAt(h)&&(d=0>d?d:d-1),a+=c.charAt(h)),h++;this.txtEle.push(c.substring(p,h));this.txtEleMacros.push("'"+c.substring(p,h)+"'")};n.prototype.toString=function(g,d){a="";for(var e=$jscomp.makeIterator(this.txtEle),
q=e.next();!q.done;q=e.next())q=q.value,"string"===typeof q?a+=q:(c=this.evaluator.eval(q)[0][0],""!==c&&("string"===typeof c?a+=c:Infinity==c?a+="Infinity":-Infinity==c?a+="-Infinity":isNaN(c)||"NaN"==c?a+="NaN":(c=parseFloat(c),c=d?c.toFixed(g):b.removeNeedlessDecimals(c.toFixed(g)),a+=c.toString().replace(".",this.parent.decimal_symbol))));return a};b.SimpleText=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O,F,M=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fillP=c.fillP||"";c.fillM=c.fillM||"";c.parseExpression();c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();f=new b.R2;w=new b.R2;u=new b.R2;x=new b.R2;v=new b.R2;c.cInd=0;return c};$jscomp.inherits(M,b.Graphic);M.prototype.parseExpression=
function(){if("compOperator"===this.expresion.type){var a=this.expresion.childs[0],c=this.expresion.childs[1];"identifier"!=a.type||"y"!=a.value||c.contains("y")?"identifier"!=c.type||"y"!=c.value||a.contains("y")?"identifier"!=a.type||"x"!=a.value||c.contains("x")?"identifier"!=c.type||"x"!=c.value||a.contains("x")||(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=a,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=
c,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new b.R2Newton(this.evaluator,this.expresion)};M.prototype.update=function(){};M.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};M.prototype.drawFamilyAux=function(a,b,g){h=this.evaluator;this.getFamilyValues();c=h.getVariable(this.family);if(0<=this.fSteps)for(var d=0,e=this.fSteps;d<=e;d++)h.setVariable(this.family,this.fInf+d*this.fSep),
this.update(),this.drawAux(a,b,g);h.setVariable(this.family,c)};M.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};M.prototype.drawAux=function(c,N,M){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;h=this.evaluator;p=this.space;d=h.eval(this.width);c.strokeStyle=this.color.getColor();c.lineWidth=d;l=h.getVariable("x");e=h.getVariable("y");n=p.w+24;g=p.h+24;q=n/9;3>q&&(q=3);m=g/7;3>m&&(m=3);0==this.cInd?(a=[],this.cInd++):this.cInd=(this.cInd+1)%
1E7;f.set(0,0);w.set(0,0);u.set(0,0);O=.25;F=8;this.abs_coord||(O/=p.scale,F/=p.scale);c.beginPath();for(C=parseInt(m/2);C<g;C+=m)for(H=parseInt(q/2);H<n;H+=q){if(this.abs_coord){v.set(H,C);r=this.newt.findZero(v,O);if(null==r)continue;h.setVariable("x",r.x);h.setVariable("y",r.y);x.set(r.x,r.y)}else{v.set(p.getRelativeX(H),p.getRelativeY(C));r=this.newt.findZero(v,O);if(null==r)continue;h.setVariable("x",r.x);h.setVariable("y",r.y);x.set(p.getAbsoluteX(r.x),p.getAbsoluteY(r.y))}z=x.ix();y=x.iy();
if(-12<=z&&z<n+24&&-12<=y&&y<g+24){if(a[z+12+(y+12)*p.w]===this.cInd)continue;a[z+12+(y+12)*p.w]=this.cInd}b.rangeOK&&(c.moveTo(z,y),c.lineTo(z,y));f.x=r.x;f.y=r.y;w.x=r.x;w.y=r.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),u.x=A.x,u.y=A.y,D=B=0,I=!1;2>D;)if(I&&(u.x=-A.x,u.y=-A.y,r.x=f.x,r.y=f.y,w.x=r.x,w.y=r.y,this.abs_coord?x.set(r.x,r.y):x.set(p.getAbsoluteX(r.x),p.getAbsoluteY(r.y)),z=x.ix(),y=x.iy(),I=!1,B=0),r.x+=F*u.x,r.y+=F*u.y,r=this.newt.findZero(r,O),null!=r){h.setVariable("x",
r.x);h.setVariable("y",r.y);u.x=r.x-w.x;u.y=r.y-w.y;u.normalize();if(0==u.x&&0==u.y)break;w.x=r.x;w.y=r.y;this.abs_coord?x.set(r.x,r.y):x.set(p.getAbsoluteX(r.x),p.getAbsoluteY(r.y));E=parseInt(x.ix());G=parseInt(x.iy());if(E!=z||G!=y)if(J=z,P=y,z=E,y=G,-12<=z&&z<n+24&&-12<=y&&y<g+24){B=0;R=a[z+12+(y+12)*p.w];a[z+12+(y+12)*p.w]=this.cInd;for(N=1;8>N;N++)L=J+Math.round((z-J)*N/8),Q=P+Math.round((y-P)*N/8),0<=L&&L<n&&0<=Q&&Q<g&&(a[L+12+(Q+12)*p.w]=this.cInd);b.rangeOK&&(c.moveTo(J,P),c.lineTo(z,y));
if(R===this.cInd)break}else I=!0,D++;else 4<++B&&(I=!0,D++)}}c.stroke();h.setVariable("x",l);h.setVariable("y",e)}};M.prototype.X=function(a,b,c){c||(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};M.prototype.Y=function(a,b,c){c||(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};M.prototype.XX=function(a,b,c){return Math.round(this.X(a,b,c))};M.prototype.YY=function(a,b,c){return Math.round(this.Y(a,
b,c))};M.prototype.extrapolate=function(a,c,g,d,e,m){h=this.evaluator;for(var q=h.getVariable(c),f=m/2,l=0,p,r,n,B,u,w;1E-15<Math.abs(f);){p=h.getVariable(c);r=h.getVariable(c)+f;h.setVariable(c,r);n=!0;try{B=e,e=h.eval(this.funExpr),h.setVariable(g,e),0<h.eval(a)?(u=new b.R2(Math.min(B,e),Math.max(B,e)),w=0,w=0<m?this.Singularity(Math.abs(f),c,d,p,B,r,e,u):this.Singularity(Math.abs(f),c,d,r,e,p,B,u),0<w&&(n=!1)):n=!1}catch(ea){n=!1}n?l+=f:h.setVariable(c,p);f/=2}h.setVariable(c,q);return new b.R2(l/
Math.abs(m),e)};M.prototype.extrapolateOnSingularity=function(a,c,g,d,e,m){h=this.evaluator;d=h.getVariable(c);for(var q=m/2,f=0,l=e,p;1E-15<Math.abs(q);){h.setVariable(c,h.getVariable(c)+q);p=!0;if(0<h.eval(a))try{l=h.eval(this.funExpr),h.setVariable(g,l),0>=h.eval(a)&&(p=!1)}catch(Y){p=!1}else p=!1;p?f+=q:h.setVariable(c,h.getVariable(c)-q);q/=2}if(0==f)for(q=m/2,f=m,l=e;1E-15<Math.abs(q);){h.setVariable(c,h.getVariable(c)-q);g=!0;if(0<h.eval(a))try{l=h.eval(this.funExpr)}catch(Y){g=!1}else g=!1;
g?f+=-q:h.setVariable(c,h.getVariable(c)+q);q/=2}h.setVariable(c,d);return new b.R2(f/Math.abs(m),l)};M.prototype.Singularity=function(a,b,c,g,d,e,m,q){h=this.evaluator;if(isNaN(m)||isNaN(d)||isNaN(q.y)||isNaN(q.x)||g>=e)return 2;var f=h.getVariable(b),l=0;try{if(1E-15>Math.abs(e-g)||1E-12>Math.abs(e-g)&&Math.abs(m-d)>Math.abs(a))return h.setVariable(b,f),1;var p=(g+e)/2;h.setVariable(b,p);var r=NaN;try{r=h.eval(this.funExpr)}catch(ca){return 2}if(isNaN(r))return 5;if(Math.abs(m-d)>a){h.setVariable(b,
g-1E-12);var n=h.eval(this.funExpr);n=(d-n)/1E-12;h.setVariable(b,e+1E-12);var B=(h.eval(this.funExpr)-m)/1E-12;if((10>Math.abs(B)||10>Math.abs(n))&&(0<=B&&0<=n||0>=B&&0>=n)&&4*Math.abs(B)<Math.abs((m-d)/(e-g)))return h.setVariable(b,f),2}if(isNaN(q.x)||isNaN(q.y)||isNaN(r))return 2;if(!(q.x<=r&&r<=q.y)){h.setVariable(b,p);q.x=Math.min(d,r);q.y=Math.max(d,r);var u=this.Singularity(a/2,b,c,g,d,p,r,q);h.setVariable(b,e);q.x=Math.min(m,r);q.y=Math.max(m,r);var w=this.Singularity(a/2,b,c,p,r,e,m,q);l=
Math.max(u,w)}}catch(ca){l=1}h.setVariable(b,f);return l};M.prototype.drawAuxFun=function(a,c,g){h=this.evaluator;l=h.getVariable("x");e=h.getVariable("y");b.rangeOK=1;c="x";var d="y";this.of_y&&(c="y",d="x");var m=this.drawif,q=h.eval(this.width),f=!1,p=new b.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?p.ix():p.iy(),n=0,B=0,u=0,w=0,x=1/this.space.scale;p=x*(this.of_y?-this.space.h+p.y:-p.x);var v=0;this.abs_coord&&(p=0,x=1);for(var D,y,G,z,A,C,H,O,E,Q=this.of_y?this.space.h+
2:this.space.w+2;u<=Q;){D=!0;y=0;h.setVariable(c,p);try{G=h.eval(this.funExpr),isNaN(G)||(h.setVariable(d,G),0<h.eval(this.drawif)&&b.rangeOK?(f?(z=Math.min(v,G),A=Math.max(v,G),C=new b.R2(z,A),y=this.Singularity(x,c,0,p-x,v,p,G,C),0===y?(v<=G?(v=C.x,G=C.y):(G=C.x,v=C.y),H=parseInt(this.of_y?this.XX(q,v,this.abs_coord):this.YY(q,v,this.abs_coord)),n=this.abs_coord?Math.round(G):parseInt(this.of_y?this.XX(q,G,this.abs_coord):this.YY(q,G,this.abs_coord)),this.fillM&&n>r&&(a.lineWidth=1,a.strokeStyle=
this.fillM.getColor(),a.beginPath(),this.of_y?(a.moveTo(r+1,this.space.h-u+.5),a.lineTo(n,this.space.h-u+.5)):(a.moveTo(u+.5,r+1),a.lineTo(u+.5,n)),a.stroke()),this.fillP&&n<r&&(a.lineWidth=1,a.strokeStyle=this.fillP.getColor(),a.beginPath(),this.of_y?(a.moveTo(r-1,this.space.h-u+.5),a.lineTo(n,this.space.h-u+.5)):(a.moveTo(u+.5,r-1),a.lineTo(u+.5,n)),a.stroke()),a.lineWidth=q,a.strokeStyle=g.getColor(),a.beginPath(),this.of_y?(a.moveTo(H+.5,this.space.h-w),a.lineTo(n+.5,this.space.h-u)):(a.moveTo(w+
.5,H),a.lineTo(u+.5,n)),a.stroke()):1===y?(h.setVariable(c,p-x),O=this.extrapolate(m,c,d,0,v,x),n=this.of_y?this.XX(q,O.y,this.abs_coord):this.YY(q,O.y,this.abs_coord),a.lineWidth=q,a.strokeStyle=g.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-w),a.lineTo(n+.5,this.space.h-w+Math.round(O.x))):(a.moveTo(w+.5,B),a.lineTo(w+Math.round(O.x)+.5,n)),h.setVariable(c,p),E=this.extrapolate(m,c,d,0,G,-x),B=this.of_y?this.XX(q,E.y,this.abs_coord):this.YY(q,E.y,this.abs_coord),n=this.of_y?this.XX(q,
G,this.abs_coord):this.YY(q,G,this.abs_coord),a.lineWidth=q,a.strokeStyle=g.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-u),a.lineTo(n+.5,this.space.h-u)):(a.moveTo(u+.5,B),a.lineTo(u+.5,n)),a.stroke()):2===y&&(n=this.of_y?this.XX(q,G,this.abs_coord):this.YY(q,G,this.abs_coord),a.lineWidth=q,a.strokeStyle=g.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-u),a.lineTo(n+.5,this.space.h-u)):(a.moveTo(u+.5,B),a.lineTo(u+.5,n)))):(E=this.extrapolateOnSingularity(m,c,d,
0,G,-x),B=this.of_y?this.XX(q,E.y,this.abs_coord):this.YY(q,E.y,this.abs_coord),n=this.of_y?this.XX(q,G,this.abs_coord):this.YY(q,G,this.abs_coord),a.lineWidth=q,a.strokeStyle=g.getColor(),a.beginPath(),this.of_y?(a.moveTo(B,this.space.h-(u+Math.round(E.x))+.5),a.lineTo(n,this.space.h-u+.5)):(a.moveTo(u+Math.round(E.x),B),a.lineTo(u,n)),a.stroke()),v=G):D=!1)}catch(fa){D=!1}f&&!D&&(h.setVariable(c,p-x),h.setVariable(d,v),O=this.extrapolate(m,c,d,0,v,x),n=parseInt(this.of_y?this.XX(q,O.y,this.abs_coord):
this.YY(q,O.y,this.abs_coord)),0<h.eval(this.drawif)&&b.rangeOK&&(a.lineWidth=q,a.strokeStyle=g.getColor(),a.beginPath(),this.of_y?(a.moveTo(B,this.space.h-(w+Math.round(O.x))+.5),a.lineTo(n,this.space.h-(w+Math.round(O.x))+.5)):(a.moveTo(w+Math.round(O.x)+.5,B),a.lineTo(w+Math.round(O.x)+.5,n)),a.stroke()),h.setVariable(c,p));f=D;p+=x;B=n;w=u++}h.setVariable("x",l);h.setVariable("y",e)};M.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=
!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parseExpression(),a.parent.update())};a.parent.editableRegion.textFields.push(c)};b.Equation=M;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,p,d,l,e,n=function(a,c){c=b.Graphic.call(this,a,c)||this;c.param=c.param||"t";c.parameter_interval=c.parameter_interval||a.evaluator.parser.parse("[0,1]");c.parameter_steps=c.parameter_steps||a.evaluator.parser.parse("8");c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();return c};$jscomp.inherits(n,b.Graphic);n.prototype.update=
function(){c=this.evaluator;var a=$jscomp.makeIterator(c.eval(this.parameter_interval)[0]);this.paraInf=a.next().value;this.paraSup=a.next().value;this.pSteps=c.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};n.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};n.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};n.prototype.drawAux=function(g,q,m){c=this.evaluator;
h=this.space;g.lineWidth=Math.max(1E-6,a(c.eval(this.width)));g.lineCap=g.lineJoin="round";g.strokeStyle=m.getColor();p=c.getVariable(this.param);g.beginPath();c.setVariable(this.param,this.paraInf);d=c.eval(this.expresion)[0];this.X=a(this.abs_coord?d[0]:h.getAbsoluteX(d[0]));this.Y=a(this.abs_coord?d[1]:h.getAbsoluteY(d[1]));this.rotateExp&&(l=b.degToRad(c.eval(this.rotateExp)),e=this.rotate(d[0],d[1],l),this.X=a(this.abs_coord?e.x:h.getAbsoluteX(e.x)),this.Y=a(this.abs_coord?e.y:h.getAbsoluteY(e.y)));
g.moveTo(this.X+.5,this.Y+.5);for(m=1;m<=this.pSteps;m++)c.setVariable(this.param,this.paraInf+m*this.paraSep),d=c.eval(this.expresion)[0],this.rotateExp&&(e=this.rotate(d[0],d[1],l),d[0]=e.x,d[1]=e.y),this.X=a(this.abs_coord?d[0]:h.getAbsoluteX(d[0])),this.Y=a(this.abs_coord?d[1]:h.getAbsoluteY(d[1])),!isNaN(this.X)&&!isNaN(this.Y)&&-1E6<this.X&&1E6>this.X&&-1E6<this.Y&&1E6>this.Y&&g.lineTo(this.X+.5,this.Y+.5);this.fill&&(g.fillStyle=q.getColor(),g.fill("evenodd"));this.dashStyle();g.stroke();g.setLineDash([]);
c.setVariable(this.param,p)};n.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parent.update())};a.parent.editableRegion.textFields.push(c);console.log(a.parent.editableRegion.textFields)};b.Curve=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,c=Math.round,h,p,d,l,e,n,g,q,m,f=function(a,c){c=b.Graphic.call(this,a,c)||this;c.size=c.size||a.evaluator.parser.parse("2");c.range=c.range||a.evaluator.parser.parse("[1, 100]");c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();return c};$jscomp.inherits(f,b.Graphic);f.prototype.update=function(){h=this.evaluator;var a=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=a.next().value;this.Y=
a.next().value;this.rotateExp&&(d=this.rotate(this.X,this.Y,b.degToRad(h.eval(this.rotateExp))),this.X=d.x,this.Y=d.y);n=h.eval(this.range)[0];this.rangeInf=n[0];this.rangeMax=n[1]};f.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};f.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};f.prototype.drawAux=function(d,f){h=this.evaluator;p=this.space;q=g=Math.ceil(h.eval(this.size)-.4);d.fillStyle=f.getColor();d.beginPath();
this.rangeInf>this.rangeMax&&(m=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=m);f=h.getVariable("n");for(var n=this.rangeInf,r=this.rangeMax;n<=r;n++){h.setVariable("n",n);var u=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=u.next().value;this.Y=u.next().value;l=c(this.abs_coord?this.X:p.getAbsoluteX(this.X));e=c(this.abs_coord?this.Y:p.getAbsoluteY(this.Y));d.beginPath();d.arc(l,e,g,0,a);d.fill()}d.fill();this.text!=[""]&&(this.fontSize=Math.max(5,h.eval(this.font_size)),this.font=
this.font_style+" "+this.fontSize+"px "+this.font_family,b.Graphic.prototype.drawText.call(this,d,this.text,l+q,e-q,this.color,this.font,"start","alphabetic",h.eval(this.decimals),this.fixed,!0));h.setVariable("n",f)};f.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parent.update())};a.parent.editableRegion.textFields.push(c)};b.Sequence=
f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,c=Math.round,h,p,d,l,e,n,g=function(a,c){c=b.Graphic.call(this,a,c)||this;c.size=c.size||a.evaluator.parser.parse("2");c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(g,b.Graphic);g.prototype.update=function(){h=this.evaluator;var a=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=a.next().value;this.Y=a.next().value;this.rotateExp&&(d=this.rotate(this.X,this.Y,b.degToRad(h.eval(this.rotateExp))),this.X=d.x,this.Y=d.y)};
g.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};g.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};g.prototype.drawAux=function(b,g){p=this.space;b.fillStyle=g.getColor();l=c(this.abs_coord?this.X:p.getAbsoluteX(this.X));e=c(this.abs_coord?this.Y:p.getAbsoluteY(this.Y));n=c(this.evaluator.eval(this.size));0<n&&(b.beginPath(),b.arc(l,e,n,0,a),b.fill());this.text.hasContent&&this.text.draw(b,g,l,e)};b.Point=g;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c=2*Math.PI,h,p,d,l,e,n,g,q,m,f,w,u=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.size=c.size||a.evaluator.parser.parse("2");c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(u,b.Graphic);u.prototype.update=function(){h=this.evaluator;d=h.eval(this.expresion);this.points=[];for(var a=0,c=d.length;a<c;a++)this.points[a]={x:d[a][0],y:d[a][1]};if(this.rotateExp)for(l=b.degToRad(h.eval(this.rotateExp)),a=
0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,this.points[a].y,l)};u.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};u.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};u.prototype.drawAux=function(b,d,l){h=this.evaluator;p=this.space;w=a(h.eval(this.width));b.lineWidth=Math.max(1E-6,w);e=h.eval(this.size);b.fillStyle=d.getColor();b.strokeStyle=l.getColor();b.lineCap="round";n=0==b.lineWidth%
2?0:.5;this.abs_coord?(g=a(this.points[0].x),q=a(this.points[0].y),m=a(this.points[1].x),f=a(this.points[1].y)):(g=a(p.getAbsoluteX(this.points[0].x)),q=a(p.getAbsoluteY(this.points[0].y)),m=a(p.getAbsoluteX(this.points[1].x)),f=a(p.getAbsoluteY(this.points[1].y)));b.beginPath();b.moveTo(g+n,q+n);b.lineTo(m+n,f+n);this.dashStyle();b.stroke();0<e&&(b.beginPath(),b.arc(g,q,e,0,c),b.arc(m,f,e,0,c),b.fill());b.setLineDash([]);this.text.hasContent&&this.text.draw(b,l,parseInt((g+m)/2)-3,parseInt((q+f)/
2)+3)};b.Segment=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=Math.round,h,p,d,l,e,n,g,q,m,f,w,u,x,r=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("5");c.size=c.size||a.evaluator.parser.parse("2");c.spear=c.spear||a.evaluator.parser.parse("8");c.arrow=c.arrow||new b.Color("ee0022");c.text=new b.TextObject(c,c.text);c.V=new b.Vector2D(0,0);c.points=[];return c};$jscomp.inherits(r,b.Graphic);r.prototype.update=function(){h=this.evaluator;p=h.eval(this.expresion);
for(var a=0,c=p.length;a<c;a++)this.points[a]={x:p[a][0],y:p[a][1]};if(this.rotateExp)for(d=b.degToRad(h.eval(this.rotateExp)),a=0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,this.points[a].y,d)};r.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.arrow,this.color)};r.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};r.prototype.drawAux=function(b,d,r){h=this.evaluator;l=this.space;p=this.points;e=Math.max(0,
h.eval(this.width));n=Math.ceil(e/2);g=l.scale;this.V.x=p[1].x-p[0].x;this.V.y=p[1].y-p[0].y;q=this.V.vLength();this.angle=Math.atan2(this.V.y,this.V.x);b.fillStyle=d.getColor();b.strokeStyle=r.getColor();b.lineWidth=2;this.abs_coord?(m=c(p[0].x),f=c(p[0].y),w=c(p[1].x),u=c(p[1].y)):(m=c(l.getAbsoluteX(p[0].x)),f=c(l.getAbsoluteY(p[0].y)),w=c(l.getAbsoluteX(p[1].x)),u=c(l.getAbsoluteY(p[1].y)));x=Math.max(0,h.eval(this.spear));b.save();b.translate(m,f);this.abs_coord?b.rotate(this.angle):(q*=g,b.rotate(-this.angle));
b.beginPath();b.moveTo(-n,a(-n));b.lineTo(a(q-x-e),a(-n));b.lineTo(a(q-2*x),a(-x-n));b.lineTo(a(q),0);b.lineTo(a(q-2*x),a(x+n));b.lineTo(a(q-x-e),a(n));b.lineTo(-n,a(n));b.closePath();b.stroke();b.fill();b.restore();this.text.hasContent&&this.text.draw(b,r,parseInt((m+w)/2)-3,parseInt((f+u)/2)+3)};b.Arrow=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,p,d,l,e,n,g,q=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.points=[];return c};$jscomp.inherits(q,b.Graphic);q.prototype.update=function(){c=this.evaluator;p=c.eval(this.expresion);for(var a=0,g=p.length;a<g;a++)this.points[a]={x:p[a][0],y:p[a][1]};if(this.rotateExp)for(d=b.degToRad(c.eval(this.rotateExp)),a=0,g=this.points.length;a<g;a++)this.points[a]=this.rotate(this.points[a].x,
this.points[a].y,d)};q.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};q.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(b,d,q){c=this.evaluator;h=this.space;l=a(c.eval(this.width));b.lineWidth=Math.max(1E-6,l);b.strokeStyle=q.getColor();b.lineCap=b.lineJoin="round";e=0<l?.5:0;n=a(this.abs_coord?this.points[0].x:h.getAbsoluteX(this.points[0].x));g=a(this.abs_coord?this.points[0].y:h.getAbsoluteY(this.points[0].y));
b.beginPath();b.moveTo(n+e,g+e);q=1;for(var m=this.points.length;q<m;q++)n=a(this.abs_coord?this.points[q].x:h.getAbsoluteX(this.points[q].x)),g=a(this.abs_coord?this.points[q].y:h.getAbsoluteY(this.points[q].y)),b.lineTo(n+e,g+e);this.fill&&(b.fillStyle=d.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Polygon=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c=Math.min,h=Math.max,p=Math.abs,d,l,e,n,g,q,m,f,w,u,x,r,v=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.border_radius=c.border_radius||a.evaluator.parser.parse("0");return c};$jscomp.inherits(v,b.Graphic);v.prototype.update=function(){d=this.evaluator;q=d.eval(this.expresion);this.X=q[0][0];this.Y=q[0][1];this.w=150;this.h=100;this.rotateExp&&(e=this.rotate(q[0][0],q[0][1],
b.degToRad(d.eval(this.rotateExp))),this.X=e.x,this.Y=e.y);4<=q[0].length&&(this.w=q[0][2],this.h=q[0][3]);q[1]&&2==q[1].length&&(this.w=q[1][0],this.h=q[1][1]);this.w=h(0,this.w);this.h=h(0,this.h)};v.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};v.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};v.prototype.drawAux=function(b,e,q,B){d=this.evaluator;l=this.space;n=a(d.eval(this.width));b.lineWidth=h(1E-6,
n);b.strokeStyle=q.getColor();b.lineCap="round";b.lineJoin="miter";g=0<n?.5:0;m=a(this.abs_coord?this.X:l.getAbsoluteX(this.X))+g;f=a(this.abs_coord?this.Y:l.getAbsoluteY(this.Y))+g;w=this.abs_coord?this.w:this.w*l.scale;u=this.abs_coord?this.h:-this.h*l.scale;x=c(h(0,d.eval(this.border_radius)),.5*p(w),.5*p(u));r=this.abs_coord?1:-1;b.beginPath();0==x?(b.moveTo(m,f),b.lineTo(m+w,f),b.lineTo(m+w,f+u),b.lineTo(m,f+u)):(b.moveTo(m+x,f),b.lineTo(m+w-x,f),b.arcTo(m+w,f,m+w,f+r*x,x),b.lineTo(m+w,f+u-r*
x),b.arcTo(m+w,f+u,m+w-x,f+u,x),b.lineTo(m+x,f+u),b.arcTo(m,f+u,m,f+u-r*x,x),b.lineTo(m,f+r*x),b.arcTo(m,f,m+x,f,x));b.closePath();this.fill&&(b.fillStyle=e.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Rectangle=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.PI,c=a/2,h=2*a,p=Math.round,d=Math.min,l=Math.max,e=Math.acos,n=Math.sqrt,g,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H,C=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.center=c.center||a.evaluator.parser.parse("(0,0)");c.radius=c.radius||a.evaluator.parser.parse("1");c.init=c.init||"0";c.end=c.end||"90";c.init.startsWith("_(")&&(c.iFlag=!0,c.init=c.init.slice(1));c.end.startsWith("_(")&&
(c.eFlag=!0,c.end=c.end.slice(1));c.initExpr=a.evaluator.parser.parse(c.init);c.endExpr=a.evaluator.parser.parse(c.end);c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(C,b.Graphic);C.prototype.update=function(){g=this.evaluator;var p=$jscomp.makeIterator(g.eval(this.center)[0]);this.X=p.next().value;this.Y=p.next().value;q=0;this.rotateExp&&(q=b.degToRad(g.eval(this.rotateExp)),m=Math.cos(q),f=Math.sin(q),w=this.X*m-this.Y*f,u=this.X*f+this.Y*m,this.X=w,this.Y=u);var G=g.eval(this.initExpr);
p=g.eval(this.endExpr);/^(\(|\[).*(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[).*(\)|\])$/i.test(this.endExpr.type)?(G=$jscomp.makeIterator(G[0]),x=G.next().value,r=G.next().value,p=$jscomp.makeIterator(p[0]),v=p.next().value,z=p.next().value,this.vectors?this.abs_coord&&(r=-r,z=-z):(x-=this.X,r=-r+this.Y,v-=this.X,z=-z+this.Y,this.abs_coord||(r=-r,z=-z)),y=0==x?0>r?3*c:c:e(1*x/n(x*x+r*r)),A=0==v?0>z?3*c:c:e(1*v/n(v*v+z*z)),y+=q,A+=q,0<x&&0<r&&this.abs_coord&&(y=h-y),0<x&&0>r&&!this.abs_coord&&(y=
h-y),0>x&&0>r&&!this.abs_coord&&(y=h-y),0>x&&0<r&&this.abs_coord&&(y=h-y),0<v&&0<z&&this.abs_coord&&(A=h-A),0<v&&0>z&&!this.abs_coord&&(A=h-A),0>v&&0>z&&!this.abs_coord&&(A=h-A),0>v&&0<z&&this.abs_coord&&(A=h-A),this.iFlag?(B=y,y=A,A=B):(B=d(y,A),D=l(y,A),y=B,A=D,A-y>a&&this.abs_coord&&(y=D,A=B),A-y<=a&&!this.abs_coord&&(y=D,A=B)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=b.degToRad(G)+q,this.endAng=b.degToRad(p)+q,this.drawAngle=!0)};C.prototype.draw=function(){b.Graphic.prototype.draw.call(this,
this.fill,this.color)};C.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};C.prototype.drawAux=function(a,b,c){g=this.evaluator;I=this.space;H=Math.max(0,g.eval(this.radius));a.lineWidth=Math.max(1E-6,p(g.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(E=p(this.X),G=p(this.Y)):(E=p(I.getAbsoluteX(this.X)),G=p(I.getAbsoluteY(this.Y)),H*=I.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>
this.endAng&&(c=$jscomp.makeIterator([this.endAng,this.iniAng]),this.iniAng=c.next().value,this.endAng=c.next().value);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(E,G),a.arc(E,G,H,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(E,G,H,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,E,G)};b.Arc=C;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.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 b.TextObject(c,c.text);return c};$jscomp.inherits(d,b.Graphic);d.prototype.update=function(){a=this.evaluator;var d=$jscomp.makeIterator(a.eval(this.expresion)[0]);this.X=d.next().value;this.Y=d.next().value;this.rotateExp&&
(c=this.rotate(this.X,this.Y,b.degToRad(a.eval(this.rotateExp))),this.X=c.x,this.Y=c.y)};d.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color)};d.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace)};d.prototype.drawAux=function(a,b){this.abs_coord?(h=parseInt(this.X),p=parseInt(this.Y)):(h=parseInt(this.space.getAbsoluteX(this.X)),p=parseInt(this.space.getAbsoluteY(this.Y)));this.text.draw(a,b,h,p)};b.Text=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,p,d,l,e,n,g,q,m,f,w=function(a,c){f=c=b.Graphic.call(this,a,c)||this;f.file=f.file||"";f.inirot=f.inirot||a.evaluator.parser.parse("0");f.img=new Image;f.scaleX=f.scaleY=1;f.ratio=a.ratio;a=f.expresion.getChildren();f.x_e=a[0];f.y_e=a[1];2<a.length&&(f.centered=!0,f.s_x_e=a[2],f.s_y_e=3<a.length?a[3]:a[2]);f.evaluator.eval(f.clip)&&(f.clip=f.clip.getChildren());f.update();return c};$jscomp.inherits(w,b.Graphic);w.prototype.update=
function(){var a=this;c=a.evaluator;a.X=c.eval(a.x_e);a.Y=c.eval(a.y_e);a.rotateExp&&(h=a.rotate(a.X,a.Y,b.degToRad(c.eval(a.rotateExp))),a.X=h.x,a.Y=h.y);a.centered&&(a.scaleX=c.eval(a.s_x_e),a.scaleY=c.eval(a.s_y_e),0==a.scaleX&&(a.scaleX=1E-5),0==a.scaleY&&(a.scaleY=1E-5));if((p=c.eval(a.file))||""==p)a.img=a.parent.getImage(p),a.img.hasUpdate||(a.img.hasUpdate=!0,a.img.addEventListener("load",function(){a.space.update(!0)}))};w.prototype.draw=function(){b.Graphic.prototype.draw.call(this)};w.prototype.drawTrace=
function(){b.Graphic.prototype.drawTrace.call(this)};w.prototype.drawAux=function(h){f=this;c=f.evaluator;f.img&&f.img.ready&&f.img.complete&&(f.clip?(q=c.eval(f.clip[2]),m=c.eval(f.clip[3])):(q=f.img.width,m=f.img.height,f.img.canvas&&(q=a(q/f.img.ratio),m=a(m/f.img.ratio))),d=f.centered?0:a(q/2),l=f.centered?0:a(m/2),e=a(f.abs_coord?f.X:f.space.getAbsoluteX(f.X)),n=a(f.abs_coord?f.Y:f.space.getAbsoluteY(f.Y)),g=b.degToRad(-c.eval(f.inirot)),h.save(),h.translate(e+d,n+l),h.rotate(g),f.opacity&&(h.globalAlpha=
c.eval(f.opacity)),h.scale(f.scaleX,f.scaleY),f.clip?f.img.canvas?h.drawImage(f.img,c.eval(f.clip[0])*f.img.ratio,c.eval(f.clip[1])*f.img.ratio,q*f.img.ratio,m*f.img.ratio,-q/2,-m/2,q,m):h.drawImage(f.img,c.eval(f.clip[0]),c.eval(f.clip[1]),q,m,-q/2,-m/2,q,m):h.drawImage(f.img,-q/2,-m/2,q,m),h.restore())};b.Image=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n=document.createElement("canvas").getContext("2d");n.canvas.width=1;n.canvas.height=1;var g=function(a,c){return b.Graphic.call(this,a,c)||this};$jscomp.inherits(g,b.Graphic);g.prototype.update=function(){var a=$jscomp.makeIterator(this.evaluator.eval(this.expresion)[0]);this.X=a.next().value;this.Y=a.next().value};g.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};g.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};g.prototype.drawAux=function(b,g){g=g.getColor();n.clearRect(0,0,1,1);n.fillStyle=g;n.fillRect(0,0,1,1);g=(new Uint32Array(n.getImageData(0,0,1,1).data.buffer))[0];l=b.getImageData(0,0,this.space.w,this.space.h);e=new Uint32Array(l.data.buffer);a=parseInt(this.abs_coord?this.X:this.space.getAbsoluteX(this.X));c=parseInt(this.abs_coord?this.Y:this.space.getAbsoluteY(this.Y));var q=l.width;p=0>a||0>c||a>=q||c>=l.height?-1:e[a+c*q];if(-1!=p&&g!=p){h=[a,c];for(d=0;0<h.length&&
!(d++,c=h.pop(),a=h.pop(),q=l.width,p==(0>a||0>c||a>=q||c>=l.height?-1:e[a+c*q])&&(e[a+c*l.width]=g,h.push(a-1,c),h.push(a+1,c),h.push(a,c-1),h.push(a,c+1)),d>=this.space.w*this.space.h););b.putImageData(l,0,0)}};b.Fill=g;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(a,c){var d=b.BaseMacro.call(this,a,c,"parseGraphic","-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-")||this;d.inirot=d.inirot||a.evaluator.parser.parse("0");d.inipos=d.inipos||a.evaluator.parser.parse("(0,0)");Object.assign(d,c);return d};$jscomp.inherits(c,b.BaseMacro);c.prototype.update=function(){a=this.evaluator.eval(this.inipos)[0];this.iniPosX=a[0];this.iniPosY=a[1]};c.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())};b.Macro=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.sqrt,c=Math.sin,h=Math.cos,p=Math.abs,d=function(a,b,c,d){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?1:d;this.D=new Float32Array(4);this.set(a,b,c,d)};d.prototype.set=function(a,b,c,d){this.D[0]=a;this.D[1]=b;this.D[2]=c;this.D[3]=d;return this};d.prototype.norm3D=function(){var b=this.D[0],c=this.D[1],g=this.D[2];return a(b*b+c*c+g*g)};d.prototype.normalize3D=function(a){a=void 0===a?new d:a;var b=this.norm3D();if(0===
b)return a.set(0,0,0,this.w);b=1/b;return a.set(this.D[0]*b,this.D[1]*b,this.D[2]*b,this.w)};d.prototype.dotProduct3D=function(a){return this.D[0]*a.D[0]+this.D[1]*a.D[1]+this.D[2]*a.D[2]};d.prototype.crossProduct3D=function(a,b){b=void 0===b?new d:b;var c=$jscomp.makeIterator(this.D),e=c.next().value,m=c.next().value;c=c.next().value;var f=$jscomp.makeIterator(a.D);a=f.next().value;var l=f.next().value;f=f.next().value;return b.set(m*f-c*l,c*a-e*f,e*l-m*a,b.w)};d.prototype.scalarProd3D=function(a,
b){b=void 0===b?new d:b;return b.set(this.D[0]*a,this.D[1]*a,this.D[2]*a,this.w)};d.prototype.subtract3D=function(a,b){b=void 0===b?new d:b;return b.set(this.D[0]-a.D[0],this.D[1]-a.D[1],this.D[2]-a.D[2],this.w)};d.prototype.add3D=function(a,b){b=void 0===b?new d:b;return b.set(this.D[0]+a.D[0],this.D[1]+a.D[1],this.D[2]+a.D[2],this.w)};d.prototype.equals3D=function(a,b){return p(this.D[0]-a.D[0])<=b&&p(this.D[1]-a.D[1])<=b&&p(this.D[2]-a.D[2])<=b};d.prototype.clone=function(){return new d(this.D[0],
this.D[1],this.D[2],this.D[3])};$jscomp.global.Object.defineProperties(d.prototype,{x:{configurable:!0,enumerable:!0,get:function(){return this.D[0]},set:function(a){this.D[0]=a}},y:{configurable:!0,enumerable:!0,get:function(){return this.D[1]},set:function(a){this.D[1]=a}},z:{configurable:!0,enumerable:!0,get:function(){return this.D[2]},set:function(a){this.D[2]=a}},w:{configurable:!0,enumerable:!0,get:function(){return this.D[3]},set:function(a){this.D[3]=a}}});var l=function(a,b,c,d,m,f,l,h,
p,r,v,z,y,A,B,D){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?0:d;m=void 0===m?0:m;f=void 0===f?0:f;l=void 0===l?0:l;h=void 0===h?0:h;p=void 0===p?0:p;r=void 0===r?0:r;v=void 0===v?0:v;z=void 0===z?0:z;y=void 0===y?0:y;A=void 0===A?0:A;B=void 0===B?0:B;D=void 0===D?0:D;this.D=new Float32Array(16);this.set(a,b,c,d,m,f,l,h,p,r,v,z,y,A,B,D)};l.prototype.set=function(a,b,c,d,m,f,l,h,p,r,v,z,y,A,B,D){var g=this.D;g[0]=a;g[1]=b;g[2]=c;g[3]=d;g[4]=m;g[5]=f;g[6]=l;g[7]=h;g[8]=p;g[9]=r;
g[10]=v;g[11]=z;g[12]=y;g[13]=A;g[14]=B;g[15]=D;return this};l.prototype.setIdentity=function(){var a=this.D;a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this};l.prototype.mulV4=function(a,b){b=void 0===b?new d:b;var c=this.D,e=a.D;a=b.D;var m=e[0],f=e[1],l=e[2];e=e[3];a[0]=m*c[0]+f*c[4]+l*c[8]+e*c[12];a[1]=m*c[1]+f*c[5]+l*c[9]+e*c[13];a[2]=m*c[2]+f*c[6]+l*c[10]+e*c[14];a[3]=m*c[3]+f*c[7]+l*c[11]+e*c[15];return b};l.prototype.translate=
function(a,b){b=void 0===b?(new l).setIdentity():b;var c=this.D,e=b.D;a instanceof d||(a=new d(a.x,a.y,a.z,a.w));var m=a.D[0],f=a.D[1];a=a.D[2];e[0]=c[0];e[1]=c[1];e[2]=c[2];e[3]=c[3];e[4]=c[4];e[5]=c[5];e[6]=c[6];e[7]=c[7];e[8]=c[8];e[9]=c[9];e[10]=c[10];e[11]=c[11];e[12]=c[0]*m+c[4]*f+c[8]*a+c[12];e[13]=c[1]*m+c[5]*f+c[9]*a+c[13];e[14]=c[2]*m+c[6]*f+c[10]*a+c[14];e[15]=c[3]*m+c[7]*f+c[11]*a+c[15];return b};l.prototype.rotateX=function(a,b){b=void 0===b?(new l).setIdentity():b;var d=this.D,e=b.D,
m=c(a);a=h(a);e[0]=d[0];e[1]=d[1];e[2]=d[2];e[3]=d[3];e[4]=d[4]*a+d[8]*m;e[5]=d[5]*a+d[9]*m;e[6]=d[6]*a+d[10]*m;e[7]=d[7]*a+d[11]*m;e[8]=d[4]*-m+d[8]*a;e[9]=d[5]*-m+d[9]*a;e[10]=d[6]*-m+d[10]*a;e[11]=d[7]*-m+d[11]*a;e[12]=d[12];e[13]=d[13];e[14]=d[14];e[15]=d[15];return b};l.prototype.rotateY=function(a,b){b=void 0===b?(new l).setIdentity():b;var d=this.D,e=b.D,m=c(a);a=h(a);e[0]=d[0]*a+d[8]*-m;e[1]=d[1]*a+d[9]*-m;e[2]=d[2]*a+d[10]*-m;e[3]=d[3]*a+d[11]*-m;e[4]=d[4];e[5]=d[5];e[6]=d[6];e[7]=d[7];e[8]=
d[0]*m+d[8]*a;e[9]=d[1]*m+d[9]*a;e[10]=d[2]*m+d[10]*a;e[11]=d[3]*m+d[11]*a;e[12]=d[12];e[13]=d[13];e[14]=d[14];e[15]=d[15];return b};l.prototype.rotateZ=function(a,b){b=void 0===b?(new l).setIdentity():b;var d=this.D,e=b.D,m=c(a);a=h(a);e[0]=d[0]*a+d[4]*m;e[1]=d[1]*a+d[5]*m;e[2]=d[2]*a+d[6]*m;e[3]=d[3]*a+d[7]*m;e[4]=d[0]*-m+d[4]*a;e[5]=d[1]*-m+d[5]*a;e[6]=d[2]*-m+d[6]*a;e[7]=d[3]*-m+d[7]*a;e[8]=d[8];e[9]=d[9];e[10]=d[10];e[11]=d[11];e[12]=d[12];e[13]=d[13];e[14]=d[14];e[15]=d[15];return b};l.prototype.clone=
function(){var a=new l;a.D.set(this.D);return a};b.norm3D=function(a){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));return a.norm3D()};b.normalize3D=function(a){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));return a.normalize3D().clone()};b.dotProduct3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.dotProduct3D(b)};b.crossProduct3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.crossProduct3D(b).clone()};
b.scalarProd3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));return a.scalarProd3D(b).clone()};b.subtract3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.subtract3D(b).clone()};b.add3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.add3D(b).clone()};b.equals3D=function(a,b,c){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.equals3D(b,
c)};b.Vec4D=d;b.Mat4=l;return b}(descartesJS||{});
descartesJS=function(b){function a(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projV[0].x,this.projV[0].y,this.size,0,e),a.fill(),a.stroke())}function c(a,b){a.textNode=null;a.lineCap=a.lineJoin="round";a.lineWidth=.4;a.beginPath();a.moveTo(this.projV[0].x,this.projV[0].y);for(var c=1,d=this.projV.length;c<d;c++)a.lineTo(this.projV[c].x,this.projV[c].y);a.closePath();a.strokeStyle=a.fillStyle;"color"===
this.model?(a.fillStyle=0>this.direction?this.backColor:this.frontColor,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.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 h(a){a.textNode=null;u=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,
this.fVal);this.fontSize=q(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projV[0].x,this.projV[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,u)}function p(a){a.textNode=null;a.lineCap="butt";a.lineJoin="round";a.lineWidth=this.lineWidth;a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projV[0].x,this.projV[0].y);a.lineTo(this.projV[1].x,
this.projV[1].y);"dot"===this.lineDash?a.setLineDash([a.lineWidth,a.lineWidth]):"dash"===this.lineDash?a.setLineDash([4*a.lineWidth,3*a.lineWidth]):"dash_dot"===this.lineDash?a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth]):(a.lineCap="round",a.setLineDash([]));a.stroke()}function d(a,c,d){return b.normalize3D(b.crossProduct3D(b.subtract3D(a,c),b.subtract3D(a,d)))}if(b.loadLib)return b;var l,e=2*Math.PI,n=Math.abs,g=Math.min,q=Math.max,m,f,w,u,x,r,v,z,y,A=function(b,g){Object.assign(this,
b);l=this;l.space=g;l.projV=[];l.spaceV=[];l.newProjV=[];l.newSpaceV=[];"vertex"===l.type?l.draw=a:"face"===l.type?(l.normal=d(l.V[0],l.V[1],l.V[2]),l.draw=c):"text"===l.type?l.draw=h:"edge"===l.type&&(l.draw=p);l.isText&&(l.computeDepth=function(){this.normal={x:0,y:0,z:0};this.projV=this.V;this.depth=this.V[0].z;this.avg=this.V[0]})};A.prototype.computeDepth=function(a){l=this;l.space=a;l.avg={x:0,y:0,z:0};l.removeDoubles();l.normal={x:0,y:1,z:0};l.direction={x:1,y:0,z:0};for(var c=l.V.length,m=
0;m<c;m++)l.spaceV[m]=a.rotateVertex(l.V[m]),l.avg.x+=l.spaceV[m].x,l.avg.y+=l.spaceV[m].y,l.avg.z+=l.spaceV[m].z;l.avg=b.scalarProd3D(l.avg,1/c);l.avg_proy=a.project(l.avg);l.depth=b.norm3D(b.subtract3D(a.eye,l.avg));2<l.V.length&&(l.normal=d(l.spaceV[0],l.spaceV[1],l.spaceV[2]));c=0;for(m=l.V.length;c<m;c++)l.newSpaceV[c]=l.spaceV[c],l.projV[c]=l.newProjV[c]=a.project(l.spaceV[c]);2<l.V.length&&(l.direction=d(l.projV[0],l.projV[1],l.projV[2]).z);l.minDistToEye=Infinity;l.maxDistToEye=-Infinity;
l.minX=Infinity;l.maxX=-Infinity;l.minY=Infinity;l.maxY=-Infinity;c=0;for(m=l.V.length;c<m;c++)r=b.norm3D(b.subtract3D(l.spaceV[c],a.eye)),l.minDistToEye=g(l.minDistToEye,r),l.maxDistToEye=q(l.maxDistToEye,r);a=0;for(c=l.V.length;a<c;a++)l.minX>l.projV[a].x&&(l.minX=l.projV[a].x),l.maxX<l.projV[a].x&&(l.maxX=l.projV[a].x),l.minY>l.projV[a].y&&(l.minY=l.projV[a].y),l.maxY<l.projV[a].y&&(l.maxY=l.projV[a].y)};A.prototype.removeDoubles=function(){l=this;if("edge"!==l.type){x=[];for(var a=0,b=l.V.length;a<
b;a++)(1E-8<n(l.V[a].x-l.V[(a+1)%b].x)||1E-8<n(l.V[a].y-l.V[(a+1)%b].y)||1E-8<n(l.V[a].z-l.V[(a+1)%b].z)||1E-8<n(l.V[a].w-l.V[(a+1)%b].w))&&x.push(l.V[a]);0===x.length&&x.push(l.V[0]);l.V=x}};A.prototype.drawText=function(a,c,d,g,e,l,q,h,p,r,n){m=this.evaluator;a.textNode=c;l=m.eval(this.offset_dist);q=-b.degToRad(m.eval(this.offset_angle));d+=l*Math.cos(q);g+=l*Math.sin(q);a.textNode.pos={x:d,y:g};c.hasContent&&(c.draw(a,e,d,g,!0),w=this.fromPoint?c.textNodes.metrics.w/2:0,f=this.fromPoint?c.textNodes.metrics.h/
2:0,c.draw(a,e,d-w,g-f))};A.prototype.splitFace=function(a){if(this.intersects(a)){var c=null,d=null,g=0,m=0,f,e=this.V,l=a.V;var q=0;for(f=l.length;q<f;q++){var h=this.intersection(l[q],l[(q+1)%f]);if(null!==h)if(null===c){if(c=h,g=q,2===l.length){d=c;break}}else if(!b.equals3D(h,c,1E-8)){d=h;m=q;break}}if(null!==c&&null!==d){q=this.isInterior(c)||this.isInterior(d);var p=f=null;if(!q&&3<=l.length){var r=0;for(e=e.length;r<e;r++)if(h=a.intersection(this.V[r],this.V[(r+1)%e]),null!==h)if(null===f)f=
h;else if(!b.equals3D(h,f,1E-8)){p=h;break}}if(q||null!==f&&null!==p&&a.isInterior(f)&&a.isInterior(p)){p=!0;e=h=null;if(2===l.length)b.equals3D(c,l[0],1E-8)||b.equals3D(c,l[1],1E-8)?p=!1:(h=[],h[0]=l[0],h[1]=c,e=[],e[0]=c,e[1]=l[1]);else for(h=[],e=[],r=k=f=q=0;r<l.length;r++)r<g?h[q++]=l[r]:r==g?(h[q++]=l[r],h[q++]=c,e[f++]=c):r<m?e[f++]=l[r]:r==m?(e[f++]=l[r],e[f++]=d,h[q++]=d):h[q++]=l[r];if(p){c=[];c[0]=new A({V:h,type:"face",frontColor:a.frontColor,backColor:a.backColor,edges:a.edges,model:a.model},
this.space);c[0].removeDoubles();c[0].normal=a.normal;c[1]=new A({V:e,type:"face",frontColor:a.frontColor,backColor:a.backColor,edges:a.edges,model:a.model},this.space);c[1].removeDoubles();c[1].normal=a.normal;if(2<c[0].V.length)return 2<c[1].V.length?c:[c[0]];if(2<c[1].V.length)return[c[1]]}}}}return[a]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(a){var c=this.V;var d=a.V;if(0<c.length){var g=b.dotProduct3D(d[0],
a.normal);var m=b.dotProduct3D(c[0],a.normal);if(1E-8>n(g-m))return!0;for(var f=1,e=c.length;f<e;f++)if(d=b.dotProduct3D(c[f],a.normal),1E-8>n(g-d)||d>g&&m<g||d<g&&m>g)return!0}return!1};A.prototype.intersection=function(a,c){var d=this.V;if(0<d.length){c=b.subtract3D(c,a);var g=b.dotProduct3D(c,this.normal);if(0!==g&&(d=b.dotProduct3D(b.subtract3D(d[0],a),this.normal)/g,-1E-8<d&&1.00000001>d))return b.add3D(a,b.scalarProd3D(c,d))}return null};A.prototype.isInterior=function(a){var c=this.V;if(0<
c.length)for(var d=0,g=b.subtract3D(c[0],a),m=0,f=c.length;m<f;m++){var e=b.subtract3D(c[(m+1)%f],a),l=b.dotProduct3D(b.crossProduct3D(g,e),this.normal);if(1E-8>n(l)){if(0>b.dotProduct3D(g,e))break}else{if(0>d&&0<l||0<d&&0>l)return!1;g=e;d=l}}return!0};A.prototype.inFrontOf=function(a,b,c){if(this.minDistToEye>=b.maxDistToEye||this.maxX<=b.minX||this.minX>=b.maxX||this.maxY<=b.minY||this.minY>=b.maxY)return!1;for(y=0;3>y;y++)if(v=null,v=0===y?this.intersections(b):1===y?b.verticesContainedIn(this):
this.verticesContainedIn(b),null!=v&&0<v.length){for(var d=$jscomp.makeIterator(v),g=d.next();!g.done;g=d.next())a.push(g.value);d=$jscomp.makeIterator(v);for(g=d.next();!g.done;g=d.next()){g=g.value;z=this.space.rayFromEye(g.x,g.y);try{t=this.distanceToEyeAlong(z)-b.distanceToEyeAlong(z);if(t<=-c)return!0;if(t>=c)return!1}catch(H){}}}return!1};A.prototype.intersections=function(a){for(var c=[],d,g,m,f=new b.R2,e=this.newSpaceV,l=a.newSpaceV,q=this.newProjV,h=a.newProjV,p=0,r=e.length;p<r;p++){a=
e[p];d=e[(p+1)%r];for(var n=0,w=l.length;n<w;n++)g=l[n],m=l[(n+1)%w],a!=g&&a!=m&&d!=g&&d!=m&&(g=f.intersection(q[p],q[(p+1)%r],h[n],h[(n+1)%w]),null!=g&&c.push(g))}return c};A.prototype.distanceToEyeAlong=function(a){a=b.dotProduct3D(this.normal,a);if(1E-6<n(a))return b.dotProduct3D(b.subtract3D(this.avg,this.space.eye),this.normal)/a;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var b=[],c=this.newSpaceV,d=this.newProjV,g=0,m=c.length;g<m;g++)!a.isVertex(c[g])&&
a.appearsToContain(d[g])&&b.push(d[g]);return b};A.prototype.appearsToContain=function(a){for(var b=0,c,d=this.newProjV,m=0,f=this.newSpaceV.length;m<f;m++){c=(d[m].x-a.x)*(d[(m+1)%f].y-a.y)-(d[(m+1)%f].x-a.x)*(d[m].y-a.y);if(0!=b)if(1E-8>n(c)){if(1E-8<n(d[m].x-d[(m+1)%f].x))return g(d[m].x,d[(m+1)%f].x)<=a.x+1E-8&&a.x<=q(d[m].x,d[(m+1)%f].x)+1E-8;if(1E-8<n(d[m].y-d[(m+1)%f].y))return g(d[m].y,d[(m+1)%f].y)<=a.y+1E-8&&a.y<=q(d[m].y,d[(m+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(a){for(var c=$jscomp.makeIterator(this.newSpaceV),d=c.next();!d.done;d=c.next())if(b.equals3D(a,d.value,1E-8))return!0;return!1};b.Primitive3D=A;return b}(descartesJS||{});
descartesJS=function(b){function a(a){for(var b=[],c=0,d,g=a.length,m=a.length-1;-1<m;m--)d=a.charAt(m),0==c?"="==d&&(c=1):1==c?" "!=d&&(c="<"===d||">"===d?0:2):2==c&&" "==d&&(b.unshift(a.substring(m+1,g)),g=m,c=0);b.unshift(a.substring(0,g));return b}if(b.loadLib)return b;var c,h=b.degToRad,p,d,l,e,n,g,q=function(a,d){c=this;c.parent=a;c.evaluator=a.evaluator;var m=a.evaluator.parser;c.spaceID="E0";c.background=!1;c.type="";c.color=new b.Color("eeffaa");c.backcolor=new b.Color("6090a0");c.Nu=c.Nv=
c.evaluator.parser.parse("7");c.drawif=m.parse("1");c.abs_coord=!1;c.family="";c.family_interval=m.parse("[0,1]");c.family_steps=m.parse("8");c.font="SansSerif,PLAIN,18";c.fixed=!0;c.text="";c.decimals=m.parse("2");c.inirot=c.endrot="(0,0,0)";c.inirotEuler=c.endrotEuler=!1;c.inipos=c.endpos=m.parse("(0,0,0)");c.model="color";Object.assign(c,d);void 0==c.expresion&&"macro"!==c.type&&(c.expresion=m.parse("(0,0)"));c.space=c.getSpace();c.canvas=c.background?c.space.backCanvas:c.space.canvas;c.ctx=c.canvas.getContext("2d");
c.font_str=c.font;c.font=b.convertFont(c.font);c.fontSize=c.font.match(/([\d\.]+)px/);c.fontSize=c.fontSize?parseFloat(c.fontSize[1]):10;c.font_style=b.getFontStyle(c.font_str.split(",")[1]);if("boolean"===typeof c.bold||"boolean"===typeof c.italics)c.font_style=(c.italics?"Italic ":"")+(c.bold?"Bold ":"");c.font_family||(c.font_family=c.font_str.split(",")[0]);c.font_family=b.getFontName(c.font_family);"undefined"===typeof c.font_size&&(c.font_size=a.evaluator.parser.parse(c.fontSize.toString()));
c.inirot.includes("Euler")&&(c.inirot=c.inirot.replace("Euler",""),c.inirotEuler=!0);c.endrot.includes("Euler")&&(c.endrot=c.endrot.replace("Euler",""),c.endrotEuler=!0);c.inirot=m.parse(c.inirot);c.endrot=m.parse(c.endrot);c.inirotM=new b.Mat4;c.inirotM_X=new b.Mat4;c.inirotM_Y=new b.Mat4;c.inirotM_Z=new b.Mat4;c.iniposM=new b.Mat4;c.endrotM=new b.Mat4;c.endrotM_X=new b.Mat4;c.endrotM_Y=new b.Mat4;c.endrotM_Z=new b.Mat4;c.endposM=new b.Mat4;g=new b.Mat4};q.prototype.getSpace=function(){var a=this;
return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};q.prototype.getFamilyValues=function(){c=this;p=c.evaluator;var a=$jscomp.makeIterator(p.eval(c.family_interval)[0]);c.fInf=a.next().value;c.fSup=a.next().value;c.fSteps=Math.round(p.eval(c.family_steps));c.fSep=0<c.fSteps?(c.fSup-c.fInf)/c.fSteps:0};q.prototype.buildFamilyPrimitives=function(){c=this;p=c.evaluator;c.getFamilyValues();d=p.getVariable(c.family);if(0<=c.fSteps)for(var a=0,b=c.fSteps;a<=b;a++)c.fVal=
c.fInf+a*c.fSep,p.setVariable(c.family,c.fVal),p.eval(c.drawif)&&c.buildPrimitives();p.setVariable(c.family,d)};q.prototype.update=function(){c=this;c.primitives=[];c.evaluator.eval(c.drawif)&&(c.family||c.buildPrimitives());c.family&&c.buildFamilyPrimitives()};q.prototype.updateMVMatrix=function(){c=this;l=c.evaluator.eval(c.inirot)[0];c.inirotEuler?(c.inirotM.setIdentity(),c.inirotM=c.inirotM.rotateZ(h(l[0])),c.inirotM=c.inirotM.rotateX(h(l[1])),c.inirotM=c.inirotM.rotateZ(h(l[2]))):(g.setIdentity(),
g.rotateX(h(l[0]),c.inirotM_X),g.rotateY(h(l[1]),c.inirotM_Y),g.rotateZ(h(l[2]),c.inirotM_Z));l=c.evaluator.eval(c.inipos)[0];c.iniposM=c.iniposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]});l=c.evaluator.eval(c.endrot)[0];c.endrotEuler?(c.endrotM.setIdentity(),c.endrotM=c.endrotM.rotateZ(h(l[0])),c.endrotM=c.endrotM.rotateX(h(l[1])),c.endrotM=c.endrotM.rotateZ(h(l[2]))):(g.setIdentity(),g.rotateX(h(l[0]),c.endrotM_X),g.rotateY(h(l[1]),c.endrotM_Y),g.rotateZ(h(l[2]),c.endrotM_Z));l=c.evaluator.eval(c.endpos)[0];
c.endposM=c.endposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]})};q.prototype.transformVertex=function(a){c=this;e=c.inirotEuler?c.inirotM.mulV4(a):c.inirotM_Z.mulV4(c.inirotM_Y.mulV4(c.inirotM_X.mulV4(a)));e=c.iniposM.mulV4(e);e=c.endrotEuler?c.endrotM.mulV4(e):c.endrotM_Z.mulV4(c.endrotM_Y.mulV4(c.endrotM_X.mulV4(e)));e=c.endposM.mulV4(e);c.macroChildren&&(e=c.applyMacroTransform(e));return e};q.prototype.applyMacroTransform=function(a){c=this;e=c.macro_inirotEuler?c.macro_inirotM.mulV4(a):c.macro_inirotM_Z.mulV4(c.macro_inirotM_Y.mulV4(c.macro_inirotM_X.mulV4(a)));
e=c.macro_iniposM.mulV4(e);e=c.macro_endrotEuler?c.macro_endrotM.mulV4(e):c.macro_endrotM_Z.mulV4(c.macro_endrotM_Y.mulV4(c.macro_endrotM_X.mulV4(e)));return e=c.macro_endposM.mulV4(e)};q.prototype.parseExpression=function(){for(var b=[],c=$jscomp.makeIterator(this.expresion.split(";")),d=c.next();!d.done;d=c.next())d=d.value,""!==d.trim()&&b.push.apply(b,$jscomp.arrayFromIterable(a(d)));c=0;for(d=b.length;c<d;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};q.prototype.splitFace=function(a){for(var b=
$jscomp.makeIterator(this.primitives),c=b.next();!c.done;c=b.next())if(c=c.value,n=[],"face"===c.type){for(var d=$jscomp.makeIterator(a.primitives),g=d.next();!g.done;g=d.next())g=g.value,"face"===g.type?n.push.apply(n,$jscomp.arrayFromIterable(c.splitFace(g))):n.push(g);a.primitives=n}};b.Graphic3D=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(e,b.Graphic3D);e.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();h=c.eval(a.expresion)[0];p=h[0];d=h[1];l=h[2];a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(p,d,l))],type:"vertex",backColor:a.backcolor.getColor(),frontColor:a.color.getColor(),size:c.eval(a.width)}));""!==a.text&&(a.offset_dist=a.offset_dist||c.parser.parse("10"),
a.offset_angle=a.offset_angle||c.parser.parse("270"),a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(p,d,l))],type:"text",fromPoint:!0,frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:c.eval(a.decimals),fixed:a.fixed,evaluator:c,text:new b.TextObject(a,a.text),family:a.family,familyValue:a.fVal,offset_dist:a.offset_dist,offset_angle:a.offset_angle},a.space)))};b.Point3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d=function(a,c){c=b.Graphic3D.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");return c};$jscomp.inherits(d,b.Graphic3D);d.prototype.buildPrimitives=function(){a=this;h=a.evaluator;a.updateMVMatrix();c=h.getVariable("u");h.setVariable("u",a.Nu);p=h.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(p[0][0],p[0][1],p[0][2])),a.transformVertex(new b.Vec4D(p[1][0],p[1][1],p[1][2]))],type:"edge",
lineDash:a.lineDash,frontColor:a.color.getColor(),lineWidth:h.eval(a.width)},a.space));h.setVariable("u",c)};b.Segment3D=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q,m,f=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.param=a.param||"t";a.parameter_interval=a.parameter_interval||c.evaluator.parser.parse("[0,1]");a.parameter_steps=a.parameter_steps||c.evaluator.parser.parse("8");a.expresion=a.parseExpression();return d};$jscomp.inherits(f,b.Graphic3D);f.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();d=c.getVariable("x");l=c.getVariable("y");e=c.getVariable("z");
h=c.getVariable("u");p=c.getVariable("v");c.setVariable("u",0);c.setVariable("v",0);n=parseInt(c.eval(a.Nu));g=parseInt(c.eval(a.Nv));q=[];for(var f=0;f<=n;f++){c.setVariable("u",f/n);for(var u=0;u<=g;u++){c.setVariable("v",u/g);for(var x=$jscomp.makeIterator(a.expresion),r=x.next();!r.done;r=x.next())c.eval(r.value);q.push(a.transformVertex(new b.Vec4D(c.getVariable("x"),c.getVariable("y"),c.getVariable("z"))))}}f=a.color.getColor();u=a.backcolor.getColor();x=a.edges?a.edges.getColor():"";for(r=
0;r<n;r++)for(var v=0;v<g;v++)m=[],m.push(q[v+r*g+r]),m.push(q[v+1+r*g+r]),m.push(q[v+2+(r+1)*g+r]),m.push(q[v+1+(r+1)*g+r]),a.primitives.push(new b.Primitive3D({V:m,type:"face",frontColor:f,backColor:u,edges:x,model:a.model},a.space));c.setVariable("x",d);c.setVariable("y",l);c.setVariable("z",e);c.setVariable("u",h);c.setVariable("v",p)};b.Surface3D=f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d=function(a,c){c=b.Graphic3D.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");return c};$jscomp.inherits(d,b.Graphic3D);d.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();h=c.eval(a.expresion);p=a.color.getColor();for(var d=0,e=h.length-1;d<e;d++)a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(h[d][0],h[d][1],h[d][2])),a.transformVertex(new b.Vec4D(h[d+1][0],h[d+1][1],h[d+
1][2]))],type:"edge",frontColor:p,lineWidth:c.eval(a.width)},a.space))};b.Polygon3D=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("1");a.expresion=a.parseExpression();return d};$jscomp.inherits(g,b.Graphic3D);g.prototype.buildPrimitives=function(){a=this;n=a.evaluator;a.updateMVMatrix();d=n.getVariable("x");l=n.getVariable("y");e=n.getVariable("z");p=n.getVariable("u");n.setVariable("u",0);h=n.eval(a.Nu);c=[];for(var g=0;g<=h;g++){n.setVariable("u",g/h);for(var m=$jscomp.makeIterator(a.expresion),
f=m.next();!f.done;f=m.next())n.eval(f.value);c.push(a.transformVertex(new b.Vec4D(n.getVariable("x"),n.getVariable("y"),n.getVariable("z"))))}g=0;for(m=c.length-1;g<m;g++)a.primitives.push(new b.Primitive3D({V:[c[g],c[g+1]],type:"edge",frontColor:a.color.getColor(),lineWidth:n.eval(a.width)},a.space));a.fill&&2<c.length&&a.primitives.push(new b.Primitive3D({V:c,type:"face",frontColor:a.fill.getColor(),backColor:a.fill.getColor(),edges:"",model:a.model},a.space));n.setVariable("x",d);n.setVariable("y",
l);n.setVariable("z",e);n.setVariable("u",p)};b.Curve3D=g;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(p,b.Graphic3D);p.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();h=c.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(h[0][0],h[0][1],h[0][2])),a.transformVertex(new b.Vec4D(h[2][0],h[2][1],h[2][2])),a.transformVertex(new b.Vec4D(h[1][0],h[1][1],h[1][2]))],type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),
edges:a.edges?a.edges.getColor():"",model:a.model},a.space))};b.Triangle3D=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(d,b.Graphic3D);d.prototype.buildPrimitives=function(){a=this;h=a.evaluator;a.updateMVMatrix();p=h.eval(a.expresion);c=[];for(var d=p.length-1;0<=d;d--)c.push(a.transformVertex(new b.Vec4D(p[d][0],p[d][1],p[d][2])));a.primitives.push(new b.Primitive3D({V:c,type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),edges:a.edges?a.edges.getColor():"",model:a.model},
a.space))};b.Face3D=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("2");a.length=a.length||c.evaluator.parser.parse("2");return d};$jscomp.inherits(n,b.Graphic3D);n.prototype.buildPrimitives=function(){a=this;e=a.evaluator;a.updateMVMatrix();c=e.eval(a.Nu);h=[a.transformVertex(new b.Vec4D)];p=e.eval(a.width)/2;d=e.eval(a.length)/2;l=2*Math.PI/c;for(var g=0;g<c;g++)h.push(a.transformVertex(new b.Vec4D(p*Math.cos(l*
g),d*Math.sin(l*g),0)));g=a.color.getColor();for(var q=a.backcolor.getColor(),m=a.edges?a.edges.getColor():"",f=0;f<c;f++)a.primitives.push(new b.Primitive3D({V:[h[0],f+2<=c?h[f+2]:h[1],h[f+1]],type:"face",frontColor:g,backColor:q,edges:m,model:a.model},a.space))};b.Polireg3D=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p=function(a,c){a=b.Graphic3D.call(this,a,c)||this;a.shadowColor=a.shadowColor?a.shadowColor.getColor():"transparent";return a};$jscomp.inherits(p,b.Graphic3D);p.prototype.buildPrimitives=function(){a=this;c=a.evaluator;h=c.eval(a.expresion)[0];a.primitives.push(new b.Primitive3D({V:[new b.Vec4D(h[0],h[1],0)],type:"text",frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:c.eval(a.decimals),
fixed:a.fixed,displace:0,isText:!0,evaluator:c,text:new b.TextObject(a,a.text),family:a.family,familyValue:a.fVal},a.space))};b.Text3D=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d=b.degToRad,l=0,e=function(c,d){var g;a=g=b.BaseMacro.call(this,c,d,"parse3DGraphic","-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-")||this;a.inirot=a.inirot||"(0,0,0)";a.inirotEuler=a.inirotEuler||!1;a.inipos=a.inipos||c.evaluator.parser.parse("(0,0,0)");a.endrot=a.endrot||"(0,0,0)";a.endrotEuler=a.endrotEuler||!1;a.endpos=
a.endpos||c.evaluator.parser.parse("(0,0,0)");a.name=a.name||"_M_"+l++;Object.assign(a,d);"string"===typeof a.inirot&&a.inirot.includes("Euler")&&(a.inirot=a.inirot.replace("Euler",""),a.inirotEuler=!0);"string"===typeof a.endrot&&a.endrot.includes("Euler")&&(a.endrot=a.endrot.replace("Euler",""),a.endrotEuler=!0);a.inirot=a.evaluator.parser.parse(a.inirot);a.endrot=a.evaluator.parser.parse(a.endrot);a.inirotM=new b.Mat4;a.inirotM_X=new b.Mat4;a.inirotM_Y=new b.Mat4;a.inirotM_Z=new b.Mat4;a.iniposM=
new b.Mat4;a.endrotM=new b.Mat4;a.endrotM_X=new b.Mat4;a.endrotM_Y=new b.Mat4;a.endrotM_Z=new b.Mat4;a.endposM=new b.Mat4;h=new b.Mat4;c=$jscomp.makeIterator(a.graphics);for(d=c.next();!d.done;d=c.next())d.value.macroChildren=!0;return g};$jscomp.inherits(e,b.BaseMacro);e.prototype.buildFamilyPrimitives=function(){a=this;c=a.evaluator;a.getFamilyValues();var b=c.getVariable(a.family);if(0<=a.fSteps)for(var d=0,e=a.fSteps;d<=e;d++)a.fVal=a.fInf+d*a.fSep,c.setVariable(a.family,a.fVal),c.eval(a.drawif)&&
a.updateMacro();c.setVariable(a.family,b)};e.prototype.update=function(){a=this;a.primitives=[];a.evaluator.eval(a.drawif)&&(a.family||a.updateMacro());a.family&&a.buildFamilyPrimitives()};e.prototype.updateMacro=function(){a=this;a.updateTransformation();if(a.inipos){var b=a.evaluator.eval(a.inipos)[0];a.iniPosX=b[0];a.iniPosY=b[1]}b=$jscomp.makeIterator(a.graphics);for(var c=b.next();!c.done;c=b.next())c=c.value,c.macro_inirotEuler=a.inirotEuler,c.macro_inirotM=a.inirotM,c.macro_inirotM_X=a.inirotM_X,
c.macro_inirotM_Y=a.inirotM_Y,c.macro_inirotM_Z=a.inirotM_Z,c.macro_iniposM=a.iniposM,c.macro_endrotEuler=a.endrotEuler,c.macro_endrotM=a.endrotM,c.macro_endrotM_X=a.endrotM_X,c.macro_endrotM_Y=a.endrotM_Y,c.macro_endrotM_Z=a.endrotM_Z,c.macro_endposM=a.endposM,c.update();b=0;for(c=a.graphics.length;b<c;b++){var d=a.graphics[b];if(d.split||a.split)for(var m=b+1;m<c;m++){var f=a.graphics[m];(f.split||a.split)&&d.splitFace(f)}a.primitives=a.primitives.concat(d.primitives||[])}};e.prototype.updateTransformation=
function(){a=this;p=a.evaluator.eval(a.inirot)[0];a.inirotEuler?(a.inirotM.setIdentity(),a.inirotM=a.inirotM.rotateZ(d(p[0])),a.inirotM=a.inirotM.rotateX(d(p[1])),a.inirotM=a.inirotM.rotateZ(d(p[2]))):(h.setIdentity(),h.rotateX(d(p[0]),a.inirotM_X),h.rotateY(d(p[1]),a.inirotM_Y),h.rotateZ(d(p[2]),a.inirotM_Z));p=a.evaluator.eval(a.inipos)[0];a.iniposM=a.iniposM.setIdentity().translate({x:p[0],y:p[1],z:p[2]});p=a.evaluator.eval(a.endrot)[0];a.endrotEuler?(a.endrotM.setIdentity(),a.endrotM=a.endrotM.rotateZ(d(p[0])),
a.endrotM=a.endrotM.rotateX(d(p[1])),a.endrotM=a.endrotM.rotateZ(d(p[2]))):(h.setIdentity(),h.rotateX(d(p[0]),a.endrotM_X),h.rotateY(d(p[1]),a.endrotM_Y),h.rotateZ(d(p[2]),a.endrotM_Z));p=a.evaluator.eval(a.endpos)[0];a.endposM=a.endposM.setIdentity().translate({x:p[0],y:p[1],z:p[2]})};e.prototype.drawAux=function(a){};b.Macro3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.PI,h=2*c,p=Math.sqrt(3),d=Math.sin,l=Math.cos,e,n,g,q,m,f,w,u,x,r,v,z,y=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("2");a.height=a.height||c.evaluator.parser.parse("2");a.length=a.length||c.evaluator.parser.parse("2");a.R=a.R||c.evaluator.parser.parse("2");a.r=a.r||c.evaluator.parser.parse("1");e=b.Vec4D;return d};$jscomp.inherits(y,b.Graphic3D);y.prototype.buildPrimitives=function(){a=this;
n=a.evaluator;a.updateMVMatrix();a.buildGeometry(n.eval(a.width),n.eval(a.height),n.eval(a.length),n.eval(a.Nu),n.eval(a.Nv));for(var c=a.color.getColor(),d=a.backcolor.getColor(),m=a.edges?a.edges.getColor():"",f=$jscomp.makeIterator(a.faces),e=f.next();!e.done;e=f.next()){e=e.value;g=[];e=$jscomp.makeIterator(e);for(var l=e.next();!l.done;l=e.next())g.push(a.transformVertex(a.V[l.value]));a.primitives.push(new b.Primitive3D({V:g,type:"face",frontColor:c,backColor:d,edges:m,model:a.model},a.space))}};
y.prototype.changeGeometry=function(a,b,c,d,g){return this.oldW===a&&this.oldH===b&&this.oldL===c&&this.oldNu===d&&this.oldNv===g};y.prototype.updateValues=function(a,b,c,d,g){this.oldW=a;this.oldH=b;this.oldL=c;this.oldNv=g;this.oldNu=d};var A=function(a,b){a=y.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(A,y);A.prototype.buildGeometry=function(a,b,c,d,g){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,d,g)||(this.V=[new e(a,c,b),
new e(a,-c,b),new e(a,c,-b),new e(a,-c,-b),new e(-a,c,b),new e(-a,-c,b),new e(-a,c,-b),new e(-a,-c,-b)],this.updateValues(a,b,c,d,g))};var B=function(a,b){return A.call(this,a,b)||this};$jscomp.inherits(B,A);B.prototype.buildGeometry=function(a,b,c,d,g){b=a/p;A.prototype.buildGeometry.call(this,b,b,b,d,g)};var D=function(a,b){a=y.call(this,a,b)||this;a.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];return a};$jscomp.inherits(D,y);D.prototype.buildGeometry=function(a,b,c,d,g){a/=2;if(!this.changeGeometry(a,
b,c,d,g)){var m=h/3,f=Math.cos(m),l=Math.sin(m);m=2*a*Math.sqrt(2)/3;var q=-a/3,p=m*f+0*l;f=-m*l+0*f;this.V=[new e(0,0,a),new e(p,f,q),new e(p,-f,q),new e(m,0,q)];this.updateValues(a,b,c,d,g)}};var I=function(a,b){a=y.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(I,y);I.prototype.buildGeometry=function(a,b,c,d,g){a/=2;this.changeGeometry(a,b,c,d,g)||(this.V=[new e(0,0,a),new e(a,0,0),new e(-a,0,0),new e(0,a,0),new e(0,-a,
0),new e(0,0,-a)],this.updateValues(a,b,c,d,g))};var E=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(E,y);E.prototype.buildGeometry=function(a,b,g,f,p){a/=2;b/=2;g/=2;if(!this.changeGeometry(a,b,g,f,p)){this.V=[new e(0,0,b)];for(var r=1;r<f;r++){m=r*c/f;for(var n=0;n<p;n++)q=n*h/p,this.V.push(new e(a*d(m)*l(q),g*d(m)*d(q),b*l(m)))}this.V.push(new e(0,0,-b));this.faces=[];for(r=0;r<p;r++)this.faces.push([0,(r+1)%p+1,r%p+1]);for(r=1;r<f-1;r++)for(n=0;n<p;n++)this.faces.push([n+1+(r-
1)*p,(n+1)%p+1+(r-1)*p,(n+1)%p+1+r*p,n+1+r*p]);for(r=0;r<p;r++)this.faces.push([this.V.length-1,this.V.length-1-p+r,this.V.length-1-p+(r+1)%p]);this.updateValues(a,b,g,f,p)}};var G=function(a,b){return E.call(this,a,b)||this};$jscomp.inherits(G,E);G.prototype.buildGeometry=function(a,b,c,d,g){E.prototype.buildGeometry.call(this,a,a,a,d,g)};var H=function(a,b){a=y.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(H,y);H.prototype.buildGeometry=function(a,d,g,m,f){a/=Math.PI;if(!this.changeGeometry(a,d,g,m,f)){u=a/1.6180339887;x=1.6180339887*a;this.V=[new e(a,a,a),new e(a,a,-a),new e(a,-a,a),new e(a,-a,-a),new e(-a,a,a),new e(-a,a,-a),new e(-a,-a,a),new e(-a,-a,-a),new e(0,u,x),new e(0,u,-x),new e(0,-u,x),new e(0,-u,-x),new e(u,x,0),new e(u,-x,0),new e(-u,x,0),new e(-u,-x,0),new e(x,0,u),new e(x,0,-u),new e(-x,
0,u),new e(-x,0,-u)];r=(new b.Mat4).setIdentity().rotateY(-c/6);for(var l=0,q=this.V.length;l<q;l++)this.V[l]=r.mulV4(this.V[l]);this.updateValues(a,d,g,m,f)}};var C=function(a,b){a=y.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(C,y);C.prototype.buildGeometry=function(a,c,d,g,m){a/=3.8;if(!this.changeGeometry(a,c,d,g,
m)){x=1.6180339887*a;this.V=[new e(0,a,x),new e(0,a,-x),new e(0,-a,x),new e(0,-a,-x),new e(a,x,0),new e(a,-x,0),new e(-a,x,0),new e(-a,-x,0),new e(x,0,a),new e(x,0,-a),new e(-x,0,a),new e(-x,0,-a)];r=(new b.Mat4).setIdentity().rotateY(-1.0285);for(var f=0,l=this.V.length;f<l;f++)this.V[f]=r.mulV4(this.V[f]);this.updateValues(a,c,d,g,m)}};var J=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(J,y);J.prototype.buildGeometry=function(a,b,c,g,m){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,
c,g,m)){this.V=[];for(var f=0;f<m;f++)for(var q=0;q<g;q++)this.V.push(new e(a*(m-f)/m*l(q*h/g),c*(m-f)/m*d(q*h/g),b-2*f*b/m));this.V.push(new e(0,0,-b));this.faces=[];for(f=0;f<m-1;f++)for(q=0;q<g;q++)this.faces.push([q+f*g,(q+1)%g+f*g,(q+1)%g+(f+1)*g,q+(f+1)*g]);for(f=0;f<g;f++)this.faces.push([this.V.length-1,this.V.length-1-g+f,this.V.length-1-g+(f+1)%g]);this.updateValues(a,b,c,g,m)}};var P=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(P,y);P.prototype.buildGeometry=function(a,
b,c,g,m){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,g,m)){this.V=[];for(var f=0;f<m+1;f++)for(var q=0;q<g;q++)this.V.push(new e(a*l(q*h/g),c*d(q*h/g),b-2*f*b/m));this.faces=[];for(f=0;f<m;f++)for(q=0;q<g;q++)this.faces.push([q+f*g,(q+1)%g+f*g,(q+1)%g+(f+1)*g,q+(f+1)*g]);this.updateValues(a,b,c,g,m)}};var R=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(R,y);R.prototype.buildGeometry=function(a,b,c,g,m){a/=2;b/=2;c/=2;f=n.eval(this.R);w=n.eval(this.r);if(!this.changeGeometry(a,b,c,
g,m)){this.V=[];for(var q=0;q<m+1;q++)for(var p=0;p<g;p++)this.V.push(new e(-(f+w*d(h*p/g))*d(h*q/m),(f+w*d(h*p/g))*l(h*q/m),w*l(h*p/g)));this.faces=[];for(q=0;q<m;q++)for(p=0;p<g;p++)this.faces.push([p+q*g,p+(q+1)*g,(p+1)%g+(q+1)*g,(p+1)%g+q*g]);this.updateValues(a,b,c,g,m)}};var L=function(c,d){c=y.call(this,c,d)||this;a.fileData=b.openFile(a.evaluator.eval(a.file)).split(/\r/);return c};$jscomp.inherits(L,y);L.prototype.buildGeometry=function(){this.V=[];this.faces=[];for(var a=0,b=this.fileData.length;a<
b;a++)v=this.fileData[a],v.startsWith("V")?(z=v.slice(2,-1).split(",").map(parseFloat),this.V.push(new e(z[0]||0,z[1]||0,z[2]||0))):v.startsWith("F")&&(z=v.slice(2,-1).split(",").map(parseInt),this.faces.push(z.reverse()))};b.OtherGeometry3D=y;b.Cube3D=B;b.Box3D=A;b.Tetrahedron3D=D;b.Octahedron3D=I;b.Sphere3D=G;b.Ellipsoid3D=E;b.Dodecahedron3D=H;b.Icosahedron3D=C;b.Cone3D=J;b.Cylinder3D=P;b.Torus3D=R;b.Mesh3D=L;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,c=Math.min,h=Math.PI,p=Math.cos,d=Math.sin,l=Math.abs,e=Math.round,n,g,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};H.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};H.prototype.copy=function(){return new H(this.x,this.y)};H.prototype.ix=function(){return e(a(c(this.x,32E3),-32E3))};H.prototype.iy=function(){return e(a(c(this.y,32E3),-32E3))};H.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};H.prototype.norm2=function(){return this.x*this.x+this.y*this.y};H.prototype.norm=function(){return Math.sqrt(this.norm2())};H.prototype.distance=function(a){g=this.copy();g.sub(a);return g.norm()};H.prototype.dot=function(a){return this.x*a.x+this.y*a.y};H.prototype.det=function(a){return this.x*a.y-this.y*a.x};H.prototype.mul=function(a){this.x*=a;this.y*=a};H.prototype.div=function(a){this.x/=a;this.y/=a};H.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};H.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};H.prototype.normalize=function(){n=this.norm();0!=n&&this.div(n)};H.prototype.rotR90=function(){n=this.x;this.x=this.y;this.y=-n};H.prototype.rotL90=function(){n=this.x;this.x=-this.y;this.y=n};H.prototype.rot=function(a){q=this.copy();w=p(a);u=d(a);this.x=q.x*w-q.y*u;this.y=q.x*u+q.y*w};H.prototype.rot2=function(a){this.rot(a*h/180)};H.prototype.intersection=function(b,d,g,e){x=d.x-b.x;r=g.x-e.x;v=g.x-b.x;z=d.y-b.y;y=g.y-e.y;A=g.y-b.y;G=x*
y-r*z;return 1E-6<l(G)?(m=(v*y-A*r)/G,f=(-v*z+A*x)/G,0<=m&&1>=m&&0<=f&&1>=f?new H(b.x+x*m,b.y+z*m):null):(d.x-g.x)*A!=(d.y-g.y)*v?null:b.x!=d.x?(B=c(b.x,d.x),D=a(b.x,d.x),B<=g.x&&g.x<=D?g:B<=e.x&&e.x<=D?e:null):g.x!=e.x?(I=c(g.x,e.x),E=a(g.x,e.x),I<=b.x&&b.x<=E?b:I<=d.x&&d.x<=E?d:null):b.y!=d.y?(B=c(b.y,d.y),D=a(b.y,d.y),B<=g.y&&g.y<=D?g:B<=e.y&&e.y<=D?e:null):g.y!=e.y?(I=c(g.y,e.y),E=a(g.y,e.y),I<=b.y&&b.y<=E?b:I<=d.y&&d.y<=E?d:null):b.x==g.x&&b.y==g.y?b:null};b.R2=H;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q=function(a,c){this.evaluator=a;this.constraint=c;/==|<|>|<=|>=/.test(this.constraint.value)&&(/</.test(this.constraint.value)?this.sign="<":/>/.test(this.constraint.value)?this.sign=">":this.sign="=",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0]);l=new b.R2(0,0);d=new b.R2(0,0);g=new b.R2(0,0)};q.prototype.getUnitNormal=function(){this.normal.normalize();return g.set(this.normal.x,this.normal.y)};
q.prototype.gradient=function(b){a=this.evaluator;l.x=0;l.y=0;e=a.getVariable("x");n=a.getVariable("y");a.setVariable("x",b.x);a.setVariable("y",b.y);this.f0=a.eval(this.constraint);a.setVariable("x",a.getVariable("x")+1E-6);c=a.eval(this.constraint);l.x=(c-this.f0)/1E-6;l.x=isNaN(l.x)?Infinity:l.x;a.setVariable("x",a.getVariable("x")-1E-6);a.setVariable("y",a.getVariable("y")+1E-6);c=a.eval(this.constraint);l.y=(c-this.f0)/1E-6;l.y=isNaN(l.y)?Infinity:l.y;a.setVariable("x",e);a.setVariable("y",n);
return l};q.prototype.findZero=function(b,c,g){a=this.evaluator;d.x=b.x;d.y=b.y;e=a.getVariable("x");n=a.getVariable("y");a.setVariable("x",b.x);a.setVariable("y",b.y);this.f0=a.eval(this.constraint);if("<"==this.sign&&0>=this.f0||">"==this.sign&&0<=this.f0)return d;a.setVariable("x",e);a.setVariable("y",n);for(var m=0;16>m;m++)if(h=d.x,p=d.y,this.normal=this.gradient(d),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),d.x=h+this.normal.x,d.y=p+this.normal.y,this.normal.norm()<
c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=d.x-b.x,this.normal.y=d.y-b.y),d;return g?d:null};b.R2Newton=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.x=a;this.y=b};a.prototype.vLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};a.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};a.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vLength()*a.vLength()))};a.AXIS_X=new a(1,0);a.AXIS_Y=new a(0,1);b.Vector2D=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h=Math.round,p,d,l,e,n,g,q,m,f,w,u,x,r,v=function(c,d){a=this;a.parent=c;a.evaluator=c.evaluator;var g=a.parser=c.evaluator.parser;a.id="GraphicControl"!==d.type?"C":"G";a.region="south";a.x=a.y=0;a.w="Video"!==d.type?100:350;a.h="Video"!==d.type?23:120;a.keyboard=!1;a.kblayout="1x16";"GraphicControl"!==d.type&&"Audio"!==d.type&&"Video"!==d.type?"TextArea"!==d.type?a.expresion=g.parse("(0,0,100,23)"):(a.expresion=g.parse("(0,0,300,200)"),
a.w=300,a.h=200):a.expresion=g.parse("(0,0)");a.fixed=a.visible=!0;a.color=new b.Color("Scrollbar"==d.gui?"e0e4e8":"222222");a.colorInt="cc0022";"Scrollbar"==d.gui?a.colorInt="182C61":"GraphicControl"!==d.type&&(a.colorInt="f0f8ff");a.colorInt=new b.Color(a.colorInt);a.font_size=g.parse("0");a.type=a.gui=a.bold=a.italics=a.underlined=a.action=a.param=a.tooltip=a.Explanation=a.msg_pos=a.cID="";a.paramFont=a.tooltipFont=a.ExplanationFont="Monospace 12px";a.drawif=a.activeif=g.parse("1");a.valueExpr=
g.parse("0");a.decimals=g.parse("2");a.min=g.parse("-Infinity");a.max=g.parse("Infinity");a.incr=g.parse("0.1");a.discrete=a.exponentialif=!1;a.zIndex=-1;Object.assign(a,d);/Video|Audio/.test(a.type)&&(a.region="interior");void 0==a.name&&(a.name=2==a.parent.version?a.id:"_nada_");a.name=/_\._|_nada_|_void_/.test(a.name)?"":a.name;d=a.evaluator.eval(a.expresion)[0];a.x=h(d[0]);a.y=h(d[1]);4==d.length&&(a.w=h(d[2]),a.h=h(d[3]));a.actionExec=c.lessonParser.parseAction(a)};v.prototype.init=function(){};
v.prototype.update=function(){};v.prototype.draw=function(){};v.prototype.getContainer=function(){a=this;var b=a.parent.spaces;if("interior"===a.region)for(var c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next()){if(d=d.value,d.id===a.spaceID)return d.addCtr(a),a.zIndex=d.zIndex,a.space=d,d.numCtrContainer}else{if("external"===a.region)return a.parent.externalSpace.addCtr(a),a.parent.externalSpace.container;if("scenario"===a.region)return a.cID?(a.expresion=a.evaluator.parser.parse("(0,-1000,"+
a.w+","+a.h+")"),a.parent.stage.stageSpace.addCtr(a),a.zIndex=a.parent.stage.stageSpace.zIndex,a.parent.stage.stageSpace.numCtrContainer):a.parent.externalSpace.container;if(/north|south|east|west/.test(a.region))return a.parent[a.region+"Space"].controls.push(a),a.parent[a.region+"Space"].container}b[0].addCtr(a);a.zIndex=b[0].zIndex;return b[0].numCtrContainer};v.prototype.addControlContainer=function(a){this.getContainer().appendChild(a)};v.prototype.updatePositionAndSize=function(){a=this;l=e=
n=g=!1;q=a.evaluator.eval(a.expresion)[0];m=h(q[0]);l=h(a.x)!==m;a.x=m;m=h(q[1]);e=h(a.y)!==m;a.y=m;4===q.length&&(m=h(q[2]),n=h(a.w)!==m,a.w=m,m=h(q[3]),g=h(a.h)!==m,a.h=m);if(n||g||l||e)a.init(!0,!0),a.draw()};v.prototype.formatValue=function(b){a=this;r=a.parent;f=b+"";w=a.evaluator.eval(a.decimals);u=f.indexOf(".");-1!=u&&(x=f.substring(u+1),x.length>w&&(f=parseFloat(f).toFixed(w)));a.fixed&&(2!==r.version||2===r.version&&!a.exponentialif)&&(f=parseFloat(b).toFixed(w));a.exponentialif&&0!=parseFloat(f)&&
(f=a.fixed&&2!==r.version?parseFloat(f).toExponential(w):parseFloat(f).toExponential(),f=f.toUpperCase().replace("+",""));return f.replace(".",r.decimal_symbol)};v.prototype.updateAndExecAction=function(){r=this.parent;r.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();r.updateControls();"animate"!==this.action&&r.update();r.updateControls()};v.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);p=b*b;for(a=0;a<b;a++)d=
c(a-35*b*.01),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+d*d*192/p/255+")")};b.Control=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=/[\w\.\-//]*(\.gif)/gi,h=/CanvasGradient|CanvasPattern/,p=Math.floor,d=Math.abs,l,e,n,g,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O,F,M,K,N,V,Z,X,U,S=function(c,d){var g;a=g=b.Control.call(this,c,d)||this;a.imageSrc=d.imageSrc||"";a.image=d.image||new Image;a.imageOver=d.imageOver||new Image;a.imageDown=d.imageDown||new Image;a.flat=d.flat||!1;a.borderColor=d.borderColor||!1;a.text_align=d.text_align||"center_center";a.image_align=d.image_align||
"center_center";a.font_family=b.getFontName(d.font_family||"arial");a.ratio=c.ratio;-1===a.font_size&&(a.noFSize=!0);a.borderColor&&(a.borderColor=new b.Color(a.borderColor));a.text_align=a.text_align.split("_");a.image_align=a.image_align.split("_");a.oName=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.classContainer=a.cssClass?" "+a.cssClass+" ":"";a.extra_style=a.extra_style||"";/^_STYLE_/.test(a.imageSrc.trim())&&(a.imageSrc="vacio.gif",
a.extra_style=a.imageSrc.trim().substring(8));if(a.extra_style){a.customStyle=!0;a.btnStyle=[];a.conStyle=[];a.conStyle.textBorder=3;var m;c=$jscomp.makeIterator(a.extra_style.split("|"));for(d=c.next();!d.done;d=c.next()){d=(m=d.value.trim().match(/(.*)=(.*)/))?m[1].trim():"";m=m?m[2].trim():"";var f=m.match(/rgb/g)?"":"#";"class"===d?a.classContainer=" "+m:"border"===d?(a.btnStyle.push({type:"border-style",value:"solid"}),a.btnStyle.push({type:"border-width",value:m+"px"})):"borderRadius"===d?(a.btnStyle.push({type:"border-radius",
value:m+"px"}),a.conStyle.push({type:"border-radius",value:m+"px"})):"borderColor"===d?a.btnStyle.push({type:"border-color",value:f+m}):/^(overColor|downColor|inactiveColor|inactiveColorBorder|shadowTextColor|shadowBoxColor|shadowInsetBoxColor)$/.test(d)?a.conStyle[d]=f+m:"font"===d?a.conStyle[d]=m.toLowerCase():/^(shadowTextBlur|shadowTextOffsetX|shadowTextOffsetY|shadowBoxBlur|shadowBoxOffsetX|shadowBoxOffsetY|shadowInsetBoxBlur|shadowInsetBoxOffsetX|shadowInsetBoxOffsetY|textBorder|imgSizeW|imgSizeH)$/.test(d)?
a.conStyle[d]=parseFloat(m)||0:"flat"===d&&(a[d]=1==parseInt(m))}}a.imageSrc.startsWith("_COLORES_")&&(c=a.imageSrc.split("_"),a.colorInt=new b.Color(c[2]),a.color=new b.Color(c[3]),a.font_size=a.parser.parse(c[5]),a.imageSrc="");/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse("'"+a.imageSrc+"'");c=a.evaluator.eval(a.imageSrc).toString().trim();if(""!=c)if(M=c.substr(0,c.lastIndexOf(".")),K=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))g.imageSrc=
g.parser.parse("'vacio.gif'"),g.image.ready=1,3===g.parent.version&&(g.name=g.parser.parse("")),g.emptyImage={ready:!0},g.parser.parse("'vacio.gif'");else if(g.image=g.parent.getImage(c),M)try{g.imageOver=g.parent.getImage(M+"_over"+K),g.imageDown=g.parent.getImage(M+"_down"+K)}catch(da){}a.container=b.newHTML("div",{class:"DescartesButtonContainer"+a.classContainer,id:a.id,style:"width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";"});a.btn=b.newHTML("canvas",{width:a.w*
a.ratio,height:a.h*a.ratio,style:"position:absolute;left:0;top:0;width:"+a.w+"px;height:"+a.h+"px;"});a.ctx=a.btn.getContext("2d");a.ctx.imageSmoothingEnabled=!1;a.tooltip&&(a.btn.title=a.tooltip);a.container.appendChild(a.btn);a.addControlContainer(a.container);a.addEvents();a.init();return g};$jscomp.inherits(S,b.Control);S.prototype.init=function(c){a=this;l=a.evaluator;G=a.container;e=a.btn;n=a.ctx;g=l.eval(a.expresion)[0];a.x=g[0];a.y=g[1];4==g.length&&(a.w=parseInt(g[2]),a.h=parseInt(g[3]));
e.width=a.w*a.ratio;e.height=a.h*a.ratio;e.setAttribute("style","position:absolute;left:0;top:0;width:"+a.w+"px;height:"+a.h+"px;box-sizing:border-box;");G.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";display:block;");if(a.btnStyle)for(var d=$jscomp.makeIterator(a.btnStyle),m=d.next();!m.done;m=d.next())m=m.value,e.style[m.type]=m.value;if(a.conStyle){d=$jscomp.makeIterator(a.conStyle);for(m=d.next();!m.done;m=d.next())m=m.value,G.style[m.type]=
m.value;a.conStyle.shadowBoxColor&&(G.style.boxShadow=(a.conStyle.shadowBoxOffsetX||0)+"px "+(a.conStyle.shadowBoxOffsetY||2)+"px "+(a.conStyle.shadowBoxBlur||2)+"px 1px "+a.conStyle.shadowBoxColor);a.conStyle.shadowInsetBoxColor&&(e.style.boxShadow=(a.conStyle.shadowInsetBoxOffsetX||0)+"px "+(a.conStyle.shadowInsetBoxOffsetY||-2)+"px "+(a.conStyle.shadowInsetBoxBlur||1)+"px 1px "+a.conStyle.shadowInsetBoxColor+" inset")}a.noFSize&&(a.font_size=l.parser.parse(b.getFieldFontSize(this.h)+""));a.fs_evaluated=
l.eval(a.font_size);a.createGradient(a.w,a.h);G.style.display=0<l.eval(a.drawif)?"block":"none";n.lineJoin="round";n.font=a.italics+" "+a.bold+" "+a.fs_evaluated+"px "+a.font_family;a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:l,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.font_size,font_family:a.font_family,italics:a.italics,bold:a.bold,border:a.borderColor,border_size:a.conStyle?a.conStyle.textBorder:
void 0,shadowBlur:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextOffsetY||2:void 0,shadowColor:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextColor:void 0},a.oName);a.draw(c)};S.prototype.update=function(){a=this;l=a.evaluator;G=a.container;a.activeIfValue=0<l.eval(a.activeif);a.drawIfValue=0<
l.eval(a.drawif);(a.space?a.space.drawIfValue:1)&&a.drawIfValue?(G.style.display="block",a.draw(),G.style.cursor=a.btn.style.cursor=a.activeIfValue?"pointer":"not-allowed",G.setAttribute("active",a.activeIfValue),a.updatePositionAndSize()):(G.style.display="none",a.buttonClick=!1)};S.prototype.draw=function(d){a=this;G=a.container;l=a.evaluator;e=a.btn;n=a.ctx;m=l.eval(a.name);a.text_object.draw(b.ctx,"#000000",0,0);m=a.text_object.textNodes.toStr();f=a.evaluator.eval(a.imageSrc).toString().trim();
if(!d&&(H=a.over===a.oldOver,C=a.buttonClick===a.oldButtonClick,J=a.activeIfValue===a.oldActiveIfValue,P=a.drawIfValue===a.oldDrawIfValue,R=m===a.oldName,L=f===a.oldImageSrc,Q=a.colorInt.getColor()===a.oldBackColor,O=a.color.getColor()===a.oldTextColor,F=a.image.ready===a.oldImageReady,a.oldOver=a.over,a.oldButtonClick=a.buttonClick,a.oldActiveIfValue=a.activeIfValue,a.oldDrawIfValue=a.drawIfValue,a.oldName=m,a.oldImageSrc=f,a.oldBackColor=a.colorInt.getColor(),a.oldTextColor=a.color.getColor(),a.oldImageReady=
a.image.ready,H&&C&&J&&P&&R&&L&&Q&&O&&F))return;n.save();n.setTransform(a.ratio,0,0,a.ratio,0,0);q=a.fs_evaluated;G.setAttribute("data-name",m);f?(w="vacio.gif"===f?this.emptyImage:this.parent.getImage(f),M=f.substr(0,f.lastIndexOf(".")),K=f.substr(f.lastIndexOf(".")),N=M+"_over"+K,V=M+"_down"+K,Z="vacio.gif"===f?this.emptyImage:this.parent.getImage(N),X="vacio.gif"===f?this.emptyImage:this.parent.getImage(V)):w=Z=X=a.emptyImg;n.clearRect(0,0,a.w,a.h);x=r=a.buttonClick?1:0;a.text_object.draw(n,a.color.getColor(),
0,0,!0);v=a.text_object.textNodes.metrics.w;z=a.text_object.textNodes.metrics.h;"center"==a.text_align[1]?I=p(a.w/2+x)-.5:"left"==a.text_align[1]?I=v/2+5+x:"right"==a.text_align[1]&&(I=a.w-v/2+x-5);"center"==a.text_align[0]?E=p(a.h/2+r)-.5:"top"==a.text_align[0]?E=z/2+r+4:"bottom"==a.text_align[0]&&(E=a.h-z/2+r-3);if(w){if(y=a.imgSizeW||w.width,A=a.imgSizeH||w.height,"center"==a.image_align[1]?B=parseInt((a.w-y)/2)+x:"left"==a.image_align[1]?B=x:"right"==a.image_align[1]&&(B=a.w-y+x),"center"==a.image_align[0]?
D=parseInt((a.h-A)/2)+r:"top"==a.image_align[0]?D=r:"bottom"==a.image_align[0]&&(D=a.h-A+r),w&&w.ready)if(w!==a.emptyImg&&w.complete)if(f.match(c))e.style.backgroundRepeat="no-repeat",e.style.backgroundImage="url('"+f+"')",e.style.backgroundPosition=B+"px "+D+"px";else{if("center"!=a.image_align[0]||"center"!=a.image_align[1])(U=a.colorInt.getColor())&&h.test(U.constructor.name)?(n.fillStyle=U,n.fillRect(0,0,a.w,a.h)):G.style.backgroundColor=U;n.drawImage(w,0,0,w.width,w.height,B,D,y,A)}else a.emptyImg&&
a.customStyle&&((U=a.colorInt.getColor())&&h.test(U.constructor.name)?(n.fillStyle=U,n.fillRect(0,0,a.w,a.h)):G.style.backgroundColor=U)}else(U=a.colorInt.getColor())&&h.test(U.constructor.name)?(n.fillStyle=U,n.fillRect(0,0,a.w,a.h)):(G.style.backgroundColor=U,a.flat||(a.buttonClick||(a.drawLine(n,a.w-1,0,a.w-1,a.h,"rgba(0,0,0,0.5)"),a.drawLine(n,0,0,0,a.h,"rgba(0,0,0,0.09)"),a.drawLine(n,1,0,1,a.h,"rgba(0,0,0,0.03)")),n.fillStyle=a.linearGradient,n.fillRect(0,0,a.w,a.h)));a.activeIfValue&&(Z!==
a.emptyImg&&a.over&&Z.ready&&Z.complete?N.match(c)?(e.style.backgroundImage="url('"+N+"')",e.style.backgroundPosition=B+"px "+D+"px"):n.drawImage(Z,B,D):a.customStyle&&a.conStyle.overColor&&a.over&&(G.style.backgroundColor=a.conStyle.overColor));a.activeIfValue?X!==a.emptyImg&&a.buttonClick&&X.ready&&X.complete?V.match(c)?(e.style.backgroundImage="url('"+V+"')",e.style.backgroundPosition=B+"px "+D+"px"):n.drawImage(X,B,D):a.customStyle&&a.conStyle.downColor&&a.buttonClick&&(G.style.backgroundColor=
a.conStyle.downColor):a.buttonClick&&!w&&(n.fillStyle="rgba(0,0,0,0.09)",n.fillRect(0,0,a.w,a.h));n.fillStyle=a.color.getColor();a.customStyle&&a.conStyle.shadowTextColor&&0<a.conStyle.textBorder&&(n.lineWidth=a.conStyle.textBorder,n.strokeStyle=a.conStyle.shadowTextColor);a.borderColor&&(n.lineWidth=parseInt(q/6),n.strokeStyle=a.borderColor.getColor());a.text_object.draw(n,a.color.getColor(),I,E);a.underlined&&(n.strokeStyle=a.color.getColor(),n.lineWidth=p(.1*q)||2,n.lineCap="round",n.beginPath(),
n.moveTo(I-v/2+x,E+p(q/2)+p(q/5)-1.5),n.lineTo(I+v/2+x,E+p(q/2)+p(q/5)-1.5),n.stroke());a.activeIfValue||(a.customStyle&&a.conStyle.inactiveColor?G.style.backgroundColor=a.conStyle.inactiveColor:(n.fillStyle="rgba(240,240,240,0.6)",n.fillRect(0,0,a.w,a.h)));n.restore();a._image_pos_x=B;a._image_pos_y=D};S.prototype.drawLine=function(a,b,c,d,g,m,f){a.lineWidth=void 0===f?1:f;a.strokeStyle=void 0===m?"black":m;u=a.lineWidth%2*.5;a.beginPath();a.moveTo(p(b)+u,p(c)+u);a.lineTo(p(d)+u,p(g)+u);a.stroke()};
S.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)};S.prototype.addEvents=function(){function a(c,d,f){b.clearTimeout(m);g.buttonClick&&g.drawIfValue&&g.activeIfValue&&(d.call(g),c=f?c:100,m=b.setTimeout(function(){a(c,d,!1)},c))}function c(c){g.parent.deactivateControls();this.focus();c.preventDefault();c.stopPropagation();document.activeElement!=document.body&&
document.activeElement.blur();g.whichBtn=b.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.buttonClick=!0,g.draw(),"calculate"==g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),a(1E3,g.updateAndExecAction,!0)),g.btn.removeEventListener("touchend",d),g.btn.addEventListener("touchend",d),g.btn.removeEventListener("mouseup",d),g.btn.addEventListener("mouseup",d))}function d(a){b.newBlobContent=null;this.focus();a.preventDefault();a.stopPropagation();g.activeIfValue||g.buttonClick?
(g.buttonClick=!1,g.draw(),"calculate"!=g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),g.updateAndExecAction()),g.btn.removeEventListener("touchend",d),g.btn.removeEventListener("mouseup",d)):g.parent.update()}var g=this,m;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();g.over=!0;g.draw()});this.btn.addEventListener("mouseout",
function(a){b.newBlobContent=null;a.preventDefault();a.stopPropagation();g.over=!1;g.buttonClick=!1;g.draw()});document.addEventListener("visibilitychange",function(a){b.newBlobContent=null;g.buttonClick=!1})};b.Button=S;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q,m,f,w,u,x,r=function(c,d){a=d=b.Control.call(this,c,d)||this;a.flat=a.image_dec_src&&a.image_inc_src;a.btn_pos=a.btn_pos||"v_left";a.horizontal="h_left"===a.btn_pos||"h_right"===a.btn_pos||"h_left_right"===a.btn_pos;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.tabindex=++c.tabindex;a.name_str=a.name;a.initial_value=0;try{a.initial_value=
a.evaluator.eval(a.parser.parse(a.valueExprString))}catch(y){console.log(y)}/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.container=b.newHTML("div",{class:"DescartesSpinnerContainer",id:a.id});a.divUp=b.newHTML("div",{class:"DJS_Up"});a.divDown=b.newHTML("div",{class:"DJS_Down"});a.field=b.newHTML("input",{type:"text",id:a.id+"_spinner",class:"DescartesSpinnerField",tabindex:a.tabindex});a.label=b.newHTML("canvas",{class:"DescartesSpinnerLabel"});
a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.label);a.container.appendChild(a.field);a.container.appendChild(a.divUp);a.container.appendChild(a.divDown);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);f=a.evaluator.parser.parse("1");a.originalIncr=a.incr;if(0>a.evaluator.eval(a.decimals)||0===a.evaluator.eval(a.incr))c=a.evaluator.eval(a.incr),0<c?a.originalIncr=a.incr=a.evaluator.parser.parse(parseInt(c).toString()):
a.incr=f;a.image_dec_src&&(/^\[.*\]$/.test(a.image_dec_src)?a.image_dec_src=a.parser.parse(a.image_dec_src.slice(1,-1)):a.image_dec_src=a.parser.parse("'"+a.image_dec_src+"'"),a.old_image_dec_src=a.evaluator.eval(a.image_dec_src).toString().trim(),a.image_dec=a.parent.getImage(a.old_image_dec_src));a.image_inc_src&&(/^\[.*\]$/.test(a.image_inc_src)?a.image_inc_src=a.parser.parse(a.image_inc_src.slice(1,-1)):a.image_inc_src=a.parser.parse("'"+a.image_inc_src+"'"),a.old_image_inc_src=a.evaluator.eval(a.image_inc_src).toString().trim(),
a.image_inc=a.parent.getImage(a.old_image_inc_src));a.addEvents();a.init();return d};$jscomp.inherits(r,b.Control);r.prototype.init=function(d,g){a=this;c=a.evaluator;a.label.innerHTML=c.eval(a.name).toString();d=a.label.textContent;g||(a.value=a.validateValue(c.eval(a.valueExpr)));g=a.formatValue(a.value);a.fieldFontSize=0<c.eval(a.font_size)?c.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:c,decimals:a.decimals,
fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var m=2!==a.parent.version?"__":"_____",f=b.getTextWidth(g+"_",a.fieldFontSize+"px "+b.sansserif_font);if(a.horizontal){var e=parseInt(a.h),l=parseInt(a.w/2-e);m=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(l=a.w-2*e,f=0);
l<m&&(l=m);""==d&&(l=0);a.w-l-e<f&&(l=a.w-e-f);0>l&&(l=0);d=a.w-(l+2*e);a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";background-color:transparent;");a.divUp.setAttribute("style","width:"+e+"px;height:"+e+"px;"+("h_left"===a.btn_pos?"left:"+(l+e):"right:0")+"px;top:0;"+(a.flat?"border-width:0;":""));a.divDown.setAttribute("style","width:"+e+"px;height:"+e+"px;left:"+(l+("h_right"===a.btn_pos?d:0))+"px;top:0;"+(a.flat?"border-width:0;":
""));a.field.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+a.fieldFontSize+"px;width:"+d+"px;height:"+a.h+"px;left:"+(e+l+("h_left"===a.btn_pos?e:"h_right"===a.btn_pos?-e:0))+"px;text-align:center;");a.cover.setAttribute("style","width:"+d+"px;height:"+a.h+"px;left:"+(e+l+("h_left"===a.btn_pos?e:"h_right"===a.btn_pos?-e:0))+"px;text-align:center;");a.field.value=g;a.visible||(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+l+
"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=l*a.ratio}else e=2+parseInt(a.h/2),l=parseInt(a.w/2-e/2),m=b.getTextWidth(d+m,a.fieldFontSize+"px "+b.sansserif_font),a.visible||(l=a.w-e,f=0),l<m&&(l=m),""==d&&(l=0),a.w-l-e<f&&(l=a.w-e-f),0>l&&(l=0),d=a.w-(l+e),a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";background-color:transparent;"),
f="width:"+e+"px;left:"+(l+("v_right"===a.btn_pos?d:0))+"px;",a.divUp.setAttribute("style",f+";height:"+(a.h/2+1)+"px;top:0;"+(a.flat?"border-width:0;":"")),a.divDown.setAttribute("style",f+";height:"+(a.h/2-1)+"px;top:"+(a.h/2+1)+"px;"+(a.flat?"border-width:0;":"")),a.field.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+a.fieldFontSize+"px;width:"+d+"px;height:"+a.h+"px;left:"+(("v_left"===a.btn_pos?e:0)+l)+"px;"),a.cover.setAttribute("style","width:"+d+"px;height:"+a.h+"px;left:"+
(("v_left"===a.btn_pos?e:0)+l)+"px;"),a.field.value=g,a.visible||(a.field.style.display="none"),a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+l+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";"),a.label.width=l*a.ratio;a.label.height=a.h*a.ratio;a.image_dec&&a.image_dec.ready&&(a.divDown.style["background-image"]="url("+a.image_dec.src+")");a.image_inc&&a.image_inc.ready&&(a.divUp.style["background-image"]=
"url("+a.image_inc.src+")");a.divUp.setAttribute("horizontal",a.horizontal);a.divDown.setAttribute("horizontal",a.horizontal);c.setVariable(a.id,a.value)};r.prototype.update=function(){a=this;c=a.evaluator;0>c.eval(a.decimals)?(h=c.eval(a.incr),0<h?a.originalIncr=a.incr=c.parser.parse(parseInt(h).toString()):a.incr=f):a.incr=0!==c.eval(a.originalIncr)?a.originalIncr:f;a.activeIfValue=0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.divUp.setAttribute("active",
!a.field.disabled);a.divDown.setAttribute("active",!a.field.disabled);a.drawIfValue?(a.updateStyle(),a.container.style.display="block"):(a.click=!1,a.container.style.display="none");a.image_dec&&(w=a.evaluator.eval(a.image_dec_src).toString().trim(),a.old_image_dec_src!==w&&(a.divDown.style["background-image"]="url("+w+")",a.old_image_dec_src=w));a.image_inc&&(u=a.evaluator.eval(a.image_inc_src).toString().trim(),a.old_image_inc_src!==u&&(a.divUp.style["background-image"]="url("+u+")",a.image_inc_src=
u));a.updatePositionAndSize();a.parent.animation.playing&&document.activeElement==a.field||(p=a.field.value,d=a.value,a.value=a.validateValue(c.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value==d&&a.field.value!=p&&(a.value=a.validateValue(p),a.field.value=a.formatValue(a.value)),c.setVariable(a.id,a.value));a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(x=a.label_color.getColor())&&
/CanvasGradient|CanvasPattern/.test(x.constructor.name)&&(a.label_ctx.fillStyle=x,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,
0,0,1,0,0)};r.prototype.updateStyle=function(){a=this;a.divUp.style.borderStyle=a.up?"inset":"outset";a.divUp.style.borderColor=a.up?"gray":"#f0f8ff";a.divUp.style.backgroundColor=a.up?"#bfbfbf":"";a.divUp.style.backgroundColor=a.flat?"transparent":a.divUp.style.backgroundColor;a.divUp.style.backgroundPosition=a.up?"calc(50% + 1px) calc(50% + 1px)":"center";a.divDown.style.borderStyle=a.down?"inset":"outset";a.divDown.style.borderColor=a.down?"gray":"#f0f8ff";a.divDown.style.backgroundColor=a.down?
"#bfbfbf":"";a.divDown.style.backgroundColor=a.flat?"transparent":a.divDown.style.backgroundColor;a.divDown.style.backgroundPosition=a.down?"calc(50% + 1px) calc(50% + 1px)":"center"};r.prototype.validateValue=function(a){c=this.evaluator;isNaN(parseFloat(a))||a.toString().includes("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(c.eval(c.parser.parse(a)));isNaN(l)&&(l=0);g=c.eval(this.min);q=c.eval(this.max);
""===g&&(g=-Infinity);""===q&&(q=Infinity);l=Math.min(Math.max(l,g),q);this.discrete&&(e=c.eval(this.incr),l=0==e?0:this.initial_value+e*Math.round((l-this.initial_value)/e));n=c.eval(this.decimals);0>=n&&(n=0);return l=parseFloat(parseFloat(l).toFixed(n))};r.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};r.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};r.prototype.changeValue=function(a){this.activeIfValue&&
(this.value=this.validateValue(a),this.field.value=this.formatValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};r.prototype.addEvents=function(){function a(c,d,g){b.clearTimeout(q);if(e.up||e.down)d.call(e),c=g?c:10,q=b.setTimeout(function(){a(c,d)},c)}function c(c){c.preventDefault();e.whichBtn=b.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&(e.up=!0,a(l,e.increase,!0))}function d(c){c.preventDefault();e.whichBtn=b.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&
(e.down=!0,a(l,e.decrease,!0))}function g(a){e.up=!1;b.clearTimeout(q);e.updateStyle()}function f(a){e.down=!1;b.clearTimeout(q);e.updateStyle()}m=b.hasTouchSupport;var e=this,l=m?500:200,q;e.label.addEventListener("touchstart",b.preventDefault);e.label.addEventListener("mousedown",b.preventDefault);e.field.addEventListener("keydown",function(a){13==a.keyCode&&e.changeValue(e.field.value)});e.divUp.addEventListener("touchstart",c);e.divUp.addEventListener("mousedown",c);e.divDown.addEventListener("touchstart",
d);e.divDown.addEventListener("mousedown",d);e.divUp.addEventListener("mouseout",function(a){e.up=!1;b.clearTimeout(q);a.preventDefault();e.updateStyle()});e.divDown.addEventListener("mouseout",function(a){e.down=!1;b.clearTimeout(q);a.preventDefault();e.updateStyle()});e.divUp.addEventListener("touchend",g);window.addEventListener("touchend",g);e.divUp.addEventListener("mouseup",g);window.addEventListener("mouseup",g);e.divDown.addEventListener("touchend",f);window.addEventListener("touchend",f);
e.divDown.addEventListener("mouseup",f);window.addEventListener("mouseup",f);document.addEventListener("visibilitychange",function(a){e.up=e.down=!1;b.clearTimeout(q);e.updateStyle()});e.field.addEventListener("blur",function(a){e.drawIfValue&&e.changeValue(e.field.value,!0)});e.field.addEventListener("click",function(a){this.focus()});e.cover.addEventListener("click",function(a){a=e.evaluator.eval(e.kbexp);e.activeIfValue&&e.parent.keyboard.show(e,e.kblayout,a[0][0]||0,a[0][1]||0,e.id,e.field,e.onlyText)})};
b.Spinner=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p=function(c,l){var d;a=d=b.Control.call(this,c,l)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.typeCtr="checkbox";a.pressed=l.pressed||!1;a.radio_group=(l.radio_group||"").trim();""!==a.radio_group&&(a.typeCtr="radio");a.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name.trim()+"'");
a.tabindex=++c.tabindex;a.containerControl=b.newHTML("div",{class:"DescartesCheckboxContainer",id:a.id});a.checkbox=b.newHTML("input",{type:a.typeCtr,id:a.id+a.typeCtr,class:"DescartesCheckbox",tabindex:a.tabindex});""!==a.radio_group&&a.checkbox.setAttribute("name",a.radio_group);a.checkbox.internalID=a.id;a.label=b.newHTML("canvas",{class:"DescartesCheckboxLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.dummyLabel=b.newHTML("label",{"for":a.id+a.typeCtr});a.value=a.evaluator.eval(a.valueExpr);
a.evaluator.setVariable(a.id,a.value);a.containerControl.appendChild(a.label);a.containerControl.appendChild(a.checkbox);a.containerControl.appendChild(a.dummyLabel);a.addControlContainer(a.containerControl);a.addEvents();a.init();return d};$jscomp.inherits(p,b.Control);p.prototype.init=function(d){a=this;c=a.evaluator;a.label.innerHTML=c.eval(a.name).toString();a.labelFontSize=0<c.eval(a.font_size)?c.eval(a.font_size):b.getFieldFontSize(a.h);d=Math.max(a.w-a.h,0);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:c,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.labelFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");"right"==a.position?(a.dummyLabel.setAttribute("style","position:absolute;width:"+a.h+"px;height:"+
a.h+"px;left:"+d+"px;"),a.checkbox.setAttribute("style","width:"+a.h+"px;height:"+a.h+"px;left:"+d+"px;"),a.label.setAttribute("style","font-size:"+a.labelFontSize+"px;width:"+d+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";")):(a.dummyLabel.setAttribute("style","position:absolute;width:"+a.h+"px;height:"+a.h+"px;left:0;"),a.checkbox.setAttribute("style","width:"+a.h+"px;height:"+a.h+"px;left:0;"),a.label.setAttribute("style",
"font-size:"+a.labelFontSize+"px;width:"+d+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";left:"+a.h+"px"));a.checkbox.checked=0!=c.getVariable(a.id);a.label.width=d*a.ratio;a.label.height=a.h*a.ratio;a.update()};p.prototype.update=function(){a=this;c=a.evaluator;a.activeIfValue=0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);a.checkbox.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":
"none";if(!a.parent.animation.playing||document.activeElement!=a.checkbox){var b=0!==c.getVariable(a.id)?1:0;if(""===a.radio_group)a.pressed?(a.value=a.checkbox.checked?1:0,a.pressed=!1):(a.value=b,a.checkbox.checked=0!==a.value),c.setVariable(a.id,a.value);else{a.value=c.getVariable(a.id);c.setVariable(a.radio_group,0);b=document.querySelectorAll("[name="+a.radio_group+"]");var l=-1;if(a.pressed){for(l=b.length-1;0<=l;l--)c.setVariable(b[l].internalID,0),b[l].checked=!1;c.setVariable(a.id,1);a.checkbox.checked=
!0;a.value=1;c.setVariable(a.radio_group,a.id);a.pressed=0}else{for(var e=b.length-1;0<=e;e--)l=0!=c.getVariable(b[e].internalID)?e:l,c.setVariable(b[e].internalID,0),b[e].checked=!1;0<=l&&(c.setVariable(b[l].internalID,1),b[l].checked=!0,c.setVariable(a.radio_group,b[l].internalID));a.value=a.checkbox.checked?1:0}}}a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);
(h=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(h.constructor.name)&&(a.label_ctx.fillStyle=h,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/
a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};p.prototype.addEvents=function(){var a=this;a.label.ontouchstart=a.label.onmousedown=a.dummyLabel.onmousedown=b.preventDefault;a.checkbox.addEventListener("click",function(){a.pressed=!0;a.updateAndExecAction()})};b.Checkbox=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name.trim()+"'");void 0===a.valueExprString&&(a.valueExprString=a.onlyText?"0":"");a.emptyString=!1;a.ok=0;a.tabindex=++c.tabindex;if(a.answer&&
a.evaluate){if(g=a.answer.match(/^krypto_(.*)$/))a.answer=(new b.Krypto).decode(g[1]);a.answer=b.answerRegEx(a.answer,a.evaluator,a.onlyText)}a.onlyText&&(/^'.*'$/.test(a.valueExprString)||(a.valueExpr=a.evaluator.parser.parse("'"+a.valueExprString+"'")),a.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&/^'.*'$/.test(a)?a.slice(1,-1):a},a.formatValue=function(a){return a.toString()});a.containerControl=b.newHTML("div",{class:"DescartesTextFieldContainer",id:a.id});a.field=b.newHTML("input",
{type:"text",id:a.id+"TextField",class:"DescartesTextFieldField",tabindex:a.tabindex});a.label=b.newHTML("canvas",{class:"DescartesTextFieldLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.containerControl.appendChild(a.label);a.containerControl.appendChild(a.field);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.containerControl.appendChild(a.cover);a.activoStr=a.id+".activo";a.activeStr=a.id+".active";a.addControlContainer(a.containerControl);a.addEvents();a.init();
return d};$jscomp.inherits(q,b.Control);q.prototype.init=function(d){a=this;c=a.evaluator;a.label.innerHTML=c.eval(a.name).toString();var g=a.label.textContent;d||(a.value=a.validateValue(c.eval(a.valueExpr)));d=a.formatValue(a.value);a.fieldFontSize=0<c.eval(a.font_size)?c.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:c,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+
a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var e=b.getTextWidth(d+"_",a.fieldFontSize+"px "+b.sansserif_font),m=parseInt(a.w/2),l=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(m=a.w,e=0);m<l&&(m=l);""==g&&(m=0);a.w-m<e&&(m=a.w-e);0>m&&(m=0);g=a.w-m;a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+
";");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+g+"px;height:"+a.h+"px;left:"+m+"px; font-family:"+("Serif"==a.font_family?b.serif_font:"Monospaced"==a.font_family?b.monospace_font:b.sansserif_font)+";");a.field.value=d;a.cover.setAttribute("style",";width:"+g+"px;height:"+a.h+"px;left:"+m+"px;");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+m+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+
";");a.label.width=m*a.ratio;a.label.height=a.h*a.ratio;a.evaluate&&(a.ok=a.evalAnswer());a.evaluator.setVariable(a.id,a.value);a.evaluator.setVariable(a.id+".ok",a.ok);a.oldValue=a.value;a.update()};q.prototype.update=function(){a=this;c=a.evaluator;a.activeIfValue=0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":"none";a.parent.animation.playing&&document.activeElement==a.field||(h=a.field.value,p=a.value,
a.value=a.validateValue(c.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value===p&&a.field.value!=h&&(a.value=a.validateValue(h),a.field.value=a.formatValue(a.value)),c.setVariable(a.id,a.value));a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(n=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(n.constructor.name)&&(a.label_ctx.fillStyle=
n,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.validateValue=function(a){if(""===a||"''"==
a)return"";c=this.evaluator;a=a.toString().replace(this.parent.decimal_symbol_regexp,".");d=a==parseFloat(a)?parseFloat(a):parseFloat(c.eval(c.parser.parse(a)));isNaN(d)&&(d=0);l=c.eval(this.min);e=c.eval(this.max);""===l&&(l=-Infinity);""===e&&(e=Infinity);d<l&&(d=l);d>e&&(d=e);this.discrete&&(a=c.eval(this.incr),d=0===a?0:a*Math.round(d/a));return d=parseFloat(parseFloat(d).toFixed(c.eval(this.decimals)))};q.prototype.formatValue=function(a){return""===a?a:b.Control.prototype.formatValue.call(this,
a)};q.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatValue(this.value),this.evaluate&&(this.ok=this.evalAnswer()),this.evaluator.setVariable(this.id,this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};q.prototype.evalAnswer=function(){return b.esCorrecto(this.answer,this.value,this.evaluator)};q.prototype.deactivate=function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,
0)};q.prototype.addEvents=function(){var a=this;a.label.addEventListener("touchstart",b.preventDefault);a.label.addEventListener("mousedown",b.preventDefault);a.field.addEventListener("mousedown",function(b){a.parent.deactivateControls();a.evaluator.setVariable(a.activoStr,1);a.evaluator.setVariable(a.activeStr,1);a.parent.update()});a.field.addEventListener("blur",function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.field.addEventListener("keydown",function(b){a.activeIfValue&&13==b.keyCode&&
a.changeValue(a.field.value,!0)});a.field.addEventListener("click",function(a){this.focus()});a.cover.addEventListener("click",function(b){a.parent.deactivateControls();a.evaluator.setVariable(a.activoStr,1);a.evaluator.setVariable(a.activeStr,1);a.parent.update();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)})};b.TextField=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.abs,h,p,d,l,e,n,g,q,m,f,w,u=function(a,c){function d(a){e.options=a.split(",");e.menuOptions=[];e.strVal=[];for(var c=0,d=e.options.length;c<d;c++)a=e.customSplit(e.options[c]),1==a.length?(e.menuOptions.push(a[0]),e.strVal.push(c.toString())):2==a.length&&(e.menuOptions.push(a[0]),""==a[1]?e.strVal.push(c.toString()):e.strVal.push(a[1]));a=0;for(c=e.menuOptions.length;a<c;a++)/^\[.*\]$/.test(e.menuOptions[a])?e.menuOptions[a]=h.parse(e.menuOptions[a].slice(1,
-1)):e.menuOptions[a]=h.parse("'"+e.menuOptions[a]+"'");a=0;for(c=e.strVal.length;a<c;a++)/^\[.*\]$/.test(e.strVal[a])?e.strVal[a]=h.parse(e.strVal[a].slice(1,-1)):e.strVal[a]=h.parse(e.strVal[a]);e.select.innerHTML="";a=$jscomp.makeIterator(e.menuOptions);for(c=a.next();!c.done;c=a.next())d=c.value,c=b.newHTML("option"),c.innerHTML=p.eval(d),e.select.appendChild(c);return 0}var g,e=g=b.Control.call(this,a,c)||this;h=e.parser;p=e.evaluator;e.label_color=e.label_color||new b.Color("e0e4e8",p);e.label_text_color=
e.label_text_color||new b.Color("000000",p);e.options=c.options||"";e.ok=0;e.tabindex=++a.tabindex;e.answer&&(/^krypto_/.test(e.answer)&&(e.answer=(new b.Krypto).decode(e.answer.substring(7))),console.log(e.answer),e.answer=parseInt(e.answer.split(",")[0].replace("[",""))||0);e.name_str=e.name;/^\[.*\]$/.test(e.name)?e.name=e.parser.parse(e.name.slice(1,-1)):e.name=e.parser.parse("'"+e.name+"'");e.evaluator.setFunction(e.id+".setOptions",d);e.containerControl=b.newHTML("div",{class:"DescartesMenuContainer",
id:e.id});e.label=b.newHTML("canvas",{class:"DescartesMenuLabel"});e.label_ctx=e.label.getContext("2d");e.ratio=a.ratio;e.select=b.newHTML("select",{id:e.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:e.tabindex});e.field=b.newHTML("input",{type:"text",id:e.id+"_menuField",class:"DescartesMenuField",tabindex:e.tabindex});d(e.options);e.containerControl.appendChild(e.label);e.containerControl.appendChild(e.select);e.visible&&e.containerControl.appendChild(e.field);e.cover=b.newHTML("div",{class:"TextfieldCover"});
e.keyboard&&e.visible&&e.containerControl.appendChild(e.cover);e.addControlContainer(e.containerControl);e.addEvents();e.init();return g};$jscomp.inherits(u,b.Control);u.prototype.init=function(c){a=this;p=a.evaluator;a.label.innerHTML=p.eval(a.name).toString();var d=a.label.textContent;a.fieldFontSize=0<p.eval(a.font_size)?p.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:p,decimals:a.decimals,fixed:!1,align:"left",
anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var g=0,e=0;a.value=c?a.value:p.eval(a.valueExpr);a.idxVal=a.getIndex(a.value);for(var f=0,m=a.menuOptions.length;f<m;f++)c=b.getTextWidth(p.eval(a.menuOptions[f]).toString(),a.fieldFontSize+"px "+b.sansserif_font),c>g&&(g=c,e=f);g+=25;c=b.getTextWidth(a.formatValue(p.eval(a.strVal[e])),
a.fieldFontSize+"px "+b.sansserif_font)+7;e=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);""==d&&(e=0);a.visible||(c=0);for(d=a.w-c-e;d<g&&0<e;)e--,d++;for(;d<g&&0<c;)c--,d++;for(;e+d+c+1<a.w;)d++,c++;g=e;f=g+d;c=a.w-f;m=a.formatValue(p.eval(a.strVal[a.idxVal]));a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+e+"px;height:"+a.h+"px;line-height:"+
a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=e*a.ratio;a.label.height=a.h*a.ratio;a.field.value=m;a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+c+"px;height:"+a.h+"px;left:"+f+"px;");a.cover.setAttribute("style","width:"+c+"px;height:"+a.h+"px;left:"+f+"px;");a.select.setAttribute("style","text-align:left;font-size:"+a.fieldFontSize+"px;width:"+d+"px;height:"+a.h+"px;left:"+g+"px;");a.select.selectedIndex=a.idxVal;
p.setVariable(a.id,parseFloat(m.replace(a.parent.decimal_symbol,".")));a.update()};u.prototype.update=function(){a=this;p=a.evaluator;a.activeIfValue=0<p.eval(a.activeif);a.drawIfValue=0<p.eval(a.drawif);a.field.disabled=a.activeIfValue?!1:!0;a.select.disabled=a.activeIfValue?!1:!0;a.drawIfValue?a.containerControl.style.display="block":(a.click=!1,a.containerControl.style.display="none");if(!a.parent.animation.playing||document.activeElement!=a.select){for(var b=0,c=a.menuOptions.length;b<c;b++)a.select.options[b].innerHTML=
(p.eval(a.menuOptions[b])||"").replace(/\\u002C/g,",");a.value=p.getVariable(a.id);isNaN(a.value)&&(a.value=0);a.field.value=a.formatValue(a.value);p.setVariable(a.id,parseFloat(a.value));a.select.selectedIndex=parseFloat(a.getIndex(a.value))}a.ok=a.value==a.answer?1:0;a.evaluator.setVariable(a.id+".ok",a.ok);a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);
(w=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(w.constructor.name)&&(a.label_ctx.fillStyle=w,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/
a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};u.prototype.customSplit=function(a){n=!1;g="";q=0;for(m=-1;q<a.length;){f=a.charAt(q);if("["===f&&-1===m){if(n||""!=g)g+="\u00a6";m++}else"["===f?m++:"]"===f&&0===m?(n=!0,m--):"]"==a.charAt(q)&&(m=0>m?m:m-1);g+=a.charAt(q);q++}return g.split("\u00a6")};u.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));d=-1;l=Infinity;for(var b=0,g=this.strVal.length;b<g;b++)e=c(a-parseFloat(this.evaluator.eval(this.strVal[b]))),
e<=l&&(l=e,d=b);this.evaluator.setVariable(this.id+".txt",this.select.options[this.select.selectedIndex].text);return d};u.prototype.changeValue=function(b,c){a=this;a.activeIfValue&&(c&&(a.idxVal=a.getIndex(b),a.value=a.evaluator.eval(a.strVal[a.idxVal]),a.field.value=a.formatValue(a.idxVal),a.select.selectedIndex=a.idxVal),a.evaluator.setVariable(a.id,a.value),a.updateAndExecAction())};u.prototype.addEvents=function(){var a=this;a.label.addEventListener("touchstart",b.preventDefault);a.label.addEventListener("mousedown",
b.preventDefault);a.select.addEventListener("change",function(b){a.value=a.evaluator.eval(a.strVal[this.selectedIndex]);a.field.value=a.formatValue(a.value);a.evaluator.setVariable(a.id,a.field.value);a.changeValue();b.preventDefault()});a.field.addEventListener("keydown",function(b){13==b.keyCode&&(a.idxVal=a.getIndex(a.field.value),a.value=a.evaluator.eval(a.strVal[a.idxVal]),a.field.value=a.formatValue(a.idxVal),a.select.selectedIndex=a.idxVal,a.changeValue())});a.field.addEventListener("blur",
function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.field.addEventListener("click",function(b){a.field.focus()});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)})};b.Menu=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h,p,d,l,e,n,g,q,m,f,w,u,x,r,v,z,y,A=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.orientation=a.w>=a.h?"h":"v";a.container=b.newHTML("div",{class:"DescartesScrollbarContainer",
id:a.id});a.canvas=b.newHTML("canvas");a.divUp=b.newHTML("div",{class:"DescartesCatcher up"});a.divDown=b.newHTML("div",{class:"DescartesCatcher down"});a.field=b.newHTML("input",{type:"text",id:a.id+"scrollbar",class:"DescartesScrollbarField"});a.handler=b.newHTML("div",{class:"DescartesCatcher manipulator"});a.label=b.newHTML("canvas",{class:"DescartesScrollbarLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.canvas);a.container.appendChild(a.label);a.container.appendChild(a.divUp);
a.container.appendChild(a.divDown);a.container.appendChild(a.field);a.container.appendChild(a.handler);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);a.addEvents();a.init();return d};$jscomp.inherits(A,b.Control);A.prototype.init=function(){a=this;h=a.evaluator;0==h.eval(a.decimals)?a.incr=1:a.incr=(h.eval(a.max)-h.eval(a.min))/100;a.value=a.validateValue(h.eval(a.valueExpr));p=a.formatValue(a.value);d=a.evaluator.eval(a.expresion)[0];
a.x=d[0];a.y=d[1];4==d.length&&(a.w=d[2],a.h=d[3]);a.orientation=a.w>=a.h?"h":"v";a.initScroll(p);a.changeScrollPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};A.prototype.initScroll=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();z=a.label.textContent;var d="v"===a.orientation?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=0<h.eval(a.font_size)?h.eval(a.font_size):"v"===a.orientation?d-parseInt(a.h/20)-1:b.getFieldFontSize(d);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:a.evaluator,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);c=b.getTextWidth(c+"_",a.fieldFontSize+"px "+b.sansserif_font);var g=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=""==z?0:d;a.fieldHeight=""==a.visible?0:d;if("v"===a.orientation)a.canvasWidth=a.w,a.canvasHeight=
a.h-a.labelHeight-a.fieldHeight,18<=a.canvasHeight+a.y-g&&(a.canvasHeight=g),d=a.fieldHeight,c=d+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=c,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.upX=0,a.upY=a.fieldHeight,a.downX=0,a.downY=c-a.downH,a.fieldWidth=a.w,a.fieldX=0,a.handlerW=a.w,a.handlerH=parseInt((a.canvasHeight-a.upHeight-a.downH-a.labelHeight-a.fieldHeight)/10),a.handlerH=a.canvasHeight-a.upHeight-a.downH-a.labelHeight-a.fieldHeight>2*a.w?a.w:a.handlerH,
a.handlerH=15>a.handlerH?15:a.handlerH,a.limInf=c-a.downH-a.handlerH,a.limSup=d+a.downH;else{d=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=d;a.fieldWidth=c;""==z&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(d=a.w-a.fieldWidth-a.labelWidth;58>d&&0<a.labelWidth;)a.labelWidth--,d++;for(;58>d&&0<a.fieldWidth;)a.fieldWidth--,d++;c=a.labelWidth;g=c+d;a.fieldWidth=a.w-g;a.canvasWidth=d;a.canvasHeight=a.h;a.canvasX=a.labelWidth;a.canvasY=0;a.fieldX=a.canvasWidth+a.labelWidth;
a.labelHeight=a.h;a.labelY=0;a.upWidth=a.downW=a.h;a.upHeight=a.downH=a.h;a.upX=g-a.downW;a.upY=0;a.downX=a.labelWidth;a.downY=0;a.handlerW=parseInt((a.canvasWidth-a.upWidth-a.downW)/10);a.handlerW=a.canvasWidth-a.upWidth-a.downW>2*a.h?a.h:a.handlerW;a.handlerW=15>a.handlerW?15:a.handlerW;a.handlerH=a.h;a.limInf=c+a.downW;a.limSup=c+a.canvasWidth-a.downW-a.handlerW}a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.canvas.setAttribute("width",
a.w+"px");a.canvas.setAttribute("height",a.h+"px");a.canvas.setAttribute("style","position:absolute;left:0;top:0;");a.ctx=a.canvas.getContext("2d");a.ctx.imageSmoothingEnabled=!1;a.divUp.setAttribute("style","width:"+a.upWidth+"px;height:"+a.upHeight+"px;left:"+a.upX+"px;top:"+a.upY+"px;");a.divDown.setAttribute("style","width:"+a.downW+"px;height:"+a.downH+"px;left:"+a.downX+"px;top:"+a.downY+"px;");a.handler.setAttribute("style","width:"+a.handlerW+"px;height:"+a.handlerH+"px;left:"+("v"===a.orientation?
0:a.limInf)+"px;top:"+("v"===a.orientation?a.limInf:0)+"px;");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");a.cover.setAttribute("style","width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");0===a.fieldHeight&&(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.labelWidth+"px;height:"+a.labelHeight+"px;line-height:"+a.labelHeight+
"px;left:0;top:"+a.labelY+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=a.labelWidth*a.ratio;a.label.height=a.labelHeight*a.ratio};A.prototype.update=function(){a=this;h=a.evaluator;0==h.eval(a.decimals)?a.incr=1:a.incr=(h.eval(a.max)-h.eval(a.min))/100;a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.drawIfValue?(a.container.style.display="block",a.draw()):a.container.style.display=
"none";a.updatePositionAndSize();var b=a.validateValue(h.getVariable(a.id));b==a.value||0<Math.abs(b-a.value)&&1E-9>Math.abs(b-a.value)||(a.value=b,a.changeScrollPosition(),a.prePos=a.pos);a.value=b;a.field.value=a.formatValue(a.value);h.setVariable(a.id,a.value);a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(y=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(y.constructor.name)&&
(a.label_ctx.fillStyle=y,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};A.prototype.draw=function(){a=
this;l=a.ctx;n=c(a.w);e=c(a.h);l.fillStyle=a.color.getColor();l.fillRect(0,0,n,e);l.fillStyle="black";l.beginPath();"h"===a.orientation?(l.lineWidth=1,l.strokeStyle="rgba(0,0,0,0.3)",l.strokeRect(parseInt(a.labelWidth)+.5,.5,n-1-parseInt(a.labelWidth),e-1),l.lineWidth=Math.ceil(12*a.upWidth/100)||1,l.strokeStyle=a.colorInt.getColor(),l.moveTo(a.downX+62.215*a.upWidth/100,20*a.downH/100),l.lineTo(a.downX+32.449*a.upWidth/100,a.downH/2),l.lineTo(a.downX+62.215*a.upWidth/100,80*a.downH/100),l.moveTo(a.upX+
32.449*a.upWidth/100,20*a.downH/100),l.lineTo(a.upX+62.215*a.upWidth/100,a.downH/2),l.lineTo(a.upX+32.449*a.upWidth/100,80*a.downH/100),l.stroke(),q=c(a.pos),g=Math.ceil(e/10)||1,l.fillStyle=a.colorInt.getColor(),l.fillRect(q+.5,g,c(a.handlerW),e-2*g)):(l.lineWidth=1,l.strokeStyle="rgba(0,0,0,0.3)",l.strokeRect(.5,.5,n-1,e-parseInt(a.labelHeight)-.5),l.lineWidth=Math.ceil(12*a.upWidth/100)||1,l.strokeStyle=a.colorInt.getColor(),l.moveTo(20*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),l.lineTo(50*
a.upWidth/100,a.h-a.labelHeight-40.237*a.downH/100),l.lineTo(80*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),l.moveTo(20*a.upWidth/100,a.upY+70*a.downH/100),l.lineTo(50*a.upWidth/100,a.upY+40.237*a.downH/100),l.lineTo(80*a.upWidth/100,a.upY+70*a.downH/100),l.stroke(),q=c(a.pos),g=Math.ceil(n/10)||1,l.fillStyle=a.colorInt.getColor(),l.fillRect(g,q+.5,n-2*g,c(a.handlerH)));a.activeIfValue||(l.fillStyle="rgba(255,255,255,0.5)",l.fillRect(0,0,l.canvas.width,l.canvas.height))};A.prototype.validateValue=
function(b){a=this;h=a.evaluator;m=b.toString();m=parseFloat(m.replace(a.parent.decimal_symbol,"."));isNaN(m)&&(m=0);a.minimo=h.eval(a.min);m<a.minimo&&(a.value=null,m=a.minimo);a.maximo=h.eval(a.max);m>a.maximo&&(a.value=null,m=a.maximo);f=a.incr;m=0!=f?m*f/f:0;a.fixed&&(m=parseFloat(parseFloat(m).toFixed(h.eval(a.decimals))));return m};A.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};A.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};
A.prototype.increase10=function(){a=this;g=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;"h"==a.orientation?a.clickPos.x>a.prePos&&a.changeValue(parseFloat(a.value)+g):a.clickPos.y<a.prePos&&a.changeValue(parseFloat(a.value)+g)};A.prototype.decrease10=function(){a=this;g=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;"h"==a.orientation?a.clickPos.x<a.prePos&&a.changeValue(parseFloat(a.value)-g):a.clickPos.y>a.prePos&&a.changeValue(parseFloat(a.value)-g)};A.prototype.changeValue=function(b){a=
this;a.activeIfValue&&(w=a.validateValue(b),w!=a.value&&(a.value=w,a.field.value=a.formatValue(w),a.changeScrollPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};A.prototype.changeValueMovement=function(){a=this;h=a.evaluator;u=a.limInf;x=a.limSup;r=h.eval(a.min);v=h.eval(a.max);f=a.incr;w=c((a.pos-u)*(v-r)/(x-u)/f)*f+r;w!=a.value&&(a.value=w,a.field.value=a.formatValue(w),h.setVariable(a.id,a.value),a.parent.updateControls(),a.actionExec.execute(),a.parent.update())};
A.prototype.changeScrollPosition=function(){a=this;h=a.evaluator;u=a.limInf;x=a.limSup;r=h.eval(a.min);v=h.eval(a.max);f=a.incr;a.pos=(a.value-r)*(x-u)/(v-r)+u;a.handler.style["h"==a.orientation?"left":"top"]=a.pos+"px"};A.prototype.addEvents=function(){function a(c,d,g,e){b.clearTimeout(u);(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-e)&&(d.call(n),c=g?c:30,u=b.setTimeout(function(){a(c,d,!1,e)},c))}function c(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&
(n.clickPos=b.getCursorPosition(c,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?a(350,n.decrease10,!0,n.minimo):a(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?a(350,n.increase10,!0,n.maximo):a(350,n.decrease10,!0,n.minimo))}function d(a){n.canvasClick=!1;b.clearTimeout(u)}function g(a){1==n.canvasClick&&(n.clickPos=b.getCursorPosition(a,n.container),a.preventDefault())}function e(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",e,!1);window.removeEventListener("mousemove",
m,!1);a.preventDefault()}function f(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",f,!1);window.removeEventListener("touchmove",m,!1);a.preventDefault()}function m(a){var c=b.getCursorPosition(a,n.container);"h"==n.orientation?(n.pos=n.prePos-(n.initPos.x-c.x),n.pos<n.limInf&&(n.pos=n.limInf),n.pos>n.limSup&&(n.pos=n.limSup),n.handler.setAttribute("style","width:"+n.handlerW+"px;height:"+n.h+"px;left:"+n.pos+"px;top:0;")):(n.pos=n.prePos-(n.initPos.y-c.y),n.pos>n.limInf&&
(n.pos=n.limInf),n.pos<n.limSup&&(n.pos=n.limSup),n.handler.setAttribute("style","width:"+n.w+"px;height:"+n.handlerH+"px;left:0;top:"+n.pos+"px;"));n.changeValueMovement();a.preventDefault()}function l(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,a(350,n.increase,!0,n.maximo))}function q(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,a(350,n.decrease,!0,n.minimo))}function h(a){n.down=!1;b.clearTimeout(u);a.preventDefault()}
function p(a){n.up=!1;b.clearTimeout(u);n.draw()}function r(a){n.down=!1;b.clearTimeout(u);n.draw()}var n=this,u;n.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});n.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.field.value,!0)});n.canvas.addEventListener("touchstart",c);n.canvas.addEventListener("mousedown",c);n.divDown.addEventListener("mouseout",h);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);n.canvas.addEventListener("touchmove",
g);n.canvas.addEventListener("mousemove",g);n.handler.addEventListener("touchstart",function(a){n.activeIfValue&&(n.scrollClick=!0,n.initPos=b.getCursorPosition(a,n.container),window.addEventListener("touchend",f),window.addEventListener("touchmove",m),a.preventDefault())});n.handler.addEventListener("mousedown",function(a){n.activeIfValue&&(n.scrollClick=!0,n.initPos=b.getCursorPosition(a,n.container),window.addEventListener("mouseup",e),window.addEventListener("mousemove",m),a.preventDefault())});
n.divUp.addEventListener("touchstart",l);n.divUp.addEventListener("mousedown",l);n.divDown.addEventListener("touchstart",q);n.divDown.addEventListener("mousedown",q);n.divUp.addEventListener("mouseout",function(a){n.up=!1;b.clearTimeout(u);a.preventDefault()});n.divDown.addEventListener("mouseout",h);window.addEventListener("touchend",p);window.addEventListener("mouseup",p);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);n.cover.addEventListener("click",function(a){a=n.evaluator.eval(n.kbexp);
n.activeIfValue&&n.parent.keyboard.show(n,n.kblayout,a[0][0]||0,a[0][1]||0,n.id,n.field,n.onlyText)})};b.Scrollbar=A;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h,p,d,l,e,n,g,q,m,f,w=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.orientation=a.w>=a.h?"h":"v";a.container=b.newHTML("div",{class:"DescartesSliderContainer",id:a.id});a.field=
b.newHTML("input",{type:"text",id:a.id+"slider",class:"DescartesSliderField"});a.sliderCtr=b.newHTML("input",{type:"range",id:a.id+"range",min:0,max:100,step:"any",class:"DescartesRange"});a.label=b.newHTML("canvas",{class:"DescartesSliderLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.label);a.container.appendChild(a.field);a.container.appendChild(a.sliderCtr);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);
a.addControlContainer(a.container);a.addEvents();a.init();return d};$jscomp.inherits(w,b.Control);w.prototype.init=function(){a=this;h=a.evaluator;a.value=a.validateValue(h.eval(a.valueExpr));p=a.formatValue(a.value);d=a.evaluator.eval(a.expresion)[0];a.x=d[0];a.y=d[1];4==d.length&&(a.w=d[2],a.h=d[3]);a.orientation=a.w>=a.h?"h":"v";a.initSlider(p);a.changeSliderPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};w.prototype.initSlider=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();
m=a.label.textContent;var d="v"===a.orientation?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=0<h.eval(a.font_size)?h.eval(a.font_size):"v"===a.orientation?d-parseInt(a.h/20)-1:b.getFieldFontSize(d);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:h,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,
a.label_text_color.getColor(),0,0,!0);c=b.getTextWidth(c+"_",a.fieldFontSize+"px "+b.sansserif_font);var g=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=""==m?0:d;a.fieldHeight=""==a.visible?0:d;if("v"===a.orientation)a.canvasWidth=a.w,a.canvasHeight=a.h-a.labelHeight-a.fieldHeight,18<=a.canvasHeight+a.y-g&&(a.canvasHeight=g),d=a.fieldHeight+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=d,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.fieldWidth=a.w,a.fieldX=0,a.sliderCtr.style=
"position:absolute;left:0;top:"+a.canvasY+"px;width:"+a.canvasHeight+"px;height:"+a.canvasWidth+"px;transform-origin:"+a.canvasWidth/2+"px "+a.canvasWidth/2+"px;transform:rotate(90deg);margin:0;padding:0;--thumb_size:"+a.canvasWidth+"px;--track_h:"+parseInt(a.canvasWidth/3)+"px;";else{d=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=d;a.fieldWidth=c;""==m&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(d=a.w-a.fieldWidth-a.labelWidth;58>d&&0<a.labelWidth;)a.labelWidth--,
d++;for(;58>d&&0<a.fieldWidth;)a.fieldWidth--,d++;a.fieldWidth=a.w-(a.labelWidth+d);a.canvasWidth=d;a.canvasHeight=a.h;a.canvasX=a.labelWidth;a.canvasY=0;a.fieldX=a.canvasWidth+a.labelWidth;a.labelHeight=a.h;a.labelY=0;a.upWidth=a.downW=a.h;a.upHeight=a.downH=a.h;a.sliderCtr.style="position:absolute;left:"+a.canvasX+"px;top:0;width:"+a.canvasWidth+"px;height:"+a.canvasHeight+"px;margin:0;padding:0;--thumb_size:"+a.canvasHeight+"px;--track_h:"+parseInt(a.canvasHeight/3)+"px;"}a.container.setAttribute("style",
"width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");a.cover.setAttribute("style","width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");0===a.fieldHeight&&(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.labelWidth+"px;height:"+a.labelHeight+
"px;line-height:"+a.labelHeight+"px;left:0;top:"+a.labelY+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=a.labelWidth*a.ratio;a.label.height=a.labelHeight*a.ratio};w.prototype.update=function(){a=this;h=a.evaluator;a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.drawIfValue?(a.container.style.display="block",a.draw()):a.container.style.display="none";a.updatePositionAndSize();var b=
a.validateValue(h.getVariable(a.id));b==a.value||0<Math.abs(b-a.value)&&1E-9>Math.abs(b-a.value)||(a.value=b,a.changeSliderPosition(),a.prePos=a.pos);a.value=b;a.field.value=a.formatValue(a.value);h.setVariable(a.id,a.value);a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(f=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(f.constructor.name)&&(a.label_ctx.fillStyle=
f,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};w.prototype.draw=function(){a=this;a.sliderCtr.style.setProperty("--track_color",
a.color.getColor());a.sliderCtr.style.setProperty("--thumb_color",a.colorInt.getColor());a.sliderCtr.value=a.pos};w.prototype.validateValue=function(b){a=this;h=a.evaluator;l=b.toString();l=parseFloat(l.replace(a.parent.decimal_symbol,"."));isNaN(l)&&(l=0);a.minimo=h.eval(a.min);l<a.minimo&&(a.value=null,l=a.minimo);a.maximo=h.eval(a.max);l>a.maximo&&(a.value=null,l=a.maximo);e=h.eval(a.incr);l=0!=e?l*e/e:0;a.fixed&&(l=parseFloat(parseFloat(l).toFixed(h.eval(a.decimals))));return l};w.prototype.changeValue=
function(b){a=this;a.activeIfValue&&(n=a.validateValue(b),n!=a.value&&(a.value=n,a.field.value=a.formatValue(n),a.changeSliderPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};w.prototype.changeValueForSliderMovement=function(){a=this;h=a.evaluator;g=h.eval(a.min);q=h.eval(a.max);e=h.eval(a.incr);n=c(a.pos*(q-g)/100/e)*e+g;n!=a.value&&(a.value=n,a.field.value=a.formatValue(n),h.setVariable(a.id,a.value),a.parent.updateControls(),a.actionExec.execute(),a.parent.update())};
w.prototype.changeSliderPosition=function(){h=this.evaluator;g=h.eval(this.min);q=h.eval(this.max);e=h.eval(this.incr);this.pos=100*(this.value-g)/(q-g)};w.prototype.addEvents=function(){var a=this;a.field.addEventListener("keydown",function(b){13==b.keyCode&&a.changeValue(a.field.value)});a.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()})};b.Slider=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p=function(a,c){var d=b.Control.call(this,a,c)||this;d.controls=c.controls||!0;d.file=c.file||"";d.oldDrawIf=0;a=d.evaluator.eval(d.expresion);c=4==a[0].length;d.w=c?a[0][2]:200;d.h=c?a[0][3]:28;d.audio=d.parent.getAudio(d.file);d.oldFile=d.file;/^\[.*\]$/.test(d.file)&&(d.file=d.evaluator.parser.parse(d.file.slice(1,-1)));d.autoplay&&(d.audio.setAttribute("autoplay","autoplay"),d.audio.play());d.loop&&d.audio.setAttribute("loop","loop");d.controls&&
d.audio.setAttribute("controls","controls");d.audio.setAttribute("style","position:absolute;width:"+d.w+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";");d.addControlContainer(d.audio);d.evaluator.setFunction(d.id+".play",function(){try{d.audio.play()}catch(n){}return 0});d.evaluator.setFunction(d.id+".pause",function(){try{d.audio.pause()}catch(n){}return 0});d.evaluator.setFunction(d.id+".stop",function(){try{d.audio.pause(),d.audio.currentTime=0}catch(n){}return 0});d.evaluator.setFunction(d.id+
".currentTime",function(a){try{d.audio.currentTime=parseFloat(a)}catch(g){}return 0});d.audio.addEventListener("timeupdate",function(){d.evaluator.setVariable(d.id+".currentTime",d.audio.currentTime);d.evaluator.setVariable(d.id+".playing",d.audio.paused?0:1);d.evaluator.setVariable(d.id+".duration",d.audio.duration)});return d};$jscomp.inherits(p,b.Control);p.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};p.prototype.update=function(){a=
this.evaluator;"string"!==typeof this.file&&(c=a.eval(this.file),this.old!==c&&(this.audio.src=this.old=c));h=0<a.eval(this.drawif);this.audio.style.display=h?"block":"none";h||h===this.oldDIF||this.audio.pause();this.oldDIF=h;this.updatePositionAndSize()};b.Audio=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p=function(d,l){a=d=b.Control.call(this,d,l)||this;a.controls=l.controls||!0;a.file=l.file||"";a.oldDrawIf=0;c=a.evaluator;l=c.eval(a.expresion)[0];4==l.length?(a.w=l[2],a.h=l[3]):(a.w=null,a.h=null);l=a.file;var e=l.lastIndexOf(".");-1!=e&&(l=a.file.substring(0,e));a.video=b.newHTML("video",{poster:l+".png",style:"position:absolute;overflow:hidden;left:"+a.x+"px;top:"+a.y+"px;outline:none;background:rgba(0,0,0,0);"});a.autoplay&&a.video.setAttribute("autoplay",
"autoplay");a.loop&&a.video.setAttribute("loop","loop");a.controls&&a.video.setAttribute("controls","controls");a.w&&(a.video.setAttribute("width",a.w),a.video.setAttribute("height",a.h));a.video.canPlayType("video/mp4")&&(e=b.newHTML("source",{src:l+".mp4",type:"video/mp4"}),a.video.appendChild(e));a.video.canPlayType("video/ogg")&&(e=b.newHTML("source",{src:l+".ogg",type:"video/ogg"}),a.video.appendChild(e),e=b.newHTML("source",{src:l+".ogv",type:"video/ogg"}),a.video.appendChild(e));a.video.canPlayType("video/webm")&&
(e=b.newHTML("source",{src:l+".webm",type:"video/webm"}),a.video.appendChild(e));a.addControlContainer(a.video);c.setFunction(a.id+".play",function(){try{a.video.play()}catch(n){}return 0});c.setFunction(a.id+".pause",function(){try{a.video.pause()}catch(n){}return 0});c.setFunction(a.id+".stop",function(){try{a.video.pause(),a.video.currentTime=0}catch(n){}return 0});c.setFunction(a.id+".currentTime",function(b){try{a.video.currentTime=parseFloat(b)}catch(g){}return 0});a.video.addEventListener("timeupdate",
function(b){c.setVariable(a.id+".currentTime",a.video.currentTime)});return d};$jscomp.inherits(p,b.Control);p.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};p.prototype.update=function(){a=this;c=a.evaluator;(h=0<c.eval(a.drawif))?a.video.style.display="block":(a.video.style.display="none",h!==a.oldDrawIf&&a.video.pause());a.oldDrawIf=h;a.updatePositionAndSize()};b.Video=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d=function(c,d){var e;a=e=b.Control.call(this,c,d)||this;a.font_family=d.font_family||"sansserif";a.style=d.style||",PLAIN,";a.font_size=d.font_size||12;typeof("number"!==a.font_size)&&(a.font_size=a.evaluator.eval(a.font_size));a.font=a.font_family+a.style+a.font_size;a.evaluator.setVariable(a.id+"._scroll_x",0);a.evaluator.setVariable(a.id+"._scroll_y",0);a.region="interior";a.tabindex=++c.tabindex;a.answer&&(/^krypto_/.test(a.answer)&&(a.answer=
(new b.Krypto).decode(a.answer.substring(7))),a.parent.lessonParser.parseText(a.answer));a.containerControl=b.newHTML("div",{class:"DescartesTextAreaContainer",id:a.id,spellcheck:"false"});a.textArea=b.newHTML("textarea",{class:"DescartesTextArea",spellcheck:"false"});a.textAreaAnswer=b.newHTML("div",{class:"DescartesTextArea"});a.showButton=b.newHTML("div",{class:"DJS_Gradient"});a.containerControl.appendChild(a.textArea);a.containerControl.appendChild(a.textAreaAnswer);a.containerControl.appendChild(a.showButton);
a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.containerControl.appendChild(a.cover);a.addControlContainer(a.containerControl);a.showAnswer=!1;a.text=a.rawText||"";a.evaluator.setVariable(a.id,a.text);var g;a.evaluator.setFunction(a.id+".insertAtCursor",function(b){g=a.textArea.selectionStart+b.length;a.textArea.value=a.textArea.value.substring(0,a.textArea.selectionStart)+b+a.textArea.value.substring(a.textArea.selectionEnd);a.textArea.selectionStart=a.textArea.selectionEnd=g;a.textArea.focus();
return 0});a.evaluator.setFunction(a.id+".update",function(){a.update()});a.evaluator.setFunction(a.id+".scrollTo",function(b){a.textArea.scrollTop=b});a.addEvents();a.init();return e};$jscomp.inherits(d,b.Control);d.prototype.init=function(){a=this;h=a.answer?30:7;c=a.evaluator;var d=a.text.replace(/\\n/g,"\n");a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");var e="width:"+(a.w-6)+"px;height:"+(a.h-h)+"px;font:"+b.convertFont(a.font)+
";line-height:"+a.font_size+"px;";a.textArea.setAttribute("style",e);a.textArea.value=d;a.textAreaAnswer.setAttribute("style",e+"display:"+(a.showAnswer?"block":"none")+";");a.textAreaAnswer.innerHTML="<span>"+a.answer+"</span>";a.showButton.setAttribute("style","text-align:center;width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #c0c0c0;display:"+(a.answer?"block":"none")+";");a.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+
b.sansserif_font+';">S</span>';a.cover.setAttribute("style","position:absolute;width:"+a.w+"px;height:"+a.h+"px;left:0px;top:0px;");a.update()};d.prototype.update=function(){a=this;c=a.evaluator;a.activeIfValue=0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);c.getVariable(a.id)!==a.oldValue&&(a.textArea.value=(c.getVariable(a.id)||"").replace(/\\n/g,"\n"));p=a.textArea.value||"";p="\n"===p.charAt(p.length-1)?p.substring(0,p.length-1):p;p=p.replace(/\n/g,"\\n").replace(/\s/g," ");c.setVariable(a.id,
p);a.oldFieldValue=p;a.oldValue=c.getVariable(a.id);a.activeIfValue?a.textArea.removeAttribute("disabled"):a.textArea.setAttribute("disabled",!0);a.containerControl.style.display=a.drawIfValue?"block":"none";a.textArea.style["overflow-x"]=0<c.getVariable(a.id+"._scroll_x")?"auto":"unset";a.textArea.style["overflow-y"]=0<c.getVariable(a.id+"._scroll_y")?"auto":"unset";a.updatePositionAndSize()};d.prototype.changeValue=function(a){this.textArea.value=a;this.update()};d.prototype.addEvents=function(){var a=
this;a.showButton.addEventListener("mousedown",function(b){b.preventDefault();a.showAnswer=!a.showAnswer;a.textAreaAnswer.style.display=a.showAnswer?"block":"none";a.showButton.childNodes[0].childNodes[0].textContent=a.showAnswer?"T":"S";a.textArea.blur()});a.showButton.onmouseup=a.showButton.onmouseout=function(a){a.preventDefault()};a.textArea.addEventListener("blur",function(){a.cursorInd=window.getSelection().focusOffset});a.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",
!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});a.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});a.cover.addEventListener("pointerdown",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.textArea,!0)})};b.TextArea=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=2*Math.PI,h,p,d,l,e,n,g,q,m,f,w,u,x=function(c,d){var g=b.Control.call(this,c,d)||this;p=c.evaluator.parser;a=g;a.spaceID=d.spaceID||"";a.text=d.text||"";a.size=d.size||p.parse("4");a.font=d.font||"Serif,PLAIN,12";a.image=new Image;a.image.onload=function(){this.ready=1};a.imageSrc=d.imageSrc||"";/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse("'"+a.imageSrc+"'");a.font=b.convertFont(a.font);
if(a.constraintExpr){a.constraint=p.parse(a.constraintExpr);"(expr)"==a.constraint.type&&(a.constraint=p.parse(a.constraintExpr.substring(1,a.constraintExpr.length-1)));if("compOperator"==a.constraint.type){d=a.constraint.childs[0];var e=a.constraint.childs[1];"identifier"!=d.type||"y"!=d.value||e.contains("y")?"identifier"!=d.type||"x"!=d.value||e.contains("x")?a.newt=new b.R2Newton(a.evaluator,a.constraint):(a.constVar="y",a.noConstVar="x",a.evalConst=a.evalConstXoY,a.constraint=e):(a.constVar=
"x",a.noConstVar="y",a.evalConst=a.evalConstXoY,a.constraint=e)}else a.constraint=null;f=new b.R2(0,0)}a.container=a.getContainer();a.mouseCatcher=b.newHTML("div",{class:"DescartesGraphicControl",id:a.id,dragged:!0,tabindex:"-1",style:"z-index:"+a.zIndex+";"});a.ctx=a.space.ctx;a.container.appendChild(a.mouseCatcher);a.addEvents();a.xStr=a.id+".x";a.yStr=a.id+".y";a.activoStr=a.id+".activo";a.activeStr=a.id+".active";c=""!==a.space.id&&2!==c.version?a.space.id+".":"";a.mX=c+"mouse_x";a.mY=c+"mouse_y";
a.mClicked=c+"mouse_clicked";a.mClicIzq=c+"clic_izquierdo";a.init();return g};$jscomp.inherits(x,b.Control);x.prototype.init=function(c){a=this;h=a.evaluator;w=b.hasTouchSupport;c||(c=h.eval(a.expresion)[0],a.x=c[0],a.y=c[1],h.setVariable(a.xStr,a.x),h.setVariable(a.yStr,a.y));a.img_src_eval=h.eval(a.imageSrc).toString().trim();""==a.img_src_eval||/vacio.gif$/i.test(a.img_src_eval)?(a.width=2*h.eval(a.size),a.height=2*h.eval(a.size),a._w=w&&48>a.width?48:a.width,a._h=w&&48>a.height?48:a.height,a.mouseCatcher.style.borderRadius=
parseInt(Math.min(a._w,a._h)/2)+"px"):(a.image=a.parent.getImage(a.img_src_eval),a.width=a.image.width,a.height=a.image.height,a._w=Math.max(a.width,32),a._h=Math.max(a.height,32));a.mouseCatcher.style.width=a._w+"px";a.mouseCatcher.style.height=a._h+"px";a.mouseCatcher.style.left=parseInt(a.space.getAbsoluteX(a.x)-a._w/2)+"px";a.mouseCatcher.style.top=parseInt(a.space.getAbsoluteY(a.y)-a._h/2)+"px";h.setVariable(a.activoStr,0);h.setVariable(a.activeStr,0);a.setImage=!1;a.update()};x.prototype.update=
function(){a=this;h=a.evaluator;h.eval(a.imageSrc).toString().trim()!==a.img_src_eval&&a.init(!0);a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.x=h.getVariable(a.xStr);a.y=h.getVariable(a.yStr);d=a.space.getAbsoluteX(a.x);l=a.space.getAbsoluteY(a.y);a.mouseCatcher.style.display=a.activeIfValue?"block":"none";a.mouseCatcher.style.left=parseInt(d-a._w/2)+"px";a.mouseCatcher.style.top=parseInt(l-a._h/2)+"px";a.constraint&&a.evalConst();a.draw()};x.prototype.draw=function(){a=
this;h=a.evaluator;a.drawIfValue&&(q=a.ctx,m=a.space.backgroundCtx,d=parseInt(a.space.getAbsoluteX(this.x))+.5,l=parseInt(a.space.getAbsoluteY(this.y))+.5,""!=a.text&&a.drawText(d,l),a.image.ready?(e=a.image.width/2,n=a.image.height/2,a.image.complete&&!a.setImage&&q.drawImage(a.image,parseInt(d-e),parseInt(l-n)),a.trace&&(m.save(),m.translate(d,l),m.scale(parseInt(e),parseInt(n)),m.beginPath(),m.arc(0,0,1,0,c),m.restore(),m.lineWidth=1,m.strokeStyle=a.trace.getColor(),m.stroke())):(e=parseInt(a.width/
2),q.beginPath(),q.arc(d,l,e,0,c),q.fillStyle=a.colorInt.getColor(),q.fill(),q.lineWidth=1,q.strokeStyle=a.color.getColor(),q.stroke(),a.active&&(q.strokeStyle=a.colorInt.borderColor(),q.beginPath(),q.arc(d,l,e-2,0,c),q.stroke()),a.trace&&(m.strokeStyle=a.trace.getColor(),m.beginPath(),m.arc(d,l,e,0,c),m.stroke())))};x.prototype.evalConst=function(){f.set(this.x,this.y);g=this.newt.findZero(f,1/this.space.scale,!0);this.x=g.x;this.y=g.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,
this.y)};x.prototype.evalConstXoY=function(){h=this.evaluator;u=h.getVariable(this.constVar);h.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=h.eval(this.constraint);h.setVariable(this.xStr,this.x);h.setVariable(this.yStr,this.y);h.setVariable(this.constVar,u)};x.prototype.drawText=function(b,c){a=this;h=a.evaluator;q=a.ctx;q.fillStyle=a.color.getColor();q.textBaseline="alphabetic";"simpleText"==a.text.type?(q.font=a.font,q.fillText(a.text.toString(h.eval(a.decimals),a.fixed),
parseInt(b+1+a.width/2),parseInt(c-1-a.height/2))):(q.strokeStyle=a.color.getColor(),a.text.draw(q,parseInt(b+1+a.width/2),parseInt(c-1-a.height/2),a.decimals,a.fixed,"start",!0,a.color.getColor()))};x.prototype.getContainer=function(){for(var a=this.parent.spaces,b=$jscomp.makeIterator(a),c=b.next();!c.done;c=b.next())if(c=c.value,c.id==this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};
x.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};x.prototype.addEvents=function(){function a(a){document.body.focus();a.preventDefault();f.whichBtn=b.whichBtn(a);"L"==f.whichBtn&&f.activeIfValue&&(f.parent.deactivateControls(),f.click=f.active=!0,f.evaluator.setVariable(f.activoStr,1),f.evaluator.setVariable(f.activeStr,1),f.evaluator.setVariable(f.mClicked,0),f.evaluator.setVariable(f.mClicIzq,
0),f.posAnte=b.getCursorPosition(a,f.container),f.prePos={x:f.space.getAbsoluteX(f.x),y:f.space.getAbsoluteY(f.y)},f.evaluator.setVariable(f.mX,f.space.getRelativeX(f.posAnte.x)),f.evaluator.setVariable(f.mY,f.space.getRelativeY(f.posAnte.y)),f.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",d),window.addEventListener("mouseup",c),window.addEventListener("mousemove",d))}function c(a){document.body.focus();a.preventDefault();a.stopPropagation();f.evaluator.setVariable(f.mClicked,
1);f.evaluator.setVariable(f.mClicIzq,1);if(f.activeIfValue||f.active)f.click=!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),e=b.getCursorPosition(a,f.container)||e,f.posX=f.prePos.x-(f.posAnte.x-e.x),f.posY=f.prePos.y-(f.posAnte.y-e.y),f.evaluator.setVariable(f.xStr,f.space.getRelativeX(f.posX)),f.evaluator.setVariable(f.yStr,f.space.getRelativeY(f.posY)),f.evaluator.setVariable(f.mX,
f.space.getRelativeX(e.x)),f.evaluator.setVariable(f.mY,f.space.getRelativeY(e.y)),f.parent.updateControls(),f.parent.update(),f.mouseCatcher.style.left=f.space.getAbsoluteX(f.x)-f._w/2+"px",f.mouseCatcher.style.top=f.space.getAbsoluteY(f.y)-f._h/2+"px";a=f.evaluator.getVariable(f.activeStr);f.parent.deactivateControls();f.parent.updateControls();f.evaluator.setVariable(f.activoStr,a);f.evaluator.setVariable(f.activeStr,a);f.parent.update()}function d(a){a.preventDefault();f.evaluator.setVariable(f.mClicked,
0);f.evaluator.setVariable(f.mClicIzq,0);e=b.getCursorPosition(a,f.container);f.posX=f.prePos.x-(f.posAnte.x-e.x);f.posY=f.prePos.y-(f.posAnte.y-e.y);f.evaluator.setVariable(f.xStr,f.space.getRelativeX(f.posX));f.evaluator.setVariable(f.yStr,f.space.getRelativeY(f.posY));f.evaluator.setVariable(f.mX,f.space.getRelativeX(e.x));f.evaluator.setVariable(f.mY,f.space.getRelativeY(e.y));80<Date.now()-g&&(f.parent.updateControls(),f.parent.update(),g=Date.now())}var g=0,e,f=this;f.click=!1;f.over=!1;f.active=
!1;f.mouseCatcher.addEventListener("touchstart",a);f.mouseCatcher.addEventListener("mousedown",a);f.mouseCatcher.addEventListener("mouseover",function(a){f.over=!0});f.mouseCatcher.addEventListener("mouseout",function(a){f.over=!1;f.click=!1})};b.GraphicControl=x;return b}(descartesJS||{});
descartesJS=function(b,a){function c(a){return a?a[0].toUpperCase()+a.substring(1):""}if(b.loadLib)return b;var h=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,p,d,l,e,n,g,q,m,f,w,u,x,r,v,z,y,A=function(a){this.parent=a;this.parser=a.evaluator.parser;this.RTFparser=new b.RTFParser(a.evaluator)};A.prototype.parseButtonsConfig=function(b){var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};b=this.split(b);for(var g=0,f=b.length;g<f;g++)switch(l=b[g][0],e=b[g][1],d=a[l],d){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[d]=
parseInt(e);break;case "about":case "config":case "init":case "clear":c[d]="true"===a[e];break;default:console.warn("Propiedad de botones no identificada: <"+l+"> valor: <"+e+">")}return c};A.prototype.parseSpace=function(c){n={};c=this.split(c);for(var g=0,f=c.length;g<f;g++)switch(l=c[g][0],e=c[g][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Space",d){case "info":break;case "type":if("R2"===e||"R3"===e)e=a[e];n[d]=e;break;case "id":b.DEBUG.idName=e;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":n[d]=
e;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":n[d]="true"===a[e];break;case "bg_display":case "render":n[d]=a[e];break;case "border_color":case "net":case "net10":case "axes":case "text":n[d]="";""!=e&&(n[d]="false"===a[e]?"":new b.Color(e,this.parent.evaluator));break;case "O.x":n.OxExpr=e;break;case "O.y":n.OyExpr=e;break;case "image":n.imageSrc=e;break;case "x":case "y":p=e.trim();var m="x"===d?this.parent.container.width:this.parent.container.height;
"%"===p[p.length-1]?(n[d+"PercentExpr"]=p,p=(m*parseFloat(p)/100).toString()):p=e.trim();n[d+"Expr"]=this.parser.parse(p);break;case "width":case "height":p=e.trim();n[d[0]+"ModExpr"]=p;"%"===p[p.length-1]?(n[d[0]+"Expr"]=p,p=this.parent.container[d]*parseFloat(p)/100):(p=parseFloat(e),p!=e&&(p=this.parent.container[d],n["_"+d[0]+"_"]=e.trim()));n[d[0]]=p;break;case "drawif":""!=e&&(n[d]=this.parser.parse(e));break;case "scale":p=parseFloat(e);isNaN(p)&&(p=48);n[d]=p;break;case "background":n[d]=
new b.Color(e,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+l+"> valor: <"+e+">")}return new b["Space"+n.type](this.parent,n)};A.prototype.parseControl=function(f){g={type:"Numeric",gui:"Spinner"};f=this.split(f);for(var m=0,q=f.length;m<q;m++)switch(l=f[m][0],e=f[m][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Control",d){case "info":break;case "type":p=a[e.trim()];"graphic"===p?p="GraphicControl":"text"===p&&(p="TextArea");g[d]=c(p);break;case "gui":p=
a[e];"textfield"===p&&(p="TextField");g[d]=c(p);break;case "id":b.DEBUG.idName=e;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":g[d]=e;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":g[d]=a[e];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":g[d]=
"true"===a[e];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":g[d]=new b.Color(e,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==e&&(g[d]=this.parser.parse(e));break;case "constraint":g.constraintExpr=e;break;case "image":g.imageSrc=e;break;case "image_dec":g.image_dec_src=e;break;case "image_inc":g.image_inc_src=e;break;case "space":g.spaceID=e;break;case "expresion":case "kbexp":g[d]=
this.parser.parse(e.replace(")(",","));break;case "borderColor":g[d]="false"===a[e]?"":e;break;case "bold":case "italics":"false"!=a[e]&&(g[d]=d);break;case "underlined":"false"!=a[e]&&(g.underlined=!0);break;case "value":var h=e.replace(/&squot;/g,"'").replace(/^\|(.*)\|$/,"'$1'");g.valueExpr=this.parser.parse(h);g.valueExprString=h;break;case "incr":0!=e&&(g[d]=this.parser.parse(e));break;case "exponentialif":g[d]=parseFloat(e);break;case "text":g.rawText=e;h=this.parseText(e);for(var r=0,n=h.length;r<
n;r++)h[r]=this.parser.parse(h[r],!1);g[d]=h;break;default:h=l.indexOf("."),r=a[l.substring(0,h)],"font"===a[l.substring(h+1)]&&/parameter|Explanation|tooltip/.test(r)?g[r+"Font"]=e:console.warn("Propiedad de control no identificada: <"+l+"> valor: <"+e+">")}return new b["Numeric"===g.type?g.gui:g.type](this.parent,g)};A.prototype.parseGraphic=function(g,f,m,p){q={rotateExp:p,parameter:"t"};g=this.split(g);p=0;for(var r=g.length;p<r;p++)if(l=g[p][0],e=g[p][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName=
"Graphic",""!=e)switch(d){case "info":break;case "type":b.DEBUG.idName=e;q[d]=c(a[e]);break;case "align":case "anchor":case "lineDash":q[d]=a[e];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":q[d]="true"===a[e];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":q[d]="false"===a[e]?"":new b.Color(e,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "init":case "end":q[d]=
e;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":""!==e&&(q[d]=this.parser.parse(e));break;case "font_size":e=e.trim();/^\[.*\]$/.test(e)&&(e=e.slice(1,-1));""!==e&&(q[d]=this.parser.parse(e));break;case "space":q[d+"ID"]=e;break;case "expresion":""!==e&&("Macro"!==q.type?(q[d]=this.parser.parse(e),q.expresionString=e):q[d]=e);break;case "text":q[d]=e;break;
case "file":var n=e.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(n)&&(n=n.slice(1,-1));n.match(h)&&(n="'"+n+"'");n.startsWith("data:image/")?q[d]=this.parser.parse("'"+n+"'"):q[d]=this.parser.parse(n);break;case "border":""!=e&&"false"!=a[e]&&(q[d]=new b.Color(e,this.parent.evaluator));break;default:if(void 0!=q.family&&(n=q.family.length+1,l.substring(0,n)===q.family+".")){n=a[l.substring(n)];/interval|steps/.test(n)&&""!=e&&(q["family_"+n]=this.parser.parse(e));break}void 0!=q.parameter&&l.match(q.parameter+
".")?(n=l.substring(0,l.indexOf(q.parameter)+q.parameter.length),q.parameter!==n&&(q.parameter=n),n=a[l.substring(q.parameter.length+1)],/interval|steps/.test(n)&&""!=e&&(q["parameter_"+n]=this.parser.parse(e))):console.warn("Propiedad del gr\u00e1fico no identificada: <"+l+"> valor: <"+e+">")}f&&(q.abs_coord=f);m&&(q.background=m);return new b[q.type](this.parent,q)};A.prototype.parse3DGraphic=function(g,f,m,h){q={rotateExp:h,parameter:"t"};g=this.split(g);f=0;for(m=g.length;f<m;f++)switch(l=g[f][0],
e=g[f][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Graphic3D",d){case "info":break;case "type":b.DEBUG.idName=e;p=a[e];q[d]=c(p);break;case "model":case "align":case "anchor":case "lineDash":q[d]=a[e];break;case "shadowColor":case "fill":q[d]="false"===a[e]?"":new b.Color(e,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":q[d]="true"===a[e];break;case "edges":"false"===a[e]?q[d]="":("true"===a[e]&&(e="808080"),q[d]=new b.Color(e,
this.parent.evaluator));break;case "border":""!=e&&"false"!=a[e]&&(q.border=new b.Color(e,this.parent.evaluator));break;case "color":case "backcolor":q[d]=new b.Color(e,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":""!=e&&(q[d]=this.parser.parse(e));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":q[d]=
e;break;case "space":q[d+"ID"]=e;break;case "expresion":/Macro|Curve|Surface/.test(q.type)?q[d]=e.replace(/\\n/g,";"):(q[d]=this.parser.parse(e),q.expresionString=e);break;case "text":q.text=e;break;case "file":h=e.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(h)&&(h=h.slice(1,-1));/./.test(h)&&(h="'"+h+"'");q[d]=this.parser.parse(h);break;default:if(void 0!=q.family&&(h=q.family.length+1,l.substring(0,h)===q.family+".")){h=a[l.substring(h)];/interval|steps/.test(h)&&""!=e&&(q["family_"+h]=this.parser.parse(e));
break}console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+l+"> valor: <"+e+">")}return new b[q.type+"3D"](this.parent,q)};A.prototype.parseAuxiliar=function(c){m={};c=this.split(c);for(var g=0,f=c.length;g<f;g++)c[g][1]=c[g][1].replace(/&squot;/g,"'");g=0;for(f=c.length;g<f;g++)switch(l=c[g][0],e=c[g][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Auxiliar",d){case "info":case "code":case "doc":break;case "id":b.DEBUG.idName=e;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":m[d]=
e.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":m[d]="true"===a[e];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":m[d]=this.parser.parse(e);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":m[d]=a[e];break;default:var q=l.indexOf("."),h=a[l.substring(0,q)];q=a[l.substring(q+1)];"parameter"===h&&"font"===q?m[h+"Font"]=e:console.warn("Propiedad del auxiliar no identificada: <"+
l+"> valor: <"+e+">")}m.sequence?m.type="sequence":m.constant?m.type="constant":m.algorithm&&m.evaluate?m.type="algorithm":m.array&&!m.matrix&&")"!=m.id.charAt(m.id.length-1)?m.type="vector":m.matrix&&")"!=m.id.charAt(m.id.length-1)?m.type="matrix":m.event&&")"!=m.id.charAt(m.id.length-1)?m.type="event":"library"===m.type?m.type="library":")"===m.id.charAt(m.id.length-1)?m.type="function":m.type="variable";b.DEBUG.typeName=m.type;switch(m.type){case "sequence":new b.Function(this.parent,m);break;
case "constant":c=new b.Constant(this.parent,m);m.evaluate&&"always"===m.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new b.Algorithm(this.parent,m));break;case "vector":c=new b.Vector(this.parent,m);m.evaluate&&"always"===m.evaluate&&this.parent.auxiliaries.push(c);break;case "matrix":c=new b.Matrix(this.parent,m);m.evaluate&&"always"===m.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new b.Event(this.parent,m));
break;case "library":new b.Library(this.parent,m);break;case "variable":new b.Variable(this.parent,m);break;default:new b.Function(this.parent,m)}};A.prototype.parseAction=function(a){return a.action?new (b[c(a.action)])(a.parent,a.parameter):{execute:function(){}}};A.prototype.parseAnimation=function(c){var g={};c=this.split(c);for(var f=0,m=c.length;f<m;f++)switch(l=c[f][0],e=c[f][1],d=a[l],b.DEBUG.pName=l,b.DEBUG.objectName="Animation",d){case "info":break;case "id":case "delay":case "init":case "doExpr":case "whileExpr":g[d]=
e.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":g[d]="true"===a[e];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+l+"> valor: <"+e+">")}return new b.Animation(this.parent,g)};A.prototype.split=function(a){if("string"!==typeof a)return[];f=[];a=(a||"").replace(/\\'/g,"\u2019");w=u=r=0;for(x=v=!1;w<a.length;)" "!==a[w]||x||w++," "===a[w]||x||(x=!0,r=w),"="!==a[w]||"'"!==a[w+1]||v||(v=!0,f[u]=[a.substring(r,w)],
r=w+2,w+=2),v&&"'"===a[w]&&(x=v=!1,f[u].push(a.substring(r,w)),u++),"="!==a[w]||"'"===a[w+1]||v||(f[u]=[a.substring(r,w)],r=w+1,w++,z=a.substring(w).indexOf("="),-1===z?z=y=a.length:(z+=w,y=a.substring(w,z).lastIndexOf(" "),y=-1===y?a.length:y+w),f[u].push(a.substring(r,y)),u++,x=!1,w=y),w++;return f};A.prototype.parseText=function(a){a=void 0===a?"":a;return/^\{\\rtf1/.test(a)?this.RTFparser.parse(a.substring(10)):new b.SimpleText(this.parent,a)};b.LessonParser=A;return b}(descartesJS||{},babel);
descartesJS=function(b){function a(){return parseFloat(this.value)}function c(){return this.value.replace(/\\u0027/g,"'")}function h(a,b){var c=a.variables[this.value];if("object"===typeof c&&void 0==c.length)return c.evaluate(a);void 0==c&&(b||a.matrices[this.value]?c=a.matrices[this.value]:a.vectors[this.value]&&(c=a.vectors[this.value]));return void 0!==c?c:0}function p(a){try{var b=a.getVector(this.value,this.childs[0].childs[0].evaluate(a));return void 0!==b?b:0}catch(ba){return 0}}function d(a){try{var b=
a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),this.childs[0].childs[1].evaluate(a));return void 0!==b?b:0}catch(ba){return 0}}function l(a){return a.functions[this.value].apply(a,this.childs[0].childs.map(function(b){return b.evaluate(a)}))}function e(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==c.type||"matrix"!==a.type)return"number"==typeof c&&"string"==typeof a?c=b.removeNeedlessDecimals(c.toString()):"string"==typeof c&&"number"==typeof a&&
(a=b.removeNeedlessDecimals(a.toString())),c+a;X=c.rows;U=c.cols;S=L(X,U);for(T=0;T<X;T++)for(W=0;W<U;W++)S[W][T]=c[W][T]+a[W][T];return S}function n(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;X=b.rows;U=b.cols;S=L(X,U);for(T=0;T<X;T++)for(W=0;W<U;W++)S[W][T]=b[W][T]-a[W][T];return S}function g(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:Q(b,a)}function q(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 c=L(a.length,a.length),d=F(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var g=0,f=a.length;g<f;g++){var e=d;for(var m=0;m<f;m++)c[m][g]=e*F(O(g,m,a)),e=-e;d=-d}else c[0][0]=d;a=c}b=0===a?L(b.rows,b.cols):Q(b,a);return b}function m(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-M(b/a)*a}function f(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);
return 0<=a?R(b,a):1/R(b,-a)}function w(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}function u(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}function x(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}function r(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}function v(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)}function z(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)}function y(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}function A(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}function B(a){return+!this.childs[0].evaluate(a)}function D(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2]?this.childs[2].evaluate(a):0}function I(a){return this.childs[0].evaluate(a)}
function E(a){return-this.childs[0].evaluate(a)}function G(a,b){return this.childs[0].evaluate(a,b)}function H(a){return 1===this.childs.length&&1===this.childs[0].childs.length&&"(expr)"===this.type?this.childs[0].childs[0].evaluate(a):this.childs.map(function(b){return b.childs.map(function(b){return b.evaluate(a)})})}function C(a){var b=this.childs[0],c=b.childs[0]?b.childs[0].childs:null,d=this.childs[1].evaluate(a);a.setVector(b.value,c[0].evaluate(a),d);return d}function J(a){var b=this.childs[0],
c=b.childs[0]?b.childs[0].childs:null,d=this.childs[1].evaluate(a);a.setMatrix(b.value,c[0].evaluate(a),c[1].evaluate(a),d);return d}function P(a){var b=this.childs[0],c=this.childs[1].evaluate(a);return c.type?a.matrices[b.value]=c:"object"!==typeof a.variables[b.value]?a.variables[b.value]=c:0}function R(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||M(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=M(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function L(a,b){S=[];S.type="matrix";S.rows=
a;S.cols=b;T=0;for(aa=b;T<aa;T++)S[T]=Array(a).fill(0);return S}function Q(a,b){X=a.rows;U=a.cols;S=L(X,U);var c;for(T=0;T<X;T++)for(W=0;W<U;W++){for(aa=c=0;aa<U;aa++)c+=a[aa][T]*b[W][aa];S[W][T]=c}return S}function O(a,b,c){for(var d=L(c.length-1,c.length-1),g=0,f=d.length;g<f;g++)for(var e=0;e<f;e++)d[g][e]=g<a?e<b?c[g][e]:c[g][e+1]:g<b?c[g+1][e]:c[g+1][e+1];return d}function F(a){if(1<a.cols){for(var b=0,c=1,d=0,g=a.cols;d<g;d++)b+=c*a[0][d]*F(O(0,d,a)),c=-c;return b}return a[0][0]}if(b.loadLib)return b;
var M=Math.floor,K,N,V,Z,X,U,S,W,T,aa,Y=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};Y.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};Y.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};Y.prototype.replaceLastChild=function(a){N=this.childs.length-1;K=this.childs[N];K.parent=null;this.childs[N]=a;a.parent=this;return a};Y.prototype.contains=function(a){return this.value===a?!0:this.childs.some(function(b){return b.contains(a)})};
Y.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",Z=new Y("compOperator","=="),Z.addChild(this),Z.addChild(new Y("number","0")),V=this.getRoot(),V.setAllEvalFun(),V):this};Y.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b=b.value,/square_bracket|parentheses/.test(b.type)&&this.childArray.push.apply(this.childArray,
$jscomp.arrayFromIterable(b.childs));return this.childArray}return null};Y.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b.value.setAllEvalFun()};Y.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=a;else if("string"===this.type)this.evaluate=c;else if("identifier"===this.type&&0===this.childs.length)this.evaluate=h;else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length)this.evaluate=
p;else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=d;else if("identifier"===this.type&&"parentheses"===this.childs[0].type)this.evaluate=l;else if("operator"===this.type)"+"===this.value?this.evaluate=e:"-"===this.value?this.evaluate=n:"*"===this.value?this.evaluate=g:"/"===this.value?this.evaluate=q:"%"===this.value?this.evaluate=m:"^"===this.value&&(this.evaluate=f);else if("compOperator"===this.type)"<"===this.value?this.evaluate=
w:"<="===this.value?this.evaluate=u:">"===this.value?this.evaluate=x:">="===this.value?this.evaluate=r:"=="===this.value?this.evaluate=v:"!="===this.value&&(this.evaluate=z);else if("boolOperator"===this.type)"&"===this.value?this.evaluate=y:"|"===this.value?this.evaluate=A:"!"===this.value&&(this.evaluate=B);else if("conditional"===this.type)this.evaluate=D;else if("sign"===this.type)this.evaluate="sign+"===this.value?I:E;else if("parentheses"===this.type)this.evaluate=G;else if("(expr)"===this.type||
"[expr]"===this.type)this.evaluate=H;else if("assign"===this.type){var b=this.childs[0],T=b.childs[0]?b.childs[0].childs:null;this.evaluate=1===b.childs.length&&"square_bracket"===b.childs[0].type&&1===T.length?C:1===b.childs.length&&"square_bracket"===b.childs[0].type&&2===T.length?J:P}};b.Node=Y;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g=/^\s+/,q=/^[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]*)*/,m=/^([0-9]+[.][0-9]+|[.][0-9]+|[0-9]+)/,f=/^(==|!=|<=|<|>=|>|#)/,w=/^(!|~|&&|&|\|\||\|)/,u=/^(=|:=)/,x=/^[\?:]/,r=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,v=/^(\[|\])/,z=/^(\(|\))/,y=/^,/,A=/^;/,B=/\|/g,D=/\|\*/g,I=/\*\|/g,E=/^\/\//g,G=/:\/\//g,H,C=/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/,
J=function(){};J.prototype.tokenize=function(C){function H(a,b,d){c.push({type:a,value:b});l=l.slice(d);p+=d;n=a}if(a=C){C=C.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a}).replace(/&sup(.+?);/g,"^$1 ").replace(/&squot;/g,"'").replace(/\brnd\b/g,"random()");C.match(/=\|\*/g)&&(C=C.replace(D,"'").replace(I,"'"));C.match(/=\|/g)&&(C=C.replace(B,"'"));var J=C.trim();"|"==J[0]&&"|"==J[J.length-1]&&(C=J.replace(B,"'"))}c=[];h=!1;p=0;l=C;for(n="";C&&
p<C.length;)if(h=p,"'"==l[0]){for(e=1;"'"!=l[e];)if(e<l.length)e++;else return;d=l.substring(1,e);H("string",d,d.length+2)}else{if(d=l.match(E))if(l.match(G))continue;else{p=2*C.length;break}if(d=l.match(g))l=l.slice(d[0].length),p+=d[0].length;else if(d=l.match(r))d[0]=d[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),H("operator",d[0],d[0].length);else if(d=l.match(q))"number"===n&&c.push({type:"operator",value:"*"}),H("identifier",d[0],d[0].length);
else if(d=l.match(m))H("number",d[0],d[0].length);else if(d=l.match(f))J=d[0],"#"==J&&(J="!="),H("compOperator",J,d[0].length);else if(d=l.match(w))J=d[0],"||"==J?J="|":"&&"==J?J="&":"~"==J&&(J="!"),H("boolOperator",J,d[0].length);else if((d=l.match(u))&&!/^==/.test(l))H("assign",d[0],d[0].length);else if(d=l.match(x))H("conditional",d[0],d[0].length);else if(d=l.match(v))H("square_bracket",d[0],d[0].length);else if(d=l.match(z))"("==d&&"number"===n&&c.push({type:"operator",value:"*"}),H("parentheses",
d[0],d[0].length);else if(d=l.match(y))H("separator",d[0],d[0].length);else if(178===l.charCodeAt(0))c.push({type:"operator",value:"^"}),H("number",2,1);else if(179===l.charCodeAt(0))c.push({type:"operator",value:"^"}),H("number",3,1);else if(d=l.match(A))H("final_of_expression",d[0],d[0].length);else if(h==p){b.DEBUG.setError(b.DEBUG.EXPRESSION,a);return}}return c};J.prototype.flatTokens=function(a,b){a=void 0===a?[]:a;b=void 0===b?"":b;H="";a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=
a.next())c=c.value,H="string"==c.type?H+("&squot;"+c.value+"&squot;"):"identifier"!=c.type||C.test(c.value)?H+c.value:H+(b+c.value);return H};b.Tokenizer=J;return b}(descartesJS||{});
descartesJS=function(b){function a(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 c(a){a=String(a).trim().replace(/^'|'$/g,"");var b=parseFloat(a);return isNaN(b)||String(b)!==a?a:b}function h(a,b,c,d){console.info("Error"+a+": en la expresi\u00f3n \u300a"+b+"\u300b, en el token {valor: "+c+", tipo: "+d+"}")}if(b.loadLib)return b;b.reservedIds="-_-_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_-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 p,d,l,e,n,g,q,m,f,w,u=function(a){this.evaluator=a;this.tokenizer=new b.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};u.prototype.parse=function(c,r){(p=this.tokenizer.tokenize(c))||(p=[]);d=null;r=!r||!1;for(var u=g=n=e=0,x=p.length;u<x;u++){q=p[u];m=q.value;f=q.type;if("identifier"===f)if(p[u+1]&&"parentheses"===p[u+1].type&&"("===p[u+1].value)this.functions.hasOwnProperty(m)||
(this.functions[m]=function(){return 0});else if(p[u+1]&&"square_bracket"===p[u+1].type&&"["===p[u+1].value)p[u+3]&&"square_bracket"===p[u+3].type&&"]"===p[u+3].value?this.vectors.hasOwnProperty(m)||(this.vectors[m]=[0,0,0]):this.matrices.hasOwnProperty(m)||(this.matrices[m]=[[0,0,0],[0,0,0],[0,0,0]]);else{var y=m.match(/(\w*)(\.mouse_x|\.mouse_y|\.mouse_pressed|\.mouse_clicked|\.clic_izquierdo)$/);y&&(this.variables[y[1]+".DJS_NO_FIXED"]=1)}"assign"===f&&r&&":="!=m&&(f="compOperator",m="==");if("assign"===
f)if(l=new b.Node(f,m),null!=d){r=!0;if("identifier"===d.type)d.parent&&d.parent.replaceLastChild(l),l.addChild(d);else if("square_bracket"===d.type)l.addChild(d.parent);else{l.type="compOperator";for(l.value="==";d.parent&&a(d.parent.value)>=a(l.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(l);l.addChild(d)}d=l}else{h(1,c,m,f);break}else if("parentheses"===f&&"("===m||"square_bracket"===f&&"["===m)if(l=new b.Node(f,m),"("===m&&e++,"["===m&&n++,null===d)"("===m&&(new b.Node("(expr)","(expr)")).addChild(l),
"["===m&&(new b.Node("[expr]","[expr]")).addChild(l),d=l;else if("operator"===d.type||"boolOperator"===d.type||"compOperator"===d.type||"conditional"===d.type||"assign"===d.type)d.addChild(l),d=l;else if("sign"===d.type)d.addChild(l),d=l;else if("parentheses"===d.type&&"("===d.value)d.addChild(l),d=l;else if("square_bracket"===d.type&&"["===d.value)d.addChild(l),d=l;else if("parentheses"===d.type&&"()"===d.value)d.parent.addChild(l),d=l;else if("square_bracket"===d.type&&"[]"===d.value)d.parent.addChild(l),
d=l;else if("identifier"===d.type)d.addChild(l),d=l;else{h(2,c,m,f);break}else if("parentheses"===f&&")"===m)if(e--,null===d)h(3,c,m,f);else{for(;d&&d.parent&&("("!=d.value||"("==d.value&&"parentheses"!=d.type);)d=d.parent;if(d&&"("===d.value)d.value="()";else{h(4,c,m,f);break}}else if("square_bracket"===f&&"]"===m)if(n--,null===d)h(5,c,m,f);else{for(;d&&d.parent&&("["!=d.value||"["==d.value&&"square_bracket"!=d.type);)d=d.parent;if(d&&"["===d.value)d.value="[]";else{h(6,c,m,f);break}}else if("number"===
f||"string"===f||"identifier"===f)if(l=new b.Node(f,m),null===d)d=l;else if("operator"===d.type||"compOperator"===d.type||"boolOperator"===d.type||"parentheses"===d.type&&"("===d.value||"square_bracket"===d.type&&"["===d.value||"sign"===d.type||"conditional"===d.type||"assign"===d.type)d.addChild(l),d=l;else break;else if("operator"===f||"compOperator"===f||"boolOperator"===f)if(l=new b.Node(f,m),null===d)if("-"===m||"+"===m)l.type="sign",l.value="sign"+m,d=l;else if("!"===m)d=l;else{h(8,c,m,f);break}else if("operator"===
d.type||"compOperator"===d.type||"boolOperator"===d.type||"assign"===d.type||"conditional"===d.type||"square_bracket"===d.type&&"["===d.value&&("-"===m||"+"===m||"!"===m)||"parentheses"===d.type&&"("===d.value&&("-"===m||"+"===m||"!"===m)){if("-"===m||"+"===m)l.type="sign",l.value="sign"+m;d.addChild(l);d=l}else if("number"===d.type||"parentheses"===d.type&&"()"===d.value||"square_bracket"===d.type&&"[]"===d.value||"string"===d.type||"identifier"===d.type||"conditional"===d.type||"assign"===d.type){for(;d.parent&&
a(d.parent.value)>=a(l.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(l);l.addChild(d);d=l}else{h(9,c,m,f);break}else if("conditional"===f)if(l=new b.Node(f,m),null!=d)if("?"===l.value){for(g++;d.parent&&a(d.parent.value)>a(l.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(l);l.addChild(d);d=l}else{for(g--;d&&d.parent&&("?"!=d.value||"?"==d.value&&"conditional"!=d.type);)d=d.parent;if(d&&"?"===d.value)d.value="?:";else{h(10,c,m,f);break}}else{h(11,c,m,f);break}else if("separator"===
f)if(null!=d)for(;d.parent&&"("!=d.value&&"["!=d.value;)d=d.parent;else{h(12,c,m,f);break}else{h(13,c,m,f);break}}0<e&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_CLOSING,c);0>e&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_OPENING,c);0<n&&b.DEBUG.setError(b.DEBUG.BRACKET_CLOSING,c);0>n&&b.DEBUG.setError(b.DEBUG.BRACKET_OPENING,c);0!=g&&b.DEBUG.setError(b.DEBUG.INCOMPLETE_IF,c);(w=d?d.getRoot():null)&&w.setAllEvalFun();return w};u.prototype.registerDefaultValues=function(){var a=Date.now(),d=this;d.variables._NUM_MAX_ITE_ALG_=
1E5;d.variables.pi=d.variables["\u03c0"]=Math.PI;d.variables.e=Math.E;d.variables.Infinity=Infinity;d.variables["-Infinity"]=-Infinity;d.variables.isTouch=d.variables["esT\u00e1ctil"]=b.hasTouchSupport?1:0;d.variables.device=d.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(d.variables,
{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});d.variables["DJS.squote"]="\\u0027";d.variables["DJS.comma"]="\\u002C";var g={};d.functions._Eval_=function(a){a=void 0===a?"":a;if(""==a)return 0;if("number"==typeof a)return"NaN";var b=a.replace(",",".");/,/.test(a)&&parseFloat(b)==b&&(a=b);if(void 0==g[a])if(b=a.match(/:=/g)?
!0:!1,/;/.test(a)){for(var c=!1,f,e=[],m=0,q=0,l=a.length;q<l;q++)f=a[q],"'"===f&&(c=!c),c||";"!==f||(e.push(a.substring(m,q)),m=q+1);e.push(a.substring(m));g[a]=d.parse("("+e.join(")(")+")",b)}else g[a]=d.parse(a,b);a=d.evaluator.eval(g[a]);return void 0!=a?a:"NaN"};d.functions.sqr=function(a){return a*a};d.functions.sqrt=d.functions["ra\u00edz"]=Math.sqrt;d.functions.exp=Math.exp;d.functions.log=Math.log;d.functions.log10=Math.log10?Math.log10:function(a){return Math.log(a)/Math.log(10)};d.functions.abs=
Math.abs;d.functions.ent=function(a){return Math.trunc(parseFloat(a)+1E-16*Math.sign(a))};d.functions.sgn=Math.sign;d.functions.ind=function(a){return a?1:0};d.functions.sin=d.functions.sen=Math.sin;d.functions.cos=Math.cos;d.functions.tan=Math.tan;d.functions.cot=function(a){return 1/Math.tan(a)};d.functions.sec=function(a){return 1/Math.cos(a)};d.functions.csc=function(a){return 1/Math.sin(a)};d.functions.sinh=d.functions.senh=Math.sinh?Math.sinh:function(a){return(Math.exp(a)-Math.exp(-a))/2};
d.functions.cosh=Math.cosh?Math.cosh:function(a){return(Math.exp(a)+Math.exp(-a))/2};d.functions.tanh=Math.tanh?Math.tanh:function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};d.functions.coth=function(a){return 1/d.functions.tanh(a)};d.functions.sech=function(a){return 1/d.functions.cosh(a)};d.functions.csch=function(a){return 1/d.functions.sinh(a)};d.functions.asin=d.functions.asen=Math.asin;d.functions.acos=Math.acos;d.functions.atan=Math.atan;d.functions.atan2=Math.atan2;d.functions.floor=
d.functions.piso=Math.floor;d.functions.ceil=d.functions.techo=Math.ceil;d.functions.round=d.functions.redondeo=Math.round;d.functions.trunc=d.functions.truncamiento=Math.trunc;d.functions.min=Math.min;d.functions.max=Math.max;d.functions._Trace_=d.functions._Print_=function(){console.info.apply(console,arguments);return 0};d.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};d.functions.isNumber=d.functions["esN\u00famero"]=
function(a){return Number.isFinite(a)?1:0};d.functions.random=d.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)};d.functions._Stop_Audios_=function(){d.evaluator.parent.stopAudios()};window.parent!==window&&(d.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},d.functions["parent.update"]=
function(){window.parent.postMessage({type:"update"},"*");return 0},d.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});d.functions.toFixed=d.functions._NumToStr_=d.functions._NumACadena_=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0)).replace(".",d.evaluator.parent.decimal_symbol)};d.functions.charAt=d.functions._charAt_=d.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:
parseInt(b);return a.charAt(b)};d.functions.substring=d.functions._substring_=d.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):""};d.functions.strLength=d.functions._length_=d.functions._longitud_=function(a){return(a||"").toString().length};d.functions.indexOf=d.functions._indexOf_=d.functions["_\u00edndiceDe_"]=function(a,b){return(a||
"").toString().indexOf((b||"").toString())};d.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};d.functions.replace=d.functions._replace_=d.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var d=a.indexOf(b);0<=d;)a=a.substring(0,d)+c+a.substring(d+b.length),d=a.indexOf(b,d+c.length);return a};d.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};d.functions.toUpperCase=function(a){return(a||
"").toString().toUpperCase()};d.functions.trim=function(a){return(a||"").toString().trim()};d.functions._Load_=function(a){var c="";a&&(c=(c=document.getElementById(a))&&"descartes/archivo"==c.type?c.text:b.openFile(a));return c||""};d.functions._GetValues_=function(a,b){return d.functions._ExecBlock_(d.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),b)};d.functions._GetMatrix_=function(a,b){return d.functions._StrToMatrix_(d.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),
b)};d.functions._MatrixToStr_=function(a){var c=d.matrices[a];if(c){for(var g="<"+a+">\\n",f=d.evaluator.getVariable(a+".columnas_usadas")||c.cols||0,e=d.evaluator.getVariable(a+".filas_usadas")||c.rows||0,m,q=0;q<f;q++){for(var l=0;l<e;l++)m=c[q][l],void 0!==m&&("string"==typeof m?m="'"+m+"'":"number"==typeof m&&(m=b.removeNeedlessDecimals(m.toFixed(6))),g+=m+(l<e-1?" \u00a6 ":""));g=g.replace(/(\u00A6 )$/g,"")+"\\n"}return g+"</"+a+">"}return""};d.functions._StrToMatrix_=function(a,b){var g=[],
f=!1,e=!1;g.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var m=0,q=a.length;m<q;m++)a[m].match("<"+b+">")?(e=!0,f=a[m].trim().split("<"+b+">"),2==f.length&&""!=f[1]&&g.push(f[1].split(String.fromCharCode("166")).map(c)),f=!0):(a[m].match("</"+b+">")&&(f=a[m].trim().split("</"+b+">"),2==f.length&&""!=f[0]&&g.push(f[0].split(String.fromCharCode("166")).map(c)),f=!1,m=a.length),f&&g.push(a[m].split(String.fromCharCode("166")).map(c)));d.matrices[b]=g;d.matrices[b].rows=g&&g[0]&&
g[0].length?g[0].length:0;d.matrices[b].cols=g&&g.length?g.length:0;d.evaluator.setVariable(b+".filas",d.matrices[b].rows);d.evaluator.setVariable(b+".columnas",d.matrices[b].cols)}return e?"OK":"ERROR"};d.functions._GetVector_=function(a,b){return d.functions._StrToVector_(d.functions._Load_(a),b)};d.functions._VectorToStr_=function(a){var b=d.vectors[a];if(b){for(var c="<"+a+">\\n",g=d.evaluator.getVariable(a+".long_usada")||b._size_||0,f,e=0;e<g;e++)f=b[e],void 0!==f?("number"==typeof f&&(f=parseFloat(f)),
c+=f+"\\n"):c+="0\\n";return c+"</"+a+">"}return""};d.functions._StrToVector_=function(a,b){var g=[],f=!1,e=!1;g.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var m=0,q=a.length;m<q;m++)a[m].match("<"+b+">")?f=e=!0:(a[m].match("</"+b+">")&&(f=!1,m=a.length),f&&g.push(c(a[m])));g._size_=g.length;d.vectors[b]=g;d.evaluator.setVariable(b+".long",g.length);d.evaluator.setVariable(b+".long_usada",g.length)}return e?"OK":"ERROR"};d.functions._ExecStr_=function(a){return d.functions._ExecBlock_(a,
"")};d.functions._ExecBlock_=function(a,b){var c=[],g=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,e=a.length;f<e;f++)a[f].match("<"+b+">")?(g=a[f].trim().split("<"+b+">"),2==g.length&&""!=g[1]&&(c=c.concat(g[1].split(String.fromCharCode("166")))),g=!0):a[f].match("</"+b+">")?(g=a[f].trim().split("</"+b+">"),2==g.length&&""!=g[0]&&(c=c.concat(g[0].split(String.fromCharCode("166")))),g=!1):g&&(c=c.concat(a[f].split(String.fromCharCode("166"))));a=0;for(b=c.length;a<b;a++)g=c[a].split("="),
g[0]=g[0].trim(),2==g.length&&""!=g[0]&&(isNaN(parseFloat(g[1]))?d.evaluator.setVariable(g[0],g[1].trim().replace(/^'|'$/g,"")):d.evaluator.setVariable(g[0],parseFloat(g[1])))}return 0};var f=b.newHTML("a",{target:"_blank"}),e,m=null;b.newBlobContent=null;d.functions._Save_=function(c,g){d.evaluator.parent.removeButtonClick();1500<Date.now()-a&&(a=Date.now(),document.body.appendChild(f),m=g.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\").replace(/\\br/g,"\\n"),e=
new Blob(["\ufeff",m],{type:"text/plain;charset=utf-8"}),f.setAttribute("href",window.URL.createObjectURL(e)),f.setAttribute("download",c),m!=b.newBlobContent&&(f.click(),b.newBlobContent=m),document.body.removeChild(f));return 0};var q=b.newHTML("a",{target:"_blank"});d.functions._SaveSpace_=function(c,g){d.evaluator.parent.removeButtonClick();1500<Date.now()-a&&(a=Date.now(),document.body.appendChild(q),m=g,q.setAttribute("href",m),q.setAttribute("download",c),m!=b.newBlobContent&&(q.click(),b.newBlobContent=
m),document.body.removeChild(q));return 0};var l,h,p=b.newHTML("input",{type:"file"});p.addEventListener("change",function(a){l=a.target.files;h=new FileReader;h.onload=function(a){b.addExternalFileContent(l[0].name,a.target.result);d.evaluator.setVariable("DJS.fileName",l[0].name);d.evaluator.setVariable("DJS.fileContent",a.target.result);if(a=d.evaluator.getFunction(d._callback))a.apply(d.evaluator,[]),d.evaluator.parent.update();p.value=""};0<l.length&&h.readAsText(l[0])});d.functions._Open_=function(b){d.evaluator.parent.removeButtonClick();
1500<Date.now()-a&&(d._callback=b,p.click(),a=Date.now());return 0};d.functions._AnchoDeCadena_=d.functions._strWidth_=function(a,c,d,g){return b.getTextWidth(a,b.convertFont(c+","+d+","+g))};d.functions.R=d.functions._Rojo_=d.functions._Red_=function(a){return(new b.Color(a)).r/255};d.functions.G=d.functions._Verde_=d.functions._Green_=function(a){return(new b.Color(a)).g/255};d.functions.B=d.functions._Azul_=d.functions._Blue_=function(a){return(new b.Color(a)).b/255};d.functions.HSV2RGB=function(a,
b,c){a=parseInt(a)%360;b*=c;var d=b*(1-Math.abs(a/60%2-1));c-=b;if(0<=a&&60>a){var g=b;var f=d;var e=0}else 60<=a&&120>a?(g=d,f=b,e=0):120<=a&&180>a?(g=0,f=b,e=d):180<=a&&240>a?(g=0,f=d,e=b):240<=a&&300>a?(g=d,f=0,e=b):300<=a&&360>a&&(g=b,f=0,e=d);g=parseInt(255*(g+c));f=parseInt(255*(f+c));e=parseInt(255*(e+c));return""+g.toString(16).padStart(2,"0")+f.toString(16).padStart(2,"0")+e.toString(16).padStart(2,"0")};d.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};
b.Parser=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=function(a){this.parent=a;this.parser=new b.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};c.prototype.setDefinition=function(a,b){this.definitions[a]=b};c.prototype.getDefinition=function(a){return this.definitions[a]};c.prototype.setVariable=function(a,b){this.variables[a]=b};c.prototype.getVariable=
function(a){return this.variables[a]};c.prototype.setVector=function(b,c,d){c=0>c?0:a(c);this.vectors[b][c]=d};c.prototype.getVector=function(b,c){c=0>c?0:a(c);return this.vectors[b][c]};c.prototype.setMatrix=function(b,c,d,l){c=0>c?0:a(c);d=0>d?0:a(d);void 0==this.matrices[b][c]&&(this.matrices[b][c]=[]);this.matrices[b][c][d]=l};c.prototype.getMatrix=function(b,c,d){c=0>c?0:a(c);d=0>d?0:a(d);return this.matrices[b][c][d]};c.prototype.setFunction=function(a,b){this.functions[a]=b};c.prototype.getFunction=
function(a){return this.functions[a]};c.prototype.eval=function(a){return a?a.evaluate(this):0};b.externalEvaluator=new c;b.Evaluator=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q,m,f,w,u,x,r,v=function(c,d){a=this;a.parent=c;a.evaluator=c.evaluator;a.decimals=c.decimals;a.fixed=c.fixed;a.align=c.align||"left";a.anchor=c.anchor||"a_top_left";a.decimal_symbol=c.parent.decimal_symbol;a.w=a.h=100;a.hasContent=""!==d;a.textStr=(d||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");a.oldTextStr=a.oldWidth=
a.oldSize=a.oldColor=a.oldPosX=a.oldPoxY=null;/^\{\\rtf1/.test(d)?(a.type="rtfNode",a.text=d,a.textNodes=(new b.RTFParser(c.evaluator)).parse(d.substring(10)),a.draw=a.drawRTF):(a.descarTeXParser=new b.DescarTeXParser,a.text=a.parseSimpleText(a.textStr),a.textNodes=new b.TextNode("","txtLineBlock",null,null),a.draw=a.drawText)};v.prototype.drawText=function(g,f,m,q,n){a=this;c=a.evaluator.eval(a.decimals);h=a.evaluator.eval(a.parent.width);p=a.evaluator.eval(a.parent.font_size);d=f.getColor?f.getColor():
f;l=a.textToString(a.text,c,a.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=l.indexOf("[")&&(l=a.textToString(a.parseSimpleText(l),c,a.fixed));if(a.oldTextStr!==l||a.oldWidth!==h||a.oldSize!==p||a.oldColor!==d||a.oldPosX!==m||a.oldPoxY!==q)e=new b.TextStyle({size:p,family:a.parent.font_family||"arial",italic:a.parent.italics||!1,bold:a.parent.bold||!1,color:d,align:a.align,border:a.parent.border,
border_size:a.parent.border_size,shadowBlur:a.parent.shadowBlur,shadowOffsetX:a.parent.shadowOffsetX,shadowOffsetY:a.parent.shadowOffsetY,shadowColor:a.parent.shadowColor||"transparent"}),a.textNodes=a.descarTeXParser.parse(l,a.evaluator,e),a.textNodes.update(m,q,c,a.fixed,a.align,a.anchor,d,h);n||a.textNodes.draw(g);a.oldTextStr=l;a.oldWidth=h;a.oldSize=p;a.oldColor=d;a.oldPosX=m;a.oldPoxY=q};v.prototype.drawRTF=function(a,b,c,d,g){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,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));g||this.textNodes.draw(a)};v.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");n=[];g="'";m=q=0;f=-1;for(x=a.length;q<x;)w=a.charAt(q),u=a.charAt(q-1),"["===w&&"\\"===u?(n.push(a.substring(m,q-1)+"["),m=q+1):"]"===w&&
"\\"===u?(n.push(a.substring(m,q-1)+"]"),m=q+1):"["===w&&-1===f?(n.push(a.substring(m,q)),m=q,f++):"["===w?f++:"]"===w&&0===f?(n.push(this.evaluator.parser.parse(a.substring(m,q+1))),m=q+1,f--):("]"==a.charAt(q)&&(f=0>f?f:f-1),g+=a.charAt(q)),q++;n.push(a.substring(m,q));return n};v.prototype.textToString=function(a,c,d){g="";if("rtfNode"!==a.type)for(var f=0,e=a.length;f<e;f++)"string"===typeof a[f]?g+=a[f]:(r=this.evaluator.eval(a[f])[0][0],""!==r&&("string"===typeof r?g+=r:Infinity===r?g+="Infinity":
-Infinity===r?g+="-Infinity":isNaN(r)||"NaN"===r?g+="NaN":(r=parseFloat(r),r=d?r.toFixed(c):b.removeNeedlessDecimals(r.toFixed(c)),g+=r.toString().replace(".",this.decimal_symbol))));return g};b.TextObject=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(){};c.prototype.tokenize=function(b){b=b.replace(/\\n/g,"\\newline ");var c=[],d=null,l=0,e=b.length;b.charAt(0);var h=!1,g=!1,q=0;a="";for(var m=0;m<e;m++){var f=b.charAt(m);var w=b.charAt(m+1);"\\"===f&&"$"===w&&(g=!0);"{"===f?q++:"}"===f&&(q--,g&&0===q&&(g=!1));g?"_"===f?"{"===w?a+="\\subindex":(a+="\\subindex{"+w+"}",m++):"^"===f?"{"===w?a+="\\superindex":(a+="\\superindex{"+w+"}",m++):a+=f:a+=f}b=a;w=b.charAt(0);for(e=b.length;l<
e;)f=w,w=b.charAt(l+1),h&&("{"===f||"["===f||"\\"===f||" "===f?(h=!1," "===f&&(d={type:"ignore"},c.push(d))):d.value+=f),h||"\\"!==f?h||"{"!==f&&"["!==f?h||"}"!==f&&"]"!==f?h||(d&&"text"===d.type?d.value+=f:d&&"ignore"===d.type?(c.pop(),d=c[c.length-1]):(d={type:"text",value:f},c.push(d))):(d={type:"close",value:f},c.push(d)):(d={type:"open",value:f},c.push(d)):(h=!0,d={type:"command",value:""},c.push(d)),l++;return c};b.DescarTeXTokenizer=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(){this.tokenizer=new b.DescarTeXTokenizer};a.prototype.parse=function(a,h,p){a=this.tokenizer.tokenize(a);var c=new b.TextNode("","textBlock",p,null),l=new b.TextNode("","textLineBlock",p.clone(),null);c.addChild(l);for(var e=[],n=void 0,g=p,q=[p],m,f,w,u,x=!1,r=0,v=a.length;r<v;r++)if("text"===a[r].type)if("color_parameter"===n)f=new b.Color(a[r].value,h);else if("text_size_parameter"===n)w=parseFloat(a[r].value);else if("textLineBlock"===
l.nodeType){m=a[r].value.split(" ");for(var z=0,y=m.length;z<y;z++)""!==m[z]&&l.addChild(new b.TextNode(m[z],"text",g.clone(),null)),z+1<y&&l.addChild(new b.TextNode(" ","space",g.clone(),null))}else l.addChild(new b.TextNode(a[r].value,"text",g.clone(),null));else"command"===a[r].type&&"curlyBracketOpen"===a[r].value?l.addChild(new b.TextNode("{","text",g.clone(),null)):"command"===a[r].type&&"curlyBracketClose"===a[r].value?l.addChild(new b.TextNode("}","text",g.clone(),null)):"command"===a[r].type&&
"squareBracketOpen"===a[r].value?l.addChild(new b.TextNode("[","text",g.clone(),null)):"command"===a[r].type&&"squareBracketClose"===a[r].value?l.addChild(new b.TextNode("]","text",g.clone(),null)):"command"===a[r].type&&"newline"===a[r].value?(0===l.children.length&&l.addChild(new b.TextNode("","text",g.clone(),null)),l=new b.TextNode("","textLineBlock",p.clone(),null),c.addChild(l)):"command"===a[r].type&&"b"===a[r].value?(n="bold",e.push(n)):"command"===a[r].type&&"i"===a[r].value?(n="italic",
e.push(n)):"command"===a[r].type&&"o"===a[r].value?(n="overline",e.push(n)):"command"===a[r].type&&"u"===a[r].value?(n="underline",e.push(n)):"command"===a[r].type&&"color"===a[r].value?(n="color",e.push(n)):"command"===a[r].type&&"ts"===a[r].value?(n="text_size",e.push(n)):"command"===a[r].type&&"sansserif"===a[r].value.toLowerCase()?(n="sansserif",e.push(n)):"command"===a[r].type&&"serif"===a[r].value.toLowerCase()?(n="serif",e.push(n)):"command"===a[r].type&&"monospace"===a[r].value.toLowerCase()?
(n="monospace",e.push(n)):"command"===a[r].type&&"c"===a[r].value?(n="center",e.push(n)):"command"===a[r].type&&"l"===a[r].value?(n="left",e.push(n)):"command"===a[r].type&&"r"===a[r].value?(n="right",e.push(n)):"command"===a[r].type&&"j"===a[r].value?(n="justify",e.push(n)):"command"===a[r].type&&"$"===a[r].value?(n="formula",e.push(n),x=!0):"command"===a[r].type&&"sum"===a[r].value?(n="sum",e.push(n)):"command"===a[r].type&&"prod"===a[r].value?(n="prod",e.push(n)):"command"===a[r].type&&"int"===
a[r].value?(n="integral",e.push(n)):"command"===a[r].type&&"lim"===a[r].value?(n="limit",e.push(n)):"command"===a[r].type&&"sqrt"===a[r].value?(n="radical",e.push(n)):"command"===a[r].type&&"subindex"===a[r].value?(n="subIndex",e.push(n)):"command"===a[r].type&&"superindex"===a[r].value?(n="superIndex",e.push(n)):"command"===a[r].type&&"frac"===a[r].value?(n="numerator",e.push(n)):"open"===a[r].type&&"{"===a[r].value&&void 0!==n?"bold"===n||"italic"===n||"overline"===n||"underline"===n?(g=g.clone(),
g[n]=!0,q.push(g)):"sansserif"===n?(g=g.clone(),g.family="sansserif",q.push(g)):"serif"===n?(g=g.clone(),g.family="serif",q.push(g)):"monospace"===n?(g=g.clone(),g.family="monospaced",q.push(g)):"text_size"===n?n="text_size_parameter":"text_size_text"===n?(g=g.clone(),g.size=w,q.push(g)):"color"===n?n="color_parameter":"color_text"===n?(g=g.clone(),g.color=f,q.push(g)):"center"===n||"left"===n||"right"===n||"justify"===n?(g=g.clone(),g.align=n,q.push(g),l=new b.TextNode("","textLineBlock",g.clone(),
null),c.addChild(l)):"formula"===n?(g=g.clone(),q.push(g),u=new b.TextNode("","formula",g.clone(),null),l.addChild(u),l=u):"subIndex"===n||"superIndex"===n?x?(g=g.clone(),q.push(g),u=new b.TextNode("",n,g.clone(),null),l.addChild(u),l=u):l.addChild(new b.TextNode("subIndex"===n?"_":"^","text",g.clone(),null)):"radical"===n?x&&(u=new b.TextNode("","radical",g.clone(),null),l.addChild(u),l=u,g=g.clone(),q.push(g),u=new b.TextNode("","index",g.clone(),null),l.addChild(u),l=u,n="index"):"index"===n?x&&
(q.pop(),g=q[q.length-1],u=new b.TextNode("","radicand",g.clone(),null),l.addChild(u),l=u,n="radicand"):"sum"===n||"integral"===n||"limit"===n||"prod"===n?x&&(u=new b.TextNode("",n,g.clone(),null),l.addChild(u),l=u,g=g.clone(),q.push(g),u=new b.TextNode("","from",g.clone(),null),l.addChild(u),l=u,n="from",e[e.length-1]=n):"from"===n?x&&(u=new b.TextNode("","to",g.clone(),null),l.addChild(u),l=u,n="to",e[e.length-1]=n):"to"===n?x&&(q.pop(),g=q[q.length-1],u=new b.TextNode("","what",g.clone(),null),
l.addChild(u),l=u,n="what",e[e.length-1]=n):"numerator"===n?x&&(u=new b.TextNode("","fraction",g.clone(),null),l.addChild(u),l=u,g=g.clone(),q.push(g),u=new b.TextNode("","numerator",g.clone(),null),l.addChild(u),l=u,n="numerator"):"denominator"===n&&(u=new b.TextNode("",n,g.clone(),null),l.addChild(u),l=u):"close"===a[r].type&&"}"===a[r].value&&void 0!==n&&("bold"===n||"italic"===n||"overline"===n||"underline"===n||"color_text"===n||"color"===n||"text_size_text"===n||"text_size"===n||"sansserif"===
n||"serif"===n||"monospace"===n?(q.pop(),g=q[q.length-1],e.pop(),n=e[e.length-1]):"color_parameter"===n?n="color_text":"text_size_parameter"===n?n="text_size_text":"center"===n||"left"===n||"right"===n||"justify"===n?(q.pop(),g=q[q.length-1],e.pop(),n=e[e.length-1],a[r+1]&&"command"===a[r+1].type&&"newline"===a[r+1].value?l=c:(l=new b.TextNode("","textLineBlock",g.clone(),null),c.addChild(l))):"formula"===l.nodeType?(x=!1,q.pop(),g=q[q.length-1],e.pop(),n=e[e.length-1],l=l.parent):"subIndex"===l.nodeType||
"superIndex"===l.nodeType?x&&(q.pop(),g=q[q.length-1],e.pop(),n=e[e.length-1],l=l.parent):"index"===l.nodeType?l=l.parent:"radicand"===l.nodeType?(e.pop(),n=e[e.length-1],l=l.parent.parent):"from"===l.nodeType?l=l.parent:"to"===l.nodeType?l=l.parent:"what"===l.nodeType?(e.pop(),n=e[e.length-1],l=l.parent.parent):"numerator"===l.nodeType?(n="denominator",l=l.parent):"denominator"===l.nodeType&&(q.pop(),g=q[q.length-1],e.pop(),n=e[e.length-1],l=l.parent.parent));var A,B,D=null,I=[];c.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)A=a.children[b],B=a.children[b+1],"text"===A.nodeType&&"text"===B.nodeType&&A.style.equals(B.style)?(null===D&&(D=A,u=A.clone(),D.changeNodeType("word"),D.value="___"+u.value,D.addChild(u)),u=B.clone(),D.addChild(u),I.push(B),D.value+=u.value):D=null});I.forEach(function(a){a.parent.removeChild(a)});c.normalize();c.adjustFontSize();return c};b.DescarTeXParser=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=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)};c.prototype.clone=function(){return new c(Object.assign({},this))};c.prototype.set=function(a){Object.assign(this,a)};c.prototype.equals=function(a){var b=!0,c;for(c in this)this.hasOwnProperty(c)&&(b=b&&this[c]===a[c]);return b};c.prototype.toString=function(c){/arial|sansserif/i.test(this.family)?
a=b.sansserif_font:/times|serif/i.test(this.family)?a=c?b.math_font:b.serif_font:/courier|monospaced/i.test(this.family)&&(a=b.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+a).trim()};b.TextStyle=c;return b}(descartesJS||{});
descartesJS=function(b){function a(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function c(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((n[a].ascent+25)*c/n[a].unitsPerEm);b.descent=Math.ceil(Math.abs((n[a].descent-25)*c/n[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(b.loadLib)return b;
var h=!1,p="#000000",d=2,l=!1,e=function(a,c,d,f){this.type="rtfNode";this.evaluator=f;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=a;this.style=d;this.changeNodeType(c);this.drawBorder=b.in_editor?this.drawBorderSpecial:function(){}};e.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}};e.prototype.clone=function(){for(var a=new e(this.value,this.nodeType,this.style.clone()),b=0,c=this.children.length;b<c;b++)a.addChild(this.children[b].clone());return a};e.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};e.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+"}"};e.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};e.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};e.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};e.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};e.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};e.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};e.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,d=this.children.length;c<d;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};e.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};e.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};e.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 e("","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 e("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&d.parent.insertAfter(d,new e("","text",d.parent.style))}return this};e.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])};e.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;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))};e.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};e.prototype.update=function(a,b,c,f,e,h,n,r){d=c;l=f;p=n;this.metrics.w=this.metrics.h=0;n=b;if(20<=r)for(c=0;c<this.children.length;c++)this.children[c].breakLines(r);c=0;for(f=this.children.length;c<f;c++){var g=this.children[c];
g.updateLine();g.metrics.offsetX=a;g.metrics.y=b;b+=parseInt(g.metrics.ascent+.5);g.metrics.offsetY=b;e=parseInt(g.metrics.descent+.5)+parseInt(1.5+.05*g.style.size);b+=e;this.metrics.h+=g.metrics.h;this.metrics.w=Math.max(this.metrics.w,g.metrics.w)}b=n;h=h||"";h.match("right")?a-=this.metrics.w:h.match("_center")&&(a-=this.metrics.w/2);h.match("bottom")?b-=this.metrics.h:h.match("center_")&&(b-=this.metrics.h/2);h=this.children;c=0;for(f=h.length;c<f;c++)"left"===h[c].style.align?h[c].metrics.offsetX=
a:"right"===h[c].style.align?h[c].metrics.offsetX=a+this.metrics.w-h[c].metrics.w:"center"===h[c].style.align?h[c].metrics.offsetX=a+(this.metrics.w-h[c].metrics.w)/2:"justify"===h[c].style.align&&20<=r&&(e=c<f-1?h[c+1].value:null,h[c].metrics.offsetX=a,"wrap"===e&&h[c].justifyAux(r)),h[c].metrics.y=b,b+=parseInt(h[c].metrics.ascent+.5),h[c].metrics.offsetY=b,e=parseInt(h[c].metrics.descent+.5)+parseInt(1.5+.05*h[c].style.size),b+=e};e.prototype.breakLines=function(a){for(var c,d=0,g=!1,l=[],h=0,
p=this.children.length;h<p;h++)c=this.children[h],g?l.push(c):("text"===c.nodeType||"space"===c.nodeType?(b.ctx.font=c.style.toString(),c.metrics.w=b.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),d+=c.metrics.w,d>a&&"space"!==c.nodeType&&0<h&&(g=!0,l.push(c)));if(0<l.length)for(a=new e("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,a),h=0,p=l.length;h<p;h++)l[h].parent&&l[h].parent.removeChild(l[h]),a.addChild(l[h])};
e.prototype.updateLine=function(a){var d=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var g=this.metrics.descent=0,f=this.children,e,l=0,h=f.length;l<h;l++){e=f[l];if("text"===e.nodeType){b.ctx.font=e.style.toString();var p=""!==e.value?e.value:b.in_editor?"\u200a":"";e.metrics=c(b.ctx.font);e.metrics.w=b.ctx.measureText(p).width;e.metrics.offsetX=g;Object.defineProperties(e.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},
y:{get:function(){return d.metrics.offsetY+this.offsetY}}})}"space"===e.nodeType?(b.ctx.font=e.style.toString(),e.metrics=c(b.ctx.font),e.metrics.w=l===h-1?0:a?a:b.ctx.measureText(" ").width,e.metrics.offsetX=g,Object.defineProperties(e.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY+this.offsetY}}})):"word"===e.nodeType&&(e.updateLine(),e.metrics.offsetX_aux=g,Object.defineProperties(e.metrics,{offsetX:{get:function(){return d.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}}));"hyperlink"===e.nodeType&&(b.ctx.font=e.styleString,p=""!==e.value?e.value:b.in_editor?"\u200a":"",e.metrics=c(b.ctx.font),e.metrics.w=b.ctx.measureText(p).width,e.metrics.offsetX=g,Object.defineProperties(e.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}}),e.clickCatcher||(e.clickCatcher=b.newHTML("div",{style:"position:absolute;width:"+e.metrics.w+"px;height:"+
e.metrics.h+"px;cursor:pointer;"}),e.clickCatcher.rtfNode=e,e.clickCatcher.action=new b.OpenURL(this.evaluator.parent,e.URL),e.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===e.nodeType&&(e.componentNumCtrl=this.evaluator.parent.getControlByCId(e.value),b.ctx.font=e.styleString,e.metrics=c(b.ctx.font),e.metrics.w=e.componentNumCtrl.w,e.metrics.h=e.componentNumCtrl.h,e.metrics.offsetX=g,Object.defineProperties(e.metrics,
{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}}));"componentSpace"===e.nodeType?(e.componentSpace=this.evaluator.parent.getSpaceByCId(e.value),b.ctx.font=e.styleString,e.metrics=c(b.ctx.font),e.metrics.w=e.componentSpace.w,e.metrics.h=e.componentSpace.h,e.metrics.offsetX=g,Object.defineProperties(e.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}})):"formula"===e.nodeType&&(e.updateFormula(),
e.metrics.marginX=e.metrics.marginY=e.metrics.paddingX=e.metrics.paddingY=0,e.metrics.offsetX_aux=g,Object.defineProperties(e.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}}),e.metrics.w+=2*e.metrics.paddingX,e.metrics.ascent+=e.metrics.paddingY,e.metrics.descent+=e.metrics.paddingY,e.metrics.h+=2*e.metrics.paddingY,g+=2*e.metrics.marginX);
this.metrics.w+=e.metrics.w+2*e.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,e.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,e.metrics.descent);g+=e.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};e.prototype.updateFormula=function(){var g=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 e=this.children,m,f=0,h={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}},p=0,n=e.length;p<n;p++){m=e[p];if("text"===m.nodeType){b.ctx.font=m.style.toString(!0);var r=""!==m.value?m.value:b.in_editor?"\u200a":"";m.metrics=c(b.ctx.font);m.metrics.w=b.ctx.measureText(r).width;m.metrics.offsetX=f;Object.defineProperties(m.metrics,{x:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.offsetX}},y:{get:function(){return g.metrics.offsetY}}});f+=g.metrics.marginX}else if("dynamicText"===m.nodeType){r=void 0===
m.decimals?d:m.evaluator.eval(m.decimals);var v=void 0===m.fixed?l:m.fixed,z=m.evaluator.eval(m.value);parseFloat(z).toString()===z.toString()&&(z=v?parseFloat(z).toFixed(r):b.removeNeedlessDecimals(parseFloat(z).toFixed(r)),z=(""+z).replace(".",m.decimal_symbol));m.evalValue=z;b.ctx.font=m.style.toString(!0);m.metrics=c(b.ctx.font);m.metrics.marginX=0;m.metrics.paddingX=0;m.metrics.w=b.ctx.measureText(z).width+2*m.metrics.paddingX;m.metrics.offsetX_aux=f;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return g.metrics.offsetY}}});f+=2*m.metrics.marginX}if("superIndex"===m.nodeType)r=m,r.updateFormula(),r.metrics.marginX=0,r.metrics.paddingX=0,r.metrics.paddingY=0,r.metrics.offsetX_aux=f,r.metrics.prevChild=h,Object.defineProperties(r.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+
g.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return g.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),r.metrics.w+=2*r.metrics.paddingX,r.metrics.ascent+=r.metrics.paddingY,r.metrics.descent+=r.metrics.paddingY,r.metrics.h+=2*r.metrics.paddingY,r.metrics.tmp_ascent=r.metrics.h+(r.metrics.prevChild.metrics.ascent-r.metrics.prevChild.metrics.descent)/2,f+=2*r.metrics.marginX;else if("subIndex"===m.nodeType)r=m,r.updateFormula(),
r.metrics.marginX=0,r.metrics.paddingX=0,r.metrics.paddingY=0,r.metrics.offsetX_aux=f,r.metrics.prevChild=h,Object.defineProperties(r.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),r.metrics.w+=r.metrics.paddingX,r.metrics.ascent+=r.metrics.paddingY,
r.metrics.descent+=r.metrics.paddingY,r.metrics.h+=2*r.metrics.paddingY,this.metrics.descent=r.metrics.ascent+(r.metrics.prevChild.metrics.descent-r.metrics.prevChild.metrics.ascent)/2+r.metrics.descent,f+=r.metrics.marginX;else if("fraction"===m.nodeType){v=m;v.updateFormula();r=v.children;z=r[0];r=r[1];v.metrics.marginX=parseInt(.5+.075*this.style.size);v.metrics.paddingX=0;v.metrics.paddingY=0;var y=Math.max(z.metrics.w,r.metrics.w)+2*v.metrics.paddingX;v.metrics.prevChild=h;v.metrics.offsetX_aux=
f;var A=parseInt(-h.metrics.descent+4*h.metrics.h/9);Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+A}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY-A}}});Object.defineProperties(z.metrics,{parent:{value:v},maxWidth:{value:y},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(r.metrics,{parent:{value:v},maxWidth:{value:y},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}}});v.metrics.w=
y;v.metrics.ascent=z.metrics.h+A+2*v.metrics.paddingY;v.metrics.descent=r.metrics.h-A+2*v.metrics.paddingY;v.metrics.h=z.metrics.h+r.metrics.h+4*v.metrics.paddingY;f+=2*v.metrics.marginX}else if("radical"===m.nodeType){h=m;h.updateFormula();r=h.children;v=r[0];var B=r[1];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY}}});r=h.style.size;h.radicalSign={w:r,scaleX:r/722,scaleY:B.metrics.h/1E3};z=parseInt(v.metrics.w-2*h.radicalSign.w/3);Object.defineProperties(h.radicalSign,{parent:{value:h},displaceIndex:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return g.metrics.offsetY-B.metrics.ascent}}});Object.defineProperties(v.metrics,{parent:{value:h},displaceIndex:{value:z},fontSize:{value:r},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 g.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(B.metrics,{parent:{value:h},
displaceIndex:{value:z},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 g.metrics.offsetY}}});z=v.metrics.w<2*h.radicalSign.w/3?h.radicalSign.w:parseInt(v.metrics.w+h.radicalSign.w/3);h.metrics.w=z+2*h.metrics.paddingX+B.metrics.w;h.metrics.ascent=Math.max(B.metrics.ascent,v.metrics.h+2*r/5)+
h.metrics.paddingY;h.metrics.descent=B.metrics.descent+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("sum"===m.nodeType){v=m;v.updateFormula();r=v.children;z=r[0];y=r[1];var D=r[2];v.metrics.marginX=parseInt(1.5+.075*this.style.size);v.metrics.paddingX=parseInt(1.5+.075*this.style.size);v.metrics.paddingY=parseInt(1.5+.05*this.style.size);v.metrics.offsetX_aux=f;Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY}}});b.ctx.font=m.style.toString();var I=c(b.ctx.font);h=parseInt(1.2*I.h);r=parseInt(.5+780*h/1E3);v.sigmaSign={w:r,h:h,scale:h/1E3};var E=Math.max(y.metrics.w,z.metrics.w,v.sigmaSign.w);v.sigmaSign.parent=v;Object.defineProperties(v.sigmaSign,{sumWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return g.metrics.offsetY+I.descent-(this.h+I.h)/2}}});r=I.descent-y.metrics.descent-(h+I.h)/2-v.metrics.paddingY;Object.defineProperties(y.metrics,{parent:{value:v},sumWidth:{value:E},newBaselineTo:{value:r},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 g.metrics.offsetY+this.newBaselineTo}}});
h=z.metrics.ascent+I.descent+(h-I.h)/2+v.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:v},sumWidth:{value:E},newBaselineFrom:{value:h},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 g.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(D.metrics,{parent:{value:v},sumWidth:{value:E},
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 g.metrics.offsetY}}});v.metrics.w=E+D.metrics.w+3*v.metrics.paddingX;v.metrics.ascent=Math.max(D.metrics.ascent,-r+y.metrics.ascent)+v.metrics.paddingY;v.metrics.descent=Math.max(D.metrics.descent,h+z.metrics.descent)+v.metrics.paddingY;v.metrics.h=v.metrics.ascent+v.metrics.descent;
f+=2*v.metrics.marginX}else if("integral"===m.nodeType){v=m;v.updateFormula();r=v.children;z=r[0];y=r[1];D=r[2];v.metrics.marginX=parseInt(1.5+.075*this.style.size);v.metrics.paddingX=parseInt(1.5+.075*this.style.size);v.metrics.paddingY=parseInt(1.5+.05*this.style.size);v.metrics.offsetX_aux=f;Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return g.metrics.offsetY}}});b.ctx.font=m.style.toString();I=c(b.ctx.font);E=parseInt(1.2*I.h);var G=parseInt(10.5+529*E/1E3);v.sign={w:G,h:E,scale:E/1E3};v.sign.parent=v;Object.defineProperties(v.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return g.metrics.offsetY+I.descent-(this.h+I.h)/2}}});r=I.descent-(E+I.h)/2-y.metrics.descent+E/3;Object.defineProperties(y.metrics,{parent:{value:v},integralWidth:{value:G},
newBaselineTo:{value:r},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 g.metrics.offsetY+this.newBaselineTo}}});h=I.descent+z.metrics.ascent/2;Object.defineProperties(z.metrics,{parent:{value:v},integralWidth:{value:G},newBaselineFrom:{value:h},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 g.metrics.offsetY+this.newBaselineFrom}}});G=Math.max(parseInt(3*G/5)+y.metrics.w,parseInt(2*G/5+z.metrics.w))+v.metrics.paddingX;Object.defineProperties(D.metrics,{parent:{value:v},whatDisplace:{value:G},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 g.metrics.offsetY}}});v.metrics.w=G+D.metrics.w+2*v.metrics.paddingX;v.metrics.ascent=Math.max(D.metrics.ascent,-r+y.metrics.ascent)+v.metrics.paddingY;v.metrics.descent=Math.max(D.metrics.descent,h+z.metrics.descent,E-v.metrics.ascent)+v.metrics.paddingY;v.metrics.h=Math.max(v.metrics.ascent+v.metrics.descent,E);f+=2*v.metrics.marginX}else if("prod"===m.nodeType)v=m,v.updateFormula(),r=v.children,z=r[0],y=r[1],D=r[2],v.metrics.marginX=parseInt(1.5+
.075*this.style.size),v.metrics.paddingX=parseInt(1.5+.075*this.style.size),v.metrics.paddingY=parseInt(1.5+.05*this.style.size),v.metrics.offsetX_aux=f,Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY}}}),b.ctx.font=m.style.toString(),I=c(b.ctx.font),h=parseInt(1.2*I.h),r=parseInt(.5+
876*h/1E3),v.piSign={w:r,h:h,scale:h/1E3},E=Math.max(y.metrics.w,z.metrics.w,v.piSign.w),v.piSign.parent=v,Object.defineProperties(v.piSign,{prodWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return g.metrics.offsetY+I.descent-(this.h+I.h)/2}}}),r=I.descent-y.metrics.descent-(h+I.h)/2-v.metrics.paddingY,Object.defineProperties(y.metrics,{parent:{value:v},prodWidth:{value:E},newBaselineTo:{value:r},
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 g.metrics.offsetY+this.newBaselineTo}}}),h=z.metrics.ascent+I.descent+(h-I.h)/2+v.metrics.paddingY,Object.defineProperties(z.metrics,{parent:{value:v},prodWidth:{value:E},newBaselineFrom:{value:h},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 g.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(D.metrics,{parent:{value:v},prodWidth:{value:E},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 g.metrics.offsetY}}}),
v.metrics.w=E+D.metrics.w+3*v.metrics.paddingX,v.metrics.ascent=Math.max(D.metrics.ascent,-r+y.metrics.ascent)+v.metrics.paddingY,v.metrics.descent=Math.max(D.metrics.descent,h+z.metrics.descent)+v.metrics.paddingY,v.metrics.h=v.metrics.ascent+v.metrics.descent,f+=2*v.metrics.marginX;else if("limit"===m.nodeType){h=m;h.updateFormula();r=h.children;var H=r[0];v=r[1];r=r[2];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=
parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY}}});b.ctx.font=m.style.toString();I=c(b.ctx.font);z=parseInt(.5+b.ctx.measureText("l\u00edm").width);y=parseInt(.5+b.ctx.measureText("\u2192").width);D=Math.max(z,H.metrics.w+y+v.metrics.w);
h.limitText={parent:h};Object.defineProperties(h.limitText,{limitWidth:{value:D},limitTextWidth:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});z=I.descent+Math.max(H.metrics.ascent,v.metrics.ascent,2*I.ascent/3)+h.metrics.paddingY;h.limitArrow={parent:h};Object.defineProperties(h.limitArrow,{newBaseline:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+H.metrics.w}},y:{get:function(){return g.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(H.metrics,{parent:{value:h},newBaseline:{value:z},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 g.metrics.offsetY+this.newBaseline}}});Object.defineProperties(v.metrics,{parent:{value:h},arrowWidth:{value:y},newBaseline:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+H.metrics.w+this.arrowWidth}},offsetY:{get:function(){return g.metrics.offsetY+this.newBaseline}}});Object.defineProperties(r.metrics,{parent:{value:h},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 g.metrics.offsetY}}});
h.metrics.w=D+r.metrics.w+3*h.metrics.paddingX;h.metrics.ascent=Math.max(r.metrics.ascent,I.ascent)+h.metrics.paddingY;y=0;r=Math.max(H.metrics.descent,v.metrics.descent,r.metrics.descent);if(0!=H.metrics.h||0!=v.metrics.h)y=z,r=Math.max(H.metrics.descent,v.metrics.descent,r-y);h.metrics.descent=y+r+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("matrix"===m.nodeType){z=m;z.updateFormula();r=z.children;y=z.rows;D=z.columns;z.metrics.marginX=parseInt(1.5+
.075*this.style.size);z.metrics.paddingX=parseInt(5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=f;Object.defineProperties(z.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY}}});b.ctx.font=m.style.toString();I=c(b.ctx.font);E=[];G=[];h=0;for(var C=y*D;h<C;h++){var J=
parseInt(h/D);var P=h%D;E[J]=Math.max(E[J]||0,r[h].metrics.h);G[P]=Math.max(G[P]||0,r[h].metrics.w)}var R=(1+D)*z.metrics.paddingX;for(h=0;h<D;h++)R+=G[h];var L=(1+y)*z.metrics.paddingY;for(h=0;h<y;h++)L+=E[h];v=I.descent-I.h/2;h=0;for(C=y*D;h<C;h++)J=parseInt(h/D),P=h%D,r[h].metrics.offsetX_aux=a(G,P)+(G[P]-r[h].metrics.w)/2+P*z.metrics.paddingX,r[h].metrics.offsetY_aux=a(E,J)+(E[J]-r[h].metrics.h)/2+(1+J)*z.metrics.paddingY,Object.defineProperties(r[h].metrics,{parent:{value:z},matrixH:{value:L},
dispY:{value:v},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 g.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.w=R;z.metrics.ascent=L/2-v;z.metrics.descent=L/2+v;z.metrics.h=z.metrics.ascent+z.metrics.descent;f+=2*z.metrics.marginX}else if("defparts"===m.nodeType){z=m;z.updateFormula();r=m.children;
y=m.parts;z.metrics.marginX=parseInt(1.5+.075*this.style.size);z.metrics.paddingX=parseInt(1.5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=f;Object.defineProperties(z.metrics,{parent:{value:g},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return g.metrics.offsetX+g.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return g.metrics.offsetY}}});b.ctx.font=
m.style.toString();I=c(b.ctx.font);D=0;E=z.metrics.paddingY;v=I.descent-I.h/2;for(h=0;h<y;h++)r[h].metrics.offsetY_aux=E,D=Math.max(D,r[h].metrics.w),E+=r[h].metrics.h+z.metrics.paddingY,Object.defineProperties(r[h].metrics,{parent:{value:z},dispY:{value:v},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 g.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.defpartsH=E;z.metrics.w=D+4*z.metrics.paddingX;z.metrics.ascent=E/2-v;z.metrics.descent=E/2+v;z.metrics.h=z.metrics.ascent+z.metrics.descent;f+=2*z.metrics.marginX}else if("numerator"===m.nodeType||"denominator"===m.nodeType||"index"===m.nodeType||"radicand"===m.nodeType||"from"===m.nodeType||"to"===m.nodeType||"what"===m.nodeType||"element"===m.nodeType)m.updateFormula(),m.metrics.paddingX=parseInt(1.5+.075*this.style.size),m.metrics.paddingY=
parseInt(1.5+.05*this.style.size),m.metrics.ascent+=m.metrics.paddingY,m.metrics.descent+=m.metrics.paddingY,m.metrics.h=m.metrics.ascent+m.metrics.descent,1==m.children.length&&"text"==m.children[0].nodeType&&""==m.children[0].value?(m.metrics.w=0,b.in_editor||(m.metrics.ascent=m.metrics.descent=m.metrics.h=0)):m.metrics.w+=2*m.metrics.paddingX;h=m;this.metrics.ascent=Math.max(this.metrics.ascent,m.metrics.tmp_ascent||m.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,m.metrics.descent);
this.metrics.w+=m.metrics.w+2*m.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;f+=m.metrics.w}};e.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,g=this.children.length;d<g-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};e.prototype.drawTextBlock=function(a){a.fillStyle=p;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"};e.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)h=!1,this.children[b].draw(a)};e.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:p;a.font=this.style.toString(h);a.beginPath();this.style.overline&&(a.rect(b,c-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,c+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,c);a.strokeStyle=
d}a.fillText(this.value,b,c)}};e.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};e.prototype.drawSpace=function(a){};e.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:p;a.font=this.style.toString(h);a.beginPath();this.style.overline&&(a.rect(b,c-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,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,c);this.drawBorder(a,"blue")};e.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=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=c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(h);a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};e.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)h=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};e.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:p;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")};e.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};e.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};e.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};e.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:p;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")};e.prototype.drawSum=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:p;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")};e.prototype.drawIntegral=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:p;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")};e.prototype.drawProd=function(a){a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:p;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")};e.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:p;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")};e.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:p;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 d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,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+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,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-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+
b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,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-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y-
b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-d,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")};e.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:p;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-
5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,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+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);
a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,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")};e.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};
e.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)};e.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)};e.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([])};e.prototype.toRTF=function(){var a=[],b=[],c="";this.mergeTextNodes();
for(var d=0,e=this.children.length;d<e;d++){var h=this.children[d];"textLineBlock"===h.nodeType&&(c+=h.toRTFAux(a,b)+(1<e&&d<e-1?"\\par":""))}h="{\\fonttbl";d=0;for(e=a.length;d<e;d++)h+="\\f"+d+"\\fcharset0 "+a[d]+";";a="";if(0<b.length){a="{\\colortbl";d=0;for(e=b.length;d<e;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(h+"}")+a+c+"}"};e.prototype.toRTFAux=function(a,b){for(var c,d,e,g=null,h="",l,n,q,y,A,B=0,D=this.children.length;B<D;B++)l=n="",c=this.children[B],q=this.addToFontTable(c.style.family,
a),y=c.style.size,A=this.addToColorTable(c.style.color,b),null===A&&0<b.length&&(A=this.addToColorTable(p,b)),A!==g&&(l+="\\cf"+A,g=A),q!==d&&(l+="\\f"+q,d=q),y!==e&&(l+="\\fs"+2*y,e=y),c.style.italic&&(l+="\\i",n="\\i0"+n),c.style.bold&&(l+="\\b",n="\\b0"+n),c.style.underline&&(l+="\\ul",n="\\ulnone"+n),c.style.overline&&(l+="\\ol",n="\\olnone"+n),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==l?l+" "+c.value+n:""!==h&&
"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=c):"formula"===c.nodeType?h+="{\\*\\mjaformula"+c.formulaToRTF(d,e,g,a,b)+"}":"componentSpace"===c.nodeType?h+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(h+="{\\*\\component\\NumCtrl "+c.value+"}");return h};e.prototype.formulaToRTF=function(a,b,c,d,e){for(var f,g="",h,l,m,n,q=0,w=this.children.length;q<w;q++)h=l="",f=this.children[q],m=this.addToFontTable(f.style.family,d),n=this.addToColorTable(f.style.color,e),null===
n&&0<e.length&&(n=this.addToColorTable(p,e)),m!==a&&(h+="\\f"+m,a=m),n!==c&&(h+="\\cf"+n,"text"!==f.nodeType||"text"===f.nodeType&&""!==f.value)&&(c=n),f.style.italic&&(h+="\\i",l="\\i0"+l),f.style.bold&&(h+="\\b",l="\\b0"+l),f.style.underline&&(h+="\\ul",l="\\ulnone"+l),f.style.overline&&(h+="\\ol",l="\\olnone"+l),"text"===f.nodeType&&""!==f.value?(f.value=f.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==h?h+" "+f.value+l:"}"!==g.charAt(g.length-
1)?" "+f.value:f.value,g+=tmpRTF):"dynamicText"===f.nodeType?(f.value=""===f.value?" ":f.value,g+=h+"{\\expr "+f.value+"\\decimals "+(f.decimals||2)+"\\fixed"+(f.fixed?1:0)+"}"+l):"fraction"===f.nodeType||"radical"===f.nodeType||"index"===f.nodeType||"radicand"===f.nodeType||"sum"===f.nodeType||"integral"===f.nodeType||"prod"===f.nodeType||"limit"===f.nodeType||"from"===f.nodeType||"to"===f.nodeType||"what"===f.nodeType||"element"===f.nodeType?g+="{\\"+f.nodeType+f.formulaToRTF(a,b,c,d,e)+"}":"numerator"===
f.nodeType?g+="{\\num"+f.formulaToRTF(a,b,c,d,e)+"}":"denominator"===f.nodeType?g+="{\\den"+f.formulaToRTF(a,b,c,d,e)+"}":"superIndex"===f.nodeType?g+="{\\supix"+f.formulaToRTF(a,b,c,d,e)+"}":"subIndex"===f.nodeType?g+="{\\subix"+f.formulaToRTF(a,b,c,d,e)+"}":"matrix"===f.nodeType?g+="{\\matrix\\rows "+(f.rows||2)+"\\columns "+(f.columns||2)+f.formulaToRTF(a,b,c,d,e)+"}":"defparts"===f.nodeType&&(g+="{\\defparts\\parts "+(f.parts||2)+f.formulaToRTF(a,b,c,d,e)+"}");return g};e.prototype.addToFontTable=
function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};e.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};e.prototype.mergeTextNodes=function(){for(var a=[],b=null,c=0,d=this.children.length;c<
d;c++)"text"===this.children[c].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[c].style)&&(this.children[c].value=b.value+this.children[c].value,a.push(b)):this.children[c].mergeTextNodes(),b=this.children[c];c=0;for(d=a.length;c<d;c++)this.removeChild(a[c])};var n={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}};b.TextNode=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=String.fromCharCode,c,h,p,d,l,e,n,g,q,m,f,w=function(){};w.prototype.tokenize=function(b){if(b)b=b.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[];c=[];h="";d=p=0;e=b.charAt(0);n=!1;for(g="text";p<b.length;)l=e,e=b.charAt(p+1),n?"\\"===e||"{"===e||"}"===
e||" "===e||";"===e?(n=!1,h+=l," "===e?(p++,e=b.charAt(p+1),f=!0):f=!1,(q=h.match(/^'([0-9a-f]{2})/))?(m="","text"===g&&(m=c.pop().value),h=m+=a(parseInt(q[1],16))+h.substring(3)):(q=h.match(/^u[0-9]+/))?(m="","text"===g&&(m=c.pop().value),h=m+=a(q[0].substring(1))):("{"===h||"}"===h||"\\"==l?(c.push({type:"text",value:h+(f?" ":"")}),g="text"):(c.push({type:"controlWord",value:h}),g="controlWord"),h="")):"{"==l||"}"==l||"\\"==l?(n=!1,c.push({type:"text",value:l}),g="text"):h+=l:"\\"===l?(n=!0,""!==
h&&(c.push({type:"text",value:h}),g="text",h="")):"{"===l?(d++,""!==h&&(c.push({type:"text",value:h}),h=""),c.push({type:"openBlock",value:d}),g="openBlock"):"}"===l?(""!==h&&(c.push({type:"text",value:h}),h=""),c.push({type:"closeBlock",value:d}),g="closeBlock",d--):h+=l,p++;""!==h&&c.push({type:"text",value:h});return c};b.RTFTokenizer=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,c,h,p,d,l,e,n,g,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O=function(a){this.evaluator=a;this.tokenizer=new b.RTFTokenizer};O.prototype.parse=function(F){c=this.tokenizer.tokenize(F);h={};d=2;if("openBlock"===c[0].type&&"fonttbl"===c[1].value){for(p=c[0].value;"closeBlock"!==c[d].type&&c[d].value!==p;)h[c[d].value]=c[d+2].value.substring(0,c[d+2].value.length-1),d+=3;d++}l={};e=0;if("openBlock"===c[d].type&&"colortbl"===c[d+1].value){p=
c[d++].value;for(d++;"closeBlock"!==c[d].type&&c[d].value!==p;)n=parseInt(c[d++].value.substring(3)).toString(16),g=parseInt(c[d++].value.substring(5)).toString(16),q=parseInt(c[d++].value.substring(4)).toString(16),";"===c[d].value&&d++,l[e++]="#"+(2>n.length?"0"+n:n)+(2>g.length?"0"+g:g)+(2>q.length?"0"+q:q);d++}x=u=w=null;R=P=J=D=B=A=y=z=v=r=!1;I=[new b.TextStyle];E=I[0];H=G=-1;C=[];m=L=new b.TextNode("","textBlock",E,this.evaluator);f=new b.TextNode("","textLineBlock",E,this.evaluator);m.addChild(f);
L.stableWidth=!0;L.hasFormula=!1;F=d;for(var M=c.length;F<M;F++){if("controlWord"==c[F].type)if(h[c[F].value])E.set({family:h[c[F].value]});else if(c[F].value.match(/^fs(\d+)/))E.set({size:parseInt(c[F].value.match(/^fs(\d+)/)[1]/2)});else if("b"==c[F].value)E.set({bold:!0}),0<C.length&&C[C.length-1].style.set({bold:!0});else if("b0"==c[F].value)E.set({bold:!1}),0<C.length&&C[C.length-1].style.set({bold:!1});else if("i"==c[F].value)E.set({italic:!0}),0<C.length&&C[C.length-1].style.set({italic:!0});
else if("i0"==c[F].value)E.set({italic:!1}),0<C.length&&C[C.length-1].style.set({italic:!1});else if("ul"==c[F].value)E.set({underline:!0}),0<C.length&&C[C.length-1].style.set({underline:!0});else if("ulnone"==c[F].value)E.set({underline:!1}),0<C.length&&C[C.length-1].style.set({underline:!1});else if("ol"==c[F].value)E.set({overline:!0}),0<C.length&&C[C.length-1].style.set({overline:!0});else if("olnone"==c[F].value)E.set({overline:!1}),0<C.length&&C[C.length-1].style.set({overline:!1});else if(c[F].value.match(/^cf(\d+)/))E.set({color:l[parseInt(c[F].value.substring(2))]}),
0<C.length&&(C[C.length-1].style.color=E.color);else if("par"==c[F].value){m=new b.TextNode("","textLineBlock",E.clone(),this.evaluator);if("textBlock"!=f.nodeType)for(f=f.parent;"textBlock"!=f.nodeType;)f=f.parent;f.addChild(m);f=m}else if("mjaformula"==c[F].value)L.hasFormula=!0,H=G,r=!0,m=new b.TextNode("","formula",E.clone(),this.evaluator),f.addChild(m),f=m,C[C.length-1]=m;else if("fraction"==c[F].value||"radicand"==c[F].value||"radical"==c[F].value||"what"==c[F].value||"sum"==c[F].value||"integral"==
c[F].value||"limit"==c[F].value){var K=C[C.length-2].style.clone();m=new b.TextNode("",c[F].value,K,this.evaluator);C[C.length-2].addChild(m);C[C.length-1]=m}else"index"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(parseInt(K.size-.5*K.size),8),m=new b.TextNode("",c[F].value,K,this.evaluator),C[C.length-2].addChild(m),C[C.length-1]=m):"to"==c[F].value||"from"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(parseInt(K.size-.2*K.size),8),m=new b.TextNode("",c[F].value,K,this.evaluator),C[C.length-
2].addChild(m),C[C.length-1]=m):"num"==c[F].value||"den"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(Math.round(K.size-.1*K.size),8),"num"==c[F].value?m=new b.TextNode("","numerator",K,this.evaluator):"den"==c[F].value&&(m=new b.TextNode("","denominator",K,this.evaluator)),C[C.length-2].addChild(m),C[C.length-1]=m):"subix"==c[F].value||"supix"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(Math.floor(K.size-.33*K.size),8),"subix"==c[F].value?m=new b.TextNode("","subIndex",K,this.evaluator):
"supix"==c[F].value&&(m=new b.TextNode("","superIndex",K,this.evaluator)),m.originalStyle=C[C.length-2].style.clone(),C[C.length-2].addChild(m),C[C.length-1]=m):"defparts"==c[F].value||"matrix"==c[F].value||"element"==c[F].value?(K=C[C.length-2].style.clone(),m=new b.TextNode("",c[F].value,K,this.evaluator),C[C.length-2].addChild(m),C[C.length-1]=m,"defparts"==c[F].value?x=m:"matrix"==c[F].value&&(u=m,u.matrix_type=0)):"parts"==c[F].value?D=!0:"type"==c[F].value?y=!0:"rows"==c[F].value?A=!0:"columns"==
c[F].value?B=!0:"expr"==c[F].value?(L.stableWidth=!1,v=!0):"decimals"==c[F].value?z=!0:"fixed1"==c[F].value?w.fixed=!0:"fixed0"==c[F].value?w.fixed=!1:"component"!=c[F].value&&("NumCtrl"==c[F].value?J=!0:"Space"==c[F].value?P=!0:"hyperlink"==c[F].value&&(R=!0));if("text"==c[F].type)if(D)x.parts=parseInt(c[F].value),D=!1;else if(y)u.matrix_type=parseInt(c[F].value),y=!1;else if(A)u.rows=parseInt(c[F].value),A=!1;else if(B)u.columns=parseInt(c[F].value),B=!1;else if(z)w.decimals=this.evaluator.parser.parse(c[F].value+
""),z=!1;else if(R){Q=c[F].value.split("|")[0];K=E.clone();m=new b.TextNode(Q,"hyperlink",K,this.evaluator);m.URL=c[F].value.split("|")[1];if("textLineBlock"!=f.nodeType)for(f=f.parent;"textLineBlock"!=f.nodeType;)f=f.parent;f.addChild(m);R=!1}else if(J)m=new b.TextNode(c[F].value,"componentNumCtrl",E.clone(),this.evaluator),f.addChild(m),J=!1;else if(P)m=new b.TextNode(c[F].value,"componentSpace",E.clone(),this.evaluator),f.addChild(m),P=!1;else if(v)K=C[C.length-2].style.clone(),Q=this.evaluator.parser.parse(c[F].value),
m=new b.TextNode(Q,"dynamicText",K,this.evaluator),C[C.length-2].addChild(m),w=C[C.length-1]=m,v=!1;else if(v||r)!v&&r&&(Q=c[F].value,m=new b.TextNode(Q,"text",C[C.length-1].style.clone(),this.evaluator),C[C.length-1].addChild(m));else{Q=c[F].value;m=new b.TextNode(Q,"text",E.clone(),this.evaluator);if("textLineBlock"!=f.nodeType)for(f=f.parent;"textLineBlock"!=f.nodeType;)f=f.parent;f.addChild(m)}else if("openBlock"==c[F].type)G=c[F].value,E=E.clone(),I.push(E),C.push(null);else if("closeBlock"==
c[F].type)c[F].value==H&&(H=-1,r=!1,f=f.parent),I.pop(),E=I[I.length-1],C.pop();else if("("==c[F].type||")"==c[F].type)K=C[C.length-1].style.clone(),K.italic="",m=new b.TextNode(c[F].type,"mathSymbol",K,this.evaluator),C[C.length-1].addChild(m);else if("+"==c[F].type||"-"==c[F].type||"*"==c[F].type||"="==c[F].type)m=new b.TextNode(c[F].type,"mathSymbol",C[C.length-1].style.clone(),this.evaluator),C[C.length-1].addChild(m)}return L.normalize()};b.RTFParser=O;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n,g,q,m,f,w=function(c,d){a=this;a.parent=c;a.evaluator=a.parent.evaluator;h=a.evaluator;p=h.parser;a.id=a.imageSrc=a.x_axis=a.y_axis=a.cID="";a.type="2D";a.xExpr=a.yExpr=p.parse("0");a.w=parseInt(c.container.width);a.h=parseInt(c.container.height);a.drawif=p.parse("1");a.fixed=a.text=a.numbers=a.sensitive_to_mouse_movements=!1;a.scale=48;a.Ox=a.Oy=a.mouse_x=a.mouse_y=a.border_width=a.border_radius=0;a.image=new Image;a.image.onload=
function(){this.ready=1};a.bg_display="topleft";a.background=new b.Color("ffffff");a.net=new b.Color("b8c4c8");a.net10=new b.Color("889498");a.axes=new b.Color("405860");a.border_color=new b.Color("000000");a.ctrs=[];a.graphicsCtr=[];a.graphics=[];a.backGraphics=[];a.zIndex=c.zIndex;a.plecaHeight=c.plecaHeight||0;a.displaceRegionNorth=c.displaceRegionNorth||0;a.displaceRegionWest=c.displaceRegionWest||0;Object.assign(a,d);a.initSpace()};w.prototype.initSpace=function(){a=this;c=a.parent;h=a.evaluator;
d=a.id+".";a.resizable||(a.displaceRegionNorth=c.displaceRegionNorth||0,a.displaceRegionSouth=c.displaceRegionSouth||0,a.displaceRegionEast=c.displaceRegionEast||0,a.displaceRegionWest=c.displaceRegionWest||0,g=parseInt(c.container.width),n=parseInt(c.container.height),void 0!=a.wExpr&&(a.w=parseInt(g-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=a.hExpr&&(a.h=parseInt(n-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=
h.parser.parse((parseInt(g-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=h.parser.parse((parseInt(n-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=h.eval(a.xExpr)+a.displaceRegionWest,a.y=h.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=n-a.y,a.h>l&&(a.h=l)):(l=a.h+a.y,a.h=l>=n?n:l),0<=a.x?
(e=g-a.x,a.w>e&&(a.w=e)):(e=a.w+a.x,a.w=e>=g?g:e));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=c.getImage(a.imageSrc));a.OxExpr&&(m=a.OxExpr,m.endsWith("%")?a.Ox=a.w*parseFloat(m)/100:(q=parseFloat(m),q!=m&&(q=0),a.Ox=q));a.OyExpr&&(f=a.OyExpr,f.endsWith("%")?a.Oy=a.h*parseFloat(f)/100:(q=parseFloat(f),q!=f&&(q=0),a.Oy=q));""!==a.id&&2!==c.version?(h.setVariable(d+"_w",a.w),h.setVariable(d+"_h",a.h),h.setVariable(d+"escala",h.getVariable(d+"escala")||a.scale),h.setVariable(d+"Ox",
h.getVariable(d+"Ox")||a.Ox),h.setVariable(d+"Oy",h.getVariable(d+"Oy")||a.Oy),h.setVariable(d+"mouse_x",0),h.setVariable(d+"mouse_y",0),h.setVariable(d+"mouse_pressed",0),h.setVariable(d+"mouse_clicked",0),h.setVariable(d+"clic_izquierdo",0)):(q=h.getVariable("_w"),h.setVariable("_w",void 0===q?a.w:q),q=h.getVariable("_h"),void 0===q&&(q=a.h),h.setVariable("_h",q),q=h.getVariable("escala"),void 0===q&&(q=a.scale),h.setVariable("escala",q),q=h.getVariable("Ox"),void 0===q&&(q=a.Ox),h.setVariable("Ox",
q),q=h.getVariable("Oy"),void 0===q&&(q=a.Oy),h.setVariable("Oy",q),h.setVariable("mouse_x",0),h.setVariable("mouse_y",0),h.setVariable("mouse_pressed",0),h.setVariable("mouse_clicked",0),h.setVariable("clic_izquierdo",0),2==c.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;h.setFunction(d+"download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};w.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):
this.ctrs.push(a)};w.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))};w.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};w.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};w.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};w.prototype.getAbsoluteX=
function(a){return a*this.scale+this.w_2+this.Ox};w.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};b.Space=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(c){a=this;a.parent=c;a.width=228;a.vSpace=25;a.container=b.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:"+(a.width+27)+"px;height:460px;"});a.movable=b.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(a.width+27)+"px;height:"+a.vSpace+
"px;line-height:"+a.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+b.sansserif_font+";font-size:18px;"});a.movable.innerHTML="Descartes";a.container.appendChild(a.movable);a.ctrs=[]};c.prototype.init=function(){function c(c){a.newPos=b.getCursorPosition(c,document.body);a.container.style.left=a.initialPosition.x+(a.newPos.x-a.oldPos.x)*b.cssScale+"px";a.container.style.top=a.initialPosition.y+(a.newPos.y-a.oldPos.y)*b.cssScale+"px"}function p(a){a.preventDefault();document.body.removeEventListener("mousemove",
c);document.body.removeEventListener("mouseup",p)}a=this;document.body.appendChild(a.container);var d=a.parent.evaluator.parser;a.numCtr=a.ctrs.length;a.ctrs.forEach(function(b,c){b.expresion=d.parse("(0,"+(a.vSpace+23+35*c)+","+a.width+",35)");b.update()});var l=new b.Button(a.parent,{region:"external",name:"english"==a.language?"about":"cr\u00e9ditos",font_size:d.parse("15"),expresion:d.parse("(0,"+a.vSpace+","+a.width/2+",25)")});l.actionExec={execute:b.showAbout};l.update();(new b.Button(a.parent,
{region:"external",name:"config",font_size:d.parse("15"),action:"config",expresion:d.parse("("+a.width/2+","+a.vSpace+","+a.width/2+",25)")})).update();(new b.Button(a.parent,{region:"external",name:"english"==a.language?"init":"inicio",font_size:d.parse("15"),action:"init",expresion:d.parse("(0,"+(a.vSpace+23+35*a.numCtr)+","+a.width/2+",25)")})).update();(new b.Button(a.parent,{region:"external",name:"english"==a.language?"clear":"limpiar",font_size:d.parse("15"),action:"clear",expresion:d.parse("("+
a.width/2+","+(a.vSpace+23+35*a.numCtr)+","+a.width/2+",25)")})).update();l=new b.Button(a.parent,{region:"external",name:"english"==a.language?"close":"cerrar",font_size:d.parse("15"),expresion:d.parse("("+a.width/4+","+(a.vSpace+46+35*a.numCtr)+","+a.width/2+",25)")});l.update();l.btn.addEventListener("click",function(b){a.hide()});a.setPositionAndSize();a.movable.addEventListener("mousedown",function(d){d.preventDefault();a.oldPos=b.getCursorPosition(d,document.body);a.initialPosition={x:a.container.offsetLeft,
y:a.container.offsetTop};document.body.addEventListener("mousemove",c);document.body.addEventListener("mouseup",p)});a.hide()};c.prototype.addCtr=function(a){this.ctrs.push(a)};c.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};c.prototype.hide=function(){this.container.style.display="none"};c.prototype.setPositionAndSize=function(){a=this;var b=a.vSpace+46+35*a.numCtr+25+10;a.container.style.left=Math.max(parseInt(window.innerWidth-a.width)/2,0)+"px";a.container.style.top=
"5px";a.container.style.height=window.innerHeight<a.vSpace+75?a.vSpace+75+"px":b>window.innerHeight-10?window.innerHeight-10+"px":b+"px"};b.SpaceExternal=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=2*Math.PI,h=b.convertFont("Serif,BOLD+ITALIC,16"),p=b.convertFont("Monospaced,PLAIN,12"),d=Math.floor,l=Math.round,e,n,g,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O,F,M,K,N=function(c,d){a=d=b.Space.call(this,c,d)||this;a.ratio=c.ratio;a.canvas=b.newHTML("canvas",{id:a.id+"_canvas",class:"DescartesSpace2DCanvas",width:a.w*a.ratio+"px",height:a.h*a.ratio+"px"});a.backCanvas=b.newHTML("canvas",{id:a.id+"_background",width:a.w*a.ratio+"px",height:a.h*
a.ratio+"px"});a.canvas.style=a.backCanvas.style=(0<a.border_width?"border:"+a.border_width+"px solid "+a.border_color.getColor()+";":"")+(a.border_radius?"border-radius:"+a.border_radius+"px;":"");a.canvas.style.zIndex=a.zIndex;a.canvas.style.width=a.backCanvas.style.width=a.w+"px";a.canvas.style.height=a.backCanvas.style.height=a.h+"px";a.ctx=a.canvas.getContext("2d");a.backCtx=a.backCanvas.getContext("2d");a.ctx.imageSmoothingEnabled=a.backCtx.imageSmoothingEnabled=!1;a.canvas.ratio=a.ratio;a.backCanvas.ratio=
a.ratio;a.graphicControlContainer=b.newHTML("div",{id:a.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+a.zIndex+";"});a.numCtrContainer=b.newHTML("div",{id:a.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+a.zIndex+";"});a.container=b.newHTML("div",{id:a.id,class:"DescartesSpace2DContainer",style:"z-index:"+a.zIndex+";"});a.container.appendChild(a.backCanvas);a.container.appendChild(a.canvas);a.container.appendChild(a.graphicControlContainer);a.container.appendChild(a.numCtrContainer);
c.container.insertBefore(a.container,c.loader);var e=a.id+".image";a.parent.images[e]=a.canvas;a.parent.images[e].ready=1;a.parent.images[e].complete=a.parent.images[e].canvas=!0;a.evaluator.setVariable(e,e);e=a.id+".back";a.parent.images[e]=a.backCanvas;a.parent.images[e].ready=1;a.parent.images[e].complete=a.parent.images[e].canvas=!0;a.evaluator.setVariable(e,e);e=""!==a.id&&2!==c.version?a.id+".":"";a.OxStr=e+"Ox";a.OyStr=e+"Oy";a.scaleStr=e+"escala";a.wStr=e+"_w";a.hStr=e+"_h";a.mxStr=e+"mouse_x";
a.myStr=e+"mouse_y";a.mpressedStr=e+"mouse_pressed";a.mclickedStr=e+"mouse_clicked";a.mclickIzqStr=e+"clic_izquierdo";a.click=0;a.resizable&&(a.wModExpr=c.evaluator.parser.parse(a.wModExpr),a.hModExpr=c.evaluator.parser.parse(a.hModExpr));"descartesJS_stage"!==a.id&&a.addEvents();c.evaluator.setVariable(a.id+"._refresh_back_",1);return d};$jscomp.inherits(N,b.Space);N.prototype.init=function(){a=this;a.initSpace();a.canvas&&(a.old_w=a.w,a.old_h=a.h,a.canvas.width=a.backCanvas.width=a.w*a.ratio,a.canvas.height=
a.backCanvas.height=a.h*a.ratio,a.canvas.style.width=a.backCanvas.style.width=a.w+"px",a.canvas.style.height=a.backCanvas.style.height=a.h+"px")};N.prototype.update=function(b){a=this;e=a.evaluator;n=a.parent;if(a.resizable){if(O=a.evaluator.eval(a.wModExpr),F=a.evaluator.eval(a.hModExpr),a.old_w!=O||a.old_h!=F)a.w=O,a.h=F,a.w_2=a.w/2,a.h_2=a.h/2,e.setVariable(a.wStr,a.w),e.setVariable(a.hStr,a.h),a.old_w=a.w,a.old_h=a.h,a.canvas.width=a.backCanvas.width=a.w*a.ratio,a.canvas.height=a.backCanvas.height=
a.h*a.ratio,a.canvas.style.width=a.backCanvas.style.width=a.w+"px",a.canvas.style.height=a.backCanvas.style.height=a.h+"px",b=!0}else e.setVariable(a.wStr,a.w),e.setVariable(a.hStr,a.h);a.drawIfValue=0<e.eval(a.drawif);if(a.drawIfValue){q=a.x!==e.eval(a.xExpr)+a.displaceRegionWest;m=a.y!==e.eval(a.yExpr)+n.plecaHeight+a.displaceRegionNorth;a.spaceChange=b||q||m||a.drawBefore!==a.drawIfValue||a.Ox!==e.getVariable(a.OxStr)||a.Oy!==e.getVariable(a.OyStr)||a.scale!==e.getVariable(a.scaleStr)||a.backColor!==
a.background.getColor();a.x=q?e.eval(a.xExpr)+a.displaceRegionWest:a.x;a.y=m?e.eval(a.yExpr)+n.plecaHeight+a.displaceRegionNorth:a.y;a.Ox=e.getVariable(a.OxStr);a.Oy=e.getVariable(a.OyStr);a.scale=e.getVariable(a.scaleStr);a.drawBefore=a.drawIfValue;a.scale=Math.max(1E-6,Math.min(1E6,a.scale));e.setVariable(a.scaleStr,a.scale);if(q||m)a.container.style.left=a.x+"px",a.container.style.top=a.y+"px";a.container.style.display="block";a.drawTrace=!a.spaceChange&&(!a.fixed&&!a.click||a.fixed);a.spaceChange&&
(a.backCtx.setTransform(a.ratio,0,0,a.ratio,0,0),a.drawBackground());a.ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.draw()}else a.container.style.display="none"};N.prototype.drawBackground=function(){a=this;e=a.evaluator;g=a.backCtx;g.clearRect(0,0,a.backCanvas.width,a.backCanvas.height);g.fillStyle=a.backColor=a.background.getColor();g.fillRect(0,0,a.backCanvas.width,a.backCanvas.height);a.image&&""!=a.image.src&&a.image.ready&&a.image.complete&&("topleft"===a.bg_display?g.drawImage(a.image,0,0):
"stretch"===a.bg_display?g.drawImage(a.image,0,0,a.w,a.h):"patch"===a.bg_display?(g.fillStyle=g.createPattern(a.image,"repeat"),g.fillRect(0,0,a.w,a.h)):"imgcenter"===a.bg_display&&g.drawImage(a.image,(a.w-a.image.width)/2,(a.h-a.image.height)/2));f=a.scale;w=0;for(u=Math.max(0,a.w+a.h);f>u;)f/=10,w++;for(;f<u/10;)f*=10;g.lineWidth=1;""!==a.net&&(g.strokeStyle=a.net.getColor(),a.drawMarks(g,f/10,-1));if(2!==a.parent.version&&""!==a.net10||2===a.parent.version&&""!==a.net&&""!==a.net10)g.strokeStyle=
a.net10.getColor(),a.drawMarks(g,f,-1);if(""!==a.axes){var b="";"no"==a.x_axis&&(b+="x");"no"==a.y_axis&&(b+="y");g.strokeStyle=a.axes.getColor();g.beginPath();"no"==a.x_axis||""===a.x_axis&&2===a.parent.version||(g.moveTo(0,d(a.h/2+a.Oy)+.5),g.lineTo(a.w,d(a.h/2+a.Oy)+.5));"no"==a.y_axis||""===a.y_axis&&2===a.parent.version||(g.moveTo(d(a.w/2+a.Ox)+.5,0),g.lineTo(d(a.w/2+a.Ox)+.5,a.h));g.lineWidth=1.2;g.stroke();g.lineWidth=1;a.drawMarks(g,f,4,b);a.drawMarks(g,f/2,2,b);a.drawMarks(g,f/10,1,b)}if(""!==
a.x_axis||""!==a.y_axis)g.fillStyle=""!==a.axes?a.axes.getColor():"#000",g.font=h,g.textAlign="right",g.textBaseline="alphabetic","no"!=a.x_axis&&g.fillText(a.x_axis,d(a.w)-2,d(a.h/2+a.Oy)+12),"no"!=a.y_axis&&g.fillText(a.y_axis,d(a.w/2+a.Ox)-2,12);a.numbers&&""!=a.axes&&(g.fillStyle=a.axes.getColor(),g.font=h,g.textAlign="start",g.textBaseline="bottom",f>(a.w+a.h)/2?a.drawNumbers(g,f/5,f<=a.scale?w+1:w):f>(a.w+a.h)/4?a.drawNumbers(g,f/2,f<=a.scale?w+1:w):a.drawNumbers(g,f,w));b=$jscomp.makeIterator(a.backGraphics);
for(var c=b.next();!c.done;c=b.next())c.value.draw()};N.prototype.draw=function(){a=this;g=a.ctx;e.getVariable(a.id+"._refresh_back_")&&g.clearRect(0,0,a.canvas.width,a.canvas.height);for(var b=$jscomp.makeIterator(a.graphics),f=b.next();!f.done;f=b.next())f=f.value,""!==f.trace&&a.drawTrace&&f.drawTrace(),f.draw();b=$jscomp.makeIterator(a.graphicsCtr);for(f=b.next();!f.done;f=b.next())f.value.draw();""!=a.text&&a.click&&"L"===a.whichBtn&&(g.save(),g.strokeStyle=g.fillStyle=a.text.getColor(),g.lineWidth=
1,g.font=p,g.textAlign="center",g.textBaseline="alphabetic",G=1>=a.scale?a.mouse_x.toFixed(0):a.mouse_x.toFixed(parseInt(a.scale).toString().length+1),H=1>=a.scale?a.mouse_y.toFixed(0):a.mouse_y.toFixed(parseInt(a.scale).toString().length+1),C="("+G+","+H+")",J=d(g.measureText(C).width/2),P=a.getAbsoluteX(a.mouse_x),R=a.getAbsoluteY(a.mouse_y),L=d(P),Q=d(R-10),L+J>a.w?L=a.w-J:0>L-J&&(L=J),Q+1>a.h?Q=a.h:0>Q-14&&(Q=15),g.fillText(C,L,Q),g.beginPath(),g.arc(P,R,2.5,0,c),g.stroke(),g.restore())};N.prototype.drawMarks=
function(a,b,c,e){x=this.w;r=this.h;I=B=0;D=x;E=r;y=d(x/2+this.Ox);A=d(r/2+this.Oy);0<=c&&(B=y-c,D=y+c,I=A-c,E=A+c);a.beginPath();if(!e||e&&!e.match("x"))for(c=-l(y/b);(v=y+l(c*b))<x;c++)a.moveTo(v+.5,I+.5),a.lineTo(v+.5,E+.5);if(!e||e&&!e.match("y"))for(e=-l(A/b);(z=A+l(e*b))<r;e++)a.moveTo(B+.5,z+.5),a.lineTo(D+.5,z+.5);a.stroke()};N.prototype.drawNumbers=function(a,b,c){x=this.w;r=this.h;y=d(x/2+this.Ox);A=d(r/2+this.Oy);for(c=-l(y/b);(v=y+l(c*b))<x;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),
v+1,A-2);for(c=-l(A/b);(z=A+l(c*b))<r;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),y+5,z+5)};N.prototype.addEvents=function(){function a(b){window.focus();document.activeElement.blur();if(g.evaluator.variables[g.id+".DJS_NO_FIXED"]||!g.fixed||g.sensitive_to_mouse_movements)g.click=0,g.evaluator.setVariable(g.mpressedStr,0),g.evaluator.setVariable(g.mclickedStr,1),g.evaluator.setVariable(g.mclickIzqStr,1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",
a),b.stopPropagation(),b.preventDefault(),g.parent.update()}function c(a){document.activeElement.blur();window.focus();a.stopPropagation();a.preventDefault();g.click=0;g.evaluator.setVariable(g.mpressedStr,0);g.evaluator.setVariable(g.mclickedStr,1);g.evaluator.setVariable(g.mclickIzqStr,1);"R"===g.whichBtn&&(window.removeEventListener("mousemove",e),g.posZoom==g.posZoomNew&&b.showConfig&&(g.parent.externalSpace.show(),g.posZoom=!1,g.posZoomNew=!0));window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",
c);g.parent.deactivateControls();g.parent.update()}function d(a){g.posAnte=b.getCursorPosition(a,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.mxStr,g.mouse_x);g.evaluator.setVariable(g.myStr,g.mouse_y);g.evaluator.setVariable(g.mclickedStr,0);g.evaluator.setVariable(g.mclickIzqStr,0);g.parent.update()}function e(a){a.preventDefault();g.posZoomNew=b.getCursorPosition(a,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+
g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.parent.update()}function f(a){a.preventDefault();a.stopPropagation();g.fixed||(g.posNext=b.getCursorPosition(a,g.container),M=g.posAnte.x-g.posNext.x,K=g.posAnte.y-g.posNext.y,g.evaluator.setVariable(g.OxStr,g.Ox-M),g.evaluator.setVariable(g.OyStr,g.Oy-K));d(a)}var g=this;g.posZoom=g.posZoomNew=null;g.sensitive_to_mouse_movements&&g.canvas.addEventListener("touchmove",d);g.canvas.addEventListener("touchstart",function(b){window.focus();document.activeElement.blur();
if(g.evaluator.variables[g.id+".DJS_NO_FIXED"]||!g.fixed||g.sensitive_to_mouse_movements)g.parent.clearClick(),g.click=1,g.evaluator.setVariable(g.mpressedStr,1),g.evaluator.setVariable(g.mclickedStr,0),g.evaluator.setVariable(g.mclickIzqStr,0),g.parent.deactivateControls(),d(b),window.addEventListener("touchmove",f),window.addEventListener("touchend",a),b.stopPropagation(),b.preventDefault()});g.sensitive_to_mouse_movements&&g.canvas.addEventListener("mousemove",d);g.canvas.addEventListener("mousedown",
function(a){window.focus();document.activeElement.blur();a.stopPropagation();a.preventDefault();g.parent.clearClick();g.click=1;g.parent.deactivateControls();g.whichBtn=b.whichBtn(a);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posZoom=b.getCursorPosition(a,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,window.addEventListener("mousemove",e))):"L"===g.whichBtn&&(g.evaluator.setVariable(g.mpressedStr,1),g.evaluator.setVariable(g.mclickedStr,0),g.evaluator.setVariable(g.mclickIzqStr,
0),d(a),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){g.click=0;g.evaluator.setVariable(g.mpressedStr,0);g.evaluator.setVariable(g.mclickedStr,1);g.evaluator.setVariable(g.mclickIzqStr,1);window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",c)})};b.Space2D=N;return b}(descartesJS||{});
descartesJS=function(b){var a,c,h;function p(a,c){O=b.subtract3D(a,b.scalarProd3D(c,b.dotProduct3D(a,c)));F=b.add3D(a,b.scalarProd3D(O,-2));M=b.norm3D(F);return 0!==M?b.scalarProd3D(F,1/M):b.scalarProd3D(a,-1)}function d(a,b){return b.depth-a.depth}if(b.loadLib)return b;var l=Math.floor,e=Math.max,n=Math.cos,g=Math.sin,q,m,f,w,u,x,r,v,z,y,A,B,D,I,E,G,H=[],C,J,P,R,L,Q,O,F,M,K,N,V=function(a,c){f=c=b.Space.call(this,a,c)||this;f.ratio=a.ratio;f.backCanvas=b.newHTML("canvas",{id:f.id+"_background",width:f.w*
f.ratio+"px",height:f.h*f.ratio+"px"});f.canvas=b.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 d=f.id+".image";f.parent.images[d]=
f.canvas;f.parent.images[d].ready=1;f.parent.images[d].complete=!0;f.parent.images[d].canvas=!0;f.evaluator.setVariable(d,d);f.graphicControlContainer=b.newHTML("div",{id:f.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+f.zIndex+";"});f.numCtrContainer=b.newHTML("div",{id:f.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+f.zIndex+";"});f.container=b.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);a.container.insertBefore(f.container,a.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}];d=0;for(var e=f.lights.length;d<e;d++)f.lights[d]=b.normalize3D(f.lights[d]);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.mxStr=f.id+".mouse_x";f.myStr=f.id+".mouse_y";f.mpressedStr=f.id+".mouse_pressed";f.mclickedStr=f.id+".mouse_clicked";f.mclickIzqStr=f.id+".clic_izquierdo";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);N=new b.Primitive3D({V:[new b.Vec4D],type:"vertex"},f);f.evaluator.setFunction(f.id+"._X3D2D_",function(a,b,c){N.V[0].x=a;N.V[0].y=b;N.V[0].z=c;N.computeDepth(f);return N.projV[0].x});f.evaluator.setFunction(f.id+
"._Y3D2D_",function(a,b,c){N.V[0].x=a;N.V[0].y=b;N.V[0].z=c;N.computeDepth(f);return N.projV[0].y});f.resizable&&(f.wModExpr=a.evaluator.parser.parse(f.wModExpr),f.hModExpr=a.evaluator.parser.parse(f.hModExpr));f.addEvents();return c};$jscomp.inherits(V,b.Space);V.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)};V.prototype.update=function(a){f=this;q=f.evaluator;m=f.parent;q.setVariable(f.wStr,f.w);q.setVariable(f.hStr,f.h);f.drawIfValue=0<q.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,q.setVariable(f.wStr,f.w),q.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));x=f.x!==q.eval(f.xExpr)+f.displaceRegionWest;r=f.y!==q.eval(f.yExpr)+m.plecaHeight+f.displaceRegionNorth;f.spaceChange=a||x||r||f.drawBefore!==f.drawIfValue||f.Ox!==q.getVariable(f.OxStr)||f.Oy!==q.getVariable(f.OyStr)||f.Ojo.x!==q.getVariable(f.ojoXStr)||f.Ojo.y!==q.getVariable(f.ojoYStr)||f.Ojo.z!==q.getVariable(f.ojoZStr)||f.scale!==q.getVariable(f.scaleStr);f.x=x?q.eval(f.xExpr)+f.displaceRegionWest:
f.x;f.y=r?q.eval(f.yExpr)+m.plecaHeight+f.displaceRegionNorth:f.y;f.Ojo.x=q.getVariable(f.ojoXStr);f.Ojo.y=q.getVariable(f.ojoYStr);f.Ojo.z=q.getVariable(f.ojoZStr);f.Ox=q.getVariable(f.OxStr);f.Oy=q.getVariable(f.OyStr);f.scale=q.getVariable(f.scaleStr);f.drawBefore=f.drawIfValue;if(a||void 0==f.observer){a=0;for(var b=f.parent.controls.length;a<b;a++)f.parent.controls[a].id===f.obsStr&&(K=!0);f.observer=K?q.getVariable(f.obsStr)||2.5*f.w_plus_h:2.5*f.w_plus_h;f.observer=e(f.observer,.25*f.w_plus_h);
q.setVariable(f.obsStr,f.observer)}1E-6>f.scale?(f.scale=1E-6,q.setVariable(f.scaleStr,1E-6)):1E6<f.scale&&(f.scale=1E6,q.setVariable(f.scaleStr,1E6));if(x||r)f.container.style.left=f.x+"px",f.container.style.top=f.y+"px";f.container.style.display="block";f.dim=q.getVariable(f.userIDimStr);f.userIntensity=q.getVariable(f.userIIStr);f.light3={x:parseInt(q.getVariable(f.userIxStr)),y:parseInt(q.getVariable(f.userIyStr)),z:parseInt(q.getVariable(f.userIzStr))};f.updateCamera();f.ctx.setTransform(f.ratio,
0,0,f.ratio,0,0);f.draw()}else f.container.style.display="none"};V.prototype.updateCamera=function(){this.eye=b.scalarProd3D(this.Ojo,1/this.scale)};V.prototype.rotateVertex=function(d){y=b.degToRad(f.evaluator.getVariable(f.rotZStr));A=n(y);B=g(y);a=d.x*A-d.y*B;c=d.x*B+d.y*A;h=d.z;y=b.degToRad(f.evaluator.getVariable(f.rotYStr));A=n(y);B=g(y);return{x:h*B+a*A,y:c,z:h*A-a*B}};V.prototype.project=function(a){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}};V.prototype.computeColor=function(a,c,d){"object"!=typeof a&&(a.match("rgba")?a=b.RGBAToHexColor(a):a.match("#")&&(a=new b.Color(a.substring(1))));R=b.subtract3D(this.eye,c.avg);L=b.norm3D(R);Q=b.scalarProd3D(R,1/L);this.lights[3]=b.subtract3D(this.light3,c.avg);G=b.norm3D(this.lights[3]);for(var e=0,g=this.intensity.length-1;e<g;e++)H[e]=this.intensity[e]*this.dim;H[3]=this.userIntensity*this.userIntensity/G||0;C=d?this.dim/2:this.dim/4;J=0;P=0>c.direction?c.normal:b.scalarProd3D(c.normal,
-1);c=0;for(e=this.lights.length;c<e;c++)d?(J=Math.max(0,b.dotProduct3D(p(this.lights[c],P),Q)),J*=J*J):J=Math.max(0,b.dotProduct3D(this.lights[c],P)),C+=H[c]*J;C=Math.min(C,1);D=l(a.r*C);I=l(a.g*C);E=l(a.b*C);return"rgba("+D+","+I+","+E+","+a.a+")"};V.prototype.draw=function(){f=this;f.ctx.clearRect(0,0,f.canvas.width,f.canvas.height);f.ctx.fillStyle=f.background.getColor();f.ctx.fillRect(0,0,f.canvas.width,f.canvas.height);f.image&&""!=f.image.src&&f.image.ready&&f.image.complete&&("topleft"===
f.bg_display?f.ctx.drawImage(f.image,0,0):"stretch"===f.bg_display?f.ctx.drawImage(f.image,0,0,f.w,f.h):"patch"===f.bg_display?(f.ctx.fillStyle=ctx.createPattern(f.image,"repeat"),f.ctx.fillRect(0,0,f.canvas.width,f.canvas.height)):"center"===f.bg_display&&f.ctx.drawImage(f.image,(f.w-f.image.width)/2,(f.h-f.image.height)/2));if(!f.click){for(var a=$jscomp.makeIterator(f.graphics),b=a.next();!b.done;b=a.next())b.value.update();f.primitives=[];if(f.split)for(a=0,b=f.graphics.length;a<b;a++){w=f.graphics[a];
for(var c=a+1;c<b;c++)u=f.graphics[c],w.splitFace(u),u.splitFace(w);f.primitives=f.primitives.concat(w.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){w=this.graphics[a];if(w.split)for(c=a+1;c<b;c++)u=this.graphics[c],u.split&&w.splitFace(u);this.primitives=this.primitives.concat(w.primitives||[])}}b=$jscomp.makeIterator(this.primitives);for(a=b.next();!a.done;a=b.next())a.value.computeDepth(this);this.primitives=this.primitives.sort(d);if("painter"===this.render)this.drawPainter(this.primitives);
else for(b=$jscomp.makeIterator(this.primitives),a=b.next();!a.done;a=b.next())a.value.draw(this.ctx,this);a=$jscomp.makeIterator(this.graphicsCtr);for(b=a.next();!b.done;b=a.next())b.value.draw()};V.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);var d=[];c=[];for(var e=0,g=a.length,f=.001,h,l;;){h=g;for(var m=0;m<b;m++)if(!a[m].drawn){l=!0;for(var p=0;p<b;p++)if(p!=m&&!a[p].drawn&&a[m].inFrontOf(d,a[p],f)){l=!1;break}l&&(g--,c[e++]=a[m],a[m].drawn=
!0)}if(0==g)break;else if(g==h){if(f*=10,.1<f){for(d=0;d<b;d++)a[d].drawn||(c[e++]=a[d],a[d].drawn=!0);break}}else f=.001}for(a=0;a<b;a++)c[a].draw(this.ctx,this)};V.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}};V.prototype.addEvents=function(){function a(b){window.focus();document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);window.removeEventListener("touchmove",g,!1);
window.removeEventListener("touchend",a,!1);b.preventDefault();f.parent.update()}function c(a){document.body.focus();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);a.preventDefault();"R"===f.whichBtn&&(window.removeEventListener("mousemove",e,!1),f.posZoom==f.posZoomNew&&b.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",g,!1);window.removeEventListener("mouseup",c,!1);f.parent.update()}function d(a){f.posAnte=b.getCursorPosition(a,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.parent.update()}function e(a){a.preventDefault();f.posZoomNew=b.getCursorPosition(a,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=b.getCursorPosition(a,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function g(a){if(!f.fixed&&
f.click){v=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;z=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(v!==f.disp.x||z!==f.disp.y)f.alpha=b.degToRad(f.evaluator.getVariable(f.rotZStr)),f.beta=b.degToRad(-f.evaluator.getVariable(f.rotYStr)),f.alpha=b.radToDeg(f.alpha)-v,f.beta=b.radToDeg(f.beta)-z,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=v,f.disp.y=z,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);
d(a);a.preventDefault()}}var f=this;f.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();f.click=1;f.evaluator.setVariable(f.mpressedStr,1);f.parent.deactivateControls();f.posAnte=b.getCursorPosition(c,f.container);f.oldMouse.x=f.getRelativeX(f.posAnte.x);f.oldMouse.y=f.getRelativeY(f.posAnte.y);d(c);window.addEventListener("touchmove",g);window.addEventListener("touchend",a);c.preventDefault()});f.canvas.addEventListener("mousedown",function(a){document.body.focus();
f.click=1;f.parent.deactivateControls();f.whichBtn=b.whichBtn(a);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posObserver=b.getCursorPosition(a,f.container).x,f.posObserverNew=f.posObserver,f.posZoom=b.getCursorPosition(a,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,f.tempObserver=f.observer,window.addEventListener("mousemove",e))):"L"==f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.posAnte=b.getCursorPosition(a,f.container),f.oldMouse.x=f.getRelativeX(f.posAnte.x),
f.oldMouse.y=f.getRelativeY(f.posAnte.y),d(a),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c));a.preventDefault()});f.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};b.Space3D=V;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,p,d,l,e,n;b.SpaceHTMLIFrame=function(a,d){var e=b.Space.call(this,a,d)||this;c=e.parent.evaluator;void 0!=e._w_&&(a=c.parser.parse(e._w_),e._w_="number"!=a.type?a:void 0);void 0!=e._h_&&(a=c.parser.parse(e._h_),e._h_="number"!=a.type?a:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";/^\[.*\]$/.test(e.file)?e.file=c.parser.parse(e.file.slice(1,-1)):/^'.*'$/.test(e.file)?e.file=c.parser.parse(e.file):
e.file=c.parser.parse("'"+e.file+"'");e.oldFile=c.eval(e.file);e.MyIFrame=b.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",class:"DescartesSpaceIframe"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=b.newHTML("div",{id:e.id,class:"DescartesSpaceIframeContainer",style:"width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+";"+(b.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")});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(a){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(a){if(a){if(b.cacheFiles[a])var d=b.cacheFiles[a];else d=(d=document.getElementById(a))&&"descartes/embed"===d.type?d.textContent:b.openFile(a),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",b.cacheFiles[a]=d;c.contentWindow.postMessage({type:"change_config",filename:a,content:d},"*")}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.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(b.SpaceHTMLIFrame,b.Space);
b.SpaceHTMLIFrame.prototype.init=function(){this.initSpace()};b.SpaceHTMLIFrame.prototype.update=function(b){a=this;h=a.container;c=a.evaluator;a.drawIfValue=0<c.eval(a.drawif);a.ImReady?h.style.display=a.drawIfValue?"block":"none":(h.style.visibility=a.drawIfValue?"visible":"hidden",h.style.opacity=a.drawIfValue?"1":"0",h.style.zIndex=a.drawIfValue?a.zIndex:-1E3);if(a.drawIfValue){b&&(a.x=a.y=Infinity);l=c.eval(a.xExpr)+a.displaceRegionWest;if(p=a.x!==l)a.x=l;l=c.eval(a.yExpr)+a.parent.plecaHeight+
a.displaceRegionNorth;if(d=a.y!==l)a.y=l;void 0!=a._w_&&(l=c.eval(a._w_),a.w!==l&&(a.container.style.width=l+"px",a.w=l));void 0!=a._h_&&(l=c.eval(a._h_),a.h!==l&&(h.style.height=l+"px",a.h=l));if(p||d)a.container.style.left=a.x+"px",a.container.style.top=a.y+"px";e=c.eval(a.file);e!==a.oldFile&&(a.ImReady=!1,a.isFirefox||(h.style.display="block",h.style.visibility=a.drawIfValue?"visible":"hidden",h.style.opacity=a.drawIfValue?"1":"0",h.style.zIndex=a.drawIfValue?a.zIndex:-1E3),a.imageSrc&&(h.style.backgroundImage=
"url("+a.imageSrc+")"),a.MyIFrame.style.visibility="hidden",a.oldFile=e,a.MyIFrame.contentWindow.location.replace(e));n=c.getVariable(a.id+"._scroll");1==n?(a.MyIFrame.setAttribute("scrolling","yes"),a.MyIFrame.style.overflow=""):-1==n?(a.MyIFrame.setAttribute("scrolling","no"),a.MyIFrame.style.overflow="hidden"):(a.MyIFrame.setAttribute("scrolling","auto"),a.MyIFrame.style.overflow="")}else a.MyIFrame.contentWindow.blur()};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=1,c=function(c){this.children=c.children;this.lessonParser=c.lessonParser;this.images=c.images;this.audios=c.audios;this.im_l=this.au_l=0;this.descartesApp=c;var h=document.querySelectorAll('script[type="descartes/imagen"]');h=$jscomp.makeIterator(h);for(var d=h.next();!d.done;d=h.next())d=d.value,this.images[d.id]=new Image,this.images[d.id].onload=function(){this.ready=1},this.images[d.id].src=d.innerText.trim();this.imgLoader=b.newHTML("div",
{class:"DescartesLoaderImage"});this.progress=b.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;")):(a=c.width<c.height?c.width/1144:c.height/1092,a=Math.min(2.5,a),this.imgLoader.setAttribute("style","background-image:url("+b.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*a+"px;"),this.progress.setAttribute("style","visibility:visible;left:"+
(c.width-726*a)/2+"px;top:"+(33.5*c.height/100+940*a/2)+"px;width:"+726*a+"px;height:"+14*a+"px;"));c.loader.appendChild(this.imgLoader);c.loader.appendChild(this.progress);c.firstRun=!1;this.initPreloader()};c.prototype.initPreloader=function(){var a=this,c=a.children,d=a.images,l=a.audios,e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,n=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,g=/'macro'|'makro'/g,q;var m=0;for(q=c.length;m<q;m++){if(c[m].value.match(g)){var f="";var w=void 0;var u=a.lessonParser.split(c[m].value);
var x=0;for(var r=u.length;x<r;x++)"expresion"===babel[u[x][0]]&&(f=u[x][1]);f&&(w=(w=document.getElementById(f))&&"descartes/macro"==w.type?w.text:b.openFile(f));if(w&&(w=w.match(e)))for(f=0,x=w.length;f<x;f++)u=w[f],u.toLowerCase().endsWith("vacio.gif")||""==u.substring(0,u.length-4)||d[u]||(d[u]=this.descartesApp.getImageAux(u))}if(w=c[m].value.match(e))for(f=0,x=w.length;f<x;f++)u=w[f],u.toLowerCase().endsWith("vacio.gif")||""==u.substring(0,u.length-4)||d[u]||(d[u]=this.descartesApp.getImageAux(u));
if(w=c[m].value.match(n))for(f=0,u=w.length;f<u;f++)l[w[f]]||(l[w[f]]=this.descartesApp.getAudioAux(w[f]))}for(var v in d)d.hasOwnProperty(v)&&a.im_l++;for(var z in l)l.hasOwnProperty(z)&&a.au_l++;var y=a.im_l+a.au_l;0<y&&a.progress.setAttribute("max",y);var A,B=function(){A=0;for(var c in d)d.hasOwnProperty(c)&&(d[c].ready||d[c].errorload)&&A++;for(var e in l)l.hasOwnProperty(e)&&(l[e].ready||l[e].errorload)&&A++;a.progress.setAttribute("value",A);A!=y?a.timer=b.setTimeout(B,1):a.descartesApp.initBuildApp()};
B()};b.DescartesLoader=c;return b}(descartesJS||{});
descartesJS=function(b){function a(){b.cssScale=Math.min(window.innerWidth/this.width,window.innerHeight/this.height);this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";this.container.style.transform="translate(-50%, -50%) scale("+b.cssScale+")"}if(b.loadLib)return b;var c=/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/,h=function(a){this.animation=
{playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=b._ratio;this.URL=window.location.href;this.applet=a;this.parentC=a.parentNode;this.width=parseFloat(a.getAttribute("width"));this.height=parseFloat(a.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=a.getElementsByTagName("param");this.code=a.getAttribute("code");this.images={};this.audios={};this.firstRun=!0;this.keyboard=new b.Keyboard(this);
this.scaleToFit=function(){};this.init()};h.prototype.init=function(){this.stop();this.evaluator=new b.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 b.LessonParser(this);var c,d=$jscomp.makeIterator(this.children);for(c=d.next();!c.done;c=d.next())if(c=c.value,"Buttons"==babel[c.name])this.buttonsConfig=
this.lessonParser.parseButtonsConfig(c.value);else if("image_loader"==c.name)this.imgLoader=c.value;else if("expand"==c.name)this.expand=c.value;else if("docBase"==c.name)document.head.appendChild(b.newHTML("base",{id:"descartesJS_base",href:c.value}));else if(c.name.startsWith("E_"))break;this.externalSpace&&this.externalSpace.container.parentNode&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new b.SpaceExternal(this);this.northSpace={container:b.newHTML("div"),controls:[]};
this.southSpace={container:b.newHTML("div"),controls:[]};this.eastSpace={container:b.newHTML("div"),controls:[]};this.westSpace={container:b.newHTML("div"),controls:[]};this.editableRegion={container:b.newHTML("div"),textFields:[]};this.spaces=[];this.controls=[];this.auxiliaries=[];this.events=[];this.zIndex=this.tabindex=this.plecaHeight=this.nIframes=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=
b.newHTML("div");this.loader=b.newHTML("div",{class:"DescartesLoader"});this.container.addEventListener("contextmenu",b.preventDefault);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&&
(d=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesAppsPrint"}),document.head.insertBefore(d,document.head.firstChild),d.innerHTML="@page{margin:0cm;size:"+this.width+"px "+this.height+"px;}",document.body.style.margin=document.body.style.padding=0,document.body.style.overflow="hidden",this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.style.left=this.container.style.top="50%",this.container.style.transformOrigin=
"50% 50%",this.scaleToFit=a,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.firstRun?(this.loader.style.display="block",new b.DescartesLoader(this)):this.initBuildApp()};h.prototype.initBuildApp=function(){b.showConfig=!0;var a=this,d,l=a.lessonParser,e=[],h=[],g=[],q=[],m=[],f=[],w=$jscomp.makeIterator(a.children);for(d=w.next();!d.done;d=w.next())d=d.value,"editable"==babel[d.name]?b.showConfig="false"!=babel[d.value]:"language"==babel[d.name]?a.language=d.value:"Buttons"==
babel[d.name]?a.buttonsConfig=l.parseButtonsConfig(d.value):"decimal_symbol"==babel[d.name]?(a.decimal_symbol=d.value,a.decimal_symbol_regexp=new RegExp("\\"+a.decimal_symbol,"g")):"version"==babel[d.name]?a.version=parseInt(d.value):d.name.startsWith("E_")?(/='HTMLIFrame'/.test(d.value)&&a.nIframes++,e.push(d.value)):d.name.startsWith("C_")?h.push(d.value):d.name.startsWith("A_")?g.push(d.value):d.name.startsWith("G_")?(c.test(d.value)&&(a.ratio=1),q.push(d.value)):d.name.startsWith("S_")?m.push(d.value):
"Animation"==babel[d.name]&&f.push(d.value);e=$jscomp.makeIterator(e);for(w=e.next();!w.done;w=e.next())a.spaces.push(l.parseSpace(w.value)),a.zIndex++;q.forEach(function(c,d){b.DEBUG.elemIndex=d;if(c=l.parseGraphic(c))a.editableRegionVisible=a.editableRegionVisible||c.visible,c.space.addGraph(c)});m.forEach(function(a,c){b.DEBUG.elemIndex=c;(a=l.parse3DGraphic(a))&&a.space.addGraph(a,!0)});h=$jscomp.makeIterator(h);for(q=h.next();!q.done;q=h.next())a.controls.push(l.parseControl(q.value));g=$jscomp.makeIterator(g);
for(h=g.next();!h.done;h=g.next())l.parseAuxiliar(h.value);f=$jscomp.makeIterator(f);for(g=f.next();!g.done;g=f.next())a.animation=l.parseAnimation(g.value);a.configRegions();a.updateAuxiliaries();a.updateAuxiliaries();f=$jscomp.makeIterator(a.controls);for(g=f.next();!g.done;g=f.next())g.value.init();a.updateControls();a.updateSpaces(!0);b.setTimeout(function(){a.finishInit()},10*a.nIframes);document.addEventListener("keydown",function(c){if(c.ctrlKey&&c.shiftKey&&"C"===c.key||c.commandKey&&c.shiftKey&&
"C"===c.key)navigator.clipboard.writeText(a.applet.innerHTML),b.preventDefault(c)})};h.prototype.finishInit=function(){var a=this;a.evaluator.setVariable("decimalSymbol",a.decimal_symbol);a.update();a.loader.parentNode.removeChild(a.loader);window.parent!==window&&(a.parentC.style.margin=a.parentC.style.padding="0px","fit"==a.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:a.URL,width:a.width,height:a.height},
"*"),window.parent.postMessage({type:"ready",value:a.URL},"*"),b.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:a.URL},"*");b.showConfig&&a.externalSpace.init();try{window.dispatchEvent(new CustomEvent("descartesReady",{detail:a}))}catch(d){console.warn("CustomEvents not supported in this browser")}a.evaluator.setFunction("openKB",function(b,c,e,h,g,p,m,f,w,u,x){a.keyboard.show(null,b,c,e,h,{x:g,y:p,w:m,h:f,fs:w+"px",value:u+"",type:"custom",tagName:"textfield"},
x)});a.readyApp=!0};h.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var a=parseInt(this.width+30),c=parseInt(this.height+90);window.moveTo(parseInt(screen.width-a)/2,parseInt(screen.height-c)/2);window.resizeTo(a,c);b.onResize()};h.prototype.configRegions=function(){var a=this.evaluator.parser,c=this.buttonsConfig||{},h=this.container,e=100,n=100,g=0,q=0,m=0,f=0,w=0,u=this.northSpace.controls,x=this.southSpace.controls;
var r=this.eastSpace.controls;var v=this.westSpace.controls;if(0<c.rowsNorth||0<u.length||c.about||c.config){0>=c.rowsNorth?(g=c.height,c.rowsNorth=1):g=c.height*c.rowsNorth;var z=this.northSpace.container;z.id="descartesJS_north";z.setAttribute("style","width:"+h.width+"px;height:"+g+"px;left:0;top:"+this.plecaHeight+"px;");h.insertBefore(z,this.loader);z=h.width;var y=0;c.about?(y=e,z-=y):e=0;c.config&&(z-=100);for(var A=Math.ceil(u.length/c.rowsNorth),B=z/A,D=0,I=u.length;D<I;D++)u[D].expresion=
a.parse("("+(y+D%A*B)+","+c.height*Math.floor(D/A)+","+B+","+c.height+")"),u[D].init();c.about&&(u=new b.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:a.parse("15"),expresion:a.parse("(0,0,"+e+","+g+")")}),u.actionExec={execute:b.showAbout},u.update());c.config&&(new b.Button(this,{region:"north",name:"config",font_size:a.parse("15"),action:"config",expresion:a.parse("("+(z+e)+",0,100,"+g+")")})).update()}if(0<c.rowsSouth||0<x.length||c.init||c.clear){0>=
c.rowsSouth?(q=c.height,c.rowsSouth=1):q=c.height*c.rowsSouth;e=h.width;z=0;c.init?(z=n,e-=z):n=0;c.clear&&(e-=100);u=this.southSpace.container;u.id="descartesJS_south";u.setAttribute("style","width:"+h.width+"px;height:"+q+"px;left:0;bottom:0;");h.insertBefore(u,this.loader);u=Math.ceil(x.length/c.rowsSouth);y=e/u;A=0;for(B=x.length;A<B;A++)x[A].expresion=a.parse("("+(z+A%u*y)+","+c.height*Math.floor(A/u)+","+y+","+c.height+")"),x[A].init();c.init&&(new b.Button(this,{region:"south",name:"english"==
this.language?"init":"inicio",font_size:a.parse("15"),action:"init",expresion:a.parse("(0,0,"+n+","+q+")")})).update();c.clear&&(new b.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:a.parse("15"),action:"clear",expresion:a.parse("("+(e+n)+",0,100,"+q+")")})).update()}if(0<r.length)for(n=h.height-g-q,f=c.widthEast,x=this.eastSpace.container,x.id="descartesJS_east",x.setAttribute("style","width:"+f+"px;height:"+n+"px;right:0;top:"+g+"px;"),h.insertBefore(x,this.loader),
n=0,x=r.length;n<x;n++)r[n].expresion=a.parse("(0,"+c.height*n+","+f+","+c.height+")"),r[n].init();if(0<v.length)for(r=h.height-g-q,w=c.widthWest,n=this.westSpace.container,n.id="descartesJS_west",n.setAttribute("style","width:"+w+"px;height:"+r+"px;left:0;top:"+g+"px;"),h.insertBefore(n,this.loader),r=0,n=v.length;r<n;r++)v[r].expresion=a.parse("(0,"+c.height*r+","+w+","+c.height),v[r].init();if(this.editableRegionVisible)for(m=c.height,a=this.editableRegion.container,a.id="descartesJS_editableRegion",
a.setAttribute("style","position:absolute;width:"+h.width+"px;height:"+m+"px;left:0;top:"+(h.height-q-c.height)+"px;"),h.insertBefore(a,this.loader),c=this.editableRegion.textFields,h=h.width/c.length,v=b.getFieldFontSize(m),r=0,n=c.length;r<n;r++)"div"==c[r].type?(a.appendChild(c[r].container),c[r].container.setAttribute("style","font-family:"+b.sansserif_font+";width:"+(h-4)+"px;height:"+m+"px;position:absolute;left:"+r*h+"px;top:0;"),x=c[r].container.firstChild,x.setAttribute("style","font-family:"+
b.sansserif_font+";font-size:"+v+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+m+"px;text-align:center;line-height:"+m+"px;"),e=x.offsetWidth,x.style.width=e+"px",x.firstChild.textContent=x.firstChild.textContent.substring(3,x.firstChild.textContent.length-3),c[r].container.lastChild.setAttribute("style","font-family:"+b.monospace_font+";font-size:"+v+"px;width:"+(h-e)+"px;height:"+m+"px;position:absolute;left:"+e+"px;top:0;border:2px groove white;")):(a.appendChild(c[r]),
c[r].setAttribute("style","font-family:"+b.monospace_font+";font-size:"+v+"px;width:"+h+"px;height:"+m+"px;position:absolute;left:"+r*h+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=g;this.displaceRegionSouth=q+(m||0);this.displaceRegionEast=f;this.displaceRegionWest=w;g=$jscomp.makeIterator(this.spaces);for(q=g.next();!q.done;q=g.next())q.value.init()};h.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};
h.prototype.clearClick=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b.value.clearClick()};h.prototype.removeButtonClick=function(){b.newBlobContent=null;for(var a=$jscomp.makeIterator(this.controls),c=a.next();!c.done;c=a.next())c.value.buttonClick=!1};h.prototype.deactivateControls=function(){if(this.controls)for(var a=$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b=b.value,b.deactivate&&b.deactivate()};h.prototype.updateAuxiliaries=function(){for(var a=
$jscomp.makeIterator(this.auxiliaries),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateEvents=function(){for(var a=$jscomp.makeIterator(this.events),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateControls=function(){for(var a=$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateSpaces=function(a){for(var b=$jscomp.makeIterator(this.spaces),c=b.next();!c.done;c=b.next())c.value.update(a)};h.prototype.clear=function(){for(var a=
$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,b.spaceChange=!0,b.drawBackground&&b.drawBackground()};h.prototype.play=function(){this.animation.play()};h.prototype.stop=function(){this.animation.stop()};h.prototype.reinitAnimation=function(){this.animation.reinit()};h.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)};h.prototype.getImage=function(a){return a?
(this.images[a]||(this.images[a]=this.getImageAux(a)),this.images[a]):new Image};h.prototype.getImageAux=function(a){var b=new Image;a.startsWith("http")&&(b.crossOrigin="Anonymous");b.onload=function(){this.ready=1};b.onerror=function(){this.errorload=1};b.src=a;return b};h.prototype.getAudio=function(a){return a?(this.audios[a]||(this.audios[a]=this.getAudioAux(a)),this.audios[a]):new Audio};h.prototype.getAudioAux=function(a){var c=new Audio(a);c.filename=a;var h=function(){this.ready=1},e=function(){this.canPlayType("audio/"+
this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo "+a+" no puede ser reproducido"),this.errorload=1):(c=new Audio(this.filename.replace("mp3","ogg")),c.filename=this.filename.replace("mp3","ogg"),c.addEventListener("canplaythrough",h),c.addEventListener("load",h),c.addEventListener("error",e),c.load())};c.addEventListener("canplaythrough",h);c.addEventListener("load",h);c.addEventListener("error",e);b.hasTouchSupport?
(c.load(),c.play(),b.setTimeout(function(){c.pause()},20),c.ready=1):c.load();return c};h.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};h.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c=$jscomp.makeIterator(this.controls),d=c.next();!d.done;d=c.next())if(d=d.value,d[b]==a)return d;return{update:function(){},w:0,h:0}};h.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};h.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var c=$jscomp.makeIterator(this.spaces),
d=c.next();!d.done;d=c.next())if(d=d.value,d[b]==a)return d;return{update:function(){},w:0,h:0}};h.prototype.getURLParameters=function(){var a=this.URL,b=a.indexOf("?");if(-1!=b)for(a=decodeURIComponent(a.substring(b+1)).split("&"),a=$jscomp.makeIterator(a),b=a.next();!b.done;b=a.next())b=b.value.split("="),2==b.length&&this.evaluator.setVariable("URL."+b[0],+b[1]==+b[1]?parseFloat(b[1]):b[1])};h.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]};b.DescartesApp=h;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.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(a,c){a="Error: "+a+" en\u300a "+c+" \u300b";var h="";switch(b.DEBUG.objectName){case "Auxiliar":c="event"===b.DEBUG.typeName||"algorithm"===b.DEBUG.typeName||
"constant"===b.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[b.DEBUG.pName]||"init"==babel[b.DEBUG.pName])h=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=c+"\u300c"+b.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d"+h+".";break;case "Graphic":a+="En el gr\u00e1fico #"+(b.DEBUG.elemIndex+1)+" de tipo \u300c"+b.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d.";break;case "Animation":if("doExpr"==babel[b.DEBUG.pName]||"init"==
babel[b.DEBUG.pName])h=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=". En la Animaci\u00f3n, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d"+h+"."}console.info(a)}};return b}(descartesJS||{});
descartesJS=function(b){function a(){c().forEach(function(a){b.apps.push(new b.DescartesApp(a));a.className="DescartesJS"})}function c(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|DescartesWeb2_0/i.test(a.getAttribute("code"))})}function h(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function p(){var c,d;return $jscomp.asyncExecutePromiseGeneratorProgram(function(e){switch(e.nextAddress){case 1:return e.setCatchFinallyBlocks(2),
c=[],["descartesJS_serif","descartesJS_sansserif","descartesJS_monospace","DJS_symbol","DJS_math"].forEach(function(a){c.push(document.fonts.load("9px "+a));c.push(document.fonts.load("bold 9px "+a));c.push(document.fonts.load("italic 9px "+a));c.push(document.fonts.load("bold italic 9px "+a))}),e.yield(Promise.all(c),4);case 4:e.leaveTryBlock(3);break;case 2:return d=e.enterCatchBlock(),console.log(d),e.return();case 3:b.getFeatures(),b.hasCanvas?(window.scrollTo(0,100),h(),a(),window.addEventListener("resize",
b.onResize),window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}",e.jumpToEnd()}})}if(b.loadLib)return b;b.apps=[];b.getDescartesApps=function(){return b.apps};(function(){var a=document.getElementById("StyleDescartesApps");a&&a.remove();a=b.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});a.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(a)})();
b.onResize=function(){0<b.apps.length&&b.apps[0].scaleToFit()};var d={};b.onMessage=function(a){if(0<b.apps.length){var c=a.data;if(c)switch(c.type){case "set":"string"==typeof c.value||"number"==typeof c.value?b.apps[0].evaluator.setVariable(c.name,c.value):c.value&&void 0!=c.value.rows?b.apps[0].evaluator.matrices[c.name]=c.value:b.apps[0].evaluator.vectors[c.name]=c.value;break;case "update":b.apps[0].update();break;case "exec":(a=b.apps[0].evaluator.getFunction(c.name))&&a.apply(b.apps[0].evaluator,
c.value.toString().split(","));break;case "isResizeNeeded":a.source.postMessage({type:"doResize"},"*");break;case "doResize":0<b.apps.length&&b.apps[0].adjustSize();break;case "change_config":d[c.filename]?a=d[c.filename]:(a=b.newHTML("div"),a.innerHTML=c.content,a=a.getElementsByTagName("param"),d[c.filename]=a);b.apps[0].children=a;b.apps[0].init();break;case "change_content":a=b.newHTML("div"),a.innerHTML=c.content,a=a.getElementsByTagName("param"),b.apps[0].children=a,b.apps[0].init()}}};void 0==
b.loadLib&&(b.loadLib=!0,window.addEventListener("load",p),window.addEventListener("message",b.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(a){window.addEventListener(a,function(a){b.onResize(a)})}));return b}(descartesJS||{});
