/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2025-04-10
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var e=0;return function(){return e<a.length?{done:!1,value:a[e++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var e="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return e?e.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var e,f=[];!(e=a.next()).done;)f.push(e.value);return f};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var e=function(){};e.prototype=a;return new e};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},e={};try{return e.__proto__=a,e.a}catch(f){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,e){a.__proto__=e;if(a.__proto__!==e)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,e){a.prototype=$jscomp.objectCreate(e.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var f=$jscomp.setPrototypeOf;f(a,e)}else for(f in e)if("prototype"!=f)if(Object.defineProperties){var c=Object.getOwnPropertyDescriptor(e,f);c&&Object.defineProperty(a,f,c)}else a[f]=e[f];a.superClass_=e.prototype};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,f){a!=Array.prototype&&a!=Object.prototype&&(a[e]=f.value)};$jscomp.polyfill=function(a,e,f,c){if(e){f=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var r=a[c];r in f||(f[r]={});f=f[r]}a=a[a.length-1];c=f[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(f,a,{configurable:!0,writable:!0,value:e})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(a){function e(){this.batch_=null}function f(a){return a instanceof r?a:new r(function(b,c){b(a)})}if(a&&!$jscomp.FORCE_POLYFILL_PROMISE)return a;e.prototype.asyncExecute=function(a){if(null==this.batch_){this.batch_=[];var b=this;this.asyncExecuteFunction(function(){b.executeBatch_()})}this.batch_.push(a)};var c=$jscomp.global.setTimeout;e.prototype.asyncExecuteFunction=function(a){c(a,0)};e.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var g=0;g<a.length;++g){var c=a[g];a[g]=null;try{c()}catch(d){this.asyncThrow_(d)}}}this.batch_=null};e.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var r=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(m){b.reject(m)}};r.prototype.createResolveAndReject_=function(){function a(a){return function(b){c||(c=!0,a.call(g,b))}}var g=this,c=!1;
return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};r.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof r)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};r.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(m){this.reject_(m);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};r.prototype.reject_=function(a){this.settle_(2,a)};r.prototype.fulfill_=function(a){this.settle_(1,a)};r.prototype.settle_=function(a,c){if(0!=this.state_)throw Error("Cannot settle("+a+", "+c+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=c;this.executeOnSettledCallbacks_()};r.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=0;a<this.onSettledCallbacks_.length;++a)l.asyncExecute(this.onSettledCallbacks_[a]);
this.onSettledCallbacks_=null}};var l=new e;r.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};r.prototype.settleSameAsThenable_=function(a,c){var b=this.createResolveAndReject_();try{a.call(c,b.resolve,b.reject)}catch(d){b.reject(d)}};r.prototype.then=function(a,c){function b(a,b){return"function"==typeof a?function(b){try{d(a(b))}catch(x){n(x)}}:b}var d,n,h=new r(function(a,b){d=a;n=b});this.callWhenSettled_(b(a,d),b(c,n));return h};
r.prototype.catch=function(a){return this.then(void 0,a)};r.prototype.callWhenSettled_=function(a,c){function b(){switch(d.state_){case 1:a(d.result_);break;case 2:c(d.result_);break;default:throw Error("Unexpected state: "+d.state_);}}var d=this;null==this.onSettledCallbacks_?l.asyncExecute(b):this.onSettledCallbacks_.push(b)};r.resolve=f;r.reject=function(a){return new r(function(b,c){c(a)})};r.race=function(a){return new r(function(b,c){for(var d=$jscomp.makeIterator(a),n=d.next();!n.done;n=d.next())f(n.value).callWhenSettled_(b,
c)})};r.all=function(a){var b=$jscomp.makeIterator(a),c=b.next();return c.done?f([]):new r(function(a,n){function d(b){return function(d){g[b]=d;e--;0==e&&a(g)}}var g=[],e=0;do g.push(void 0),e++,f(c.value).callWhenSettled_(d(g.length-1),n),c=b.next();while(!c.done)})};return r},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(a,e){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:e})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(f){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(f||"")+"_"+e++,f)}var e=0;return a}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.generator={};
$jscomp.generator.ensureIteratorResultIsObject_=function(a){if(!(a instanceof Object))throw new TypeError("Iterator result "+a+" is not an object");};$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};
$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(a){this.yieldResult=a};
$jscomp.generator.Context.prototype.throw_=function(a){this.abruptCompletion_={exception:a,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(a){this.abruptCompletion_={return:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(a){this.abruptCompletion_={jumpTo:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(a,e){this.nextAddress=e;return{value:a}};
$jscomp.generator.Context.prototype.yieldAll=function(a,e){a=$jscomp.makeIterator(a);var f=a.next();$jscomp.generator.ensureIteratorResultIsObject_(f);if(f.done)this.yieldResult=f.value,this.nextAddress=e;else return this.yieldAllIterator_=a,this.yield(f.value,e)};$jscomp.generator.Context.prototype.jumpTo=function(a){this.nextAddress=a};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(a,e){this.catchAddress_=a;void 0!=e&&(this.finallyAddress_=e)};$jscomp.generator.Context.prototype.setFinallyBlock=function(a){this.catchAddress_=0;this.finallyAddress_=a||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(a,e){this.nextAddress=a;this.catchAddress_=e||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(a){this.catchAddress_=a||0;a=this.abruptCompletion_.exception;this.abruptCompletion_=null;return a};$jscomp.generator.Context.prototype.enterFinallyBlock=function(a,e,f){f?this.finallyContexts_[f]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=a||0;this.finallyAddress_=e||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(a,e){e=this.finallyContexts_.splice(e||0)[0];if(e=this.abruptCompletion_=this.abruptCompletion_||e){if(e.isException)return this.jumpToErrorHandler_();void 0!=e.jumpTo&&this.finallyAddress_<e.jumpTo?(this.nextAddress=e.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=a};$jscomp.generator.Context.prototype.forIn=function(a){return new $jscomp.generator.Context.PropertyIterator(a)};
$jscomp.generator.Context.PropertyIterator=function(a){this.object_=a;this.properties_=[];for(var e in a)this.properties_.push(e);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var a=this.properties_.pop();if(a in this.object_)return a}return null};$jscomp.generator.Engine_=function(a){this.context_=new $jscomp.generator.Context;this.program_=a};
$jscomp.generator.Engine_.prototype.next_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,a,this.context_.next_);this.context_.next_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(a){this.context_.start_();var e=this.context_.yieldAllIterator_;if(e)return this.yieldAllStep_("return"in e?e["return"]:function(a){return{value:a,done:!0}},a,this.context_.return);this.context_.return(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],a,this.context_.next_);this.context_.throw_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(a,e,f){try{var c=a.call(this.context_.yieldAllIterator_,e);$jscomp.generator.ensureIteratorResultIsObject_(c);if(!c.done)return this.context_.stop_(),c;var r=c.value}catch(l){return this.context_.yieldAllIterator_=null,this.context_.throw_(l),this.nextStep_()}this.context_.yieldAllIterator_=null;f.call(this.context_,r);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var a=this.program_(this.context_);if(a)return this.context_.stop_(),{value:a.value,done:!1}}catch(e){this.context_.yieldResult=void 0,this.context_.throw_(e)}this.context_.stop_();if(this.context_.abruptCompletion_){a=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(a.isException)throw a.exception;return{value:a.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(a){this.next=function(e){return a.next_(e)};this.throw=function(e){return a.throw_(e)};this.return=function(e){return a.return_(e)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(a,e){e=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(e));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(e,a.prototype);return e};
$jscomp.asyncExecutePromiseGenerator=function(a){function e(c){return a.next(c)}function f(c){return a.throw(c)}return new Promise(function(c,r){function l(a){a.done?c(a.value):Promise.resolve(a.value).then(e,f).then(l,r)}l(a.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(a){return $jscomp.asyncExecutePromiseGenerator(a())};$jscomp.asyncExecutePromiseGeneratorProgram=function(a){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a)))};
$jscomp.checkStringArgs=function(a,e,f){if(null==a)throw new TypeError("The 'this' value for String.prototype."+f+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+f+" must not be a regular expression");return a+""};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var f=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var c="";a;)if(a&1&&(c+=f),a>>>=1)f+=f;return c}},"es6","es3");
$jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(a,f){var c=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var e=c.length,l=a.length;f=Math.max(0,Math.min(f|0,c.length));for(var b=0;b<l&&f<e;)if(c[f++]!=a[b++])return!1;return b>=l}},"es6","es3");
$jscomp.polyfill("String.prototype.endsWith",function(a){return a?a:function(a,f){var c=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===f&&(f=c.length);f=Math.max(0,Math.min(f|0,c.length));for(var e=a.length;0<e&&0<f;)if(c[--f]!=a[--e])return!1;return 0>=e}},"es6","es3");$jscomp.owns=function(a,e){return Object.prototype.hasOwnProperty.call(a,e)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,e){for(var f=1;f<arguments.length;f++){var c=arguments[f];if(c)for(var r in c)$jscomp.owns(c,r)&&(a[r]=c[r])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,f,c){var e=this.length||0;0>f&&(f=Math.max(0,e+f));if(null==c||c>e)c=e;c=Number(c);0>c&&(c=Math.max(0,e+c));for(f=Number(f||0);f<c;f++)this[f]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,e,f){a instanceof String&&(a=String(a));for(var c=a.length,r=0;r<c;r++){var l=a[r];if(e.call(f,l,r,a))return{i:r,v:l}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,f){return $jscomp.findInternal(this,a,f).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var f=[],c=0;c<this.length;c++){var e=this[c];Array.isArray(e)&&0<a?(e=Array.prototype.flat.call(e,a-1),f.push.apply(f,e)):f.push(e)}return f}},"es9","es5");
$jscomp.polyfill("Math.trunc",function(a){return a?a:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var f=Math.floor(Math.abs(a));return 0>a?-f:f}},"es6","es3");$jscomp.polyfill("Math.sign",function(a){return a?a:function(a){a=Number(a);return 0===a||isNaN(a)?a:0<a?1:-1}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(a){return a?a:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");
$jscomp.stringPadding=function(a,e){a=void 0!==a?String(a):" ";return 0<e&&a?a.repeat(Math.ceil(e/a.length)).substring(0,e):""};$jscomp.polyfill("String.prototype.padStart",function(a){return a?a:function(a,f){var c=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(f,a-c.length)+c}},"es8","es3");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.slider="slider";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="cover";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";
a.shadowBlur="shadowBlur";a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.keyboard="keyboard";a.kblayout="kblayout";a.kbexp="kbexp";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return"@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(c){if(""==c)return"";e=c.split(",");f="";f+=a.getFontStyle(e[1])+" ";f+=e[2]+"px ";return f+=a.getFontName(e[0].split(" ")[0])};a.getFontName=function(f){f=f.toLowerCase();c=a.monospace_font;if("serif"===f||"times new roman"===f||"timesroman"===f||"times"===f)c=a.serif_font;else if("sansserif"===f||"arial"===f||"helvetica"===f)c=a.sansserif_font;return c};
a.getFontStyle=function(a){return r[a.toLowerCase()]||""};a.getTextWidth=function(c,b){a.ctx.font=b;return Math.round(a.ctx.measureText(c).width)};a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function e(){var a,b,h,c,g,f,e;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(d){d=Math.max(0,parseInt(void 0===d?0:d));a=this.toString();-1!==a.indexOf("e")&&(c=a.split("e"),f="-"===c[0][0]?"-":"",g="-"===f?parseFloat(c[0].substring(1)).oToFixed(11):parseFloat(c[0]).oToFixed(11),e=parseInt(c[1]),b=g.indexOf("."),g=g.replace(".",""),0>b+e?(b=0>b?1:b,a=f+"0."+"0".repeat(Math.abs(b+e))+g):a=f+g+"0".repeat(e-g.length+1));b=a.indexOf(".");
-1===b?0<d&&(a+="."+"0".repeat(d)):(h=a.length-b-1,a=h>=d?11>=d?parseFloat(a).oToFixed(d):a.substring(0,b+d+1):a+"0".repeat(d-h));return a}}if(a.loadLib)return a;var f=360/(2*Math.PI),c=2*Math.PI/360,r=Math.floor,l,b,g,m;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*f};a.degToRad=function(a){return a*c};a.getFeatures=function(){var b="";try{b=navigator.appVersion.toLowerCase()}catch(n){console.warn("navigator.appVersion is deprecated")}a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||
"ontouchstart"in window||/android/i.test(b);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);b=a.newHTML("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(b.width=b.height=1,a.ctx=a.hasCanvas,a._ratio=2);e()};a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(g=a.indexOf("."),-1!==g)){m=a.substring(g);if(0==parseFloat(m))return a.substring(0,g);for(var b=m.length-1;0<b;b--)if("0"!==m.charAt(b))return a.substring(0,g+b+1)}return a};
a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,b,h){a=void 0===a?0:a;b=void 0===b?100:b;h="linear-gradient("+(void 0===h?0:h)+"deg,";for(var d=2*a,c=a;c<b;c++)a=r(100-c-35),h+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*c-d)+"%, ";return h+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(d,c){l=d.touches?d.touches[0]:d;b=c.getBoundingClientRect();return l?{x:(l.pageX-window.scrollX-b.left)/a.cssScale,y:(l.pageY-window.scrollY-b.top)/a.cssScale}:
null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,d,c=[],g=0,f=0,e=a.length;f<e;f++)d=a.charAt(f),"'"===d&&(b=!b),b||";"!==d&&"\n"!==d||(c.push(a.substring(g,f).replace(/\n/g,"\\n")),g=f+1);c.push(a.substring(g).replace(/\n/g,"\\n"));return c};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(b){var d=a.newHTML("textarea");d.innerHTML=b;return d.value};a.newHTML=function(a,b){a=document.createElement(a);for(var d in b)a.setAttribute(d,
b[d]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function d(){Date.now()-c>=b&&(a.call(),c=Date.now());n.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setInterval(a,b);var c=Date.now(),n={};n.value=requestAnimationFrame(d);return n};a.clearInterval=
function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function d(){Date.now()-c>=b?a.call():n.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setTimeout(a,b);var c=Date.now(),n={};n.value=requestAnimationFrame(d);return n};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var b="<html>\n<head>\n<style>\nbody{text-align:center;}\niframe{width:650px;height:73px;overflow:hidden;border:1px solid black;}\ndt{font-weight:bold;margin-top:10px;}\n</style>\n</head>\n<body>\n<iframe src='https://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='https://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='https://descartesjs.org' target='_blank'>DescartesJS.org</a></h2>\n<dl>\n<dt>Dise\u00f1o funcional:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Jos\u00e9 R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver\u00e1 Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz\u00e1lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est\u00e1 bajo la licencia\n<a href='https://joinup.ec.europa.eu/software/page/eupl/licence-eupl'>EUPL v.1.1</a>\n<br>\nEl software en JavaScript est\u00e1 bajo licencia\n<a href='https://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci\u00f3n y el c\u00f3digo fuente se encuentran en :\n<br>\n<a href='https://descartes.matem.unam.mx/'>https://descartes.matem.unam.mx/</a>\n</p>";
a.ccLicense&&(b+="<p>\nEste objeto, creado con Descartes, est\u00e1 licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>");b+="</body> </html>";var c=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
c.document.write(b);c.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openFile=function(e){if(a.cacheFiles[e])return a.cacheFiles[e];var f=null,c=new XMLHttpRequest;c.open("GET",e,!1);try{c.send(null),f=200===c.status||304===c.status?c.responseText:c.responseText||"",f=404===c.status?"":f,f.match(String.fromCharCode(65533))&&(c.open("GET",e,!1),c.overrideMimeType("text/plain;charset=ISO-8859-1"),c.send(null),f=c.responseText)}catch(r){f=null}return f};a.addExternalFileContent=function(e,
f){a.cacheFiles[e]=f};return a}(descartesJS||{});
descartesJS=function(a){function e(a){x=a.indexOf("--radial--");-1!=x&&(a=a.substring(0,x));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");l=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};l[0]==l[l.length-1]&&"'"==l[0]&&(a.ignoreCaps=!0,l=l.substring(1,l.length-1),"`"==l[0]&&"\u00b4"==l[l.length-1]&&(a.ignoreAccents=!0,l=l.substring(1,l.length-1)));"`"==l[0]&&"\u00b4"==l[l.length-1]&&(a.ignoreAccents=!0,l=l.substring(1,l.length-1),l[0]==l[l.length-1]&&"'"==l[0]&&(a.ignoreCaps=!0,l=l.substring(1,
l.length-1)));l.startsWith("\\*")&&!l.endsWith("\\*")?l=l.substring(2)+"$":!l.startsWith("\\*")&&l.endsWith("\\*")?l="^"+l.substring(0,l.length-2):l.startsWith("\\*")||l.endsWith("\\*")?l.startsWith("\\*")&&l.endsWith("\\*")&&(l=l.substring(2,l.length-2)):l="^"+l+"$";a.regExp=l.replace(/\?/g,"[\\S\\s]{1}");return a}function f(a,b){l=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=l.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),expr:b.parser.parse(a.expr[0].substring(1))};
a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),expr:b.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function c(a,b,c){b=parseFloat(b);d=a.expr[0];n=a.expr[1];h=c.eval(d.expr);v=c.eval(n.expr);q="("==d.type||"["==d.type;u=")"==n.type||"]"==n.type;return q&&b>h&&u&&b<=v?1:0}function r(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,
"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var l,b,g,m,d,n,h,v,q,u,x;a.buildRegularExpressionsPatterns=function(a,k){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var d=0,c=a.length;d<c;d++){b=a[d].split("&");g=[];for(var h=0,n=b.length;h<n;h++)l=b[h],-1===l.indexOf(",")||"("!==
l.charAt(0)&&"["!==l.charAt(0)||")"!==l.charAt(l.length-1)&&"]"!==l.charAt(l.length-1)?g.push(e(l)):g.push(f(l,k));a[d]=g}return a};a.escorrecto=function(d,k,h,n){h=h||a.externalEvaluator;n=n||a.buildRegularExpressionsPatterns(d,h);k=r(k);d=0;for(var g=n.length;d<g;d++){b=n[d];m=!0;for(var f=0,e=b.length;f<e;f++)m=b[f].regExp?m&&!!k.match(new RegExp(r(b[f].regExp),"i")):m&&c(b[f],k,h);if(m)return 1}return 0};a.esCorrecto=function(d,k,h,n){h=h||a.externalEvaluator;n=n||a.buildRegularExpressionsPatterns(d,
h);k+="";d=0;for(var g=n.length;d<g;d++){b=n[d];m=!0;for(var f=0,e=b.length;f<e;f++)(l=b[f].regExp)?(b[f].ignoreAccents&&(k=r(k),l=r(l)),b[f].ignoreCaps&&(k=k.toLowerCase(),l=r(l).toLowerCase()),m=m&&!!k.match(l)):m=m=m&&c(b[f],k,h);if(m)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,f){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===f?"24c":f)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,f){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===f?"d00018":f)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,c,r,l,b,g,m,d,n,h,v,q,u,x,p,k,z,w,y,A=function(d,k){this.r=this.g=this.b=0;this.a=1;this.evaluator=k;this.getColor=this.getColorStr;if(!d)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(d.match(/^GradL/)){d=this.splitComa(d.substring(6,d.length-1));this.x1=this.evaluator.parser.parse(d[0]);this.y1=this.evaluator.parser.parse(d[1]);this.x2=this.evaluator.parser.parse(d[2]);
this.y2=this.evaluator.parser.parse(d[3]);this.stops=[];for(var c=4;c<d.length;c++)""!=d[c]&&(k=d[c].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(k[1]),color:"#"+k[2]}));this.getColor=this.getLinearGradient}else if(d.match(/^Pattern/))this.img_src=d.substring(8,d.length-1),this.img_src.match(f)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[d])"net"===babel[d]&&(d="rojo"),d=babel[d],this.r=
a.toHex(d.substring(1,3)),this.g=a.toHex(d.substring(3,5)),this.b=a.toHex(d.substring(5,7)),this.colorStr=d;else if(6===d.length)this.r=a.toHex(d.substring(0,2)),this.g=a.toHex(d.substring(2,4)),this.b=a.toHex(d.substring(4,6)),this.colorStr="#"+d;else if(8===d.length)this.r=a.toHex(d.substring(2,4)),this.g=a.toHex(d.substring(4,6)),this.b=a.toHex(d.substring(6,8)),this.a=1-a.toHex(d.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===d[0]){r=[];l=this.splitComa(d.substring(1,
d.length-1));d=0;for(k=l.length;d<k;d++)m=l[d],b=parseInt(m,16),m!==b.toString(16)&&m!=="0"+b.toString(16)?("["===m.charAt(0)&&"]"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1)),r.push(this.evaluator.parser.parse(m))):r.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=r[0];this.gExpr=r[1];this.bExpr=r[2];this.aExpr=r[3];this.getColor=this.getColorExp}};A.prototype.splitComa=function(a){g=[];for(var b=h=n=d=0,k=a.length;b<k;b++)v=a.charAt(b),"("===v?d++:")"===v?d--:"["===v?n++:
"]"===v?n--:","===v&&0===d&&0===n&&(g.push(a.substring(h,b)),h=b+1);g.push(a.substring(h));return g};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){c=this.evaluator;this.r=e(255*c.eval(this.rExpr));this.g=e(255*c.eval(this.gExpr));this.b=e(255*c.eval(this.bExpr));this.a=1-c.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){z=a.ctx.createLinearGradient(this.evaluator.eval(this.x1),this.evaluator.eval(this.y1),
this.evaluator.eval(this.x2),this.evaluator.eval(this.y2));for(var b=0;b<this.stops.length;b++)k=this.evaluator.eval(this.stops[b].percentage),k=0>k?0:1<k?1:k,z.addColorStop(k,this.stops[b].color);return z};A.prototype.getPattern=function(){y=this.evaluator.parent;if(w=y.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(w,"repeat")}catch(F){}return"ff00ff"};A.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.toHex=function(a){return parseInt("0x"+
a,16)};a.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");q=parseInt(a[0]).toString(16);u=parseInt(a[1]).toString(16);x=parseInt(a[2]).toString(16);p=(255-parseInt(255*parseFloat(a[3]))).toString(16);1===q.length&&(q="0"+q);1===u.length&&(u="0"+u);1===x.length&&(x="0"+x);1===p.length&&(p="0"+p);return new A(p+q+u+x)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f){var c=this;this.parent=f;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=a.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);
this.additionalKeys=a.newHTML("div",{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=a.newHTML("div",{style:"position:absolute; background-color:white; margin:0; font-family:DJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",function(){c.insert("\n")});this.container.appendChild(this.newLine);
this.display.addEventListener("keydown",function(a){c.keypressed=!0;if(27===a.keyCode)c.close();else if(13===a.keyCode)c.onEnter()});this.key_pressed=!1;var e;this.delete_pressed=!1;var l;this.keyContainer.addEventListener("pointerdown",function(a){if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id){a.target.onpointerleave=function(){clearTimeout(e)};var b=a.target.textContent.trim().toLowerCase();e=setTimeout(function(){c.key_pressed=
!0;c.showAditionalKeys(b)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(l)},l=setInterval(function(){c.delete_pressed=!0;c.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=c.keyContainer&&a.target!=c.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)c.display.selectionStart=c.display.selectionEnd=Math.max(0,c.display.selectionStart-1);else if("k_right"==a.target.id)c.display.selectionStart=c.display.selectionEnd=
Math.min(c.display.value.length,c.display.selectionStart+1);else if("k_delete"==a.target.id)c.delete_pressed||c.delete(),clearTimeout(l),c.delete_pressed=!1;else if("k_\u221a"==a.target.id)c.insert("\u221a(");else if("k_space"==a.target.id)c.insert(" ");else if("k_esc"==a.target.id)c.close();else if("k_shift"==a.target.id){a=c.keyContainer.querySelectorAll("div");var b=c.additionalKeys.querySelectorAll("div");c.shift=!c.shift;c.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=
a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),b.forEach(function(a){a.textContent=a.textContent.toUpperCase()})):(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toLowerCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=".")}),b.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)c["setLayout_"+c.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)c["setLayout_"+
c.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)c.display.value="";else if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id)clearTimeout(e),c.key_pressed||(c.insert(a.target.textContent.trim()),c.additionalKeys.style.display="none"),c.key_pressed=!1;else if("k_return"==a.target.id)c.onEnter();else a=a.target.textContent.trim(),c.insert(a),c.additionalKeys.style.display="none";c.display.focus()});
this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var b=!1;this.additionalKeys.addEventListener("pointerdown",function(a){b=!0});this.additionalKeys.addEventListener("pointerup",function(a){b&&(a.target!=c.keyContainer&&a.target!=c.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),c.insert(a)),c.key_pressed=!1,c.additionalKeys.style.display="none");b=!1;c.display.focus()})};e.prototype.insert=function(a){this.display.setRangeText(a);
this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()};e.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};e.prototype.addKey=function(a,c,e){return"<div "+(c?"id='"+c+"'":"")+" "+(e?"style='"+e+"'":"")+">"+a+"</div>"};e.prototype.addKeys=function(a){var c=this,f="";a.forEach(function(a){f="object"===typeof a?
f+c.addKey(a.val,a.id,a.style):f+c.addKey(a)});return f};e.prototype.showAditionalKeys=function(a){var c=[];"."==a?c=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?c=["-","\u00d7","\u00f7","^"]:"a"==a?c=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?c=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?c=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?c=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(c=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(c);this.shift&&(this.additionalKeys.innerHTML=
this.additionalKeys.innerHTML.toUpperCase());this.additionalKeys.style.display="flex";this.additionalKeys.style.left=this.keyContainer.style.left;this.additionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"};e.prototype.setLayout_14x1=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_delete"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};e.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=
this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_delete"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};e.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_delete"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};e.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=
this.addKeys([7,8,9,{val:"\u232b",id:"k_delete"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="185px"};e.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_delete"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"};e.prototype.setLayout_11x3=
function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_delete"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1};e.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=
this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_delete"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"};e.prototype.setLayout_10x4_alfa=function(){this.keyContainer.innerHTML=
this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_delete",style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width=
"455px"};e.prototype.setLayout_10x4_num=function(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_delete"},{val:"ABC",id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};e.prototype.showCustomKB=
function(a){var c=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||c.length);for(var f=[],e,b,g=0;g<c.length;g++){e={val:c[g].textContent};if(b=c[g].getAttribute("id"))e.id=b;if(b=c[g].getAttribute("size"))e.style="width:"+(40*parseInt(b)+5*(parseInt(b)-1))+"px;transform:none !important;";f.push(e)}this.keyContainer.innerHTML=this.addKeys(f);this.keyContainer.style.width=5+45*a+"px"};e.prototype.setLayout=function(a){this.layout_mode=a;var c=document.getElementById("kb_"+a);c?this.showCustomKB(c):
"14x1"==a?this.setLayout_14x1():"7x2"==a?this.setLayout_7x2():"10x2"==a?this.setLayout_10x2():"4x4"==a?this.setLayout_4x4():"5x4"==a?this.setLayout_5x4():"11x3"==a?this.setLayout_11x3():"11x4"==a?this.setLayout_11x4():"10x4_alfa"==a?this.setLayout_10x4_alfa():"10x4_num"==a?this.setLayout_10x4_num():this.setLayout_14x1()};e.prototype.show=function(a,c,e,l,b,g,m){this.ctr=a;this.var_id=b;this.onlyText=m;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display=
"block";this.setDisplay(g);this.setLayout(c);this.keyContainer.style.left=e+"px";this.keyContainer.style.top=l+"px";this.additionalKeys.style.display="none"};e.prototype.close=function(){this.container.style.display="none";this.parent.deactivateControls();this.parent.update()};e.prototype.setDisplay=function(f){if("custom"==f.type){var c=f.x;var e=f.y;var l=f.w;var b=f.h;var g=f.fs}else e=this.container.getBoundingClientRect(),b=f.getBoundingClientRect(),c=b.left/a.cssScale-e.left/a.cssScale,e=b.top/
a.cssScale-e.top/a.cssScale,l=b.width/a.cssScale,b=b.height/a.cssScale,g=f.style.fontSize;"textarea"==f.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+c+"px;top:"+e+"px;width:"+l+"px;height:"+b+"px;font-size:"+g+";line-height:1.2em;padding:5px;font:"+f.style.font+";"),this.newLine.style.left=c+l-42+"px",this.newLine.style.top=e+b-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+c+"px;top:"+e+"px;width:"+l+"px;height:"+b+"px;font-size:"+g+";line-height:"+
b+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=f.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};e.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var c=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{c&&(a=this.parent.evaluator.eval(c))}catch(b){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),c=this.var_id.indexOf("["),
-1==c)this.parent.evaluator.setVariable(this.var_id,a);else{var e=this.var_id.indexOf(","),l=this.var_id.substring(0,c);-1==e?this.parent.evaluator.setVector(l,parseInt(this.var_id.substring(c+1)),a):this.parent.evaluator.setMatrix(l,parseInt(this.var_id.substring(c+1)),parseInt(this.var_id.substring(e+1)),a)}this.close()};a.Keyboard=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=document.head,f=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});e.querySelector("meta[name=viewport]")||e.appendChild(f);f=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});e.appendChild(f);f=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});e.appendChild(f);f=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});e.appendChild(f);(e=
document.getElementById("StyleDescartesApps2"))&&e.remove();e=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(e,document.head.firstChild);e.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.TextfieldCover{position:absolute;overflow:hidden;background-color:transparent;cursor:pointer;}\ninput[type=text]{-webkit-appearance:none;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField,.DescartesSliderField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesSliderLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;resize:none;border:solid #666 1px;}\n.DescartesTextAreaContainer *{border:none;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer,.DescartesSliderContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DescartesSliderContainer{background:transparent;}\n.DescartesRange{-webkit-appearance:none;appearance:none;background:transparent;cursor: pointer;}\n.DescartesRange::-webkit-slider-runnable-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-moz-range-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--track_h) / 2 - var(--thumb_size) / 2);border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DescartesRange::-moz-range-thumb{border:none;border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100)+", url('"+a.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+a.createGradient(50,100,90)+", url('"+a.getSvgArrowUp(!0)+"');}\n.DJS_Up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+a.createGradient(0,50)+", url('"+a.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100,-90)+", url('"+a.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DescartesKeyboardContainer{position:absolute;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);z-index:1000;}\n.DescartesKeysContainer{display:flex;flex-direction:row;flex-wrap:wrap;background-color:#c0c0c0;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 8px 0 rgba(0,0,0,0.75);box-sizing: content-box;}\n.DescartesKeysContainer > div, .new_line_btn{margin:5px 0 0 5px;display:inline-block;min-width:40px;min-height:40px;max-height:40px;line-height:35px;background-color:#ebeff3;font-family:"+
a.math_font+";font-size:18px;font-weight:bold;color:black;cursor:pointer;text-align:center;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 1px 2px 0 rgba(0,0,0,0.25);transform-origin:center;user-select:none;}\n.DescartesKeysContainer > div:hover, .new_line_btn:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active, .new_line_btn:active{transform:scale(0.95);}\n.DescartesKeyboardDisplay{font-family:"+a.sansserif_font+";padding:0 2px;border:solid #666 1px;text-align:left;background-color:white;position:absolute;overflow:hidden;outline:2px solid black; resize: none;}\n.custom_keyboard{display:none;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(a.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"")+"@media print{body{margin:0;padding:0;}\n.DescartesAppContainer{transform:none !important;left:0 !important;top:0 !important;}\ndiv:has(.DescartesAppContainer){overflow:unset !important;width:100% !important;height:100% !important;}}";return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.sin,f=Math.floor,c=Math.random,r=Math.round,l=Math.abs,b=String.fromCharCode,g,m,d,n,h,v,q,u,x,p,k=function(a){this.key=(void 0===a?0:a).toString()};k.prototype.getKey=function(a){g=[];for(var d=0;256>d;d++)g[d]=b(this.alfanum(f(l(7.5*(e(1*d-a)+e(1.4*d+a)+e(.6*d-a)+e(2.2*d+a))))));return g.join("")};k.prototype.encode=function(a){m=f(31*c());this.key=this.getKey(m);return b(this.alfanum(m))+this.encripta(a)};k.prototype.decode=function(a){m=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(m);return this.desencripta(a.substring(1))};k.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};k.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var b=0,d=a.length;b<d;b++)x=256*f(a[b]+128)+r(255*c())+65536*r(255*c()),p=f((x<<this.shift(b))/256),v[3*b]=this.alfanum(p%32),v[3*b+1]=this.alfanum(p/32%32),v[3*b+2]=this.alfanum(p/1024%32);return v};k.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};k.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;q=Array(a.length/3);for(var b=0,d=q.length;b<d;b++)p=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),x=f(256*p>>this.shift(b)),u=f(x/256)%256-128,0>u&&(u+=256),q[b]=u;return q};k.prototype.alfanum=function(a){return(10>a?48:87)+f(a)};k.prototype.numalfa=function(a){return a-(58>a?48:87)};k.prototype.stringToBytes=
function(a){n=[];for(var b=0,d=a.length;b<d;b++)n.push(a.charCodeAt(b));return n};k.prototype.bytesToString=function(a){for(var d=0,k=a.length;d<k;d++)a[d]=b(a[d]);return a.join("")};k.prototype.shift=function(a){d=this.key.charCodeAt(a%this.key.length);n=this.numalfa(d);h=f(n/2%8);0==h&&(h=4);return h};k.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){this.parent=f;var e=f.evaluator,l=e.parser;f=new a.Auxiliary(f);var b=this;b.delay=l.parse(c.delay?c.delay:"60");b.loop=c.loop?c.loop:!1;b.auto=void 0==c.auto?!0:c.auto;b.controls=c.controls;b.init=f.splitInstructions(l,c.init);b.doExpr=f.splitInstructions(l,c.doExpr);c.whileExpr&&(b.whileExpr=l.parse(c.whileExpr));var g,m=b.doExpr.length;b.animExec=function(){for(g=0;g<m;g++)e.eval(b.doExpr[g]);b.parent.update();b.playing&&(0<e.eval(b.whileExpr)||
b.loop)?b.timer=a.setTimeout(b.animExec,e.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};e.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};e.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};e.prototype.reinit=function(){for(var a=0,c=this.init.length;a<c;a++)this.parent.evaluator.eval(this.init[a])};
a.Animation=e;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var e=function(a){this.parent=a;this.evaluator=this.parent.evaluator};e.prototype.execute=function(){};a.Action=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){c=void 0===c?"":c;f=a.Action.call(this,f)||this;f.parameter=c.replace(/\\n/g,"\n").replace(/&squot;/g,"'");return f};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){alert(this.parameter)};a.Message=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){c=void 0===c?"":c;f=a.Action.call(this,f)||this;c=a.splitSeparator((c||"").replace(/&squot;/g,"'"));f.inst=[];for(var e,l=0,b=c.length;l<b;l++)(e=f.evaluator.parser.parse(c[l],!0))&&f.inst.push(e);return f};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){for(var a=0,c=this.inst.length;a<c;a++)this.evaluator.eval(this.inst[a])};a.Calculate=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){f=a.Action.call(this,f)||this;f.parameter=c.trim();f.target="_blank";return f};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var f=this.parameter;f.match(/^\[.*\]?/)&&(f=this.evaluator.eval(this.evaluator.parser.parse(f.substring(1,f.length-1))));var c=f.indexOf("target");-1!=c&&(this.target=f.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),f=f.substring(0,c-1));if("javascript"==f.substring(0,
10)){f=new a.SimpleText(this.parent,f.substring(11).replace(/&squot;/g,"'"));try{eval(f.toString())}catch(r){}}else"http"!=f.substring(0,4)&&(c=window.__dirname||window.location.href,f=c.substring(0,c.lastIndexOf("/")+1)+f),window.open(f,this.target)};a.OpenURL=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){c=void 0===c?"":c;f=a.Action.call(this,f)||this;f.parameter=c.trim();f.target="_blank";return f};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.evaluator.parser.parse(a.substring(1,a.length-1))));var c=a.indexOf("target");-1!=c&&(this.target=a.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,c-1));if("javascript"==
a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(r){}}else"http"!=a.substring(0,4)&&(c=window.__dirname||window.location.href,a=c.substring(0,c.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+",top="+(window.screen.height-this.parent.height)/2+",location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f){return a.Action.call(this,f)||this};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};a.Config=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f){return a.Action.call(this,f)||this};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){this.parent.init()};a.Init=e;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var e=function(f){return a.Action.call(this,f)||this};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){this.parent.clear()};a.Clear=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f){return a.Action.call(this,f)||this};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){this.parent.play()};a.Animate=e;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var e=function(f){return a.Action.call(this,f)||this};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,f=function(c,f){f=void 0===f?"":f;c=a.Action.call(this,c)||this;f.match(e)?c.filename=c.evaluator.parser.parse("'"+f.match(e)+"'"):(f.match(/^\[.*\]?/)&&(f=f.substring(1,f.length-1)),c.filename=c.evaluator.parser.parse(f));return c};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c=function(a,c){this.parent=a;this.evaluator=a.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,c)};c.prototype.firstRun=function(){};c.prototype.update=function(){};c.prototype.splitInstructions=function(c,l){f=[];l=l?a.splitSeparator(l):[""];for(var b=0,g=l.length;b<g;b++)a.DEBUG.lineCount=b,(e=c.parse(l[b],!0))&&f.push(e);return f};c.prototype.getPrivateVariables=function(a,c){f=[];c=c?c.split(/;|,/):
[""];for(var b=0,g=c.length;b<g;b++)(e=a.parse(c[b],!0))&&f.push(e);b=0;for(g=f.length;b<g;b++)f[b]="assign"===f[b].type?f[b].childs[0].value:"identifier"===f[b].type?f[b].value:"";return f};c.prototype.parseExpressions=function(c){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(c,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(c,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(c,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
c.parse(this.whileExpr)};a.Auxiliary=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){f=a.Auxiliary.call(this,f,c)||this;c=f.evaluator.parser;f.expresionString=f.expresion;f.expresion=c.parse(f.expresionString);f.expresion&&c.setVariable(f.id,f.expresion);f.editable&&(f.registerTextField(),f.parent.editableRegionVisible=!0);return f};$jscomp.inherits(e,a.Auxiliary);e.prototype.registerTextField=function(){var f=a.newHTML("div"),c=a.newHTML("label");c.appendChild(document.createTextNode("___"+this.id+"=___"));var e=a.newHTML("input");
e.value=this.expresionString;e.disabled=!this.editable;f.appendChild(c);f.appendChild(e);var l=this,b=l.evaluator.parser;e.onkeydown=function(a){13==a.keyCode&&(l.expresion=b.parse(this.value),b.setVariable(l.id,l.expresion),l.parent.update())};this.parent.editableRegion.textFields.push({container:f,type:"div"})};a.Variable=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){f=a.Auxiliary.call(this,f,c)||this;f.expresion=f.evaluator.parser.parse(f.expresion);f.update();return f};$jscomp.inherits(e,a.Auxiliary);e.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l=function(b,c){c=a.Auxiliary.call(this,b,c)||this;e=b.evaluator;f=e.parser;c.size=c.size||f.parse("3");c.expresion=c.expresion.split(";");c.parseFile=f.parse(c.file);c.update();return c};$jscomp.inherits(l,a.Auxiliary);l.prototype.update=function(){var b=this.expresion,g;e=this.evaluator;f=e.parser;this.oldFile=this.file;if(c=e.eval(this.parseFile))this.file=c;if(this.file){r=(g=document.getElementById(this.file))&&"descartes/vectorFile"==
g.type?g.text:a.openFile(this.file);if(null!=r){r=r.replace(/\r/g,"").split("\n");var m=[];g=0;for(var d=r.length;g<d;g++)""!=r[g]&&m.push(r[g]);r=m}null==r||1==r.length&&""==r[0]?(r=[],this.size=f.parse("0")):(b=r,this.size=null);null===this.size&&(this.size=f.parse(b.length+""))}var n;m=[];g=0;for(d=b.length;g<d;g++)(n=f.parse(b[g],!0))&&"assign"!=n.type&&(n=f.parse(this.id+"["+g+"]="+b[g],!0)),m.push(n);b=Array(parseInt(Math.abs(e.eval(this.size)))).fill(0);b._size_=b.length;e.vectors[this.id]=
b;e.setVariable(this.id+".long",b._size_);g=0;for(d=m.length;g<d;g++)e.eval(m[g])};a.Vector=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b=function(b,m){m=a.Auxiliary.call(this,b,m)||this;e=b.evaluator;f=e.parser;m.rows=m.rows||f.parse("3");m.columns=m.columns||f.parse("3");m.expresion=m.splitInstructions(f,m.expresion);c=e.eval(m.rows);r=e.eval(m.columns);l=[];l.type="matrix";b=0;for(var d=r;b<d;b++)l[b]=Array(c).fill(0);e.matrices[m.id]=l;m.update();return m};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){e=this.evaluator;c=e.eval(this.rows);r=e.eval(this.columns);
e.setVariable(this.id+".filas",c);e.setVariable(this.id+".columnas",r);l=e.matrices[this.id];l.rows=c;l.cols=r;for(var a=0,b=this.expresion.length;a<b;a++)e.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){var e=a.Auxiliary.call(this,f,c)||this;var l=e.evaluator;f=l.parser;c=e.id.indexOf("(");e.name=e.id.substring(0,c);e.params=e.id.substring(c+1,e.id.indexOf(")"));e.domain=e.range?f.parse(e.range):f.parse("1");e.params=""===e.params?[]:e.params.split(",");e.numParams=e.params.length;e.algorithm||(e.init="",e.doExpr="",e.whileExpr="");e.parseExpressions(f);e.expresion=f.parse(e.expresion);var b;e.functionExec=function(){e.iterations=
0;if(e.numParams<=arguments.length){for(var c=[],f=0,d=e.privateVars.length;f<d;f++)c.push(l.getVariable(e.privateVars[f])),l.setVariable(e.privateVars[f],0);var n=[];f=0;for(d=e.params.length;f<d;f++)n.push(l.getVariable(e.params[f])),l.setVariable(e.params[f],arguments[f]);f=0;for(d=e.init.length;f<d;f++)l.eval(e.init[f]);b=l.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{f=0;for(d=e.doExpr.length;f<d;f++)l.eval(e.doExpr[f]);if(++e.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+
b+" repeticiones en la funci\u00f3n << "+e.name+" >>"),0}while(0<l.eval(e.whileExpr));var h=l.eval(e.expresion);a.rangeOK=l.eval(e.domain);f=0;for(d=e.params.length;f<d;f++)l.setVariable(e.params[f],n[f]);f=0;for(d=e.privateVars.length;f<d;f++)l.setVariable(e.privateVars[f],c[f]);return h}return 0};l.setFunction(e.name,e.functionExec);return e};$jscomp.inherits(e,a.Auxiliary);a.Function=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){var e=a.Auxiliary.call(this,f,c)||this;var l=e.evaluator;e.parseExpressions(l.parser);var b;e.algorithmExec=function(){e.iterations=0;b=l.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var a=0,c=e.init.length;a<c;a++)l.eval(e.init[a]);do{a=0;for(c=e.doExpr.length;a<c;a++)l.eval(e.doExpr[a]);if(++e.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+b+" repeticiones en el algoritmo << "+e.name+" >>"),0}while(0<l.eval(e.whileExpr))};
return e};$jscomp.inherits(e,a.Auxiliary);e.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){f=a.Auxiliary.call(this,f,c)||this;c=f.evaluator;delete f.evaluate;f.condition=c.parser.parse(f.condition);f.lastEval=!1;f.action=f.parent.lessonParser.parseAction(f);"onlyOnce"==f.execution&&(f.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEval&&(this.lastEval=!0,this.action.execute())});"alternate"==f.execution&&(f.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEval?(this.action.execute(),
this.lastEval=!0):!a&&this.lastEval&&(this.lastEval=!1)});"always"==f.execution&&(f.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return f};$jscomp.inherits(e,a.Auxiliary);e.prototype.update=function(){this.eventExec()};a.Event=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(f,c){var e=a.Auxiliary.call(this,f,c)||this;c=c.file;if(c)var l=(l=document.getElementById(c))&&"descartes/library"===l.type?l.text:a.openFile(c);if(l){l=a.convertHTMLEntities(l).replace(/\r/g,"").split("\n");c=0;for(var b=l.length;c<b;c++)""!==l[c].trim()&&f.lessonParser.parseAuxiliar(l[c])}return e};$jscomp.inherits(e,a.Auxiliary);a.Library=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=c.parse("1");this.abs_coord=d&&d.type&&"text"===d.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=c.parse("(0,0)");this.family="";this.family_interval=c.parse("[0,1]");this.family_steps=c.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=c.parse("2");Object.assign(this,d);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);
if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};d.prototype.getSpace=
function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};d.prototype.getFamilyValues=function(){e=this.evaluator;f=e.eval(this.family_interval);this.familyInf=f[0][0];this.familySup=f[0][1];this.fSteps=Math.round(e.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};d.prototype.drawFamilyAux=function(a,b,d){e=this.evaluator;this.getFamilyValues();c=e.getVariable(this.family);if(0<=this.fSteps)for(var h=
0,n=this.fSteps;h<=n;h++)e.setVariable(this.family,this.familyInf+h*this.family_sep),0<e.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,b,d));e.setVariable("_Text_H_",0);e.setVariable(this.family,c)};d.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([])};d.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))};d.prototype.rotate=function(a,b,d){g=Math.cos(d);m=Math.sin(d);return{x:a*g-b*m,y:a*m+b*g}};d.prototype.dashStyle=function(){b=this.ctx;"dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([b.lineWidth,b.lineWidth])):"dash"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,3*b.lineWidth])):"dash_dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,2*b.lineWidth,b.lineWidth,2*b.lineWidth])):b.setLineDash([])};d.prototype.drawText=
function(a,b,d,c,f,g,m,k,z,w,y){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=f.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:d,y:c},b.update(a,d,c,z,w,m,y,f.getColor());else for("simpleText"===b.type&&(b=b.toString(z,w).split("\\n")),e=this.evaluator,a.fillStyle=f.getColor(),a.font=g,a.textAlign=m,a.textBaseline=k,l=1.2*this.fontSize||0,f=0,g=b.length;f<g;f++)r=b[f],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(r,
d,c+l*f)),a.fillText(r,d,c+l*f)};a.Graphic=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m=function(a,n){this.text=n=n.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";e="'";r=c=0;for(l=-1;c<n.length;)b=n.charAt(c),g=n.charAt(c-1),"["===b&&"\\"===g?(this.textElements.push(n.substring(r,c-1)+"["),this.textElementsMacros.push("'"+n.substring(r,c-1)+"['"),r=c+1):"]"===b&&"\\"===g?(this.textElements.push(n.substring(r,
c-1)+"]"),this.textElementsMacros.push("'"+n.substring(r,c-1)+"]'"),r=c+1):"["===b&&-1===l?(this.textElements.push(n.substring(r,c)),this.textElementsMacros.push("'"+n.substring(r,c)+"'"),r=c,l++):"["===b?l++:"]"===b&&0===l?(this.textElements.push(this.evaluator.parser.parse(n.substring(r,c+1))),this.textElementsMacros.push("["+n.substring(r,c+1)+"]"),r=c+1,l--):("]"==n.charAt(c)&&(l=0>l?l:l-1),e+=n.charAt(c)),c++;this.textElements.push(n.substring(r,c));this.textElementsMacros.push("'"+n.substring(r,
c)+"'")};m.prototype.toString=function(b,c){e="";for(var d=0,n=this.textElements.length;d<n;d++)"string"===typeof this.textElements[d]?e+=this.textElements[d]:(f=this.evaluator.eval(this.textElements[d])[0][0],""!==f&&("string"===typeof f?e+=f:Infinity==f?e+="Infinity":-Infinity==f?e+="-Infinity":isNaN(f)||"NaN"==f?e+="NaN":(f=parseFloat(f),f=c?f.toFixed(b):a.removeNeedlessDecimals(f.toFixed(b)),e+=f.toString().replace(".",this.parent.decimal_symbol))));return e};a.SimpleText=m;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J,D,B,I,L,M,O,H,N,C,Q,K=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fillP=d.fillP||"";d.fillM=d.fillM||"";d.parseExpression();d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();q=new a.R2;u=new a.R2;x=new a.R2;z=new a.R2;p=new a.R2;d.cInd=0;return d};$jscomp.inherits(K,a.Graphic);K.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],d=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||d.contains("y")?"identifier"!=d.type||"y"!=d.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||d.contains("x")?"identifier"!=d.type||"x"!=d.value||b.contains("x")||(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};K.prototype.update=function(){};K.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};K.prototype.drawFamilyAux=function(a,b,d){c=this.evaluator;this.getFamilyValues();f=c.getVariable(this.family);if(0<=this.fSteps)for(var k=0,h=this.fSteps;k<=h;k++)c.setVariable(this.family,this.familyInf+k*this.family_sep),this.update(),this.drawAux(a,
b,d);c.setVariable(this.family,f)};K.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};K.prototype.drawAux=function(f,P,S){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;c=this.evaluator;r=c.parser;l=this.space;b=c.eval(this.width);f.strokeStyle=this.color.getColor();f.lineWidth=b;g=r.getVariable("x");m=r.getVariable("y");d=l.w+24;n=l.h+24;h=d/9;3>h&&(h=3);v=n/7;3>v&&(v=3);0==this.cInd?(e=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;q.set(0,0);u.set(0,
0);x.set(0,0);C=.25;Q=8;this.abs_coord||(C/=l.scale,Q/=l.scale);f.beginPath();for(I=parseInt(v/2);I<n;I+=v)for(B=parseInt(h/2);B<d;B+=h){if(this.abs_coord){z.set(B,I);k=this.newt.findZero(z,C);if(null==k)continue;c.setVariable("x",k.x);c.setVariable("y",k.y);p.set(k.x,k.y)}else{z.set(l.getRelativeX(B),l.getRelativeY(I));k=this.newt.findZero(z,C);if(null==k)continue;c.setVariable("x",k.x);c.setVariable("y",k.y);p.set(l.getAbsoluteX(k.x),l.getAbsoluteY(k.y))}w=p.ix();y=p.iy();if(-12<=w&&w<d+24&&-12<=
y&&y<n+24){if(e[w+12+(y+12)*l.w]===this.cInd)continue;e[w+12+(y+12)*l.w]=this.cInd}a.rangeOK&&(f.moveTo(w,y),f.lineTo(w,y));q.x=k.x;q.y=k.y;u.x=k.x;u.y=k.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),x.x=A.x,x.y=A.y,E=F=0,G=!1;2>E;)if(G&&(x.x=-A.x,x.y=-A.y,k.x=q.x,k.y=q.y,u.x=k.x,u.y=k.y,this.abs_coord?p.set(k.x,k.y):p.set(l.getAbsoluteX(k.x),l.getAbsoluteY(k.y)),w=p.ix(),y=p.iy(),G=!1,F=0),k.x+=Q*x.x,k.y+=Q*x.y,k=this.newt.findZero(k,C),null!=k){c.setVariable("x",k.x);c.setVariable("y",
k.y);x.x=k.x-u.x;x.y=k.y-u.y;x.normalize();if(0==x.x&&0==x.y)break;u.x=k.x;u.y=k.y;this.abs_coord?p.set(k.x,k.y):p.set(l.getAbsoluteX(k.x),l.getAbsoluteY(k.y));J=parseInt(p.ix());D=parseInt(p.iy());if(J!=w||D!=y)if(L=w,M=y,w=J,y=D,-12<=w&&w<d+24&&-12<=y&&y<n+24){F=0;O=e[w+12+(y+12)*l.w];e[w+12+(y+12)*l.w]=this.cInd;for(P=1;8>P;P++)H=L+Math.round((w-L)*P/8),N=M+Math.round((y-M)*P/8),0<=H&&H<d&&0<=N&&N<n&&(e[H+12+(N+12)*l.w]=this.cInd);a.rangeOK&&(f.moveTo(L,M),f.lineTo(w,y));if(O===this.cInd)break}else G=
!0,E++;else 4<++F&&(G=!0,E++)}}f.stroke()}};K.prototype.X=function(a,b,d){d||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};K.prototype.Y=function(a,b,d){d||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};K.prototype.XX=function(a,b,d){return Math.round(this.X(a,b,d))};K.prototype.YY=function(a,b,d){return Math.round(this.Y(a,b,d))};K.prototype.extrapolate=function(b,d,
c,k,h,n){for(var f=this.evaluator.getVariable(d),g=n/2,e=0,q,m,l,u,p,v;1E-15<Math.abs(g);){q=this.evaluator.getVariable(d);m=this.evaluator.getVariable(d)+g;this.evaluator.setVariable(d,m);l=!0;try{u=h,h=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,h),0<this.evaluator.eval(b)?(p=new a.R2(Math.min(u,h),Math.max(u,h)),v=0,v=0<n?this.Singularity(Math.abs(g),d,k,q,u,m,h,p):this.Singularity(Math.abs(g),d,k,m,h,q,u,p),0<v&&(l=!1)):l=!1}catch(Z){l=!1}l?e+=g:this.evaluator.setVariable(d,
q);g/=2}this.evaluator.setVariable(d,f);return new a.R2(e/Math.abs(n),h)};K.prototype.extrapolateOnSingularity=function(b,d,c,k,h,n){k=this.evaluator.getVariable(d);for(var f=n/2,g=0,e=h,q;1E-15<Math.abs(f);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)+f);q=!0;if(0<this.evaluator.eval(b))try{e=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,e),0>=this.evaluator.eval(b)&&(q=!1)}catch(X){q=!1}else q=!1;q?g+=f:this.evaluator.setVariable(d,this.evaluator.getVariable(d)-f);
f/=2}if(0==g)for(f=n/2,g=n,e=h;1E-15<Math.abs(f);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)-f);q=!0;if(0<this.evaluator.eval(b))try{e=this.evaluator.eval(this.funExpr)}catch(X){q=!1}else q=!1;q?g+=-f:this.evaluator.setVariable(d,this.evaluator.getVariable(d)+f);f/=2}this.evaluator.setVariable(d,k);return new a.R2(g/Math.abs(n),e)};K.prototype.Singularity=function(a,b,d,c,k,h,n,f){if(isNaN(n)||isNaN(k)||isNaN(f.y)||isNaN(f.x)||c>=h)return 2;var g=this.evaluator.getVariable(b),e=0;
try{if(1E-15>Math.abs(h-c)||1E-12>Math.abs(h-c)&&Math.abs(n-k)>Math.abs(a))return this.evaluator.setVariable(b,g),1;var q=(c+h)/2;this.evaluator.setVariable(b,q);var m=NaN;try{m=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(m))return 5;if(Math.abs(n-k)>a){this.evaluator.setVariable(b,c-1E-12);var l=this.evaluator.eval(this.funExpr);l=(k-l)/1E-12;this.evaluator.setVariable(b,h+1E-12);var u=(this.evaluator.eval(this.funExpr)-n)/1E-12;if((10>Math.abs(u)||10>Math.abs(l))&&(0<=u&&0<=l||
0>=u&&0>=l)&&4*Math.abs(u)<Math.abs((n-k)/(h-c)))return this.evaluator.setVariable(b,g),2}if(isNaN(f.x)||isNaN(f.y)||isNaN(m))return 2;if(!(f.x<=m&&m<=f.y)){this.evaluator.setVariable(b,q);f.x=Math.min(k,m);f.y=Math.max(k,m);var p=this.Singularity(a/2,b,d,c,k,q,m,f);this.evaluator.setVariable(b,h);f.x=Math.min(n,m);f.y=Math.max(n,m);var v=this.Singularity(a/2,b,d,q,m,h,n,f);e=Math.max(p,v)}}catch(Y){e=1}this.evaluator.setVariable(b,g);return e};K.prototype.discontLR=function(a,b,d,c){var k=b+d,h=
k+d,n=b-d;d=n-d;this.evaluator.setVariable("x",b);b=this.evaluator.eval(a);if(isNaN(b)||!isFinite(b)||Math.abs(b)>c)return!0;this.evaluator.setVariable("x",k);k=this.evaluator.eval(a);if(isNaN(k)||!isFinite(k)||Math.abs(k)>c)return!0;this.evaluator.setVariable("x",h);h=this.evaluator.eval(a);if(isNaN(h)||!isFinite(h)||Math.abs(h)>c)return!0;this.evaluator.setVariable("x",n);n=this.evaluator.eval(a);if(isNaN(n)||!isFinite(n)||Math.abs(n)>c)return!0;this.evaluator.setVariable("x",d);a=this.evaluator.eval(a);
if(isNaN(a)||!isFinite(a)||Math.abs(a)>c)return!0;c=3*b-4*k+h;a=3*b-4*n+a;return.8<Math.abs((c*c-a*a)/(c*c+a*a+1E-4))?!0:!1};K.prototype.drawAuxFun1=function(b,d,c){g=this.evaluator.parser.getVariable("x");m=this.evaluator.parser.getVariable("y");a.rangeOK=1;if(this.evaluator.eval(this.drawif)){d="x";this.of_y&&(d="y");b.beginPath();b.lineWidth=this.evaluator.eval(this.width);b.strokeStyle=c.getColor();for(var k=-1;k<=this.space.w;k+=1){c=this.space.getRelativeX(k);this.evaluator.setVariable(d,c);
var h=this.evaluator.eval(this.funExpr);var n=this.space.getAbsoluteX(c);h=this.space.getAbsoluteY(h);this.discontLR(this.funExpr,c,.001,100)?b.moveTo(n,h):b.lineTo(n,h)}b.stroke();this.evaluator.parser.setVariable("x",g);this.evaluator.parser.setVariable("y",m)}};K.prototype.drawAuxFun=function(b,d,c){g=this.evaluator.parser.getVariable("x");m=this.evaluator.parser.getVariable("y");a.rangeOK=1;d="x";var k="y";this.of_y&&(d="y",k="x");var h=this.drawif,n=this.evaluator.eval(this.width),f=!1,e=new a.R2(this.space.w/
2+this.space.Ox,this.space.h/2+this.space.Oy),q=this.of_y?e.ix():e.iy(),l=0,u=0,p=0,v=0,r=1/this.space.scale;e=r*(this.of_y?-this.space.h+e.y:-e.x);var x=0;this.abs_coord&&(e=0,r=1);for(var z,F,y,A,w,J,B,L,D,E=this.of_y?this.space.h+2:this.space.w+2;p<=E;){z=!0;F=0;this.evaluator.setVariable(d,e);try{y=this.evaluator.eval(this.funExpr),isNaN(y)||(this.evaluator.setVariable(k,y),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(f?(A=Math.min(x,y),w=Math.max(x,y),J=new a.R2(A,w),F=this.Singularity(r,d,
0,e-r,x,e,y,J),0===F?(x<=y?(x=J.x,y=J.y):(y=J.x,x=J.y),B=parseInt(this.of_y?this.XX(n,x,this.abs_coord):this.YY(n,x,this.abs_coord)),l=this.abs_coord?Math.round(y):parseInt(this.of_y?this.XX(n,y,this.abs_coord):this.YY(n,y,this.abs_coord)),this.fillM&&l>q&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(q+1,this.space.h-p+.5),b.lineTo(l,this.space.h-p+.5)):(b.moveTo(p+.5,q+1),b.lineTo(p+.5,l)),b.stroke()),this.fillP&&l<q&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),
b.beginPath(),this.of_y?(b.moveTo(q-1,this.space.h-p+.5),b.lineTo(l,this.space.h-p+.5)):(b.moveTo(p+.5,q-1),b.lineTo(p+.5,l)),b.stroke()),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(B+.5,this.space.h-v),b.lineTo(l+.5,this.space.h-p)):(b.moveTo(v+.5,B),b.lineTo(p+.5,l)),b.stroke()):1===F?(this.evaluator.setVariable(d,e-r),L=this.extrapolate(h,d,k,0,x,r),l=this.of_y?this.XX(n,L.y,this.abs_coord):this.YY(n,L.y,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),
this.of_y?(b.moveTo(u+.5,this.space.h-v),b.lineTo(l+.5,this.space.h-v+Math.round(L.x))):(b.moveTo(v+.5,u),b.lineTo(v+Math.round(L.x)+.5,l)),this.evaluator.setVariable(d,e),D=this.extrapolate(h,d,k,0,y,-r),u=this.of_y?this.XX(n,D.y,this.abs_coord):this.YY(n,D.y,this.abs_coord),l=this.of_y?this.XX(n,y,this.abs_coord):this.YY(n,y,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(u+.5,this.space.h-p),b.lineTo(l+.5,this.space.h-p)):(b.moveTo(p+.5,u),b.lineTo(p+
.5,l)),b.stroke()):2===F&&(l=this.of_y?this.XX(n,y,this.abs_coord):this.YY(n,y,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(u+.5,this.space.h-p),b.lineTo(l+.5,this.space.h-p)):(b.moveTo(p+.5,u),b.lineTo(p+.5,l)))):(D=this.extrapolateOnSingularity(h,d,k,0,y,-r),u=this.of_y?this.XX(n,D.y,this.abs_coord):this.YY(n,D.y,this.abs_coord),l=this.of_y?this.XX(n,y,this.abs_coord):this.YY(n,y,this.abs_coord),b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),
this.of_y?(b.moveTo(u,this.space.h-(p+Math.round(D.x))+.5),b.lineTo(l,this.space.h-p+.5)):(b.moveTo(p+Math.round(D.x),u),b.lineTo(p,l)),b.stroke()),x=y):z=!1)}catch(aa){z=!1}f&&!z&&(this.evaluator.setVariable(d,e-r),this.evaluator.setVariable(k,x),L=this.extrapolate(h,d,k,0,x,r),l=parseInt(this.of_y?this.XX(n,L.y,this.abs_coord):this.YY(n,L.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=n,b.strokeStyle=c.getColor(),b.beginPath(),this.of_y?(b.moveTo(u,this.space.h-(v+
Math.round(L.x))+.5),b.lineTo(l,this.space.h-(v+Math.round(L.x))+.5)):(b.moveTo(v+Math.round(L.x)+.5,u),b.lineTo(v+Math.round(L.x)+.5,l)),b.stroke()),this.evaluator.setVariable(d,e));f=z;e+=r;u=l;v=p++}this.evaluator.parser.setVariable("x",g);this.evaluator.parser.setVariable("y",m)};K.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=
d.evaluator.parser.parse(this.value),d.parseExpression(),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Equation=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f,c,r,l,b,g,m,d=function(b,d){d=a.Graphic.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(d,a.Graphic);d.prototype.update=
function(){f=this.evaluator;c=f.eval(this.parameter_interval);this.paraInf=c[0][0];this.paraSup=c[0][1];this.pSteps=f.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};d.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};d.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};d.prototype.drawAux=function(d,c,v){f=this.evaluator;r=this.space;d.lineWidth=Math.max(1E-6,e(f.eval(this.width)));
d.lineCap=d.lineJoin="round";d.strokeStyle=v.getColor();l=f.getVariable(this.parameter);d.beginPath();f.setVariable(this.parameter,this.paraInf);b=f.eval(this.expresion);this.exprX=e(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0]));this.exprY=e(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1]));this.rotateExp&&(g=a.degToRad(f.eval(this.rotateExp)),m=this.rotate(b[0][0],b[0][1],g),this.exprX=e(this.abs_coord?m.x:r.getAbsoluteX(m.x)),this.exprY=e(this.abs_coord?m.y:r.getAbsoluteY(m.y)));d.moveTo(this.exprX+
.5,this.exprY+.5);for(v=1;v<=this.pSteps;v++)f.setVariable(this.parameter,this.paraInf+v*this.paraSep),b=f.eval(this.expresion),this.rotateExp&&(m=this.rotate(b[0][0],b[0][1],g),b[0][0]=m.x,b[0][1]=m.y),this.exprX=e(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0])),this.exprY=e(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&d.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(d.fillStyle=c.getColor(),
d.fill("evenodd"));this.dashStyle();d.stroke();d.setLineDash([]);f.setVariable(this.parameter,l)};d.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Curve=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,f=Math.round,c,r,l,b,g,m,d,n,h,v,q=function(b,d){d=a.Graphic.call(this,b,d)||this;d.size=d.size||b.evaluator.parser.parse("2");d.range=d.range||b.evaluator.parser.parse("[1, 100]");d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.rotateExp&&
(b=this.rotate(l[0][0],l[0][1],a.degToRad(c.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);d=c.eval(this.range);this.rangeInf=d[0][0];this.rangeMax=d[0][1]};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(b,d){c=this.evaluator;r=this.space;h=n=Math.ceil(c.eval(this.size)-.4);b.fillStyle=d.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);d=c.getVariable("n");for(var q=this.rangeInf,k=this.rangeMax;q<=k;q++)c.setVariable("n",q),l=c.eval(this.expresion),this.exprX=l[0][0],this.exprY=l[0][1],g=f(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX)),m=f(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(g,m,n,0,e,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,c.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,g+h,m-h,this.color,this.font,"start","alphabetic",c.eval(this.decimals),this.fixed,!0));c.setVariable("n",d)};q.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};
a.Sequence=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,f=Math.round,c,r,l,b,g,m,d,n=function(b,d){d=a.Graphic.call(this,b,d)||this;d.size=d.size||b.evaluator.parser.parse("2");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.rotateExp&&(b=this.rotate(l[0][0],l[0][1],a.degToRad(c.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};n.prototype.drawAux=function(a,b){r=this.space;a.fillStyle=b.getColor();g=f(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX));m=f(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY));d=f(this.evaluator.eval(this.size));0<d&&(a.beginPath(),a.arc(g,m,d,0,e),a.fill());this.text.hasContent&&this.text.draw(a,b,g,m)};a.Point=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f=2*Math.PI,c,r,l,b,g,m,d,n,h,v,q=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.size=d.size||b.evaluator.parser.parse("2");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);this.endPoints=[];for(var d=0,h=l.length;d<h;d++)this.endPoints[d]={x:l[d][0],y:l[d][1]};if(this.rotateExp)for(b=a.degToRad(c.eval(this.rotateExp)),
d=0,h=this.endPoints.length;d<h;d++)this.endPoints[d]=this.rotate(this.endPoints[d].x,this.endPoints[d].y,b)};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(a,b,q){c=this.evaluator;r=this.space;a.lineWidth=Math.max(1E-6,e(c.eval(this.width)));g=c.eval(this.size);a.fillStyle=b.getColor();a.strokeStyle=q.getColor();a.lineCap="round";m=
0==a.lineWidth%2?0:.5;this.abs_coord?(d=e(this.endPoints[0].x),n=e(this.endPoints[0].y),h=e(this.endPoints[1].x),v=e(this.endPoints[1].y)):(d=e(r.getAbsoluteX(this.endPoints[0].x)),n=e(r.getAbsoluteY(this.endPoints[0].y)),h=e(r.getAbsoluteX(this.endPoints[1].x)),v=e(r.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(d+m,n+m);a.lineTo(h+m,v+m);this.dashStyle();a.stroke();0<g&&(a.beginPath(),a.arc(d,n,g,0,f),a.arc(h,v,g,0,f),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
q,parseInt((d+h)/2)-3,parseInt((n+v)/2)+3)};a.Segment=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=Math.round,c,r,l,b,g,m,d,n,h,v,q,u,x,p=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("5");d.size=d.size||b.evaluator.parser.parse("2");d.spear=d.spear||b.evaluator.parser.parse("8");d.arrow=d.arrow||new a.Color("ee0022");d.text=new a.TextObject(d,d.text);d.endPoints=[];d.vect=new a.Vector2D(0,0);return d};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){c=this.evaluator;r=c.eval(this.expresion);
for(var b=0,d=r.length;b<d;b++)this.endPoints[b]={x:r[b][0],y:r[b][1]};if(this.rotateExp)for(l=a.degToRad(c.eval(this.rotateExp)),b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,l)};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};p.prototype.drawAux=function(a,l,p){c=this.evaluator;b=this.space;g=Math.max(0,
c.eval(this.width));m=Math.ceil(g/2);d=b.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;n=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=l.getColor();a.strokeStyle=p.getColor();a.lineWidth=2;this.abs_coord?(h=f(this.endPoints[0].x),v=f(this.endPoints[0].y),q=f(this.endPoints[1].x),u=f(this.endPoints[1].y)):(h=f(b.getAbsoluteX(this.endPoints[0].x)),v=f(b.getAbsoluteY(this.endPoints[0].y)),q=f(b.getAbsoluteX(this.endPoints[1].x)),
u=f(b.getAbsoluteY(this.endPoints[1].y)));x=Math.max(0,c.eval(this.spear));a.save();a.translate(h,v);this.abs_coord?a.rotate(this.angle):(n*=d,a.rotate(-this.angle));a.beginPath();a.moveTo(-m,e(-m));a.lineTo(e(n-x-g),e(-m));a.lineTo(e(n-2*x),e(-x-m));a.lineTo(e(n),0);a.lineTo(e(n-2*x),e(x+m));a.lineTo(e(n-x-g),e(m));a.lineTo(-m,e(m));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,p,parseInt((h+q)/2)-3,parseInt((v+u)/2)+3)};a.Arrow=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f,c,r,l,b,g,m=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.endPoints=[];return c};$jscomp.inherits(m,a.Graphic);m.prototype.update=function(){f=this.evaluator;r=f.eval(this.expresion);for(var b=0,c=r.length;b<c;b++)this.endPoints[b]={x:r[b][0],y:r[b][1]};if(this.rotateExp)for(l=a.degToRad(f.eval(this.rotateExp)),b=0,c=this.endPoints.length;b<c;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,
this.endPoints[b].y,l)};m.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};m.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};m.prototype.drawAux=function(a,n,h){f=this.evaluator;c=this.space;a.lineWidth=Math.max(1E-6,e(f.eval(this.width)));a.strokeStyle=h.getColor();a.lineCap=a.lineJoin="round";b=e(this.abs_coord?this.endPoints[0].x:c.getAbsoluteX(this.endPoints[0].x));g=e(this.abs_coord?this.endPoints[0].y:c.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(b+0,g+0);h=1;for(var d=this.endPoints.length;h<d;h++)b=e(this.abs_coord?this.endPoints[h].x:c.getAbsoluteX(this.endPoints[h].x)),g=e(this.abs_coord?this.endPoints[h].y:c.getAbsoluteY(this.endPoints[h].y)),a.lineTo(b+0,g+0);this.fill&&(a.fillStyle=n.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f=Math.min,c=Math.max,r=Math.abs,l,b,g,m,d,n,h,v,q,u,x=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.border_radius=d.border_radius||b.evaluator.parser.parse("0");d.endPoints=[];return d};$jscomp.inherits(x,a.Graphic);x.prototype.update=function(){l=this.evaluator;m=l.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.w=150;this.h=100;this.rotateExp&&(g=this.rotate(m[0][0],
m[0][1],a.degToRad(l.eval(this.rotateExp))),this.exprX=g.x,this.exprY=g.y);4<=m[0].length&&(this.w=m[0][2],this.h=m[0][3]);m[1]&&2==m[1].length&&(this.w=m[1][0],this.h=m[1][1]);this.w=c(0,this.w);this.h=c(0,this.h)};x.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};x.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};x.prototype.drawAux=function(a,k,g,m){l=this.evaluator;b=this.space;a.lineWidth=Math.max(1E-6,e(l.eval(this.width)));
a.strokeStyle=g.getColor();a.lineCap="round";a.lineJoin="miter";d=e(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+0;n=e(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+0;h=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;q=f(c(0,l.eval(this.border_radius)),.5*r(h),.5*r(v));u=this.abs_coord?1:-1;a.beginPath();0!==q?(a.moveTo(d+q,n),a.lineTo(d+h-q,n),a.quadraticCurveTo(d+h,n,d+h,n+u*q),a.lineTo(d+h,n+v-u*q),a.quadraticCurveTo(d+h,n+v,d+h-q,n+v),a.lineTo(d+q,
n+v),a.quadraticCurveTo(d,n+v,d,n+v-u*q),a.lineTo(d,n+u*q),a.quadraticCurveTo(d,n,d+q,n),a.lineTo(d+q,n)):(a.moveTo(d,n),a.lineTo(d+h,n),a.lineTo(d+h,n+v),a.lineTo(d,n+v),a.lineTo(d,n));this.fill&&(a.fillStyle=k.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f=Math.min,c=Math.max,r=Math.acos,l=Math.sqrt,b=Math.PI,g=b/2,m=2*b,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J,D,B,I,L=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.center=d.center||b.evaluator.parser.parse("(0,0)");d.radius=d.radius||b.evaluator.parser.parse("1");d.init=d.init||"0";d.end=d.end||"90";d.init.match(/^_\(/)&&(d.initFlag=!0,d.init=d.init.substring(1));d.end.match(/^_\(/)&&
(d.endFlag=!0,d.end=d.end.substring(1));d.initExpr=b.evaluator.parser.parse(d.init);d.endExpr=b.evaluator.parser.parse(d.end);d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(L,a.Graphic);L.prototype.update=function(){d=this.evaluator;n=d.eval(this.center);this.exprX=n[0][0];this.exprY=n[0][1];h=0;this.rotateExp&&(h=a.degToRad(d.eval(this.rotateExp)),v=Math.cos(h),q=Math.sin(h),u=this.exprX*v-this.exprY*q,x=this.exprX*q+this.exprY*v,this.exprX=u,this.exprY=x);var e=d.eval(this.initExpr),
J=d.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(p=e[0][0],k=e[0][1],z=J[0][0],w=J[0][1],this.vectors?this.abs_coord&&(k=-k,w=-w):(p-=this.exprX,k=-k+this.exprY,z-=this.exprX,w=-w+this.exprY,this.abs_coord||(k=-k,w=-w)),y=0==p?0>k?3*g:g:r(1*p/l(p*p+k*k)),A=0==z?0>w?3*g:g:r(1*z/l(z*z+w*w)),y+=h,A+=h,0<p&&0<k&&this.abs_coord&&(y=m-y),0<p&&0>k&&!this.abs_coord&&(y=m-y),0>p&&0>k&&!this.abs_coord&&(y=m-y),0>p&&0<k&&this.abs_coord&&
(y=m-y),0<z&&0<w&&this.abs_coord&&(A=m-A),0<z&&0>w&&!this.abs_coord&&(A=m-A),0>z&&0>w&&!this.abs_coord&&(A=m-A),0>z&&0<w&&this.abs_coord&&(A=m-A),this.initFlag?(F=y,y=A,A=F):(F=f(y,A),E=c(y,A),y=F,A=E,A-y>b&&this.abs_coord&&(y=E,A=F),A-y<=b&&!this.abs_coord&&(y=E,A=F)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(e)+h,this.endAng=a.degToRad(J)+h,this.drawAngle=!0)};L.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};L.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};L.prototype.drawAux=function(a,b,c){d=this.evaluator;G=this.space;B=Math.max(0,d.eval(this.radius));a.lineWidth=Math.max(1E-6,e(d.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(J=e(this.exprX),D=e(this.exprY)):(J=e(G.getAbsoluteX(this.exprX)),D=e(G.getAbsoluteY(this.exprY)),B*=G.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(I=this.iniAng,this.iniAng=
this.endAng,this.endAng=I);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(J,D),a.arc(J,D,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(J,D,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,J,D)};a.Arc=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("0");c.align||(c.align="left");c.anchor||(c.anchor="top_left");c.shadowColor=c.shadowColor?c.shadowColor.getColor():"transparent";c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){e=this.evaluator;f=e.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1];this.rotateExp&&(c=this.rotate(f[0][0],
f[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y)};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};b.prototype.drawAux=function(a,b){this.abs_coord?(r=parseInt(this.exprX),l=parseInt(this.exprY)):(r=parseInt(this.space.getAbsoluteX(this.exprX)),l=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,r,l)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f,c,r,l,b,g,m,d,n,h,v,q,u,x=function(b,d){d=a.Graphic.call(this,b,d)||this;d.file=d.file||"";d.inirot=d.inirot||b.evaluator.parser.parse("0");d.img=new Image;d.scaleX=d.scaleY=1;d.ratio=b.ratio;b=d.expresion.getChildren();d.x_e=b[0];d.y_e=b[1];2<b.length&&(d.centered=!0,d.s_x_e=b[2],d.s_y_e=3<b.length?b[3]:b[2]);d.evaluator.eval(d.clip)&&(d.clip=d.clip.getChildren());d.update();return d};$jscomp.inherits(x,a.Graphic);x.prototype.update=
function(){f=this.evaluator;v=f.eval(this.x_e);q=f.eval(this.y_e);this.exprX=v;this.exprY=q;this.rotateExp&&(c=this.rotate(v,q,a.degToRad(f.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y);this.centered&&(this.scaleX=f.eval(this.s_x_e),this.scaleY=f.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));u=this;if((r=f.eval(this.file))||""==r)this.img=this.parent.getImage(r),this.img.ready||this.img.addEventListener("load",function(a){u.space.update(!0)})};x.prototype.draw=
function(){a.Graphic.prototype.draw.call(this)};x.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};x.prototype.drawAux=function(c){f=this.evaluator;this.img&&this.img.ready&&this.img.complete&&(this.clip?(n=f.eval(this.clip[2]),h=f.eval(this.clip[3])):(n=this.img.width,h=this.img.height,this.img.canvas&&(n=e(n/this.img.ratio),h=e(h/this.img.ratio))),l=this.centered?0:e(n/2),b=this.centered?0:e(h/2),g=e(this.abs_coord?this.exprX:this.space.getAbsoluteX(this.exprX)),m=e(this.abs_coord?
this.exprY:this.space.getAbsoluteY(this.exprY)),d=a.degToRad(-f.eval(this.inirot)),c.save(),c.translate(g+l,m+b),c.rotate(d),this.opacity&&(c.globalAlpha=f.eval(this.opacity)),c.scale(this.scaleX,this.scaleY),this.clip?this.img.canvas?c.drawImage(this.img,f.eval(this.clip[0])*this.img.ratio,f.eval(this.clip[1])*this.img.ratio,n*this.img.ratio,h*this.img.ratio,-n/2,-h/2,n,h):c.drawImage(this.img,f.eval(this.clip[0]),f.eval(this.clip[1]),n,h,-n/2,-h/2,n,h):c.drawImage(this.img,-n/2,-h/2,n,h),c.restore())};
a.Image=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d=document.createElement("canvas").getContext("2d");d.canvas.width=1;d.canvas.height=1;var n=function(b,d){return a.Graphic.call(this,b,d)||this};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){e=this.evaluator.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1]};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,
this.trace)};n.prototype.drawAux=function(a,n){n=n.getColor();d.clearRect(0,0,1,1);d.fillStyle=n;d.fillRect(0,0,1,1);n=(new Uint32Array(d.getImageData(0,0,1,1).data.buffer))[0];g=a.getImageData(0,0,this.space.w,this.space.h);m=new Uint32Array(g.data.buffer);this.abs_coord?(f=parseInt(this.exprX),c=parseInt(this.exprY)):(f=parseInt(this.space.getAbsoluteX(this.exprX)),c=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>f||0>c||f>=this.space.w||c>=this.space.h)){r=[f,c];var h=g.width;l=0>f||0>c||
f>=h||c>=g.height?-1:m[f+c*h];for(b=0;0<r.length&&!(b++,c=r.pop(),f=r.pop(),h=g.width,l==(0>f||0>c||f>=h||c>=g.height?-1:m[f+c*h])&&(m[f+c*g.width]=n,r.push(f-1,c),r.push(f+1,c),r.push(f,c-1),r.push(f,c+1)),b>=this.space.w*this.space.h*8););a.putImageData(g,0,0)}};a.Fill=n;return a}(descartesJS||{});
descartesJS=function(a,e){if(a.loadLib)return a;var f=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),c=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,l=function(b,g){var m=a.Graphic.call(this,b,g)||this;m.hasExpresion=m.hasExpresion||!1;m.inirot=m.inirot||b.evaluator.parser.parse("0");m.inipos=m.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(m,g);m.hasExpresion=void 0!==m.expresion;m.graphics=[];b=b.lessonParser;var d=new a.Tokenizer;
if(!m.hasExpresion)return m;"'"!==m.expresion.charAt(0)&&(m.expresion="'"+m.expresion+"'");m.expresion=m.evaluator.parser.parse(m.expresion);g=m.evaluator.eval(m.expresion);if(g)var n=(n=document.getElementById(g))&&"descartes/macro"==n.type?n.text:a.openFile(g);if(n){var h=a.convertHTMLEntities(n).replace(/\r/g,"").split("\n");n=[];g=0;for(var l=h.length;g<l;g++)if(h[g].trim()){var q=h[g].indexOf("=");if(-1!==q){q=b.split(h[g]);for(var u=0,r=q.length;u<r;u++)if(q[u]&&1<q.length&&("id"===e[q[u][0]]||
"type"===e[q[u][0]])){n.push(q);break}}}u=function(b,c){c=d.tokenize(c.replace(/&squot;/g,"'"));for(var k=0,h=c.length;k<h;k++)if("identifier"==c[k].type&&!a.reservedIds.match("-"+c[k].value+"-")||"R"===c[k].value||"G"===c[k].value||"B"===c[k].value)c[k].value=m.name+"."+c[k].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+d.flatTokens(c)};g=0;for(l=n.length;g<l;g++){var p=(r=n[g]||[],r[0])&&"id"===r[0][0];h=0;for(q=r.length;h<q;h++){var k=r[h][0].indexOf(".");-1===k||p?k=e[r[h][0]]:(k=e[r[h][0].substring(k+
1)],r[h][0]=m.name+"."+r[h][0]);if(!("font"===k||"font_family"===k||("fill"===k||"color"===k||"border"===k||"arrow"===k)&&"("!==r[h][1].charAt(0)||"file"===k&&r[h][1].match(c)||"id"!==k&&void 0!==e[r[h][1]])||"radius"===k)if("text"==k)if(r[h][1].match(/\{\\rtf1/))k=r[h][1],k=k.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),k=k.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),r[h][1]=k;else{var z=b.parseText(r[h][1]).textElementsMacros;for(var w=
0,y=z.length;w<y;w++){k=d.tokenize(z[w].replace(/&squot;/g,"'"));for(var A=0,F=k.length;A<F;A++)if("identifier"===k[A].type&&!a.reservedIds.match("-"+k[A].value+"-")||"R"===k[A].value||"G"===k[A].value||"B"===k[A].value)k[A].value=m.name+"."+k[A].value;k=d.flatTokens(k).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");z[w]=k.substring(1,k.length-1)}r[h][1]=z.join("")}else{z=r[h][1].replace(/&squot;/g,"'").split(";");w=0;for(y=z.length;w<y;w++){k=d.tokenize(z[w].replace(/\\n/g,";"));
A=0;for(F=k.length;A<F;A++)if("identifier"===k[A].type&&!a.reservedIds.match("-"+k[A].value+"-")||"R"===k[A].value||"G"===k[A].value||"B"===k[A].value)k[A].value=m.name+"."+k[A].value;z[w]=d.flatTokens(k)}r[h][1]=z.join(";")}}}g=0;for(l=n.length;g<l;g++)if(n[g][0]){u="";r=!1;h=0;for(q=n[g].length;h<q;h++)"type"===e[n[g][h][0]]&&f.match("-"+e[n[g][h][1]]+"-")&&(r=!0),u=u+n[g][h][0]+"='"+n[g][h][1]+"' ";n[g]=u+(r?" space='"+m.spaceID+"'":"");r?m.graphics.push(b.parseGraphic(n[g],m.abs_coord,m.background,
m.inirot)):b.parseAuxiliar(n[g])}}return m};$jscomp.inherits(l,a.Graphic);l.prototype.update=function(){r=this.evaluator.eval(this.inipos);this.iniPosX=r[0][0];this.iniPosY=r[0][1]};l.prototype.drawAux=function(a){for(var b=0,c=this.graphics.length;b<c;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=l;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var e=Math.sqrt,f=Math.sin,c=Math.cos,r=Math.abs,l,b,g,m,d,n,h,v,q,u,x,p,k,z,w,y=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=c||0;this.adjustDec()};y.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,b,d,c,k,h,n,f,g,e,q,m,l,u,p,r){this.a00=a||0;this.a01=b||0;this.a02=d||0;this.a03=c||0;this.a10=k||0;this.a11=h||0;this.a12=n||0;this.a13=f||0;
this.a20=g||0;this.a21=e||0;this.a22=q||0;this.a23=m||0;this.a30=l||0;this.a31=u||0;this.a32=p||0;this.a33=r||0};A.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};A.prototype.multiplyVector4=function(a){return new y(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};A.prototype.translate=function(a){return new A(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};A.prototype.rotateX=function(a){b=f(a);g=c(a);v=this.a10;q=this.a11;u=this.a12;
x=this.a13;p=this.a20;k=this.a21;z=this.a22;w=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,v*g+p*b,q*g+k*b,u*g+z*b,x*g+w*b,v*-b+p*g,q*-b+k*g,u*-b+z*g,x*-b+w*g,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){b=f(a);g=c(a);m=this.a00;d=this.a01;n=this.a02;h=this.a03;p=this.a20;k=this.a21;z=this.a22;w=this.a23;return new A(m*g+p*-b,d*g+k*-b,n*g+z*-b,h*g+w*-b,this.a10,this.a11,this.a12,this.a13,m*b+p*g,d*b+k*g,n*b+z*g,h*b+w*g,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){b=f(a);g=c(a);m=this.a00;d=this.a01;n=this.a02;h=this.a03;v=this.a10;q=this.a11;u=this.a12;x=this.a13;return new A(m*g+v*b,d*g+q*b,n*g+u*b,h*g+x*b,m*-b+v*g,d*-b+q*g,n*-b+u*g,h*-b+x*g,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return e(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){l=a.norm3D(b);if(0===l)return{x:0,y:0,z:0};if(1===l)return{x:b.x,y:b.y,z:b.z};l=1/l;return{x:b.x*l,y:b.y*l,z:b.z*l}};a.dotProduct3D=function(a,b){return a.x*
b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};a.add3D=function(a,b){return{x:a.x+b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,d){return r(a.x-b.x)<=d&&r(a.y-b.y)<=d&&r(a.z-b.z)<=d};a.Vector4D=y;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function e(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function f(a,b){a.textNode=null;a.lineCap=g;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);q=1;for(u=this.projVert.length;q<u;q++)a.lineTo(this.projVert[q].x,this.projVert[q].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=b.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function c(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";h=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.fontSize=Math.max(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,h)}function r(a){a.textNode=null;a.lineCap=g;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function l(b,d,c){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
d),a.subtract3D(b,c)))}if(a.loadLib)return a;var b=2*Math.PI,g=lineJoin="round",m,d,n,h,v,q,u,x,p,k,z,w,y,A=function(a,b){Object.assign(this,a);this.space=b;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=e:"face"===this.type?(this.normal=l(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=f):"text"===this.type?this.draw=c:"edge"===this.type&&(this.draw=r);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};A.prototype.computeDepth=function(b){this.space=b;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};q=0;for(u=this.vertices.length;q<u;q++)this.spaceVertices[q]=b.rotateVertex(this.vertices[q]),this.average.x+=this.spaceVertices[q].x,this.average.y+=this.spaceVertices[q].y,this.average.z+=this.spaceVertices[q].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=b.project(this.average);this.depth=a.norm3D(a.subtract3D(b.eye,this.average));2<this.vertices.length&&(this.normal=l(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));q=0;for(u=this.vertices.length;q<u;q++)this.newSpaceVert[q]=this.spaceVertices[q],this.projVert[q]=this.newProjVert[q]=b.project(this.spaceVertices[q]);2<this.vertices.length&&(this.direction=l(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;q=0;for(u=this.vertices.length;q<u;q++)x=a.norm3D(a.subtract3D(this.spaceVertices[q],b.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,x),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,x);q=0;for(u=this.vertices.length;q<u;q++)this.minx>this.projVert[q].x&&(this.minx=this.projVert[q].x),this.maxx<this.projVert[q].x&&(this.maxx=this.projVert[q].x),this.miny>this.projVert[q].y&&(this.miny=this.projVert[q].y),
this.maxy<this.projVert[q].y&&(this.maxy=this.projVert[q].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];q=0;for(u=this.vertices.length;q<u;q++)(1E-8<Math.abs(this.vertices[q].x-this.vertices[(q+1)%u].x)||1E-8<Math.abs(this.vertices[q].y-this.vertices[(q+1)%u].y)||1E-8<Math.abs(this.vertices[q].z-this.vertices[(q+1)%u].z)||1E-8<Math.abs(this.vertices[q].w-this.vertices[(q+1)%u].w))&&v.push(this.vertices[q]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};A.prototype.drawText=
function(b,c,k,h,f,g,e,q,l,u,p){m=this.evaluator;b.textNode=c;g=m.eval(this.offset_dist);e=-a.degToRad(m.eval(this.offset_angle));k+=g*Math.cos(e);h+=g*Math.sin(e);b.textNode.pos={x:k,y:h};c.hasContent&&(c.draw(b,f,k,h,!0),n=this.fromPoint?c.textNodes.metrics.w/2:0,d=this.fromPoint?c.textNodes.metrics.h/2:0,c.draw(b,f,k-n,h-d))};A.prototype.splitFace=function(b){if(this.intersects(b)){var d=i2=null,c=ix2=0,k,h;var n=this.vertices;var f=b.vertices;var g=0;for(h=f.length;g<h;g++){var e=this.intersection(f[g],
f[(g+1)%h]);if(null!==e)if(null===d){if(d=e,c=g,2===f.length){i2=d;break}}else if(!a.equals3DEpsilon(e,d,1E-8)){i2=e;ix2=g;break}}if(null!==d&&null!==i2){g=this.isInterior(d)||this.isInterior(i2);var q=k=null;if(!g&&3<=f.length)for(h=0,n=n.length;h<n;h++)if(e=b.intersection(this.vertices[h],this.vertices[(h+1)%n]),null!==e)if(null===k)k=e;else if(!a.equals3DEpsilon(e,k,1E-8)){q=e;break}if(g||null!==k&&null!==q&&b.isInterior(k)&&b.isInterior(q)){q=!0;n=e=null;if(2===f.length)a.equals3DEpsilon(d,f[0],
1E-8)||a.equals3DEpsilon(d,f[1],1E-8)?q=!1:(e=[],e[0]=f[0],e[1]=d,n=[],n[0]=d,n[1]=f[1]);else for(e=[],n=[],g=h=k=0;g<f.length;g++)g<c?e[k++]=f[g]:g==c?(e[k++]=f[g],e[k++]=d,n[h++]=d):g<ix2?n[h++]=f[g]:g==ix2?(n[h++]=f[g],n[h++]=i2,e[k++]=i2):e[k++]=f[g];if(q){d=[];d[0]=new A({vertices:e,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);d[0].removeDoubles();d[0].normal=b.normal;d[1]=new A({vertices:n,type:"face",frontColor:b.frontColor,backColor:b.backColor,
edges:b.edges,model:b.model},this.space);d[1].removeDoubles();d[1].normal=b.normal;if(2<d[0].vertices.length)return 2<d[1].vertices.length?d:[d[0]];if(2<d[1].vertices.length)return[d[1]]}}}}return[b]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(b){var d=this.vertices;var c=b.vertices;if(0<d.length){var k=a.dotProduct3D(c[0],b.normal);var h=a.dotProduct3D(d[0],b.normal);if(1E-8>Math.abs(k-h))return!0;for(var n=1,f=
d.length;n<f;n++)if(c=a.dotProduct3D(d[n],b.normal),1E-8>Math.abs(k-c)||c>k&&h<k||c<k&&h>k)return!0}return!1};A.prototype.intersection=function(b,d){var c=this.vertices;if(0<c.length){d=a.subtract3D(d,b);var k=a.dotProduct3D(d,this.normal);if(0!==k&&(c=a.dotProduct3D(a.subtract3D(c[0],b),this.normal)/k,-1E-8<c&&1.00000001>c))return a.add3D(b,a.scalarProduct3D(d,c))}return null};A.prototype.isInterior=function(b){var d=this.vertices;if(0<d.length)for(var c=0,k=a.subtract3D(d[0],b),h=0,n=d.length;h<
n;h++){var f=a.subtract3D(d[(h+1)%n],b),g=a.dotProduct3D(a.crossProduct3D(k,f),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(k,f))break}else{if(0>c&&0<g||0<c&&0>g)return!1;k=f;c=g}}return!0};A.prototype.inFrontOf=function(a,b,d){if(this.minDistanceToEye>=b.maxDistanceToEye||this.maxx<=b.minx||this.minx>=b.maxx||this.maxy<=b.miny||this.miny>=b.maxy)return!1;for(w=0;3>w;w++)if(p=null,p=0===w?this.intersections(b):1===w?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=p&&0<p.length){for(y=
0;y<p.length;y++)a.push(p[y]);q=0;for(u=p.length;q<u;q++){k=p[q];z=this.space.rayFromEye(k.x,k.y);try{t=this.distanceToEyeAlong(z)-b.distanceToEyeAlong(z);if(t<=-d)return!0;if(t>=d)return!1}catch(J){}}}return!1};A.prototype.intersections=function(b){for(var d=[],c,k,h,n=new a.R2,f=this.newSpaceVert,g=b.newSpaceVert,e=this.newProjVert,q=b.newProjVert,m=0,l=f.length;m<l;m++){b=f[m];c=f[(m+1)%l];for(var u=0,p=g.length;u<p;u++)k=g[u],h=g[(u+1)%p],b!=k&&b!=h&&c!=k&&c!=h&&(k=n.intersection(e[m],e[(m+1)%
l],q[u],q[(u+1)%p]),null!=k&&d.push(k))}return d};A.prototype.distanceToEyeAlong=function(b){b=a.dotProduct3D(this.normal,b);if(1E-6<Math.abs(b))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/b;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var b=[],d=this.newSpaceVert,c=this.newProjVert,k=0,h=d.length;k<h;k++)!a.isVertex(d[k])&&a.appearsToContain(c[k])&&b.push(c[k]);return b};A.prototype.appearsToContain=function(a){for(var b=
0,d,c=this.newProjVert,k=0,h=this.newSpaceVert.length;k<h;k++){d=(c[k].x-a.x)*(c[(k+1)%h].y-a.y)-(c[(k+1)%h].x-a.x)*(c[k].y-a.y);if(0!=b)if(1E-8>Math.abs(d)){if(1E-8<Math.abs(c[k].x-c[(k+1)%h].x))return Math.min(c[k].x,c[(k+1)%h].x)<=a.x+1E-8&&a.x<=Math.max(c[k].x,c[(k+1)%h].x)+1E-8;if(1E-8<Math.abs(c[k].y-c[(k+1)%h].y))return Math.min(c[k].y,c[(k+1)%h].y)<=a.y+1E-8&&a.y<=Math.max(c[k].y,c[(k+1)%h].y)+1E-8}else if(0<b&&0>d||0>b&&0<d)return!1;b=d}return!0};A.prototype.isVertex=function(b){for(var d=
this.newSpaceVert,c=0,k=d.length;c<k;c++)if(a.equals3DEpsilon(b,d[c],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function e(a){for(var b=[],d=0,c,h=a.length,n=a.length-1;-1<n;n--)c=a.charAt(n),0==d?"="==c&&(d=1):1==d?" "!=c&&(d="<"===c||">"===c?0:2):2==d&&" "==c&&(b.unshift(a.substring(n+1,h)),h=n,d=0);b.unshift(a.substring(0,h));return b}if(a.loadLib)return a;var f={x:0,y:0,z:0},c,r,l,b,g,m=a.degToRad,d,n=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=b.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=c.parse("1");this.abs_coord=!1;this.family="";this.family_interval=c.parse("[0,1]");this.family_steps=c.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=c.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=c.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=c.parse("(0,0,0)");this.model="color";Object.assign(this,d);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=c.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style=
"Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=c.parse(this.inirot);this.endrot=c.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};n.prototype.getSpace=function(){for(var a=this.parent.spaces,b,d=0,
c=a.length;d<c;d++)if(b=a[d],b.id==this.spaceID)return b;return a[0]};n.prototype.getFamilyValues=function(){c=this.evaluator;r=c.eval(this.family_interval);this.familyInf=r[0][0];this.familySup=r[0][1];this.fSteps=Math.round(c.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};n.prototype.buildFamilyPrimitives=function(){c=this.evaluator;this.getFamilyValues();l=c.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)c.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,c.eval(this.drawif)&&this.buildPrimitives();c.setVariable(this.family,l)};n.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};n.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(m(b[0][0])),this.inirotM=
this.inirotM.rotateX(m(b[0][1])),this.inirotM=this.inirotM.rotateZ(m(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(m(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(m(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.inipos);f={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(f);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(m(b[0][0])),this.endrotM=this.endrotM.rotateX(m(b[0][1])),this.endrotM=this.endrotM.rotateZ(m(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(m(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(m(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.endpos);f={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(f)};n.prototype.transformVertex=function(a){this.inirotEuler?g=
this.inirotM.multiplyVector4(a):(g=this.inirotM_X.multiplyVector4(a),g=this.inirotM_Y.multiplyVector4(g),g=this.inirotM_Z.multiplyVector4(g));g=this.iniposM.multiplyVector4(g);this.endrotEuler?g=this.endrotM.multiplyVector4(g):(g=this.endrotM_X.multiplyVector4(g),g=this.endrotM_Y.multiplyVector4(g),g=this.endrotM_Z.multiplyVector4(g));g=this.endposM.multiplyVector4(g);this.macroChildren&&(g=this.applyMacroTransform(g));g.adjustDec();return g};n.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
g=this.macro_inirotM.multiplyVector4(a):(g=this.macro_inirotM_X.multiplyVector4(a),g=this.macro_inirotM_Y.multiplyVector4(g),g=this.macro_inirotM_Z.multiplyVector4(g));g=this.macro_iniposM.multiplyVector4(g);this.macro_endrotEuler?g=this.macro_endrotM.multiplyVector4(g):(g=this.macro_endrotM_X.multiplyVector4(g),g=this.macro_endrotM_Y.multiplyVector4(g),g=this.macro_endrotM_Z.multiplyVector4(g));return g=this.macro_endposM.multiplyVector4(g)};n.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],d=0,c=a.length;d<c;d++)""!==a[d].trim()&&(b=b.concat(e(a[d])));d=0;for(c=b.length;d<c;d++)b[d]=this.evaluator.parser.parse(b[d],!0);return b};n.prototype.splitFace=function(a){for(var b=0,c=this.primitives.length;b<c;b++)if(d=[],"face"===this.primitives[b].type){for(var h=0,n=a.primitives.length;h<n;h++)"face"===a.primitives[h].type?d=d.concat(this.primitives[b].splitFace(a.primitives[h])):d.push(a.primitives[h]);a.primitives=d}};a.Graphic3D=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b=function(b,c){return a.Graphic3D.call(this,b,c)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();f=e.eval(this.expresion);c=f[0][0];r=f[0][1];l=f[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,r,l,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:e.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||e.parser.parse("10"),this.offset_angle=this.offset_angle||e.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,r,l,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:e.eval(this.decimals),fixed:this.fixed,evaluator:e,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");return d};$jscomp.inherits(n,a.Graphic3D);n.prototype.buildPrimitives=function(){m=this.evaluator;this.updateMVMatrix();g=m.getVariable("u");m.setVariable("u",this.Nu);d=m.eval(this.expresion);e=d[0][0];f=d[0][1];c=d[0][2];r=d[1][0];l=d[1][1];b=d[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,
f,c,1)),this.transformVertex(new a.Vector4D(r,l,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:m.eval(this.width)},this.space));m.setVariable("u",g)};a.Segment3D=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n,h,v,q,u,x=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.expresion=d.parseExpression();return d};$jscomp.inherits(x,a.Graphic3D);x.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();r=e.getVariable("x");l=e.getVariable("y");b=e.getVariable("z");
f=e.getVariable("u");c=e.getVariable("v");e.setVariable("u",0);e.setVariable("v",0);g=parseInt(e.eval(this.Nu));m=parseInt(e.eval(this.Nv));d=[];for(h=0;h<=g;h++)for(e.setVariable("u",h/g),v=0;v<=m;v++){e.setVariable("v",v/m);q=0;for(u=this.expresion.length;q<u;q++)e.eval(this.expresion[q]);d.push(this.transformVertex(new a.Vector4D(e.getVariable("x"),e.getVariable("y"),e.getVariable("z"),1)))}var p=this.color.getColor(),k=this.backcolor.getColor(),z=this.edges?this.edges.getColor():"";for(h=0;h<
g;h++)for(v=0;v<m;v++)n=[],n.push(d[v+h*m+h]),n.push(d[v+1+h*m+h]),n.push(d[v+2+(h+1)*m+h]),n.push(d[v+1+(h+1)*m+h]),this.primitives.push(new a.Primitive3D({vertices:n,type:"face",frontColor:p,backColor:k,edges:z,model:this.model},this.space));e.setVariable("x",r);e.setVariable("y",l);e.setVariable("z",b);e.setVariable("u",f);e.setVariable("v",c)};a.Surface3D=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");return d};$jscomp.inherits(d,a.Graphic3D);d.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();m=g.eval(this.expresion);for(var d=this.color.getColor(),h=0,v=m.length-1;h<v;h++)e=m[h][0],f=m[h][1],c=m[h][2],r=m[h+1][0],l=m[h+1][1],b=m[h+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,
f,c,1)),this.transformVertex(new a.Vector4D(r,l,b,1))],type:"edge",frontColor:d,lineWidth:g.eval(this.width)},this.space))};a.Polygon3D=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.expresion=c.parseExpression();return c};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();r=g.getVariable("x");l=g.getVariable("y");b=g.getVariable("z");c=g.getVariable("u");g.setVariable("u",0);f=g.eval(this.Nu);e=[];for(var d=0;d<=f;d++){g.setVariable("u",d/f);for(var n=0,h=
this.expresion.length;n<h;n++)g.eval(this.expresion[n]);e.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}d=0;for(n=e.length-1;d<n;d++)this.primitives.push(new a.Primitive3D({vertices:[e[d],e[d+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:g.eval(this.width)},this.space));this.fill&&2<e.length&&this.primitives.push(new a.Primitive3D({vertices:e,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));g.setVariable("x",r);g.setVariable("y",b);g.setVariable("z",l);g.setVariable("u",c)};a.Curve3D=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n,h,v=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){n=this.evaluator;this.updateMVMatrix();h=n.eval(this.expresion);e=h[0][0];f=h[0][1];c=h[0][2];r=h[1][0];l=h[1][1];b=h[1][2];g=h[2][0];m=h[2][1];d=h[2][2];var q=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,f,c,1)),this.transformVertex(new a.Vector4D(g,
m,d,1)),this.transformVertex(new a.Vector4D(r,l,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:q,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();c=f.eval(this.expresion);e=[];for(var l=c.length-1;0<=l;l--)e.push(this.transformVertex(new a.Vector4D(c[l][0],c[l][1],c[l][2],1)));l=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:e,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:l,model:this.model},this.space))};a.Face3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("2");d.length=d.length||b.evaluator.parser.parse("2");return d};$jscomp.inherits(g,a.Graphic3D);g.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();e=b.eval(this.Nu);f=[this.transformVertex(new a.Vector4D(0,0,0,1))];c=b.eval(this.width)/2;r=b.eval(this.length)/2;l=2*Math.PI/e;for(var g=0;g<e;g++)f.push(this.transformVertex(new a.Vector4D(c*
Math.cos(l*g),r*Math.sin(l*g),0,1)));var d=this.color.getColor(),n=this.backcolor.getColor(),h=this.edges?this.edges.getColor():"";for(g=0;g<e;g++)this.primitives.push(new a.Primitive3D({vertices:[f[0],g+2<=e?f[g+2]:f[1],f[g+1]],type:"face",frontColor:d,backColor:n,edges:h,model:this.model},this.space))};a.Polireg3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l=function(b,c){b=a.Graphic3D.call(this,b,c)||this;b.shadowColor=b.shadowColor?b.shadowColor.getColor():"transparent";return b};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){e=this.evaluator;f=e.eval(this.expresion);c=f[0][0];r=f[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(c,r,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:e.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:e,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=l;return a}(descartesJS||{});
descartesJS=function(a,e){if(a.loadLib)return a;var f=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),c=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,l,b=0,g=function(g,d){var n=a.Graphic.call(this,g,d)||this;n.expresion=n.expresion||void 0;n.inirot=n.inirot||"(0,0,0)";n.inirotEuler=n.inirotEuler||!1;n.inipos=n.inipos||g.evaluator.parser.parse("(0,0,0)");n.endrot=
n.endrot||"(0,0,0)";n.endrotEuler=n.endrotEuler||!1;n.endpos=n.endpos||g.evaluator.parser.parse("(0,0,0)");n.name=n.name||"_descartes_empty_name_"+b++;Object.assign(n,d);n.inirot.match("Euler")&&(n.inirot=n.inirot.replace("Euler",""),n.inirotEuler=!0);n.endrot.match("Euler")&&(n.endrot=n.endrot.replace("Euler",""),n.endrotEuler=!0);n.inirot=n.evaluator.parser.parse(n.inirot);n.endrot=n.evaluator.parser.parse(n.endrot);n.inirotM=new a.Matrix4x4;n.inirotM_X=new a.Matrix4x4;n.inirotM_Y=new a.Matrix4x4;
n.inirotM_Z=new a.Matrix4x4;n.iniposM=new a.Matrix4x4;n.endrotM=new a.Matrix4x4;n.endrotM_X=new a.Matrix4x4;n.endrotM_Y=new a.Matrix4x4;n.endrotM_Z=new a.Matrix4x4;n.endposM=new a.Matrix4x4;n.graphics=[];g=g.lessonParser;var h=new a.Tokenizer;if(void 0==n.expresion)return n;"'"!==n.expresion.charAt(0)&&(n.expresion="'"+n.expresion+"'");n.expresion=n.evaluator.parser.parse(n.expresion);d=n.evaluator.eval(n.expresion);if(d)var l=(l=document.getElementById(d))&&"descartes/macro"==l.type?l.text:a.openFile(d);
if(l){var q=a.convertHTMLEntities(l).replace(/\r/g,"").split("\n");l=[];d=0;for(var m=q.length;d<m;d++){var r=q[d].indexOf("=");if(-1!==r){r=g.split(q[d]);for(var p=0,k=r.length;p<k;p++)if(r[p]&&1<r.length&&("id"===e[r[p][0]]||"type"===e[r[p][0]])){l.push(r);break}}}d=0;for(m=l.length;d<m;d++){k=(p=l[d]||[],p[0])&&"id"===p[0][0];var z=!1;q=0;for(r=p.length;q<r;q++){var w=p[q][0].indexOf(".");-1===w||k?w=e[p[q][0]]:(w=e[p[q][0].substring(w+1)],p[q][0]=n.name+"."+p[q][0]);"type"===w&&"surface"===e[p[q][1]]&&
(z=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==p[q][1].charAt(0)||"file"===w&&p[q][1].match(c)||"id"!==w&&void 0!==e[p[q][1]])||"width"===w||"height"===w||"length"===w)if(z&&"expresion"===w){var y=p[q][1].split(" ");for(var A="",F=0,E=y.length;F<E;F++){for(var G=y[F].replace(/&squot;/g,"'").split(";"),J=0,D=G.length;J<D;J++){w=h.tokenize(G[J].replace(/\\n/g,";"));for(var B=0,I=w.length;B<I;B++)if("identifier"===w[B].type&&!(a.reservedIds+
"-x-y-z-u-v-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=n.name+"."+w[B].value;G[J]=h.flatTokens(w)}A+=G.join(";")+" "}p[q][1]=A}else if("text"==w)if(p[q][1].match(/\{\\rtf1/)){w=p[q][1];var L=n;y=function(b,d){d=h.tokenize(d.replace(/&squot;/g,"'"));for(var c=0,k=d.length;c<k;c++)if("identifier"==d[c].type&&!a.reservedIds.match("-"+d[c].value+"-")||"R"===d[c].value||"G"===d[c].value||"B"===d[c].value)d[c].value=L.name+"."+d[c].value;return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+h.flatTokens(d)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,y);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,y);p[q][1]=w}else{y=g.parseText(p[q][1]).textElementsMacros;A=0;for(F=y.length;A<F;A++){w=h.tokenize(y[A].replace(/&squot;/g,"'"));E=0;for(G=w.length;E<G;E++)if("identifier"===w[E].type&&!a.reservedIds.match("-"+w[E].value+"-")||"R"===w[E].value||"G"===w[E].value||"B"===w[E].value)w[E].value=n.name+"."+w[E].value;
w=h.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");y[A]=w.substring(1,w.length-1)}p[q][1]=y.join("")}else{G=p[q][1].replace(/&squot;/g,"'").split(";");J=0;for(D=G.length;J<D;J++){w=h.tokenize(G[J].replace(/\\n/g,";"));B=0;for(I=w.length;B<I;B++)if("identifier"===w[B].type&&!(a.reservedIds+"-Euler-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=n.name+"."+w[B].value;G[J]=h.flatTokens(w)}p[q][1]=G.join(";")}}}d=0;for(m=
l.length;d<m;d++)if(l[d][0]){p="";k=!1;q=0;for(r=l[d].length;q<r;q++)"type"===e[l[d][q][0]]&&f.match("-"+e[l[d][q][1]]+"-")&&(k=!0),p=p+l[d][q][0]+"='"+l[d][q][1]+"' ";l[d]=p+(k?" space='"+n.spaceID+"'":"");k?n.graphics.push(g.parse3DGraphic(l[d],n.abs_coord,n.background,n.inirot)):g.parseAuxiliar(l[d])}}d=0;for(m=n.graphics.length;d<m;d++)n.graphics[d].macroChildren=!0;return n};$jscomp.inherits(g,a.Graphic);g.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();
var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var b=0,c=this.fSteps;b<=c;b++)evaluator.setVariable(this.family,this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};g.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};g.prototype.updateMacro=function(){this.updateTransformation();
if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var b=this.graphics.length;a<b;a++)r=this.graphics[a],r.macro_inirotEuler=this.inirotEuler,r.macro_inirotM=this.inirotM,r.macro_inirotM_X=this.inirotM_X,r.macro_inirotM_Y=this.inirotM_Y,r.macro_inirotM_Z=this.inirotM_Z,r.macro_iniposM=this.iniposM,r.macro_endrotEuler=this.endrotEuler,r.macro_endrotM=this.endrotM,r.macro_endrotM_X=this.endrotM_X,r.macro_endrotM_Y=this.endrotM_Y,r.macro_endrotM_Z=
this.endrotM_Z,r.macro_endposM=this.endposM,r.update();a=0;for(b=this.graphics.length;a<b;a++){r=this.graphics[a];if(r.split||this.split)for(var c=a+1;c<b;c++)l=this.graphics[c],(l.split||this.split)&&r.splitFace(l);this.primitives=this.primitives.concat(r.primitives||[])}};g.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),
this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);tmpExpr=this.evaluator.eval(this.endrot);
this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.endpos);
translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};g.prototype.drawAux=function(a){};a.Macro3D=g;return a}(descartesJS||{},babel);
descartesJS=function(a){function e(a,b,d,c,k){f.call(this,a/p,a/p,a/p,c,k)}function f(a,b,d,c,h){a/=2;b/=2;d/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new k(a,d,b,1),new k(a,-d,b,1),new k(a,d,-b,1),new k(a,-d,-b,1),new k(-a,d,b,1),new k(-a,-d,b,1),new k(-a,d,-b,1),new k(-a,-d,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,d,c,h))}function c(a,b,d,c,h){a/=2;if(!this.changeGeometry(a,b,d,c,h)){var n=2*Math.PI/3,f=2*a*Math.sqrt(2)/3,g=-a/
3,e=f*Math.cos(n)+0*Math.sin(n);n=-f*Math.sin(n)+0*Math.cos(n);this.vertices=[new k(0,0,a,1),new k(e,n,g,1),new k(e,-n,g,1),new k(f,0,g,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,d,c,h)}}function r(a,b,d,c,h){a/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new k(0,0,a,1),new k(a,0,0,1),new k(-a,0,0,1),new k(0,a,0,1),new k(0,-a,0,1),new k(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,d,c,h))}function l(b,
d,c,h,n){b/=Math.PI;if(!this.changeGeometry(b,d,c,h,n)){B=b/1.6180339887;I=1.6180339887*b;this.vertices=[new k(b,b,b,1),new k(b,b,-b,1),new k(b,-b,b,1),new k(b,-b,-b,1),new k(-b,b,b,1),new k(-b,b,-b,1),new k(-b,-b,b,1),new k(-b,-b,-b,1),new k(0,B,I,1),new k(0,B,-I,1),new k(0,-B,I,1),new k(0,-B,-I,1),new k(B,I,0,1),new k(B,-I,0,1),new k(-B,I,0,1),new k(-B,-I,0,1),new k(I,0,B,1),new k(I,0,-B,1),new k(-I,0,B,1),new k(-I,0,-B,1)];L=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(N=this.vertices.length;H<
N;H++)this.vertices[H]=L.multiplyVector4(this.vertices[H]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,d,c,h,n)}}function b(b,d,c,h,n){b/=3.8;if(!this.changeGeometry(b,d,c,h,n)){I=1.6180339887*b;this.vertices=[new k(0,b,I,1),new k(0,b,-I,1),new k(0,-b,I,1),new k(0,-b,-I,1),new k(b,I,0,1),new k(b,-I,0,1),new k(-b,I,0,1),new k(-b,-I,0,1),
new k(I,0,b,1),new k(I,0,-b,1),new k(-I,0,b,1),new k(-I,0,-b,1)];this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];L=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);H=0;for(N=this.vertices.length;H<N;H++)this.vertices[H]=L.multiplyVector4(this.vertices[H]);this.updateValues(b,d,c,h,n)}}function g(a,b,d,c,h){a/=2;this.isSphere?d=b=a:(b/=2,d/=2);if(!this.changeGeometry(a,
b,d,c,h)){this.vertices=[new k(0,0,b,1)];for(H=1;H<c;H++)for(G=H*u/c,C=0;C<h;C++)E=C*x/h,y=a*v(G)*q(E),A=d*v(G)*v(E),F=b*q(G),this.vertices.push(new k(y,A,F,1));this.vertices.push(new k(0,0,-b,1));this.faces=[];for(H=0;H<h;H++)this.faces.push([0,(H+1)%h+1,H%h+1]);for(H=1;H<c-1;H++)for(C=0;C<h;C++)this.faces.push([C+1+(H-1)*h,(C+1)%h+1+(H-1)*h,(C+1)%h+1+H*h,C+1+H*h]);for(H=0;H<h;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-h+H,this.vertices.length-1-h+(H+1)%h]);this.updateValues(a,
b,d,c,h)}}function m(a,b,d,c,h){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h;H++)for(C=0;C<c;C++)y=a*(h-H)/h*q(C*x/c),A=d*(h-H)/h*v(C*x/c),F=b-2*H*b/h,this.vertices.push(new k(y,A,F,1));this.vertices.push(new k(0,0,-b,1));this.faces=[];for(H=0;H<h-1;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,(C+1)%c+H*c,(C+1)%c+(H+1)*c,C+(H+1)*c]);for(H=0;H<c;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-c+H,this.vertices.length-1-c+(H+1)%c]);this.updateValues(a,
b,d,c,h)}}function d(a,b,d,c,h){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<c;C++)y=a*q(C*x/c),A=d*v(C*x/c),F=b-2*H*b/h,this.vertices.push(new k(y,A,F,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,(C+1)%c+H*c,(C+1)%c+(H+1)*c,C+(H+1)*c]);this.updateValues(a,b,d,c,h)}}function n(a,b,d,c,h){a/=2;b/=2;d/=2;J=z.eval(this.R);D=z.eval(this.r);if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<c;C++)y=
-(J+D*v(x*C/c))*v(x*H/h),A=(J+D*v(x*C/c))*q(x*H/h),F=D*q(x*C/c),this.vertices.push(new k(y,A,F,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,C+(H+1)*c,(C+1)%c+(H+1)*c,(C+1)%c+H*c]);this.updateValues(a,b,d,c,h)}}function h(){this.vertices=[];this.faces=[];H=0;for(N=this.fileData.length;H<N;H++)M=this.fileData[H],M.match(/^V\(/)?(O=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new k(O[0]||0,O[1]||0,O[2]||0,1))):M.match(/^F\(/)&&(O=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var v=Math.sin,q=Math.cos,u=Math.PI,x=2*u,p=Math.sqrt(3),k,z,w,y,A,F,E,G,J,D,B,I,L,M,O,H,N,C,Q,K=function(q,p){p=a.Graphic3D.call(this,q,p)||this;p.width=p.width||q.evaluator.parser.parse("2");p.height=p.height||q.evaluator.parser.parse("2");p.length=p.length||q.evaluator.parser.parse("2");p.R=p.R||q.evaluator.parser.parse("2");p.r=p.r||q.evaluator.parser.parse("1");k=a.Vector4D;switch(p.subType){case "cube":p.buildGeometry=
e;break;case "box":p.buildGeometry=f;break;case "tetrahedron":p.buildGeometry=c;break;case "octahedron":p.buildGeometry=r;break;case "sphere":p.isSphere=!0;case "ellipsoid":p.buildGeometry=g;break;case "dodecahedron":p.buildGeometry=l;break;case "icosahedron":p.buildGeometry=b;break;case "cone":p.buildGeometry=m;break;case "cylinder":p.buildGeometry=d;break;case "torus":p.buildGeometry=n;break;case "mesh":p.fileData=a.openFile(p.evaluator.eval(p.file)).split(/\r/),p.buildGeometry=h}return p};$jscomp.inherits(K,
a.Graphic3D);K.prototype.buildPrimitives=function(){z=this.evaluator;this.updateMVMatrix();this.buildGeometry(z.eval(this.width),z.eval(this.height),z.eval(this.length),z.eval(this.Nu),z.eval(this.Nv));var b=this.color.getColor(),d=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";H=0;for(N=this.faces.length;H<N;H++){w=[];C=0;for(Q=this.faces[H].length;C<Q;C++)w.push(this.transformVertex(this.vertices[this.faces[H][C]]));this.primitives.push(new a.Primitive3D({vertices:w,type:"face",
frontColor:b,backColor:d,edges:c,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,b,d,c,k){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===d&&this.oldNu===c&&this.oldNv===k};K.prototype.updateValues=function(a,b,d,c,k){this.oldWidth=a;this.oldHeight=b;this.oldLength=d;this.oldNv=k;this.oldNu=c};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.max,f=Math.min,c=Math.PI,r=Math.cos,l=Math.sin,b=Math.abs,g=Math.round,m,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J,D=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};D.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};D.prototype.copy=function(){return new D(this.x,this.y)};D.prototype.ix=function(){return g(e(f(this.x,32E3),-32E3))};D.prototype.iy=function(){return g(e(f(this.y,32E3),-32E3))};D.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};D.prototype.norm2=function(){return this.x*this.x+this.y*this.y};D.prototype.norm=function(){return Math.sqrt(this.norm2())};D.prototype.distance=function(a){d=this.copy();d.sub(a);return d.norm()};D.prototype.dot=function(a){return this.x*a.x+this.y*a.y};D.prototype.det=function(a){return this.x*a.y-this.y*a.x};D.prototype.mul=function(a){this.x*=a;this.y*=a};D.prototype.div=function(a){this.x/=a;this.y/=a};D.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};D.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};D.prototype.normalize=function(){m=this.norm();0!=m&&this.div(m)};D.prototype.rotR90=function(){m=this.x;this.x=this.y;this.y=-m};D.prototype.rotL90=function(){m=this.x;this.x=-this.y;this.y=m};D.prototype.rot=function(a){n=this.copy();q=r(a);u=l(a);this.x=n.x*q-n.y*u;this.y=n.x*u+n.y*q};D.prototype.rot2=function(a){this.rot(a*c/180)};D.prototype.intersection=function(a,d,c,n){x=d.x-a.x;p=c.x-n.x;k=c.x-a.x;z=d.y-a.y;w=c.y-n.y;y=c.y-a.y;J=x*
w-p*z;return 1E-6<b(J)?(h=(k*w-y*p)/J,v=(-k*z+y*x)/J,0<=h&&1>=h&&0<=v&&1>=v?new D(a.x+x*h,a.y+z*h):null):(d.x-c.x)*y!=(d.y-c.y)*k?null:a.x!=d.x?(A=f(a.x,d.x),F=e(a.x,d.x),A<=c.x&&c.x<=F?c:A<=n.x&&n.x<=F?n:null):c.x!=n.x?(E=f(c.x,n.x),G=e(c.x,n.x),E<=a.x&&a.x<=G?a:E<=d.x&&d.x<=G?d:null):a.y!=d.y?(A=f(a.y,d.y),F=e(a.y,d.y),A<=c.y&&c.y<=F?c:A<=n.y&&n.y<=F?n:null):c.y!=n.y?(E=f(c.y,n.y),G=e(c.y,n.y),E<=a.y&&a.y<=G?a:E<=d.y&&d.y<=G?d:null):a.x==c.x&&a.y==c.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n=function(c,n){this.evaluator=c;this.constraint=n;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];b=
new a.R2(0,0);l=new a.R2(0,0);d=new a.R2(0,0)};n.prototype.getUnitNormal=function(){this.normal.normalize();return d.set(this.normal.x,this.normal.y)};n.prototype.gradient=function(a){e=this.evaluator;b.x=0;b.y=0;g=e.getVariable("x");m=e.getVariable("y");e.setVariable("x",a.x);e.setVariable("y",a.y);this.f0=e.eval(this.constraint);e.setVariable("x",e.getVariable("x")+1E-6);f=e.eval(this.constraint);b.x=(f-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;e.setVariable("x",e.getVariable("x")-1E-6);e.setVariable("y",
e.getVariable("y")+1E-6);f=e.eval(this.constraint);b.y=(f-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;e.setVariable("x",g);e.setVariable("y",m);return b};n.prototype.findZero=function(a,b,d){e=this.evaluator;l.x=a.x;l.y=a.y;g=e.getVariable("x");m=e.getVariable("y");e.setVariable("x",a.x);e.setVariable("y",a.y);this.f0=e.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return l;e.setVariable("x",g);e.setVariable("y",m);for(var h=0;16>h;h++)if(c=l.x,r=l.y,this.normal=
this.gradient(l),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),l.x=c+this.normal.x,l.y=r+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=l.x-a.x,this.normal.y=l.y-a.y),l;return d?l:null};a.R2Newton=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(a,c){this.x=a;this.y=c};e.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};e.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};e.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};e.AXIS_X=new e(1,0);e.AXIS_Y=new e(0,1);a.Vector2D=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=Math.round,c,r,l,b,g,m,d,n,h,v,q,u,x,p=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.parser=b.evaluator.parser;this.id="GraphicControl"!==d.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==d.type?100:350;this.h="Video"!==d.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==d.type&&"Audio"!==d.type&&"Video"!==d.type?"TextArea"!==d.type?this.expresion=c.parse("(0,0,100,23)"):
(this.expresion=c.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=c.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("Scrollbar"==d.gui?"e0e4e8":"222222");this.colorInt="cc0022";"Scrollbar"==d.gui?this.colorInt="182C61":"GraphicControl"!==d.type&&(this.colorInt="f0f8ff");this.colorInt=new a.Color(this.colorInt);this.font_size=c.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=
this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=c.parse("1");this.activeif=c.parse("1");this.valueExpr=c.parse("0");this.decimals=c.parse("2");this.min=c.parse("-Infinity");this.max=c.parse("Infinity");this.incr=c.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,d);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==this.name||
"_nada_"==this.name||"_void_"==this.name?"":this.name;d=this.evaluator.eval(this.expresion);this.x=f(d[0][0]);this.y=f(d[0][1]);4==d[0].length&&(this.w=f(d[0][2]),this.h=f(d[0][3]));this.actionExec=b.lessonParser.parseAction(this)};p.prototype.init=function(){};p.prototype.update=function(){};p.prototype.draw=function(){};p.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,d=a.length;b<d;b++){var c=a[b];if(c.id===this.spaceID)return c.addCtr(this),
this.zIndex=c.zIndex,this.space=c,c.numCtrContainer}else{if("external"===this.region)return this.parent.externalSpace.addCtr(this),this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numCtrContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+
"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);this.zIndex=a[0].zIndex;return a[0].numCtrContainer};p.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};p.prototype.updatePositionAndSize=function(){l=b=g=m=!1;d=this.evaluator.eval(this.expresion);n=f(d[0][0]);l=f(this.x)!==n;this.x=n;n=f(d[0][1]);b=f(this.y)!==n;this.y=n;4===d[0].length&&(n=f(d[0][2]),g=f(this.w)!==n,this.w=
n,n=f(d[0][3]),m=f(this.h)!==n,this.h=n);if(g||m||l||b)this.init(!0,!0),this.draw()};p.prototype.formatOutputValue=function(a){x=this.parent;h=a+"";v=this.evaluator.eval(this.decimals);q=h.indexOf(".");-1!=q&&(u=h.substring(q+1),u.length>v&&(h=parseFloat(h).toFixed(v)));this.fixed&&(2!==x.version||2===x.version&&!this.exponentialif)&&(h=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(h)&&(h=this.fixed&&2!==x.version?parseFloat(h).toExponential(v):parseFloat(h).toExponential(),h=h.toUpperCase().replace("+",
""));return h.replace(".",x.decimal_symbol)};p.prototype.updateAndExecAction=function(){this.parent.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()};p.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);c=b*b;for(a=0;a<b;a++)r=e(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+r*r*192/c/255+")")};a.Control=
p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=Math.abs,c=/[\w\.\-//]*(\.gif)/gi,r,l,b,g,m,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J,D,B,I,L,M,O,H,N,C,Q,K,R,P,S,T=function(b,d){var c=a.Control.call(this,b,d)||this;c.imageSrc=d.imageSrc||"";c.image=d.image||new Image;c.imageOver=d.imageOver||new Image;c.imageDown=d.imageDown||new Image;c.flat=d.flat||!1;c.borderColor=d.borderColor||!1;c.text_align=d.text_align||"center_center";c.image_align=d.image_align||"center_center";c.font_family=a.getFontName(d.font_family||
"arial");c.ratio=b.ratio;-1===c.font_size&&(c.noFSize=!0);c.borderColor&&(c.borderColor=new a.Color(c.borderColor));c.text_align=c.text_align.split("_");c.image_align=c.image_align.split("_");c.old_name=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.classContainer=c.cssClass?" "+c.cssClass+" ":"";c.extra_style=c.imageSrc.trim().match("^_STYLE_")?c.imageSrc.trim().substring(8):c.extra_style||"";c.imageSrc.trim().match("^_STYLE_")&&
(c.imageSrc="vacio.gif");if(c.extra_style){c.customStyle=!0;c.btnStyle=[];c.conStyle=[];c.conStyle.textBorder=3;b=c.extra_style.split("|");for(var k,h=0,n=b.length;h<n;h++)d=b[h],k=d.match(/rgb/g),d.match("class=")?c.classContainer=" "+d.substring(6):d.match("border=")?(c.btnStyle.push({type:"border-style",value:"solid"}),c.btnStyle.push({type:"border-width",value:d.substring(7).trim()+"px"})):d.match("borderRadius=")?(c.btnStyle.push({type:"border-radius",value:d.substring(13).trim()+"px"}),c.conStyle.push({type:"border-radius",
value:d.substring(13).trim()+"px"})):d.match("borderColor=")?c.btnStyle.push({type:"border-color",value:(k?"":"#")+d.substring(12).trim()}):d.match("overColor=")?c.conStyle.overColor=(k?"":"#")+d.substring(10).trim():d.match("downColor=")?c.conStyle.downColor=(k?"":"#")+d.substring(10).trim():d.match("font=")?c.conStyle.font=d.substring(5).trim().toLowerCase():d.match("inactiveColor=")?c.conStyle.inactiveColor=(k?"":"#")+d.substring(14).trim():d.match("inactiveColorBorder=")?c.conStyle.inactiveColorBorder=
(k?"":"#")+d.substring(20).trim():d.match("shadowTextBlur=")?c.conStyle.shadowTextBlur=parseFloat(d.substring(15).trim()):d.match("shadowTextOffsetX=")?c.conStyle.shadowTextOffsetX=parseFloat(d.substring(18).trim()):d.match("shadowTextOffsetY=")?c.conStyle.shadowTextOffsetY=parseFloat(d.substring(18).trim()):d.match("shadowTextColor=")?c.conStyle.shadowTextColor=(k?"":"#")+d.substring(16).trim():d.match("shadowBoxBlur=")?c.conStyle.shadowBoxBlur=parseFloat(d.substring(14).trim()):d.match("shadowBoxOffsetX=")?
c.conStyle.shadowBoxOffsetX=parseFloat(d.substring(17).trim()):d.match("shadowBoxOffsetY=")?c.conStyle.shadowBoxOffsetY=parseFloat(d.substring(17).trim()):d.match("shadowBoxColor=")?c.conStyle.shadowBoxColor=(k?"":"#")+d.substring(15).trim():d.match("shadowInsetBoxBlur=")?c.conStyle.shadowInsetBoxBlur=parseFloat(d.substring(19).trim()):d.match("shadowInsetBoxOffsetX=")?c.conStyle.shadowInsetBoxOffsetX=parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxOffsetY=")?c.conStyle.shadowInsetBoxOffsetY=
parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxColor=")?c.conStyle.shadowInsetBoxColor=(k?"":"#")+d.substring(20).trim():d.match("textBorder=")?c.conStyle.textBorder=parseFloat(d.substring(11).trim()):d.match("flat=")?c.flat=1==parseInt(d.substring(5).trim()):d.match("imgSizeW=")?c.imgSizeW=parseFloat(d.substring(9))||0:d.match("imgSizeH=")&&(c.imgSizeH=parseFloat(d.substring(9))||0)}c.imageSrc.match("_COLORES_")&&(b=c.imageSrc.split("_"),c.colorInt=new a.Color(b[2]),c.color=new a.Color(b[3]),
c.font_size=c.parser.parse(b[5]),c.imageSrc="");c.imageSrc.match(/^\[.*\]?/)?c.imageSrc=c.parser.parse(c.imageSrc.substring(1,c.imageSrc.length-1)):c.imageSrc=c.parser.parse("'"+c.imageSrc+"'");b=c.evaluator.eval(c.imageSrc).toString().trim();if(""!=b)if(d=b.substr(0,b.lastIndexOf(".")),k=b.substr(b.lastIndexOf(".")),b.match(/vacio.gif$/i))c.imageSrc=c.parser.parse("'vacio.gif'"),c.image.ready=1,3===c.parent.version&&(c.name=c.parser.parse("")),c.emptyImage={ready:!0},c.parser.parse("'vacio.gif'");
else if(c.image=c.parent.getImage(b),d)try{c.imageOver=c.parent.getImage(d+"_over"+k),c.imageDown=c.parent.getImage(d+"_down"+k)}catch(X){}c.container=a.newHTML("div",{class:"DescartesButtonContainer"+c.classContainer,id:c.id,style:"width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"});c.btn=a.newHTML("canvas",{width:c.w*c.ratio,height:c.h*c.ratio,style:"position:absolute;left:0;top:0;width:"+c.w+"px;height:"+c.h+"px;"});c.ctx=c.btn.getContext("2d");c.ctx.imageSmoothingEnabled=
!1;c.tooltip&&(c.btn.title=c.tooltip);c.container.appendChild(c.btn);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(T,a.Control);T.prototype.init=function(d){r=this.evaluator;E=this.container;l=this.btn;b=this.ctx;g=r.eval(this.expresion);this.x=g[0][0];this.y=g[0][1];4==g[0].length&&(this.w=parseInt(g[0][2]),this.h=parseInt(g[0][3]));l.width=this.w*this.ratio;l.height=this.h*this.ratio;l.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+
this.h+"px;box-sizing:border-box;");E.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var c=0,k=this.btnStyle.length;c<k;c++)l.style[this.btnStyle[c].type]=this.btnStyle[c].value;if(this.conStyle){c=0;for(k=this.conStyle.length;c<k;c++)E.style[this.conStyle[c].type]=this.conStyle[c].value;if(this.conStyle.shadowBoxColor){c=this.conStyle.shadowBoxOffsetX||0;k=this.conStyle.shadowBoxOffsetY||
2;var h=this.conStyle.shadowBoxBlur||2;E.style.boxShadow=c+"px "+k+"px "+h+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(c=this.conStyle.shadowInsetBoxOffsetX||0,k=this.conStyle.shadowInsetBoxOffsetY||-2,h=this.conStyle.shadowInsetBoxBlur||1,l.style.boxShadow=c+"px "+k+"px "+h+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.noFSize&&(this.font_size=r.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=r.eval(this.font_size);this.createGradient(this.w,
this.h);E.style.display=0<r.eval(this.drawif)?"block":"none";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?
this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(d)};T.prototype.update=function(){r=this.evaluator;E=
this.container;l=this.btn;this.activeIfValue=0<r.eval(this.activeif);this.drawIfValue=0<r.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(E.style.display="block",this.draw(),E.style.cursor=l.style.cursor=this.activeIfValue?"pointer":"not-allowed",E.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(E.style.display="none",this.buttonClick=!1)};T.prototype.draw=function(f){E=this.container;r=this.evaluator;l=this.btn;b=this.ctx;d=r.eval(this.name);this.text_object.draw(a.ctx,
"#000000",0,0);d=this.text_object.textNodes.toStr();n=this.evaluator.eval(this.imageSrc).toString().trim();if(!f&&(G=this.over===this.oldOver,J=this.buttonClick===this.oldButtonClick,D=this.activeIfValue===this.oldActiveIfValue,B=this.drawIfValue===this.oldDrawIfValue,I=d===this.oldName,L=n===this.oldImageSrc,M=this.colorInt.getColor()===this.oldBackColor,O=this.color.getColor()===this.oldTextColor,H=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,
this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=d,this.oldImageSrc=n,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,G&&J&&D&&B&&I&&L&&M&&O&&H))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);m=this.fs_evaluated;E.setAttribute("data-name",d);n?(h="vacio.gif"===n?this.emptyImage:this.parent.getImage(n),N=n.substr(0,n.lastIndexOf(".")),C=n.substr(n.lastIndexOf(".")),Q=N+"_over"+
C,K=N+"_down"+C,R="vacio.gif"===n?this.emptyImage:this.parent.getImage(Q),P="vacio.gif"===n?this.emptyImage:this.parent.getImage(K)):P=R=h=this.emptyImage;b.clearRect(0,0,this.w,this.h);q=u=0;this.buttonClick&&(q=u=1);this.text_object.draw(b,this.color.getColor(),0,0,!0);x=this.text_object.textNodes.metrics.w;p=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?A=e(this.w/2+q)-.5:"left"==this.text_align[1]?A=x/2+5+q:"right"==this.text_align[1]&&(A=this.w-x/2+q-5);"center"==this.text_align[0]?
F=e(this.h/2+u)-.5:"top"==this.text_align[0]?F=p/2+u+4:"bottom"==this.text_align[0]&&(F=this.h-p/2+u-3);if(h){if(k=this.imgSizeW?this.imgSizeW:h.width,z=this.imgSizeH?this.imgSizeH:h.height,"center"==this.image_align[1]?w=parseInt((this.w-k)/2)+q:"left"==this.image_align[1]?w=q:"right"==this.image_align[1]&&(w=this.w-k+q),"center"==this.image_align[0]?y=parseInt((this.h-z)/2)+u:"top"==this.image_align[0]?y=u:"bottom"==this.image_align[0]&&(y=this.h-z+u),h&&h.ready)if(h!==this.emptyImage&&h.complete)if(n.match(c))this.btn.style.backgroundRepeat=
"no-repeat",this.btn.style.backgroundImage="url('"+n+"')",this.btn.style.backgroundPosition=w+"px "+y+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?E.style.backgroundColor=S:(b.fillStyle=S,b.fillRect(0,0,this.w,this.h));b.drawImage(h,0,0,h.width,h.height,w,y,k,z)}else this.emptyImage&&this.customStyle&&(S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&
"CanvasPattern"!==S.constructor.name?E.style.backgroundColor=S:(b.fillStyle=S,b.fillRect(0,0,this.w,this.h)))}else S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?(E.style.backgroundColor=S,this.flat||(this.buttonClick||(this.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),this.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),this.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h))):
(b.fillStyle=S,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(R!==this.emptyImage&&this.over&&R.ready&&R.complete?Q.match(c)?(this.btn.style.backgroundImage="url('"+Q+"')",this.btn.style.backgroundPosition=w+"px "+y+"px"):b.drawImage(R,w,y):this.customStyle&&this.conStyle.overColor&&this.over&&(E.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?P!==this.emptyImage&&this.buttonClick&&P.ready&&P.complete?K.match(c)?(this.btn.style.backgroundImage="url('"+K+"')",this.btn.style.backgroundPosition=
w+"px "+y+"px"):b.drawImage(P,w,y):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(E.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!h&&(b.fillStyle="rgba(0,0,0,0.09)",b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(b.lineWidth=this.conStyle.textBorder,b.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(b.lineWidth=parseInt(m/6),b.strokeStyle=this.borderColor.getColor());
this.text_object.draw(b,this.color.getColor(),A,F);this.underlined&&(b.strokeStyle=this.color.getColor(),b.lineWidth=e(m/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(A-x/2+q,F+e(m/2)+e(m/5)-1.5),b.lineTo(A+x/2+q,F+e(m/2)+e(m/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?E.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=w;this._image_pos_y=y};T.prototype.drawLine=
function(a,b,d,c,k,h,n){a.lineWidth=void 0===n?1:n;a.strokeStyle=void 0===h?"black":h;v=a.lineWidth%2*.5;a.beginPath();a.moveTo(e(b)+v,e(d)+v);a.lineTo(e(c)+v,e(k)+v);a.stroke()};T.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(f(this.colorInt.r-this.color.r)+f(this.colorInt.g-this.color.g)+f(this.colorInt.b-this.color.b))/255)};T.prototype.buttonPressed=function(){this.updateAndExecAction()};T.prototype.addEvents=function(){function b(d,c,n){a.clearTimeout(h);
k.buttonClick&&k.drawIfValue&&k.activeIfValue&&(c.call(k),d=n?d:100,h=a.setTimeout(function(){b(d,c,!1)},d))}function d(d){this.focus();d.preventDefault();d.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();k.whichBtn=a.whichBtn(d);"L"==k.whichBtn&&k.activeIfValue&&(k.buttonClick=!0,k.draw(),"calculate"==k.action&&(k.evaluator.setVariable(k.id,k.evaluator.eval(k.valueExpr)),b(1E3,k.buttonPressed,!0)),k.btn.removeEventListener("touchend",c),k.btn.addEventListener("touchend",
c),k.btn.removeEventListener("mouseup",c),k.btn.addEventListener("mouseup",c))}function c(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(k.activeIfValue||k.buttonClick)k.buttonClick=!1,k.draw(),"calculate"!=k.action&&(k.evaluator.setVariable(k.id,k.evaluator.eval(k.valueExpr)),k.buttonPressed()),k.btn.removeEventListener("touchend",c),k.btn.removeEventListener("mouseup",c);k.parent.update()}var k=this,h;k.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=
!1;this.btn.addEventListener("touchstart",d);this.btn.addEventListener("mousedown",d);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();k.over=!0;k.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=null;b.preventDefault();b.stopPropagation();k.over=!1;k.buttonClick=!1;k.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;k.buttonClick=!1})};a.Button=T;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n,h,v,q,u,x=function(b,d){d=a.Control.call(this,b,d)||this;d.flat=d.image_dec_src&&d.image_inc_src;d.btn_pos=d.btn_pos||"v_left";d.horizontal="h_left"===d.btn_pos||"h_right"===d.btn_pos||"h_left_right"===d.btn_pos;d.label_color=d.label_color||new a.Color("e0e4e8",b.evaluator);d.label_text_color=d.label_text_color||new a.Color("000000",b.evaluator);d.tabindex=++d.parent.tabindex;d.name_str=d.name;d.initial_value=0;try{d.initial_value=
d.evaluator.eval(d.parser.parse(d.valueExprString))}catch(z){console.log(z)}d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name+"'");d.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:d.id});d.divUp=a.newHTML("div",{class:"DJS_Up"});d.divDown=a.newHTML("div",{class:"DJS_Down"});d.field=a.newHTML("input",{type:"text",id:d.id+"_spinner",class:"DescartesSpinnerField",tabindex:d.tabindex});d.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});
d.label_ctx=d.label.getContext("2d");d.ratio=b.ratio;d.container.appendChild(d.label);d.container.appendChild(d.field);d.container.appendChild(d.divUp);d.container.appendChild(d.divDown);d.cover=a.newHTML("div",{class:"TextfieldCover"});d.keyboard&&d.visible&&d.container.appendChild(d.cover);d.addControlContainer(d.container);h=d.evaluator.parser.parse("1");d.originalIncr=d.incr;if(0>d.evaluator.eval(d.decimals)||0===d.evaluator.eval(d.incr))b=d.evaluator.eval(d.incr),0<b?(d.incr=d.evaluator.parser.parse(parseInt(b).toString()),
d.originalIncr=d.incr):d.incr=h;d.image_dec_src&&(d.image_dec_src.match(/^\[.*\]?/)?d.image_dec_src=d.parser.parse(d.image_dec_src.substring(1,d.image_dec_src.length-1)):d.image_dec_src=d.parser.parse("'"+d.image_dec_src+"'"),d.old_image_dec_src=d.evaluator.eval(d.image_dec_src).toString().trim(),d.image_dec=d.parent.getImage(d.old_image_dec_src));d.image_inc_src&&(d.image_inc_src.match(/^\[.*\]?/)?d.image_inc_src=d.parser.parse(d.image_inc_src.substring(1,d.image_inc_src.length-1)):d.image_inc_src=
d.parser.parse("'"+d.image_inc_src+"'"),d.old_image_inc_src=d.evaluator.eval(d.image_inc_src).toString().trim(),d.image_inc=d.parent.getImage(d.old_image_inc_src));d.addEvents();d.init();return d};$jscomp.inherits(x,a.Control);x.prototype.init=function(b,d){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();var c=this.label.textContent;d||(this.value=this.validateValue(e.eval(this.valueExpr)));d=this.formatOutputValue(this.value);this.fieldFontSize=0<e.eval(this.font_size)?e.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var h=2!==this.parent.version?"__":"_____",n=a.getTextWidth(d+
"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){b=parseInt(this.h);var k=parseInt(this.w/2-b);h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(k=this.w-2*b,n=0);k<h&&(k=h);""==c&&(k=0);this.w-k-b<n&&(k=this.w-b-n);0>k&&(k=0);c=this.w-(k+2*b);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;");this.divUp.setAttribute("style","width:"+
b+"px;height:"+b+"px;"+("h_left"===this.btn_pos?"left:"+(k+b):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+b+"px;height:"+b+"px;left:"+(k+("h_right"===this.btn_pos?c:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+(b+k+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;");
this.cover.setAttribute("style","width:"+c+"px;height:"+this.h+"px;left:"+(b+k+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;")}else b=2+parseInt(this.h/2),k=parseInt(this.w/2-b/2),h=a.getTextWidth(c+h,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(k=this.w-b,n=0),k<h&&(k=h),""==c&&(k=0),this.w-k-b<n&&(k=this.w-b-n),0>k&&(k=0),c=this.w-(k+b),this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+
this.zIndex+";background-color:transparent;"),h="width:"+b+"px;left:"+(k+("v_right"===this.btn_pos?c:0))+"px;",this.divUp.setAttribute("style",h+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",h+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;"+(this.flat?"border-width:0;":"")),this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?
b:0)+k)+"px;"),this.cover.setAttribute("style","width:"+c+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?b:0)+k)+"px;");this.field.value=d;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+k+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=k*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&
this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);e.setVariable(this.id,this.value)};x.prototype.update=function(){e=this.evaluator;0>e.eval(this.decimals)?(f=e.eval(this.incr),0<f?this.originalIncr=this.incr=e.parser.parse(parseInt(f).toString()):
this.incr=h):this.incr=0!==e.eval(this.originalIncr)?this.originalIncr:h;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==v&&(this.divDown.style["background-image"]="url("+v+")",this.old_image_dec_src=v));this.image_inc&&(q=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==q&&(this.divUp.style["background-image"]="url("+q+")",this.image_inc_src=q));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(c=this.field.value,r=this.value,this.value=this.validateValue(e.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),
this.value==r&&this.field.value!=c&&(this.value=this.validateValue(c),this.field.value=this.formatOutputValue(this.value)),e.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(u=this.label_color.getColor())||"CanvasGradient"!==u.constructor.name&&"CanvasPattern"!==u.constructor.name||(this.label_ctx.fillStyle=u,this.label_ctx.fillRect(0,
0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};x.prototype.updateStyle=
function(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=
this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"};x.prototype.validateValue=function(a){e=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");l=a==parseFloat(a)?parseFloat(a):parseFloat(e.eval(e.parser.parse(a)));isNaN(l)&&(l=0);
m=e.eval(this.min);d=e.eval(this.max);""===m&&(m=-Infinity);""===d&&(d=Infinity);l=Math.min(Math.max(l,m),d);this.discrete&&(b=e.eval(this.incr),l=0==b?0:this.initial_value+b*Math.round((l-this.initial_value)/b));g=e.eval(this.decimals);0>=g&&(g=0);return l=parseFloat(parseFloat(l).toFixed(g))};x.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};x.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};
x.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};x.prototype.addEvents=function(){function b(d,c,h){a.clearTimeout(q);if(g.up||g.down)c.call(g),d=h?d:10,q=a.setTimeout(function(){b(d,c)},d)}function d(d){d.preventDefault();g.whichBtn=a.whichBtn(d);"L"==g.whichBtn&&g.activeIfValue&&(g.up=!0,b(e,g.increase,!0))}function c(d){d.preventDefault();
g.whichBtn=a.whichBtn(d);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,b(e,g.decrease,!0))}function h(b){g.up=!1;a.clearTimeout(q);g.updateStyle()}function f(b){g.down=!1;a.clearTimeout(q);g.updateStyle()}n=a.hasTouchSupport;var g=this,e=n?500:200,q;g.divUp.oncontextmenu=g.divDown.oncontextmenu=g.field.oncontextmenu=g.label.oncontextmenu=g.cover.oncontextmenu=function(){return!1};this.label.addEventListener("touchstart",a.preventDefault);this.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("keydown",
function(a){13==a.keyCode&&g.changeValue(g.field.value)});this.divUp.addEventListener("touchstart",d);this.divUp.addEventListener("mousedown",d);this.divDown.addEventListener("touchstart",c);this.divDown.addEventListener("mousedown",c);this.divUp.addEventListener("mouseout",function(b){g.up=!1;a.clearTimeout(q);b.preventDefault();g.updateStyle()});this.divDown.addEventListener("mouseout",function(b){g.down=!1;a.clearTimeout(q);b.preventDefault();g.updateStyle()});this.divUp.addEventListener("touchend",
h);window.addEventListener("touchend",h);this.divUp.addEventListener("mouseup",h);window.addEventListener("mouseup",h);this.divDown.addEventListener("touchend",f);window.addEventListener("touchend",f);this.divDown.addEventListener("mouseup",f);window.addEventListener("mouseup",f);document.addEventListener("visibilitychange",function(b){g.up=!1;g.down=!1;a.clearTimeout(q);g.updateStyle()});this.field.addEventListener("blur",function(a){g.drawIfValue&&g.changeValue(g.field.value,!0)});g.field.addEventListener("click",
function(a){this.focus()});g.cover.addEventListener("click",function(a){a=g.evaluator.eval(g.kbexp);g.activeIfValue&&g.parent.keyboard.show(g,g.kblayout,a[0][0]||0,a[0][1]||0,g.id,g.field,g.onlyText)})};a.Spinner=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c=function(c,f){var b=a.Control.call(this,c,f)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.typeCtr="checkbox";b.pressed=f.pressed||!1;b.radio_group=(f.radio_group||"").trim();""!==b.radio_group&&(b.typeCtr="radio");b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+
"'");b.tabindex=++b.parent.tabindex;b.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:b.id});b.checkbox=a.newHTML("input",{type:b.typeCtr,id:b.id+b.typeCtr,class:"DescartesCheckbox",tabindex:b.tabindex});""!==b.radio_group&&b.checkbox.setAttribute("name",b.radio_group);b.checkbox.internalID=b.id;b.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.dummyLabel=a.newHTML("label",{"for":b.id+b.typeCtr});b.value=b.evaluator.eval(b.valueExpr);
b.evaluator.setVariable(b.id,b.value);b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.checkbox);b.containerControl.appendChild(b.dummyLabel);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(c,a.Control);c.prototype.init=function(c){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();this.labelFontSize=0<e.eval(this.font_size)?e.eval(this.font_size):a.getFieldFontSize(this.h);c=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");"right"==this.position?(this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+c+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+c+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+c+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";")):(this.dummyLabel.setAttribute("style",
"position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+c+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";left:"+this.h+"px"));this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.width=c*this.ratio;this.label.height=
this.h*this.ratio;this.update()};c.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==e.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),e.setVariable(this.id,this.value);else{this.value=e.getVariable(this.id);e.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var c=-1;if(this.pressed){for(var b=a.length-1;0<=b;b--)e.setVariable(a[b].internalID,0),a[b].checked=!1;e.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;e.setVariable(this.radio_group,this.id);this.pressed=0}else{for(b=a.length-1;0<=b;b--)c=0!=e.getVariable(a[b].internalID)?b:c,e.setVariable(a[b].internalID,
0),a[b].checked=!1;0<=c&&(e.setVariable(a[c].internalID,1),a[c].checked=!0,e.setVariable(this.radio_group,a[c].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(f=this.label_color.getColor())||"CanvasGradient"!==f.constructor.name&&"CanvasPattern"!==f.constructor.name||
(this.label_ctx.fillStyle=f,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,
0,0,1,0,0)};c.prototype.addEvents=function(){var c=this;c.checkbox.oncontextmenu=c.label.oncontextmenu=c.dummyLabel.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);c.dummyLabel.addEventListener("mousedown",a.preventDefault);c.checkbox.addEventListener("click",function(){c.pressed=!0;c.updateAndExecAction()})};a.Checkbox=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name.trim()+"'");void 0===c.valueExprString&&(c.valueExprString=c.onlyText?"0":"");c.emptyString=!1;c.ok=0;c.tabindex=++c.parent.tabindex;
c.regExpDecimalSymbol=new RegExp("\\"+c.parent.decimal_symbol,"g");if(c.answer)if(c.answer.match("krypto_")&&(c.answer=(new a.Krypto).decode(c.answer.substring(7))),c.answerPattern=c.answer,c.answer=a.buildRegularExpressionsPatterns(c.answer,c.evaluator),c.onlyText){var d=c.answerPattern.indexOf("|");c.firstAnswer=-1==d?c.answerPattern:c.answerPattern.substring(0,d)}else c.firstAnswer=c.parser.parse(c.answerPattern.substring(1,c.answerPattern.indexOf(",")));c.onlyText&&(c.valueExprString.match(/^'/)&&
c.valueExprString.match(/'$/)||(c.valueExpr=c.evaluator.parser.parse("'"+c.valueExprString+"'")),c.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},c.formatOutputValue=function(a){return a.toString()});c.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:c.id});c.field=a.newHTML("input",{type:"text",id:c.id+"TextField",class:"DescartesTextFieldField",tabindex:c.tabindex});c.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.containerControl.appendChild(c.label);c.containerControl.appendChild(c.field);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.containerControl.appendChild(c.cover);c.activoStr=c.id+".activo";c.activeStr=c.id+".active";c.addControlContainer(c.containerControl);c.addEvents();c.init();return c};$jscomp.inherits(m,a.Control);m.prototype.init=function(b){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();
var d=this.label.textContent;b||(this.value=this.validateValue(e.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<e.eval(this.font_size)?e.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,
italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var c=a.getTextWidth(b+"_",this.fieldFontSize+"px "+a.sansserif_font),g=parseInt(this.w/2),f=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(g=this.w,c=0);g<f&&(g=f);""==d&&(g=0);this.w-g<c&&(g=this.w-c);0>g&&(g=0);d=this.w-g;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+
"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+g+"px; font-family:"+("Serif"==this.font_family?a.serif_font:"Monospaced"==this.font_family?a.monospace_font:a.sansserif_font)+";");this.field.value=b;this.cover.setAttribute("style",";width:"+d+"px;height:"+this.h+"px;left:"+g+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+
this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=g*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};m.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=
this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,c=this.value,this.value=this.validateValue(e.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===c&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),e.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,
this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(g=this.label_color.getColor())||"CanvasGradient"!==g.constructor.name&&"CanvasPattern"!==g.constructor.name||(this.label_ctx.fillStyle=g,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};m.prototype.validateValue=function(a){if(""===a||"''"==a)return"";e=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");r=a==parseFloat(a)?parseFloat(a):parseFloat(e.eval(e.parser.parse(a)));isNaN(r)&&(r=0);l=e.eval(this.min);b=e.eval(this.max);
""===l&&(l=-Infinity);""===b&&(b=Infinity);r<l&&(r=l);r>b&&(r=b);this.discrete&&(a=e.eval(this.incr),r=0===a?0:a*Math.round(r/a));return r=parseFloat(parseFloat(r).toFixed(e.eval(this.decimals)))};m.prototype.formatOutputValue=function(b){return""===b?"":a.Control.prototype.formatOutputValue.call(this,b)};m.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,
this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};m.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};m.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};m.prototype.deactivate=function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)};m.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=
b.label.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("mousedown",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update()});this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&
13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()});b.cover.addEventListener("click",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update();a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.TextField=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.abs,f,c,r,l,b,g,m,d,n,h,v,q=function(b,d){function h(b){g.options=b.split(",");g.menuOptions=[];g.strValue=[];b=0;for(var d=g.options.length;b<d;b++){var h=g.customSplit(g.options[b]);1==h.length?(g.menuOptions.push(h[0]),g.strValue.push(b.toString())):2==h.length&&(g.menuOptions.push(h[0]),""==h[1]?g.strValue.push(b.toString()):g.strValue.push(h[1]))}b=0;for(d=g.menuOptions.length;b<d;b++)g.menuOptions[b].match(/^\[/)&&g.menuOptions[b].match(/\]$/)?
g.menuOptions[b]=f.parse(g.menuOptions[b].substring(1,g.menuOptions[b].length-1)):g.menuOptions[b]=f.parse("'"+g.menuOptions[b]+"'");b=0;for(d=g.strValue.length;b<d;b++)g.strValue[b].match(/^\[/)&&g.strValue[b].match(/\]$/)?g.strValue[b]=f.parse(g.strValue[b].substring(1,g.strValue[b].length-1)):g.strValue[b]=f.parse(g.strValue[b]);g.select.innerHTML="";b=0;for(d=g.menuOptions.length;b<d;b++)h=a.newHTML("option"),h.innerHTML=c.eval(g.menuOptions[b]),g.select.appendChild(h);return 0}var k,g=k=a.Control.call(this,
b,d)||this;g.label_color=g.label_color||new a.Color("e0e4e8",b.evaluator);g.label_text_color=g.label_text_color||new a.Color("000000",b.evaluator);g.options=d.options||"";f=g.parser;c=g.evaluator;g.ok=0;g.tabindex=++g.parent.tabindex;g.answer&&(g.answer.match("krypto_")&&(g.answer=(new a.Krypto).decode(g.answer.substring(7))),g.answer=parseInt(g.answer.split(",")[0].replace("[",""))||0);g.name_str=g.name;g.name.match(/^\[.*\]?/)?g.name=g.parser.parse(g.name.substring(1,g.name.length-1)):g.name=g.parser.parse("'"+
g.name+"'");g.evaluator.setFunction(g.id+".setOptions",h);g.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:g.id});g.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});g.label_ctx=g.label.getContext("2d");g.ratio=b.ratio;g.select=a.newHTML("select",{id:g.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:g.tabindex});g.field=a.newHTML("input",{type:"text",id:g.id+"_menuField",class:"DescartesMenuField",tabindex:g.tabindex});h(g.options);g.containerControl.appendChild(g.label);
g.containerControl.appendChild(g.select);g.visible&&g.containerControl.appendChild(g.field);g.cover=a.newHTML("div",{class:"TextfieldCover"});g.keyboard&&g.visible&&g.containerControl.appendChild(g.cover);g.addControlContainer(g.containerControl);g.addEvents();g.init();return k};$jscomp.inherits(q,a.Control);q.prototype.init=function(b){c=this.evaluator;this.label.innerHTML=c.eval(this.name).toString();var d=this.label.textContent;this.fieldFontSize=0<c.eval(this.font_size)?c.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var g=0,h=0;this.value=b?this.value:c.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var f=0,n=this.menuOptions.length;f<n;f++)b=a.getTextWidth(c.eval(this.menuOptions[f]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>g&&(g=b,h=f);g+=25;b=a.getTextWidth(this.formatOutputValue(c.eval(this.strValue[h])),this.fieldFontSize+"px "+a.sansserif_font)+7;h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==d&&(h=0);this.visible||(b=0);for(d=this.w-b-h;d<g&&0<h;)h--,d++;for(;d<g&&0<b;)b--,d++;for(;h+d+b+1<this.w;)d++,
b++;g=h;f=g+d;b=this.w-f;n=this.formatOutputValue(c.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+h+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=h*this.ratio;this.label.height=
this.h*this.ratio;this.field.value=n;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+f+"px;");this.cover.setAttribute("style","width:"+b+"px;height:"+this.h+"px;left:"+f+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+g+"px;");this.select.selectedIndex=this.indexValue;c.setVariable(this.id,parseFloat(n.replace(this.parent.decimal_symbol,".")));this.update()};
q.prototype.update=function(){c=this.evaluator;this.activeIfValue=0<c.eval(this.activeif);this.drawIfValue=0<c.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=(c.eval(this.menuOptions[a])||
"").replace(/\\u002C/g,",");this.value=c.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);c.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/
2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.customSplit=function(a){g=!1;m="";d=0;for(n=-1;d<a.length;){h=a.charAt(d);if("["===h&&-1===n){if(g||""!=m)m+="\u00a6";n++}else"["===h?n++:"]"===h&&0===n?(g=!0,n--):"]"==a.charAt(d)&&(n=0>n?n:n-1);m+=a.charAt(d);d++}return m.split("\u00a6")};q.prototype.getIndex=function(a){a=
parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));r=-1;l=Infinity;for(var d=0,c=this.strValue.length;d<c;d++)b=e(a-parseFloat(this.evaluator.eval(this.strValue[d]))),b<=l&&(l=b,r=d);return r};q.prototype.changeValue=function(a,b){this.activeIfValue&&(b&&(this.indexValue=this.getIndex(a),this.value=this.evaluator.eval(this.strValue[this.indexValue]),this.field.value=this.formatOutputValue(this.indexValue),this.select.selectedIndex=this.indexValue),this.evaluator.setVariable(this.id,
this.value),this.updateAndExecAction())};q.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);b.select.addEventListener("change",function(a){b.value=b.evaluator.eval(b.strValue[this.selectedIndex]);b.field.value=b.formatOutputValue(b.value);b.evaluator.setVariable(b.id,b.field.value);b.changeValue();
a.preventDefault()});b.field.addEventListener("keydown",function(a){13==a.keyCode&&(b.indexValue=b.getIndex(b.field.value),b.value=b.evaluator.eval(b.strValue[b.indexValue]),b.field.value=b.formatOutputValue(b.indexValue),b.select.selectedIndex=b.indexValue,b.changeValue())});b.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){b.field.focus()});b.cover.addEventListener("click",function(a){a=b.evaluator.eval(b.kbexp);
b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.Menu=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f,c,r,l,b,g,m,d,n,h,v,q,u,x,p,k,z,w,y=function(b,d){d=a.Control.call(this,b,d)||this;d.label_color=d.label_color||new a.Color("e0e4e8",b.evaluator);d.label_text_color=d.label_text_color||new a.Color("000000",b.evaluator);d.name_str=d.name;d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name+"'");d.orientation=d.w>=d.h?"h":"v";d.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:d.id});d.canvas=a.newHTML("canvas");d.divUp=a.newHTML("div",{class:"DescartesCatcher up"});d.divDown=a.newHTML("div",{class:"DescartesCatcher down"});d.field=a.newHTML("input",{type:"text",id:d.id+"scrollbar",class:"DescartesScrollbarField"});d.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});d.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});d.label_ctx=d.label.getContext("2d");d.ratio=b.ratio;d.container.appendChild(d.canvas);d.container.appendChild(d.label);d.container.appendChild(d.divUp);
d.container.appendChild(d.divDown);d.container.appendChild(d.field);d.container.appendChild(d.scrollHandler);d.cover=a.newHTML("div",{class:"TextfieldCover"});d.keyboard&&d.visible&&d.container.appendChild(d.cover);d.addControlContainer(d.container);d.addEvents();d.init();return d};$jscomp.inherits(y,a.Control);y.prototype.init=function(){f=this.evaluator;0==f.eval(this.decimals)?this.incr=1:this.incr=(f.eval(this.max)-f.eval(this.min))/100;this.value=this.validateValue(f.eval(this.valueExpr));r=
this.formatOutputValue(this.value);l=this.evaluator.eval(this.expresion);this.x=l[0][0];this.y=l[0][1];4==l[0].length&&(this.w=l[0][2],this.h=l[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(r);this.changeScrollPositionFromValue();this.prePos=this.pos;f.setVariable(this.id,this.value)};y.prototype.initScroll=function(b){c=this;f=c.evaluator;c.label.innerHTML=f.eval(c.name).toString();z=c.label.textContent;var d="v"===c.orientation?parseInt(19+5*(c.h-100)/100):c.h;c.fieldFontSize=0<
f.eval(c.font_size)?f.eval(c.font_size):"v"===c.orientation?d-parseInt(c.h/20)-1:a.getFieldFontSize(d);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},c.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);b=a.getTextWidth(b+"_",c.fieldFontSize+"px "+a.sansserif_font);var h=c.parent.getSpaceById(c.spaceID).h;c.labelHeight=""==z?0:d;c.fieldHeight=""==c.visible?0:d;if("v"===c.orientation)c.canvasWidth=c.w,c.canvasHeight=c.h-c.labelHeight-c.fieldHeight,18<=c.canvasHeight+c.y-h&&(c.canvasHeight=h),d=c.fieldHeight,b=d+c.canvasHeight,c.canvasX=0,c.canvasY=c.fieldHeight,c.labelWidth=c.w,c.labelY=b,c.upWidth=c.downW=c.w,c.upHeight=c.downH=c.w,c.upX=0,c.upY=c.fieldHeight,c.downX=0,c.downY=b-c.downH,
c.fieldWidth=c.w,c.fieldX=0,c.scrollHandlerW=c.w,c.scrollHandlerH=parseInt((c.canvasHeight-c.upHeight-c.downH-c.labelHeight-c.fieldHeight)/10),c.scrollHandlerH=c.canvasHeight-c.upHeight-c.downH-c.labelHeight-c.fieldHeight>2*c.w?c.w:c.scrollHandlerH,c.scrollHandlerH=15>c.scrollHandlerH?15:c.scrollHandlerH,c.limInf=b-c.downH-c.scrollHandlerH,c.limSup=d+c.downH;else{d=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);c.labelWidth=d;c.fieldWidth=b;""==z&&(c.labelWidth=0);c.visible||(c.fieldWidth=
0);for(b=c.w-c.fieldWidth-c.labelWidth;58>b&&0<c.labelWidth;)c.labelWidth--,b++;for(;58>b&&0<c.fieldWidth;)c.fieldWidth--,b++;d=c.labelWidth;h=d+b;c.fieldWidth=c.w-h;c.canvasWidth=b;c.canvasHeight=c.h;c.canvasX=c.labelWidth;c.canvasY=0;c.fieldX=c.canvasWidth+c.labelWidth;c.labelHeight=c.h;c.labelY=0;c.upWidth=c.downW=c.h;c.upHeight=c.downH=c.h;c.upX=h-c.downW;c.upY=0;c.downX=c.labelWidth;c.downY=0;c.scrollHandlerW=parseInt((c.canvasWidth-c.upWidth-c.downW)/10);c.scrollHandlerW=c.canvasWidth-c.upWidth-
c.downW>2*c.h?c.h:c.scrollHandlerW;c.scrollHandlerW=15>c.scrollHandlerW?15:c.scrollHandlerW;c.scrollHandlerH=c.h;c.limInf=d+c.downW;c.limSup=d+c.canvasWidth-c.downW-c.scrollHandlerW}c.container.setAttribute("style","width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.canvas.setAttribute("width",c.w+"px");c.canvas.setAttribute("height",c.h+"px");c.canvas.setAttribute("style","position:absolute;left:0;top:0;");c.ctx=c.canvas.getContext("2d");c.ctx.imageSmoothingEnabled=
!1;c.divUp.setAttribute("style","width:"+c.upWidth+"px;height:"+c.upHeight+"px;left:"+c.upX+"px;top:"+c.upY+"px;");c.divDown.setAttribute("style","width:"+c.downW+"px;height:"+c.downH+"px;left:"+c.downX+"px;top:"+c.downY+"px;");c.scrollHandler.setAttribute("style","width:"+c.scrollHandlerW+"px;height:"+c.scrollHandlerH+"px;left:"+("v"===c.orientation?0:c.limInf)+"px;top:"+("v"===c.orientation?c.limInf:0)+"px;");c.field.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.fieldWidth+"px;height:"+
c.fieldHeight+"px;left:"+c.fieldX+"px;top:0;");c.cover.setAttribute("style","width:"+c.fieldWidth+"px;height:"+c.fieldHeight+"px;left:"+c.fieldX+"px;top:0;");0===c.fieldHeight&&(c.field.style.display="none");c.label.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.labelWidth+"px;height:"+c.labelHeight+"px;line-height:"+c.labelHeight+"px;left:0;top:"+c.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=c.labelWidth*
this.ratio;this.label.height=c.labelHeight*this.ratio};y.prototype.update=function(){f=this.evaluator;0==f.eval(this.decimals)?this.incr=1:this.incr=(f.eval(this.max)-f.eval(this.min))/100;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(f.getVariable(this.id));a==this.value||
0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);f.setVariable(this.id,this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(w=this.label_color.getColor())||"CanvasGradient"!==w.constructor.name&&"CanvasPattern"!==
w.constructor.name||(this.label_ctx.fillStyle=w,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/
this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};y.prototype.draw=function(){c=this;b=c.ctx;m=e(this.w);g=e(this.h);b.fillStyle=this.color.getColor();b.fillRect(0,0,m,g);b.fillStyle="black";b.beginPath();"h"===c.orientation?(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(parseInt(c.labelWidth)+.5,.5,m-1-parseInt(c.labelWidth),g-1),b.lineWidth=Math.ceil(12*c.upWidth/100)||1,b.strokeStyle=c.colorInt.getColor(),b.moveTo(c.downX+62.215*c.upWidth/100,20*c.downH/100),b.lineTo(c.downX+
32.449*c.upWidth/100,c.downH/2),b.lineTo(c.downX+62.215*c.upWidth/100,80*c.downH/100),b.moveTo(c.upX+32.449*c.upWidth/100,20*c.downH/100),b.lineTo(c.upX+62.215*c.upWidth/100,c.downH/2),b.lineTo(c.upX+32.449*c.upWidth/100,80*c.downH/100),b.stroke(),n=e(c.pos),d=Math.ceil(g/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(n+.5,d,e(c.scrollHandlerW),g-2*d)):(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(.5,.5,m-1,g-parseInt(c.labelHeight)-.5),b.lineWidth=Math.ceil(12*c.upWidth/100)||
1,b.strokeStyle=c.colorInt.getColor(),b.moveTo(20*c.upWidth/100,c.h-c.labelHeight-70*c.downH/100),b.lineTo(50*c.upWidth/100,c.h-c.labelHeight-40.237*c.downH/100),b.lineTo(80*c.upWidth/100,c.h-c.labelHeight-70*c.downH/100),b.moveTo(20*c.upWidth/100,c.upY+70*c.downH/100),b.lineTo(50*c.upWidth/100,c.upY+40.237*c.downH/100),b.lineTo(80*c.upWidth/100,c.upY+70*c.downH/100),b.stroke(),n=e(c.pos),d=Math.ceil(m/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(d,n+.5,m-2*d,e(c.scrollHandlerH)));c.activeIfValue||
(b.fillStyle="rgba(255,255,255,0.5)",b.fillRect(0,0,b.canvas.width,b.canvas.height))};y.prototype.validateValue=function(a){f=this.evaluator;h=a.toString();h=parseFloat(h.replace(this.parent.decimal_symbol,"."));isNaN(h)&&(h=0);this.minimo=f.eval(this.min);h<this.minimo&&(this.value=null,h=this.minimo);this.maximo=f.eval(this.max);h>this.maximo&&(this.value=null,h=this.maximo);v=this.incr;h=0!=v?h*v/v:0;this.fixed&&(h=parseFloat(parseFloat(h).toFixed(f.eval(this.decimals))));return h};y.prototype.increase=
function(){this.changeValue(parseFloat(this.value)+this.incr)};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};y.prototype.increase10=function(){d=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+d):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+d)};y.prototype.decrease10=function(){d=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/
10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-d):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-d)};y.prototype.changeValue=function(a){this.activeIfValue&&(q=this.validateValue(a),q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};y.prototype.changeValueForScrollMovement=function(){f=
this.evaluator;u=this.limInf;x=this.limSup;p=f.eval(this.min);k=f.eval(this.max);v=this.incr;q=e((this.pos-u)*(k-p)/(x-u)/v)*v+p;q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),f.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};y.prototype.changeScrollPositionFromValue=function(){f=this.evaluator;u=this.limInf;x=this.limSup;p=f.eval(this.min);k=f.eval(this.max);v=this.incr;this.pos=(this.value-p)*(x-u)/(k-p)+u;this.scrollHandler.style["h"==
this.orientation?"left":"top"]=this.pos+"px"};y.prototype.addEvents=function(){function b(d,c,h,g){a.clearTimeout(r);(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-g)&&(c.call(p),d=h?d:30,r=a.setTimeout(function(){b(d,c,!1,g)},d))}function d(d){d.preventDefault();p.whichBtn=a.whichBtn(d);"L"==p.whichBtn&&p.activeIfValue&&(p.clickPos=a.getCursorPosition(d,p.container),p.canvasClick=!0,"h"==p.orientation?p.clickPos.x<p.prePos?b(350,p.decrease10,!0,p.minimo):b(350,p.increase10,!0,p.maximo):p.clickPos.y<
p.prePos?b(350,p.increase10,!0,p.maximo):b(350,p.decrease10,!0,p.minimo))}function c(b){p.canvasClick=!1;a.clearTimeout(r)}function h(b){1==p.canvasClick&&(p.clickPos=a.getCursorPosition(b,p.container),b.preventDefault())}function g(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",g,!1);window.removeEventListener("mousemove",f,!1);a.preventDefault()}function k(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("touchend",k,!1);window.removeEventListener("touchmove",
f,!1);a.preventDefault()}function f(b){var d=a.getCursorPosition(b,p.container);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-d.x),p.pos<p.limInf&&(p.pos=p.limInf),p.pos>p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.scrollHandlerW+"px;height:"+p.h+"px;left:"+p.pos+"px;top:0;")):(p.pos=p.prePos-(p.initPos.y-d.y),p.pos>p.limInf&&(p.pos=p.limInf),p.pos<p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.w+"px;height:"+p.scrollHandlerH+"px;left:0;top:"+
p.pos+"px;"));p.changeValueForScrollMovement();b.preventDefault()}function n(d){d.preventDefault();p.whichBtn=a.whichBtn(d);"L"==p.whichBtn&&p.activeIfValue&&(p.up=!0,b(350,p.increase,!0,p.maximo))}function e(d){d.preventDefault();p.whichBtn=a.whichBtn(d);"L"==p.whichBtn&&p.activeIfValue&&(p.down=!0,b(350,p.decrease,!0,p.minimo))}function q(b){p.down=!1;a.clearTimeout(r);b.preventDefault()}function l(b){p.up=!1;a.clearTimeout(r);p.draw()}function m(b){p.down=!1;a.clearTimeout(r);p.draw()}var p=this,
r;p.canvas.oncontextmenu=p.divUp.oncontextmenu=p.divDown.oncontextmenu=p.label.oncontextmenu=p.field.oncontextmenu=p.scrollHandler.oncontextmenu=p.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});this.field.addEventListener("blur",function(a){p.drawIfValue&&p.changeValue(p.field.value,!0)});this.canvas.addEventListener("touchstart",d);this.canvas.addEventListener("mousedown",d);this.divDown.addEventListener("mouseout",
q);window.addEventListener("touchend",c);window.addEventListener("mouseup",c);this.canvas.addEventListener("touchmove",h);this.canvas.addEventListener("mousemove",h);this.scrollHandler.addEventListener("touchstart",function(b){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(b,p.container),window.addEventListener("touchend",k),window.addEventListener("touchmove",f),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){p.activeIfValue&&(p.scrollClick=!0,
p.initPos=a.getCursorPosition(b,p.container),window.addEventListener("mouseup",g),window.addEventListener("mousemove",f),b.preventDefault())});this.divUp.addEventListener("touchstart",n);this.divUp.addEventListener("mousedown",n);this.divDown.addEventListener("touchstart",e);this.divDown.addEventListener("mousedown",e);this.divUp.addEventListener("mouseout",function(b){p.up=!1;a.clearTimeout(r);b.preventDefault()});this.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",l);
window.addEventListener("mouseup",l);window.addEventListener("touchend",m);window.addEventListener("mouseup",m);p.cover.addEventListener("click",function(a){a=p.evaluator.eval(p.kbexp);p.activeIfValue&&p.parent.keyboard.show(p,p.kblayout,a[0][0]||0,a[0][1]||0,p.id,p.field,p.onlyText)})};a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f,c,r,l,b,g,m,d,n,h,v,q=function(b,d){d=a.Control.call(this,b,d)||this;d.label_color=d.label_color||new a.Color("e0e4e8",b.evaluator);d.label_text_color=d.label_text_color||new a.Color("000000",b.evaluator);d.name_str=d.name;d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name+"'");d.orientation=d.w>=d.h?"h":"v";d.container=a.newHTML("div",{class:"DescartesSliderContainer",
id:d.id});d.field=a.newHTML("input",{type:"text",id:d.id+"slider",class:"DescartesSliderField"});d.sliderCtr=a.newHTML("input",{type:"range",id:d.id+"range",min:0,max:100,step:"any",class:"DescartesRange"});d.label=a.newHTML("canvas",{class:"DescartesSliderLabel"});d.label_ctx=d.label.getContext("2d");d.ratio=b.ratio;d.container.appendChild(d.label);d.container.appendChild(d.field);d.container.appendChild(d.sliderCtr);d.cover=a.newHTML("div",{class:"TextfieldCover"});d.keyboard&&d.visible&&d.container.appendChild(d.cover);
d.addControlContainer(d.container);d.addEvents();d.init();return d};$jscomp.inherits(q,a.Control);q.prototype.init=function(){f=this.evaluator;this.value=this.validateValue(f.eval(this.valueExpr));r=this.formatOutputValue(this.value);l=this.evaluator.eval(this.expresion);this.x=l[0][0];this.y=l[0][1];4==l[0].length&&(this.w=l[0][2],this.h=l[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initSlider(r);this.changeSliderPositionFromValue();this.prePos=this.pos;f.setVariable(this.id,this.value)};
q.prototype.initSlider=function(b){c=this;f=c.evaluator;c.label.innerHTML=f.eval(c.name).toString();h=c.label.textContent;var d="v"===c.orientation?parseInt(19+5*(c.h-100)/100):c.h;c.fieldFontSize=0<f.eval(c.font_size)?f.eval(c.font_size):"v"===c.orientation?d-parseInt(c.h/20)-1:a.getFieldFontSize(d);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),
font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},c.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);b=a.getTextWidth(b+"_",c.fieldFontSize+"px "+a.sansserif_font);var g=c.parent.getSpaceById(c.spaceID).h;c.labelHeight=""==h?0:d;c.fieldHeight=""==c.visible?0:d;if("v"===c.orientation)c.canvasWidth=c.w,c.canvasHeight=c.h-c.labelHeight-c.fieldHeight,18<=c.canvasHeight+c.y-g&&(c.canvasHeight=g),d=
c.fieldHeight+c.canvasHeight,c.canvasX=0,c.canvasY=c.fieldHeight,c.labelWidth=c.w,c.labelY=d,c.upWidth=c.downW=c.w,c.upHeight=c.downH=c.w,c.fieldWidth=c.w,c.fieldX=0,c.sliderCtr.style="position:absolute;left:0;top:"+c.canvasY+"px;width:"+c.canvasHeight+"px;height:"+c.canvasWidth+"px;transform-origin:"+c.canvasWidth/2+"px "+c.canvasWidth/2+"px;transform:rotate(90deg);margin:0;padding:0;--thumb_size:"+c.canvasWidth+"px;--track_h:"+parseInt(c.canvasWidth/3)+"px;";else{d=this.text_object.textNodes.metrics.w+
parseInt(this.fieldFontSize);c.labelWidth=d;c.fieldWidth=b;""==h&&(c.labelWidth=0);c.visible||(c.fieldWidth=0);for(b=c.w-c.fieldWidth-c.labelWidth;58>b&&0<c.labelWidth;)c.labelWidth--,b++;for(;58>b&&0<c.fieldWidth;)c.fieldWidth--,b++;d=c.labelWidth;c.fieldWidth=c.w-(d+b);c.canvasWidth=b;c.canvasHeight=c.h;c.canvasX=c.labelWidth;c.canvasY=0;c.fieldX=c.canvasWidth+c.labelWidth;c.labelHeight=c.h;c.labelY=0;c.upWidth=c.downW=c.h;c.upHeight=c.downH=c.h;c.sliderCtr.style="position:absolute;left:"+c.canvasX+
"px;top:0;width:"+c.canvasWidth+"px;height:"+c.canvasHeight+"px;margin:0;padding:0;--thumb_size:"+c.canvasHeight+"px;--track_h:"+parseInt(c.canvasHeight/3)+"px;"}c.container.setAttribute("style","width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.field.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.fieldWidth+"px;height:"+c.fieldHeight+"px;left:"+c.fieldX+"px;top:0;");c.cover.setAttribute("style","width:"+c.fieldWidth+"px;height:"+c.fieldHeight+
"px;left:"+c.fieldX+"px;top:0;");0===c.fieldHeight&&(c.field.style.display="none");c.label.setAttribute("style","font-size:"+c.fieldFontSize+"px;width:"+c.labelWidth+"px;height:"+c.labelHeight+"px;line-height:"+c.labelHeight+"px;left:0;top:"+c.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=c.labelWidth*this.ratio;this.label.height=c.labelHeight*this.ratio};q.prototype.update=function(){f=this.evaluator;this.activeIfValue=
0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(f.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeSliderPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);f.setVariable(this.id,
this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?
(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.draw=function(){c=this;this.sliderCtr.style.setProperty("--track_color",this.color.getColor());this.sliderCtr.style.setProperty("--thumb_color",
this.colorInt.getColor());this.sliderCtr.value=this.pos};q.prototype.validateValue=function(a){f=this.evaluator;b=a.toString();b=parseFloat(b.replace(this.parent.decimal_symbol,"."));isNaN(b)&&(b=0);this.minimo=f.eval(this.min);b<this.minimo&&(this.value=null,b=this.minimo);this.maximo=f.eval(this.max);b>this.maximo&&(this.value=null,b=this.maximo);g=f.eval(this.incr);b=0!=g?b*g/g:0;this.fixed&&(b=parseFloat(parseFloat(b).toFixed(f.eval(this.decimals))));return b};q.prototype.changeValue=function(a){this.activeIfValue&&
(m=this.validateValue(a),m!=this.value&&(this.value=m,this.field.value=this.formatOutputValue(m),this.changeSliderPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};q.prototype.changeValueForSliderMovement=function(){f=this.evaluator;d=f.eval(this.min);n=f.eval(this.max);g=f.eval(this.incr);m=e(this.pos*(n-d)/100/g)*g+d;m!=this.value&&(this.value=m,this.field.value=this.formatOutputValue(m),f.setVariable(this.id,this.value),this.parent.updateControls(),
this.actionExec.execute(),this.parent.update())};q.prototype.changeSliderPositionFromValue=function(){f=this.evaluator;d=f.eval(this.min);n=f.eval(this.max);g=f.eval(this.incr);this.pos=100*(this.value-d)/(n-d)};q.prototype.addEvents=function(){var a=this;a.label.oncontextmenu=a.field.oncontextmenu=a.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(b){13==b.keyCode&&a.changeValue(a.field.value)});this.field.addEventListener("blur",function(b){a.drawIfValue&&
a.changeValue(a.field.value,!0)});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)});a.sliderCtr.addEventListener("input",function(b){a.pos=b.target.value;a.changeValueForSliderMovement()})};a.Slider=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c=function(c,f){var b=a.Control.call(this,c,f)||this;b.controls=f.controls||!0;b.file=f.file||"";b.oldDrawIf=0;c=b.evaluator.eval(b.expresion);4==c[0].length?(b.w=c[0][2],b.h=c[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(g){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(g){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(g){}return 0});
b.evaluator.setFunction(b.id+".currentTime",function(a){try{b.audio.currentTime=parseFloat(a)}catch(m){}return 0});b.audio.addEventListener("timeupdate",function(){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime);b.evaluator.setVariable(b.id+".playing",b.audio.paused?0:1);b.evaluator.setVariable(b.id+".duration",b.audio.duration)});return b};$jscomp.inherits(c,a.Control);c.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};c.prototype.update=
function(){e=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=e.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(f=0<e.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",f!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=f;this.updatePositionAndSize()};a.Audio=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c=function(c,f){var b=a.Control.call(this,c,f)||this;b.controls=f.controls||!0;b.file=f.file||"";b.oldDrawIf=0;e=b.evaluator;c=e.eval(b.expresion);4==c[0].length?(b.w=c[0][2],b.h=c[0][3]):(b.w=null,b.h=null);c=b.file;f=c.lastIndexOf(".");-1!=f&&(c=b.file.substring(0,f));b.video=a.newHTML("video",{poster:c+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(f=a.newHTML("source",{src:c+".mp4",type:"video/mp4"}),b.video.appendChild(f));b.video.canPlayType("video/ogg")&&(f=a.newHTML("source",{src:c+".ogg",type:"video/ogg"}),b.video.appendChild(f),f=a.newHTML("source",{src:c+".ogv",type:"video/ogg"}),b.video.appendChild(f));b.video.canPlayType("video/webm")&&
(f=a.newHTML("source",{src:c+".webm",type:"video/webm"}),b.video.appendChild(f));b.addControlContainer(b.video);e.setFunction(b.id+".play",function(){try{b.video.play()}catch(g){}return 0});e.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(g){}return 0});e.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(g){}return 0});e.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(m){}return 0});b.video.addEventListener("timeupdate",
function(a){e.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(c,a.Control);c.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};c.prototype.update=function(){e=this.evaluator;(f=0<e.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",f!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=f;this.updatePositionAndSize()};a.Video=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r=function(c,b){var g=a.Control.call(this,c,b)||this;g.font_family=b.font_family||"sansserif";g.style=b.style||",PLAIN,";g.font_size=b.font_size||12;typeof("number"!==g.font_size)&&(g.font_size=g.evaluator.eval(g.font_size));g.font=g.font_family+g.style+g.font_size;g.evaluator.setVariable(g.id+"._scroll_x",0);g.evaluator.setVariable(g.id+"._scroll_y",0);g.region="interior";g.tabindex=++g.parent.tabindex;if(g.answer){g.answer.match("krypto_")&&
(g.answer=(new a.Krypto).decode(g.answer.substring(7)));var f=g.parent.lessonParser.parseText(g.answer)}g.containerControl=a.newHTML("div",{class:"DescartesTextAreaContainer",id:g.id,spellcheck:"false"});g.textArea=a.newHTML("textarea",{class:"DescartesTextAreaContainer",spellcheck:"false"});g.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});g.showButton=a.newHTML("div",{class:"DJS_Gradient"});g.containerControl.appendChild(g.textArea);g.containerControl.appendChild(g.textAreaAnswer);
g.containerControl.appendChild(g.showButton);g.cover=a.newHTML("div",{class:"TextfieldCover"});g.keyboard&&g.containerControl.appendChild(g.cover);g.addControlContainer(g.containerControl);g.showAnswer=!1;g.text=g.rawText||"";f&&"simpleText"!==f.type&&(g.answer=g.text.hasFormula?"":f.toHTML());g.evaluator.setVariable(g.id,g.text);var d;g.evaluator.setFunction(g.id+".insertAtCursor",function(a){d=g.textArea.selectionStart+a.length;g.textArea.value=g.textArea.value.substring(0,g.textArea.selectionStart)+
a+g.textArea.value.substring(g.textArea.selectionEnd);g.textArea.selectionStart=g.textArea.selectionEnd=d;g.textArea.focus();return 0});g.evaluator.setFunction(g.id+".update",function(){g.update()});g.evaluator.setFunction(g.id+".scrollTo",function(a){g.textArea.scrollTop=a});g.addEvents();g.init();return g};$jscomp.inherits(r,a.Control);r.prototype.init=function(){f=this.answer?28:4;e=this.evaluator;var c=this.text.replace(/\\n/g,"\n");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+
this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var b="padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-f)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",b);this.textArea.value=c;this.textAreaAnswer.setAttribute("style",b+"display:"+(this.showAnswer?"block":"none")+";");this.textAreaAnswer.innerHTML="<span>"+this.answer+"</span>";this.showButton.setAttribute("style",
"width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:"+(this.answer?"block":"none")+";");this.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+a.sansserif_font+';">S</span>';this.cover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:0px;top:0px;");this.update()};r.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=
0<e.eval(this.drawif);e.getVariable(this.id)!==this.oldValue&&(this.textArea.value=(e.getVariable(this.id)||"").replace(/\\n/g,"\n"));c=this.textArea.value||"";c="\n"===c.charAt(c.length-1)?c.substring(0,c.length-1):c;c=c.replace(/\n/g,"\\n").replace(/\s/g," ");e.setVariable(this.id,c);this.oldFieldValue=c;this.oldValue=e.getVariable(this.id);this.activeIfValue?this.textArea.removeAttribute("disabled"):this.textArea.setAttribute("disabled",!0);this.containerControl.style.display=this.drawIfValue?
"block":"none";this.textArea.style["overflow-x"]=0<e.getVariable(this.id+"._scroll_x")?"auto":"unset";this.textArea.style["overflow-y"]=0<e.getVariable(this.id+"._scroll_y")?"auto":"unset";this.updatePositionAndSize()};r.prototype.changeValue=function(a){this.textArea.value=a;this.update()};r.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=this;b.cover.oncontextmenu=function(){return!1};b.showButton.addEventListener("mousedown",function(a){a.preventDefault();b.showAnswer=!b.showAnswer;
b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S"});b.showButton.addEventListener("mouseup",a);b.showButton.addEventListener("mouseout",a);b.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});b.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});b.textArea.addEventListener("keydown",
function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});b.cover.addEventListener("pointerdown",function(a){a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.textArea,!0)})};a.TextArea=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,f,c,r,l,b,g,m,d,n,h,v,q,u=function(b,d){var g=a.Control.call(this,b,d)||this;c=b.evaluator.parser;g.spaceID=d.spaceID||"";g.text=d.text||"";g.size=d.size||c.parse("4");g.font=d.font||"Serif,PLAIN,12";g.image=new Image;g.image.onload=function(){this.ready=1};g.imageSrc=d.imageSrc||"";g.imageSrc.match(/^\[.*\]?/)?g.imageSrc=g.parser.parse(g.imageSrc.substring(1,g.imageSrc.length-1)):g.imageSrc=g.parser.parse("'"+g.imageSrc+"'");g.font=a.convertFont(g.font);
if(g.constraintExpr){g.constraint=c.parse(g.constraintExpr);"(expr)"==g.constraint.type&&(g.constraint=c.parse(g.constraintExpr.substring(1,g.constraintExpr.length-1)));if("compOperator"==g.constraint.type){d=g.constraint.childs[0];var f=g.constraint.childs[1];"identifier"!=d.type||"y"!=d.value||f.contains("y")?"identifier"!=d.type||"x"!=d.value||f.contains("x")?g.newt=new a.R2Newton(g.evaluator,g.constraint):(g.constVar="y",g.noConstVar="x",g.evalConst=g.evalConstXoY,g.constraint=f):(g.constVar=
"x",g.noConstVar="y",g.evalConst=g.evalConstXoY,g.constraint=f)}else g.constraint=null;h=new a.R2(0,0)}g.container=g.getContainer();g.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:g.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+g.zIndex+";"});g.ctx=g.space.ctx;g.container.appendChild(g.mouseCatcher);g.addEvents();g.xStr=g.id+".x";g.yStr=g.id+".y";g.activoStr=g.id+".activo";g.activeStr=g.id+".active";""!==g.space.id&&2!==b.version?(g.mX=
g.space.id+".mouse_x",g.mY=g.space.id+".mouse_y",g.mClicked=g.space.id+".mouse_clicked",g.mClicIzq=g.space.id+".clic_izquierdo"):(g.mX="mouse_x",g.mY="mouse_y",g.mClicked="mouse_clicked",g.mClicIzq="clic_izquierdo");g.init();return g};$jscomp.inherits(u,a.Control);u.prototype.init=function(b){f=this.evaluator;v=a.hasTouchSupport;b||(b=f.eval(this.expresion),this.x=b[0][0],this.y=b[0][1],f.setVariable(this.xStr,this.x),f.setVariable(this.yStr,this.y));this.img_src_eval=f.eval(this.imageSrc).toString().trim();
""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*f.eval(this.size),this.height=2*f.eval(this.size),this._w=v&&48>this.width?48:this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=
this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";f.setVariable(this.activoStr,0);f.setVariable(this.activeStr,0);this.setImage=!1;this.update()};u.prototype.update=function(){f=this.evaluator;f.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=
0<f.eval(this.drawif);this.x=f.getVariable(this.xStr);this.y=f.getVariable(this.yStr);r=this.space.getAbsoluteX(this.x);l=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(r-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(l-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){f=this.evaluator;this.drawIfValue&&(d=this.ctx,n=this.space.backgroundCtx,r=parseInt(this.space.getAbsoluteX(this.x))+
.5,l=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(r,l),this.image.ready?(b=this.image.width/2,g=this.image.height/2,this.image.complete&&!this.setImage&&d.drawImage(this.image,parseInt(r-b),parseInt(l-g)),this.trace&&(n.save(),n.translate(r,l),n.scale(parseInt(b),parseInt(g)),n.beginPath(),n.arc(0,0,1,0,e),n.restore(),n.lineWidth=1,n.strokeStyle=this.trace.getColor(),n.stroke())):(b=parseInt(this.width/2),d.beginPath(),d.arc(r,l,b,0,e),d.fillStyle=this.colorInt.getColor(),
d.fill(),d.lineWidth=1,d.strokeStyle=this.color.getColor(),d.stroke(),this.active&&(d.strokeStyle=this.colorInt.borderColor(),d.beginPath(),d.arc(r,l,b-2,0,e),d.stroke()),this.trace&&(n.strokeStyle=this.trace.getColor(),n.beginPath(),n.arc(r,l,b,0,e),n.stroke())))};u.prototype.evalConst=function(){h.set(this.x,this.y);m=this.newt.findZero(h,1/this.space.scale,!0);this.x=m.x;this.y=m.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};u.prototype.evalConstXoY=
function(){f=this.evaluator;q=f.getVariable(this.constVar);f.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=f.eval(this.constraint);f.setVariable(this.xStr,this.x);f.setVariable(this.yStr,this.y);f.setVariable(this.constVar,q)};u.prototype.drawText=function(a,b){d=this.ctx;f=this.evaluator;"simpleText"==this.text.type?(d.fillStyle=this.color.getColor(),d.font=this.font,d.textBaseline="alphabetic",d.fillText(this.text.toString(f.eval(this.decimals),this.fixed),parseInt(a+1+this.width/
2),parseInt(b-1-this.height/2))):(d.fillStyle=this.color.getColor(),d.strokeStyle=this.color.getColor(),d.textBaseline="alphabetic",this.text.draw(d,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};u.prototype.getContainer=function(){for(var a=this.parent.spaces,b,d=0,c=a.length;d<c;d++)if(b=a[d],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;
this.space=a[0];return a[0].graphicControlContainer};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};u.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();f.whichBtn=a.whichBtn(b);"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=a.getCursorPosition(b,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",d),window.addEventListener("touchmove",c),window.addEventListener("mouseup",d),window.addEventListener("mousemove",c))}function d(b){document.body.focus();
b.preventDefault();b.stopPropagation();f.evaluator.setVariable(f.mClicked,1);f.evaluator.setVariable(f.mClicIzq,1);if(f.activeIfValue||f.active)f.click=!1,window.removeEventListener("mouseup",d),window.removeEventListener("mousemove",c),window.removeEventListener("touchend",d),window.removeEventListener("touchmove",c),h=a.getCursorPosition(b,f.container)||h,f.posX=f.prePos.x-(f.posAnte.x-h.x),f.posY=f.prePos.y-(f.posAnte.y-h.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(h.x)),f.evaluator.setVariable(f.mY,f.space.getRelativeY(h.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";b=f.evaluator.getVariable(f.activeStr);f.parent.deactivateControls();f.parent.updateControls();f.evaluator.setVariable(f.activoStr,b);f.evaluator.setVariable(f.activeStr,b);f.parent.update()}
function c(b){b.preventDefault();f.evaluator.setVariable(f.mClicked,0);f.evaluator.setVariable(f.mClicIzq,0);h=a.getCursorPosition(b,f.container);f.posX=f.prePos.x-(f.posAnte.x-h.x);f.posY=f.prePos.y-(f.posAnte.y-h.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(h.x));f.evaluator.setVariable(f.mY,f.space.getRelativeY(h.y));80<Date.now()-g&&(f.parent.updateControls(),f.parent.update(),
g=Date.now())}var g=0,h,f=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",b);this.mouseCatcher.addEventListener("mousedown",b);this.mouseCatcher.addEventListener("mouseover",function(a){f.over=!0});this.mouseCatcher.addEventListener("mouseout",function(a){f.over=!1;f.click=!1})};a.GraphicControl=u;return a}(descartesJS||{});
descartesJS=function(a,e){var f,c,r,l,b,g,m,d,n,h;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var q=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,u,x,p,k,z,w,y,A,F,E,G,J,D,B,I,L,M,O,H,N,C,Q,K,R,P,S,T,W,V,U=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};U.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var d=0,c=a.length;d<
c;d++)switch(p=a[d][0],k=a[d][1],x=e[p],x){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[x]=parseInt(k);break;case "about":case "config":case "init":case "clear":b[x]="true"===e[k];break;default:console.warn("Propiedad de botones no identificada: <"+p+"> valor: <"+k+">")}return b};U.prototype.parseSpace=function(b){z={};b=this.split(b);for(var d=0,c=b.length;d<c;d++)switch(p=b[d][0],k=b[d][1],x=e[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Space",x){case "type":if("R2"===
k||"R3"===k)k=e[k];z[x]=k;break;case "id":a.DEBUG.idName=k;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":z[x]=k;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":z[x]="true"===e[k];break;case "bg_display":case "render":z[x]=e[k];break;case "border_color":case "net":case "net10":case "axes":case "text":z[x]=""!=k?"false"===e[k]?"":new a.Color(k,this.parent.evaluator):"";break;case "O.x":z.OxExpr=
k;break;case "O.y":z.OyExpr=k;break;case "image":z.imageSrc=k;break;case "x":u=k;"%"===u[u.length-1]?(z.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=k;z.xExpr=this.parser.parse(u);break;case "y":u=k;"%"===u[u.length-1]?(z.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=k;z.yExpr=this.parser.parse(u);break;case "width":u=k.trim();z.wModExpr=u;"%"===u[u.length-1]?(z.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(k),u!=k&&(u=this.parent.container.width,z._w_=k.trim()));z.w=u;break;case "height":u=k.trim();z.hModExpr=u;"%"===u[u.length-1]?(z.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(k),u!=k&&(u=this.parent.container.height,z._h_=k.trim()));z.h=u;break;case "drawif":""!=k&&(z.drawif=this.parser.parse(k));break;case "scale":u=parseFloat(k);isNaN(u)&&(u=48);z.scale=u;break;case "background":z.background=new a.Color(k,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
p+"> valor: <"+k+">")}return new a["Space"+z.type](this.parent,z)};U.prototype.parseControl=function(b){w={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var d=0,c=b.length;d<c;d++)switch(p=b[d][0],k=b[d][1],x=e[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Control",x){case "type":u=e[k.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");w.type=v(u);break;case "gui":u=e[k];"textfield"===u&&(u="TextField");w[x]=v(u);break;case "id":a.DEBUG.idName=k;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":case "info":w[x]=
k;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":w[x]=e[k];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":w[x]="true"===e[k];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":w[x]=new a.Color(k,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
k&&(w[x]=this.parser.parse(k));break;case "constraint":w.constraintExpr=k;break;case "image":w.imageSrc=k;break;case "image_dec":w.image_dec_src=k;break;case "image_inc":w.image_inc_src=k;break;case "space":w.spaceID=k;break;case "expresion":w.expresion=this.parser.parse(k.replace(")(",","));case "kbexp":w.kbexp=this.parser.parse(k.replace(")(",","));break;case "borderColor":w[x]="false"===e[k]?"":k;break;case "bold":"false"!=e[k]&&(w.bold="bold");break;case "italics":"false"!=e[k]&&(w.italics="italic");
break;case "underlined":"false"!=e[k]&&(w.underlined=!0);break;case "value":var g=k.replace(/&squot;/g,"'");g.match(/^\|/)&&(g="'"+g.substring(1),g.match(/\|$/)&&(g=g.substring(0,g.length-1)+"'"));w.valueExpr=this.parser.parse(g);w.valueExprString=g;break;case "incr":0!=k&&(w.incr=this.parser.parse(k));break;case "exponentialif":w.exponentialif=parseFloat(k);break;case "text":w.rawText=k;g=this.parseText(k);for(var h=0,f=g.length;h<f;h++)g[h]=this.parser.parse(g[h],!1);w.text=g;break;default:h=p.indexOf("."),
g=e[p.substring(0,h)],h=e[p.substring(h+1)],"parameter"===g&&"font"===h?w.parameterFont=k:"Explanation"===g&&"font"===h?w.ExplanationFont=k:"tooltip"===g&&"font"===h?w.tooltipFont=k:console.warn("Propiedad de control no identificada: <"+p+"> valor: <"+k+">")}return new a["Numeric"===w.type?w.gui:w.type](this.parent,w)};U.prototype.parseGraphic=function(b,d,c,g){y={rotateExp:g,parameter:"t"};b=this.split(b);g=0;for(var h=b.length;g<h;g++)if(p=b[g][0],k=b[g][1],x=e[p],a.DEBUG.paramName=p,a.DEBUG.objectName=
"Graphic",""!=k)switch(x){case "type":a.DEBUG.idName=k;y[x]=v(e[k]);break;case "align":case "anchor":case "lineDash":y[x]=e[k];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":y[x]="true"===e[k];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":y[x]="false"===e[k]?"":new a.Color(k,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":y[x]=
k;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==k&&(y[x]=this.parser.parse(k));break;case "font_size":k=k.trim();k.match(/^\[.*\]?/)&&(k=k.substring(1,k.length-1));""!==k&&(y[x]=this.parser.parse(k));break;case "space":y.spaceID=k;break;case "expresion":""!==k&&("Macro"!==y.type?(y.expresion=this.parser.parse(k),y.expresionString=k):y.expresion=k);break;
case "text":y.text=k;break;case "file":var f=k.replace(/&squot;/g,"'").trim();"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));f.match(q)&&(f="'"+f+"'");f.startsWith("data:image/")?y.file=this.parser.parse("'"+f+"'"):y.file=this.parser.parse(f);break;case "border":""!=k&&"false"!=e[k]&&(y.border=new a.Color(k,this.parent.evaluator));break;default:if(void 0!=y.family&&p.substring(0,y.family.length+1)===y.family+".")switch(e[p.substring(y.family.length+1)]){case "interval":""!=
k&&(y.family_interval=this.parser.parse(k));break;case "steps":""!=k&&(y.family_steps=this.parser.parse(k))}else if(void 0!=y.parameter&&p.match(y.parameter+"."))switch(y.parameter!==p.substring(0,p.indexOf(y.parameter)+y.parameter.length)&&(y.parameter=p.substring(0,p.indexOf(y.parameter)+y.parameter.length)),e[p.substring(y.parameter.length+1)]){case "interval":""!=k&&(y.parameter_interval=this.parser.parse(k));break;case "steps":""!=k&&(y.parameter_steps=this.parser.parse(k))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+
p+"> valor: <"+k+">")}d&&(y.abs_coord=d);c&&(y.background=c);return new a[y.type](this.parent,y)};U.prototype.parse3DGraphic=function(b,d,c,g){y={rotateExp:g,parameter:"t"};b=this.split(b);d=0;for(c=b.length;d<c;d++)switch(p=b[d][0],k=b[d][1],x=e[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Graphic3D",x){case "type":a.DEBUG.idName=k;u=e[k];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":y.subType=
u,u="OtherGeometry"}y[x]=v(u);break;case "model":case "align":case "anchor":case "lineDash":y[x]=e[k];break;case "shadowColor":case "fill":y[x]="false"===e[k]?"":new a.Color(k,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":y[x]="true"===e[k];break;case "edges":"false"===e[k]?y[x]="":("true"===e[k]&&(k="808080"),y[x]=new a.Color(k,this.parent.evaluator));break;case "border":""!=k&&"false"!=e[k]&&(y.border=new a.Color(k,this.parent.evaluator));
break;case "color":case "backcolor":y[x]=new a.Color(k,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":""!=k&&(y[x]=this.parser.parse(k));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":y[x]=
k;break;case "space":y.spaceID=k;break;case "expresion":"Macro"!=y.type&&"Curve"!=y.type&&"Surface"!=y.type?(y.expresion=this.parser.parse(k),y.expresionString=k):y.expresion=k.replace(/\\n/g,";");break;case "text":y.text=k;break;case "file":g=k.replace(/&squot;/g,"'");"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=g.substring(1,g.length-1));g.match(/./)&&(g="'"+g+"'");y.file=this.parser.parse(g);break;default:void 0!==y.family&&p.substring(0,y.family.length+1)===y.family+"."?"interval"===e[p.substring(y.family.length+
1)]?""!=k&&(y.family_interval=this.parser.parse(k)):""!=k&&(y.family_steps=this.parser.parse(k)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+p+"> valor: <"+k+">")}return new a[y.type+"3D"](this.parent,y)};U.prototype.parseAuxiliar=function(b){A={};b=this.split(b);for(var d=0,c=b.length;d<c;d++)b[d][1]=b[d][1].replace(/&squot;/g,"'");d=0;for(c=b.length;d<c;d++)switch(p=b[d][0],k=b[d][1],x=e[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Auxiliar",x){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=k;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[x]=k.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[x]="true"===e[k];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[x]=this.parser.parse(k);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[x]=
e[k];break;default:var g=p.indexOf("."),h=e[p.substring(0,g)];g=e[p.substring(g+1)];"parameter"===h&&"font"===g?A.parameterFont=k:console.warn("Propiedad del auxiliar no identificada: <"+p+"> valor: <"+k+">")}A.sequence?A.type="sequence":A.constant?A.type="constant":A.algorithm&&A.evaluate?A.type="algorithm":A.array&&!A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="vector":A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="matrix":A.event&&")"!=A.id.charAt(A.id.length-1)?A.type="event":"library"===
A.type?A.type="library":")"===A.id.charAt(A.id.length-1)?A.type="function":A.type="variable";a.DEBUG.typeName=A.type;switch(A.type){case "sequence":new a.Function(this.parent,A);break;case "constant":b=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":b=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,A));break;case "library":new a.Library(this.parent,A);break;case "variable":new a.Variable(this.parent,A);break;default:new a.Function(this.parent,A)}};U.prototype.parseAction=function(b){F=b.action;E=b.parent;G=b.parameter;return F?new (a[v(F)])(E,G):{execute:function(){}}};U.prototype.parseAnimation=function(b){var d={};
b=this.split(b);for(var c=0,g=b.length;c<g;c++)switch(p=b[c][0],k=b[c][1],x=e[p],x){case "id":case "delay":case "init":case "doExpr":case "whileExpr":d[x]=k.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":d[x]="true"===e[k];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+p+">  <"+k+">")}return new a.Animation(this.parent,d)};U.prototype.parsePleca=function(e,q){e=this.split(e);c=f="";r=0;l="#536891";b="white";g=
"left";m="";d="SansSerif,BOLD,20";n="SansSerif,PLAIN,18";h=void 0;for(var u=0,v=e.length;u<v;u++)switch(p=e[u][0],k=e[u][1],p){case "title":f=k;break;case "subtitle":c=k;break;case "subtitlines":r=k;break;case "bgcolor":""!=k&&(l=(new a.Color(k,this.parent.evaluator)).getColor());break;case "fgcolor":""!=k&&(b=(new a.Color(k,this.parent.evaluator)).getColor());break;case "align":""!=k&&(g=k);break;case "titleimage":m=k;break;case "titlefont":d=""!=k?a.convertFont(k):a.convertFont(d);break;case "subtitlefont":n=
""!=k?a.convertFont(k):a.convertFont(n);break;default:console.warn("Propiedad de la pleca no identificada: <"+p+">  <"+k+">")}if(""===f&&""===c)return a.newHTML("div");O=n.substring(0,n.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=m&&(H=this.parent.getImage(m),N=H.height);h=a.newHTML("div",{id:"descartesPleca"});N?(h.setAttribute("style","position:absolute;left:0;top:0;text-align:"+g+";width:"+q+"px;height:"+N+"px;background-color:"+l+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
H.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),h.appendChild(H)):h.setAttribute("style","position:absolute;left:0;top:0;text-align:"+g+";width:"+q+"px;background:"+l+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+d+";overflow:hidden;white-space:nowrap;"});C.innerHTML=f;Q=a.newHTML("div");if(1===parseInt(r)){T=0;K=a.newHTML("div");K.innerHTML=c;document.body.appendChild(K);P=O;do P-=
T,K.setAttribute("style","padding:0;margin:0;font:"+n+";font-size:"+P+"px;width:"+(q-30)+"px;line-height:"+P+"px;"),R=K.offsetHeight,S=R/P,T=1;while(1<S&&8<P);document.body.removeChild(K);Q.setAttribute("style","padding:0;margin:0;font:"+n+";font-size:"+P+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else Q.setAttribute("style","padding:0;margin:0;font:"+n+";line-height:1em;");Q.innerHTML=c;h.appendChild(C);h.appendChild(Q);h.imageHeight=N;return h};U.prototype.split=function(a){if("string"!==
typeof a)return[];J=[];a=(a||"").replace(/\\'/g,"\u2019");D=B=L=0;for(I=M=!1;D<a.length;)" "!==a.charAt(D)||I||D++," "===a.charAt(D)||I||(I=!0,L=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,J[B]=[a.substring(L,D)],L=D+2,D+=2),M&&"'"===a.charAt(D)&&(I=M=!1,J[B].push(a.substring(L,D)),B++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||M||(J[B]=[a.substring(L,D)],L=D+1,D++,W=a.substring(D).indexOf("="),-1===W?V=W=a.length:(W+=D,V=a.substring(D,W).lastIndexOf(" "),V=-1===V?a.length:V+D),J[B].push(a.substring(L,
V)),B++,I=!1,D=V),D++;return J};U.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=U;return a}(descartesJS||{},babel);
descartesJS=function(a){function e(a,d){if(0==d)return 1;if(0>d)return NaN;if(0<=a||b(d)===d)return Math.pow(a,d);if(0>a){var c=1/d,g=b(c);if(g===c&&1===g%2)return-Math.pow(-a,d)}return NaN}function f(a,b){x=[];x.type="matrix";x.rows=a;x.cols=b;k=0;for(z=b;k<z;k++)x[k]=Array(a).fill(0);return x}function c(a,b){q=a.rows;u=a.cols;x=f(q,u);var d;for(k=0;k<q;k++)for(p=0;p<u;p++){for(z=d=0;z<u;z++)d+=a[z][k]*b[p][z];x[p][k]=d}return x}function r(a,b,d){for(var c=f(d.length-1,d.length-1),g=0,h=c.length;g<
h;g++)for(var k=0;k<h;k++)c[g][k]=g<a?k<b?d[g][k]:d[g][k+1]:g<b?d[g+1][k]:d[g+1][k+1];return c}function l(a){if(1<a.cols){for(var b=0,d=1,c=0,g=a.cols;c<g;c++)b+=d*a[0][c]*l(r(0,c,a)),d=-d;return b}return a[0][0]}if(a.loadLib)return a;var b=Math.floor,g={},m,d,n,h,v,q,u,x,p,k,z,w=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};w.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};w.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
w.prototype.replaceLastChild=function(a){n=this.childs.length-1;d=this.childs[n];d.parent=null;this.childs[n]=a;a.parent=this;return a};w.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,d=this.childs.length;b<d;b++)if(this.childs[b].contains(a))return!0;return!1};w.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new w("compOperator","=="),v.addChild(this),v.addChild(new w("number","0")),h=this.getRoot(),h.setAllEvalFun(),
h):this};w.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=0,b=this.childs.length;a<b;a++)if("square_bracket"===this.childs[a].type||"parentheses"===this.childs[a].type)this.childArray=this.childArray.concat(this.childs[a].childs);return this.childArray}return null};w.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};w.prototype.setEvalFun=
function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var d;this.evaluate=function(a,b){d=a.variables[this.value];if("object"===typeof d&&void 0==d.length)return d.evaluate(a);void 0==d&&(b||a.matrices[this.value]?d=a.matrices[this.value]:
a.vectors[this.value]&&(d=a.vectors[this.value]));return void 0!==d?d:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var h;this.evaluate=function(a){try{return h=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==h?h:0}catch(M){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return h=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==h?h:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var n,v,z;this.evaluate=function(a){n=[];for(var b=0,d=this.childs[0].childs.length;b<d;b++)n[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){m=0<n.length?n[0]:0;if("number"==typeof m)return"NaN";m.match(",")&&parseFloat(m.replace(",","."))==m.replace(",",".")&&(m=m.replace(",","."));if(void 0==g[m]){v=m.match(/:=/g)?!0:!1;if(m.match(";")){var c=
!1,h=[],f=0;b=0;for(d=m.length;b<d;b++){var k=m.charAt(b);"'"===k&&(c=!c);c||";"!==k||(h.push(m.substring(f,b)),f=b+1)}h.push(m.substring(f));m="("+h.join(")(")+")"}g[m]=a.parser.parse(m,v)}z=a.eval(g[m]);return void 0!=z?z:NaN}return a.functions[this.value].apply(a,n)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(b){var d=this.childs[0].evaluate(b,!0);b=this.childs[1].evaluate(b,!0);if("matrix"!==d.type||"matrix"!==b.type)return"number"==typeof d&&"string"==typeof b?d=a.removeNeedlessDecimals(d.toString()):
"string"==typeof d&&"number"==typeof b&&(b=a.removeNeedlessDecimals(b.toString())),d+b;q=d.rows;u=d.cols;x=f(q,u);for(k=0;k<q;k++)for(p=0;p<u;p++)x[p][k]=d[p][k]+b[p][k];return x}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b-a;q=b.rows;u=b.cols;x=f(q,u);for(k=0;k<q;k++)for(p=0;p<u;p++)x[p][k]=b[p][k]-a[p][k];return x}:"*"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,
!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:c(b,a)}:"/"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var d=f(a.length,a.length),g=l(a);if(0===g)a=0;else{g=1/g;if(1<a.length)for(var h=0,k=a.length;h<k;h++){var n=g;for(var e=0;e<k;e++)d[e][h]=n*l(r(h,e,a)),n=-n;g=-g}else d[0][0]=g;a=d}b=0===a?f(b.rows,b.cols):c(b,a);return b}:"%"===this.value?this.evaluate=
function(a){var d=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return d-b(d/a)*a}:"^"===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?e(b,a):1/e(b,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+(1E-8>Math.abs(b-a)):+(b===a)}:"!="===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&
"number"==typeof a?+!(1E-8>Math.abs(b-a)):+(b!==a)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):
this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,d=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)d=this.childs[0].childs[0].evaluate(a);
else for(var c=0;c<b;c++){var g=[];for(var h=0,f=this.childs[c].childs.length;h<f;h++)g.push(this.childs[c].childs[h].evaluate(a));d[c]=g}return d};else if("assign"===this.type){var J,w=this.childs[0],B=this.childs[1],I=w.childs[0]?w.childs[0].childs:null;this.evaluate=1===w.childs.length&&"square_bracket"===w.childs[0].type&&1===I.length?function(a){J=B.evaluate(a);a.setVector(w.value,I[0].evaluate(a),J);return J}:1===w.childs.length&&"square_bracket"===w.childs[0].type&&2===I.length?function(a){J=
B.evaluate(a);a.setMatrix(w.value,I[0].evaluate(a),I[1].evaluate(a),J);return J}:function(a){J=B.evaluate(a);return J.type?a.matrices[w.value]=J:"object"!==typeof a.variables[w.value]?a.variables[w.value]=J:0}}};a.Node=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d=/^\s+/,n=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,h=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,q=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,x=/^[\?:]/,p=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,k=/^\[|^\]/,z=/^\(|^\)/,w=/^,/,y=/^;/,A=/\|/g,F=/\|\*/g,E=/\*\|/g,G=/^\/\//g,J=/:\/\//g,D,B=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
I=function(){};I.prototype.tokenize=function(B){function D(a,d,c){f.push({type:a,value:d});b=b.slice(c);r+=c;m=a}if(e=B){B=B.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});B=B.replace(/&sup(.+?);/g,"^$1 ");B=B.replace(/&squot;/g,"'");B.match(/=\|\*/g)&&(B=B.replace(F,"'").replace(E,"'"));B.match(/=\|/g)&&(B=B.replace(A,"'"));var I=B.trim();"|"==I.charAt(0)&&"|"==I.charAt(I.length-1)&&(B=I.replace(A,"'"))}f=[];c=!1;r=0;b=B;for(m="";B&&r<B.length;)if(c=
r,"'"==b[0]){for(g=1;"'"!=b[g];)if(g<b.length)g++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+e+"\u300b");return}l=b.substring(1,g);D("string",l,l.length+2)}else{if(l=b.match(G))if(b.match(J))continue;else{r=2*B.length;break}if(l=b.match(d))b=b.slice(l[0].length),r+=l[0].length;else if(l=b.match(p))l[0]=l[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),D("operator",l[0],l[0].length);else if(l=b.match(n))"number"===m&&f.push({type:"operator",
value:"*"}),D("identifier",l[0],l[0].length);else if(l=b.match(h))D("number",l[0],l[0].length);else if(l=b.match(v))I=l[0],"#"==I&&(I="!="),D("compOperator",I,l[0].length);else if(l=b.match(q))I=l[0],"||"==I?I="|":"&&"==I?I="&":"~"==I&&(I="!"),D("boolOperator",I,l[0].length);else if((l=b.match(u))&&!b.match(/^==/))D("assign",l[0],l[0].length);else if(l=b.match(x))D("conditional",l[0],l[0].length);else if(l=b.match(k))D("square_bracket",l[0],l[0].length);else if(l=b.match(z))"("==l&&"number"===m&&
f.push({type:"operator",value:"*"}),D("parentheses",l[0],l[0].length);else if(l=b.match(w))D("separator",l[0],l[0].length);else if(178===b.charCodeAt(0))f.push({type:"operator",value:"^"}),D("number",2,1);else if(179===b.charCodeAt(0))f.push({type:"operator",value:"^"}),D("number",3,1);else if(l=b.match(y))D("final_of_expression",l[0],l[0].length);else if(c==r){a.DEBUG.setError(a.DEBUG.EXPRESSION,e);return}}return f};I.prototype.flatTokens=function(a,b){a=a||[];b=b||"";D="";for(var d=0,c=a.length;d<
c;d++)D="string"==a[d].type?D+"&squot;"+a[d].value+"&squot;":"identifier"!=a[d].type||a[d].value.match(B)?D+a[d].value:D+b+a[d].value;return D};a.Tokenizer=I;return a}(descartesJS||{});
descartesJS=function(a){function e(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 f(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-_NUM_MAX_ITE_ALG_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-device-dispositivo-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-piso-ceil-techo-round-redondeo-trunc-truncamiento-min-max-_Trace_-_Print_-_Num_-isNumber-esN\u00famero-random-aleatorio-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_SaveSpace_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-DJS.squote-DJS.comma-DJS.w-DJS.h-");
var c=Date.now(),r,l,b,g,m,d,n,h,v,q,u,x,p=function(b){this.evaluator=b;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};p.prototype.setDefinition=function(a,b){this.definitions[a]=b};p.prototype.getDefinition=function(a){return this.definitions[a]};p.prototype.setVariable=function(a,b){this.variables[a]=b};p.prototype.getVariable=function(a){return this.variables[a]};
p.prototype.setVector=function(a,b,d){this.vectors[a][b]=d};p.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};p.prototype.setMatrix=function(a,b,d,c){this.matrices[a][b][d]=c};p.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};p.prototype.setFunction=function(a,b){this.functions[a]=b};p.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||
(this.functions[a]=function(){return 0});return this.functions[a]};p.prototype.parse=function(c,f){(b=this.tokenizer.tokenize(c))||(b=[]);g=null;f=!f||!1;r=h=n=d=0;for(l=b.length;r<l;r++){v=b[r];q=v.value;u=v.type;if("identifier"===u)if(r+1<l&&"parentheses"===b[r+1].type&&"("===b[r+1].value)this.getFunction(q);else if(r+1<l&&"square_bracket"===b[r+1].type&&"["===b[r+1].value)b[r+3]&&"square_bracket"===b[r+3].type&&"]"===b[r+3].value?this.getVector(q):this.getMatrix(q);else{var k=q.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);
k&&(this.variables[(k[1]||k[2]||k[3]||k[4]||k[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(q,!0)}"assign"===u&&f&&":="!=q&&(u="compOperator",q="==");if("assign"===u)if(m=new a.Node(u,q),null!=g)if("identifier"===g.type)g.parent&&g.parent.replaceLastChild(m),m.addChild(g),g=m,f=!0;else if("square_bracket"===g.type)m.addChild(g.parent),g=m,f=!0;else{m.type="compOperator";m.value="==";for(f=!0;g.parent&&e(g.parent.value)>=e(m.value);)g=g.parent;g.parent&&g.parent.replaceLastChild(m);m.addChild(g);
g=m}else{console.info("Error1: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===q||"square_bracket"===u&&"["===q)if(m=new a.Node(u,q),"("===q&&d++,"["===q&&n++,null===g)"("===q&&(new a.Node("(expr)","(expr)")).addChild(m),"["===q&&(new a.Node("[expr]","[expr]")).addChild(m),g=m;else if("operator"===g.type||"boolOperator"===g.type||"compOperator"===g.type||"conditional"===g.type||"assign"===g.type)g.addChild(m),g=m;else if("sign"===
g.type)g.addChild(m),g=m;else if("parentheses"===g.type&&"("===g.value)g.addChild(m),g=m;else if("square_bracket"===g.type&&"["===g.value)g.addChild(m),g=m;else if("parentheses"===g.type&&"()"===g.value)g.parent.addChild(m),g=m;else if("square_bracket"===g.type&&"[]"===g.value)g.parent.addChild(m),g=m;else if("identifier"===g.type)g.addChild(m),g=m;else{console.info("Error2: en la expresi\u00f3n \u300a "+c+" \u300b, en el token ["+r+"] {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&
")"===q)if(d--,null===g)console.info("Error3: en la expresi\u00f3n \u300a "+c+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;g&&g.parent&&("("!=g.value||"("==g.value&&"parentheses"!=g.type);)g=g.parent;if(g&&"("===g.value)g.value="()";else break}else if("square_bracket"===u&&"]"===q)if(n--,null===g)console.info("Error5: en la expresi\u00f3n \u300a "+c+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;g&&g.parent&&("["!=g.value||"["==g.value&&"square_bracket"!=g.type);)g=g.parent;if(g&&
"["===g.value)g.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(m=new a.Node(u,q),null===g)g=m;else if("operator"===g.type||"compOperator"===g.type||"boolOperator"===g.type||"parentheses"===g.type&&"("===g.value||"square_bracket"===g.type&&"["===g.value||"sign"===g.type||"conditional"===g.type||"assign"===g.type)g.addChild(m),g=m;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
c);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(m=new a.Node(u,q),null===g)if("-"===q||"+"===q)m.type="sign",m.value="sign"+q,g=m;else if("!"===q)g=m;else{console.info("Error8: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("operator"===g.type||"compOperator"===g.type||"boolOperator"===g.type||"assign"===g.type||"conditional"===g.type||"square_bracket"===g.type&&"["===g.value&&("-"===q||"+"===q||"!"===q)||"parentheses"===
g.type&&"("===g.value&&("-"===q||"+"===q||"!"===q)){if("-"===q||"+"===q)m.type="sign",m.value="sign"+q;g.addChild(m);g=m}else if("number"===g.type||"parentheses"===g.type&&"()"===g.value||"square_bracket"===g.type&&"[]"===g.value||"string"===g.type||"identifier"===g.type||"conditional"===g.type||"assign"===g.type){for(;g.parent&&e(g.parent.value)>=e(m.value);)g=g.parent;g.parent&&g.parent.replaceLastChild(m);m.addChild(g);g=m}else{console.info("Error9: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+
q+", tipo: "+u+"}");break}else if("conditional"===u)if(m=new a.Node(u,q),null!=g)if("?"===m.value){for(h++;g.parent&&e(g.parent.value)>e(m.value);)g=g.parent;g.parent&&g.parent.replaceLastChild(m);m.addChild(g);g=m}else{for(h--;g&&g.parent&&("?"!=g.value||"?"==g.value&&"conditional"!=g.type);)g=g.parent;if(g&&"?"===g.value)g.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("separator"===u)if(null!=g)for(;g.parent&&"("!=g.value&&"["!=g.value;)g=g.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}0<d&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,c);0>d&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,c);0<n&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
c);0>n&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,c);0!=h&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,c);(x=g?g.getRoot():null)&&x.setAllEvalFun();return x};p.prototype.registerDefaultValues=function(){var b=this;b.variables._NUM_MAX_ITE_ALG_=1E5;b.variables.rnd=Math.random;b.variables.pi=b.variables["\u03c0"]=Math.PI;b.variables.e=Math.E;b.variables.Infinity=Infinity;b.variables["-Infinity"]=-Infinity;b.variables.isTouch=b.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;b.variables.device=b.variables.dispositivo=
function(){var a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"mobile":"desktop"}();Object.defineProperties(b.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});
b.variables["DJS.squote"]="\\u0027";b.variables["DJS.comma"]="\\u002C";b.functions.sqr=function(a){return a*a};b.functions.sqrt=b.functions["ra\u00edz"]=Math.sqrt;b.functions.exp=Math.exp;b.functions.log=Math.log;b.functions.log10=Math.log10?Math.log10:function(a){return Math.log(a)/Math.log(10)};b.functions.abs=Math.abs;b.functions.ent=function(a){return Math.trunc(parseFloat(a)+1E-16*Math.sign(a))};b.functions.sgn=Math.sign;b.functions.ind=function(a){return a?1:0};b.functions.sin=b.functions.sen=
Math.sin;b.functions.cos=Math.cos;b.functions.tan=Math.tan;b.functions.cot=function(a){return 1/Math.tan(a)};b.functions.sec=function(a){return 1/Math.cos(a)};b.functions.csc=function(a){return 1/Math.sin(a)};b.functions.sinh=b.functions.senh=Math.sinh?Math.sinh:function(a){return(Math.exp(a)-Math.exp(-a))/2};b.functions.cosh=Math.cosh?Math.cosh:function(a){return(Math.exp(a)+Math.exp(-a))/2};b.functions.tanh=Math.tanh?Math.tanh:function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};
b.functions.coth=function(a){return 1/b.functions.tanh(a)};b.functions.sech=function(a){return 1/b.functions.cosh(a)};b.functions.csch=function(a){return 1/b.functions.sinh(a)};b.functions.asin=b.functions.asen=Math.asin;b.functions.acos=Math.acos;b.functions.atan=Math.atan;b.functions.atan2=Math.atan2;b.functions.floor=b.functions.piso=Math.floor;b.functions.ceil=b.functions.techo=Math.ceil;b.functions.round=b.functions.redondeo=Math.round;b.functions.trunc=b.functions.truncamiento=Math.trunc;b.functions.min=
Math.min;b.functions.max=Math.max;b.functions._Trace_=b.functions._Print_=function(){console.info.apply(console,arguments);return 0};b.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};b.functions.isNumber=b.functions["esN\u00famero"]=function(a){return Number.isFinite(a)?1:0};b.functions.random=b.functions.aleatorio=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?1:parseFloat(b);a>b&&(b=$jscomp.makeIterator([b,
a]),a=b.next().value,b=b.next().value);return a+Math.random()*(b-a)};b.functions._Stop_Audios_=function(){b.evaluator.parent.stopAudios()};b.functions.esCorrecto=function(d,c,g){return a.esCorrecto(d,c,b.evaluator,g)};b.functions.escorrecto=function(d,c,g){return a.escorrecto(d,c,b.evaluator,g)};window.parent!==window&&(b.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},b.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},
"*");return 0},b.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});b.functions.toFixed=b.functions._NumToStr_=b.functions._NumACadena_=function(a,d){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(d||0)).replace(".",b.evaluator.parent.decimal_symbol)};b.functions.charAt=b.functions._charAt_=b.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};b.functions.substring=
b.functions._substring_=b.functions._subcadena_=function(a,b,d){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);d=isNaN(parseInt(d))?0:parseInt(d);return 0<=b&&0<=d?a.substring(b,d):0>b&&0<=d?a.substring(d):0>d&&0<=b?a.substring(b):""};b.functions.strLength=b.functions._length_=b.functions._longitud_=function(a){return(a||"").toString().length};b.functions.indexOf=b.functions._indexOf_=b.functions["_\u00edndiceDe_"]=function(a,b){return(a||"").toString().indexOf((b||"").toString())};b.functions.lastIndexOf=
function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};b.functions.replace=b.functions._replace_=b.functions._reemplazar_=function(a,b,d){a=(a||"").toString();b=(b||"").toString();d=(d||"").toString();for(var c=a.indexOf(b);0<=c;)a=a.substring(0,c)+d+a.substring(c+b.length),c=a.indexOf(b,c+d.length);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};b.functions.trim=function(a){return(a||
"").toString().trim()};b.functions._Load_=function(b){var d="";b&&(d=(d=document.getElementById(b))&&"descartes/archivo"==d.type?d.text:a.openFile(b));return d||""};b.functions._GetValues_=function(a,d){return b.functions._ExecBlock_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),d)};b.functions._GetMatrix_=function(a,d){return b.functions._StrToMatrix_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),d)};b.functions._MatrixToStr_=function(d){var c=b.matrices[d];
if(c){for(var g="<"+d+">\\n",h=b.getVariable(d+".columnas_usadas")||c.cols||0,f=b.getVariable(d+".filas_usadas")||c.rows||0,n,e=0;e<h;e++){for(var k=0;k<f;k++)n=c[e][k],void 0!==n&&("string"==typeof n?n="'"+n+"'":"number"==typeof n&&(n=a.removeNeedlessDecimals(n.toFixed(6))),g+=n+(k<f-1?" \u00a6 ":""));g=g.replace(/(\u00A6 )$/g,"")+"\\n"}return g+"</"+d+">"}return""};b.functions._StrToMatrix_=function(a,d){var c=[],g=!1,h=!1;c.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var n=
0,e=a.length;n<e;n++)a[n].match("<"+d+">")?(h=!0,g=a[n].trim().split("<"+d+">"),2==g.length&&""!=g[1]&&c.push(g[1].split(String.fromCharCode("166")).map(f)),g=!0):(a[n].match("</"+d+">")&&(g=a[n].trim().split("</"+d+">"),2==g.length&&""!=g[0]&&c.push(g[0].split(String.fromCharCode("166")).map(f)),g=!1,n=a.length),g&&c.push(a[n].split(String.fromCharCode("166")).map(f)));b.matrices[d]=c;b.matrices[d].rows=c&&c[0]&&c[0].length?c[0].length:0;b.matrices[d].cols=c&&c.length?c.length:0;b.setVariable(d+
".filas",b.matrices[d].rows);b.setVariable(d+".columnas",b.matrices[d].cols)}return h?"OK":"ERROR"};b.functions._GetVector_=function(a,d){return b.functions._StrToVector_(b.functions._Load_(a),d)};b.functions._VectorToStr_=function(a){var d=b.vectors[a];if(d){for(var c="<"+a+">\\n",g=b.getVariable(a+".long_usada")||d._size_||0,h,f=0;f<g;f++)h=d[f],void 0!==h?("number"==typeof h&&(h=parseFloat(h)),c+=h+"\\n"):c+="0\\n";return c+"</"+a+">"}return""};b.functions._StrToVector_=function(a,d){var c=[],
g=!1,h=!1;c.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var n=0,e=a.length;n<e;n++)a[n].match("<"+d+">")?g=h=!0:(a[n].match("</"+d+">")&&(g=!1,n=a.length),g&&c.push(f(a[n])));c._size_=c.length;b.vectors[d]=c;b.setVariable(d+".long",c.length);b.setVariable(d+".long_usada",c.length)}return h?"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,d){var c=[],g=""==d;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);
for(var h=0,f=a.length;h<f;h++)a[h].match("<"+d+">")?(g=a[h].trim().split("<"+d+">"),2==g.length&&""!=g[1]&&(c=c.concat(g[1].split(String.fromCharCode("166")))),g=!0):a[h].match("</"+d+">")?(g=a[h].trim().split("</"+d+">"),2==g.length&&""!=g[0]&&(c=c.concat(g[0].split(String.fromCharCode("166")))),g=!1):g&&(c=c.concat(a[h].split(String.fromCharCode("166"))));h=0;for(f=c.length;h<f;h++)g=c[h].split("="),g[0]=g[0].trim(),2==g.length&&""!=g[0]&&(isNaN(parseFloat(g[1]))?b.setVariable(g[0],g[1].replace(/^\s|\s$/g,
"").replace(/^'|'$/g,"")):b.setVariable(g[0],parseFloat(g[1])))}return 0};var d=a.newHTML("a",{target:"_blank"}),g,h=null;a.newBlobContent=null;b.functions._Save_=function(f,n){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(c=Date.now(),document.body.appendChild(d),h=n.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\").replace(/\\br/g,"\\n"),g=new Blob(["\ufeff",h],{type:"text/plain;charset=utf-8"}),d.setAttribute("href",window.URL.createObjectURL(g)),d.setAttribute("download",
f),h!=a.newBlobContent&&(d.click(),a.newBlobContent=h),document.body.removeChild(d));return 0};var n=a.newHTML("a",{target:"_blank"});b.functions._SaveSpace_=function(d,g){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(c=Date.now(),document.body.appendChild(n),h=g,n.setAttribute("href",h),n.setAttribute("download",d),h!=a.newBlobContent&&(n.click(),a.newBlobContent=h),document.body.removeChild(n));return 0};var e,q,l=a.newHTML("input",{type:"file"});l.addEventListener("change",function(d){e=
d.target.files;q=new FileReader;q.onload=function(d){a.addExternalFileContent(e[0].name,d.target.result);b.setVariable("DJS.fileName",e[0].name);b.setVariable("DJS.fileContent",d.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());l.value=""};0<e.length&&q.readAsText(e[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(b._callback=a,l.click(),c=Date.now());return 0};b.functions._AnchoDeCadena_=
b.functions._strWidth_=function(b,d,c,g){return a.getTextWidth(b,a.convertFont(d+","+c+","+g))};b.functions.R=b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/255};b.functions.G=b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};b.functions.B=b.functions._Azul_=b.functions._Blue_=function(b){return(new a.Color(b)).b/255};b.functions.HSV2RGB=function(a,b,d){a=parseInt(a)%360;b*=d;var c=b*(1-Math.abs(a/60%2-1));d-=b;if(0<=a&&60>a){var g=b;var h=
c;var f=0}else 60<=a&&120>a?(g=c,h=b,f=0):120<=a&&180>a?(g=0,h=b,f=c):180<=a&&240>a?(g=0,h=c,f=b):240<=a&&300>a?(g=c,h=0,f=b):300<=a&&360>a&&(g=b,h=0,f=c);g=parseInt(255*(g+d));h=parseInt(255*(h+d));f=parseInt(255*(f+d));return""+g.toString(16).padStart(2,"0")+h.toString(16).padStart(2,"0")+f.toString(16).padStart(2,"0")};b.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=function(c){this.parent=c;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};f.prototype.setDefinition=function(a,f){this.definitions[a]=f};f.prototype.getDefinition=function(a){return this.definitions[a]};f.prototype.setVariable=function(a,f){this.variables[a]=f};f.prototype.getVariable=
function(a){return this.variables[a]};f.prototype.setVector=function(a,f,l){f=0>f?0:e(f);this.vectors[a][f]=l};f.prototype.getVector=function(a,f){f=0>f?0:e(f);return this.vectors[a][f]};f.prototype.setMatrix=function(a,f,l,b){f=0>f?0:e(f);l=0>l?0:e(l);void 0==this.matrices[a][f]&&(this.matrices[a][f]=[]);this.matrices[a][f][l]=b};f.prototype.getMatrix=function(a,f,l){f=0>f?0:e(f);l=0>l?0:e(l);return this.matrices[a][f][l]};f.prototype.setFunction=function(a,f){this.functions[a]=f};f.prototype.getFunction=
function(a){return this.functions[a]};f.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new f;a.Evaluator=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n,h,v,q,u,x,p=function(b,d){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==d;this.textStr=(d||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;d.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=d,this.textNodes=(new a.RTFParser(b.evaluator)).parse(d.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};p.prototype.drawText=function(d,g,h,n,q){e=this.evaluator.eval(this.decimals);f=this.evaluator.eval(this.parent.width);
c=this.evaluator.eval(this.parent.font_size);r=g.getColor?g.getColor():g;l=this.textToString(this.text,e,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=l.indexOf("[")&&(l=this.textToString(this.parseSimpleText(l),e,this.fixed));if(this.oldTextStr!==l||this.oldWidth!==f||this.oldSize!==c||this.oldColor!==r||this.oldPosX!==h||this.oldPoxY!==n)b=new a.TextStyle({size:c,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:r,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(l,this.evaluator,b),this.textNodes.update(h,n,e,this.fixed,this.align,this.anchor,r,f);q||this.textNodes.draw(d);this.oldTextStr=l;this.oldWidth=
f;this.oldSize=c;this.oldColor=r;this.oldPosX=h;this.oldPoxY=n};p.prototype.drawRTF=function(a,b,d,c,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(d,c,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));g||this.textNodes.draw(a)};p.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");g=[];m="'";n=d=0;h=-1;for(u=a.length;d<u;)v=a.charAt(d),q=a.charAt(d-1),"["===v&&"\\"===q?(g.push(a.substring(n,d-1)+"["),n=d+1):"]"===v&&"\\"===q?(g.push(a.substring(n,d-1)+"]"),n=d+1):"["===v&&-1===h?(g.push(a.substring(n,d)),n=d,h++):"["===v?h++:"]"===v&&0===h?(g.push(this.evaluator.parser.parse(a.substring(n,d+1))),n=d+1,h--):("]"==a.charAt(d)&&(h=0>h?h:h-1),m+=a.charAt(d)),d++;g.push(a.substring(n,d));return g};p.prototype.textToString=function(b,d,c){m="";if("rtfNode"!==
b.type)for(var g=0,h=b.length;g<h;g++)"string"===typeof b[g]?m+=b[g]:(x=this.evaluator.eval(b[g])[0][0],""!==x&&("string"===typeof x?m+=x:Infinity===x?m+="Infinity":-Infinity===x?m+="-Infinity":isNaN(x)||"NaN"===x?m+="NaN":(x=parseFloat(x),x=c?x.toFixed(d):a.removeNeedlessDecimals(x.toFixed(d)),m+=x.toString().replace(".",this.decimal_symbol))));return m};a.TextObject=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f=function(){};f.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var c=[],f=null,b=0,g=a.length;a.charAt(0);var m=!1,d=!1,n=0;e="";for(var h=0;h<g;h++){var v=a.charAt(h);var q=a.charAt(h+1);"\\"===v&&"$"===q&&(d=!0);"{"===v?n++:"}"===v&&(n--,d&&0===n&&(d=!1));d?"_"===v?"{"===q?e+="\\subindex":(e+="\\subindex{"+q+"}",h++):"^"===v?"{"===q?e+="\\superindex":(e+="\\superindex{"+q+"}",h++):e+=v:e+=v}a=e;q=a.charAt(0);for(g=a.length;b<
g;)v=q,q=a.charAt(b+1),m&&("{"===v||"["===v||"\\"===v||" "===v?(m=!1," "===v&&(f={type:"ignore"},c.push(f))):f.value+=v),m||"\\"!==v?m||"{"!==v&&"["!==v?m||"}"!==v&&"]"!==v?m||(f&&"text"===f.type?f.value+=v:f&&"ignore"===f.type?(c.pop(),f=c[c.length-1]):(f={type:"text",value:v},c.push(f))):(f={type:"close",value:v},c.push(f)):(f={type:"open",value:v},c.push(f)):(m=!0,f={type:"command",value:""},c.push(f)),b++;return c};a.DescarTeXTokenizer=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(){this.tokenizer=new a.DescarTeXTokenizer};e.prototype.parse=function(f,c,e){f=this.tokenizer.tokenize(f);var l=new a.TextNode("","textBlock",e,null),b=new a.TextNode("","textLineBlock",e.clone(),null);l.addChild(b);for(var g=[],m=void 0,d=e,n=[e],h,r,q,u,x=!1,p=0,k=f.length;p<k;p++)if("text"===f[p].type)if("color_parameter"===m)r=new a.Color(f[p].value,c);else if("text_size_parameter"===m)q=parseFloat(f[p].value);else if("textLineBlock"===
b.nodeType){h=f[p].value.split(" ");for(var z=0,w=h.length;z<w;z++)""!==h[z]&&b.addChild(new a.TextNode(h[z],"text",d.clone(),null)),z+1<w&&b.addChild(new a.TextNode(" ","space",d.clone(),null))}else b.addChild(new a.TextNode(f[p].value,"text",d.clone(),null));else"command"===f[p].type&&"curlyBracketOpen"===f[p].value?b.addChild(new a.TextNode("{","text",d.clone(),null)):"command"===f[p].type&&"curlyBracketClose"===f[p].value?b.addChild(new a.TextNode("}","text",d.clone(),null)):"command"===f[p].type&&
"squareBracketOpen"===f[p].value?b.addChild(new a.TextNode("[","text",d.clone(),null)):"command"===f[p].type&&"squareBracketClose"===f[p].value?b.addChild(new a.TextNode("]","text",d.clone(),null)):"command"===f[p].type&&"newline"===f[p].value?(0===b.children.length&&b.addChild(new a.TextNode("","text",d.clone(),null)),b=new a.TextNode("","textLineBlock",e.clone(),null),l.addChild(b)):"command"===f[p].type&&"b"===f[p].value?(m="bold",g.push(m)):"command"===f[p].type&&"i"===f[p].value?(m="italic",
g.push(m)):"command"===f[p].type&&"o"===f[p].value?(m="overline",g.push(m)):"command"===f[p].type&&"u"===f[p].value?(m="underline",g.push(m)):"command"===f[p].type&&"color"===f[p].value?(m="color",g.push(m)):"command"===f[p].type&&"ts"===f[p].value?(m="text_size",g.push(m)):"command"===f[p].type&&"sansserif"===f[p].value.toLowerCase()?(m="sansserif",g.push(m)):"command"===f[p].type&&"serif"===f[p].value.toLowerCase()?(m="serif",g.push(m)):"command"===f[p].type&&"monospace"===f[p].value.toLowerCase()?
(m="monospace",g.push(m)):"command"===f[p].type&&"c"===f[p].value?(m="center",g.push(m)):"command"===f[p].type&&"l"===f[p].value?(m="left",g.push(m)):"command"===f[p].type&&"r"===f[p].value?(m="right",g.push(m)):"command"===f[p].type&&"j"===f[p].value?(m="justify",g.push(m)):"command"===f[p].type&&"$"===f[p].value?(m="formula",g.push(m),x=!0):"command"===f[p].type&&"sum"===f[p].value?(m="sum",g.push(m)):"command"===f[p].type&&"prod"===f[p].value?(m="prod",g.push(m)):"command"===f[p].type&&"int"===
f[p].value?(m="integral",g.push(m)):"command"===f[p].type&&"lim"===f[p].value?(m="limit",g.push(m)):"command"===f[p].type&&"sqrt"===f[p].value?(m="radical",g.push(m)):"command"===f[p].type&&"subindex"===f[p].value?(m="subIndex",g.push(m)):"command"===f[p].type&&"superindex"===f[p].value?(m="superIndex",g.push(m)):"command"===f[p].type&&"frac"===f[p].value?(m="numerator",g.push(m)):"open"===f[p].type&&"{"===f[p].value&&void 0!==m?"bold"===m||"italic"===m||"overline"===m||"underline"===m?(d=d.clone(),
d[m]=!0,n.push(d)):"sansserif"===m?(d=d.clone(),d.family="sansserif",n.push(d)):"serif"===m?(d=d.clone(),d.family="serif",n.push(d)):"monospace"===m?(d=d.clone(),d.family="monospaced",n.push(d)):"text_size"===m?m="text_size_parameter":"text_size_text"===m?(d=d.clone(),d.size=q,n.push(d)):"color"===m?m="color_parameter":"color_text"===m?(d=d.clone(),d.color=r,n.push(d)):"center"===m||"left"===m||"right"===m||"justify"===m?(d=d.clone(),d.align=m,n.push(d),b=new a.TextNode("","textLineBlock",d.clone(),
null),l.addChild(b)):"formula"===m?(d=d.clone(),n.push(d),u=new a.TextNode("","formula",d.clone(),null),b.addChild(u),b=u):"subIndex"===m||"superIndex"===m?x?(d=d.clone(),n.push(d),u=new a.TextNode("",m,d.clone(),null),b.addChild(u),b=u):b.addChild(new a.TextNode("subIndex"===m?"_":"^","text",d.clone(),null)):"radical"===m?x&&(u=new a.TextNode("","radical",d.clone(),null),b.addChild(u),b=u,d=d.clone(),n.push(d),u=new a.TextNode("","index",d.clone(),null),b.addChild(u),b=u,m="index"):"index"===m?x&&
(n.pop(),d=n[n.length-1],u=new a.TextNode("","radicand",d.clone(),null),b.addChild(u),b=u,m="radicand"):"sum"===m||"integral"===m||"limit"===m||"prod"===m?x&&(u=new a.TextNode("",m,d.clone(),null),b.addChild(u),b=u,d=d.clone(),n.push(d),u=new a.TextNode("","from",d.clone(),null),b.addChild(u),b=u,m="from",g[g.length-1]=m):"from"===m?x&&(u=new a.TextNode("","to",d.clone(),null),b.addChild(u),b=u,m="to",g[g.length-1]=m):"to"===m?x&&(n.pop(),d=n[n.length-1],u=new a.TextNode("","what",d.clone(),null),
b.addChild(u),b=u,m="what",g[g.length-1]=m):"numerator"===m?x&&(u=new a.TextNode("","fraction",d.clone(),null),b.addChild(u),b=u,d=d.clone(),n.push(d),u=new a.TextNode("","numerator",d.clone(),null),b.addChild(u),b=u,m="numerator"):"denominator"===m&&(u=new a.TextNode("",m,d.clone(),null),b.addChild(u),b=u):"close"===f[p].type&&"}"===f[p].value&&void 0!==m&&("bold"===m||"italic"===m||"overline"===m||"underline"===m||"color_text"===m||"color"===m||"text_size_text"===m||"text_size"===m||"sansserif"===
m||"serif"===m||"monospace"===m?(n.pop(),d=n[n.length-1],g.pop(),m=g[g.length-1]):"color_parameter"===m?m="color_text":"text_size_parameter"===m?m="text_size_text":"center"===m||"left"===m||"right"===m||"justify"===m?(n.pop(),d=n[n.length-1],g.pop(),m=g[g.length-1],f[p+1]&&"command"===f[p+1].type&&"newline"===f[p+1].value?b=l:(b=new a.TextNode("","textLineBlock",d.clone(),null),l.addChild(b))):"formula"===b.nodeType?(x=!1,n.pop(),d=n[n.length-1],g.pop(),m=g[g.length-1],b=b.parent):"subIndex"===b.nodeType||
"superIndex"===b.nodeType?x&&(n.pop(),d=n[n.length-1],g.pop(),m=g[g.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(g.pop(),m=g[g.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(g.pop(),m=g[g.length-1],b=b.parent.parent):"numerator"===b.nodeType?(m="denominator",b=b.parent):"denominator"===b.nodeType&&(n.pop(),d=n[n.length-1],g.pop(),m=g[g.length-1],b=b.parent.parent));var y,A,F=null,E=[];l.children.forEach(function(a){for(var b=
0,d=a.children.length;b<d-1;b++)y=a.children[b],A=a.children[b+1],"text"===y.nodeType&&"text"===A.nodeType&&y.style.equals(A.style)?(null===F&&(F=y,u=y.clone(),F.changeNodeType("word"),F.value="___"+u.value,F.addChild(u)),u=A.clone(),F.addChild(u),E.push(A),F.value+=u.value):F=null});E.forEach(function(a){a.parent.removeChild(a)});l.normalize();l.adjustFontSize();return l};a.DescarTeXParser=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f=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)};f.prototype.clone=function(){return new f(Object.assign({},this))};f.prototype.set=function(a){Object.assign(this,a)};f.prototype.equals=function(a){var c=!0,f;for(f in this)this.hasOwnProperty(f)&&(c=c&&this[f]===a[f]);return c};f.prototype.toString=function(c){/arial|sansserif/i.test(this.family)?
e=a.sansserif_font:/times|serif/i.test(this.family)?e=c?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(e=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+e).trim()};a.TextStyle=f;return a}(descartesJS||{});
descartesJS=function(a){function e(a,b){for(var d=0,c=0;c<b;c++)d+=a[c];return d}function f(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 d=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((m[a].ascent+25)*d/m[a].unitsPerEm);b.descent=Math.ceil(Math.abs((m[a].descent-25)*d/m[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var c=!1,r="#000000",l=2,b=!1,g=function(b,c,g,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=b;this.style=g;this.changeNodeType(c);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};g.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=
this.drawTextLineBlock;break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;
case "integral":this.draw=this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};g.prototype.clone=function(){for(var a=new g(this.value,this.nodeType,this.style.clone()),b=0,c=this.children.length;b<c;b++)a.addChild(this.children[b].clone());return a};g.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};g.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,c=this.children.length;b<c;b++)a+=this.children[b].stringify()+(b==c-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};g.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};g.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};g.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};g.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};g.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,c=this.parent.children.length;b<c;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};g.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};g.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var d=0,c=this.children.length;d<c;d++)b=b.concat(this.children[d].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};g.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};g.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};g.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,c=a.length;b<c;b++)0===a[b].children.length&&a[b].addChild(new g("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(c=a.length;b<c;b++){var f=a[b];(null===f.prevSibling()||null!==f.prevSibling()&&"text"!==f.prevSibling().nodeType)&&f.parent.insertBefore(f,
new g("","text",f.parent.style));(null===f.nextSibling()||null!==f.nextSibling()&&"text"!==f.nextSibling().nodeType)&&f.parent.insertAfter(f,new g("","text",f.parent.style))}return this};g.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,c=a.length;b<c;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};g.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var d=0,c=this.children.length;d<c;d++)"text"===this.children[d].nodeType&&
a?(this.children[d].style.size=b,this.children[d].styleString=this.children[d].style.toString()):"index"===this.children[d].nodeType?(this.children[d].style.size=Math.max(parseInt(b-.5*b),8),this.children[d].styleString=this.children[d].style.toString(),this.children[d].adjustFontSize(!0)):"to"===this.children[d].nodeType||"from"===this.children[d].nodeType?(this.children[d].style.size=Math.max(parseInt(b-.2*b),8),this.children[d].styleString=this.children[d].style.toString(),this.children[d].adjustFontSize(!0)):
"numerator"===this.children[d].nodeType||"denominator"===this.children[d].nodeType?(this.children[d].style.size=Math.max(parseInt(b-.1*b),8),this.children[d].styleString=this.children[d].style.toString(),this.children[d].adjustFontSize(!0)):"subIndex"===this.children[d].nodeType||"superIndex"===this.children[d].nodeType?(this.children[d].style.size=Math.max(parseInt(b-.33*b),8),this.children[d].styleString=this.children[d].style.toString(),this.children[d].adjustFontSize(!0)):(a&&(this.children[d].style.size=
b,this.children[d].styleString=this.children[d].style.toString()),this.children[d].adjustFontSize(a))};g.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var d=0,c=this.children.length;d<c;d++)this.children[d].propagateStyle(a,b)};g.prototype.update=function(a,c,g,f,e,m,x,p){l=g;b=f;r=x;this.metrics.w=this.metrics.h=0;x=c;if(20<=p)for(g=0;g<this.children.length;g++)this.children[g].breakLines(p);g=0;for(f=this.children.length;g<f;g++){var d=this.children[g];
d.updateLine();d.metrics.offsetX=a;d.metrics.y=c;c+=parseInt(d.metrics.ascent+.5);d.metrics.offsetY=c;e=parseInt(d.metrics.descent+.5)+parseInt(1.5+.05*d.style.size);c+=e;this.metrics.h+=d.metrics.h;this.metrics.w=Math.max(this.metrics.w,d.metrics.w)}c=x;m=m||"";m.match("right")?a-=this.metrics.w:m.match("_center")&&(a-=this.metrics.w/2);m.match("bottom")?c-=this.metrics.h:m.match("center_")&&(c-=this.metrics.h/2);m=this.children;g=0;for(f=m.length;g<f;g++)"left"===m[g].style.align?m[g].metrics.offsetX=
a:"right"===m[g].style.align?m[g].metrics.offsetX=a+this.metrics.w-m[g].metrics.w:"center"===m[g].style.align?m[g].metrics.offsetX=a+(this.metrics.w-m[g].metrics.w)/2:"justify"===m[g].style.align&&20<=p&&(e=g<f-1?m[g+1].value:null,m[g].metrics.offsetX=a,"wrap"===e&&m[g].justifyAux(p)),m[g].metrics.y=c,c+=parseInt(m[g].metrics.ascent+.5),m[g].metrics.offsetY=c,e=parseInt(m[g].metrics.descent+.5)+parseInt(1.5+.05*m[g].style.size),c+=e};g.prototype.breakLines=function(b){for(var d,c=0,f=!1,e=[],m=0,
l=this.children.length;m<l;m++)d=this.children[m],f?e.push(d):("text"===d.nodeType||"space"===d.nodeType?(a.ctx.font=d.style.toString(),d.metrics.w=a.ctx.measureText(d.value).width):"word"===d.nodeType?d.updateLine():"formula"===d.nodeType&&d.updateFormula(),c+=d.metrics.w,c>b&&"space"!==d.nodeType&&0<m&&(f=!0,e.push(d)));if(0<e.length)for(b=new g("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),m=0,l=e.length;m<l;m++)e[m].parent&&e[m].parent.removeChild(e[m]),b.addChild(e[m])};
g.prototype.updateLine=function(b){var d=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var c=this.metrics.descent=0,g=this.children,e,m=0,l=g.length;m<l;m++){e=g[m];if("text"===e.nodeType){a.ctx.font=e.style.toString();var p=""!==e.value?e.value:a.in_editor?"\u200a":"";e.metrics=f(a.ctx.font);e.metrics.w=a.ctx.measureText(p).width;e.metrics.offsetX=c;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?(a.ctx.font=e.style.toString(),e.metrics=f(a.ctx.font),e.metrics.w=m===l-1?0:b?b:a.ctx.measureText(" ").width,e.metrics.offsetX=c,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=c,Object.defineProperties(e.metrics,{offsetX:{get:function(){return d.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}}));"hyperlink"===e.nodeType&&(a.ctx.font=e.styleString,p=""!==e.value?e.value:a.in_editor?"\u200a":"",e.metrics=f(a.ctx.font),e.metrics.w=a.ctx.measureText(p).width,e.metrics.offsetX=c,Object.defineProperties(e.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}}),e.clickCatcher||(e.clickCatcher=a.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 a.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),a.ctx.font=e.styleString,e.metrics=f(a.ctx.font),e.metrics.w=e.componentNumCtrl.w,e.metrics.h=e.componentNumCtrl.h,e.metrics.offsetX=c,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),a.ctx.font=e.styleString,e.metrics=f(a.ctx.font),e.metrics.w=e.componentSpace.w,e.metrics.h=e.componentSpace.h,e.metrics.offsetX=c,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=c,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,c+=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);c+=e.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};g.prototype.updateFormula=function(){var d=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 c=this.children,g,m=0,q={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},r=0,x=c.length;r<x;r++){g=c[r];if("text"===g.nodeType){a.ctx.font=g.style.toString(!0);var p=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=f(a.ctx.font);g.metrics.w=a.ctx.measureText(p).width;g.metrics.offsetX=m;Object.defineProperties(g.metrics,{x:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}});m+=d.metrics.marginX}else if("dynamicText"===g.nodeType){p=void 0===
g.decimals?l:g.evaluator.eval(g.decimals);var k=void 0===g.fixed?b:g.fixed,z=g.evaluator.eval(g.value);parseFloat(z).toString()===z.toString()&&(z=k?parseFloat(z).toFixed(p):a.removeNeedlessDecimals(parseFloat(z).toFixed(p)),z=(""+z).replace(".",g.decimal_symbol));g.evalValue=z;a.ctx.font=g.style.toString(!0);g.metrics=f(a.ctx.font);g.metrics.marginX=0;g.metrics.paddingX=0;g.metrics.w=a.ctx.measureText(z).width+2*g.metrics.paddingX;g.metrics.offsetX_aux=m;Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return d.metrics.offsetY}}});m+=2*g.metrics.marginX}if("superIndex"===g.nodeType)p=g,p.updateFormula(),p.metrics.marginX=0,p.metrics.paddingX=0,p.metrics.paddingY=0,p.metrics.offsetX_aux=m,p.metrics.prevChild=q,Object.defineProperties(p.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+
d.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return d.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),p.metrics.w+=2*p.metrics.paddingX,p.metrics.ascent+=p.metrics.paddingY,p.metrics.descent+=p.metrics.paddingY,p.metrics.h+=2*p.metrics.paddingY,p.metrics.tmp_ascent=p.metrics.h+(p.metrics.prevChild.metrics.ascent-p.metrics.prevChild.metrics.descent)/2,m+=2*p.metrics.marginX;else if("subIndex"===g.nodeType)p=g,p.updateFormula(),
p.metrics.marginX=0,p.metrics.paddingX=0,p.metrics.paddingY=0,p.metrics.offsetX_aux=m,p.metrics.prevChild=q,Object.defineProperties(p.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),p.metrics.w+=p.metrics.paddingX,p.metrics.ascent+=p.metrics.paddingY,
p.metrics.descent+=p.metrics.paddingY,p.metrics.h+=2*p.metrics.paddingY,this.metrics.descent=p.metrics.ascent+(p.metrics.prevChild.metrics.descent-p.metrics.prevChild.metrics.ascent)/2+p.metrics.descent,m+=p.metrics.marginX;else if("fraction"===g.nodeType){k=g;k.updateFormula();p=k.children;z=p[0];p=p[1];k.metrics.marginX=parseInt(.5+.075*this.style.size);k.metrics.paddingX=0;k.metrics.paddingY=0;var w=Math.max(z.metrics.w,p.metrics.w)+2*k.metrics.paddingX;k.metrics.prevChild=q;k.metrics.offsetX_aux=
m;var y=parseInt(-q.metrics.descent+4*q.metrics.h/9);Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+y}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY-y}}});Object.defineProperties(z.metrics,{parent:{value:k},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(p.metrics,{parent:{value:k},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});k.metrics.w=
w;k.metrics.ascent=z.metrics.h+y+2*k.metrics.paddingY;k.metrics.descent=p.metrics.h-y+2*k.metrics.paddingY;k.metrics.h=z.metrics.h+p.metrics.h+4*k.metrics.paddingY;m+=2*k.metrics.marginX}else if("radical"===g.nodeType){q=g;q.updateFormula();p=q.children;k=p[0];var A=p[1];q.metrics.marginX=parseInt(1.5+.075*this.style.size);q.metrics.paddingX=parseInt(1.5+.075*this.style.size);q.metrics.paddingY=parseInt(1.5+.05*this.style.size);q.metrics.offsetX_aux=m;Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}});p=q.style.size;q.radicalSign={w:p,scaleX:p/722,scaleY:A.metrics.h/1E3};z=parseInt(k.metrics.w-2*q.radicalSign.w/3);Object.defineProperties(q.radicalSign,{parent:{value:q},displaceIndex:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return d.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(k.metrics,{parent:{value:q},displaceIndex:{value:z},fontSize:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return d.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:q},
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 d.metrics.offsetY}}});z=k.metrics.w<2*q.radicalSign.w/3?q.radicalSign.w:parseInt(k.metrics.w+q.radicalSign.w/3);q.metrics.w=z+2*q.metrics.paddingX+A.metrics.w;q.metrics.ascent=Math.max(A.metrics.ascent,k.metrics.h+2*p/5)+
q.metrics.paddingY;q.metrics.descent=A.metrics.descent+q.metrics.paddingY;q.metrics.h=q.metrics.ascent+q.metrics.descent;m+=2*q.metrics.marginX}else if("sum"===g.nodeType){k=g;k.updateFormula();p=k.children;z=p[0];w=p[1];var F=p[2];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=m;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}});a.ctx.font=g.style.toString();var E=f(a.ctx.font);q=parseInt(1.2*E.h);p=parseInt(.5+780*q/1E3);k.sigmaSign={w:p,h:q,scale:q/1E3};var G=Math.max(w.metrics.w,z.metrics.w,k.sigmaSign.w);k.sigmaSign.parent=k;Object.defineProperties(k.sigmaSign,{sumWidth:{value:G},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return d.metrics.offsetY+E.descent-(this.h+E.h)/2}}});p=E.descent-w.metrics.descent-(q+E.h)/2-k.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:k},sumWidth:{value:G},newBaselineTo:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaselineTo}}});
q=z.metrics.ascent+E.descent+(q-E.h)/2+k.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:k},sumWidth:{value:G},newBaselineFrom:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(F.metrics,{parent:{value:k},sumWidth:{value:G},
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 d.metrics.offsetY}}});k.metrics.w=G+F.metrics.w+3*k.metrics.paddingX;k.metrics.ascent=Math.max(F.metrics.ascent,-p+w.metrics.ascent)+k.metrics.paddingY;k.metrics.descent=Math.max(F.metrics.descent,q+z.metrics.descent)+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;
m+=2*k.metrics.marginX}else if("integral"===g.nodeType){k=g;k.updateFormula();p=k.children;z=p[0];w=p[1];F=p[2];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=m;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return d.metrics.offsetY}}});a.ctx.font=g.style.toString();E=f(a.ctx.font);G=parseInt(1.2*E.h);var J=parseInt(10.5+529*G/1E3);k.sign={w:J,h:G,scale:G/1E3};k.sign.parent=k;Object.defineProperties(k.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return d.metrics.offsetY+E.descent-(this.h+E.h)/2}}});p=E.descent-(G+E.h)/2-w.metrics.descent+G/3;Object.defineProperties(w.metrics,{parent:{value:k},integralWidth:{value:J},
newBaselineTo:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaselineTo}}});q=E.descent+z.metrics.ascent/2;Object.defineProperties(z.metrics,{parent:{value:k},integralWidth:{value:J},newBaselineFrom:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaselineFrom}}});J=Math.max(parseInt(3*J/5)+w.metrics.w,parseInt(2*J/5+z.metrics.w))+k.metrics.paddingX;Object.defineProperties(F.metrics,{parent:{value:k},whatDisplace:{value:J},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return d.metrics.offsetY}}});k.metrics.w=J+F.metrics.w+2*k.metrics.paddingX;k.metrics.ascent=Math.max(F.metrics.ascent,-p+w.metrics.ascent)+k.metrics.paddingY;k.metrics.descent=Math.max(F.metrics.descent,q+z.metrics.descent,G-k.metrics.ascent)+k.metrics.paddingY;k.metrics.h=Math.max(k.metrics.ascent+k.metrics.descent,G);m+=2*k.metrics.marginX}else if("prod"===g.nodeType)k=g,k.updateFormula(),p=k.children,z=p[0],w=p[1],F=p[2],k.metrics.marginX=parseInt(1.5+
.075*this.style.size),k.metrics.paddingX=parseInt(1.5+.075*this.style.size),k.metrics.paddingY=parseInt(1.5+.05*this.style.size),k.metrics.offsetX_aux=m,Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}}),a.ctx.font=g.style.toString(),E=f(a.ctx.font),q=parseInt(1.2*E.h),p=parseInt(.5+
876*q/1E3),k.piSign={w:p,h:q,scale:q/1E3},G=Math.max(w.metrics.w,z.metrics.w,k.piSign.w),k.piSign.parent=k,Object.defineProperties(k.piSign,{prodWidth:{value:G},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return d.metrics.offsetY+E.descent-(this.h+E.h)/2}}}),p=E.descent-w.metrics.descent-(q+E.h)/2-k.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:k},prodWidth:{value:G},newBaselineTo:{value:p},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaselineTo}}}),q=z.metrics.ascent+E.descent+(q-E.h)/2+k.metrics.paddingY,Object.defineProperties(z.metrics,{parent:{value:k},prodWidth:{value:G},newBaselineFrom:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(F.metrics,{parent:{value:k},prodWidth:{value:G},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 d.metrics.offsetY}}}),
k.metrics.w=G+F.metrics.w+3*k.metrics.paddingX,k.metrics.ascent=Math.max(F.metrics.ascent,-p+w.metrics.ascent)+k.metrics.paddingY,k.metrics.descent=Math.max(F.metrics.descent,q+z.metrics.descent)+k.metrics.paddingY,k.metrics.h=k.metrics.ascent+k.metrics.descent,m+=2*k.metrics.marginX;else if("limit"===g.nodeType){q=g;q.updateFormula();p=q.children;var D=p[0];k=p[1];p=p[2];q.metrics.marginX=parseInt(1.5+.075*this.style.size);q.metrics.paddingX=parseInt(1.5+.075*this.style.size);q.metrics.paddingY=
parseInt(1.5+.05*this.style.size);q.metrics.offsetX_aux=m;Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}});a.ctx.font=g.style.toString();E=f(a.ctx.font);z=parseInt(.5+a.ctx.measureText("l\u00edm").width);w=parseInt(.5+a.ctx.measureText("\u2192").width);F=Math.max(z,D.metrics.w+w+k.metrics.w);
q.limitText={parent:q};Object.defineProperties(q.limitText,{limitWidth:{value:F},limitTextWidth:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});z=E.descent+Math.max(D.metrics.ascent,k.metrics.ascent,2*E.ascent/3)+q.metrics.paddingY;q.limitArrow={parent:q};Object.defineProperties(q.limitArrow,{newBaseline:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w}},y:{get:function(){return d.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(D.metrics,{parent:{value:q},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 d.metrics.offsetY+this.newBaseline}}});Object.defineProperties(k.metrics,{parent:{value:q},arrowWidth:{value:w},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+D.metrics.w+this.arrowWidth}},offsetY:{get:function(){return d.metrics.offsetY+this.newBaseline}}});Object.defineProperties(p.metrics,{parent:{value:q},limitWidth:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return d.metrics.offsetY}}});
q.metrics.w=F+p.metrics.w+3*q.metrics.paddingX;q.metrics.ascent=Math.max(p.metrics.ascent,E.ascent)+q.metrics.paddingY;w=0;p=Math.max(D.metrics.descent,k.metrics.descent,p.metrics.descent);if(0!=D.metrics.h||0!=k.metrics.h)w=z,p=Math.max(D.metrics.descent,k.metrics.descent,p-w);q.metrics.descent=w+p+q.metrics.paddingY;q.metrics.h=q.metrics.ascent+q.metrics.descent;m+=2*q.metrics.marginX}else if("matrix"===g.nodeType){z=g;z.updateFormula();p=z.children;w=z.rows;F=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=m;Object.defineProperties(z.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}});a.ctx.font=g.style.toString();E=f(a.ctx.font);G=[];J=[];q=0;for(var B=w*F;q<B;q++){var I=
parseInt(q/F);var L=q%F;G[I]=Math.max(G[I]||0,p[q].metrics.h);J[L]=Math.max(J[L]||0,p[q].metrics.w)}var M=(1+F)*z.metrics.paddingX;for(q=0;q<F;q++)M+=J[q];var O=(1+w)*z.metrics.paddingY;for(q=0;q<w;q++)O+=G[q];k=E.descent-E.h/2;q=0;for(B=w*F;q<B;q++)I=parseInt(q/F),L=q%F,p[q].metrics.offsetX_aux=e(J,L)+(J[L]-p[q].metrics.w)/2+L*z.metrics.paddingX,p[q].metrics.offsetY_aux=e(G,I)+(G[I]-p[q].metrics.h)/2+(1+I)*z.metrics.paddingY,Object.defineProperties(p[q].metrics,{parent:{value:z},matrixH:{value:O},
dispY:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.w=M;z.metrics.ascent=O/2-k;z.metrics.descent=O/2+k;z.metrics.h=z.metrics.ascent+z.metrics.descent;m+=2*z.metrics.marginX}else if("defparts"===g.nodeType){z=g;z.updateFormula();p=g.children;
w=g.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=m;Object.defineProperties(z.metrics,{parent:{value:d},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+d.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}});a.ctx.font=
g.style.toString();E=f(a.ctx.font);F=0;G=z.metrics.paddingY;k=E.descent-E.h/2;for(q=0;q<w;q++)p[q].metrics.offsetY_aux=G,F=Math.max(F,p[q].metrics.w),G+=p[q].metrics.h+z.metrics.paddingY,Object.defineProperties(p[q].metrics,{parent:{value:z},dispY:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return d.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.defpartsH=G;z.metrics.w=F+4*z.metrics.paddingX;z.metrics.ascent=G/2-k;z.metrics.descent=G/2+k;z.metrics.h=z.metrics.ascent+z.metrics.descent;m+=2*z.metrics.marginX}else if("numerator"===g.nodeType||"denominator"===g.nodeType||"index"===g.nodeType||"radicand"===g.nodeType||"from"===g.nodeType||"to"===g.nodeType||"what"===g.nodeType||"element"===g.nodeType)g.updateFormula(),g.metrics.paddingX=parseInt(1.5+.075*this.style.size),g.metrics.paddingY=
parseInt(1.5+.05*this.style.size),g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h=g.metrics.ascent+g.metrics.descent,1==g.children.length&&"text"==g.children[0].nodeType&&""==g.children[0].value?(g.metrics.w=0,a.in_editor||(g.metrics.ascent=g.metrics.descent=g.metrics.h=0)):g.metrics.w+=2*g.metrics.paddingX;q=g;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.tmp_ascent||g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;m+=g.metrics.w}};g.prototype.justifyAux=function(a){for(var b=0,d=0,c=0,g=this.children.length;c<g-1;c++)"space"===this.children[c].nodeType?b++:d+=this.children[c].metrics.w;this.updateLine((a-d)/b)};g.prototype.drawTextBlock=function(a){a.fillStyle=r;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);a.shadowColor="transparent"};g.prototype.drawTextLineBlock=function(a){for(var b=0,d=this.children.length;b<d;b++)c=!1,this.children[b].draw(a)};g.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,d=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(c);a.beginPath();this.style.overline&&(a.rect(b,d-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,d+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var g=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,d);a.strokeStyle=
g}a.fillText(this.value,b,d)}};g.prototype.drawWord=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a)};g.prototype.drawSpace=function(a){};g.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,d=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(c);a.beginPath();this.style.overline&&(a.rect(b,d-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,d+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,d);this.drawBorder(a,"blue")};g.prototype.drawHyperlink=function(a){var b=this.metrics.x,d=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=d-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,d-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(c);a.beginPath();a.rect(b,d+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,d)};g.prototype.drawFormula=function(a){for(var b=0,d=this.children.length;b<d;b++)c=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};g.prototype.drawNumDen=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};g.prototype.drawSuperIndex=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSubIndex=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?
parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.lineWidth/=Math.max(this.radicalSign.scaleX,this.radicalSign.scaleY));a.save();a.font="1000px DJS_symbol";a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);this.style.border&&a.strokeText("\u221a",-70,800);a.fillText("\u221a",-70,800);a.restore();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-
.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSum=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=1.9*this.sigmaSign.w+"px DJS_symbol";this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin=
"round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h));a.fillText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h);for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawIntegral=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=1.5*this.sign.w+"px DJS_symbol";this.style.border&&
(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4));a.fillText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4);for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawProd=function(a){a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=1.5*this.piSign.w+"px DJS_symbol";this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h));a.fillText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h);for(var b=0,d=this.children.length;b<
d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawLimit=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor());
a.font=this.style.toString();this.style.border&&a.strokeText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&(this.style.border&&a.strokeText("\u2192",this.limitArrow.x,this.limitArrow.y),a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y));this.drawBorder(a,"blue")};g.prototype.drawMatrix=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);d=parseInt(1.5+this.style.size/25);b=d/2;a.lineWidth=
d;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-
b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-
b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){d=3*this.metrics.marginX;var c=d/2;a.moveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+c,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+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+
b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+c,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,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+
b-c,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-c,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-c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-c,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,this.metrics.x+this.metrics.w+b-d,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+
b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+
this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};g.prototype.drawDefparts=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);d=parseInt(1.5+this.style.size/25);b=d/2;a.lineWidth=d;a.strokeStyle=
null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();d=3*this.metrics.marginX;var c=d/2;a.moveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-
5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+c,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+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);
a.lineTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+c,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,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawGenericBlock=function(a){for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};
g.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};g.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=
this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};g.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};var m={sansserif:{ascent:1854,descent:-434,lineGap:67,
capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=String.fromCharCode,f,c,r,l,b,g,m,d,n,h,v,q=function(){};q.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];f=[];c="";l=r=0;g=a.charAt(0);m=!1;for(d="text";r<a.length;)b=g,g=a.charAt(r+1),m?"\\"===g||"{"===g||"}"===
g||" "===g||";"===g?(m=!1,c+=b," "===g?(r++,g=a.charAt(r+1),v=!0):v=!1,(n=c.match(/^'([0-9a-f]{2})/))?(h="","text"===d&&(h=f.pop().value),c=h+=e(parseInt(n[1],16))+c.substring(3)):(n=c.match(/^u[0-9]+/))?(h="","text"===d&&(h=f.pop().value),c=h+=e(n[0].substring(1))):("{"===c||"}"===c||"\\"==b?(f.push({type:"text",value:c+(v?" ":"")}),d="text"):(f.push({type:"controlWord",value:c}),d="controlWord"),c="")):"{"==b||"}"==b||"\\"==b?(m=!1,f.push({type:"text",value:b}),d="text"):c+=b:"\\"===b?(m=!0,""!==
c&&(f.push({type:"text",value:c}),d="text",c="")):"{"===b?(l++,""!==c&&(f.push({type:"text",value:c}),c=""),f.push({type:"openBlock",value:l}),d="openBlock"):"}"===b?(""!==c&&(f.push({type:"text",value:c}),c=""),f.push({type:"closeBlock",value:l}),d="closeBlock",l--):c+=b,r++;""!==c&&f.push({type:"text",value:c});return f};a.RTFTokenizer=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.max,f,c,r,l,b,g,m,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J,D,B,I,L,M,O,H,N=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};N.prototype.parse=function(C){f=this.tokenizer.tokenize(C);c={};l=2;if("openBlock"===f[0].type&&"fonttbl"===f[1].value){for(r=f[0].value;"closeBlock"!==f[l].type&&f[l].value!==r;)c[f[l].value]=f[l+2].value.substring(0,f[l+2].value.length-1),l+=3;l++}b={};g=0;if("openBlock"===f[l].type&&"colortbl"===f[l+1].value){r=
f[l++].value;for(l++;"closeBlock"!==f[l].type&&f[l].value!==r;)m=parseInt(f[l++].value.substring(3)).toString(16),d=parseInt(f[l++].value.substring(5)).toString(16),n=parseInt(f[l++].value.substring(4)).toString(16),";"===f[l].value&&l++,b[g++]="#"+(2>m.length?"0"+m:m)+(2>d.length?"0"+d:d)+(2>n.length?"0"+n:n);l++}x=u=q=null;M=L=I=F=A=y=w=z=k=p=!1;E=[new a.TextStyle];G=E[0];D=J=-1;B=[];h=O=new a.TextNode("","textBlock",G,this.evaluator);v=new a.TextNode("","textLineBlock",G,this.evaluator);h.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;C=l;for(var N=f.length;C<N;C++){if("controlWord"==f[C].type)if(c[f[C].value])G.set({family:c[f[C].value]});else if(f[C].value.match(/^fs(\d+)/))G.set({size:parseInt(f[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==f[C].value)G.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==f[C].value)G.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==f[C].value)G.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==f[C].value)G.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==f[C].value)G.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==f[C].value)G.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==f[C].value)G.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==f[C].value)G.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(f[C].value.match(/^cf(\d+)/))G.set({color:b[parseInt(f[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=G.color);else if("par"==f[C].value){h=new a.TextNode("","textLineBlock",G.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(h);v=h}else if("mjaformula"==f[C].value)O.hasFormula=!0,D=J,p=!0,h=new a.TextNode("","formula",G.clone(),this.evaluator),v.addChild(h),v=h,B[B.length-1]=h;else if("fraction"==f[C].value||"radicand"==f[C].value||"radical"==f[C].value||"what"==f[C].value||"sum"==f[C].value||"integral"==
f[C].value||"limit"==f[C].value){var K=B[B.length-2].style.clone();h=new a.TextNode("",f[C].value,K,this.evaluator);B[B.length-2].addChild(h);B[B.length-1]=h}else"index"==f[C].value?(K=B[B.length-2].style.clone(),K.size=e(parseInt(K.size-.5*K.size),8),h=new a.TextNode("",f[C].value,K,this.evaluator),B[B.length-2].addChild(h),B[B.length-1]=h):"to"==f[C].value||"from"==f[C].value?(K=B[B.length-2].style.clone(),K.size=e(parseInt(K.size-.2*K.size),8),h=new a.TextNode("",f[C].value,K,this.evaluator),B[B.length-
2].addChild(h),B[B.length-1]=h):"num"==f[C].value||"den"==f[C].value?(K=B[B.length-2].style.clone(),K.size=e(Math.round(K.size-.1*K.size),8),"num"==f[C].value?h=new a.TextNode("","numerator",K,this.evaluator):"den"==f[C].value&&(h=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(h),B[B.length-1]=h):"subix"==f[C].value||"supix"==f[C].value?(K=B[B.length-2].style.clone(),K.size=e(Math.floor(K.size-.33*K.size),8),"subix"==f[C].value?h=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==f[C].value&&(h=new a.TextNode("","superIndex",K,this.evaluator)),h.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(h),B[B.length-1]=h):"defparts"==f[C].value||"matrix"==f[C].value||"element"==f[C].value?(K=B[B.length-2].style.clone(),h=new a.TextNode("",f[C].value,K,this.evaluator),B[B.length-2].addChild(h),B[B.length-1]=h,"defparts"==f[C].value?x=h:"matrix"==f[C].value&&(u=h,u.matrix_type=0)):"parts"==f[C].value?F=!0:"type"==f[C].value?w=!0:"rows"==f[C].value?y=!0:"columns"==
f[C].value?A=!0:"expr"==f[C].value?(O.stableWidth=!1,k=!0):"decimals"==f[C].value?z=!0:"fixed1"==f[C].value?q.fixed=!0:"fixed0"==f[C].value?q.fixed=!1:"component"!=f[C].value&&("NumCtrl"==f[C].value?I=!0:"Space"==f[C].value?L=!0:"hyperlink"==f[C].value&&(M=!0));if("text"==f[C].type)if(F)x.parts=parseInt(f[C].value),F=!1;else if(w)u.matrix_type=parseInt(f[C].value),w=!1;else if(y)u.rows=parseInt(f[C].value),y=!1;else if(A)u.columns=parseInt(f[C].value),A=!1;else if(z)q.decimals=this.evaluator.parser.parse(f[C].value+
""),z=!1;else if(M){H=f[C].value.split("|")[0];K=G.clone();h=new a.TextNode(H,"hyperlink",K,this.evaluator);h.URL=f[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(h);M=!1}else if(I)h=new a.TextNode(f[C].value,"componentNumCtrl",G.clone(),this.evaluator),v.addChild(h),I=!1;else if(L)h=new a.TextNode(f[C].value,"componentSpace",G.clone(),this.evaluator),v.addChild(h),L=!1;else if(k)K=B[B.length-2].style.clone(),H=this.evaluator.parser.parse(f[C].value),
h=new a.TextNode(H,"dynamicText",K,this.evaluator),B[B.length-2].addChild(h),q=B[B.length-1]=h,k=!1;else if(k||p)!k&&p&&(H=f[C].value,h=new a.TextNode(H,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(h));else{H=f[C].value;h=new a.TextNode(H,"text",G.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(h)}else if("openBlock"==f[C].type)J=f[C].value,G=G.clone(),E.push(G),B.push(null);else if("closeBlock"==
f[C].type)f[C].value==D&&(D=-1,p=!1,v=v.parent),E.pop(),G=E[E.length-1],B.pop();else if("("==f[C].type||")"==f[C].type)K=B[B.length-1].style.clone(),K.italic="",h=new a.TextNode(f[C].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(h);else if("+"==f[C].type||"-"==f[C].type||"*"==f[C].type||"="==f[C].type)h=new a.TextNode(f[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(h)}return O.normalize()};a.RTFParser=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g,m,d,n,h,v=function(b,d){this.parent=b;f=this.evaluator=this.parent.evaluator;c=f.parser;this.id="";this.type="2D";this.xExpr=c.parse("0");this.yExpr=c.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=c.parse("1");this.fixed=!1;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=
b.displaceRegionWest||0;Object.assign(this,d);this.initSpace()};v.prototype.initSpace=function(){var a=this;e=a.parent;f=a.evaluator;r=a.id;a.resizable||(a.displaceRegionNorth=e.displaceRegionNorth||0,a.displaceRegionSouth=e.displaceRegionSouth||0,a.displaceRegionEast=e.displaceRegionEast||0,a.displaceRegionWest=e.displaceRegionWest||0,m=parseInt(e.container.width),g=parseInt(e.container.height),void 0!=a.wExpr&&(a.w=parseInt(m-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(g-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=f.parser.parse((parseInt(m-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=f.parser.parse((parseInt(g-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=f.eval(a.xExpr)+a.displaceRegionWest,a.y=f.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&
(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(l=g-a.y,a.h>l&&(a.h=l)):(l=a.h+a.y,a.h=l>=g?g:l),0<=a.x?(b=m-a.x,a.w>b&&(a.w=b)):(b=a.w+a.x,a.w=b>=m?m:b));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=e.getImage(a.imageSrc));a.OxExpr&&(n=a.OxExpr,"%"===n[n.length-1]?a.Ox=a.w*parseFloat(n)/100:(d=parseFloat(n),d!=n&&(d=0),a.Ox=d));a.OyExpr&&(h=a.OyExpr,"%"===h[h.length-1]?a.Oy=a.h*parseFloat(h)/100:(d=parseFloat(h),d!=h&&(d=0),a.Oy=d));""!==a.id&&2!==e.version?
(f.setVariable(r+"._w",a.w),f.setVariable(r+"._h",a.h),f.setVariable(r+".escala",f.getVariable(r+".escala")||a.scale),f.setVariable(r+".Ox",f.getVariable(r+".Ox")||a.Ox),f.setVariable(r+".Oy",f.getVariable(r+".Oy")||a.Oy),f.setVariable(r+".mouse_x",0),f.setVariable(r+".mouse_y",0),f.setVariable(r+".mouse_pressed",0),f.setVariable(r+".mouse_clicked",0),f.setVariable(r+".clic_izquierdo",0)):(d=f.getVariable("_w"),f.setVariable("_w",void 0===d?a.w:d),d=f.getVariable("_h"),void 0===d&&(d=a.h),f.setVariable("_h",
d),d=f.getVariable("escala"),void 0===d&&(d=a.scale),f.setVariable("escala",d),d=f.getVariable("Ox"),void 0===d&&(d=a.Ox),f.setVariable("Ox",d),d=f.getVariable("Oy"),void 0===d&&(d=a.Oy),f.setVariable("Oy",d),f.setVariable("mouse_x",0),f.setVariable("mouse_y",0),f.setVariable("mouse_pressed",0),f.setVariable("mouse_clicked",0),f.setVariable("clic_izquierdo",0),2==e.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;f.setFunction(r+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,
a.canvas.toDataURL("image/png"))})};v.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-
this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f=function(c){e=this;e.parent=c;e.width=228;e.vSpace=25;e.container=a.newHTML("div",{style:"box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:"+(e.width+27)+"px;height:460px;"});e.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(e.width+27)+"px;height:"+e.vSpace+
"px;line-height:"+e.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});e.movable.innerHTML="Descartes";e.container.appendChild(e.movable);e.ctrs=[]};f.prototype.init=function(){function c(b){e.newPos=a.getCursorPosition(b,document.body);e.container.style.left=e.initialPosition.x+(e.newPos.x-e.oldPos.x)*a.cssScale+"px";e.container.style.top=e.initialPosition.y+(e.newPos.y-e.oldPos.y)*a.cssScale+"px"}function f(a){a.preventDefault();document.body.removeEventListener("mousemove",
c);document.body.removeEventListener("mouseup",f)}e=this;document.body.appendChild(this.container);for(var l=e.parent.evaluator.parser,b=0,g=e.ctrs.length;b<g;b++)e.ctrs[b].expresion=l.parse("(0,"+(e.vSpace+23+35*b)+","+e.width+",35)"),e.ctrs[b].update();e.numCtr=g;b=new a.Button(e.parent,{region:"external",name:"english"==e.language?"about":"cr\u00e9ditos",font_size:l.parse("15"),expresion:l.parse("(0,"+e.vSpace+","+e.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(e.parent,
{region:"external",name:"config",font_size:l.parse("15"),action:"config",expresion:l.parse("("+e.width/2+","+e.vSpace+","+e.width/2+",25)")})).update();(new a.Button(e.parent,{region:"external",name:"english"==e.language?"init":"inicio",font_size:l.parse("15"),action:"init",expresion:l.parse("(0,"+(e.vSpace+23+35*g)+","+e.width/2+",25)")})).update();(new a.Button(e.parent,{region:"external",name:"english"==e.language?"clear":"limpiar",font_size:l.parse("15"),action:"clear",expresion:l.parse("("+e.width/
2+","+(e.vSpace+23+35*g)+","+e.width/2+",25)")})).update();l=new a.Button(e.parent,{region:"external",name:"english"==e.language?"close":"cerrar",font_size:l.parse("15"),expresion:l.parse("("+e.width/4+","+(e.vSpace+46+35*g)+","+e.width/2+",25)")});l.update();l.btn.addEventListener("click",function(a){e.hide()});e.setPositionAndSize();e.movable.addEventListener("mousedown",function(b){b.preventDefault();e.oldPos=a.getCursorPosition(b,document.body);e.initialPosition={x:e.container.offsetLeft,y:e.container.offsetTop};
document.body.addEventListener("mousemove",c);document.body.addEventListener("mouseup",f)});e.hide()};f.prototype.addCtr=function(a){this.ctrs.push(a)};f.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};f.prototype.hide=function(){this.container.style.display="none"};f.prototype.setPositionAndSize=function(){e=this;var a=e.vSpace+46+35*e.numCtr+25+10;e.container.style.left=Math.max(parseInt(window.innerWidth-e.width)/2,0)+"px";e.container.style.top="5px";e.container.style.height=
window.innerHeight<e.vSpace+75?e.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=Math.round,c=2*Math.PI,r=a.convertFont("Serif,BOLD+ITALIC,16"),l=a.convertFont("Monospaced,PLAIN,12"),b,g,m,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J,D,B,I,L,M,O,H,N,C,Q,K,R,P=function(d,c){b=c=a.Space.call(this,d,c)||this;b.ratio=d.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio+"px",height:b.h*b.ratio+"px"});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio+"px",
height:b.h*b.ratio+"px"});b.canvas.style=b.backCanvas.style=(0<b.border_width?"border:"+b.border_width+"px solid "+b.border_color.getColor()+";":"")+(b.border_radius?"border-radius:"+b.border_radius+"px;":"");b.canvas.style.zIndex=b.zIndex;b.canvas.style.width=b.backCanvas.style.width=b.w+"px";b.canvas.style.height=b.backCanvas.style.height=b.h+"px";b.ctx=b.canvas.getContext("2d");b.backCtx=b.backCanvas.getContext("2d");b.ctx.imageSmoothingEnabled=b.backCtx.imageSmoothingEnabled=!1;b.canvas.ratio=
b.ratio;b.backCanvas.ratio=b.ratio;b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.numCtrContainer=a.newHTML("div",{id:b.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.container=a.newHTML("div",{id:b.id,class:"DescartesSpace2DContainer",style:"z-index:"+b.zIndex+";"});b.parent.arquimedes&&"#f0f8fa"===b.background.getColor()&&(b.container.style.boxShadow="0 0 5px 0 #b8c4c8");
b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numCtrContainer);d.container.insertBefore(b.container,d.loader);var g=b.id+".image";b.parent.images[g]=b.canvas;b.parent.images[g].ready=1;b.parent.images[g].complete=b.parent.images[g].canvas=!0;b.evaluator.setVariable(g,g);g=b.id+".back";b.parent.images[g]=b.backCanvas;b.parent.images[g].ready=1;b.parent.images[g].complete=b.parent.images[g].canvas=
!0;b.evaluator.setVariable(g,g);g=""!==b.id&&2!==d.version?b.id+".":"";b.OxStr=g+"Ox";b.OyStr=g+"Oy";b.scaleStr=g+"escala";b.wStr=g+"_w";b.hStr=g+"_h";b.mxStr=g+"mouse_x";b.myStr=g+"mouse_y";b.mpressedStr=g+"mouse_pressed";b.mclickedStr=g+"mouse_clicked";b.mclickIzqStr=g+"clic_izquierdo";b.click=0;b.resizable&&(b.wModExpr=d.evaluator.parser.parse(b.wModExpr),b.hModExpr=d.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};d.evaluator.setVariable(b.id+
"._refresh_back_",1);return c};$jscomp.inherits(P,a.Space);P.prototype.init=function(){b=this;this.initSpace();b.canvas&&(b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px")};P.prototype.update=function(a){b=this;g=b.evaluator;m=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),Q=b.evaluator.eval(b.hModExpr),b.old_w!=
C||b.old_h!=Q)b.w=C,b.h=Q,b.w_2=b.w/2,b.h_2=b.h/2,g.setVariable(b.wStr,b.w),g.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",a=!0}else g.setVariable(b.wStr,b.w),g.setVariable(b.hStr,b.h);b.drawIfValue=0<g.eval(b.drawif);if(b.drawIfValue){n=b.x!==g.eval(b.xExpr)+b.displaceRegionWest;h=b.y!==g.eval(b.yExpr)+
m.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||n||h||b.drawBefore!==b.drawIfValue||b.Ox!==g.getVariable(b.OxStr)||b.Oy!==g.getVariable(b.OyStr)||b.scale!==g.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=n?g.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=h?g.eval(b.yExpr)+m.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=g.getVariable(b.OxStr);b.Oy=g.getVariable(b.OyStr);b.scale=g.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));g.setVariable(b.scaleStr,
b.scale);if(n||h)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.drawTrace=!b.spaceChange&&(!b.fixed&&!b.click||b.fixed);b.spaceChange&&(b.backCtx.setTransform(b.ratio,0,0,b.ratio,0,0),b.drawBackground());b.ctx.setTransform(b.ratio,0,0,b.ratio,0,0);b.draw()}else b.container.style.display="none"};P.prototype.drawBackground=function(){b=this;g=b.evaluator;d=b.backCtx;d.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);d.fillStyle=b.backColor=b.background.getColor();
d.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===b.bg_display?d.drawImage(b.image,0,0):"stretch"===b.bg_display?d.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(d.fillStyle=d.createPattern(b.image,"repeat"),d.fillRect(0,0,b.w,b.h)):"imgcenter"===b.bg_display&&d.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));q=b.scale;u=0;for(x=0>b.w+b.h?0:b.w+b.h;q>x;)q/=10,u++;for(;q<x/10;)q*=10;d.lineWidth=1;
""!==b.net&&(d.strokeStyle=b.net.getColor(),b.drawMarks(d,q/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&""!==b.net&&""!==b.net10)d.strokeStyle=b.net10.getColor(),b.drawMarks(d,q,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");d.strokeStyle=b.axes.getColor();d.beginPath();"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(d.moveTo(0,e(b.h/2+b.Oy)+.5),d.lineTo(b.w,e(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(d.moveTo(e(b.w/
2+b.Ox)+.5,0),d.lineTo(e(b.w/2+b.Ox)+.5,b.h));d.lineWidth=1.2;d.stroke();d.lineWidth=1;b.drawMarks(d,q,4,a);b.drawMarks(d,q/2,2,a);b.drawMarks(d,q/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)d.fillStyle=""!==b.axes?b.axes.getColor():"#000",d.font=r,d.textAlign="right",d.textBaseline="alphabetic","no"!=b.x_axis&&d.fillText(b.x_axis,e(b.w)-2,e(b.h/2+b.Oy)+12),"no"!=b.y_axis&&d.fillText(b.y_axis,e(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(d.fillStyle=b.axes.getColor(),d.font=r,d.textAlign="start",d.textBaseline=
"bottom",q>(b.w+b.h)/2?b.drawNumbers(d,q/5,q<=b.scale?u+1:u):q>(b.w+b.h)/4?b.drawNumbers(d,q/2,q<=b.scale?u+1:u):b.drawNumbers(d,q,u));a=0;for(var c=this.backGraphics.length;a<c;a++)this.backGraphics[a].draw()};P.prototype.draw=function(){b=this;d=b.ctx;g.getVariable(b.id+"._refresh_back_")&&d.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,f=b.graphics.length;a<f;a++)v=b.graphics[a],""!==v.trace&&b.drawTrace&&v.drawTrace(),v.draw();a=0;for(f=b.graphicsCtr.length;a<f;a++)b.graphicsCtr[a].draw();
""!=b.text&&b.click&&"L"===b.whichBtn&&(d.save(),d.strokeStyle=d.fillStyle=b.text.getColor(),d.lineWidth=1,d.font=l,d.textAlign="center",d.textBaseline="alphabetic",D=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(parseInt(b.scale).toString().length+1),B=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(parseInt(b.scale).toString().length+1),I="("+D+","+B+")",L=e(d.measureText(I).width/2),M=b.getAbsoluteX(b.mouse_x),O=b.getAbsoluteY(b.mouse_y),H=e(M),N=e(O-10),H+L>b.w?H=b.w-L:0>H-L&&(H=L),N+1>
b.h?N=b.h:0>N-14&&(N=15),d.fillText(I,H,N),d.beginPath(),d.arc(M,O,2.5,0,c,!0),d.stroke(),d.restore())};P.prototype.drawMarks=function(a,b,d,c){p=this.w;k=this.h;G=F=0;E=p;J=k;y=e(p/2+this.Ox);A=e(k/2+this.Oy);0<=d&&(F=y-d,E=y+d,G=A-d,J=A+d);a.beginPath();if(!c||c&&!c.match("x"))for(d=-f(y/b);(z=y+f(d*b))<p;d++)a.moveTo(z+.5,G+.5),a.lineTo(z+.5,J+.5);if(!c||c&&!c.match("y"))for(d=-f(A/b);(w=A+f(d*b))<k;d++)a.moveTo(F+.5,w+.5),a.lineTo(E+.5,w+.5);a.stroke()};P.prototype.drawNumbers=function(a,b,d){p=
this.w;k=this.h;y=e(p/2+this.Ox);A=e(k/2+this.Oy);for(d=-f(y/b);(z=y+f(d*b))<p;d++)a.fillText(parseFloat((d*b/this.scale).toFixed(4)),z+1,A-2);for(d=-f(A/b);(w=A+f(d*b))<k;d++)0!==parseFloat(-d*b/this.scale)&&a.fillText(parseFloat((-d*b/this.scale).toFixed(4)),y+5,w+5)};P.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(e.evaluator.variables[e.id+".DESCARTESJS_no_fixed"]||!e.fixed||e.sensitive_to_mouse_movements)e.click=0,e.evaluator.setVariable(e.mpressedStr,
0),e.evaluator.setVariable(e.mclickedStr,1),e.evaluator.setVariable(e.mclickIzqStr,1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),e.parent.update()}function d(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();e.click=0;e.evaluator.setVariable(e.mpressedStr,0);e.evaluator.setVariable(e.mclickedStr,1);e.evaluator.setVariable(e.mclickIzqStr,1);"R"===e.whichBtn&&(window.removeEventListener("mousemove",
g),e.posZoom==e.posZoomNew&&a.showConfig&&(e.parent.externalSpace.show(),e.posZoom=!1,e.posZoomNew=!0));window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",d);e.parent.deactivateControls();e.parent.update()}function c(b){e.posAnte=a.getCursorPosition(b,e.container);e.mouse_x=e.getRelativeX(e.posAnte.x);e.mouse_y=e.getRelativeY(e.posAnte.y);e.evaluator.setVariable(e.mxStr,e.mouse_x);e.evaluator.setVariable(e.myStr,e.mouse_y);e.evaluator.setVariable(e.mclickedStr,0);e.evaluator.setVariable(e.mclickIzqStr,
0);e.parent.update()}function g(b){b.preventDefault();e.posZoomNew=a.getCursorPosition(b,e.container).y;e.evaluator.setVariable(e.scaleStr,e.tempScale+e.tempScale/45*((e.posZoom-e.posZoomNew)/10));e.parent.update()}function f(b){b.preventDefault();b.stopPropagation();e.fixed||(e.posNext=a.getCursorPosition(b,e.container),K=e.posAnte.x-e.posNext.x,R=e.posAnte.y-e.posNext.y,e.evaluator.setVariable(e.OxStr,e.Ox-K),e.evaluator.setVariable(e.OyStr,e.Oy-R));c(b)}var e=this;e.posZoom=e.posZoomNew=null;e.canvas.oncontextmenu=
function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",c);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(e.evaluator.variables[e.id+".DESCARTESJS_no_fixed"]||!e.fixed||e.sensitive_to_mouse_movements)e.parent.clearClick(),e.click=1,e.evaluator.setVariable(e.mpressedStr,1),e.evaluator.setVariable(e.mclickedStr,0),e.evaluator.setVariable(e.mclickIzqStr,0),e.parent.deactivateControls(),c(a),window.addEventListener("touchmove",
f),window.addEventListener("touchend",b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",c);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();e.parent.clearClick();e.click=1;e.parent.deactivateControls();e.whichBtn=a.whichBtn(b);"R"===e.whichBtn?(window.addEventListener("mouseup",d),e.posZoom=a.getCursorPosition(b,e.container).y,e.posZoomNew=e.posZoom,
e.fixed||(e.tempScale=e.scale,window.addEventListener("mousemove",g))):"L"===e.whichBtn&&(e.evaluator.setVariable(e.mpressedStr,1),e.evaluator.setVariable(e.mclickedStr,0),e.evaluator.setVariable(e.mclickIzqStr,0),c(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",d))});document.addEventListener("visibilitychange",function(a){d(a)});document.addEventListener("mouseleave",function(a){e.click=0;e.evaluator.setVariable(e.mpressedStr,0);e.evaluator.setVariable(e.mclickedStr,
1);e.evaluator.setVariable(e.mclickIzqStr,1);window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",d)})};a.Space2D=P;return a}(descartesJS||{});
descartesJS=function(a){var e,f,c;function r(b,d){H=a.subtract3D(b,a.scalarProduct3D(d,a.dotProduct3D(b,d)));N=a.add3D(b,a.scalarProduct3D(H,-2));C=a.norm3D(N);return 0!==C?a.scalarProduct3D(N,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var l=Math.floor,b=Math.max,g=Math.cos,m=Math.sin,d,n,h,v,q,u,x,p,k,z,w,y,A,F,E,G,J=[],D,B,I,L,M,O,H,N,C,Q,K,R=function(b,d){h=d=a.Space.call(this,b,d)||this;h.ratio=b.ratio;h.backCanvas=a.newHTML("canvas",{id:h.id+"_background",width:h.w*h.ratio+"px",height:h.h*
h.ratio+"px"});h.canvas=a.newHTML("canvas",{id:h.id+"_canvas",width:h.w*h.ratio+"px",height:h.h*h.ratio+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+h.zIndex+";"});h.ctx=h.canvas.getContext("2d");h.ctx.imageSmoothingEnabled=!1;h.canvas.ratio=h.ratio;h.canvas.style=h.backCanvas.style=(0<h.border_width?"border:"+h.border_width+"px solid "+h.border_color.getColor()+";":"")+(h.border_radius?"border-radius:"+h.border_radius+"px;":"");var c=h.id+".image";h.parent.images[c]=h.canvas;h.parent.images[c].ready=
1;h.parent.images[c].complete=!0;h.parent.images[c].canvas=!0;h.evaluator.setVariable(c,c);h.graphicControlContainer=a.newHTML("div",{id:h.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+h.zIndex+";"});h.numCtrContainer=a.newHTML("div",{id:h.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+h.zIndex+";"});h.container=a.newHTML("div",{id:h.id,class:"DescartesSpace3DContainer",style:"z-index:"+h.zIndex+";"});h.container.appendChild(h.backCanvas);h.container.appendChild(h.canvas);
h.container.appendChild(h.graphicControlContainer);h.container.appendChild(h.numCtrContainer);b.container.insertBefore(h.container,b.loader);h.eye={x:0,y:0,z:0};h.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}];c=0;for(var g=h.lights.length;c<g;c++)h.lights[c]=a.normalize3D(h.lights[c]);h.light3={x:0,y:0,z:0};h.intensity=[.4,.5,.3,0];h.userIntensity=0;h.dim=1;h.tmpIntensity=[];h.OxStr=h.id+".Ox";h.OyStr=h.id+".Oy";h.scaleStr=h.id+".escala";h.wStr=h.id+"._w";h.hStr=h.id+
"._h";h.obsStr=h.id+".observador";h.ojoXStr=h.id+".Ojo.x";h.ojoYStr=h.id+".Ojo.y";h.ojoZStr=h.id+".Ojo.z";h.rotZStr=h.id+".rot.z";h.rotYStr=h.id+".rot.y";h.userIDimStr=h.id+".userIlum.dim";h.userIIStr=h.id+".userIlum.I";h.userIxStr=h.id+".userIlum.x";h.userIyStr=h.id+".userIlum.y";h.userIzStr=h.id+".userIlum.z";h.evaluator.setVariable(h.rotZStr,0);h.evaluator.setVariable(h.rotYStr,0);h.evaluator.setVariable(h.userIDimStr,h.dim);h.evaluator.setVariable(h.userIIStr,h.userIntensity);h.evaluator.setVariable(h.userIxStr,
0);h.evaluator.setVariable(h.userIyStr,0);h.evaluator.setVariable(h.userIzStr,0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},h);h.evaluator.setFunction(h.id+"._X3D2D_",function(a,b,d){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=d;K.computeDepth(h);return K.projVert[0].x});h.evaluator.setFunction(h.id+"._Y3D2D_",function(a,b,d){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=d;K.computeDepth(h);return K.projVert[0].y});h.resizable&&(h.wModExpr=b.evaluator.parser.parse(h.wModExpr),
h.hModExpr=b.evaluator.parser.parse(h.hModExpr));h.addEvents();return d};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){h=this;h.initSpace();h.canvas&&(h.old_w=h.w,h.old_h=h.h,h.canvas.width=h.backCanvas.width=h.w*h.ratio,h.canvas.height=h.backCanvas.height=h.h*h.ratio,h.canvas.style.width=h.backCanvas.style.width=h.w+"px",h.canvas.style.height=h.backCanvas.style.height=h.h+"px");h.w_2=h.w/2;h.h_2=h.h/2;h.w_plus_h=h.w+h.h;h.oldMouse={x:0,y:0};h.S={x:h.h/1080*-20.6*(40/h.scale),y:0,z:0};
h.Ojo={x:3*h.w_2,y:0,z:0};h.evaluator.setVariable(h.ojoXStr,h.Ojo.x);h.evaluator.setVariable(h.ojoYStr,h.Ojo.y);h.evaluator.setVariable(h.ojoZStr,h.Ojo.z)};R.prototype.update=function(a){h=this;d=h.evaluator;n=h.parent;d.setVariable(h.wStr,h.w);d.setVariable(h.hStr,h.h);h.drawIfValue=0<d.eval(h.drawif);if(h.drawIfValue){h.resizable&&(wModExpr=h.evaluator.eval(h.wModExpr),hModExpr=h.evaluator.eval(h.hModExpr),h.old_w!=wModExpr||h.old_h!=hModExpr)&&(h.w=wModExpr,h.h=hModExpr,h.w_2=h.w/2,h.h_2=h.h/2,
d.setVariable(h.wStr,h.w),d.setVariable(h.hStr,h.h),h.old_w=h.w,h.old_h=h.h,h.canvas.width=h.backCanvas.width=h.w*h.ratio,h.canvas.height=h.backCanvas.height=h.h*h.ratio,h.canvas.style.width=h.backCanvas.style.width=h.w+"px",h.canvas.style.height=h.backCanvas.style.height=h.h+"px",a=!0,h.S={x:h.h/1080*-20.6*(40/h.scale),y:0,z:0},h.Ojo={x:3*h.w_2,y:0,z:0},h.evaluator.setVariable(h.ojoXStr,h.Ojo.x),h.evaluator.setVariable(h.ojoYStr,h.Ojo.y),h.evaluator.setVariable(h.ojoZStr,h.Ojo.z));u=h.x!==d.eval(h.xExpr)+
h.displaceRegionWest;x=h.y!==d.eval(h.yExpr)+n.plecaHeight+h.displaceRegionNorth;h.spaceChange=a||u||x||h.drawBefore!==h.drawIfValue||h.Ox!==d.getVariable(h.OxStr)||h.Oy!==d.getVariable(h.OyStr)||h.Ojo.x!==d.getVariable(h.ojoXStr)||h.Ojo.y!==d.getVariable(h.ojoYStr)||h.Ojo.z!==d.getVariable(h.ojoZStr)||h.scale!==d.getVariable(h.scaleStr);h.x=u?d.eval(h.xExpr)+h.displaceRegionWest:h.x;h.y=x?d.eval(h.yExpr)+n.plecaHeight+h.displaceRegionNorth:h.y;h.Ojo.x=d.getVariable(h.ojoXStr);h.Ojo.y=d.getVariable(h.ojoYStr);
h.Ojo.z=d.getVariable(h.ojoZStr);h.Ox=d.getVariable(h.OxStr);h.Oy=d.getVariable(h.OyStr);h.scale=d.getVariable(h.scaleStr);h.drawBefore=h.drawIfValue;if(a||void 0==h.observer){a=0;for(var c=h.parent.controls.length;a<c;a++)h.parent.controls[a].id===h.obsStr&&(Q=!0);h.observer=Q?d.getVariable(h.obsStr)||2.5*h.w_plus_h:2.5*h.w_plus_h;h.observer=b(h.observer,.25*h.w_plus_h);d.setVariable(h.obsStr,h.observer)}1E-6>h.scale?(h.scale=1E-6,d.setVariable(h.scaleStr,1E-6)):1E6<h.scale&&(h.scale=1E6,d.setVariable(h.scaleStr,
1E6));if(u||x)h.container.style.left=h.x+"px",h.container.style.top=h.y+"px";h.container.style.display="block";h.dim=d.getVariable(h.userIDimStr);h.userIntensity=d.getVariable(h.userIIStr);h.light3={x:parseInt(d.getVariable(h.userIxStr)),y:parseInt(d.getVariable(h.userIyStr)),z:parseInt(d.getVariable(h.userIzStr))};h.updateCamera();h.ctx.setTransform(h.ratio,0,0,h.ratio,0,0);h.draw()}else h.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};
R.prototype.rotateVertex=function(b){z=a.degToRad(h.evaluator.getVariable(h.rotZStr));w=g(z);y=m(z);e=b.x*w-b.y*y;f=b.x*y+b.y*w;c=b.z;z=a.degToRad(h.evaluator.getVariable(h.rotYStr));w=g(z);y=m(z);return{x:c*y+e*w,y:f,z:c*w-e*y}};R.prototype.project=function(a){h=this;this.evaluator.getVariable("URL.oldProj");var b=h.eye.x/(a.x-h.eye.x);return{x:h.getAbsoluteX(b*(h.eye.y-a.y)),y:h.getAbsoluteY(b*(h.eye.z-a.z)),z:h.eye.x-a.x}};R.prototype.computeColor=function(b,d,c){"object"!=typeof b&&(b.match("rgba")?
b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1))));L=a.subtract3D(this.eye,d.average);M=a.norm3D(L);O=a.scalarProduct3D(L,1/M);this.lights[3]=a.subtract3D(this.light3,d.average);G=a.norm3D(this.lights[3]);for(var g=0,f=this.intensity.length-1;g<f;g++)J[g]=this.intensity[g]*this.dim;J[3]=this.userIntensity*this.userIntensity/G||0;D=c?this.dim/2:this.dim/4;B=0;I=0>d.direction?d.normal:a.scalarProduct3D(d.normal,-1);g=0;for(f=this.lights.length;g<f;g++)c?(B=Math.max(0,a.dotProduct3D(r(this.lights[g],
I),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[g],I)),D+=J[g]*B;D=Math.min(D,1);A=l(b.r*D);F=l(b.g*D);E=l(b.b*D);return"rgba("+A+","+F+","+E+","+b.a+")"};R.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===
this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];
for(var d=a+1;d<b;d++)q=this.graphics[d],v.splitFace(q),q.splitFace(v);this.primitives=this.primitives.concat(v.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(d=a+1;d<b;d++)q=this.graphics[d],q.split&&v.splitFace(q);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);
else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var b=a.length,d=0;d<b;d++)a[d].drawn=!1,a[d].draw(this.ctx,this);for(var c=[],g=[],f=0,e=a.length,h=.001,k,n;;){k=e;for(d=0;d<b;d++)if(!a[d].drawn){n=!0;for(var m=0;m<b;m++)if(m!=d&&!a[m].drawn&&a[d].inFrontOf(c,a[m],h)){n=!1;break}n&&(e--,g[f++]=a[d],a[d].drawn=!0)}if(0==e)break;else if(e==k){if(h*=10,.1<
h){for(d=0;d<b;d++)a[d].drawn||(g[f++]=a[d],a[d].drawn=!0);break}}else h=.001}for(d=0;d<b;d++)g[d].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();e.click=0;e.evaluator.setVariable(e.id+".mouse_pressed",0);window.removeEventListener("touchmove",f,!1);window.removeEventListener("touchend",
b,!1);a.preventDefault();e.parent.update()}function d(b){document.body.focus();e.click=0;e.evaluator.setVariable(e.id+".mouse_pressed",0);b.preventDefault();"R"===e.whichBtn&&(window.removeEventListener("mousemove",g,!1),e.posZoom==e.posZoomNew&&a.showConfig&&e.parent.externalSpace.show());window.removeEventListener("mousemove",f,!1);window.removeEventListener("mouseup",d,!1);e.parent.update()}function c(b){e.posAnte=a.getCursorPosition(b,e.container);e.mouse_x=e.getRelativeX(e.posAnte.x);e.mouse_y=
e.getRelativeY(e.posAnte.y);e.evaluator.setVariable(e.id+".mouse_x",e.mouse_x);e.evaluator.setVariable(e.id+".mouse_y",e.mouse_y);e.parent.update()}function g(b){b.preventDefault();e.posZoomNew=a.getCursorPosition(b,e.container).y;e.evaluator.setVariable(e.scaleStr,e.tempScale+e.tempScale/45*((e.posZoom-e.posZoomNew)/10));e.posObserverNew=a.getCursorPosition(b,e.container).x;e.evaluator.setVariable(e.obsStr,e.tempObserver-2.5*(e.posObserver-e.posObserverNew));e.parent.update()}function f(b){if(!e.fixed&&
e.click){p=(e.getAbsoluteX(e.oldMouse.x)-e.getAbsoluteX(e.mouse_x))/4;k=(-e.getAbsoluteY(e.oldMouse.y)+e.getAbsoluteY(e.mouse_y))/4;if(p!==e.disp.x||k!==e.disp.y)e.alpha=a.degToRad(e.evaluator.getVariable(e.rotZStr)),e.beta=a.degToRad(-e.evaluator.getVariable(e.rotYStr)),e.alpha=a.radToDeg(e.alpha)-p,e.beta=a.radToDeg(e.beta)-k,e.evaluator.setVariable(e.rotZStr,e.alpha),e.evaluator.setVariable(e.rotYStr,-e.beta),e.disp.x=p,e.disp.y=k,e.oldMouse.x=e.getRelativeX(e.posAnte.x),e.oldMouse.y=e.getRelativeY(e.posAnte.y);
c(b);b.preventDefault()}}var e=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(d){window.focus();document.activeElement.blur();e.click=1;e.evaluator.setVariable(e.id+".mouse_pressed",1);e.parent.deactivateControls();e.posAnte=a.getCursorPosition(d,e.container);e.oldMouse.x=e.getRelativeX(e.posAnte.x);e.oldMouse.y=e.getRelativeY(e.posAnte.y);c(d);window.addEventListener("touchmove",f);window.addEventListener("touchend",b);d.preventDefault()});
this.canvas.addEventListener("mousedown",function(b){document.body.focus();e.click=1;e.parent.deactivateControls();e.whichBtn=a.whichBtn(b);"R"===e.whichBtn?(window.addEventListener("mouseup",d),e.posObserver=a.getCursorPosition(b,e.container).x,e.posObserverNew=e.posObserver,e.posZoom=a.getCursorPosition(b,e.container).y,e.posZoomNew=e.posZoom,e.fixed||(e.tempScale=e.scale,e.tempObserver=e.observer,window.addEventListener("mousemove",g))):"L"==e.whichBtn&&(e.evaluator.setVariable(e.id+".mouse_pressed",
1),e.posAnte=a.getCursorPosition(b,e.container),e.oldMouse.x=e.getRelativeX(e.posAnte.x),e.oldMouse.y=e.getRelativeY(e.posAnte.y),c(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",d));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){d(a)});document.addEventListener("mouseleave",function(a){d(a)})};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,f,c,r,l,b,g=function(b,d){var c=a.Space.call(this,b,d)||this;e=c.parent.evaluator;void 0!=c._w_&&(b=e.parser.parse(c._w_),c._w_="number"!=b.type?b:void 0);void 0!=c._h_&&(b=e.parser.parse(c._h_),c._h_="number"!=b.type?b:void 0);c.isFirefox=/firefox/i.test(window.navigator.userAgent);c.file=c.file?c.file.trim():"";c.file.match(/^\[/)&&c.file.match(/\]$/)?c.file=e.parser.parse(c.file.substring(1,c.file.length-1)):c.file.match(/^'/)&&c.file.match(/'$/)?
c.file=e.parser.parse(c.file):c.file=e.parser.parse("'"+c.file+"'");c.oldFile=e.eval(c.file);c.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=c.oldFile&&c.MyIFrame.setAttribute("src",c.oldFile);c.container=a.newHTML("div",{id:c.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+
c.zIndex+";background-repeat:no-repeat;background-position:center;"});c.container.appendChild(c.MyIFrame);c.imageSrc&&(c.container.style.backgroundImage="url("+c.imageSrc+")");c.parent.container.insertBefore(c.container,c.parent.loader);c.MyIFrame.onload=function(b){var d=this;c.evaluator.setFunction(c.id+".set",function(a,b){d.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});c.evaluator.setFunction(c.id+".update",function(){d.contentWindow.postMessage({type:"update"},"*");return 0});
c.evaluator.setFunction(c.id+".exec",function(a,b){d.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});c.evaluator.setFunction(c.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var c=a.cacheFiles[b];else c=(c=document.getElementById(b))&&"descartes/embed"===c.type?c.textContent:a.openFile(b),c=(c=(new DOMParser).parseFromString(c,"text/html").querySelector("ajs"))?c.innerHTML:"",a.cacheFiles[b]=c;d.contentWindow.postMessage({type:"change_config",filename:b,content:c},"*")}return 0});
c.evaluator.setFunction(c.id+".changeContent",function(a){a&&(a=(a=(new DOMParser).parseFromString(a.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?a.innerHTML:"",d.contentWindow.postMessage({type:"change_content",content:a},"*"))});c.ImReady=!c.isFirefox;c.isFirefox||(c.container.style.visibility="visible",c.container.style.opacity="1",c.container.style.zIndex=c.zIndex,c.container.style.display=c.drawIfValue?"block":"none");c.MyIFrame.style.visibility="visible";c.container.style.backgroundImage=
""};c.update=c.iframeUpdate;c.evaluator.setVariable(c.id+"._scroll",0);return c};$jscomp.inherits(g,a.Space);g.prototype.init=function(){l=this;l.initSpace();l.MyIFrame&&Object.assign(l.MyIFrame.style,{width:l.w+"px",height:l.h+"px"})};g.prototype.iframeUpdate=function(a){e=this.evaluator;this.drawIfValue=0<e.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=
this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);f=this.x!==e.eval(this.xExpr)+this.displaceRegionWest;c=this.y!==e.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=f?e.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=c?e.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=e.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=
a+"px",this.w=a));void 0!=this._h_&&(a=e.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(f||c)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";r=e.eval(this.file);r!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?
this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),this.MyIFrame.style.visibility="hidden",this.oldFile=r,this.MyIFrame.contentWindow.location.replace(r));b=e.getVariable(this.id+"._scroll");1==b?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==b?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};
a.SpaceHTMLIFrame=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=1,f=function(c){this.children=c.children;this.lessonParser=c.lessonParser;this.images=c.images;this.images.length=c.images.length;this.audios=c.audios;this.audios.length=c.audios.length;this.descartesApp=c;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});c.imgLoader?(c.loader.style.backgroundColor="transparent",this.imgLoader.setAttribute("style","background-image:url("+
c.imgLoader+");background-size:contain;")):(e=c.width<c.height?c.width/1144:c.height/1092,e=2.5<e?2.5:e,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*e+"px;"),this.progress.setAttribute("style","visibility:visible;left:"+(c.width-726*e)/2+"px;top:"+(33.5*c.height/100+940*e/2)+"px;width:"+726*e+"px;height:"+14*e+"px;"));c.loader.appendChild(this.imgLoader);c.loader.appendChild(this.progress);c.firstRun=!1;this.initPreloader()};
f.prototype.initPreloader=function(){var c=this,f=c.children,e=c.images,b=c.audios,g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,m=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;e["lib/DescartesCCLicense.png"]=a.getCCLImg();e["lib/DescartesCCLicense.png"].ready=1;var d;var n=0;for(d=f.length;n<d;n++)if("rtf"!==f[n].name){if(f[n].value.match(/'macro'|'makro'/g)){var h="";var v=void 0;var q=c.lessonParser.split(f[n].value);var u=0;for(var x=q.length;u<x;u++)"expresion"===babel[q[u][0]]&&(h=q[u][1]);h&&
(v=(v=document.getElementById(h))&&"descartes/macro"==v.type?v.text:a.openFile(h));if(v&&(v=v.match(g)))for(h=0,u=v.length;h<u;h++)q=v[h],q.toLowerCase().match(/vacio.gif$/)||""==q.substring(0,q.length-4)||(e[q]=new Image,q.startsWith("http")&&(e[q].crossOrigin="Anonymous"),e[q].addEventListener("load",function(){this.ready=1}),e[q].addEventListener("error",function(){this.errorload=1}),e[q].src=q)}if(v=f[n].value.match(g))for(h=0,u=v.length;h<u;h++)q=v[h],q.toLowerCase().match(/vacio.gif$/)||""==
q.substring(0,q.length-4)||(e[q]=new Image,q.startsWith("http")&&(e[q].crossOrigin="Anonymous"),e[q].addEventListener("load",function(){this.ready=1}),e[q].addEventListener("error",function(){this.errorload=1}),e[q].src=q);if(v=f[n].value.match(m))for(h=0,q=v.length;h<q;h++)c.initAudio(v[h])}for(var p in e)e.hasOwnProperty(p)&&c.images.length++;for(var k in b)b.hasOwnProperty(k)&&c.audios.length++;var z=c.images.length+c.audios.length;0<z&&c.progress.setAttribute("max",z);var w,y=function(){w=0;for(var d in e)e.hasOwnProperty(d)&&
(e[d].ready||e[d].errorload)&&w++;for(var g in b)b.hasOwnProperty(g)&&(b[g].ready||b[g].errorload)&&w++;c.progress.setAttribute("value",w);w!=z?c.timer=a.setTimeout(y,1):c.descartesApp.initBuildApp()};y()};f.prototype.initAudio=function(c){var e=this.audios;e[c]=new Audio(c);e[c].filename=c;var f=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo "+c+" no puede ser reproducido"),
this.errorload=1):(e[c]=new Audio(this.filename.replace("mp3","ogg")),e[c].filename=this.filename.replace("mp3","ogg"),e[c].addEventListener("canplaythrough",f),e[c].addEventListener("load",f),e[c].addEventListener("error",b),e[c].load())};e[c].addEventListener("canplaythrough",f);e[c].addEventListener("load",f);e[c].addEventListener("error",b);a.hasTouchSupport?(e[c].load(),e[c].play(),a.setTimeout(function(){e[c].pause()},20),e[c].ready=1):e[c].load()};a.DescartesLoader=f;return a}(descartesJS||
{});
descartesJS=function(a){function e(){f=window.innerWidth/this.width;c=window.innerHeight/this.height;a.cssScale=r=Math.min(f,c);this.container.style.transformOrigin="0 0";this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";f<c?(this.container.style.left="0",this.container.style.top="50%",this.container.style.transform="translate3d(0px,0px,0px) scale("+r+") translate(0,-50%)"):(this.container.style.left="50%",this.container.style.top="0",
this.container.style.transform="translate3d(0px,0px,0px) scale("+r+") translate(-50%,0)")}if(a.loadLib)return a;var f,c,r,l=function(b){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=b;this.parentC=b.parentNode;this.width=parseFloat(b.getAttribute("width"));this.height=parseFloat(b.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=b.getElementsByTagName("param");
a.ccLicense=!0;for(var c=$jscomp.makeIterator(this.children),e=c.next();!e.done;e=c.next())e=e.value,"CreativeCommonsLicense"===e.name&&(a.ccLicense="no"!==e.value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.keyboard=new a.Keyboard(this);this.scaleToFit=function(){};this.init()};l.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",
this.height);this.evaluator.setVariable("DJS.container_w",this.width);this.evaluator.setVariable("DJS.container_h",this.height);this.getURLParameters();this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);this.licenseA=a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Cr\u00e9ditos|https://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";var b,c=0,f=0,d=a.ccLicense?90:0,n=$jscomp.makeIterator(this.children);for(b=n.next();!b.done;b=n.next())if(b=b.value,"rtf_height"==b.name)c=parseInt(b.value)+120||this.height;else if("Buttons"==babel[b.name])this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value),f=this.buttonsConfig.height;else if("image_loader"==b.name)this.imgLoader=b.value;else if("expand"==b.name)this.expand=b.value;else if("docBase"==b.name)document.head.appendChild(a.newHTML("base",{id:"descartesJS_base",href:b.value}));
else if(b.name.startsWith("E_"))break;this.arquimedes&&(this.ratio=1,c&&(this.height=c+f+d));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),textFields:[]};
this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=this.height;this.container.className=
"DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(c=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesAppsPrint"}),document.head.insertBefore(c,document.head.firstChild),c.innerHTML="@page{margin:0cm;size:"+this.width+"px "+this.height+"px;}",this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.scaleToFit=
e,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(q){}if(this.spaces)for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=
a.next())b=b.value,b.initSpace(),b.init(),b.update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()};l.prototype.initBuildApp=function(){a.showConfig=!0;var b,c=this.lessonParser,e=[],d=[],f=[],h=[],l=[],q=[],r=$jscomp.makeIterator(this.children);for(b=r.next();!b.done;b=r.next())if(b=b.value,"editable"==babel[b.name])a.showConfig="false"!=babel[b.value];else if("language"==babel[b.name])this.language=b.value;
else if("pleca"==b.name)b=c.parsePleca(b.value,this.width),this.container.insertBefore(b,this.loader),this.plecaHeight=b.imageHeight?b.imageHeight:b.offsetHeight;else if("Buttons"==babel[b.name])this.buttonsConfig=c.parseButtonsConfig(b.value);else if("decimal_symbol"==babel[b.name])this.decimal_symbol=b.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[b.name])this.version=parseInt(b.value);else if("language"==babel[b.name])this.language=b.value;else if("rtf"==
b.name){var x=(this.width-780)/2,p=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;h.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+b.value.replace(/'/g,"&squot;")+"'","space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+x+","+(p-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&h.push("space='descartesJS_stage' type='image' expresion='["+(x+15)+","+p+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else b.name.startsWith("E_")?
(b.value.match(/'HTMLIFrame'/)&&this.nIframes++,e.push(b.value)):b.name.startsWith("C_")?d.push(b.value):b.name.startsWith("A_")?f.push(b.value):b.name.startsWith("G_")?(b.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),h.push(b.value)):b.name.startsWith("S_")?l.push(b.value):"Animation"==babel[b.name]&&q.push(b.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),
scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_stage' fondo='"+(a.TextController?"ffffffff":"blanco")+"' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+this.width+"' alto='"+this.height+"'"),this.stage.container.appendChild(this.stage.stageSpace.container),this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));b=0;for(x=e.length;b<x;b++)r=c.parseSpace(e[b]),this.arquimedes&&this.stage.container.appendChild(r.container),
this.spaces.push(r),this.zIndex++;r=0;for(b=h.length;r<b;r++)if(a.DEBUG.elemIndex=r,e=c.parseGraphic(h[r]))this.editableRegionVisible=this.editableRegionVisible||e.visible,e.space.addGraph(e);h=0;for(r=l.length;h<r;h++)(e=c.parse3DGraphic(l[h]))&&e.space.addGraph(e,!0);l=0;for(h=d.length;l<h;l++)this.controls.push(c.parseControl(d[l]));d=0;for(l=f.length;d<l;d++)c.parseAuxiliar(f[d]);f=0;for(d=q.length;f<d;f++)this.animation=c.parseAnimation(q[f]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();
c=0;for(q=this.controls.length;c<q;c++)this.controls[c].init();this.updateControls();this.updateSpaces(!0);var k=this;a.setTimeout(function(){k.finishInit()},10*k.nIframes);document.addEventListener("keydown",function(a){if(a.ctrlKey&&a.shiftKey&&"C"===a.key||a.commandKey&&a.shiftKey&&"c"===a.key)console.log("Control+Shift+C o Command+Shift+C presionados!"),navigator.clipboard.writeText(k.applet.innerHTML),a.stopPropagation(),a.preventDefault()})};l.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",
this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",
href:window.location.href},"*");this.externalSpace.init();try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(m){console.warn("CustomEvents not supported in this browser")}var c=this;this.evaluator.setFunction("openKB",function(a,b,g,e,f,l,r,x,p,k,z){c.keyboard.show(null,a,b,g,e,{x:f,y:l,w:r,h:x,fs:p+"px",value:k+"",type:"custom",tagName:"textfield"},z)});this.readyApp=!0};l.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=
this.parentC.style.margin=this.parentC.style.padding="0px";var b=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-c)/2);window.resizeTo(b,c);a.onResize()};l.prototype.configRegions=function(){var b=this.evaluator.parser,c=this.buttonsConfig||{},e=this.container,d="15",f=100,h=100,l=100,q=100;2===this.version&&(d="14",f=63,h=50,l=44,q=53);var r=0,x=0,p=0,k=0,z=0,w=this.northSpace.controls,y=this.southSpace.controls;var A=this.eastSpace.controls;
var F=this.westSpace.controls;if(0<c.rowsNorth||0<w.length||c.about||c.config){0>=c.rowsNorth?(r=c.height,c.rowsNorth=1):r=c.height*c.rowsNorth;var E=this.northSpace.container;E.id="descartesJS_north";E.setAttribute("style","width:"+e.width+"px;height:"+r+"px;left:0;top:"+this.plecaHeight+"px;");e.insertBefore(E,this.loader);E=e.width;var G=0;c.about?(G=f,E-=G):f=0;c.config&&(E-=h);for(var J=Math.ceil(w.length/c.rowsNorth),D=E/J,B=0,I=w.length;B<I;B++)w[B].expresion=b.parse("("+(G+B%J*D)+","+c.height*
Math.floor(B/J)+","+D+","+c.height+")"),w[B].init();c.about&&(w=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(d),expresion:b.parse("(0,0,"+f+","+r+")")}),w.actionExec={execute:a.showAbout},w.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(d),action:"config",expresion:b.parse("("+(E+f)+",0,"+h+","+r+")")})).update()}if(0<c.rowsSouth||0<y.length||c.init||c.clear){0>=c.rowsSouth?(x=c.height,c.rowsSouth=
1):x=c.height*c.rowsSouth;f=e.width;h=0;c.init?(h=l,f-=h):l=0;c.clear&&(f-=q);E=this.southSpace.container;E.id="descartesJS_south";E.setAttribute("style","width:"+e.width+"px;height:"+x+"px;left:0;bottom:0;");e.insertBefore(E,this.loader);E=Math.ceil(y.length/c.rowsSouth);w=f/E;G=0;for(J=y.length;G<J;G++)y[G].expresion=b.parse("("+(h+G%E*w)+","+c.height*Math.floor(G/E)+","+w+","+c.height+")"),y[G].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(d),
action:"init",expresion:b.parse("(0,0,"+l+","+x+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(d),action:"clear",expresion:b.parse("("+(f+l)+",0,"+q+","+x+")")})).update()}if(0<A.length)for(d=e.height-r-x,k=c.widthEast,l=this.eastSpace.container,l.id="descartesJS_east",l.setAttribute("style","width:"+k+"px;height:"+d+"px;right:0;top:"+r+"px;"),e.insertBefore(l,this.loader),d=0,l=A.length;d<l;d++)A[d].expresion=b.parse("(0,"+
c.height*d+","+k+","+c.height+")"),A[d].init();if(0<F.length)for(A=e.height-r-x,z=c.widthWest,d=this.westSpace.container,d.id="descartesJS_west",d.setAttribute("style","width:"+z+"px;height:"+A+"px;left:0;top:"+r+"px;"),e.insertBefore(d,this.loader),A=0,d=F.length;A<d;A++)F[A].expresion=b.parse("(0,"+c.height*A+","+z+","+c.height),F[A].init();if(this.editableRegionVisible)for(p=c.height,b=this.editableRegion.container,b.id="descartesJS_editableRegion",b.setAttribute("style","position:absolute;width:"+
e.width+"px;height:"+p+"px;left:0;top:"+(e.height-x-c.height)+"px;"),e.insertBefore(b,this.loader),c=this.editableRegion.textFields,e=e.width/c.length,F=a.getFieldFontSize(p),A=0,d=c.length;A<d;A++)"div"==c[A].type?(b.appendChild(c[A].container),c[A].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+p+"px;position:absolute;left:"+A*e+"px;top:0;"),l=c[A].container.firstChild,l.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+F+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+
p+"px;text-align:center;line-height:"+p+"px;"),q=l.offsetWidth,l.style.width=q+"px",l.firstChild.textContent=l.firstChild.textContent.substring(3,l.firstChild.textContent.length-3),c[A].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+F+"px;width:"+(e-q)+"px;height:"+p+"px;position:absolute;left:"+q+"px;top:0;border:2px groove white;")):(b.appendChild(c[A]),c[A].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+F+"px;width:"+e+"px;height:"+p+
"px;position:absolute;left:"+A*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=r;this.displaceRegionSouth=x+(p||0);this.displaceRegionEast=k;this.displaceRegionWest=z;r=$jscomp.makeIterator(this.spaces);for(x=r.next();!x.done;x=r.next())x.value.init()};l.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};l.prototype.clearClick=function(){for(var a=$jscomp.makeIterator(this.spaces),c=a.next();!c.done;c=
a.next())c.value.clearClick()};l.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var b=$jscomp.makeIterator(this.controls),c=b.next();!c.done;c=b.next())c.value.buttonClick=!1};l.prototype.deactivateControls=function(){if(this.controls)for(var a=$jscomp.makeIterator(this.controls),c=a.next();!c.done;c=a.next())c=c.value,c.deactivate&&c.deactivate()};l.prototype.updateAuxiliaries=function(){for(var a=$jscomp.makeIterator(this.auxiliaries),c=a.next();!c.done;c=a.next())c.value.update()};
l.prototype.updateEvents=function(){for(var a=$jscomp.makeIterator(this.events),c=a.next();!c.done;c=a.next())c.value.update()};l.prototype.updateControls=function(){for(var a=$jscomp.makeIterator(this.controls),c=a.next();!c.done;c=a.next())c.value.update()};l.prototype.updateSpaces=function(a){for(var b=$jscomp.makeIterator(this.spaces),c=b.next();!c.done;c=b.next())c.value.update(a)};l.prototype.clear=function(){for(var a=$jscomp.makeIterator(this.spaces),c=a.next();!c.done;c=a.next())c=c.value,
c.spaceChange=!0,c.drawBackground&&c.drawBackground()};l.prototype.play=function(){this.animation.play()};l.prototype.stop=function(){this.animation.stop()};l.prototype.reinitAnimation=function(){this.animation.reinit()};l.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&this.audios[a].pause&&(this.audios[a].pause(),this.audios[a].currentTime=0)};l.prototype.getImage=function(a){if(a){if(this.images[a])return this.images[a];var b=this.images;b[a]=
new Image;a.startsWith("http")&&(b[a].crossOrigin="Anonymous");b[a].addEventListener("load",function(){this.ready=1});b[a].addEventListener("error",function(){this.ready=0;this.errorload=1});b[a].src=a;return b[a]}return new Image};l.prototype.getAudio=function(b){var c=this.audios;if(b){if(!c[b]){b.lastIndexOf(".");c[b]=new Audio(b);var e=function(a){this.ready=1};c[b].addEventListener("canplaythrough",e);var d=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-
3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(c[b]=new Audio(b.replace("mp3","ogg")),c[b].addEventListener("canplaythrough",e),c[b].addEventListener("load",e),c[b].addEventListener("error",d),c[b].load())};c[b].addEventListener("error",d);c[b].play();a.setTimeout(function(){c[b].pause()},15)}return c[b]}return new Audio};l.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};l.prototype.getControlById=function(a,c){c=c?"cID":"id";for(var b=$jscomp.makeIterator(this.controls),
d=b.next();!d.done;d=b.next())if(d=d.value,d[c]==a)return d;return{update:function(){},w:0,h:0}};l.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};l.prototype.getSpaceById=function(a,c){c=c?"cID":"id";for(var b=$jscomp.makeIterator(this.spaces),d=b.next();!d.done;d=b.next())if(d=d.value,d[c]==a)return d;return{update:function(){},w:0,h:0}};l.prototype.getURLParameters=function(){var a=window.location.href,c=a.indexOf("?");if(-1!=c)for(a=decodeURIComponent(a.substring(c+1)).split("&"),
a=$jscomp.makeIterator(a),c=a.next();!c.done;c=a.next())c=c.value.split("="),2==c.length&&this.evaluator.setVariable("URL."+c[0],+c[1]==+c[1]?parseFloat(c[1]):c[1])};l.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);a.backCanvas&&(a.backCanvas=a.backCtx=null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&
delete this.images[a]};a.DescartesApp=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(e,f){e="Error: "+e+" en\u300a "+f+" \u300b";var c="";switch(a.DEBUG.objectName){case "Auxiliar":f="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])c=" en la l\u00ednea "+(a.DEBUG.lineCount+1);e+=f+"\u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d"+c+".";break;case "Graphic":e+="En el gr\u00e1fico #"+(a.DEBUG.elemIndex+1)+" de tipo \u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(e)}};return a}(descartesJS||{});
descartesJS=function(a){function e(){f().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function f(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|DescartesWeb2_0/i.test(a.getAttribute("code"))})}function c(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function r(b){var g,f;return $jscomp.asyncExecutePromiseGeneratorProgram(function(b){switch(b.nextAddress){case 1:return b.setCatchFinallyBlocks(2),
g=[],["descartesJS_serif","descartesJS_sansserif","descartesJS_monospace","DJS_symbol","DJS_math"].forEach(function(a){g.push(document.fonts.load("20px "+a));g.push(document.fonts.load("bold 20px "+a));g.push(document.fonts.load("italic 20px "+a));g.push(document.fonts.load("bold italic 20px "+a))}),b.yield(Promise.all(g),4);case 4:b.leaveTryBlock(3);break;case 2:return f=b.enterCatchBlock(),console.log(f),b.return();case 3:a.getFeatures(),a.hasCanvas?(window.scrollTo(0,100),c(),e(),window.addEventListener("resize",
a.onResize),window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}",b.jumpToEnd()}})}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();
a.onResize=function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var l={};a.onMessage=function(b){if(0<a.apps.length){var c=b.data;c&&("set"===c.type?"string"==typeof c.value||"number"==typeof c.value?a.apps[0].evaluator.setVariable(c.name,c.value):c.value&&void 0!=c.value.rows?a.apps[0].evaluator.matrices[c.name]=c.value:a.apps[0].evaluator.vectors[c.name]=c.value:"update"===c.type?a.apps[0].update():"exec"===c.type?(b=a.apps[0].evaluator.getFunction(c.name))&&b.apply(a.apps[0].evaluator,c.value.toString().split(",")):
"isResizeNeeded"===c.type?b.source.postMessage({type:"doResize"},"*"):"doResize"===c.type?0<a.apps.length&&a.apps[0].adjustSize():"change_config"===c.type?(l[c.filename]?b=l[c.filename]:(b=a.newHTML("div"),b.innerHTML=c.content,b=b.getElementsByTagName("param"),l[c.filename]=b),a.apps[0].children=b,a.apps[0].init()):"change_content"===c.type&&(b=a.newHTML("div"),b.innerHTML=c.content,b=b.getElementsByTagName("param"),a.apps[0].children=b,a.apps[0].init()))}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",
r),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(b){window.addEventListener(b,function(b){a.onResize(b)})}));return a}(descartesJS||{});
