/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2020-03-03
*/
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,d=[];!(e=a.next()).done;)d.push(e.value);return d};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var e=function(){};e.prototype=a;return new e};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},e={};try{return e.__proto__=a,e.a}catch(d){}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 d=$jscomp.setPrototypeOf;d(a,e)}else for(d in e)if("prototype"!=d)if(Object.defineProperties){var c=Object.getOwnPropertyDescriptor(e,d);c&&Object.defineProperty(a,d,c)}else a[d]=e[d];a.superClass_=e.prototype};
$jscomp.checkStringArgs=function(a,e,d){if(null==a)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");return a+""};$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,d){a!=Array.prototype&&a!=Object.prototype&&(a[e]=d.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,d,c){if(e){d=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var u=a[c];u in d||(d[u]={});d=d[u]}a=a[a.length-1];c=d[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:e})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var d=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var c="";a;)if(a&1&&(c+=d),a>>>=1)d+=d;return c}},"es6","es3");$jscomp.owns=function(a,e){return Object.prototype.hasOwnProperty.call(a,e)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,e){for(var d=1;d<arguments.length;d++){var c=arguments[d];if(c)for(var u in c)$jscomp.owns(c,u)&&(a[u]=c[u])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,d,c){var e=this.length||0;0>d&&(d=Math.max(0,e+d));if(null==c||c>e)c=e;c=Number(c);0>c&&(c=Math.max(0,e+c));for(d=Number(d||0);d<c;d++)this[d]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,e,d){a instanceof String&&(a=String(a));for(var c=a.length,u=0;u<c;u++){var p=a[u];if(e.call(d,p,u,a))return{i:u,v:p}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var d=[],c=0;c<this.length;c++){var e=this[c];Array.isArray(e)&&0<a?(e=Array.prototype.flat.call(e,a-1),d.push.apply(d,e)):d.push(e)}return d}},"es9","es5");
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.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="expand";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.extra_style="extra_style";return a}(babel||
Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
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.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_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+
a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+
a.extraIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbola,DJS_extra,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbola,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbola,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";
a.convertFont=function(c){if(""==c)return"";e=c.split(",");d="";d+=a.getFontStyle(e[1])+" ";d+=e[2]+"px ";return d+=a.getFontName(e[0].split(" ")[0])};a.getFontName=function(d){d=d.toLowerCase();c=a.monospace_font;if("serif"===d||"times new roman"===d||"timesroman"===d||"times"===d)c=a.serif_font;else if("sansserif"===d||"arial"===d||"helvetica"===d)c=a.sansserif_font;return c};a.getFontStyle=function(a){return u[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,k,c,r,f,d;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(g){g=g||0;g=0>g?0:parseInt(g);a=this.toString();-1!==a.indexOf("e")&&(c=a.split("e"),f="-"===c[0][0]?"-":"",r="-"===f?parseFloat(c[0].substring(1)).oToFixed(11):parseFloat(c[0]).oToFixed(11),d=parseInt(c[1]),b=r.indexOf("."),r=r.replace(".",""),0>b+d?(b=0>b?1:b,a=f+"0."+"0".repeat(Math.abs(b+d))+r):a=f+r+"0".repeat(d-r.length+1));b=a.indexOf(".");-1===b?0<g&&
(a+="."+"0".repeat(g)):(k=a.length-b-1,a=k>=g?11>=g?parseFloat(a).oToFixed(g):a.substring(0,b+g+1):a+"0".repeat(g-k));return a}}if(a.loadLib)return a;var d=2*Math.PI,c=360/d,u=d/360,p=Math.floor,b,l,m,h;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*c};a.degToRad=function(a){return a*u};a.drawLine=function(a,b,k,c,r,f,d){a.lineWidth=d||1;a.strokeStyle=f||"black";h=a.lineWidth%2*.5;a.beginPath();a.moveTo(p(b)+h,p(k)+h);a.lineTo(p(c)+h,p(r)+h);a.stroke()};a.getColor=function(a,n){if("string"===
typeof n)return n;b=a.eval(n);return"rgba("+p(255*b[0][0])+","+p(255*b[0][1])+","+p(255*b[0][2])+","+(1-b[0][3])+")"};a.getFeatures=function(){var b=navigator.appVersion.toLowerCase();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=1.5);e()};var q,k;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(q=a.indexOf("."),-1!==q)){k=a.substring(q);if(0==parseFloat(k))return a.substring(0,q);for(var b=k.length-1;0<b;b--)if("0"!==k.charAt(b))return a.substring(0,q+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,b,k){a=void 0===a?0:a;b=void 0===
b?100:b;k="linear-gradient("+(void 0===k?0:k)+"deg,";for(var g=2*a,n=a;n<b;n++)a=p(100-n-35),k+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*n-g)+"%, ";return k+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(b,n){l=b.touches?b.touches[0]:b;m=n.getBoundingClientRect();return l?{x:(l.pageX-window.pageXOffset-m.left)/a.cssScale,y:(l.pageY-window.pageYOffset-m.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,g,k=[],r=0,f=0,c=a.length;f<c;f++)g=a.charAt(f),"'"===
g&&(b=!b),b||";"!==g&&"\n"!==g||(k.push(a.substring(r,f).replace(/\n/g,"\\n")),r=f+1);k.push(a.substring(r).replace(/\n/g,"\\n"));return k};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(b){var g=a.newHTML("textarea");g.innerHTML=b;return g.value};a.newHTML=function(a,b){a=document.createElement(a);for(var g in b)a.setAttribute(g,b[g]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||
window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function g(){Date.now()-n>=b&&(a.call(),n=Date.now());k.value=requestAnimationFrame(g)}if(!requestAnimationFrame)return setInterval(a,b);var n=Date.now(),k={};k.value=requestAnimationFrame(g);return k};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function g(){Date.now()-
n>=b?a.call():k.value=requestAnimationFrame(g)}if(!requestAnimationFrame)return setTimeout(a,b);var n=Date.now(),k={};k.value=requestAnimationFrame(g);return k};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='http://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='http://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='http://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='http://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='http://descartes.matem.unam.mx/'>http://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 n=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
n.document.write(b);n.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(e){if(a.cacheFiles[e])return a.cacheFiles[e];var d=null,c=new XMLHttpRequest;c.open("GET",e,!1);try{c.send(null),d=200===c.status||304===c.status?c.responseText:c.responseText||"",d=404===c.status?"":d,d.match(String.fromCharCode(65533))&&(c.open("GET",e,!1),c.overrideMimeType("text/plain;charset=ISO-8859-1"),c.send(null),d=c.responseText)}catch(u){d=null}return d};a.addExternalFileContent=function(e,
d){a.cacheFiles[e]=d};return a}(descartesJS||{});
descartesJS=function(a){function e(a){y=a.indexOf("--radial--");-1!=y&&(a=a.substring(0,y));p=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1),"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1)));"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1),p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1)));"*"===p.charAt(0)&&"*"!==
p.charAt(p.length-1)?p=p.substring(1)+"$":"*"!==p.charAt(0)&&"*"===p.charAt(p.length-1)?p="^"+p.substring(0,p.length-1):"*"!==p.charAt(0)&&"*"!==p.charAt(p.length-1)?p="^"+p+"$":"*"===p.charAt(0)&&"*"===p.charAt(p.length-1)&&(p=p.substring(1,p.length-1));a.regExp=p.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,b){p=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=p.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);h=a.expr[0];q=a.expr[1];k=c.eval(h.expr);g=c.eval(q.expr);n="("==h.type||"["==h.type;v=")"==q.type||"]"==q.type;return n&&b>k&&v&&b<=g?1:0}function u(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 p,b,l,m,h,q,k,g,n,v,y;a.buildRegularExpressionsPatterns=function(a,f){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 g=0,n=a.length;g<n;g++){b=a[g].split("&");l=[];for(var k=0,c=b.length;k<c;k++)p=b[k],-1===p.indexOf(",")||"("!==
p.charAt(0)&&"["!==p.charAt(0)||")"!==p.charAt(p.length-1)&&"]"!==p.charAt(p.length-1)?l.push(e(p)):l.push(d(p,f));a[g]=l}return a};a.escorrecto=function(g,f,n,k){n=n||a.externalEvaluator;k=k||a.buildRegularExpressionsPatterns(g,n);f=u(f);g=0;for(var d=k.length;g<d;g++){b=k[g];m=!0;for(var h=0,r=b.length;h<r;h++)m=b[h].regExp?m&&!!f.match(new RegExp(u(b[h].regExp),"i")):m&&c(b[h],f,n);if(m)return 1}return 0};a.esCorrecto=function(g,f,n,k){n=n||a.externalEvaluator;k=k||a.buildRegularExpressionsPatterns(g,
n);g=0;for(var d=k.length;g<d;g++){b=k[g];m=!0;for(var h=0,r=b.length;h<r;h++)(p=b[h].regExp)?(b[h].ignoreAccents&&(f=u(f),p=u(p)),b[h].ignoreCaps&&(f=f.toLowerCase(),p=u(p).toLowerCase()),m=m&&!!f.match(p)):m=m=m&&c(b[h],f,n);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,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===d?"24c":d)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+
(void 0===d?"d00018":d)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,d,c,u,p,b,l,m,h,q,k,g,n,v,y,r=function(b,g){this.r=this.g=this.b=0;this.a=1;this.evaluator=g;this.getColor=this.getColorStr;if(b){if(babel[b]&&("net"===babel[b]&&(b="rojo"),b=babel[b],this.r=a.toHex(b.substring(1,3)),this.g=a.toHex(b.substring(3,5)),this.b=a.toHex(b.substring(5,7)),this.colorStr=b),6===b.length&&(this.r=a.toHex(b.substring(0,2)),this.g=a.toHex(b.substring(2,4)),this.b=a.toHex(b.substring(4,6)),this.colorStr="#"+b),8===
b.length&&(this.r=a.toHex(b.substring(2,4)),this.g=a.toHex(b.substring(4,6)),this.b=a.toHex(b.substring(6,8)),this.a=1-a.toHex(b.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===b[0]){c=[];u=this.splitComa(b.substring(1,b.length-1));b=0;for(g=u.length;b<g;b++)l=u[b],p=parseInt(l,16),l!==p.toString(16)&&l!=="0"+p.toString(16)?("["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substring(1,l.length-1)),c.push(this.evaluator.parser.parse(l))):c.push(this.evaluator.parser.parse((p/
255).toString()));this.rExpr=c[0];this.gExpr=c[1];this.bExpr=c[2];this.aExpr=c[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};r.prototype.splitComa=function(a){b=[];for(var f=q=h=m=0,g=a.length;f<g;f++)k=a.charAt(f),"("===k?m++:")"===k?m--:"["===k?h++:"]"===k?h--:","===k&&0===m&&0===h&&(b.push(a.substring(q,f)),q=f+1);b.push(a.substring(q));return b};r.prototype.getColorStr=function(){return this.colorStr};r.prototype.getColorExp=function(){d=
this.evaluator;this.r=e(255*d.eval(this.rExpr));this.g=e(255*d.eval(this.gExpr));this.b=e(255*d.eval(this.bExpr));this.a=1-d.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};r.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(",");g=parseInt(a[0]).toString(16);n=parseInt(a[1]).toString(16);v=parseInt(a[2]).toString(16);y=(255-
parseInt(255*parseFloat(a[3]))).toString(16);1===g.length&&(g="0"+g);1===n.length&&(n="0"+n);1===v.length&&(v="0"+v);1===y.length&&(y="0"+y);return new r(y+g+n+v)};a.Color=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=document.head,d=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});e.appendChild(d);d=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||e.appendChild(d);d=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});e.appendChild(d);d=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});e.appendChild(d);
d=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});e.appendChild(d);(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-apearance:none;apearance: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;}\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:white;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:white;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:white;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:white;}\n.DescartesCheckbox{position:absolute;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.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;}\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;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\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.DJS_Gradient{position:absolute;display:none;}\n"+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.sin,d=Math.floor,c=Math.random,u=Math.round,p=Math.abs,b=String.fromCharCode,l,m,h,q,k,g,n,v,y,r,f=function(a){this.key=(void 0===a?0:a).toString()};f.prototype.getKey=function(a){l=[];for(var f=0;256>f;f++)l[f]=b(this.alfanum(d(p(7.5*(e(1*f-a)+e(1.4*f+a)+e(.6*f-a)+e(2.2*f+a))))));return l.join("")};f.prototype.encode=function(a){m=d(31*c());this.key=this.getKey(m);return b(this.alfanum(m))+this.encripta(a)};f.prototype.decode=function(a){m=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(m);return this.desencripta(a.substring(1))};f.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};f.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;g=Array(3*a.length);for(var b=0,f=a.length;b<f;b++)y=256*d(a[b]+128)+u(255*c())+65536*u(255*c()),r=d((y<<this.shift(b))/256),g[3*b]=this.alfanum(r%32),g[3*b+1]=this.alfanum(r/32%32),g[3*b+2]=this.alfanum(r/1024%32);return g};f.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};f.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;n=Array(a.length/3);for(var b=0,f=n.length;b<f;b++)r=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),y=d(256*r>>this.shift(b)),v=d(y/256)%256-128,0>v&&(v+=256),n[b]=v;return n};f.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};f.prototype.numalfa=function(a){return a-(58>a?48:87)};f.prototype.stringToBytes=
function(a){q=[];for(var b=0,f=a.length;b<f;b++)q.push(a.charCodeAt(b));return q};f.prototype.bytesToString=function(a){for(var f=0,g=a.length;f<g;f++)a[f]=b(a[f]);return a.join("")};f.prototype.shift=function(a){h=this.key.charCodeAt(a%this.key.length);q=this.numalfa(h);k=d(q/2%8);0==k&&(k=4);return k};f.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(d,c){this.parent=d;var e=d.evaluator,p=e.parser;d=new a.Auxiliary(d);var b=this;b.delay=c.delay?p.parse(c.delay):p.parse("60");b.loop=c.loop?c.loop:!1;b.auto=void 0==c.auto?!0:c.auto;b.controls=c.controls;b.init=d.splitInstructions(p,c.init);b.doExpr=d.splitInstructions(p,c.doExpr);c.whileExpr&&(b.whileExpr=p.parse(c.whileExpr));var l,m=b.doExpr.length;b.animExec=function(){for(l=0;l<m;l++)e.eval(b.doExpr[l]);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,c){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(d,c){d=a.Action.call(this,d,c)||this;d.parameter=(c||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return d};$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(d,c){d=a.Action.call(this,d,c)||this;var e=d.evaluator,p=e.parser;c=a.splitSeparator((c||"").replace(/&squot;/g,"'"));for(var b=[],l,m=0,h=c.length;m<h;m++)(l=p.parse(c[m],!0))&&b.push(l);h=b.length;d.execute=function(){for(m=0;m<h;m++)e.eval(b[m])};return d};$jscomp.inherits(e,a.Action);a.Calculate=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(d,c){var e=a.Action.call(this,d,c)||this;e.parser=d.evaluator.parser;e.evaluator=d.evaluator;e.parameter=c;e.target="_blank";return e};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var d=this.parameter;d.match(/^\[.*\]?/)&&(d=this.evaluator.eval(this.parser.parse(d.substring(1,d.length-1))));var c=d.indexOf("target");-1!=c&&(this.target=d.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),d=d.substring(0,
c-1));if("javascript"==d.substring(0,10)){d=new a.SimpleText(parent,d.substring(11).replace(/&squot;/g,"'"));try{eval(d.toString())}catch(u){}}else"http"!=d.substring(0,4)&&(c=window.__dirname||window.location.href,d=c.substring(0,c.lastIndexOf("/")+1)+d),window.open(d,this.target)};a.OpenURL=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(d,c){var e=a.Action.call(this,d,c)||this;e.parser=d.evaluator.parser;e.evaluator=d.evaluator;e.parameter=c.trim();e.target="_blank";return e};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.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(u){}}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(d,c){return a.Action.call(this,d,c)||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%;'><script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'>\x3c/script>"+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(d,c){return a.Action.call(this,d,c)||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(d,c){return a.Action.call(this,d,c)||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(d,c){return a.Action.call(this,d,c)||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(d,c){return a.Action.call(this,d,c)||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,d=function(c,d){c=a.Action.call(this,c,d)||this;d=d||"";d.match(e)?c.filenameExpr=c.evaluator.parser.parse("'"+d.match(e)+"'"):(d.match(/^\[.*\]?/)&&(d=d.substring(1,d.length-1)),c.filenameExpr=c.evaluator.parser.parse(d));return c};$jscomp.inherits(d,a.Action);d.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c=function(a,c){this.parent=a;this.evaluator=this.parent.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,p){d=[];p=p?a.splitSeparator(p):[""];for(var b=0,l=p.length;b<l;b++)a.DEBUG.lineCount=b,(e=c.parse(p[b],!0))&&d.push(e);return d};c.prototype.getPrivateVariables=function(a,c){d=[];c=c?c.split(/;|,/):
[""];for(var b=0,l=c.length;b<l;b++)(e=a.parse(c[b],!0))&&d.push(e);b=0;for(l=d.length;b<l;b++)d[b]="asign"===d[b].type?d[b].childs[0].value:"identifier"===d[b].type?d[b].value:"";return d};c.prototype.parseExpressions=function(c){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(c,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(c,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(c,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
c.parse(this.whileExpr)};a.Auxiliary=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(d,c){d=a.Auxiliary.call(this,d,c)||this;c=d.evaluator.parser;d.expresionString=d.expresion;d.expresion=c.parse(d.expresionString);d.expresion&&c.setVariable(d.id,d.expresion);d.editable&&(d.registerTextField(),d.parent.editableRegionVisible=!0);return d};$jscomp.inherits(e,a.Auxiliary);e.prototype.registerTextField=function(){var d=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;d.appendChild(c);d.appendChild(e);var p=this,b=p.evaluator.parser;e.onkeydown=function(a){13==a.keyCode&&(p.expresion=b.parse(this.value),b.setVariable(p.id,p.expresion),p.parent.update())};this.parent.editableRegion.textFields.push({container:d,type:"div"})};a.Variable=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(d,c){d=a.Auxiliary.call(this,d,c)||this;d.expresion=d.evaluator.parser.parse(d.expresion);d.update();return d};$jscomp.inherits(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,d,c,u,p=function(b,c){c=a.Auxiliary.call(this,b,c)||this;e=b.evaluator;d=e.parser;c.size=c.size||d.parse("3");c.expresion=c.expresion.split(";");c.parseFile=d.parse(c.file);c.update();return c};$jscomp.inherits(p,a.Auxiliary);p.prototype.update=function(){var b=this.expresion,l;e=this.evaluator;d=e.parser;this.oldFile=this.file;if(c=e.eval(this.parseFile))this.file=c;if(this.file){u=(l=document.getElementById(this.file))&&"descartes/vectorFile"==
l.type?l.text:a.openExternalFile(this.file);if(null!=u){u=u.replace(/\r/g,"").split("\n");var m=[];l=0;for(var h=u.length;l<h;l++)""!=u[l]&&m.push(u[l]);u=m}null==u||1==u.length&&""==u[0]?(u=[],this.size=d.parse("0")):(b=u,this.size=null);null===this.size&&(this.size=d.parse(b.length+""))}var q;m=[];l=0;for(h=b.length;l<h;l++)(q=d.parse(b[l],!0))&&"asign"!=q.type&&(q=d.parse(this.id+"["+l+"]="+b[l],!0)),m.push(q);b=Array(e.eval(this.size)).fill(0);b._size_=b.length;e.vectors[this.id]=b;e.setVariable(this.id+
".long",b._size_);l=0;for(h=m.length;l<h;l++)e.eval(m[l])};a.Vector=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b=function(b,m){m=a.Auxiliary.call(this,b,m)||this;e=b.evaluator;d=e.parser;m.rows=m.rows||d.parse("3");m.columns=m.columns||d.parse("3");m.expresion=m.splitInstructions(d,m.expresion);c=e.eval(m.rows);u=e.eval(m.columns);p=[];p.type="matrix";b=0;for(var h=u;b<h;b++)p[b]=Array(c).fill(0);e.matrices[m.id]=p;m.update();return m};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){e=this.evaluator;c=e.eval(this.rows);u=e.eval(this.columns);
e.setVariable(this.id+".filas",c);e.setVariable(this.id+".columnas",u);p=e.matrices[this.id];p.rows=c;p.cols=u;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(d,c){var e=a.Auxiliary.call(this,d,c)||this;var p=e.evaluator;d=p.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?d.parse(e.range):d.parse("1");e.params=""===e.params?[]:e.params.split(",");e.numberOfParams=e.params.length;e.algorithm||(e.init="",e.doExpr="",e.whileExpr="");e.parseExpressions(d);e.expresion=d.parse(e.expresion);e.functionExec=function(){e.iterations=0;
if(e.numberOfParams<=arguments.length){for(var b=[],c=0,d=e.privateVars.length;c<d;c++)b.push(p.getVariable(e.privateVars[c])),p.setVariable(e.privateVars[c],0);var h=[];c=0;for(d=e.params.length;c<d;c++)h[c]=p.getVariable(e.params[c]),p.setVariable(e.params[c],arguments[c]);c=0;for(d=e.init.length;c<d;c++)p.eval(e.init[c]);do{c=0;for(d=e.doExpr.length;c<d;c++)p.eval(e.doExpr[c]);if(1E5<++e.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
e.name+" >>"),0}while(0<p.eval(e.whileExpr));var q=p.eval(e.expresion);a.rangeOK=p.eval(e.domain);c=0;for(d=e.params.length;c<d;c++)p.setVariable(e.params[c],h[c]);c=0;for(d=e.privateVars.length;c<d;c++)p.setVariable(e.privateVars[c],b[c]);return q}return 0};p.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(d,c){var e=a.Auxiliary.call(this,d,c)||this;var p=e.evaluator;e.parseExpressions(p.parser);e.algorithmExec=function(){for(var a=e.iterations=0,c=e.init.length;a<c;a++)p.eval(e.init[a]);do{a=0;for(c=e.doExpr.length;a<c;a++)p.eval(e.doExpr[a]);if(1E5<++e.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+e.name+" >>"),0}while(0<p.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(d,c){d=a.Auxiliary.call(this,d,c)||this;c=d.evaluator;delete d.evaluate;d.condition=c.parser.parse(d.condition);d.lastEvaluation=!1;d.action=d.parent.lessonParser.parseAction(d);"onlyOnce"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==d.execution&&(d.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEvaluation?
(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return d};$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(d,c){var e=a.Auxiliary.call(this,d,c)||this;if(c=c.file){var p=document.getElementById(c);p=p&&"descartes/library"===p.type?p.text:a.openExternalFile(c)}if(p){p=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");c=0;for(var b=p.length;c<b;c++)""!==p[c].trim()&&d.lessonParser.parseAuxiliar(p[c])}return e};$jscomp.inherits(e,a.Auxiliary);a.Library=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h=function(b,c){this.parent=b;this.evaluator=b.evaluator;var g=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=g.parse("1");this.abs_coord=c.type&&"text"===c.type?!0:!1;this.color=new a.Color("blue");2!==this.parent.version&&(this.color=new a.Color("20303a"),this.parent.arquimedes&&(this.color=new a.Color("black")));this.trace="";this.expresion=g.parse("(0,0)");this.family="";this.family_interval=g.parse("[0,1]");
this.family_steps=g.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=g.parse("2");Object.assign(this,c);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?
parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&
(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};h.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};h.prototype.getFamilyValues=function(){e=this.evaluator;d=e.eval(this.family_interval);this.familyInf=d[0][0];this.familySup=d[0][1];this.fSteps=Math.round(e.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};h.prototype.drawFamilyAux=function(a,
b,g){e=this.evaluator;this.getFamilyValues();c=e.getVariable(this.family);if(0<=this.fSteps)for(var n=0,k=this.fSteps;n<=k;n++)e.setVariable(this.family,this.familyInf+n*this.family_sep),0<e.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,b,g));e.setVariable("_Text_H_",0);e.setVariable(this.family,c)};h.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))};h.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))};h.prototype.rotate=function(a,b,g){l=Math.cos(g);m=Math.sin(g);return{x:a*l-b*m,y:a*m+b*l}};h.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([])};h.prototype.drawText=function(a,b,g,n,c,d,h,f,m,l,w){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=c.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:g,y:n},b.update(a,g,n,m,l,h,w,c.getColor());else for("simpleText"===b.type&&(b=b.toString(m,l).split("\\n")),e=this.evaluator,a.fillStyle=c.getColor(),a.font=d,a.textAlign=h,a.textBaseline=f,p=1.2*this.fontSize||0,c=0,d=b.length;c<d;c++)u=
b[c],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(u,g,n+p*c)),a.fillText(u,g,n+p*c)};a.Graphic=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m=function(a,d){this.text=d=d.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";e="'";u=c=0;for(p=-1;c<d.length;)b=d.charAt(c),l=d.charAt(c-1),"["===b&&"\\"===l?(this.textElements.push(d.substring(u,c-1)+"["),this.textElementsMacros.push("'"+d.substring(u,c-1)+"['"),u=c+1):"]"===b&&"\\"===l?(this.textElements.push(d.substring(u,
c-1)+"]"),this.textElementsMacros.push("'"+d.substring(u,c-1)+"]'"),u=c+1):"["===b&&-1===p?(this.textElements.push(d.substring(u,c)),this.textElementsMacros.push("'"+d.substring(u,c)+"'"),u=c,p++):"["===b?p++:"]"===b&&0===p?(this.textElements.push(this.evaluator.parser.parse(d.substring(u,c+1))),this.textElementsMacros.push("["+d.substring(u,c+1)+"]"),u=c+1,p--):("]"==d.charAt(c)&&(p=0>p?p:p-1),e+=d.charAt(c)),c++;this.textElements.push(d.substring(u,c));this.textElementsMacros.push("'"+d.substring(u,
c)+"'")};m.prototype.toString=function(b,c){e="";for(var k=0,g=this.textElements.length;k<g;k++)"string"===typeof this.textElements[k]?e+=this.textElements[k]:(d=this.evaluator.eval(this.textElements[k])[0][0],""!==d&&("string"===typeof d?e+=d:Infinity==d?e+="Infinity":-Infinity==d?e+="-Infinity":isNaN(d)||"NaN"==d?e+="NaN":(d=parseFloat(d),d=c?d.toFixed(b):a.removeNeedlessDecimals(d.toFixed(b)),e+=d.toString().replace(".",this.parent.decimal_symbol))));return e};a.SimpleText=m;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K,D,A,I,H,M,P,G,O,C,N=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fillP=c.fillP||"";c.fillM=c.fillM||"";c.parseExpression();c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();g=new a.R2;n=new a.R2;v=new a.R2;f=new a.R2;y=new a.R2;c.cInd=0;return c};$jscomp.inherits(N,a.Graphic);N.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],f=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||f.contains("y")?"identifier"!=f.type||"y"!=f.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||f.contains("x")?"identifier"!=f.type||"x"!=f.value||b.contains("x")||(this.funExpr=f,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=f,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=f,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};N.prototype.update=function(){};N.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};N.prototype.drawFamilyAux=function(a,b,f){d=this.evaluator;this.getFamilyValues();tempParam=d.getVariable(this.family);if(0<=this.fSteps)for(var g=0,c=this.fSteps;g<=c;g++)d.setVariable(this.family,this.familyInf+g*this.family_sep),this.update(),
this.drawAux(a,b,f);d.setVariable(this.family,tempParam)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(L,R,Q){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;d=this.evaluator;c=d.parser;u=this.space;p=d.eval(this.width);L.strokeStyle=this.color.getColor();L.lineWidth=p;b=c.getVariable("x");l=c.getVariable("y");m=u.w+24;h=u.h+24;q=m/9;3>q&&(q=3);k=h/7;3>k&&(k=3);0==this.cInd?(e=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;g.set(0,0);n.set(0,0);v.set(0,0);O=.25;C=8;this.abs_coord||(O/=u.scale,C/=u.scale);L.beginPath();for(A=parseInt(k/2);A<h;A+=k)for(D=parseInt(q/2);D<m;D+=q){if(this.abs_coord){f.set(D,A);r=this.newt.findZero(f,O);if(null==r)continue;d.setVariable("x",r.x);d.setVariable("y",r.y);y.set(r.x,r.y)}else{f.set(u.getRelativeX(D),u.getRelativeY(A));r=this.newt.findZero(f,O);if(null==r)continue;d.setVariable("x",r.x);d.setVariable("y",r.y);y.set(u.getAbsoluteX(r.x),u.getAbsoluteY(r.y))}B=y.ix();z=y.iy();
if(-12<=B&&B<m+24&&-12<=z&&z<h+24){if(e[B+12+(z+12)*u.w]===this.cInd)continue;e[B+12+(z+12)*u.w]=this.cInd}a.rangeOK&&(L.moveTo(B,z),L.lineTo(B,z));g.x=r.x;g.y=r.y;n.x=r.x;n.y=r.y;w=this.newt.getUnitNormal();if(0!=w.x||0!=w.y)for(w.rotL90(),v.x=w.x,v.y=w.y,F=x=0,J=!1;2>F;)if(J&&(v.x=-w.x,v.y=-w.y,r.x=g.x,r.y=g.y,n.x=r.x,n.y=r.y,this.abs_coord?y.set(r.x,r.y):y.set(u.getAbsoluteX(r.x),u.getAbsoluteY(r.y)),B=y.ix(),z=y.iy(),J=!1,x=0),r.x+=C*v.x,r.y+=C*v.y,r=this.newt.findZero(r,O),null!=r){d.setVariable("x",
r.x);d.setVariable("y",r.y);v.x=r.x-n.x;v.y=r.y-n.y;v.normalize();if(0==v.x&&0==v.y)break;n.x=r.x;n.y=r.y;this.abs_coord?y.set(r.x,r.y):y.set(u.getAbsoluteX(r.x),u.getAbsoluteY(r.y));E=parseInt(y.ix());K=parseInt(y.iy());if(E!=B||K!=z)if(I=B,H=z,B=E,z=K,-12<=B&&B<m+24&&-12<=z&&z<h+24){x=0;M=e[B+12+(z+12)*u.w];e[B+12+(z+12)*u.w]=this.cInd;for(R=1;8>R;R++)P=I+Math.round((B-I)*R/8),G=H+Math.round((z-H)*R/8),0<=P&&P<m&&0<=G&&G<h&&(e[P+12+(G+12)*u.w]=this.cInd);a.rangeOK&&(L.moveTo(I,H),L.lineTo(B,z));
if(M===this.cInd)break}else J=!0,F++;else 4<++x&&(J=!0,F++)}}L.stroke()}};N.prototype.X=function(a,b,f){f||(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};N.prototype.Y=function(a,b,f){f||(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};N.prototype.XX=function(a,b,f){return Math.round(this.X(a,b,f))};N.prototype.YY=function(a,b,f){return Math.round(this.Y(a,b,f))};N.prototype.extrapolate=
function(b,f,g,c,n,k){for(var d=this.evaluator.getVariable(f),h=k/2,r=0,e,m,v,l,q,p;1E-15<Math.abs(h);){e=this.evaluator.getVariable(f);m=this.evaluator.getVariable(f)+h;this.evaluator.setVariable(f,m);v=!0;try{l=n,n=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(g,n),0<this.evaluator.eval(b)?(q=new a.R2(Math.min(l,n),Math.max(l,n)),p=0,p=0<k?this.Singularity(Math.abs(h),f,c,e,l,m,n,q):this.Singularity(Math.abs(h),f,c,m,n,e,l,q),0<p&&(v=!1)):v=!1}catch(Z){v=!1}v?r+=h:this.evaluator.setVariable(f,
e);h/=2}this.evaluator.setVariable(f,d);return new a.R2(r/Math.abs(k),n)};N.prototype.extrapolateOnSingularity=function(b,f,g,c,n,k){c=this.evaluator.getVariable(f);for(var d=k/2,h=0,r=n,e;1E-15<Math.abs(d);){this.evaluator.setVariable(f,this.evaluator.getVariable(f)+d);e=!0;if(0<this.evaluator.eval(b))try{r=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(g,r),0>=this.evaluator.eval(b)&&(e=!1)}catch(X){e=!1}else e=!1;e?h+=d:this.evaluator.setVariable(f,this.evaluator.getVariable(f)-d);
d/=2}if(0==h)for(d=k/2,h=k,r=n;1E-15<Math.abs(d);){this.evaluator.setVariable(f,this.evaluator.getVariable(f)-d);e=!0;if(0<this.evaluator.eval(b))try{r=this.evaluator.eval(this.funExpr)}catch(X){e=!1}else e=!1;e?h+=-d:this.evaluator.setVariable(f,this.evaluator.getVariable(f)+d);d/=2}this.evaluator.setVariable(f,c);return new a.R2(h/Math.abs(k),r)};N.prototype.Singularity=function(a,b,f,g,c,n,k,d){if(isNaN(k)||isNaN(c)||isNaN(d.y)||isNaN(d.x)||g>=n)return 2;var h=this.evaluator.getVariable(b),e=0;
try{if(1E-15>Math.abs(n-g)||1E-12>Math.abs(n-g)&&Math.abs(k-c)>Math.abs(a))return this.evaluator.setVariable(b,h),1;var r=(g+n)/2;this.evaluator.setVariable(b,r);var m=NaN;try{m=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(m))return 5;if(Math.abs(k-c)>a){this.evaluator.setVariable(b,g-1E-12);var v=this.evaluator.eval(this.funExpr);v=(c-v)/1E-12;this.evaluator.setVariable(b,n+1E-12);var l=(this.evaluator.eval(this.funExpr)-k)/1E-12;if((10>Math.abs(l)||10>Math.abs(v))&&(0<=l&&0<=v||
0>=l&&0>=v)&&4*Math.abs(l)<Math.abs((k-c)/(n-g)))return this.evaluator.setVariable(b,h),2}if(isNaN(d.x)||isNaN(d.y)||isNaN(m))return 2;if(!(d.x<=m&&m<=d.y)){this.evaluator.setVariable(b,r);d.x=Math.min(c,m);d.y=Math.max(c,m);var q=this.Singularity(a/2,b,f,g,c,r,m,d);this.evaluator.setVariable(b,n);d.x=Math.min(k,m);d.y=Math.max(k,m);var p=this.Singularity(a/2,b,f,r,m,n,k,d);e=Math.max(q,p)}}catch(Y){e=1}this.evaluator.setVariable(b,h);return e};N.prototype.drawAuxFun=function(f,g,c){b=this.evaluator.parser.getVariable("x");
l=this.evaluator.parser.getVariable("y");a.rangeOK=1;g="x";var n="y";this.of_y&&(g="y",n="x");var k=this.drawif,d=this.evaluator.eval(this.width),h=!1,e=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?e.ix():e.iy(),m=0,v=0,q=0,p=0,w=1/this.space.scale;e=w*(this.of_y?-this.space.h+e.y:-e.x);var y=0;this.abs_coord&&(e=0,w=1);for(var z,u,F,B,x,A,H,E,Q,D=this.of_y?this.space.h+2:this.space.w+2;q<=D;){z=!0;u=0;this.evaluator.setVariable(g,e);try{F=this.evaluator.eval(this.funExpr),
isNaN(F)||(this.evaluator.setVariable(n,F),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(h?(B=Math.min(y,F),x=Math.max(y,F),A=new a.R2(B,x),u=this.Singularity(w,g,0,e-w,y,e,F,A),0===u?(y<=F?(y=A.x,F=A.y):(F=A.x,y=A.y),H=parseInt(this.of_y?this.XX(d,y,this.abs_coord):this.YY(d,y,this.abs_coord)),m=this.abs_coord?Math.round(F):parseInt(this.of_y?this.XX(d,F,this.abs_coord):this.YY(d,F,this.abs_coord)),this.fillM&&m>r&&(f.lineWidth=1,f.strokeStyle=this.fillM.getColor(),f.beginPath(),this.of_y?(f.moveTo(r+
1,this.space.h-q+.5),f.lineTo(m,this.space.h-q+.5)):(f.moveTo(q+.5,r+1),f.lineTo(q+.5,m)),f.stroke()),this.fillP&&m<r&&(f.lineWidth=1,f.strokeStyle=this.fillP.getColor(),f.beginPath(),this.of_y?(f.moveTo(r-1,this.space.h-q+.5),f.lineTo(m,this.space.h-q+.5)):(f.moveTo(q+.5,r-1),f.lineTo(q+.5,m)),f.stroke()),f.lineWidth=d,f.strokeStyle=c.getColor(),f.beginPath(),this.of_y?(f.moveTo(H+.5,this.space.h-p),f.lineTo(m+.5,this.space.h-q)):(f.moveTo(p+.5,H),f.lineTo(q+.5,m)),f.stroke()):1===u?(this.evaluator.setVariable(g,
e-w),E=this.extrapolate(k,g,n,0,y,w),m=this.of_y?this.XX(d,E.y,this.abs_coord):this.YY(d,E.y,this.abs_coord),f.lineWidth=d,f.strokeStyle=c.getColor(),f.beginPath(),this.of_y?(f.moveTo(v+.5,this.space.h-p),f.lineTo(m+.5,this.space.h-p+Math.round(E.x))):(f.moveTo(p+.5,v),f.lineTo(p+Math.round(E.x)+.5,m)),this.evaluator.setVariable(g,e),Q=this.extrapolate(k,g,n,0,F,-w),v=this.of_y?this.XX(d,Q.y,this.abs_coord):this.YY(d,Q.y,this.abs_coord),m=this.of_y?this.XX(d,F,this.abs_coord):this.YY(d,F,this.abs_coord),
f.lineWidth=d,f.strokeStyle=c.getColor(),f.beginPath(),this.of_y?(f.moveTo(v+.5,this.space.h-q),f.lineTo(m+.5,this.space.h-q)):(f.moveTo(q+.5,v),f.lineTo(q+.5,m)),f.stroke()):2===u&&(m=this.of_y?this.XX(d,F,this.abs_coord):this.YY(d,F,this.abs_coord),f.lineWidth=d,f.strokeStyle=c.getColor(),f.beginPath(),this.of_y?(f.moveTo(v+.5,this.space.h-q),f.lineTo(m+.5,this.space.h-q)):(f.moveTo(q+.5,v),f.lineTo(q+.5,m)))):(Q=this.extrapolateOnSingularity(k,g,n,0,F,-w),v=this.of_y?this.XX(d,Q.y,this.abs_coord):
this.YY(d,Q.y,this.abs_coord),m=this.of_y?this.XX(d,F,this.abs_coord):this.YY(d,F,this.abs_coord),f.lineWidth=d,f.strokeStyle=c.getColor(),f.beginPath(),this.of_y?(f.moveTo(v,this.space.h-(q+Math.round(Q.x))+.5),f.lineTo(m,this.space.h-q+.5)):(f.moveTo(q+Math.round(Q.x),v),f.lineTo(q,m)),f.stroke()),y=F):z=!1)}catch(aa){z=!1}h&&!z&&(this.evaluator.setVariable(g,e-w),this.evaluator.setVariable(n,y),E=this.extrapolate(k,g,n,0,y,w),m=parseInt(this.of_y?this.XX(d,E.y,this.abs_coord):this.YY(d,E.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(f.lineWidth=d,f.strokeStyle=c.getColor(),f.beginPath(),this.of_y?(f.moveTo(v,this.space.h-(p+Math.round(E.x))+.5),f.lineTo(m,this.space.h-(p+Math.round(E.x))+.5)):(f.moveTo(p+Math.round(E.x)+.5,v),f.lineTo(p+Math.round(E.x)+.5,m)),f.stroke()),this.evaluator.setVariable(g,e));h=z;e+=w;v=m;p=q++}this.evaluator.parser.setVariable("x",b);this.evaluator.parser.setVariable("y",l)};N.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;
b.disabled=!this.editable;var f=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(f.expresion=f.evaluator.parser.parse(this.value),f.parseExpression(),f.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Equation=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,d,c,u,p,b,l,m,h,q=function(b,g){g=a.Graphic.call(this,b,g)||this;g.parameter=g.parameter||"t";g.parameter_interval=g.parameter_interval||b.evaluator.parser.parse("[0,1]");g.parameter_steps=g.parameter_steps||b.evaluator.parser.parse("8");g.width=g.width||b.evaluator.parser.parse("1");g.fill=g.fill||"";g.visible=2===g.parent.version&&void 0==g.visible?!0:g.visible;g.visible&&g.registerTextField();return g};$jscomp.inherits(q,a.Graphic);
q.prototype.update=function(){d=this.evaluator;c=d.eval(this.parameter_interval);this.paraInf=c[0][0];this.paraSup=c[0][1];this.pSteps=d.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};q.prototype.drawAux=function(c,g,n){d=this.evaluator;u=this.space;p=e(d.eval(this.width));
c.lineWidth=0<p?p:1E-6;c.lineCap=c.lineJoin="round";c.strokeStyle=n.getColor();b=d.getVariable(this.parameter);c.beginPath();d.setVariable(this.parameter,this.paraInf);l=d.eval(this.expresion);this.exprX=e(this.abs_coord?l[0][0]:u.getAbsoluteX(l[0][0]));this.exprY=e(this.abs_coord?l[0][1]:u.getAbsoluteY(l[0][1]));this.rotateExp&&(m=a.degToRad(d.eval(this.rotateExp)),h=this.rotate(l[0][0],l[0][1],m),this.exprX=e(this.abs_coord?h.x:u.getAbsoluteX(h.x)),this.exprY=e(this.abs_coord?h.y:u.getAbsoluteY(h.y)));
c.moveTo(this.exprX+.5,this.exprY+.5);for(n=1;n<=this.pSteps;n++)d.setVariable(this.parameter,this.paraInf+n*this.paraSep),l=d.eval(this.expresion),this.rotateExp&&(h=this.rotate(l[0][0],l[0][1],m),l[0][0]=h.x,l[0][1]=h.y),this.exprX=e(this.abs_coord?l[0][0]:u.getAbsoluteX(l[0][0])),this.exprY=e(this.abs_coord?l[0][1]:u.getAbsoluteY(l[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&c.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(c.fillStyle=
g.getColor(),c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);d.setVariable(this.parameter,b)};q.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var g=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(a){13==a.keyCode&&(g.expresion=g.evaluator.parser.parse(this.value),g.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Curve=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,d=Math.round,c,u,p,b,l,m,h,q,k,g,n=function(b,g){g=a.Graphic.call(this,b,g)||this;g.size=g.size||b.evaluator.parser.parse("2");g.range=g.range||b.evaluator.parser.parse("[1, 100]");g.visible=2===g.parent.version&&void 0==g.visible?!0:g.visible;g.visible&&g.registerTextField();return g};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){c=this.evaluator;p=c.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&
(b=this.rotate(p[0][0],p[0][1],a.degToRad(c.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);h=c.eval(this.range);this.rangeInf=h[0][0];this.rangeMax=h[0][1]};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};n.prototype.drawAux=function(b,n){c=this.evaluator;u=this.space;k=q=Math.ceil(c.eval(this.size)-.4);b.fillStyle=n.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(g=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=g);n=c.getVariable("n");for(var h=this.rangeInf,f=this.rangeMax;h<=f;h++)c.setVariable("n",h),p=c.eval(this.expresion),this.exprX=p[0][0],this.exprY=p[0][1],l=d(this.abs_coord?this.exprX:u.getAbsoluteX(this.exprX)),m=d(this.abs_coord?this.exprY:u.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(l,m,q,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,l+k,m-k,this.color,this.font,"start","alphabetic",c.eval(this.decimals),this.fixed,!0));c.setVariable("n",n)};n.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var g=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(g.expresion=g.evaluator.parser.parse(this.value),g.parent.update())};this.parent.editableRegion.textFields.push(b)};
a.Sequence=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,d=Math.round,c,u,p,b,l,m,h=function(b,c){c=a.Graphic.call(this,b,c)||this;c.size=c.size||b.evaluator.parser.parse("2");c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){c=this.evaluator;p=c.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&(b=this.rotate(p[0][0],p[0][1],a.degToRad(c.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};h.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};h.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};h.prototype.drawAux=function(a,b){u=this.space;a.fillStyle=b.getColor();l=d(this.abs_coord?this.exprX:u.getAbsoluteX(this.exprX));m=d(this.abs_coord?this.exprY:u.getAbsoluteY(this.exprY));a.beginPath();a.arc(l,m,d(this.evaluator.eval(this.size)),0,e,!0);a.fill();this.text.hasContent&&this.text.draw(a,b,l,m)};a.Point=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,d=2*Math.PI,c,u,p,b,l,m,h,q,k,g,n,v,y,r=function(b,g){g=a.Graphic.call(this,b,g)||this;g.width=g.width||b.evaluator.parser.parse("1");g.size=g.size||b.evaluator.parser.parse("2");g.text=new a.TextObject(g,g.text);return g};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){c=this.evaluator;p=c.eval(this.expresion);this.endPoints=[];for(var f=0,g=p.length;f<g;f++)this.endPoints[f]={x:p[f][0],y:p[f][1]};if(this.rotateExp)for(b=
a.degToRad(c.eval(this.rotateExp)),f=0,g=this.endPoints.length;f<g;f++)this.endPoints[f]=this.rotate(this.endPoints[f].x,this.endPoints[f].y,b)};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(a,b,r){c=this.evaluator;u=this.space;l=e(c.eval(this.width));a.lineWidth=0<l?l:1E-6;q=c.eval(this.size);0>q&&(q=0);a.fillStyle=b.getColor();a.strokeStyle=
r.getColor();a.lineCap="round";k=0==a.lineWidth%2?0:.5;this.abs_coord?(g=e(this.endPoints[0].x),n=e(this.endPoints[0].y),v=e(this.endPoints[1].x),y=e(this.endPoints[1].y)):(g=e(u.getAbsoluteX(this.endPoints[0].x)),n=e(u.getAbsoluteY(this.endPoints[0].y)),v=e(u.getAbsoluteX(this.endPoints[1].x)),y=e(u.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(g+k,n+k);a.lineTo(v+k,y+k);this.dashStyle();a.stroke();0<q&&(a.beginPath(),a.arc(g,n,q,0,d,!0),a.arc(v,y,q,0,d,!0),a.fill());a.setLineDash([]);
this.text.hasContent&&(m=parseInt((g+v)/2)-3,h=parseInt((n+y)/2)+3,this.text.draw(a,r,m,h))};a.Segment=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,d=Math.round,c,u,p,b,l,m,h,q,k,g,n,v,y,r,f,B=function(b,f){f=a.Graphic.call(this,b,f)||this;f.width=f.width||b.evaluator.parser.parse("5");f.size=f.size||b.evaluator.parser.parse("2");f.spear=f.spear||b.evaluator.parser.parse("8");f.arrow=f.arrow||new a.Color("ee0022");f.text=new a.TextObject(f,f.text);return f};$jscomp.inherits(B,a.Graphic);B.prototype.update=function(){c=this.evaluator;u=c.eval(this.expresion);this.endPoints=[];for(var b=
0,f=u.length;b<f;b++)this.endPoints[b]={x:u[b][0],y:u[b][1]};if(this.rotateExp)for(p=a.degToRad(c.eval(this.rotateExp)),b=0,f=this.endPoints.length;b<f;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,p)};B.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};B.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};B.prototype.drawAux=function(p,w,u){c=this.evaluator;b=this.space;h=c.eval(this.width);
0>h&&(h=0);q=Math.ceil(h/2);k=b.scale;this.vect=new a.Vector2D(this.endPoints[1].x-this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);g=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);p.fillStyle=w.getColor();p.strokeStyle=u.getColor();p.lineWidth=2;this.abs_coord?(n=d(this.endPoints[0].x),v=d(this.endPoints[0].y),y=d(this.endPoints[1].x),r=d(this.endPoints[1].y)):(n=d(b.getAbsoluteX(this.endPoints[0].x)),v=d(b.getAbsoluteY(this.endPoints[0].y)),y=d(b.getAbsoluteX(this.endPoints[1].x)),
r=d(b.getAbsoluteY(this.endPoints[1].y)));f=c.eval(this.spear);0>f&&(f=0);p.save();p.translate(n,v,g);this.abs_coord?p.rotate(this.angle*(0<=this.vect.y?1:-1)):(g*=k,p.rotate(this.angle*(0<=this.vect.y?-1:1)));p.beginPath();p.moveTo(-q,e(-q));p.lineTo(e(g-f-h),e(-q));p.lineTo(e(g-2*f),e(-f-q));p.lineTo(e(g),0);p.lineTo(e(g-2*f),e(f+q));p.lineTo(e(g-f-h),e(q));p.lineTo(-q,e(q));p.closePath();p.stroke();p.fill();p.restore();this.text.hasContent&&(l=parseInt((n+y)/2)-3,m=parseInt((v+r)/2)+3,this.text.draw(p,
u,l,m))};a.Arrow=B;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,d,c,u,p,b,l,m,h,q=function(b,g){g=a.Graphic.call(this,b,g)||this;g.width=g.width||b.evaluator.parser.parse("1");g.fill=g.fill||"";g.endPoints=[];return g};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){d=this.evaluator;u=d.eval(this.expresion);for(var b=0,g=u.length;b<g;b++)this.endPoints[b]={x:u[b][0],y:u[b][1]};if(this.rotateExp)for(p=a.degToRad(d.eval(this.rotateExp)),b=0,g=this.endPoints.length;b<g;b++)this.endPoints[b]=
this.rotate(this.endPoints[b].x,this.endPoints[b].y,p)};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(a,g,n){d=this.evaluator;c=this.space;b=e(d.eval(this.width));a.lineWidth=0<b?b:1E-6;a.strokeStyle=n.getColor();a.lineCap=a.lineJoin="round";l=0<b?.5:0;m=e(this.abs_coord?this.endPoints[0].x:c.getAbsoluteX(this.endPoints[0].x));h=e(this.abs_coord?
this.endPoints[0].y:c.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(m+l,h+l);n=1;for(var k=this.endPoints.length;n<k;n++)m=e(this.abs_coord?this.endPoints[n].x:c.getAbsoluteX(this.endPoints[n].x)),h=e(this.abs_coord?this.endPoints[n].y:c.getAbsoluteY(this.endPoints[n].y)),a.lineTo(m+l,h+l);this.fill&&(a.fillStyle=g.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,d=Math.min,c=Math.max,u=Math.abs,p,b,l,m,h,q,k,g,n,v,y,r,f=function(b,f){f=a.Graphic.call(this,b,f)||this;f.width=f.width||b.evaluator.parser.parse("1");f.fill=f.fill||"";f.border_radius=f.border_radius||b.evaluator.parser.parse("0");f.endPoints=[];return f};$jscomp.inherits(f,a.Graphic);f.prototype.update=function(){p=this.evaluator;q=p.eval(this.expresion);this.exprX=q[0][0];this.exprY=q[0][1];this.w=150;this.h=100;this.rotateExp&&(l=
this.rotate(q[0][0],q[0][1],a.degToRad(p.eval(this.rotateExp))),this.exprX=l.x,this.exprY=l.y);4<=q[0].length&&(this.w=q[0][2],this.h=q[0][3]);q[1]&&2==q[1].length&&(this.w=q[1][0],this.h=q[1][1]);this.w=c(0,this.w);this.h=c(0,this.h)};f.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};f.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};f.prototype.drawAux=function(a,f,l,q){p=this.evaluator;b=this.space;m=e(p.eval(this.width));
a.lineWidth=0<m?m:1E-6;a.strokeStyle=l.getColor();a.lineCap="round";a.lineJoin="miter";h=0<m?.5:0;k=e(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+h;g=e(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+h;n=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;y=d(c(0,p.eval(this.border_radius)),.5*u(n),.5*u(v));r=this.abs_coord?1:-1;a.beginPath();0!==y?(a.moveTo(k+y,g),a.lineTo(k+n-y,g),a.quadraticCurveTo(k+n,g,k+n,g+r*y),a.lineTo(k+n,g+v-r*y),a.quadraticCurveTo(k+
n,g+v,k+n-y,g+v),a.lineTo(k+y,g+v),a.quadraticCurveTo(k,g+v,k,g+v-r*y),a.lineTo(k,g+r*y),a.quadraticCurveTo(k,g,k+y,g),a.lineTo(k+y,g)):(a.moveTo(k,g),a.lineTo(k+n,g),a.lineTo(k+n,g+v),a.lineTo(k,g+v),a.lineTo(k,g));this.fill&&(a.fillStyle=f.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,d=Math.min,c=Math.max,u=Math.acos,p=Math.sqrt,b=Math.PI,l=b/2,m=2*b,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K,D,A,I,H,M=function(b,f){f=a.Graphic.call(this,b,f)||this;f.width=f.width||b.evaluator.parser.parse("1");f.fill=f.fill||"";f.center=f.center||b.evaluator.parser.parse("(0,0)");f.radius=f.radius||b.evaluator.parser.parse("1");f.init=f.init||"0";f.end=f.end||"90";f.init.match(/^_\(/)&&(f.initFlag=!0,f.init=f.init.substring(1));f.end.match(/^_\(/)&&
(f.endFlag=!0,f.end=f.end.substring(1));f.initExpr=b.evaluator.parser.parse(f.init);f.endExpr=b.evaluator.parser.parse(f.end);f.text=new a.TextObject(f,f.text);return f};$jscomp.inherits(M,a.Graphic);M.prototype.update=function(){h=this.evaluator;q=h.eval(this.center);this.exprX=q[0][0];this.exprY=q[0][1];k=0;this.rotateExp&&(k=a.degToRad(h.eval(this.rotateExp)),g=Math.cos(k),n=Math.sin(k),v=this.exprX*g-this.exprY*n,y=this.exprX*n+this.exprY*g,this.exprX=v,this.exprY=y);var e=h.eval(this.initExpr),
A=h.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(r=e[0][0],f=e[0][1],B=A[0][0],z=A[0][1],this.vectors?this.abs_coord&&(f=-f,z=-z):this.abs_coord?(r-=this.exprX,f=-f+this.exprY,B-=this.exprX,z=-z+this.exprY):(r-=this.exprX,f-=this.exprY,B-=this.exprX,z-=this.exprY),w=0==r?0>f?3*l:l:u(1*r/p(r*r+f*f)),x=0==B?0>z?3*l:l:u(1*B/p(B*B+z*z)),w+=k,x+=k,0<r&&0<f&&this.abs_coord&&(w=m-w),0<r&&0>f&&!this.abs_coord&&(w=m-w),0>r&&0>f&&!this.abs_coord&&
(w=m-w),0>r&&0<f&&this.abs_coord&&(w=m-w),0<B&&0<z&&this.abs_coord&&(x=m-x),0<B&&0>z&&!this.abs_coord&&(x=m-x),0>B&&0>z&&!this.abs_coord&&(x=m-x),0>B&&0<z&&this.abs_coord&&(x=m-x),this.initFlag?(F=w,w=x,x=F):(F=d(w,x),J=c(w,x),w=F,x=J,x-w>b&&this.abs_coord&&(w=J,x=F),x-w<=b&&!this.abs_coord&&(w=J,x=F)),this.iniAng=w,this.endAng=x,this.drawPoints=!0):(this.iniAng=a.degToRad(e)+k,this.endAng=a.degToRad(A)+k,this.drawAngle=!0)};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.fill,this.trace)};M.prototype.drawAux=function(a,b,f){h=this.evaluator;E=this.space;A=h.eval(this.radius);0>A&&(A=0);H=e(h.eval(this.width));a.lineWidth=0<H?H:1E-6;a.lineCap="round";a.strokeStyle=f.getColor();this.drawAngle?(this.abs_coord?(K=e(this.exprX),D=e(this.exprY)):(K=e(E.getAbsoluteX(this.exprX)),D=e(E.getAbsoluteY(this.exprY)),A*=E.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>
this.endAng&&(I=this.iniAng,this.iniAng=this.endAng,this.endAng=I)):this.drawPoints&&(this.abs_coord?(K=e(this.exprX),D=e(this.exprY)):(K=e(E.getAbsoluteX(this.exprX)),D=e(E.getAbsoluteY(this.exprY)),A*=E.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(K,D),a.arc(K,D,A,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(K,D,A,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,
this.color,K,D)};a.Arc=M;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,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.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){e=this.evaluator;d=e.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(c=this.rotate(d[0][0],d[0][1],a.degToRad(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?(u=parseInt(this.exprX),p=parseInt(this.exprY)):(u=parseInt(this.space.getAbsoluteX(this.exprX)),p=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,u,p)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,d,c,u,p,b,l,m,h,q,k,g,n,v=function(b,g){g=a.Graphic.call(this,b,g)||this;g.file=g.file||"";g.inirot=g.inirot||b.evaluator.parser.parse("0");g.img=new Image;g.scaleX=g.scaleY=1;g.ratio=b.ratio;g.update();return g};$jscomp.inherits(v,a.Graphic);v.prototype.update=function(){d=this.evaluator;c=d.eval(this.expresion);this.exprX=c[0][0];this.exprY=c[0][1];this.rotateExp&&(u=this.rotate(c[0][0],c[0][1],a.degToRad(d.eval(this.rotateExp))),this.exprX=
u.x,this.exprY=u.y);4<=c[0].length&&(this.centered=!0,this.scaleX=c[0][2],this.scaleY=c[0][3]);c[1]&&2==c[1].length&&(this.centered=!0,this.scaleX=c[1][0],this.scaleY=c[1][1]);0==this.scaleX&&(this.scaleX=1E-5);0==this.scaleY&&(this.scaleY=1E-5);var b=this;if((p=d.eval(this.file))||""==p)this.img=this.parent.getImage(p),this.img.addEventListener("load",function(a){b.space.update(!0)})};v.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};v.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};
v.prototype.drawAux=function(c){d=this.evaluator;b=this.space;this.img&&this.img.ready&&this.img.complete&&(g=this.img.width,n=this.img.height,this.img.canvas&&(g=e(g/this.ratio),n=e(n/this.ratio)),l=this.centered?0:e(g/2),m=this.centered?0:e(n/2),h=e(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX)),q=e(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY)),k=a.degToRad(-d.eval(this.inirot)),c.save(),c.translate(h+l,q+m),c.rotate(k),this.opacity&&(c.globalAlpha=d.eval(this.opacity)),c.scale(this.scaleX,
this.scaleY),c.drawImage(this.img,-g/2,-n/2,g,n),c.restore())};a.Image=v;return a}(descartesJS||{});
descartesJS=function(a){function e(a,b,c){m=4*(b+c*a.width);return{r:a.data[m],g:a.data[m+1],b:a.data[m+2],a:a.data[m+3]}}if(a.loadLib)return a;var d,c,u,p,b,l,m,h,q=function(b,g){return a.Graphic.call(this,b,g)||this};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){d=this.evaluator.eval(this.expresion);this.exprX=d[0][0];this.exprY=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(a,g){g.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(c=parseInt(this.exprX),u=parseInt(this.exprY)):(c=parseInt(this.space.getAbsoluteX(this.exprX)),u=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>c||0>u||c>=this.space.w||u>=this.space.h)){p=[[c,u]];l=e(imageData,c,u);for(h=0;0<p.length;){h++;b=p.pop();c=b[0];u=b[1];var n=e(imageData,c,u);if(l.r===n.r&&l.g===n.g&&l.b===n.b&&l.a===n.a){n=imageData;var d=
g;m=4*(c+u*n.width);n.data[m+0]=d.r;n.data[m+1]=d.g;n.data[m+2]=d.b;n.data[m+3]=255*d.a;0<c&&p.push([c-1,u]);c<imageData.width-1&&p.push([c+1,u]);p.push([c,u-1]);p.push([c,u+1])}if(h>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=q;return a}(descartesJS||{});
descartesJS=function(a,e){if(a.loadLib)return a;var d=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),c=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,u,p=function(b,l){var m=a.Graphic.call(this,b,l)||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,l);m.hasExpresion=void 0!==m.expresion;m.graphics=[];b=b.lessonParser;var h=new a.Tokenizer;if(!m.hasExpresion)return m;
"'"!==m.expresion.charAt(0)&&(m.expresion="'"+m.expresion+"'");m.expresion=m.evaluator.parser.parse(m.expresion);l=m.evaluator.eval(m.expresion);if(l)var q=(q=document.getElementById(l))&&"descartes/macro"==q.type?q.text:a.openExternalFile(l);if(q){var k=a.convertHTMLEntities(q).replace(/\r/g,"").split("\n");q=[];l=0;for(var g=k.length;l<g;l++)if(k[l].trim()){var n=k[l].indexOf("=");if(-1!==n){n=b.split(k[l]);for(var v=0,p=n.length;v<p;v++)if(n[v]&&1<n.length&&("id"===e[n[v][0]]||"type"===e[n[v][0]])){q.push(n);
break}}}v=function(b,f){f=h.tokenize(f.replace(/&squot;/g,"'"));for(var g=0,c=f.length;g<c;g++)"identifier"!=f[g].type||a.reservedIds.match("-"+f[g].value+"-")||(f[g].value=m.name+"."+f[g].value);return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+h.flatTokens(f)};l=0;for(g=q.length;l<g;l++){var r=(p=q[l]||[],p[0])&&"id"===p[0][0];k=0;for(n=p.length;k<n;k++){var f=p[k][0].indexOf(".");-1===f||r?f=e[p[k][0]]:(f=e[p[k][0].substring(f+1)],p[k][0]=m.name+"."+p[k][0]);if(!("font"===f||"font_family"===f||
("fill"===f||"color"===f||"border"===f||"arrow"===f)&&"("!==p[k][1].charAt(0)||"file"===f&&p[k][1].match(c)||"id"!==f&&void 0!==e[p[k][1]])||"radius"===f)if("text"==f)if(p[k][1].match(/\{\\rtf1/))f=p[k][1],f=f.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,v),f=f.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,v),p[k][1]=f;else{var u=b.parseText(p[k][1]).textElementsMacros;for(var z=0,w=u.length;z<w;z++){f=h.tokenize(u[z].replace(/&squot;/g,"'"));for(var x=
0,F=f.length;x<F;x++)"identifier"!==f[x].type||a.reservedIds.match("-"+f[x].value+"-")||(f[x].value=m.name+"."+f[x].value);f=h.flatTokens(f).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");u[z]=f.substring(1,f.length-1)}p[k][1]=u.join("")}else{u=p[k][1].replace(/&squot;/g,"'").split(";");z=0;for(w=u.length;z<w;z++){f=h.tokenize(u[z].replace(/\\n/g,";"));x=0;for(F=f.length;x<F;x++)"identifier"!==f[x].type||a.reservedIds.match("-"+f[x].value+"-")||(f[x].value=m.name+"."+f[x].value);
u[z]=h.flatTokens(f)}p[k][1]=u.join(";")}}}l=0;for(g=q.length;l<g;l++)if(q[l][0]){v="";p=!1;k=0;for(n=q[l].length;k<n;k++)"type"===e[q[l][k][0]]&&d.match("-"+e[q[l][k][1]]+"-")&&(p=!0),v=v+q[l][k][0]+"='"+q[l][k][1]+"' ";q[l]=v+(p?" space='"+m.spaceID+"'":"");p?m.graphics.push(b.parseGraphic(q[l],m.abs_coord,m.background,m.inirot)):b.parseAuxiliar(q[l])}}return m};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){u=this.evaluator.eval(this.inipos);this.iniPosX=u[0][0];this.iniPosY=u[0][1]};
p.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=p;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var e=Math.sqrt,d=Math.sin,c=Math.cos,u=Math.abs,p,b,l,m,h,q,k,g,n,v,y,r,f,B,z,w=function(a,b,f,g){this.x=a||0;this.y=b||0;this.z=f||0;this.w=g||0;this.adjustDec()};w.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 x=function(a,b,f,g,c,n,d,h,e,k,m,r,v,l,q,p){this.a00=a||0;this.a01=b||0;this.a02=f||0;this.a03=g||0;this.a10=c||0;this.a11=n||0;this.a12=d||0;this.a13=h||0;
this.a20=e||0;this.a21=k||0;this.a22=m||0;this.a23=r||0;this.a30=v||0;this.a31=l||0;this.a32=q||0;this.a33=p||0};x.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};x.prototype.multiplyVector4=function(a){return new w(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)};x.prototype.translate=function(a){return new x(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)};x.prototype.rotateX=function(a){b=d(a);l=c(a);g=this.a10;n=this.a11;v=this.a12;
y=this.a13;r=this.a20;f=this.a21;B=this.a22;z=this.a23;return new x(this.a00,this.a01,this.a02,this.a03,g*l+r*b,n*l+f*b,v*l+B*b,y*l+z*b,g*-b+r*l,n*-b+f*l,v*-b+B*l,y*-b+z*l,this.a30,this.a31,this.a32,this.a33)};x.prototype.rotateY=function(a){b=d(a);l=c(a);m=this.a00;h=this.a01;q=this.a02;k=this.a03;r=this.a20;f=this.a21;B=this.a22;z=this.a23;return new x(m*l+r*-b,h*l+f*-b,q*l+B*-b,k*l+z*-b,this.a10,this.a11,this.a12,this.a13,m*b+r*l,h*b+f*l,q*b+B*l,k*b+z*l,this.a30,this.a31,this.a32,this.a33)};x.prototype.rotateZ=
function(a){b=d(a);l=c(a);m=this.a00;h=this.a01;q=this.a02;k=this.a03;g=this.a10;n=this.a11;v=this.a12;y=this.a13;return new x(m*l+g*b,h*l+n*b,q*l+v*b,k*l+y*b,m*-b+g*l,h*-b+n*l,q*-b+v*l,k*-b+y*l,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){p=a.norm3D(b);if(0===p)return{x:0,y:0,z:0};if(1===p)return{x:b.x,y:b.y,z:b.z};p=1/p;return{x:b.x*p,y:b.y*p,z:b.z*p}};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,f){return u(a.x-b.x)<=f&&u(a.y-b.y)<=f&&u(a.z-b.z)<=f};a.Vector4D=w;a.Matrix4x4=x;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 d(a,b){a.textNode=null;a.lineCap=l;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);n=1;for(v=this.projVert.length;n<v;n++)a.lineTo(this.projVert[n].x,this.projVert[n].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_";k=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,k)}function u(a){a.textNode=null;a.lineCap=l;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 p(b,f,g){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
f),a.subtract3D(b,g)))}if(a.loadLib)return a;var b=2*Math.PI,l=lineJoin="round",m,h,q,k,g,n,v,y,r,f,B,z,w,x=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=p(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=d):"text"===this.type?this.draw=c:"edge"===this.type&&(this.draw=u);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]})};x.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};n=0;for(v=this.vertices.length;n<v;n++)this.spaceVertices[n]=b.rotateVertex(this.vertices[n]),this.average.x+=this.spaceVertices[n].x,this.average.y+=this.spaceVertices[n].y,this.average.z+=this.spaceVertices[n].z;this.average=a.scalarProduct3D(this.average,
1/v);this.average_proy=b.project(this.average);this.depth=a.norm3D(a.subtract3D(b.eye,this.average));2<this.vertices.length&&(this.normal=p(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));n=0;for(v=this.vertices.length;n<v;n++)this.newSpaceVert[n]=this.spaceVertices[n],this.projVert[n]=this.newProjVert[n]=b.project(this.spaceVertices[n]);2<this.vertices.length&&(this.direction=p(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;n=0;for(v=this.vertices.length;n<v;n++)y=a.norm3D(a.subtract3D(this.spaceVertices[n],b.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,y),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,y);n=0;for(v=this.vertices.length;n<v;n++)this.minx>this.projVert[n].x&&(this.minx=this.projVert[n].x),this.maxx<this.projVert[n].x&&(this.maxx=this.projVert[n].x),this.miny>this.projVert[n].y&&(this.miny=this.projVert[n].y),
this.maxy<this.projVert[n].y&&(this.maxy=this.projVert[n].y)};x.prototype.removeDoubles=function(){if("edge"!==this.type){g=[];n=0;for(v=this.vertices.length;n<v;n++)(1E-8<Math.abs(this.vertices[n].x-this.vertices[(n+1)%v].x)||1E-8<Math.abs(this.vertices[n].y-this.vertices[(n+1)%v].y)||1E-8<Math.abs(this.vertices[n].z-this.vertices[(n+1)%v].z)||1E-8<Math.abs(this.vertices[n].w-this.vertices[(n+1)%v].w))&&g.push(this.vertices[n]);0===g.length&&g.push(this.vertices[0]);this.vertices=g}};x.prototype.drawText=
function(b,f,g,c,n,d,e,k,r,v,l){m=this.evaluator;b.textNode=f;d=m.eval(this.offset_dist);e=-a.degToRad(m.eval(this.offset_angle));g+=d*Math.cos(e);c+=d*Math.sin(e);b.textNode.pos={x:g,y:c};f.hasContent&&(f.draw(b,n,g,c,!0),q=this.fromPoint?f.textNodes.metrics.w/2:0,h=this.fromPoint?f.textNodes.metrics.h/2:0,f.draw(b,n,g-q,c-h))};x.prototype.splitFace=function(b){if(this.intersects(b)){var f=i2=null,g=ix2=0,c,n;var d=this.vertices;var h=b.vertices;var e=0;for(n=h.length;e<n;e++){var k=this.intersection(h[e],
h[(e+1)%n]);if(null!==k)if(null===f){if(f=k,g=e,2===h.length){i2=f;break}}else if(!a.equals3DEpsilon(k,f,1E-8)){i2=k;ix2=e;break}}if(null!==f&&null!==i2){e=this.isInterior(f)||this.isInterior(i2);var m=c=null;if(!e&&3<=h.length)for(n=0,d=d.length;n<d;n++)if(k=b.intersection(this.vertices[n],this.vertices[(n+1)%d]),null!==k)if(null===c)c=k;else if(!a.equals3DEpsilon(k,c,1E-8)){m=k;break}if(e||null!==c&&null!==m&&b.isInterior(c)&&b.isInterior(m)){m=!0;d=k=null;if(2===h.length)a.equals3DEpsilon(f,h[0],
1E-8)||a.equals3DEpsilon(f,h[1],1E-8)?m=!1:(k=[],k[0]=h[0],k[1]=f,d=[],d[0]=f,d[1]=h[1]);else for(k=[],d=[],e=n=c=0;e<h.length;e++)e<g?k[c++]=h[e]:e==g?(k[c++]=h[e],k[c++]=f,d[n++]=f):e<ix2?d[n++]=h[e]:e==ix2?(d[n++]=h[e],d[n++]=i2,k[c++]=i2):k[c++]=h[e];if(m){f=[];f[0]=new x({vertices:k,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);f[0].removeDoubles();f[0].normal=b.normal;f[1]=new x({vertices:d,type:"face",frontColor:b.frontColor,backColor:b.backColor,
edges:b.edges,model:b.model},this.space);f[1].removeDoubles();f[1].normal=b.normal;if(2<f[0].vertices.length)return 2<f[1].vertices.length?f:[f[0]];if(2<f[1].vertices.length)return[f[1]]}}}}return[b]};x.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};x.prototype.intersectsPlane=function(b){var f=this.vertices;var g=b.vertices;if(0<f.length){var c=a.dotProduct3D(g[0],b.normal);var n=a.dotProduct3D(f[0],b.normal);if(1E-8>Math.abs(c-n))return!0;for(var d=1,e=
f.length;d<e;d++)if(g=a.dotProduct3D(f[d],b.normal),1E-8>Math.abs(c-g)||g>c&&n<c||g<c&&n>c)return!0}return!1};x.prototype.intersection=function(b,f){var g=this.vertices;if(0<g.length){f=a.subtract3D(f,b);var c=a.dotProduct3D(f,this.normal);if(0!==c&&(g=a.dotProduct3D(a.subtract3D(g[0],b),this.normal)/c,-1E-8<g&&1.00000001>g))return a.add3D(b,a.scalarProduct3D(f,g))}return null};x.prototype.isInterior=function(b){var f=this.vertices;if(0<f.length)for(var g=0,c=a.subtract3D(f[0],b),n=0,d=f.length;n<
d;n++){var e=a.subtract3D(f[(n+1)%d],b),h=a.dotProduct3D(a.crossProduct3D(c,e),this.normal);if(1E-8>Math.abs(h)){if(0>a.dotProduct3D(c,e))break}else{if(0>g&&0<h||0<g&&0>h)return!1;c=e;g=h}}return!0};x.prototype.inFrontOf=function(a,b,g){if(this.minDistanceToEye>=b.maxDistanceToEye||this.maxx<=b.minx||this.minx>=b.maxx||this.maxy<=b.miny||this.miny>=b.maxy)return!1;for(z=0;3>z;z++)if(r=null,r=0===z?this.intersections(b):1===z?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=r&&0<r.length){for(w=
0;w<r.length;w++)a.push(r[w]);n=0;for(v=r.length;n<v;n++){f=r[n];B=this.space.rayFromEye(f.x,f.y);try{t=this.distanceToEyeAlong(B)-b.distanceToEyeAlong(B);if(t<=-g)return!0;if(t>=g)return!1}catch(K){}}}return!1};x.prototype.intersections=function(b){for(var f=[],g,c,n,d=new a.R2,e=this.newSpaceVert,h=b.newSpaceVert,k=this.newProjVert,m=b.newProjVert,r=0,v=e.length;r<v;r++){b=e[r];g=e[(r+1)%v];for(var l=0,q=h.length;l<q;l++)c=h[l],n=h[(l+1)%q],b!=c&&b!=n&&g!=c&&g!=n&&(c=d.intersection(k[r],k[(r+1)%
v],m[l],m[(l+1)%q]),null!=c&&f.push(c))}return f};x.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");};x.prototype.verticesContainedIn=function(a){for(var b=[],f=this.newSpaceVert,g=this.newProjVert,c=0,n=f.length;c<n;c++)!a.isVertex(f[c])&&a.appearsToContain(g[c])&&b.push(g[c]);return b};x.prototype.appearsToContain=function(a){for(var b=
0,f,g=this.newProjVert,c=0,n=this.newSpaceVert.length;c<n;c++){f=(g[c].x-a.x)*(g[(c+1)%n].y-a.y)-(g[(c+1)%n].x-a.x)*(g[c].y-a.y);if(0!=b)if(1E-8>Math.abs(f)){if(1E-8<Math.abs(g[c].x-g[(c+1)%n].x))return Math.min(g[c].x,g[(c+1)%n].x)<=a.x+1E-8&&a.x<=Math.max(g[c].x,g[(c+1)%n].x)+1E-8;if(1E-8<Math.abs(g[c].y-g[(c+1)%n].y))return Math.min(g[c].y,g[(c+1)%n].y)<=a.y+1E-8&&a.y<=Math.max(g[c].y,g[(c+1)%n].y)+1E-8}else if(0<b&&0>f||0>b&&0<f)return!1;b=f}return!0};x.prototype.isVertex=function(b){for(var f=
this.newSpaceVert,g=0,c=f.length;g<c;g++)if(a.equals3DEpsilon(b,f[g],1E-8))return!0;return!1};a.Primitive3D=x;return a}(descartesJS||{});
descartesJS=function(a){function e(a){for(var b=[],c=0,d,e=a.length,h=a.length-1;-1<h;h--)d=a.charAt(h),0==c?"="==d&&(c=1):1==c?" "!=d&&(c="<"===d||">"===d?0:2):2==c&&" "==d&&(b.unshift(a.substring(h+1,e)),e=h,c=0);b.unshift(a.substring(0,e));return b}if(a.loadLib)return a;var d={x:0,y:0,z:0},c,u,p,b,l,m=a.degToRad,h,q=function(b,g){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="Monospaced,PLAIN,12";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,g);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};q.prototype.getSpace=function(){for(var a=this.parent.spaces,b,c=0,
d=a.length;c<d;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};q.prototype.getFamilyValues=function(){c=this.evaluator;u=c.eval(this.family_interval);this.familyInf=u[0][0];this.familySup=u[0][1];this.fSteps=Math.round(c.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};q.prototype.buildFamilyPrimitives=function(){c=this.evaluator;this.getFamilyValues();p=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,p)};q.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};q.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(m(b[0][0])),this.inirotM=
this.inirotM.rotateX(m(b[0][1])),this.inirotM=this.inirotM.rotateZ(m(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(m(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(m(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.inipos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(d);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(m(b[0][0])),this.endrotM=this.endrotM.rotateX(m(b[0][1])),this.endrotM=this.endrotM.rotateZ(m(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(m(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(m(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.endpos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(d)};q.prototype.transformVertex=function(a){this.inirotEuler?l=
this.inirotM.multiplyVector4(a):(l=this.inirotM_X.multiplyVector4(a),l=this.inirotM_Y.multiplyVector4(l),l=this.inirotM_Z.multiplyVector4(l));l=this.iniposM.multiplyVector4(l);this.endrotEuler?l=this.endrotM.multiplyVector4(l):(l=this.endrotM_X.multiplyVector4(l),l=this.endrotM_Y.multiplyVector4(l),l=this.endrotM_Z.multiplyVector4(l));l=this.endposM.multiplyVector4(l);this.macroChildren&&(l=this.applyMacroTransform(l));l.adjustDec();return l};q.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
l=this.macro_inirotM.multiplyVector4(a):(l=this.macro_inirotM_X.multiplyVector4(a),l=this.macro_inirotM_Y.multiplyVector4(l),l=this.macro_inirotM_Z.multiplyVector4(l));l=this.macro_iniposM.multiplyVector4(l);this.macro_endrotEuler?l=this.macro_endrotM.multiplyVector4(l):(l=this.macro_endrotM_X.multiplyVector4(l),l=this.macro_endrotM_Y.multiplyVector4(l),l=this.macro_endrotM_Z.multiplyVector4(l));return l=this.macro_endposM.multiplyVector4(l)};q.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],c=0,d=a.length;c<d;c++)""!==a[c].trim()&&(b=b.concat(e(a[c])));c=0;for(d=b.length;c<d;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};q.prototype.splitFace=function(a){for(var b=0,c=this.primitives.length;b<c;b++)if(h=[],"face"===this.primitives[b].type){for(var d=0,e=a.primitives.length;d<e;d++)"face"===a.primitives[d].type?h=h.concat(this.primitives[b].splitFace(a.primitives[d])):h.push(a.primitives[d]);a.primitives=h}};a.Graphic3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,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();d=e.eval(this.expresion);c=d[0][0];u=d[0][1];p=d[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,u,p,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,u,p,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,d,c,u,p,b,l,m,h,q=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){m=this.evaluator;this.updateMVMatrix();l=m.getVariable("u");m.setVariable("u",this.Nu);h=m.eval(this.expresion);e=h[0][0];d=h[0][1];c=h[0][2];u=h[1][0];p=h[1][1];b=h[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,
d,c,1)),this.transformVertex(new a.Vector4D(u,p,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:m.eval(this.width)},this.space));m.setVariable("u",l)};a.Segment3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q,k,g,n,v,y=function(b,f){f=a.Graphic3D.call(this,b,f)||this;f.parameter=f.parameter||"t";f.parameter_interval=f.parameter_interval||b.evaluator.parser.parse("[0,1]");f.parameter_steps=f.parameter_steps||b.evaluator.parser.parse("8");f.expresion=f.parseExpression();return f};$jscomp.inherits(y,a.Graphic3D);y.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();u=e.getVariable("x");p=e.getVariable("y");b=e.getVariable("z");
d=e.getVariable("u");c=e.getVariable("v");e.setVariable("u",0);e.setVariable("v",0);l=parseInt(e.eval(this.Nu));m=parseInt(e.eval(this.Nv));h=[];for(k=0;k<=l;k++)for(e.setVariable("u",k/l),g=0;g<=m;g++){e.setVariable("v",g/m);n=0;for(v=this.expresion.length;n<v;n++)e.eval(this.expresion[n]);h.push(this.transformVertex(new a.Vector4D(e.getVariable("x"),e.getVariable("y"),e.getVariable("z"),1)))}var r=this.color.getColor(),f=this.backcolor.getColor(),y=this.edges?this.edges.getColor():"";for(k=0;k<
l;k++)for(g=0;g<m;g++)q=[],q.push(h[g+k*m+k]),q.push(h[g+1+k*m+k]),q.push(h[g+2+(k+1)*m+k]),q.push(h[g+1+(k+1)*m+k]),this.primitives.push(new a.Primitive3D({vertices:q,type:"face",frontColor:r,backColor:f,edges:y,model:this.model},this.space));e.setVariable("x",u);e.setVariable("y",p);e.setVariable("z",b);e.setVariable("u",d);e.setVariable("v",c)};a.Surface3D=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(h,a.Graphic3D);h.prototype.buildPrimitives=function(){l=this.evaluator;this.updateMVMatrix();m=l.eval(this.expresion);for(var h=this.color.getColor(),k=0,g=m.length-1;k<g;k++)e=m[k][0],d=m[k][1],c=m[k][2],u=m[k+1][0],p=m[k+1][1],b=m[k+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,
d,c,1)),this.transformVertex(new a.Vector4D(u,p,b,1))],type:"edge",frontColor:h,lineWidth:l.eval(this.width)},this.space))};a.Polygon3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,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(){l=this.evaluator;this.updateMVMatrix();u=l.getVariable("x");p=l.getVariable("y");b=l.getVariable("z");c=l.getVariable("u");l.setVariable("u",0);d=l.eval(this.Nu);e=[];for(var h=0;h<=d;h++){l.setVariable("u",h/d);for(var m=0,k=
this.expresion.length;m<k;m++)l.eval(this.expresion[m]);e.push(this.transformVertex(new a.Vector4D(l.getVariable("x"),l.getVariable("y"),l.getVariable("z"),1)))}h=0;for(m=e.length-1;h<m;h++)this.primitives.push(new a.Primitive3D({vertices:[e[h],e[h+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:l.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));l.setVariable("x",u);l.setVariable("y",b);l.setVariable("z",p);l.setVariable("u",c)};a.Curve3D=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q,k,g=function(b,c){return a.Graphic3D.call(this,b,c)||this};$jscomp.inherits(g,a.Graphic3D);g.prototype.buildPrimitives=function(){q=this.evaluator;this.updateMVMatrix();k=q.eval(this.expresion);e=k[0][0];d=k[0][1];c=k[0][2];u=k[1][0];p=k[1][1];b=k[1][2];l=k[2][0];m=k[2][1];h=k[2][2];var g=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,d,c,1)),this.transformVertex(new a.Vector4D(l,
m,h,1)),this.transformVertex(new a.Vector4D(u,p,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:g,model:this.model},this.space))};a.Triangle3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(u,a.Graphic3D);u.prototype.buildPrimitives=function(){d=this.evaluator;this.updateMVMatrix();c=d.eval(this.expresion);e=[];for(var p=c.length-1;0<=p;p--)e.push(this.transformVertex(new a.Vector4D(c[p][0],c[p][1],c[p][2],1)));p=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:e,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:p,model:this.model},this.space))};a.Face3D=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("2");c.length=c.length||b.evaluator.parser.parse("2");return c};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();e=b.eval(this.Nu);d=[this.transformVertex(new a.Vector4D(0,0,0,1))];c=b.eval(this.width)/2;u=b.eval(this.length)/2;p=2*Math.PI/e;for(var m=0;m<e;m++)d.push(this.transformVertex(new a.Vector4D(c*
Math.cos(p*m),u*Math.sin(p*m),0,1)));var h=this.color.getColor(),l=this.backcolor.getColor(),k=this.edges?this.edges.getColor():"";for(m=0;m<e;m++)this.primitives.push(new a.Primitive3D({vertices:[d[0],m+2<=e?d[m+2]:d[1],d[m+1]],type:"face",frontColor:h,backColor:l,edges:k,model:this.model},this.space))};a.Polireg3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p=function(b,c){return a.Graphic3D.call(this,b,c)||this};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){e=this.evaluator;d=e.eval(this.expresion);c=d[0][0];u=d[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(c,u,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=p;return a}(descartesJS||{});
descartesJS=function(a,e){if(a.loadLib)return a;var d=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),c=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,u,p,b=0,l=function(m,h){var l=a.Graphic.call(this,m,h)||this;l.expresion=l.expresion||void 0;l.inirot=l.inirot||"(0,0,0)";l.inirotEuler=l.inirotEuler||!1;l.inipos=l.inipos||m.evaluator.parser.parse("(0,0,0)");l.endrot=l.endrot||
"(0,0,0)";l.endrotEuler=l.endrotEuler||!1;l.endpos=l.endpos||m.evaluator.parser.parse("(0,0,0)");l.name=l.name||"_descartes_empty_name_"+b++;Object.assign(l,h);l.inirot.match("Euler")&&(l.inirot=l.inirot.replace("Euler",""),l.inirotEuler=!0);l.endrot.match("Euler")&&(l.endrot=l.endrot.replace("Euler",""),l.endrotEuler=!0);l.inirot=l.evaluator.parser.parse(l.inirot);l.endrot=l.evaluator.parser.parse(l.endrot);l.inirotM=new a.Matrix4x4;l.inirotM_X=new a.Matrix4x4;l.inirotM_Y=new a.Matrix4x4;l.inirotM_Z=
new a.Matrix4x4;l.iniposM=new a.Matrix4x4;l.endrotM=new a.Matrix4x4;l.endrotM_X=new a.Matrix4x4;l.endrotM_Y=new a.Matrix4x4;l.endrotM_Z=new a.Matrix4x4;l.endposM=new a.Matrix4x4;l.graphics=[];m=m.lessonParser;var k=new a.Tokenizer;if(void 0==l.expresion)return l;"'"!==l.expresion.charAt(0)&&(l.expresion="'"+l.expresion+"'");l.expresion=l.evaluator.parser.parse(l.expresion);h=l.evaluator.eval(l.expresion);if(h)var g=(g=document.getElementById(h))&&"descartes/macro"==g.type?g.text:a.openExternalFile(h);
if(g){var n=a.convertHTMLEntities(g).replace(/\r/g,"").split("\n");g=[];h=0;for(var v=n.length;h<v;h++){var p=n[h].indexOf("=");if(-1!==p){p=m.split(n[h]);for(var r=0,f=p.length;r<f;r++)if(p[r]&&1<p.length&&("id"===e[p[r][0]]||"type"===e[p[r][0]])){g.push(p);break}}}h=0;for(v=g.length;h<v;h++){f=(r=g[h]||[],r[0])&&"id"===r[0][0];var u=!1;n=0;for(p=r.length;n<p;n++){var z=r[n][0].indexOf(".");-1===z||f?z=e[r[n][0]]:(z=e[r[n][0].substring(z+1)],r[n][0]=l.name+"."+r[n][0]);"type"===z&&"surface"===e[r[n][1]]&&
(u=!0);if(!("font"===z||"font_family"===z||("fill"===z||"color"===z||"backcolor"===z||"arrow"===z)&&"("!==r[n][1].charAt(0)||"file"===z&&r[n][1].match(c)||"id"!==z&&void 0!==e[r[n][1]]||u&&"expresion"===z)||"width"===z||"height"===z||"length"===z)if("text"==z)if(r[n][1].match(/\{\\rtf1/)){z=r[n][1];var w=l;var x=function(b,f){f=k.tokenize(f.replace(/&squot;/g,"'"));for(var c=0,g=f.length;c<g;c++)"identifier"!=f[c].type||a.reservedIds.match("-"+f[c].value+"-")||(f[c].value=w.name+"."+f[c].value);return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+k.flatTokens(f)};z=z.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);z=z.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);r[n][1]=z}else{x=m.parseText(r[n][1]).textElementsMacros;for(var F=0,J=x.length;F<J;F++){z=k.tokenize(x[F].replace(/&squot;/g,"'"));for(var E=0,K=z.length;E<K;E++)"identifier"!==z[E].type||a.reservedIds.match("-"+z[E].value+"-")||(z[E].value=l.name+"."+z[E].value);z=k.flatTokens(z).replace(/&squot;/g,"'").replace(/'\+\(/g,
"[").replace(/\)\+'/g,"]");x[F]=z.substring(1,z.length-1)}r[n][1]=x.join("")}else{x=r[n][1].replace(/&squot;/g,"'").split(";");F=0;for(J=x.length;F<J;F++){z=k.tokenize(x[F].replace(/\\n/g,";"));E=0;for(K=z.length;E<K;E++)"identifier"!==z[E].type||a.reservedIds.match("-"+z[E].value+"-")||(z[E].value=l.name+"."+z[E].value);x[F]=k.flatTokens(z)}r[n][1]=x.join(";")}}}h=0;for(v=g.length;h<v;h++)if(g[h][0]){r="";f=!1;n=0;for(p=g[h].length;n<p;n++)"type"===e[g[h][n][0]]&&d.match("-"+e[g[h][n][1]]+"-")&&
(f=!0),r=r+g[h][n][0]+"='"+g[h][n][1]+"' ";g[h]=r+(f?" space='"+l.spaceID+"'":"");f?l.graphics.push(m.parse3DGraphic(g[h],l.abs_coord,l.background,l.inirot)):m.parseAuxiliar(g[h])}}h=0;for(v=l.graphics.length;h<v;h++)l.graphics[h].macroChildren=!0;return l};$jscomp.inherits(l,a.Graphic);l.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)};l.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};l.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++)u=this.graphics[a],u.macro_inirotEuler=this.inirotEuler,u.macro_inirotM=this.inirotM,u.macro_inirotM_X=this.inirotM_X,u.macro_inirotM_Y=this.inirotM_Y,u.macro_inirotM_Z=this.inirotM_Z,u.macro_iniposM=this.iniposM,u.macro_endrotEuler=this.endrotEuler,u.macro_endrotM=this.endrotM,u.macro_endrotM_X=this.endrotM_X,u.macro_endrotM_Y=this.endrotM_Y,u.macro_endrotM_Z=this.endrotM_Z,u.macro_endposM=this.endposM,u.update();a=0;for(b=this.graphics.length;a<b;a++){u=this.graphics[a];
if(u.split||this.split)for(var c=a+1;c<b;c++)p=this.graphics[c],(p.split||this.split)&&u.splitFace(p);this.primitives=this.primitives.concat(u.primitives||[])}};l.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)};
l.prototype.drawAux=function(a){};a.Macro3D=l;return a}(descartesJS||{},babel);
descartesJS=function(a){function e(a,b,f,c,g){d.call(this,a/r,a/r,a/r,c,g)}function d(a,b,c,g,d){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,g,d)||(this.vertices=[new f(a,c,b,1),new f(a,-c,b,1),new f(a,c,-b,1),new f(a,-c,-b,1),new f(-a,c,b,1),new f(-a,-c,b,1),new f(-a,c,-b,1),new f(-a,-c,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,c,g,d))}function c(a,b,c,g,d){a/=2;if(!this.changeGeometry(a,b,c,g,d)){var n=2*Math.PI/3,e=2*a*Math.sqrt(2)/3,h=-a/
3,k=e*Math.cos(n)+0*Math.sin(n);n=-e*Math.sin(n)+0*Math.cos(n);this.vertices=[new f(0,0,a,1),new f(k,n,h,1),new f(k,-n,h,1),new f(e,0,h,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,c,g,d)}}function u(a,b,c,g,d){a/=2;this.changeGeometry(a,b,c,g,d)||(this.vertices=[new f(0,0,a,1),new f(a,0,0,1),new f(-a,0,0,1),new f(0,a,0,1),new f(0,-a,0,1),new f(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,c,g,d))}function p(b,
c,g,d,n){b/=Math.PI;if(!this.changeGeometry(b,c,g,d,n)){A=b/1.6180339887;I=1.6180339887*b;this.vertices=[new f(b,b,b,1),new f(b,b,-b,1),new f(b,-b,b,1),new f(b,-b,-b,1),new f(-b,b,b,1),new f(-b,b,-b,1),new f(-b,-b,b,1),new f(-b,-b,-b,1),new f(0,A,I,1),new f(0,A,-I,1),new f(0,-A,I,1),new f(0,-A,-I,1),new f(A,I,0,1),new f(A,-I,0,1),new f(-A,I,0,1),new f(-A,-I,0,1),new f(I,0,A,1),new f(I,0,-A,1),new f(-I,0,A,1),new f(-I,0,-A,1)];H=(new a.Matrix4x4).setIdentity().rotateY(-v/6);G=0;for(O=this.vertices.length;G<
O;G++)this.vertices[G]=H.multiplyVector4(this.vertices[G]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,c,g,d,n)}}function b(b,c,g,d,n){b/=3.8;if(!this.changeGeometry(b,c,g,d,n)){I=1.6180339887*b;this.vertices=[new f(0,b,I,1),new f(0,b,-I,1),new f(0,-b,I,1),new f(0,-b,-I,1),new f(b,I,0,1),new f(b,-I,0,1),new f(-b,I,0,1),new f(-b,-I,0,1),
new f(I,0,b,1),new f(I,0,-b,1),new f(-I,0,b,1),new f(-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]];H=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);G=0;for(O=this.vertices.length;G<O;G++)this.vertices[G]=H.multiplyVector4(this.vertices[G]);this.updateValues(b,c,g,d,n)}}function l(a,b,c,d,e){a/=2;this.isSphere?c=b=a:(b/=2,c/=2);if(!this.changeGeometry(a,
b,c,d,e)){this.vertices=[new f(0,0,b,1)];for(G=1;G<d;G++)for(E=G*v/d,C=0;C<e;C++)J=C*y/e,w=a*g(E)*n(J),x=c*g(E)*g(J),F=b*n(E),this.vertices.push(new f(w,x,F,1));this.vertices.push(new f(0,0,-b,1));this.faces=[];for(G=0;G<e;G++)this.faces.push([0,(G+1)%e+1,G%e+1]);for(G=1;G<d-1;G++)for(C=0;C<e;C++)this.faces.push([C+1+(G-1)*e,(C+1)%e+1+(G-1)*e,(C+1)%e+1+G*e,C+1+G*e]);for(G=0;G<e;G++)this.faces.push([this.vertices.length-1,this.vertices.length-1-e+G,this.vertices.length-1-e+(G+1)%e]);this.updateValues(a,
b,c,d,e)}}function m(a,b,c,d,e){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(G=0;G<e;G++)for(C=0;C<d;C++)w=a*(e-G)/e*n(C*y/d),x=c*(e-G)/e*g(C*y/d),F=b-2*G*b/e,this.vertices.push(new f(w,x,F,1));this.vertices.push(new f(0,0,-b,1));this.faces=[];for(G=0;G<e-1;G++)for(C=0;C<d;C++)this.faces.push([C+G*d,(C+1)%d+G*d,(C+1)%d+(G+1)*d,C+(G+1)*d]);for(G=0;G<d;G++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+G,this.vertices.length-1-d+(G+1)%d]);this.updateValues(a,
b,c,d,e)}}function h(a,b,c,d,e){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(G=0;G<e+1;G++)for(C=0;C<d;C++)w=a*n(C*y/d),x=c*g(C*y/d),F=b-2*G*b/e,this.vertices.push(new f(w,x,F,1));this.faces=[];for(G=0;G<e;G++)for(C=0;C<d;C++)this.faces.push([C+G*d,(C+1)%d+G*d,(C+1)%d+(G+1)*d,C+(G+1)*d]);this.updateValues(a,b,c,d,e)}}function q(a,b,c,d,e){a/=2;b/=2;c/=2;K=B.eval(this.R);D=B.eval(this.r);if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(G=0;G<e+1;G++)for(C=0;C<d;C++)w=
-(K+D*g(y*C/d))*g(y*G/e),x=(K+D*g(y*C/d))*n(y*G/e),F=D*n(y*C/d),this.vertices.push(new f(w,x,F,1));this.faces=[];for(G=0;G<e;G++)for(C=0;C<d;C++)this.faces.push([C+G*d,C+(G+1)*d,(C+1)%d+(G+1)*d,(C+1)%d+G*d]);this.updateValues(a,b,c,d,e)}}function k(){this.vertices=[];this.faces=[];G=0;for(O=this.fileData.length;G<O;G++)M=this.fileData[G],M.match(/^V\(/)?(P=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new f(P[0]||0,P[1]||0,P[2]||0,1))):M.match(/^F\(/)&&(P=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(P.reverse()))}if(a.loadLib)return a;var g=Math.sin,n=Math.cos,v=Math.PI,y=2*v,r=Math.sqrt(3),f,B,z,w,x,F,J,E,K,D,A,I,H,M,P,G,O,C,N,L=function(g,n){n=a.Graphic3D.call(this,g,n)||this;n.width=n.width||g.evaluator.parser.parse("2");n.height=n.height||g.evaluator.parser.parse("2");n.length=n.length||g.evaluator.parser.parse("2");n.R=n.R||g.evaluator.parser.parse("2");n.r=n.r||g.evaluator.parser.parse("1");f=a.Vector4D;switch(n.subType){case "cube":n.buildGeometry=
e;break;case "box":n.buildGeometry=d;break;case "tetrahedron":n.buildGeometry=c;break;case "octahedron":n.buildGeometry=u;break;case "sphere":n.isSphere=!0;case "ellipsoid":n.buildGeometry=l;break;case "dodecahedron":n.buildGeometry=p;break;case "icosahedron":n.buildGeometry=b;break;case "cone":n.buildGeometry=m;break;case "cylinder":n.buildGeometry=h;break;case "torus":n.buildGeometry=q;break;case "mesh":n.fileData=a.openExternalFile(n.evaluator.eval(n.file)).split(/\r/),n.buildGeometry=k}return n};
$jscomp.inherits(L,a.Graphic3D);L.prototype.buildPrimitives=function(){B=this.evaluator;this.updateMVMatrix();this.buildGeometry(B.eval(this.width),B.eval(this.height),B.eval(this.length),B.eval(this.Nu),B.eval(this.Nv));var b=this.color.getColor(),f=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";G=0;for(O=this.faces.length;G<O;G++){z=[];C=0;for(N=this.faces[G].length;C<N;C++)z.push(this.transformVertex(this.vertices[this.faces[G][C]]));this.primitives.push(new a.Primitive3D({vertices:z,
type:"face",frontColor:b,backColor:f,edges:c,model:this.model},this.space))}};L.prototype.changeGeometry=function(a,b,f,c,g){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===f&&this.oldNu===c&&this.oldNv===g};L.prototype.updateValues=function(a,b,f,c,g){this.oldWidth=a;this.oldHeight=b;this.oldLength=f;this.oldNv=g;this.oldNu=c};a.OtherGeometry3D=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.max,d=Math.min,c=Math.PI,u=Math.cos,p=Math.sin,b=Math.abs,l=Math.round,m,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K,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 l(e(d(this.x,32E3),-32E3))};D.prototype.iy=function(){return l(e(d(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){h=this.copy();h.sub(a);return h.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){q=this.copy();n=u(a);v=p(a);this.x=q.x*n-q.y*v;this.y=q.x*v+q.y*n};D.prototype.rot2=function(a){this.rot(a*c/180)};D.prototype.intersection=function(a,c,n,h){y=c.x-a.x;r=n.x-h.x;f=n.x-a.x;B=c.y-a.y;z=n.y-h.y;w=n.y-a.y;K=y*
z-r*B;return 1E-6<b(K)?(k=(f*z-w*r)/K,g=(-f*B+w*y)/K,0<=k&&1>=k&&0<=g&&1>=g?new D(a.x+y*k,a.y+B*k):null):(c.x-n.x)*w!=(c.y-n.y)*f?null:a.x!=c.x?(x=d(a.x,c.x),F=e(a.x,c.x),x<=n.x&&n.x<=F?n:x<=h.x&&h.x<=F?h:null):n.x!=h.x?(J=d(n.x,h.x),E=e(n.x,h.x),J<=a.x&&a.x<=E?a:J<=c.x&&c.x<=E?c:null):a.y!=c.y?(x=d(a.y,c.y),F=e(a.y,c.y),x<=n.y&&n.y<=F?n:x<=h.y&&h.y<=F?h:null):n.y!=h.y?(J=d(n.y,h.y),E=e(n.y,h.y),J<=a.y&&a.y<=E?a:J<=c.y&&c.y<=E?c:null):a.x==n.x&&a.y==n.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q=function(c,g){this.evaluator=c;this.constraint=g;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);p=new a.R2(0,0);h=new a.R2(0,0)};q.prototype.getUnitNormal=function(){this.normal.normalize();return h.set(this.normal.x,this.normal.y)};q.prototype.gradient=function(a){e=this.evaluator;b.x=0;b.y=0;l=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);d=e.eval(this.constraint);b.x=(d-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);d=e.eval(this.constraint);b.y=(d-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;e.setVariable("x",l);e.setVariable("y",m);return b};q.prototype.findZero=function(a,b,d){e=this.evaluator;p.x=a.x;p.y=a.y;l=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 p;e.setVariable("x",l);e.setVariable("y",m);for(var g=0;16>g;g++)if(c=p.x,u=p.y,this.normal=
this.gradient(p),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),p.x=c+this.normal.x,p.y=u+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=p.x-a.x,this.normal.y=p.y-a.y),p;return d?p:null};a.R2Newton=q;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,d=Math.round,c,u,p,b,l,m,h,q,k,g,n,v,y,r=function(b,c){this.parent=b;this.evaluator=b.evaluator;var f=this.parser=b.evaluator.parser;this.id="GraphicControl"!==c.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==c.type?100:350;this.h="Video"!==c.type?23:120;"GraphicControl"!==c.type&&"Audio"!==c.type&&"Video"!==c.type?"TextArea"!==c.type?this.expresion=f.parse("(0,0,100,23)"):(this.expresion=f.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=f.parse("(0,0)");this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color=new a.Color(4>this.parent.version?"000000":"222222");this.colorInt=new a.Color("GraphicControl"!==c.type?"f0f8ff":"cc0022");this.font_size=4>this.parent.version?-1:f.parse("12");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=
f.parse("1");this.activeif=f.parse("1");this.valueExpr=f.parse("0");this.decimals=f.parse("2");this.min=f.parse("-Infinity");this.max=f.parse("Infinity");this.incr=f.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,c);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");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;c=this.evaluator.eval(this.expresion);
this.x=d(c[0][0]);this.y=d(c[0][1]);4==c[0].length&&(this.w=d(c[0][2]),this.h=d(c[0][3]));this.actionExec=b.lessonParser.parseAction(this)};r.prototype.init=function(){};r.prototype.update=function(){};r.prototype.draw=function(){};r.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,c=a.length;b<c;b++){var g=a[b];if(g.id===this.spaceID)return g.addCtr(this),this.zIndex=g.zIndex,this.space=g,g.numericalControlContainer}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.numericalControlContainer):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].numericalControlContainer};r.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};r.prototype.updatePositionAndSize=function(){p=b=l=m=!1;h=this.evaluator.eval(this.expresion);q=d(h[0][0]);p=d(this.x)!==q;this.x=q;q=d(h[0][1]);b=d(this.y)!==q;this.y=q;4===h[0].length&&(q=d(h[0][2]),l=d(this.w)!==q,this.w=q,q=d(h[0][3]),m=d(this.h)!==q,this.h=q);if(l||m||p||b)this.init(!0),this.draw()};
r.prototype.formatOutputValue=function(a){y=this.parent;k=a+"";g=this.evaluator.eval(this.decimals);n=k.indexOf(".");-1!=n&&(v=k.substring(n+1),v.length>g&&(k=parseFloat(k).toFixed(g)));this.fixed&&(2!==y.version||2===y.version&&!this.exponentialif)&&(k=parseFloat(a).toFixed(g));this.exponentialif&&0!=parseFloat(k)&&(k=this.fixed&&2!==y.version?parseFloat(k).toExponential(g):parseFloat(k).toExponential(),k=k.toUpperCase().replace("+",""));return k.replace(".",y.decimal_symbol)};r.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()};r.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);c=b*b;for(a=0;a<b;a++)u=e(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+u*u*192/c/255+")")};a.Control=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,d=Math.abs,c=/[\w\.\-//]*(\.gif)/gi,u,p,b,l,m,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K,D,A,I,H,M,P,G,O,C,N=function(b,f){var c=a.Control.call(this,b,f)||this;c.imageSrc=f.imageSrc||"";c.image=f.image||new Image;c.imageOver=f.imageOver||new Image;c.imageDown=f.imageDown||new Image;c.flat=f.flat||!1;c.borderColor=f.borderColor||!1;c.text_align=f.text_align||"center_center";c.image_align=f.image_align||"center_center";c.font_family=a.getFontName(f.font_family||
"arial");c.ratio=b.ratio;-1===c.font_size&&(c.fontSizeNotSet=!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.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 g,d=0,n=b.length;d<n;d++)f=b[d],g=f.match(/rgb/g),f.match("class=")?c.classContainer=" "+f.substring(6):f.match("border=")?(c.btnStyle.push({type:"border-style",value:"solid"}),c.btnStyle.push({type:"border-width",value:f.substring(7).trim()+"px"})):f.match("borderRadius=")?(c.btnStyle.push({type:"border-radius",value:f.substring(13).trim()+"px"}),c.conStyle.push({type:"border-radius",
value:f.substring(13).trim()+"px"})):f.match("borderColor=")?c.btnStyle.push({type:"border-color",value:(g?"":"#")+f.substring(12).trim()}):f.match("overColor=")?c.conStyle.overColor=(g?"":"#")+f.substring(10).trim():f.match("downColor=")?c.conStyle.downColor=(g?"":"#")+f.substring(10).trim():f.match("font=")?c.conStyle.font=f.substring(5).trim().toLowerCase():f.match("inactiveColor=")?c.conStyle.inactiveColor=(g?"":"#")+f.substring(14).trim():f.match("inactiveColorBorder=")?c.conStyle.inactiveColorBorder=
(g?"":"#")+f.substring(20).trim():f.match("shadowTextBlur=")?c.conStyle.shadowTextBlur=parseFloat(f.substring(15).trim()):f.match("shadowTextOffsetX=")?c.conStyle.shadowTextOffsetX=parseFloat(f.substring(18).trim()):f.match("shadowTextOffsetY=")?c.conStyle.shadowTextOffsetY=parseFloat(f.substring(18).trim()):f.match("shadowTextColor=")?c.conStyle.shadowTextColor=(g?"":"#")+f.substring(16).trim():f.match("shadowBoxBlur=")?c.conStyle.shadowBoxBlur=parseFloat(f.substring(14).trim()):f.match("shadowBoxOffsetX=")?
c.conStyle.shadowBoxOffsetX=parseFloat(f.substring(17).trim()):f.match("shadowBoxOffsetY=")?c.conStyle.shadowBoxOffsetY=parseFloat(f.substring(17).trim()):f.match("shadowBoxColor=")?c.conStyle.shadowBoxColor=(g?"":"#")+f.substring(15).trim():f.match("shadowInsetBoxBlur=")?c.conStyle.shadowInsetBoxBlur=parseFloat(f.substring(19).trim()):f.match("shadowInsetBoxOffsetX=")?c.conStyle.shadowInsetBoxOffsetX=parseFloat(f.substring(22).trim()):f.match("shadowInsetBoxOffsetY=")?c.conStyle.shadowInsetBoxOffsetY=
parseFloat(f.substring(22).trim()):f.match("shadowInsetBoxColor=")?c.conStyle.shadowInsetBoxColor=(g?"":"#")+f.substring(20).trim():f.match("textBorder=")?c.conStyle.textBorder=parseFloat(f.substring(11).trim()):f.match("flat=")&&(c.flat=1==parseInt(f.substring(5).trim()))}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(f=b.substr(0,b.lastIndexOf(".")),g=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),f)try{c.imageOver=c.parent.getImage(f+"_over"+g),c.imageDown=c.parent.getImage(f+"_down"+
g)}catch(T){}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.container.appendChild(c.btn);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(N,
a.Control);N.prototype.init=function(c){u=this.evaluator;z=this.container;p=this.btn;b=this.ctx;l=u.eval(this.expresion);this.x=l[0][0];this.y=l[0][1];4==l[0].length&&(this.w=parseInt(l[0][2]),this.h=parseInt(l[0][3]));p.width=this.w*this.ratio;p.height=this.h*this.ratio;p.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+this.h+"px;box-sizing:border-box;");z.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 f=0,g=this.btnStyle.length;f<g;f++)p.style[this.btnStyle[f].type]=this.btnStyle[f].value;if(this.conStyle){f=0;for(g=this.conStyle.length;f<g;f++)z.style[this.conStyle[f].type]=this.conStyle[f].value;if(this.conStyle.shadowBoxColor){f=this.conStyle.shadowBoxOffsetX||0;g=this.conStyle.shadowBoxOffsetY||2;var d=this.conStyle.shadowBoxBlur||2;z.style.boxShadow=f+"px "+g+"px "+d+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(f=this.conStyle.shadowInsetBoxOffsetX||
0,g=this.conStyle.shadowInsetBoxOffsetY||-2,d=this.conStyle.shadowInsetBoxBlur||1,p.style.boxShadow=f+"px "+g+"px "+d+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset");this.conStyle.shadowTextColor&&(b.shadowBlur=this.conStyle.shadowTextBlur||1,b.shadowOffsetX=this.conStyle.shadowTextOffsetX||0,b.shadowOffsetY=this.conStyle.shadowTextOffsetY||2,b.shadowColor=this.conStyle.shadowTextColor)}this.fontSizeNotSet&&(this.font_size=u.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=u.eval(this.font_size);
this.createGradient(this.w,this.h);z.style.display=0<u.eval(this.drawif)?"block":"none";b.textAlign="center";b.textBaseline="middle";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.customStyle&&("serif"==this.conStyle.font?b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family:"monospace"==this.conStyle.font&&(b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+a.monospace_font));this.draw(c)};N.prototype.update=
function(){u=this.evaluator;z=this.container;p=this.btn;this.activeIfValue=0<u.eval(this.activeif);this.drawIfValue=0<u.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(z.style.display="block",this.draw(),z.style.cursor=p.style.cursor=this.activeIfValue?"pointer":"not-allowed",this.updatePositionAndSize()):(z.style.display="none",this.buttonClick=!1)};N.prototype.draw=function(d){z=this.container;u=this.evaluator;p=this.btn;b=this.ctx;h=u.eval(this.name);q=this.evaluator.eval(this.imageSrc).toString().trim();
if(!d&&(w=this.over===this.oldOver,x=this.buttonClick===this.oldButtonClick,F=this.activeIfValue===this.oldActiveIfValue,J=this.drawIfValue===this.oldDrawIfValue,E=h===this.oldName,K=q===this.oldImageSrc,D=this.colorInt.getColor()===this.oldBackColor,A=this.color.getColor()===this.oldTextColor,I=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=h,this.oldImageSrc=
q,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,w&&x&&F&&J&&E&&K&&D&&A&&I))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);m=this.fs_evaluated;z.setAttribute("data-name",h);q?(k="vacio.gif"===q?this.emptyImage:this.parent.getImage(q),H=q.substr(0,q.lastIndexOf(".")),M=q.substr(q.lastIndexOf(".")),P=H+"_over"+M,G=H+"_down"+M,O="vacio.gif"===q?this.emptyImage:this.parent.getImage(P),C="vacio.gif"===q?this.emptyImage:
this.parent.getImage(G)):C=O=k=this.emptyImage;b.clearRect(0,0,this.w,this.h);g=n=0;this.buttonClick&&(g=n=1);"center"==this.text_align[1]?f=e(this.w/2+g)-.5:"left"==this.text_align[1]?(v=b.measureText(h).width,f=v/2+5+g):"right"==this.text_align[1]&&(v=b.measureText(h).width,f=this.w-v/2+g-5);"center"==this.text_align[0]?B=e(this.h/2+n)-.5:"top"==this.text_align[0]?B=m/2+n+4:"bottom"==this.text_align[0]&&(B=this.h-m/2+n-3);k&&("center"==this.image_align[1]?y=parseInt((this.w-k.width)/2)+g:"left"==
this.image_align[1]?y=g:"right"==this.image_align[1]&&(y=this.w-k.width+g),"center"==this.image_align[0]?r=parseInt((this.h-k.height)/2)+n:"top"==this.image_align[0]?r=n:"bottom"==this.image_align[0]&&(r=this.h-k.height+n));if(k&&k.ready)if(k!==this.emptyImage&&k.complete)if(q.match(c))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+q+"')",this.btn.style.backgroundPosition=y+"px "+r+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])z.style.backgroundColor=
this.colorInt.getColor();b.drawImage(k,y,r)}else this.emptyImage&&this.customStyle&&(z.style.backgroundColor=this.colorInt.getColor());else z.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.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));this.activeIfValue&&(O!==this.emptyImage&&this.over&&O.ready&&O.complete?
P.match(c)?(this.btn.style.backgroundImage="url('"+P+"')",this.btn.style.backgroundPosition=y+"px "+r+"px"):b.drawImage(O,y,r):this.customStyle&&this.conStyle.overColor&&this.over&&(z.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?C!==this.emptyImage&&this.buttonClick&&C.ready&&C.complete?G.match(c)?(this.btn.style.backgroundImage="url('"+G+"')",this.btn.style.backgroundPosition=y+"px "+r+"px"):b.drawImage(C,y,r):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(z.style.backgroundColor=
this.conStyle.downColor):this.buttonClick&&!k&&(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,b.strokeText(h,f,B));this.borderColor&&(b.lineWidth=parseInt(m/6),b.strokeStyle=this.borderColor.getColor(),b.strokeText(h,f,B));b.fillText(h,f,B);this.underlined&&(v=b.measureText(h).width,b.strokeStyle=
this.color.getColor(),b.lineWidth=e(m/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(f-v/2+g,B+e(m/2)+e(m/5)-1.5),b.lineTo(f+v/2+g,B+e(m/2)+e(m/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?z.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=y;this._image_pos_y=r};N.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>
(d(this.colorInt.r-this.color.r)+d(this.colorInt.g-this.color.g)+d(this.colorInt.b-this.color.b))/255)};N.prototype.buttonPressed=function(){this.updateAndExecAction()};N.prototype.addEvents=function(){function b(c,f,n){a.clearTimeout(d);g.buttonClick&&g.drawIfValue&&g.activeIfValue&&(f.call(g),c=n?c:100,d=a.setTimeout(function(){b(c,f,!1)},c))}function c(c){this.focus();c.preventDefault();c.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();g.whichBtn=a.whichBtn(c);
"L"==g.whichBtn&&g.activeIfValue&&(g.buttonClick=!0,g.draw(),"calculate"==g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),b(1E3,g.buttonPressed,!0)),g.btn.removeEventListener("touchend",f),g.btn.addEventListener("touchend",f),g.btn.removeEventListener("mouseup",f),g.btn.addEventListener("mouseup",f))}function f(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(g.activeIfValue||g.buttonClick)g.buttonClick=!1,g.draw(),"calculate"!=g.action&&(g.evaluator.setVariable(g.id,
g.evaluator.eval(g.valueExpr)),g.buttonPressed()),g.btn.removeEventListener("touchend",f),g.btn.removeEventListener("mouseup",f);g.parent.update()}var g=this,d;g.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",c);this.btn.addEventListener("mousedown",c);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();g.over=!0;g.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=null;b.preventDefault();
b.stopPropagation();g.over=!1;g.buttonClick=!1;g.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;g.buttonClick=!1})};a.Button=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q,k,g,n,v=function(b,c){c=a.Control.call(this,b,c)||this;c.flat=c.image_dec_src&&c.image_inc_src;c.btn_pos=c.btn_pos||"v_left";c.horizontal="h_left"===c.btn_pos||"h_right"===c.btn_pos||"h_left_right"===c.btn_pos;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.tabindex=++c.parent.tabindex;"_._"==c.name&&(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.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:c.id});c.divUp=a.newHTML("div",{class:"DJS_Up"});c.divDown=a.newHTML("div",{class:"DJS_Down"});c.field=a.newHTML("input",{type:"text",id:c.id+"_spinner",class:"DescartesSpinnerField",tabindex:c.tabindex});c.label=a.newHTML("label",{class:"DescartesSpinnerLabel"});c.container.appendChild(c.label);c.container.appendChild(c.field);c.container.appendChild(c.divUp);
c.container.appendChild(c.divDown);c.addControlContainer(c.container);k=c.evaluator.parser.parse("1");c.originalIncr=c.incr;if(0>c.evaluator.eval(c.decimals)||0===c.evaluator.eval(c.incr))b=c.evaluator.eval(c.incr),0<b?(c.incr=c.evaluator.parser.parse(parseInt(b).toString()),c.originalIncr=c.incr):c.incr=k;c.image_dec_src&&(c.image_dec_src.match(/^\[.*\]?/)?c.image_dec_src=c.parser.parse(c.image_dec_src.substring(1,c.image_dec_src.length-1)):c.image_dec_src=c.parser.parse("'"+c.image_dec_src+"'"),
c.old_image_dec_src=c.evaluator.eval(c.image_dec_src).toString().trim(),c.image_dec=c.parent.getImage(c.old_image_dec_src));c.image_inc_src&&(c.image_inc_src.match(/^\[.*\]?/)?c.image_inc_src=c.parser.parse(c.image_inc_src.substring(1,c.image_inc_src.length-1)):c.image_inc_src=c.parser.parse("'"+c.image_inc_src+"'"),c.old_image_inc_src=c.evaluator.eval(c.image_inc_src).toString().trim(),c.image_inc=c.parent.getImage(c.old_image_inc_src));c.addEvents();c.init();return c};$jscomp.inherits(v,a.Control);
v.prototype.init=function(){e=this.evaluator;var b=e.eval(this.name).toString();this.label.innerHTML=b;b=this.label.textContent;this.value=this.validateValue(e.eval(this.valueExpr));var c=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var f=2!==this.parent.version?"__":"_____",g=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){var d=parseInt(this.h),n=parseInt(this.w/2-d);f=a.getTextWidth(b+f,this.fieldFontSize+
"px "+a.sansserif_font);this.visible||(n=this.w-2*d,g=0);n<f&&(n=f);""==b&&(n=0);this.w-n-d<g&&(n=this.w-d-g);0>n&&(n=0);b=this.w-(n+2*d);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:"+d+"px;height:"+d+"px;"+("h_left"===this.btn_pos?"left:"+(n+d):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+
d+"px;height:"+d+"px;left:"+(n+("h_right"===this.btn_pos?b:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+(d+n+("h_left"===this.btn_pos?d:"h_right"===this.btn_pos?-d:0))+"px;text-align:center;")}else d=2+parseInt(this.h/2),n=parseInt(this.w/2-d/2),f=a.getTextWidth(b+f,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(n=this.w-d,g=0),n<f&&(n=f),""==
b&&(n=0),this.w-n-d<g&&(n=this.w-d-g),0>n&&(n=0),b=this.w-(n+d),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;"),f="width:"+d+"px;left:"+(n+("v_right"===this.btn_pos?b:0))+"px;",this.divUp.setAttribute("style",f+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",f+";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:"+b+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?d:0)+n)+"px;");this.field.value=c;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+n+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");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)};v.prototype.update=function(){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();0>e.eval(this.decimals)?(d=e.eval(this.incr),0<d?this.originalIncr=this.incr=
e.parser.parse(parseInt(d).toString()):this.incr=k):this.incr=0!==e.eval(this.originalIncr)?this.originalIncr:k;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&&(g=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==g&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")",this.old_image_dec_src=g));this.image_inc&&(n=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==n&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")",this.image_inc_src=n));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(c=this.field.value,u=this.value,this.value=this.validateValue(e.getVariable(this.id)),
this.field.value=this.formatOutputValue(this.value),this.value==u&&this.field.value!=c&&(this.value=this.validateValue(c),this.field.value=this.formatOutputValue(this.value)),e.setVariable(this.id,this.value))};v.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"};v.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,".");p=a==parseFloat(a)?parseFloat(a):parseFloat(e.eval(e.parser.parse(a)));isNaN(p)&&(p=0);m=e.eval(this.min);h=e.eval(this.max);""===m&&(m=-Infinity);""===h&&(h=Infinity);p=Math.min(Math.max(p,m),h);this.discrete&&(b=e.eval(this.incr),p=0==b?0:b*Math.round(p/b));l=e.eval(this.decimals);0>=l&&(l=0);return p=parseFloat(parseFloat(p).toFixed(l))};v.prototype.increase=function(){this.changeValue(parseFloat(this.value)+
this.evaluator.eval(this.incr))};v.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};v.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())};v.prototype.addEvents=function(){function b(c,f,g){a.clearTimeout(h);if(n.up||n.down)f.call(n),c=g?c:10,h=a.setTimeout(function(){b(c,f)},c)}function c(c){c.preventDefault();
n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,b(e,n.increase,!0))}function f(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,b(e,n.decrease,!0))}function g(b){n.up=!1;a.clearTimeout(h);n.updateStyle()}function d(b){n.down=!1;a.clearTimeout(h);n.updateStyle()}q=a.hasTouchSupport;var n=this,e=q?500:200,h;n.divUp.oncontextmenu=n.divDown.oncontextmenu=n.field.oncontextmenu=n.label.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&&n.changeValue(n.field.value)});this.divUp.addEventListener("touchstart",c);this.divUp.addEventListener("mousedown",c);this.divDown.addEventListener("touchstart",f);this.divDown.addEventListener("mousedown",f);this.divUp.addEventListener("mouseout",function(b){n.up=!1;a.clearTimeout(h);b.preventDefault();n.updateStyle()});this.divDown.addEventListener("mouseout",
function(b){n.down=!1;a.clearTimeout(h);b.preventDefault();n.updateStyle()});this.divUp.addEventListener("touchend",g);window.addEventListener("touchend",g);this.divUp.addEventListener("mouseup",g);window.addEventListener("mouseup",g);this.divDown.addEventListener("touchend",d);window.addEventListener("touchend",d);this.divDown.addEventListener("mouseup",d);window.addEventListener("mouseup",d);document.addEventListener("visibilitychange",function(b){n.up=!1;n.down=!1;a.clearTimeout(h);n.updateStyle()});
n.field.addEventListener("click",function(a){this.focus()})};a.Spinner=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d=function(c,d){var e=a.Control.call(this,c,d)||this;e.label_color=e.label_color||new a.Color("e0e4e8",c.evaluator);e.label_text_color=e.label_text_color||new a.Color("000000",c.evaluator);e.typeCtr="checkbox";e.pressed=d.pressed||!1;e.radio_group=(d.radio_group||"").trim();""!==e.radio_group&&(e.typeCtr="radio");e.name.match(/^\[.*\]?/)?e.name=e.parser.parse(e.name.substring(1,e.name.length-1)):e.name=e.parser.parse("'"+e.name.trim()+"'");e.tabindex=
++e.parent.tabindex;e.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:e.id});e.checkbox=a.newHTML("input",{type:e.typeCtr,id:e.id+e.typeCtr,class:"DescartesCheckbox",tabindex:e.tabindex});""!==e.radio_group&&e.checkbox.setAttribute("name",e.radio_group);e.checkbox.internalID=e.id;e.label=a.newHTML("label",{class:"DescartesCheckboxLabel"});e.dummyLabel=a.newHTML("label",{"for":e.id+e.typeCtr});e.value=e.evaluator.eval(e.valueExpr);e.containerControl.appendChild(e.label);e.containerControl.appendChild(e.checkbox);
e.containerControl.appendChild(e.dummyLabel);e.addControlContainer(e.containerControl);e.addEvents();e.init();return e};$jscomp.inherits(d,a.Control);d.prototype.init=function(c){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();this.labelFontSize=a.getFieldFontSize(this.h);c=Math.max(this.w-this.h,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+";");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.checkbox.checked=0!=this.value;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.evaluator.setVariable(this.id,this.value);this.update()};d.prototype.update=
function(){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();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;""===this.radio_group?this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value):(this.value=this.checkbox.checked?1:0,this.pressed&&(e.setVariable(this.radio_group,this.id),this.pressed=!1));e.setVariable(this.id,this.value)}this.updatePositionAndSize()};d.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(a){c.pressed=!0;c.updateAndExecAction()})};a.Checkbox=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l=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.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");c.answer&&(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?(b=c.answerPattern.indexOf("|"),c.firstAnswer=-1==b?c.answerPattern:c.answerPattern.substring(0,b)):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()});""==name.trim()&&(name="");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("label",{class:"DescartesTextFieldLabel"});
c.containerControl.appendChild(c.label);c.containerControl.appendChild(c.field);c.addControlContainer(c.containerControl);c.addEvents();c.init();return c};$jscomp.inherits(l,a.Control);l.prototype.init=function(b){e=this.evaluator;var c=e.eval(this.name).toString();this.label.innerHTML=c;c=this.label.textContent;b||(this.value=this.validateValue(e.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var d=a.getTextWidth(b+"_",this.fieldFontSize+
"px "+a.sansserif_font),l=parseInt(this.w/2),g=a.getTextWidth(c,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(l=this.w,d=0);l<g&&(l=g);""==c&&(l=0);this.w-l<d&&(l=this.w-d);0>l&&(l=0);c=this.w-l;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+l+"px;");this.field.value=b;this.label.setAttribute("style",
"font-size:"+this.fieldFontSize+"px;width:"+l+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");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()};l.prototype.update=function(){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();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||(d=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!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),e.setVariable(this.id,this.value));
this.updatePositionAndSize()};l.prototype.validateValue=function(a){if(""===a||"''"==a)return"";e=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");u=a==parseFloat(a)?parseFloat(a):parseFloat(e.eval(e.parser.parse(a)));isNaN(u)&&(u=0);p=e.eval(this.min);b=e.eval(this.max);""===p&&(p=-Infinity);""===b&&(b=Infinity);u<p&&(u=p);u>b&&(u=b);this.discrete&&(a=e.eval(this.incr),u=0===a?0:a*Math.round(u/a));return u=parseFloat(parseFloat(u).toFixed(e.eval(this.decimals)))};l.prototype.formatOutputValue=
function(b){return""===b?"":a.Control.prototype.formatOutputValue.call(this,b)};l.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())};l.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};
l.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};l.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=b.label.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){b.evaluator.eval(b.drawIf)&&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()})};a.TextField=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.abs,d,c,u,p,b,l,m,h,q,k,g=function(b,g){function n(b){f.options=b.split(",");f.menuOptions=[];f.strValue=[];b=0;for(var g=f.options.length;b<g;b++){var n=f.customSplit(f.options[b]);1==n.length?(f.menuOptions.push(n[0]),f.strValue.push(b.toString())):2==n.length&&(f.menuOptions.push(n[0]),""==n[1]?f.strValue.push(b.toString()):f.strValue.push(n[1]))}b=0;for(g=f.menuOptions.length;b<g;b++)f.menuOptions[b].match(/^\[/)&&f.menuOptions[b].match(/\]$/)?
f.menuOptions[b]=d.parse(f.menuOptions[b].substring(1,f.menuOptions[b].length-1)):f.menuOptions[b]=d.parse("'"+f.menuOptions[b]+"'");b=0;for(g=f.strValue.length;b<g;b++)f.strValue[b].match(/^\[/)&&f.strValue[b].match(/\]$/)?f.strValue[b]=d.parse(f.strValue[b].substring(1,f.strValue[b].length-1)):f.strValue[b]=d.parse(f.strValue[b]);for(;f.select.firstChild;)f.select.remove();b=0;for(g=f.menuOptions.length;b<g;b++)n=a.newHTML("option"),n.innerHTML=c.eval(f.menuOptions[b]),f.select.appendChild(n);return 0}
var e=a.Control.call(this,b,g)||this;e.label_color=e.label_color||new a.Color("e0e4e8",b.evaluator);e.label_text_color=e.label_text_color||new a.Color("000000",b.evaluator);e.options=g.options||"";d=e.parser;c=e.evaluator;e.ok=0;e.tabindex=++e.parent.tabindex;e.answer&&(e.answer.match("krypto_")&&(e.answer=(new a.Krypto).decode(e.answer.substring(7))),e.answer=parseInt(e.answer.split(",")[0].replace("[",""))||0);e.name.match(/^\[.*\]?/)?e.name=e.parser.parse(e.name.substring(1,e.name.length-1)):e.name=
e.parser.parse("'"+e.name+"'");var f=e;e.evaluator.setFunction(e.id+".setOptions",n);e.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:e.id});e.label=a.newHTML("label",{class:"DescartesMenuLabel"});e.select=a.newHTML("select",{id:e.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:e.tabindex});e.field=a.newHTML("input",{type:"text",id:e.id+"_menuField",class:"DescartesMenuField",tabindex:e.tabindex});n(e.options);e.containerControl.appendChild(e.label);e.containerControl.appendChild(e.select);
e.visible&&e.containerControl.appendChild(e.field);e.addControlContainer(e.containerControl);e.addEvents();e.init();return e};$jscomp.inherits(g,a.Control);g.prototype.init=function(b){c=this.evaluator;var g=c.eval(this.name).toString();this.label.innerHTML=g;g=this.label.textContent;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var n=0,d=0;this.value=b?this.value:c.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var f=0,e=this.menuOptions.length;f<e;f++)b=
a.getTextWidth(c.eval(this.menuOptions[f]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>n&&(n=b,d=f);n+=25;b=a.getTextWidth(this.formatOutputValue(c.eval(this.strValue[d])),this.fieldFontSize+"px "+a.sansserif_font)+7;d=a.getTextWidth(g,this.fieldFontSize+"px "+a.sansserif_font)+10;""==g&&(d=0);this.visible||(b=0);for(g=this.w-b-d;g<n&&0<d;)d--,g++;for(;g<n&&0<b;)b--,g++;for(;d+g+b+1<this.w;)g++,b++;n=d;f=n+g;b=this.w-f;e=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:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.field.value=e;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+f+"px;");this.select.setAttribute("style","text-align:left;font-size:"+
this.fieldFontSize+"px;width:"+g+"px;height:"+this.h+"px;left:"+n+"px;");this.select.selectedIndex=this.indexValue;c.setVariable(this.id,parseFloat(e.replace(this.parent.decimal_symbol,".")));this.update()};g.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){this.label.innerHTML=c.eval(this.name).toString();for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=c.eval(this.menuOptions[a]);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()};g.prototype.customSplit=function(a){l=!1;m="";h=0;for(q=-1;h<a.length;){k=a.charAt(h);if("["===k&&-1===q){if(l||""!=m)m+="\u00a6";q++}else"["===k?q++:"]"===k&&0===q?(l=!0,q--):"]"==a.charAt(h)&&(q=0>q?q:q-1);m+=a.charAt(h);h++}return m.split("\u00a6")};g.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));u=-1;p=Infinity;for(var c=0,g=this.strValue.length;c<
g;c++)b=e(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=p&&(p=b,u=c);return u};g.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};g.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.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()});this.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("click",function(a){this.focus()})};
a.Menu=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,d,c,u,p,b,l,m,h,q,k,g,n,v,y,r,f,B,z,w=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.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("label",{class:"DescartesScrollbarLabel"});c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);c.container.appendChild(c.divDown);
c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(w,a.Control);w.prototype.init=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.value=this.validateValue(d.eval(this.valueExpr));u=this.formatOutputValue(this.value);p=this.evaluator.eval(this.expresion);this.x=p[0][0];this.y=p[0][1];4==p[0].length&&(this.w=p[0][2],this.h=
p[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(u);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};w.prototype.initScroll=function(b){c=this;d=c.evaluator;z=d.eval(c.name).toString();c.label.innerHTML=z;z=this.label.textContent;var f="v"===c.orientation?parseInt(19+5*(c.h-100)/100):c.h;c.fieldFontSize="v"===c.orientation?f-parseInt(c.h/20)-1:2!==c.parent.version?a.getFieldFontSize(f):10;b=a.getTextWidth(b+"_",c.fieldFontSize+"px "+a.sansserif_font);
var g=c.parent.getSpaceById(c.spaceID).h;c.labelHeight=""==z?0:f;c.fieldHeight=""==c.visible?0:f;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),f=c.fieldHeight,b=f+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=15,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=15>c.scrollHandlerH?15:c.scrollHandlerH,c.limInf=b-c.downH-c.scrollHandlerH,c.limSup=f+c.downH;else{f=a.getTextWidth(z,c.fieldFontSize+"px "+a.sansserif_font)+10;c.labelWidth=f;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++;f=c.labelWidth;g=f+b;c.fieldWidth=c.w-g;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=15;c.upHeight=c.downH=c.h;c.upX=g-c.downW;c.upY=0;c.downX=c.labelWidth;c.downY=0;c.scrollHandlerW=parseInt((c.canvasWidth-c.upWidth-c.downW)/10);c.scrollHandlerW=15>c.scrollHandlerW?15:c.scrollHandlerW;c.scrollHandlerH=c.h;c.limInf=f+c.downW;c.limSup=f+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;");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()+";")};w.prototype.update=function(){d=this.evaluator;this.label.innerHTML=d.eval(this.name).toString();0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display=
"none";this.updatePositionAndSize();var a=this.validateValue(d.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);d.setVariable(this.id,this.value)};w.prototype.draw=function(){c=this;b=c.ctx;m=e(this.w);l=e(this.h);b.fillStyle="#e0e4e8";b.fillRect(0,0,m,l);b.strokeStyle="#7a8a99";b.fillStyle="#ccdcec";c.down&&b.fillRect(c.downX+
.5,c.downY+.5,c.downW,c.downH-1);b.strokeRect(c.downX+.5,c.downY+.5,c.downW,c.downH-1);c.up&&b.fillRect(c.upX+.5,c.upY-.5,c.upWidth,c.upHeight+1);b.strokeRect(c.upX+.5,c.upY-.5,c.upWidth,c.upHeight+1);h=4;b.fillStyle="black";b.beginPath();"h"===c.orientation?(b.moveTo(c.downX+h,c.downH/2),b.lineTo(c.downX+c.downW-h,h),b.lineTo(c.downX+c.downW-h,c.downH-h),b.moveTo(c.upX+c.upWidth-h,c.downH/2),b.lineTo(c.upX+h,h),b.lineTo(c.upX+h,c.downH-h),b.fill(),c.activeIfValue&&(q=e(c.pos),b.fillStyle="#ccdcec",
b.fillRect(q+.5,0,e(c.scrollHandlerW),l),b.strokeStyle="#6382bf",b.strokeRect(q+.5,0,e(c.scrollHandlerW),l),k=e(c.scrollHandlerW/2),b.beginPath(),b.moveTo(q+k+.5-2,3),b.lineTo(q+k+.5-2,l-3),b.moveTo(q+k+.5,3),b.lineTo(q+k+.5,l-3),b.moveTo(q+k+.5+2,3),b.lineTo(q+k+.5+2,l-3),b.stroke())):(b.moveTo(c.downX+c.downW/2,c.downY+c.downH-h),b.lineTo(c.downX+h,c.downY+h),b.lineTo(c.downX+c.downW-h,c.downY+h),b.moveTo(c.upX+c.upWidth/2,c.upY+h),b.lineTo(c.upX+h,c.upY+c.upHeight-h),b.lineTo(c.upX+c.upWidth-h,
c.upY+c.upHeight-h),b.fill(),c.activeIfValue&&(q=e(c.pos),b.fillStyle="#ccdcec",b.fillRect(0,q+.5,m,e(c.scrollHandlerH)),b.strokeStyle="#6382bf",b.strokeRect(0,q+.5,m,e(c.scrollHandlerH)),k=e(c.scrollHandlerH/2),b.beginPath(),b.moveTo(3,q+k+.5-2),b.lineTo(m-3,q+k+.5-2),b.moveTo(3,q+k+.5),b.lineTo(m-3,q+k+.5),b.moveTo(3,q+k+.5+2),b.lineTo(m-3,q+k+.5+2),b.stroke()));b.strokeRect(.5,.5,m-1,l-1);c.activeIfValue||(b.fillStyle="rgba(240,240,240,"+160/255+")",b.fillRect(0,0,m,l.h))};w.prototype.validateValue=
function(a){d=this.evaluator;g=a.toString();g=parseFloat(g.replace(this.parent.decimal_symbol,"."));isNaN(g)&&(g=0);this.minimo=d.eval(this.min);g<this.minimo&&(this.value=null,g=this.minimo);this.maximo=d.eval(this.max);g>this.maximo&&(this.value=null,g=this.maximo);n=this.incr;g=0!=n?g*n/n:0;this.fixed&&(g=parseFloat(parseFloat(g).toFixed(d.eval(this.decimals))));return g};w.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};w.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-
this.incr)};w.prototype.increase10=function(){h=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+h):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+h)};w.prototype.decrease10=function(){h=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-h):this.clickPos.y>this.prePos&&
this.changeValue(parseFloat(this.value)-h)};w.prototype.changeValue=function(a){this.activeIfValue&&(v=this.validateValue(a),v!=this.value&&(this.value=v,this.field.value=this.formatOutputValue(v),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction()))};w.prototype.changeValueForScrollMovement=function(){d=this.evaluator;y=this.limInf;r=this.limSup;f=d.eval(this.min);B=d.eval(this.max);n=this.incr;v=e((this.pos-y)*(B-f)/
(r-y)/n)*n+f;v!=this.value&&(this.value=v,this.field.value=this.formatOutputValue(v),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};w.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;y=this.limInf;r=this.limSup;f=d.eval(this.min);B=d.eval(this.max);n=this.incr;this.pos=(this.value-f)*(r-y)/(B-f)+y;this.scrollHandler.style["h"==this.orientation?"left":"top"]=this.pos+"px"};w.prototype.addEvents=function(){function b(c,
f,g,d){a.clearTimeout(p);(r.up||r.down||r.canvasClick)&&1E-7<Math.abs(r.value-d)&&(f.call(r),c=g?c:30,p=a.setTimeout(function(){b(c,f,!1,d)},c))}function c(c){c.preventDefault();r.whichBtn=a.whichBtn(c);"L"==r.whichBtn&&r.activeIfValue&&(r.clickPos=a.getCursorPosition(c,r.container),r.canvasClick=!0,"h"==r.orientation?r.clickPos.x<r.prePos?b(350,r.decrease10,!0,r.minimo):b(350,r.increase10,!0,r.maximo):r.clickPos.y<r.prePos?b(350,r.increase10,!0,r.maximo):b(350,r.decrease10,!0,r.minimo))}function f(b){r.canvasClick=
!1;a.clearTimeout(p)}function g(b){1==r.canvasClick&&(r.clickPos=a.getCursorPosition(b,r.container),b.preventDefault())}function d(a){r.scrollClick=!1;r.prePos=r.pos;window.removeEventListener("mouseup",d,!1);window.removeEventListener("mousemove",e,!1);a.preventDefault()}function n(a){r.scrollClick=!1;r.prePos=r.pos;window.removeEventListener("touchend",n,!1);window.removeEventListener("touchmove",e,!1);a.preventDefault()}function e(b){var c=a.getCursorPosition(b,r.container);"h"==r.orientation?
(r.pos=r.prePos-(r.initPos.x-c.x),r.pos<r.limInf&&(r.pos=r.limInf),r.pos>r.limSup&&(r.pos=r.limSup),r.scrollHandler.setAttribute("style","width:"+r.scrollHandlerW+"px;height:"+r.h+"px;left:"+r.pos+"px;top:0;")):(r.pos=r.prePos-(r.initPos.y-c.y),r.pos>r.limInf&&(r.pos=r.limInf),r.pos<r.limSup&&(r.pos=r.limSup),r.scrollHandler.setAttribute("style","width:"+r.w+"px;height:"+r.scrollHandlerH+"px;left:0;top:"+r.pos+"px;"));r.changeValueForScrollMovement();b.preventDefault()}function l(c){c.preventDefault();
r.whichBtn=a.whichBtn(c);"L"==r.whichBtn&&r.activeIfValue&&(r.up=!0,b(350,r.increase,!0,r.maximo))}function h(c){c.preventDefault();r.whichBtn=a.whichBtn(c);"L"==r.whichBtn&&r.activeIfValue&&(r.down=!0,b(350,r.decrease,!0,r.minimo))}function k(b){r.down=!1;a.clearTimeout(p);b.preventDefault()}function m(b){r.up=!1;a.clearTimeout(p);r.draw()}function v(b){r.down=!1;a.clearTimeout(p);r.draw()}var r=this,p;r.canvas.oncontextmenu=r.divUp.oncontextmenu=r.divDown.oncontextmenu=r.label.oncontextmenu=r.field.oncontextmenu=
r.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&r.changeValue(r.field.value)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",k);window.addEventListener("touchend",f);window.addEventListener("mouseup",f);this.canvas.addEventListener("touchmove",g);this.canvas.addEventListener("mousemove",g);this.scrollHandler.addEventListener("touchstart",function(b){r.activeIfValue&&
(r.scrollClick=!0,r.initPos=a.getCursorPosition(b,r.container),window.addEventListener("touchend",n),window.addEventListener("touchmove",e),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){r.activeIfValue&&(r.scrollClick=!0,r.initPos=a.getCursorPosition(b,r.container),window.addEventListener("mouseup",d),window.addEventListener("mousemove",e),b.preventDefault())});this.divUp.addEventListener("touchstart",l);this.divUp.addEventListener("mousedown",l);this.divDown.addEventListener("touchstart",
h);this.divDown.addEventListener("mousedown",h);this.divUp.addEventListener("mouseout",function(b){r.up=!1;a.clearTimeout(p);b.preventDefault()});this.divDown.addEventListener("mouseout",k);window.addEventListener("touchend",m);window.addEventListener("mouseup",m);window.addEventListener("touchend",v);window.addEventListener("mouseup",v)};a.Scrollbar=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c=function(c,d){var b=a.Control.call(this,c,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;c=b.evaluator.eval(b.expresion);4==c[0].length?(b.w=c[0][2],b.h=c[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(l){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(l){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(l){}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(a){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime)});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));(d=0<e.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",d!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Audio=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c=function(c,d){var b=a.Control.call(this,c,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;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;d=c.lastIndexOf(".");-1!=d&&(c=b.file.substring(0,d));b.video=a.newHTML("video",{poster:c+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(d=a.newHTML("source",{src:c+".mp4",type:"video/mp4"}),b.video.appendChild(d));b.video.canPlayType("video/ogg")&&(d=a.newHTML("source",{src:c+".ogg",type:"video/ogg"}),b.video.appendChild(d),d=a.newHTML("source",{src:c+".ogv",type:"video/ogg"}),b.video.appendChild(d));b.video.canPlayType("video/webm")&&
(d=a.newHTML("source",{src:c+".webm",type:"video/webm"}),b.video.appendChild(d));b.addControlContainer(b.video);e.setFunction(b.id+".play",function(){try{b.video.play()}catch(l){}return 0});e.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(l){}return 0});e.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(l){}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;(d=0<e.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",d!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Video=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u=function(c,b){var d=a.Control.call(this,c,b)||this;d.font_family=b.font_family||"Monospaced";d.style=b.style||",PLAIN,";d.font_size=b.font_size||12;typeof("number"!==d.font_size)&&(d.font_size=d.evaluator.eval(d.font_size));d.font=d.font_family+d.style+d.font_size;d.region="interior";d.tabindex=++d.parent.tabindex;if(d.answer){d.answer.match("krypto_")&&(d.answer=(new a.Krypto).decode(d.answer.substring(7)));var e=d.parent.lessonParser.parseText(d.answer)}d.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:d.id,spellcheck:"false"});d.textArea=a.newHTML("div",{class:"DescartesTextAreaContainer",contenteditable:"true"});d.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});d.showButton=a.newHTML("div",{class:"DJS_Gradient"});d.activeCover=a.newHTML("div");d.containerControl.appendChild(d.textArea);d.containerControl.appendChild(d.textAreaAnswer);d.containerControl.appendChild(d.showButton);d.containerControl.appendChild(d.activeCover);
d.addControlContainer(d.containerControl);d.showAnswer=!1;d.text=void 0==d.text||"simpleText"==d.text.type?d.rawText||"":d.text.hasFormula?d.rawText:d.text.toHTML();e&&"simpleText"!==e.type&&(d.answer=d.text.hasFormula?"":e.toHTML());d.evaluator.setVariable(d.id,d.text);var h,p,k;d.evaluator.setFunction(d.id+".insertAtCursor",function(a){(h=window.getSelection())&&h.getRangeAt&&h.rangeCount&&(k=document.createTextNode(a),p=h.getRangeAt(0),p.deleteContents(),p.insertNode(k),p.setStart(k,k.length),
p.setEnd(k,k.length),h.removeAllRanges(),h.addRange(p),d.textArea.focus());return 0});d.evaluator.setFunction(d.id+".update",function(){d.update()});d.addEvents();d.init();return d};$jscomp.inherits(u,a.Control);u.prototype.init=function(){d=this.answer?28:4;e=this.evaluator;var c=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var b=
"padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-d)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",b);this.textArea.innerHTML=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.activeCover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;");this.update()};u.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.innerText=
(e.getVariable(this.id)||"").replace(/\\n/g,"\n"));c=this.textArea.innerText||"";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.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};u.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=
this;this.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"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});this.textArea.addEventListener("paste",function(a){a.preventDefault();
document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});this.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()})};a.TextArea=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,d,c,u,p,b,l,m,h,q,k,g,n,v=function(b,g){var f=a.Control.call(this,b,g)||this;c=b.evaluator.parser;f.spaceID=g.spaceID||"";f.text=g.text||"";f.size=g.size||c.parse("4");f.font=g.font||"Monospaced,PLAIN,12";f.image=new Image;f.image.onload=function(){this.ready=1};f.imageSrc=g.imageSrc||"";f.font=a.convertFont(f.font);if(f.constraintExpr){f.constraint=c.parse(f.constraintExpr);"(expr)"==f.constraint.type&&(f.constraint=c.parse(f.constraintExpr.substring(1,
f.constraintExpr.length-1)));if("compOperator"==f.constraint.type){g=f.constraint.childs[0];var d=f.constraint.childs[1];"identifier"!=g.type||"y"!=g.value||d.contains("y")?"identifier"!=g.type||"x"!=g.value||d.contains("x")?f.newt=new a.R2Newton(f.evaluator,f.constraint):(f.constVar="y",f.noConstVar="x",f.evalConst=f.evalConstXoY,f.constraint=d):(f.constVar="x",f.noConstVar="y",f.evalConst=f.evalConstXoY,f.constraint=d)}else f.constraint=null;k=new a.R2(0,0)}f.container=f.getContainer();f.mouseCatcher=
a.newHTML("div",{class:"DescartesGraphicControl",id:f.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:rgba(0,0,0,0);z-index:"+f.zIndex+";"});f.ctx=f.space.ctx;f.container.appendChild(f.mouseCatcher);f.addEvents();f.xStr=f.id+".x";f.yStr=f.id+".y";f.activoStr=f.id+".activo";f.activeStr=f.id+".active";""!==f.space.id&&2!==b.version?(f.mxStr=f.space.id+".mouse_x",f.myStr=f.space.id+".mouse_y",f.mclickedStr=f.space.id+".mouse_clicked",f.mclicizquierdoStr=f.space.id+".clic_izquierdo"):
(f.mxStr="mouse_x",f.myStr="mouse_y",f.mclickedStr="mouse_clicked",f.mclicizquierdoStr="clic_izquierdo");f.init();return f};$jscomp.inherits(v,a.Control);v.prototype.init=function(){d=this.evaluator;g=a.hasTouchSupport;var b=d.eval(this.expresion);this.x=b[0][0];this.y=b[0][1];d.setVariable(this.xStr,this.x);d.setVariable(this.yStr,this.y);""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*d.eval(this.size),this.height=2*d.eval(this.size),this._w=g&&48>this.width?48:
this.width,this._h=g&&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.imageSrc),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=
parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";d.setVariable(this.activoStr,0);d.setVariable(this.activeStr,0);this.setImage=!1;this.update()};v.prototype.update=function(){d=this.evaluator;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.x=d.getVariable(this.xStr);this.y=d.getVariable(this.yStr);u=this.space.getAbsoluteX(this.x);p=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=
parseInt(u-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(p-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};v.prototype.draw=function(){d=this.evaluator;this.drawIfValue&&(h=this.ctx,q=this.space.backgroundCtx,u=parseInt(this.space.getAbsoluteX(this.x))+.5,p=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(u,p),this.image.ready?(b=this.image.width/2,l=this.image.height/2,this.image.complete&&!this.setImage&&h.drawImage(this.image,parseInt(u-b),parseInt(p-
l)),this.trace&&(q.save(),q.translate(u,p),q.scale(parseInt(b),parseInt(l)),q.beginPath(),q.arc(0,0,1,0,e),q.restore(),q.lineWidth=1,q.strokeStyle=this.trace.getColor(),q.stroke())):(b=parseInt(this.width/2),h.beginPath(),h.arc(u,p,b,0,e),h.fillStyle=this.colorInt.getColor(),h.fill(),h.lineWidth=1,h.strokeStyle=this.color.getColor(),h.stroke(),this.active&&(h.strokeStyle=this.colorInt.borderColor(),h.beginPath(),h.arc(u,p,b-2,0,e),h.stroke()),this.trace&&(q.strokeStyle=this.trace.getColor(),q.beginPath(),
q.arc(u,p,b,0,e),q.stroke())))};v.prototype.evalConst=function(){k.set(this.x,this.y);m=this.newt.findZero(k,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)};v.prototype.evalConstXoY=function(){d=this.evaluator;n=d.getVariable(this.constVar);d.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=d.eval(this.constraint);d.setVariable(this.xStr,this.x);d.setVariable(this.yStr,this.y);d.setVariable(this.constVar,
n)};v.prototype.drawText=function(a,b){h=this.ctx;d=this.evaluator;"simpleText"==this.text.type?(h.fillStyle=this.color.getColor(),h.font=this.font,h.textBaseline="alphabetic",h.fillText(this.text.toString(d.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))):(h.fillStyle=this.color.getColor(),h.strokeStyle=this.color.getColor(),h.textBaseline="alphabetic",this.text.draw(h,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",
!0,this.color.getColor()))};v.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,g=a.length;c<g;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};v.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,
0)};v.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();e.whichBtn=a.whichBtn(b);"L"==e.whichBtn&&e.activeIfValue&&(e.parent.deactivateGraphicControls(),e.click=e.active=!0,e.evaluator.setVariable(e.activoStr,1),e.evaluator.setVariable(e.activeStr,1),e.evaluator.setVariable(e.mclickedStr,0),e.evaluator.setVariable(e.mclicizquierdoStr,0),e.posAnte=a.getCursorPosition(b,e.container),e.prePos={x:e.space.getAbsoluteX(e.x),y:e.space.getAbsoluteY(e.y)},e.evaluator.setVariable(e.mxStr,
e.space.getRelativeX(e.posAnte.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(e.posAnte.y)),e.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",f),window.addEventListener("mouseup",c),window.addEventListener("mousemove",f))}function c(b){document.body.focus();b.preventDefault();b.stopPropagation();e.evaluator.setVariable(e.mclickedStr,1);e.evaluator.setVariable(e.mclicizquierdoStr,1);if(e.activeIfValue||e.active)e.click=!1,window.removeEventListener("mouseup",
c),window.removeEventListener("mousemove",f),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",f),d=a.getCursorPosition(b,e.container)||d,e.posX=e.prePos.x-(e.posAnte.x-d.x),e.posY=e.prePos.y-(e.posAnte.y-d.y),e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX)),e.evaluator.setVariable(e.yStr,e.space.getRelativeY(e.posY)),e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(d.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(d.y)),e.parent.updateControls(),
e.parent.update(),e.mouseCatcher.style.left=e.space.getAbsoluteX(e.x)-e._w/2+"px",e.mouseCatcher.style.top=e.space.getAbsoluteY(e.y)-e._h/2+"px";e.parent.deactivateGraphicControls();e.parent.updateControls()}function f(b){b.preventDefault();e.evaluator.setVariable(e.mclickedStr,0);e.evaluator.setVariable(e.mclicizquierdoStr,0);d=a.getCursorPosition(b,e.container);e.posX=e.prePos.x-(e.posAnte.x-d.x);e.posY=e.prePos.y-(e.posAnte.y-d.y);e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX));e.evaluator.setVariable(e.yStr,
e.space.getRelativeY(e.posY));e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(d.x));e.evaluator.setVariable(e.myStr,e.space.getRelativeY(d.y));80<Date.now()-g&&(e.parent.updateControls(),e.parent.update(),g=Date.now())}var g=0,d,e=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){e.over=!0});
this.mouseCatcher.addEventListener("mouseout",function(a){e.over=!1;e.click=!1})};a.GraphicControl=v;return a}(descartesJS||{});
descartesJS=function(a,e){var d,c,u,p,b,l,m,h,q,k;function g(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var n=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,v,y,r,f,B,z,w,x,F,J,E,K,D,A,I,H,M,P,G,O,C,N,L,R,Q,W,V,U,T,S=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};S.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,g=a.length;c<g;c++)switch(r=
a[c][0],f=a[c][1],y=e[r],y){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[y]=parseInt(f);break;case "about":case "config":case "init":case "clear":b[y]="true"===e[f];break;default:console.warn("Propiedad de botones no identificada: <"+r+"> valor: <"+f+">")}return b};S.prototype.parseSpace=function(b){B={};b=this.split(b);for(var c=0,g=b.length;c<g;c++)switch(r=b[c][0],f=b[c][1],y=e[r],a.DEBUG.paramName=r,a.DEBUG.objectName="Space",y){case "type":if("R2"===f||
"R3"===f)f=e[f];B[y]=f;break;case "id":a.DEBUG.idName=f;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":B[y]=f;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":B[y]="true"===e[f];break;case "bg_display":case "render":B[y]=e[f];break;case "border_color":case "net":case "net10":case "axes":case "text":B[y]=""!=f?"false"===e[f]?"":new a.Color(f,this.parent.evaluator):"";break;case "O.x":B.OxExpr=
f;break;case "O.y":B.OyExpr=f;break;case "image":B.imageSrc=f;break;case "x":v=f;"%"===v[v.length-1]?(B.xPercentExpr=v.trim(),v=(this.parent.container.width*parseFloat(v)/100).toString()):v=f;B.xExpr=this.parser.parse(v);break;case "y":v=f;"%"===v[v.length-1]?(B.yPercentExpr=v.trim(),v=(this.parent.container.height*parseFloat(v)/100).toString()):v=f;B.yExpr=this.parser.parse(v);break;case "width":v=f.trim();B.wModExpr=v;"%"===v[v.length-1]?(B.wExpr=v,v=this.parent.container.width*parseFloat(v)/100):
(v=parseFloat(f),v!=f&&(v=this.parent.container.width,B._w_=f.trim()));B.w=v;break;case "height":v=f.trim();B.hModExpr=v;"%"===v[v.length-1]?(B.hExpr=v,v=this.parent.container.height*parseFloat(v)/100):(v=parseFloat(f),v!=f&&(v=this.parent.container.height,B._h_=f.trim()));B.h=v;break;case "drawif":""!=f&&(B.drawif=this.parser.parse(f));break;case "scale":v=parseFloat(f);isNaN(v)&&(v=48);B.scale=v;break;case "background":B.background=new a.Color(f,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
r+"> valor: <"+f+">")}return new a["Space"+B.type](this.parent,B)};S.prototype.parseControl=function(b){z={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(r=b[c][0],f=b[c][1],y=e[r],a.DEBUG.paramName=r,a.DEBUG.objectName="Control",y){case "type":v=e[f.trim()];"graphic"===v?v="GraphicControl":"text"===v&&(v="TextArea");z.type=g(v);break;case "gui":v=e[f];"textfield"===v&&(v="TextField");z[y]=g(v);break;case "id":a.DEBUG.idName=f;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 "info":z[y]=
f;break;case "region":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":z[y]=e[f];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":z[y]="true"===e[f];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":z[y]=new a.Color(f,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
f&&(z[y]=this.parser.parse(f));break;case "constraint":z.constraintExpr=f;break;case "image":z.imageSrc=f;break;case "image_dec":z.image_dec_src=f;break;case "image_inc":z.image_inc_src=f;break;case "space":z.spaceID=f;break;case "expresion":z.expresion=this.parser.parse(f.replace(")(",","));break;case "borderColor":z[y]="false"===e[f]?"":f;break;case "bold":"false"!=e[f]&&(z.bold="bold");break;case "italics":"false"!=e[f]&&(z.italics="italic");break;case "underlined":"false"!=e[f]&&(z.underlined=
!0);break;case "value":var n=f.replace(/&squot;/g,"'");n.match(/^\|/)&&(n="'"+n.substring(1),n.match(/\|$/)&&(n=n.substring(0,n.length-1)+"'"));z.valueExpr=this.parser.parse(n);z.valueExprString=n;break;case "incr":0!=f&&(z.incr=this.parser.parse(f));break;case "exponentialif":z.exponentialif=parseFloat(f);break;case "text":z.rawText=f;n=this.parseText(f);for(var h=0,k=n.length;h<k;h++)n[h]=this.parser.parse(n[h],!1);z.text=n;break;default:h=r.indexOf("."),n=e[r.substring(0,h)],h=e[r.substring(h+
1)],"parameter"===n&&"font"===h?z.parameterFont=f:"Explanation"===n&&"font"===h?z.ExplanationFont=f:"tooltip"===n&&"font"===h?z.tooltipFont=f:console.warn("Propiedad de control no identificada: <"+r+"> valor: <"+f+">")}return new a["Numeric"===z.type?z.gui:z.type](this.parent,z)};S.prototype.parseGraphic=function(b,c,d,h){w={rotateExp:h,parameter:"t"};b=this.split(b);h=0;for(var k=b.length;h<k;h++)if(r=b[h][0],f=b[h][1],y=e[r],a.DEBUG.paramName=r,a.DEBUG.objectName="Graphic",""!=f)switch(y){case "type":a.DEBUG.idName=
f;w[y]=g(e[f]);break;case "align":case "anchor":case "lineDash":w[y]=e[f];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":w[y]="true"===e[f];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":w[y]="false"===e[f]?"":new a.Color(f,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":w[y]=
f;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":""!==f&&(w[y]=this.parser.parse(f));break;case "font_size":f=f.trim();f.match(/^\[.*\]?/)&&(f=f.substring(1,f.length-1));""!==f&&(w[y]=this.parser.parse(f));break;case "space":w.spaceID=f;break;case "expresion":""!==f&&("Macro"!==w.type?(w.expresion=this.parser.parse(f),w.expresionString=f):w.expresion=f);break;case "text":w.text=
f;break;case "file":var m=f.replace(/&squot;/g,"'");"["===m.charAt(0)&&"]"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1));m.match(n)&&(m="'"+m+"'");w.file=this.parser.parse(m);break;case "border":""!=f&&"false"!=e[f]&&(w.border=new a.Color(f,this.parent.evaluator));break;default:if(void 0!=w.family&&r.substring(0,w.family.length+1)===w.family+".")switch(e[r.substring(w.family.length+1)]){case "interval":""!=f&&(w.family_interval=this.parser.parse(f));break;case "steps":""!=f&&(w.family_steps=
this.parser.parse(f))}else if(void 0!=w.parameter&&r.match(w.parameter+"."))switch(w.parameter!==r.substring(0,r.indexOf(w.parameter)+w.parameter.length)&&(w.parameter=r.substring(0,r.indexOf(w.parameter)+w.parameter.length)),e[r.substring(w.parameter.length+1)]){case "interval":""!=f&&(w.parameter_interval=this.parser.parse(f));break;case "steps":""!=f&&(w.parameter_steps=this.parser.parse(f))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+r+"> valor: <"+f+">")}c&&(w.abs_coord=
c);d&&(w.background=d);return new a[w.type](this.parent,w)};S.prototype.parse3DGraphic=function(b,c,d,n){w={rotateExp:n,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(r=b[c][0],f=b[c][1],y=e[r],a.DEBUG.paramName=r,a.DEBUG.objectName="Graphic3D",y){case "type":a.DEBUG.idName=f;v=e[f];switch(v){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":w.subType=
v,v="OtherGeometry"}w[y]=g(v);break;case "model":case "lineDash":w[y]=e[f];break;case "fill":w[y]="false"===e[f]?"":new a.Color(f,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":w[y]="true"===e[f];break;case "edges":"false"===e[f]?w[y]="":("true"===e[f]&&(f="808080"),w[y]=new a.Color(f,this.parent.evaluator));break;case "color":case "backcolor":w[y]=new a.Color(f,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":""!=
f&&(w[y]=this.parser.parse(f));break;case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":w[y]=f;break;case "space":w.spaceID=f;break;case "expresion":"Macro"!=w.type&&"Curve"!=w.type&&"Surface"!=w.type?(w.expresion=this.parser.parse(f),w.expresionString=f):w.expresion=f.replace(/\\n/g,";");break;case "text":w.text=f;break;case "file":n=f.replace(/&squot;/g,"'");"["===n.charAt(0)&&"]"===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1));
n.match(/./)&&(n="'"+n+"'");w.file=this.parser.parse(n);break;default:void 0!==w.family&&r.substring(0,w.family.length+1)===w.family+"."?"interval"===e[r.substring(w.family.length+1)]?""!=f&&(w.family_interval=this.parser.parse(f)):""!=f&&(w.family_steps=this.parser.parse(f)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+r+"> valor: <"+f+">")}return new a[w.type+"3D"](this.parent,w)};S.prototype.parseAuxiliar=function(b){x={};b=this.split(b);for(var c=0,g=b.length;c<g;c++)b[c][1]=
b[c][1].replace(/&squot;/g,"'");c=0;for(g=b.length;c<g;c++)switch(r=b[c][0],f=b[c][1],y=e[r],a.DEBUG.paramName=r,a.DEBUG.objectName="Auxiliar",y){case "info":case "code":case "doc":break;case "id":a.DEBUG.idName=f;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":x[y]=f.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":x[y]="true"===
e[f];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":x[y]=this.parser.parse(f);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":x[y]=e[f];break;default:var d=r.indexOf("."),n=e[r.substring(0,d)];d=e[r.substring(d+1)];"parameter"===n&&"font"===d?x.parameterFont=f:console.warn("Propiedad del auxiliar no identificada: <"+r+"> valor: <"+f+">")}x.sequence?x.type="sequence":x.constant?x.type="constant":x.algorithm&&x.evaluate?x.type=
"algorithm":x.array&&!x.matrix&&")"!=x.id.charAt(x.id.length-1)?x.type="vector":x.matrix&&")"!=x.id.charAt(x.id.length-1)?x.type="matrix":x.event&&")"!=x.id.charAt(x.id.length-1)?x.type="event":"library"===x.type?x.type="library":")"===x.id.charAt(x.id.length-1)?x.type="function":x.type="variable";a.DEBUG.typeName=x.type;switch(x.type){case "sequence":new a.Function(this.parent,x);break;case "constant":b=new a.Constant(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);
break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,x));break;case "vector":b=new a.Vector(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);break;case "matrix":b=new a.Matrix(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,x));break;case "library":new a.Library(this.parent,x);break;case "variable":new a.Variable(this.parent,x);break;default:new a.Function(this.parent,
x)}};S.prototype.parseAction=function(b){F=b.action;J=b.parent;E=b.parameter;return F?new (a[g(F)])(J,E):{execute:function(){}}};S.prototype.parseAnimation=function(b){var c={};b=this.split(b);for(var g=0,d=b.length;g<d;g++)switch(r=b[g][0],f=b[g][1],y=e[r],y){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[y]=f.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[y]="true"===e[f];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+
r+">  <"+f+">")}return new a.Animation(this.parent,c)};S.prototype.parsePleca=function(g,e){g=this.split(g);c=d="";u=0;p="#536891";b="white";l="left";m="";h="SansSerif,BOLD,20";q="SansSerif,PLAIN,18";k=void 0;for(var n=0,v=g.length;n<v;n++)switch(r=g[n][0],f=g[n][1],r){case "title":d=f;break;case "subtitle":c=f;break;case "subtitlines":u=f;break;case "bgcolor":""!=f&&(p=(new a.Color(f,this.parent.evaluator)).getColor());break;case "fgcolor":""!=f&&(b=(new a.Color(f,this.parent.evaluator)).getColor());
break;case "align":""!=f&&(l=f);break;case "titleimage":m=f;break;case "titlefont":h=""!=f?a.convertFont(f):a.convertFont(h);break;case "subtitlefont":q=""!=f?a.convertFont(f):a.convertFont(q);break;default:console.warn("Propiedad de la pleca no identificada: <"+r+">  <"+f+">")}if(""===d&&""===c)return a.newHTML("div");P=q.substring(0,q.indexOf("px"));P=P.substring(P.lastIndexOf(" "));""!=m&&(G=this.parent.getImage(m),O=G.height);k=a.newHTML("div",{id:"descartesPleca"});O?(k.setAttribute("style",
"position:absolute;left:0;top:0;text-align:"+l+";width:"+e+"px;height:"+O+"px;background-color:"+p+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),G.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),k.appendChild(G)):k.setAttribute("style","position:absolute;left:0;top:0;text-align:"+l+";width:"+e+"px;background:"+p+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+
h+";overflow:hidden;white-space:nowrap;"});C.innerHTML=d;N=a.newHTML("div");if(1===parseInt(u)){V=0;L=a.newHTML("div");L.innerHTML=c;document.body.appendChild(L);Q=P;do Q-=V,L.setAttribute("style","padding:0;margin:0;font:"+q+";font-size:"+Q+"px;width:"+(e-30)+"px;line-height:"+Q+"px;"),R=L.offsetHeight,W=R/Q,V=1;while(1<W&&8<Q);document.body.removeChild(L);N.setAttribute("style","padding:0;margin:0;font:"+q+";font-size:"+Q+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else N.setAttribute("style",
"padding:0;margin:0;font:"+q+";line-height:1em;");N.innerHTML=c;k.appendChild(C);k.appendChild(N);k.imageHeight=O;return k};S.prototype.split=function(a){if("string"!==typeof a)return[];K=[];a=(a||"").replace(/\\'/g,"\u2019");D=A=H=0;for(I=M=!1;D<a.length;)" "!==a.charAt(D)||I||D++," "===a.charAt(D)||I||(I=!0,H=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,K[A]=[a.substring(H,D)],H=D+2,D+=2),M&&"'"===a.charAt(D)&&(I=M=!1,K[A].push(a.substring(H,D)),A++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||
M||(K[A]=[a.substring(H,D)],H=D+1,D++,U=a.substring(D).indexOf("="),-1===U?T=U=a.length:(U+=D,T=a.substring(D,U).lastIndexOf(" "),T=-1===T?a.length:T+D),K[A].push(a.substring(H,T)),A++,I=!1,D=T),D++;return K};S.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=S;return a}(descartesJS||{},babel);
descartesJS=function(a){function e(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||l(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,f=l(c);if(f===c&&1===f%2)return-Math.pow(-a,b)}return NaN}function d(a,b){y=[];y.type="matrix";y.rows=a;y.cols=b;f=0;for(B=b;f<B;f++)y[f]=Array(a).fill(0);return y}function c(a,b){n=a.rows;v=a.cols;y=d(n,v);var c;for(f=0;f<n;f++)for(r=0;r<v;r++){for(B=c=0;B<v;B++)c+=a[B][f]*b[r][B];y[r][f]=c}return y}function u(a,b,c){for(var f=d(c.length-1,c.length-1),g=0,e=f.length;g<
e;g++)for(var n=0;n<e;n++)f[g][n]=g<a?n<b?c[g][n]:c[g][n+1]:g<b?c[g+1][n]:c[g+1][n+1];return f}function p(a){if(1<a.cols){for(var b=0,c=1,f=0,g=a.cols;f<g;f++)b+=c*a[0][f]*p(u(0,f,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var b={},l=Math.floor,m,h,q,k,g,n,v,y,r,f,B,z=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};z.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};z.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
z.prototype.replaceLastChild=function(a){q=this.childs.length-1;h=this.childs[q];h.parent=null;this.childs[q]=a;a.parent=this;return a};z.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,c=this.childs.length;b<c;b++)if(this.childs[b].contains(a))return!0;return!1};z.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",g=new z("compOperator","=="),g.addChild(this),g.addChild(new z("number","0")),k=this.getRoot(),k.setAllEvalFun(),
k):this};z.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};z.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 g;this.evaluate=function(a,
b){g=a.variables[this.value];if("object"===typeof g&&void 0==g.length)return g.evaluate(a);void 0==g&&(b||a.matrices[this.value]?g=a.matrices[this.value]:a.vectors[this.value]&&(g=a.vectors[this.value]));return void 0!==g?g: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 k,q,z;this.evaluate=function(a){k=[];for(var c=0,f=this.childs[0].childs.length;c<f;c++)k[c]=this.childs[0].childs[c].evaluate(a);if("_Eval_"===this.value){m=0<k.length?k[0]:0;if("number"==
typeof m)return"NaN";m.match(",")&&parseFloat(m.replace(",","."))==m.replace(",",".")&&(m=m.replace(",","."));if(void 0==b[m]){q=m.match(/:=/g)?!0:!1;if(m.match(";")){var g=!1,d=[],e=0;c=0;for(f=m.length;c<f;c++){var n=m.charAt(c);"'"===n&&(g=!g);g||";"!==n||(d.push(m.substring(e,c)),e=c+1)}d.push(m.substring(e));m="("+d.join(")(")+")"}b[m]=a.parser.parse(m,q)}z=a.eval(b[m]);return void 0!=z?z:NaN}return a.functions[this.value].apply(a,k)}}else if("operator"===this.type)"+"===this.value?this.evaluate=
function(b){var c=this.childs[0].evaluate(b,!0);b=this.childs[1].evaluate(b,!0);if("matrix"!==c.type||"matrix"!==b.type)return"number"==typeof c&&"string"==typeof b?c=a.removeNeedlessDecimals(c.toString()):"string"==typeof c&&"number"==typeof b&&(b=a.removeNeedlessDecimals(b.toString())),c+b;n=c.rows;v=c.cols;y=d(n,v);for(f=0;f<n;f++)for(r=0;r<v;r++)y[r][f]=c[r][f]+b[r][f];return y}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==
b.type||"matrix"!==a.type)return b-a;n=b.rows;v=b.cols;y=d(n,v);for(f=0;f<n;f++)for(r=0;r<v;r++)y[r][f]=b[r][f]-a[r][f];return y}:"*"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:c(b,a)}:"/"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var f=d(a.length,a.length),g=p(a);if(0===g)a=
0;else{g=1/g;if(1<a.length)for(var e=0,n=a.length;e<n;e++){var h=g;for(var k=0;k<n;k++)f[k][e]=h*p(u(e,k,a)),h=-h;g=-g}else f[0][0]=g;a=f}b=0===a?d(b.rows,b.cols):c(b,a);return b}:"%"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-l(b/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){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))});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].evaluate(a)};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=
this.childs[0].childs[0].evaluate(a);else for(var f=0;f<b;f++){var g=[];for(var d=0,e=this.childs[f].childs.length;d<e;d++)g.push(this.childs[f].childs[d].evaluate(a));c[f]=g}return c};else if("asign"===this.type){var B,D=this.childs[0],A=this.childs[1],I=D.childs[0]?D.childs[0].childs:null;this.evaluate=1===D.childs.length&&"square_bracket"===D.childs[0].type&&1===I.length?function(a){B=A.evaluate(a);a.setVector(D.value,I[0].evaluate(a),B);return B}:1===D.childs.length&&"square_bracket"===D.childs[0].type&&
2===I.length?function(a){B=A.evaluate(a);a.setMatrix(D.value,I[0].evaluate(a),I[1].evaluate(a),B);return B}:function(a){B=A.evaluate(a);return B.type?a.matrices[D.value]=B:"object"!==typeof a.variables[D.value]?a.variables[D.value]=B:0}}};a.Node=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h=/^\s+/,q=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,k=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,g=/^==|^!=|^<=|^<|^>=|^>|^#/,n=/^!|^~|^&&|^&|^\|\||^\|/,v=/^=|^:=/,y=/^[\?:]/,r=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,f=/^\[|^\]/,B=/^\(|^\)/,z=/^,/,w=/^;/,x=/\|/g,F=/\|\*/g,J=/\*\|/g,E,K=/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/,
D=function(){};D.prototype.tokenize=function(E){function A(a,c,f){d.push({type:a,value:c});b=b.slice(f);u+=f;m=a}if(e=E){var D=E.indexOf("//");0<=D&&":"!==E[D-1]&&(E=E.substring(0,D));E=E.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});E=E.replace(/&sup(.+);/g,"^ $1 ");E=E.replace(/&squot;/g,"'");E.match(/=\|\*/g)&&(E=E.replace(F,"'").replace(J,"'"));E.match(/=\|/g)&&(E=E.replace(x,"'"));D=E.trim();"|"==D.charAt(0)&&"|"==D.charAt(D.length-1)&&
(E=D.replace(x,"'"))}d=[];c=!1;u=0;b=E;for(m="";E&&u<E.length;)if(c=u,"'"==b[0]){for(l=1;"'"!=b[l];)if(l<b.length)l++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+e+"\u300b");return}p=b.substring(1,l);A("string",p,p.length+2)}else if(p=b.match(h))b=b.slice(p[0].length),u+=p[0].length;else if(p=b.match(r))p[0]=p[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),A("operator",p[0],p[0].length);else if(p=b.match(q))"number"===m&&
d.push({type:"operator",value:"*"}),A("identifier",p[0],p[0].length);else if(p=b.match(k))A("number",p[0],p[0].length);else if(p=b.match(g))D=p[0],"#"==D&&(D="!="),A("compOperator",D,p[0].length);else if(p=b.match(n))D=p[0],"||"==D?D="|":"&&"==D?D="&":"~"==D&&(D="!"),A("boolOperator",D,p[0].length);else if((p=b.match(v))&&!b.match(/^==/))A("asign",p[0],p[0].length);else if(p=b.match(y))A("conditional",p[0],p[0].length);else if(p=b.match(f))A("square_bracket",p[0],p[0].length);else if(p=b.match(B))"("==
p&&"number"===m&&d.push({type:"operator",value:"*"}),A("parentheses",p[0],p[0].length);else if(p=b.match(z))A("separator",p[0],p[0].length);else if(178===b.charCodeAt(0))d.push({type:"operator",value:"^"}),A("number",2,1);else if(179===b.charCodeAt(0))d.push({type:"operator",value:"^"}),A("number",3,1);else if(p=b.match(w))A("final_of_expression",p[0],p[0].length);else if(c==u){a.DEBUG.setError(a.DEBUG.EXPRESSION,e);return}return d};D.prototype.flatTokens=function(a,b){a=a||[];b=b||"";E="";for(var c=
0,f=a.length;c<f;c++)E="string"==a[c].type?E+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(K)?E+a[c].value:E+b+a[c].value;return E};a.Tokenizer=D;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 d(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-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-ceil-round-min-max-_Trace_-_Print_-_Num_-_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_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var c=Date.now(),u,p,b,l,m,h,q,k,g,n,v,y,r=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()};r.prototype.setDefinition=function(a,b){this.definitions[a]=b};r.prototype.getDefinition=function(a){return this.definitions[a]};r.prototype.setVariable=function(a,b){this.variables[a]=b};r.prototype.getVariable=function(a,
b){b&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};r.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};r.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};r.prototype.setMatrix=function(a,b,c,g){this.matrices[a][b][c]=g};r.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};r.prototype.setFunction=
function(a,b){this.functions[a]=b};r.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};r.prototype.parse=function(c,d){(b=this.tokenizer.tokenize(c))||(b=[]);l=null;d=!d||!1;u=k=q=h=0;for(p=b.length;u<p;u++){g=b[u];n=g.value;v=g.type;if("identifier"===v)if(u+1<p&&"parentheses"===b[u+1].type&&"("===b[u+1].value)this.getFunction(n);else if(u+1<p&&"square_bracket"===b[u+1].type&&"["===b[u+1].value)b[u+3]&&"square_bracket"===
b[u+3].type&&"]"===b[u+3].value?this.getVector(n):this.getMatrix(n);else{var f=n.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);f&&(this.variables[(f[1]||f[2]||f[3]||f[4]||f[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(n,!0)}"asign"===v&&d&&":="!=n&&(v="compOperator",n="==");if("asign"===v)if(m=new a.Node(v,n),null!=l)if("identifier"===l.type)l.parent&&l.parent.replaceLastChild(m),m.addChild(l),l=m,d=!0;else if("square_bracket"===l.type)m.addChild(l.parent),
l=m,d=!0;else{m.type="compOperator";m.value="==";for(d=!0;l.parent&&e(l.parent.value)>=e(m.value);)l=l.parent;l.parent&&l.parent.replaceLastChild(m);m.addChild(l);l=m}else{console.info("Error1: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}else if("parentheses"===v&&"("===n||"square_bracket"===v&&"["===n)if(m=new a.Node(v,n),"("===n&&h++,"["===n&&q++,null===l)"("===n&&(new a.Node("(expr)","(expr)")).addChild(m),"["===n&&(new a.Node("[expr]","[expr]")).addChild(m),
l=m;else if("operator"===l.type||"boolOperator"===l.type||"compOperator"===l.type||"conditional"===l.type||"asign"===l.type)l.addChild(m),l=m;else if("sign"===l.type)l.addChild(m),l=m;else if("parentheses"===l.type&&"("===l.value)l.addChild(m),l=m;else if("square_bracket"===l.type&&"["===l.value)l.addChild(m),l=m;else if("parentheses"===l.type&&"()"===l.value)l.parent.addChild(m),l=m;else if("square_bracket"===l.type&&"[]"===l.value)l.parent.addChild(m),l=m;else if("identifier"===l.type)l.addChild(m),
l=m;else{console.info("Error2: en la expresi\u00f3n \u300a "+c+" \u300b, en el token ["+u+"] {valor: "+n+", tipo: "+v+"}");break}else if("parentheses"===v&&")"===n)if(h--,null===l)console.info("Error3: en la expresi\u00f3n \u300a "+c+" \u300b, en el token (valor:"+n+", tipo:"+v);else{for(;l&&l.parent&&("("!=l.value||"("==l.value&&"parentheses"!=l.type);)l=l.parent;if(l&&"("===l.value)l.value="()";else break}else if("square_bracket"===v&&"]"===n)if(q--,null===l)console.info("Error5: en la expresi\u00f3n \u300a "+
c+" \u300b, en el token (valor:"+n+", tipo:"+v);else{for(;l&&l.parent&&("["!=l.value||"["==l.value&&"square_bracket"!=l.type);)l=l.parent;if(l&&"["===l.value)l.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}}else if("number"===v||"string"===v||"identifier"===v)if(m=new a.Node(v,n),null===l)l=m;else if("operator"===l.type||"compOperator"===l.type||"boolOperator"===l.type||"parentheses"===l.type&&"("===l.value||"square_bracket"===
l.type&&"["===l.value||"sign"===l.type||"conditional"===l.type||"asign"===l.type)l.addChild(m),l=m;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,c);break}else if("operator"===v||"compOperator"===v||"boolOperator"===v)if(m=new a.Node(v,n),null===l)if("-"===n||"+"===n)m.type="sign",m.value="sign"+n,l=m;else if("!"===n)l=m;else{console.info("Error8: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}else if("operator"===l.type||"compOperator"===l.type||"boolOperator"===
l.type||"asign"===l.type||"conditional"===l.type||"square_bracket"===l.type&&"["===l.value&&("-"===n||"+"===n||"!"===n)||"parentheses"===l.type&&"("===l.value&&("-"===n||"+"===n||"!"===n)){if("-"===n||"+"===n)m.type="sign",m.value="sign"+n;l.addChild(m);l=m}else if("number"===l.type||"parentheses"===l.type&&"()"===l.value||"square_bracket"===l.type&&"[]"===l.value||"string"===l.type||"identifier"===l.type||"conditional"===l.type||"asign"===l.type){for(;l.parent&&e(l.parent.value)>=e(m.value);)l=l.parent;
l.parent&&l.parent.replaceLastChild(m);m.addChild(l);l=m}else{console.info("Error9: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}else if("conditional"===v)if(m=new a.Node(v,n),null!=l)if("?"===m.value){for(k++;l.parent&&e(l.parent.value)>e(m.value);)l=l.parent;l.parent&&l.parent.replaceLastChild(m);m.addChild(l);l=m}else{for(k--;l&&l.parent&&("?"!=l.value||"?"==l.value&&"conditional"!=l.type);)l=l.parent;if(l&&"?"===l.value)l.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+
c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}else if("separator"===v)if(null!=l)for(;l.parent&&"("!=l.value&&"["!=l.value;)l=l.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+c+" \u300b, en el token {valor: "+n+", tipo: "+v+"}");break}}0<
h&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,c);0>h&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,c);0<q&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,c);0>q&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,c);0!=k&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,c);(y=l?l.getRoot():null)&&y.setAllEvalFun();return y};r.prototype.registerDefaultValues=function(){var b=this;b.variables.rnd=Math.random;b.variables.pi=b.variables["\u03c0"]=a.returnValue(Math.PI);b.variables.e=a.returnValue(Math.E);b.variables.Infinity=
Infinity;b.variables["-Infinity"]=-Infinity;b.variables.isTouch=b.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;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.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=function(a){return Math.log(a)/Math.log(10)};b.functions.abs=Math.abs;b.functions.ent=Math.floor;b.functions.sgn=function(a){return 0<a?1:0>a?-1:0};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=
function(a){return(Math.exp(a)-Math.exp(-a))/2};b.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};b.functions.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=Math.floor;b.functions.ceil=Math.ceil;b.functions.round=Math.round;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._Stop_Audios_=function(){b.evaluator.parent.stopAudios()};b.functions.esCorrecto=function(c,g,d){return a.esCorrecto(c,g,b.evaluator,
d)};b.functions.escorrecto=function(c,g,d){return a.escorrecto(c,g,b.evaluator,d)};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,
b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0))};b.functions.charAt=b.functions._charAt_=b.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};b.functions.substring=b.functions._substring_=b.functions._subcadena_=function(a,b,c){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);c=isNaN(parseInt(c))?0:parseInt(c);return 0<=b&&0<=c?a.substring(b,c):0>b&&0<=c?a.substring(c):0>c&&0<=b?a.substring(b):""};b.functions.strLength=
b.functions._length_=b.functions._longitud_=function(a){return(a||"").toString().length};b.functions.indexOf=b.functions._indexOf_=b.functions["_\u00edndiceDe_"]=function(a,b){return(a||"").toString().indexOf((b||"").toString())};b.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};b.functions.replace=b.functions._replace_=b.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var g=a.indexOf(b);0<=g;)a=
a.substring(0,g)+c+a.substring(g+b.length),g=a.indexOf(b);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};b.functions.trim=function(a){return(a||"").toString().trim()};b.functions._Load_=function(b){var c="";b&&(c=(c=document.getElementById(b))&&"descartes/archivo"==c.type?c.text:a.openExternalFile(b));return c||""};b.functions._GetValues_=function(a,c){return b.functions._ExecBlock_(b.functions._Load_(a).replace(/&brvbar;/g,
String.fromCharCode("166")),c)};b.functions._GetMatrix_=function(a,c){return b.functions._StrToMatrix_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._MatrixToStr_=function(c){var g=b.matrices[c];if(g){for(var d="<"+c+">\\n",f=b.getVariable(c+".columnas_usadas")||g.cols||0,e=b.getVariable(c+".filas_usadas")||g.rows||0,n,h=0;h<f;h++){for(var k=0;k<e;k++)n=g[h][k],void 0!==n&&("string"==typeof n?n="'"+n+"'":"number"==typeof n&&(n=a.removeNeedlessDecimals(n.toFixed(6))),
d+=n+(k<e-1?" \u00a6 ":""));d=d.replace(/(\u00A6 )$/g,"")+"\\n"}return d+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var g=[],f=!1,e=!1;g.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var n=0,h=a.length;n<h;n++)a[n].match("<"+c+">")?(e=!0,f=a[n].trim().split("<"+c+">"),2==f.length&&""!=f[1]&&g.push(f[1].split(String.fromCharCode("166")).map(d)),f=!0):(a[n].match("</"+c+">")&&(f=a[n].trim().split("</"+c+">"),2==f.length&&""!=f[0]&&g.push(f[0].split(String.fromCharCode("166")).map(d)),
f=!1,n=a.length),f&&g.push(a[n].split(String.fromCharCode("166")).map(d)));b.matrices[c]=g;b.matrices[c].rows=g&&g[0]&&g[0].length?g[0].length:0;b.matrices[c].cols=g&&g.length?g.length:0;b.setVariable(c+".filas",b.matrices[c].rows);b.setVariable(c+".columnas",b.matrices[c].cols)}return e?"OK":"ERROR"};b.functions._GetVector_=function(a,c){return b.functions._StrToVector_(b.functions._Load_(a),c)};b.functions._VectorToStr_=function(a){var c=b.vectors[a];if(c){for(var g="<"+a+">\\n",d=b.getVariable(a+
".long_usada")||c._size_||0,f,e=0;e<d;e++)f=c[e],void 0!==f?("number"==typeof f&&(f=parseFloat(f)),g+=f+"\\n"):g+="0\\n";return g+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var g=[],f=!1,e=!1;g.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var n=0,h=a.length;n<h;n++)a[n].match("<"+c+">")?f=e=!0:(a[n].match("</"+c+">")&&(f=!1,n=a.length),f&&g.push(d(a[n])));g._size_=g.length;b.vectors[c]=g;b.setVariable(c+".long",g.length);b.setVariable(c+".long_usada",g.length)}return e?
"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var g=[],f=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var d=0,e=a.length;d<e;d++)a[d].match("<"+c+">")?(f=a[d].trim().split("<"+c+">"),2==f.length&&""!=f[1]&&(g=g.concat(f[1].split(String.fromCharCode("166")))),f=!0):a[d].match("</"+c+">")?(f=a[d].trim().split("</"+c+">"),2==f.length&&""!=f[0]&&(g=g.concat(f[0].split(String.fromCharCode("166")))),f=!1):f&&(g=g.concat(a[d].split(String.fromCharCode("166"))));
d=0;for(e=g.length;d<e;d++)f=g[d].split("="),f[0]=f[0].trim(),2==f.length&&""!=f[0]&&(isNaN(parseFloat(f[1]))?b.setVariable(f[0],f[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(f[0],parseFloat(f[1])))}return 0};var g=a.newHTML("a",{target:"_blank"}),e,n=null;a.newBlobContent=null;b.functions._Save_=function(f,d){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(c=Date.now(),document.body.appendChild(g),n=d.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,
"\\"),e=new Blob(["\ufeff",n],{type:"text/plain;charset=utf-8"}),g.setAttribute("href",window.URL.createObjectURL(e)),g.setAttribute("download",f),n!=a.newBlobContent&&(g.click(),a.newBlobContent=n),document.body.removeChild(g));return 0};var h,k,m=a.newHTML("input",{type:"file"});m.addEventListener("change",function(c){h=c.target.files;k=new FileReader;k.onload=function(c){a.addExternalFileContent(h[0].name,c.target.result);b.setVariable("DJS.fileName",h[0].name);b.setVariable("DJS.fileContent",
c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());m.value=""};0<h.length&&k.readAsText(h[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-c&&(b._callback=a,m.click(),c=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,g,f){return a.getTextWidth(b,a.convertFont(c+","+g+","+f))};b.functions.R=b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/
255};b.functions.G=b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};b.functions.B=b.functions._Azul_=b.functions._Blue_=function(b){return(new a.Color(b)).b/255};b.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,d=function(c){this.parent=c;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,d){this.definitions[a]=d};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,d){this.variables[a]=d};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(a,d,p){d=0>d?0:e(d);this.vectors[a][d]=p};d.prototype.getVector=function(a,d){d=0>d?0:e(d);return this.vectors[a][d]};d.prototype.setMatrix=function(a,d,p,b){d=0>d?0:e(d);p=0>p?0:e(p);void 0==this.matrices[a][d]&&(this.matrices[a][d]=[]);this.matrices[a][d][p]=b};d.prototype.getMatrix=function(a,d,p){d=0>d?0:e(d);p=0>p?0:e(p);return this.matrices[a][d][p]};d.prototype.setFunction=function(a,d){this.functions[a]=d};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new d;a.Evaluator=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q,k,g,n,v,y,r=function(b,c){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==c;this.textStr=(c||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;c.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=c,this.textNodes=(new a.RTFParser(b.evaluator)).parse(c.substring(10))):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null))};r.prototype.draw=function(a,b,c,g,d){this["rtfNode"===this.type?"drawRTF":"drawText"](a,b,c,g,d)};r.prototype.drawText=function(g,n,h,k,m){e=
this.evaluator.eval(this.decimals);d=this.evaluator.eval(this.parent.width);c=this.evaluator.eval(this.parent.font_size);u=n.getColor?n.getColor():n;p=this.textToString(this.text,e,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=p.indexOf("[")&&(p=this.textToString(this.parseSimpleText(p),e,this.fixed));if(this.oldTextStr!==p||this.oldWidth!==d||this.oldSize!==c||this.oldColor!==
u||this.oldPosX!==h||this.oldPoxY!==k)b=new a.TextStyle({size:c,family:this.parent.font_family||"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:u,align:this.align,border:this.parent.border}),this.textNodes=this.descarTeXParser.parse(p,this.evaluator,b),this.textNodes.update(h,k,e,this.fixed,this.align,this.anchor,u,d);m||this.textNodes.draw(g);this.oldTextStr=p;this.oldWidth=d;this.oldSize=c;this.oldColor=u;this.oldPosX=h;this.oldPoxY=k};r.prototype.drawRTF=function(a,b,c,g,
d){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,g,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));d||this.textNodes.draw(a)};r.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");l=[];m="'";q=h=0;k=-1;for(v=a.length;h<v;)g=a.charAt(h),n=a.charAt(h-
1),"["===g&&"\\"===n?(l.push(a.substring(q,h-1)+"["),q=h+1):"]"===g&&"\\"===n?(l.push(a.substring(q,h-1)+"]"),q=h+1):"["===g&&-1===k?(l.push(a.substring(q,h)),q=h,k++):"["===g?k++:"]"===g&&0===k?(l.push(this.evaluator.parser.parse(a.substring(q,h+1))),q=h+1,k--):("]"==a.charAt(h)&&(k=0>k?k:k-1),m+=a.charAt(h)),h++;l.push(a.substring(q,h));return l};r.prototype.textToString=function(b,c,g){m="";if("rtfNode"!==b.type)for(var d=0,f=b.length;d<f;d++)"string"===typeof b[d]?m+=b[d]:(y=this.evaluator.eval(b[d])[0][0],
""!==y&&("string"===typeof y?m+=y:Infinity===y?m+="Infinity":-Infinity===y?m+="-Infinity":isNaN(y)||"NaN"===y?m+="NaN":(y=parseFloat(y),y=g?y.toFixed(c):a.removeNeedlessDecimals(y.toFixed(c)),m+=y.toString().replace(".",this.decimal_symbol))));return m};a.TextObject=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d=function(){};d.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var c=[],d=null,b=0,l=a.length;a.charAt(0);var m=!1,h=!1,q=0;e="";for(var k=0;k<l;k++){var g=a.charAt(k);var n=a.charAt(k+1);"\\"===g&&"$"===n&&(h=!0);"{"===g?q++:"}"===g&&(q--,h&&0===q&&(h=!1));h?"_"===g?"{"===n?e+="\\subindex":(e+="\\subindex{"+n+"}",k++):"^"===g?"{"===n?e+="\\superindex":(e+="\\superindex{"+n+"}",k++):e+=g:e+=g}a=e;n=a.charAt(0);for(l=a.length;b<
l;)g=n,n=a.charAt(b+1),m&&("{"===g||"["===g||"\\"===g||" "===g?(m=!1," "===g&&(d={type:"ignore"},c.push(d))):d.value+=g),m||"\\"!==g?m||"{"!==g&&"["!==g?m||"}"!==g&&"]"!==g?m||(d&&"text"===d.type?d.value+=g:d&&"ignore"===d.type?(c.pop(),d=c[c.length-1]):(d={type:"text",value:g},c.push(d))):(d={type:"close",value:g},c.push(d)):(d={type:"open",value:g},c.push(d)):(m=!0,d={type:"command",value:""},c.push(d)),b++;return c};a.DescarTeXTokenizer=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=function(){this.tokenizer=new a.DescarTeXTokenizer};e.prototype.parse=function(d,c,e){d=this.tokenizer.tokenize(d);var p=new a.TextNode("","textBlock",e,null),b=new a.TextNode("","textLineBlock",e.clone(),null);p.addChild(b);for(var l=[],m=void 0,h=e,q=[e],k,g,n,v,u=!1,r=0,f=d.length;r<f;r++)if("text"===d[r].type)if("color_parameter"===m)g=new a.Color(d[r].value,c);else if("text_size_parameter"===m)n=parseFloat(d[r].value);else if("textLineBlock"===
b.nodeType){k=d[r].value.split(" ");for(var B=0,z=k.length;B<z;B++)""!==k[B]&&b.addChild(new a.TextNode(k[B],"text",h.clone(),null)),B+1<z&&b.addChild(new a.TextNode(" ","space",h.clone(),null))}else b.addChild(new a.TextNode(d[r].value,"text",h.clone(),null));else if("command"===d[r].type&&"curlyBracketOpen"===d[r].value)b.addChild(new a.TextNode("{","text",h.clone(),null));else if("command"===d[r].type&&"curlyBracketClose"===d[r].value)b.addChild(new a.TextNode("}","text",h.clone(),null));else if("command"===
d[r].type&&"squareBracketOpen"===d[r].value)b.addChild(new a.TextNode("[","text",h.clone(),null));else if("command"===d[r].type&&"squareBracketClose"===d[r].value)b.addChild(new a.TextNode("]","text",h.clone(),null));else if("command"===d[r].type&&"newline"===d[r].value)0===b.children.length&&b.addChild(new a.TextNode("","text",h.clone(),null)),b=new a.TextNode("","textLineBlock",e.clone(),null),p.addChild(b);else if("command"===d[r].type&&"b"===d[r].value)m="bold",l.push(m);else if("command"===d[r].type&&
"i"===d[r].value)m="italic",l.push(m);else if("command"===d[r].type&&"o"===d[r].value)m="overline",l.push(m);else if("command"===d[r].type&&"u"===d[r].value)m="underline",l.push(m);else if("command"===d[r].type&&"color"===d[r].value)m="color",l.push(m);else if("command"===d[r].type&&"ts"===d[r].value)m="text_size",l.push(m);else if("command"===d[r].type&&"sansserif"===d[r].value.toLowerCase())m="sansserif",l.push(m);else if("command"===d[r].type&&"serif"===d[r].value.toLowerCase())m="serif",l.push(m);
else if("command"===d[r].type&&"monospace"===d[r].value.toLowerCase())m="monospace",l.push(m);else if("command"===d[r].type&&"c"===d[r].value)m="center",l.push(m);else if("command"===d[r].type&&"l"===d[r].value)m="left",l.push(m);else if("command"===d[r].type&&"r"===d[r].value)m="right",l.push(m);else if("command"===d[r].type&&"j"===d[r].value)m="justify",l.push(m);else if("command"===d[r].type&&"$"===d[r].value)m="formula",l.push(m),u=!0;else if("command"===d[r].type&&"sum"===d[r].value)m="sum",
l.push(m);else if("command"===d[r].type&&"prod"===d[r].value)m="prod",l.push(m);else if("command"===d[r].type&&"int"===d[r].value)m="integral",l.push(m);else if("command"===d[r].type&&"lim"===d[r].value)m="limit",l.push(m);else if("command"===d[r].type&&"sqrt"===d[r].value)m="radical",l.push(m);else if("command"===d[r].type&&"subindex"===d[r].value)m="subIndex",l.push(m);else if("command"===d[r].type&&"superindex"===d[r].value)m="superIndex",l.push(m);else if("command"===d[r].type&&"frac"===d[r].value)m=
"numerator",l.push(m);else if("open"===d[r].type&&"{"===d[r].value&&void 0!==m)"bold"===m||"italic"===m||"overline"===m||"underline"===m?(h=h.clone(),h[m]=!0,q.push(h)):"sansserif"===m?(h=h.clone(),h.family="sansserif",q.push(h)):"serif"===m?(h=h.clone(),h.family="serif",q.push(h)):"monospace"===m?(h=h.clone(),h.family="monospaced",q.push(h)):"text_size"===m?m="text_size_parameter":"text_size_text"===m?(h=h.clone(),h.size=n,q.push(h)):"color"===m?m="color_parameter":"color_text"===m?(h=h.clone(),
h.color=g,q.push(h)):"center"===m||"left"===m||"right"===m||"justify"===m?(h=h.clone(),h.align=m,q.push(h),b=new a.TextNode("","textLineBlock",h.clone(),null),p.addChild(b)):"formula"===m?(h=h.clone(),h.italic=!0,q.push(h),v=new a.TextNode("","formula",h.clone(),null),b.addChild(v),b=v):"subIndex"===m||"superIndex"===m?u?(h=h.clone(),q.push(h),v=new a.TextNode("",m,h.clone(),null),b.addChild(v),b=v):b.addChild(new a.TextNode("subIndex"===m?"_":"^","text",h.clone(),null)):"radical"===m?u&&(v=new a.TextNode("",
"radical",h.clone(),null),b.addChild(v),b=v,h=h.clone(),q.push(h),v=new a.TextNode("","index",h.clone(),null),b.addChild(v),b=v,m="index"):"index"===m?u&&(q.pop(),h=q[q.length-1],v=new a.TextNode("","radicand",h.clone(),null),b.addChild(v),b=v,m="radicand"):"sum"===m||"integral"===m||"limit"===m||"prod"===m?u&&(v=new a.TextNode("",m,h.clone(),null),b.addChild(v),b=v,h=h.clone(),q.push(h),v=new a.TextNode("","from",h.clone(),null),b.addChild(v),b=v,m="from"):"from"===m?u&&(v=new a.TextNode("","to",
h.clone(),null),b.addChild(v),b=v,m="to"):"to"===m?u&&(q.pop(),h=q[q.length-1],v=new a.TextNode("","what",h.clone(),null),b.addChild(v),b=v,m="what"):"numerator"===m?u&&(v=new a.TextNode("","fraction",h.clone(),null),b.addChild(v),b=v,h=h.clone(),q.push(h),v=new a.TextNode("","numerator",h.clone(),null),b.addChild(v),b=v,m="numerator"):"denominator"===m&&(v=new a.TextNode("",m,h.clone(),null),b.addChild(v),b=v);else if("close"===d[r].type&&"}"===d[r].value&&void 0!==m){if("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)q.pop(),h=q[q.length-1],l.pop(),m=l[l.length-1];else if("color_parameter"===m){m="color_text";continue}else if("text_size_parameter"===m){m="text_size_text";continue}else if("center"===m||"left"===m||"right"===m||"justify"===m)q.pop(),h=q[q.length-1],l.pop(),m=l[l.length-1],d[r+1]&&"command"===d[r+1].type&&"newline"===d[r+1].value?b=p:(b=new a.TextNode("",
"textLineBlock",h.clone(),null),p.addChild(b));"formula"===b.nodeType?(u=!1,q.pop(),h=q[q.length-1],l.pop(),m=l[l.length-1],b=b.parent):"subIndex"===b.nodeType||"superIndex"===b.nodeType?u&&(q.pop(),h=q[q.length-1],l.pop(),m=l[l.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(l.pop(),m=l[l.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(l.pop(),m=l[l.length-1],b=b.parent.parent):"numerator"===b.nodeType?(m=
"denominator",b=b.parent):"denominator"===b.nodeType&&(q.pop(),h=q[q.length-1],l.pop(),m=l[l.length-1],b=b.parent.parent)}var w,x,F=null,J=[];p.children.forEach(function(a){for(var b=0,c=a.children.length;b<c-1;b++)w=a.children[b],x=a.children[b+1],"text"===w.nodeType&&"text"===x.nodeType&&w.style.equals(x.style)?(null===F&&(F=w,v=w.clone(),F.changeNodeType("word"),F.value="___"+v.value,F.addChild(v)),v=x.clone(),F.addChild(v),J.push(x),F.value+=v.value):F=null});J.forEach(function(a){a.parent.removeChild(a)});
p.normalize();p.adjustFontSize();return p};a.DescarTeXParser=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d=[a.sansserif_font,a.serif_font,a.monospace_font],c=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};c.prototype.clone=function(){return new c(Object.assign({},this))};c.prototype.set=function(a){Object.assign(this,a)};c.prototype.equals=function(a){var c=!0,b;for(b in this)this.hasOwnProperty(b)&&(c=c&&this[b]===a[b]);return c};
c.prototype.toString=function(){/arial|sansserif/i.test(this.family)?e=d[0]:/times|serif/i.test(this.family)?e=d[1]:/courier|monospaced/i.test(this.family)&&(e=d[2]);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+e).trim()};a.TextStyle=c;return a}(descartesJS||{});
descartesJS=function(a){function e(a,b){for(var c=0,g=0;g<b;g++)c+=a[g];return c}function d(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((k[a].ascent+25)*c/k[a].unitsPerEm);b.descent=Math.ceil(Math.abs((k[a].descent-25)*c/k[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var c="#000000",u=2,p=!1,b=new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z");b.svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";var l=new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z");l.svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";var m=new Path2D("m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z");m.svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
var h=new Path2D("m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z");
h.svgData="m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z";
var q=function(a,b,c,d){this.type="rtfNode";this.evaluator=d;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=a;this.style=c;this.changeNodeType(b);this.drawBorder=function(){}};q.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}};q.prototype.clone=function(){for(var a=new q(this.value,this.nodeType,this.style.clone()),b=0,c=this.children.length;b<c;b++)a.addChild(this.children[b].clone());return a};q.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};q.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+"}"};q.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};q.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};q.prototype.getFirstTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[0];return a};q.prototype.getLastTextNode=
function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};q.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};q.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};q.prototype.queryAll=function(a){var b=
[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,g=this.children.length;c<g;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};q.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};q.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};q.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 q("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(c=a.length;b<c;b++){var d=a[b];(null===d.prevSibling()||null!==d.prevSibling()&&"text"!==d.prevSibling().nodeType)&&d.parent.insertBefore(d,new q("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&
d.parent.insertAfter(d,new q("","text",d.parent.style))}return this};q.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])};q.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType&&a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===
this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=
Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};
q.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};q.prototype.update=function(a,b,d,e,h,f,k,m){u=d;p=e;c=k;this.metrics.w=this.metrics.h=0;k=b;if(20<=m)for(d=0;d<this.children.length;d++)this.children[d].breakLines(m);d=0;for(e=this.children.length;d<e;d++){var g=this.children[d];g.updateLine();g.metrics.offsetX=a;g.metrics.y=b;b+=parseInt(g.metrics.ascent+.5);g.metrics.offsetY=
b;h=parseInt(g.metrics.descent+.5)+parseInt(1.5+.05*g.style.size);b+=h;this.metrics.h+=g.metrics.h;this.metrics.w=Math.max(this.metrics.w,g.metrics.w)}b=k;f=f||"";f.match("right")?a-=this.metrics.w:f.match("_center")&&(a-=this.metrics.w/2);f.match("bottom")?b-=this.metrics.h:f.match("center_")&&(b-=this.metrics.h/2);f=this.children;d=0;for(e=f.length;d<e;d++)"left"===f[d].style.align?f[d].metrics.offsetX=a:"right"===f[d].style.align?f[d].metrics.offsetX=a+this.metrics.w-f[d].metrics.w:"center"===
f[d].style.align?f[d].metrics.offsetX=a+(this.metrics.w-f[d].metrics.w)/2:"justify"===f[d].style.align&&20<=m&&(h=d<e-1?f[d+1].value:null,f[d].metrics.offsetX=a,"wrap"===h&&f[d].justifyAux(m)),f[d].metrics.y=b,b+=parseInt(f[d].metrics.ascent+.5),f[d].metrics.offsetY=b,h=parseInt(f[d].metrics.descent+.5)+parseInt(1.5+.05*f[d].style.size),b+=h};q.prototype.breakLines=function(b){for(var c,d=0,g=!1,e=[],f=0,h=this.children.length;f<h;f++)c=this.children[f],g?e.push(c):("text"===c.nodeType||"space"===
c.nodeType?(a.ctx.font=c.style.toString(),c.metrics.w=a.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),d+=c.metrics.w,d>b&&"space"!==c.nodeType&&0<f&&(g=!0,e.push(c)));if(0<e.length)for(b=new q("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),f=0,h=e.length;f<h;f++)e[f].parent&&e[f].parent.removeChild(e[f]),b.addChild(e[f])};q.prototype.updateLine=function(b){var c=this;if("textLineBlock"===this.nodeType||
"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var g=this.metrics.descent=0,e=this.children,h,f=0,k=e.length;f<k;f++){h=e[f];if("text"===h.nodeType){a.ctx.font=h.style.toString();var m=""!==h.value?h.value:"\u200a";h.metrics=d(a.ctx.font);h.metrics.w=a.ctx.measureText(m).width;h.metrics.offsetX=g;Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===h.nodeType?(a.ctx.font=
h.style.toString(),h.metrics=d(a.ctx.font),h.metrics.w=f===k-1?0:b?b:a.ctx.measureText(" ").width,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===h.nodeType&&(h.updateLine(),h.metrics.offsetX_aux=g,Object.defineProperties(h.metrics,{offsetX:{get:function(){return c.metrics.offsetX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===
h.nodeType&&(a.ctx.font=h.styleString,m=""!==h.value?h.value:"\u200a",h.metrics=d(a.ctx.font),h.metrics.w=a.ctx.measureText(m).width,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),h.clickCatcher||(h.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+h.metrics.w+"px;height:"+h.metrics.h+"px;cursor:pointer;"}),h.clickCatcher.rtfNode=h,h.clickCatcher.action=new a.OpenURL(this.evaluator.parent,
h.URL),h.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===h.nodeType&&(h.componentNumCtrl=this.evaluator.parent.getControlByCId(h.value),a.ctx.font=h.styleString,h.metrics=d(a.ctx.font),h.metrics.w=h.componentNumCtrl.w,h.metrics.h=h.componentNumCtrl.h,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));
"componentSpace"===h.nodeType?(h.componentSpace=this.evaluator.parent.getSpaceByCId(h.value),a.ctx.font=h.styleString,h.metrics=d(a.ctx.font),h.metrics.w=h.componentSpace.w,h.metrics.h=h.componentSpace.h,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===h.nodeType&&(h.updateFormula(),h.metrics.offsetX_aux=g,Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),h.metrics.w+=2*h.metrics.paddingX,h.metrics.ascent+=h.metrics.paddingY,h.metrics.descent+=h.metrics.paddingY,h.metrics.h+=2*h.metrics.paddingY,g+=2*h.metrics.marginX);this.metrics.w+=h.metrics.w+2*h.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,h.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,
h.metrics.descent);g+=h.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};q.prototype.updateFormula=function(){var b=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,h,k=0,m={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}},f=0,l=c.length;f<l;f++){h=c[f];if("text"===h.nodeType){a.ctx.font=h.style.toString();var q=""!==h.value?h.value:
"\u200a";h.metrics=d(a.ctx.font);h.metrics.w=a.ctx.measureText(q).width;h.metrics.offsetX=k;Object.defineProperties(h.metrics,{x:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}});k+=b.metrics.marginX}else if("dynamicText"===h.nodeType){q=void 0===h.decimals?u:h.evaluator.eval(h.decimals);var w=void 0===h.fixed?p:h.fixed,x=h.evaluator.eval(h.value);parseFloat(x).toString()===x.toString()&&(x=w?parseFloat(x).toFixed(q):a.removeNeedlessDecimals(parseFloat(x).toFixed(q)),
x=(""+x).replace(".",h.decimal_symbol));h.evalValue=x;a.ctx.font=h.style.toString();h.metrics=d(a.ctx.font);h.metrics.marginX=0;h.metrics.paddingX=0;h.metrics.w=a.ctx.measureText(x).width+2*h.metrics.paddingX;h.metrics.offsetX_aux=k;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return b.metrics.offsetY}}});
k+=2*h.metrics.marginX}if("superIndex"===h.nodeType)q=h,q.updateFormula(),q.metrics.marginX=0*parseInt(1.5+.075*this.style.size),q.metrics.paddingX=0*parseInt(1.5+.075*this.style.size),q.metrics.paddingY=parseInt(1.5+.05*this.style.size),q.metrics.offsetX_aux=k,q.metrics.prevChild=m,Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return b.metrics.offsetY-
this.descent+this.prevChild.metrics.descent-parseInt(2*this.prevChild.metrics.h/7)}}}),q.metrics.w+=2*q.metrics.paddingX,q.metrics.ascent+=q.metrics.paddingY,q.metrics.descent+=q.metrics.paddingY,q.metrics.h+=2*q.metrics.paddingY,k+=2*q.metrics.marginX;else if("subIndex"===h.nodeType){var F=h;F.updateFormula();F.metrics.marginX=parseInt(1.5+.09375*this.style.size);F.metrics.paddingX=0*parseInt(1.5+.01875*this.style.size);F.metrics.paddingY=parseInt(1.5+.05*this.style.size);F.metrics.offsetX_aux=k;
F.metrics.prevChild=m;Object.defineProperties(F.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux+0*this.marginX}},offsetY:{get:function(){return b.metrics.offsetY+this.ascent+F.metrics.prevChild.metrics.descent-parseInt(4*F.metrics.prevChild.metrics.h/7)}}});F.metrics.w+=F.metrics.paddingX;F.metrics.ascent+=F.metrics.paddingY;F.metrics.descent+=F.metrics.paddingY;F.metrics.h+=
2*F.metrics.paddingY;this.metrics.descent=F.metrics.ascent+F.metrics.prevChild.metrics.descent-parseInt(4*F.metrics.prevChild.metrics.h/7)+F.metrics.descent;k+=F.metrics.marginX}else if("fraction"===h.nodeType){w=h;w.updateFormula();q=w.children;x=q[0];q=q[1];w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=0*parseInt(1.5+.075*this.style.size);w.metrics.paddingY=0*parseInt(1.5+.05*this.style.size);var J=Math.max(x.metrics.w,q.metrics.w)+2*w.metrics.paddingX;w.metrics.prevChild=
m;w.metrics.offsetX_aux=k;var E=parseInt(-m.metrics.descent+4*m.metrics.h/9);Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+E}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY-E}}});Object.defineProperties(x.metrics,{parent:{value:w},maxWidth:{value:J},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(q.metrics,{parent:{value:w},maxWidth:{value:J},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}}});w.metrics.w=
J;w.metrics.ascent=x.metrics.h+E+2*w.metrics.paddingY;w.metrics.descent=q.metrics.h-E+2*w.metrics.paddingY;w.metrics.h=x.metrics.h+q.metrics.h+4*w.metrics.paddingY;k+=2*w.metrics.marginX}else if("radical"===h.nodeType){m=h;m.updateFormula();q=m.children;w=q[0];var K=q[1];m.metrics.marginX=parseInt(1.5+.075*this.style.size);m.metrics.paddingX=parseInt(1.5+.075*this.style.size);m.metrics.paddingY=parseInt(1.5+.05*this.style.size);m.metrics.offsetX_aux=k;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});q=m.style.size;m.radicalSign={w:q,scaleX:q/722,scaleY:K.metrics.h/1E3};x=parseInt(w.metrics.w-2*m.radicalSign.w/3);Object.defineProperties(m.radicalSign,{parent:{value:m},displaceIndex:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return b.metrics.offsetY-K.metrics.ascent}}});Object.defineProperties(w.metrics,{parent:{value:m},displaceIndex:{value:x},fontSize:{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+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return b.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(K.metrics,{parent:{value:m},
displaceIndex:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return b.metrics.offsetY}}});x=w.metrics.w<2*m.radicalSign.w/3?m.radicalSign.w:parseInt(w.metrics.w+m.radicalSign.w/3);m.metrics.w=x+2*m.metrics.paddingX+K.metrics.w;m.metrics.ascent=Math.max(K.metrics.ascent,w.metrics.h+2*q/5)+
m.metrics.paddingY;m.metrics.descent=K.metrics.descent+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;k+=2*m.metrics.marginX}else if("sum"===h.nodeType){w=h;w.updateFormula();q=w.children;x=q[0];J=q[1];var D=q[2];w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=k;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=h.style.toString();var A=d(a.ctx.font);m=parseInt(1.2*A.h);q=parseInt(.5+780*m/1E3);w.sigmaSign={w:q,h:m,scale:m/1E3};var I=Math.max(J.metrics.w,x.metrics.w,w.sigmaSign.w);w.sigmaSign.parent=w;Object.defineProperties(w.sigmaSign,{sumWidth:{value:I},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return b.metrics.offsetY+A.descent-(this.h+A.h)/2}}});q=A.descent-J.metrics.descent-(m+A.h)/2-w.metrics.paddingY;Object.defineProperties(J.metrics,{parent:{value:w},sumWidth:{value:I},newBaselineTo:{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 b.metrics.offsetY+this.newBaselineTo}}});
m=x.metrics.ascent+A.descent+(m-A.h)/2+w.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:w},sumWidth:{value:I},newBaselineFrom:{value:m},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 b.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(D.metrics,{parent:{value:w},sumWidth:{value:I},
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 b.metrics.offsetY}}});w.metrics.w=I+D.metrics.w+3*w.metrics.paddingX;w.metrics.ascent=Math.max(D.metrics.ascent,-q+J.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(D.metrics.descent,m+x.metrics.descent)+w.metrics.paddingY;w.metrics.h=w.metrics.ascent+w.metrics.descent;
k+=2*w.metrics.marginX}else if("integral"===h.nodeType){w=h;w.updateFormula();q=w.children;x=q[0];J=q[1];D=q[2];w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=k;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=h.style.toString();A=d(a.ctx.font);I=parseInt(1.2*A.h);var H=parseInt(10.5+529*I/1E3);w.sign={w:H,h:I,scale:I/1E3};w.sign.parent=w;Object.defineProperties(w.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return b.metrics.offsetY+A.descent-(this.h+A.h)/2}}});q=A.descent-(I+A.h)/2-J.metrics.descent+I/3;Object.defineProperties(J.metrics,{parent:{value:w},integralWidth:{value:H},
newBaselineTo:{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(4*this.integralWidth/5)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineTo}}});m=A.descent+x.metrics.ascent/2;Object.defineProperties(x.metrics,{parent:{value:w},integralWidth:{value:H},newBaselineFrom:{value:m},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 b.metrics.offsetY+this.newBaselineFrom}}});H=Math.max(parseInt(4*H/5)+J.metrics.w,parseInt(2*H/5+x.metrics.w))+w.metrics.paddingX;Object.defineProperties(D.metrics,{parent:{value:w},whatDisplace:{value:H},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return b.metrics.offsetY}}});w.metrics.w=H+D.metrics.w+2*w.metrics.paddingX;w.metrics.ascent=Math.max(D.metrics.ascent,-q+J.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(D.metrics.descent,m+x.metrics.descent,I-w.metrics.ascent)+w.metrics.paddingY;w.metrics.h=Math.max(w.metrics.ascent+w.metrics.descent,I);k+=2*w.metrics.marginX}else if("prod"===h.nodeType)w=h,w.updateFormula(),q=w.children,x=q[0],J=q[1],D=q[2],w.metrics.marginX=parseInt(1.5+
.075*this.style.size),w.metrics.paddingX=parseInt(1.5+.075*this.style.size),w.metrics.paddingY=parseInt(1.5+.05*this.style.size),w.metrics.offsetX_aux=k,Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),a.ctx.font=h.style.toString(),A=d(a.ctx.font),m=parseInt(1.2*A.h),q=parseInt(.5+
876*m/1E3),w.piSign={w:q,h:m,scale:m/1E3},I=Math.max(J.metrics.w,x.metrics.w,w.piSign.w),w.piSign.parent=w,Object.defineProperties(w.piSign,{prodWidth:{value:I},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return b.metrics.offsetY+A.descent-(this.h+A.h)/2}}}),q=A.descent-J.metrics.descent-(m+A.h)/2-w.metrics.paddingY,Object.defineProperties(J.metrics,{parent:{value:w},prodWidth:{value:I},newBaselineTo:{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 b.metrics.offsetY+this.newBaselineTo}}}),m=x.metrics.ascent+A.descent+(m-A.h)/2+w.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:w},prodWidth:{value:I},newBaselineFrom:{value:m},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 b.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(D.metrics,{parent:{value:w},prodWidth:{value:I},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 b.metrics.offsetY}}}),
w.metrics.w=I+D.metrics.w+3*w.metrics.paddingX,w.metrics.ascent=Math.max(D.metrics.ascent,-q+J.metrics.ascent)+w.metrics.paddingY,w.metrics.descent=Math.max(D.metrics.descent,m+x.metrics.descent)+w.metrics.paddingY,w.metrics.h=w.metrics.ascent+w.metrics.descent,k+=2*w.metrics.marginX;else if("limit"===h.nodeType){m=h;m.updateFormula();q=m.children;var M=q[0];w=q[1];q=q[2];m.metrics.marginX=parseInt(1.5+.075*this.style.size);m.metrics.paddingX=parseInt(1.5+.075*this.style.size);m.metrics.paddingY=
parseInt(1.5+.05*this.style.size);m.metrics.offsetX_aux=k;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=h.style.toString();A=d(a.ctx.font);J=parseInt(.5+a.ctx.measureText("l\u00edm").width);x=parseInt(.5+a.ctx.measureText("\u2192").width);limitWidth=Math.max(J,M.metrics.w+
x+w.metrics.w);m.limitText={parent:m};Object.defineProperties(m.limitText,{limitWidth:{value:limitWidth},limitTextWidth:{value:J},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});J=A.descent+Math.max(M.metrics.ascent,w.metrics.ascent,2*A.ascent/3)+m.metrics.paddingY;m.limitArrow={parent:m};Object.defineProperties(m.limitArrow,{newBaseline:{value:J},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
M.metrics.w}},y:{get:function(){return b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(M.metrics,{parent:{value:m},newBaseline:{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}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(w.metrics,{parent:{value:m},arrowWidth:{value:x},newBaseline:{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+M.metrics.w+this.arrowWidth}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(q.metrics,{parent:{value:m},limitWidth:{value:limitWidth},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 b.metrics.offsetY}}});
m.metrics.w=limitWidth+q.metrics.w+3*m.metrics.paddingX;m.metrics.ascent=Math.max(q.metrics.ascent,A.ascent)+m.metrics.paddingY;m.metrics.descent=J+Math.max(M.metrics.descent,w.metrics.descent)+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;k+=2*m.metrics.marginX}else if("matrix"===h.nodeType){x=h;x.updateFormula();q=x.children;J=x.rows;D=x.columns;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+
.05*this.style.size);x.metrics.offsetX_aux=k;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=h.style.toString();A=d(a.ctx.font);I=[];H=[];m=0;for(var P=J*D;m<P;m++){var G=parseInt(m/D);var O=m%D;I[G]=Math.max(I[G]||0,q[m].metrics.h);H[O]=Math.max(H[O]||0,q[m].metrics.w)}var C=
(1+D)*x.metrics.paddingX;for(m=0;m<D;m++)C+=H[m];var N=(1+J)*x.metrics.paddingY;for(m=0;m<J;m++)N+=I[m];w=A.descent-A.h/2;m=0;for(P=J*D;m<P;m++)G=parseInt(m/D),O=m%D,q[m].metrics.offsetX_aux=e(H,O)+(H[O]-q[m].metrics.w)/2+O*x.metrics.paddingX,q[m].metrics.offsetY_aux=e(I,G)+(I[G]-q[m].metrics.h)/2+(1+G)*x.metrics.paddingY,Object.defineProperties(q[m].metrics,{parent:{value:x},matrixH:{value:N},dispY:{value:w},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 b.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.w=C;x.metrics.ascent=N/2-w;x.metrics.descent=N/2+w;x.metrics.h=x.metrics.ascent+x.metrics.descent;k+=2*x.metrics.marginX}else if("defparts"===h.nodeType){x=h;x.updateFormula();q=h.children;J=h.parts;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+
.05*this.style.size);x.metrics.offsetX_aux=k;Object.defineProperties(x.metrics,{parent:{value:b},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=h.style.toString();A=d(a.ctx.font);D=0;I=x.metrics.paddingY;w=A.descent-A.h/2;for(m=0;m<J;m++)q[m].metrics.offsetY_aux=I,D=Math.max(D,q[m].metrics.w),
I+=q[m].metrics.h+x.metrics.paddingY,Object.defineProperties(q[m].metrics,{parent:{value:x},dispY:{value:w},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 b.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=I;x.metrics.w=D+4*x.metrics.paddingX;x.metrics.ascent=I/2-w;x.metrics.descent=
I/2+w;x.metrics.h=x.metrics.ascent+x.metrics.descent;k+=2*x.metrics.marginX}else if("numerator"===h.nodeType||"denominator"===h.nodeType||"index"===h.nodeType||"radicand"===h.nodeType||"from"===h.nodeType||"to"===h.nodeType||"what"===h.nodeType||"element"===h.nodeType)h.updateFormula(),h.metrics.paddingX=parseInt(1.5+.075*this.style.size),h.metrics.paddingY=parseInt(1.5+.05*this.style.size),h.metrics.w+=2*h.metrics.paddingX,h.metrics.ascent+=h.metrics.paddingY,h.metrics.descent+=h.metrics.paddingY,
h.metrics.h=h.metrics.ascent+h.metrics.descent;m=h;this.metrics.ascent=Math.max(this.metrics.ascent,h.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,h.metrics.descent);this.metrics.w+=h.metrics.w+2*h.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;k+=h.metrics.w}};q.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,g=this.children.length;d<g-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};q.prototype.drawTextBlock=
function(a){a.fillStyle=c;for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(a)};q.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};q.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:c;a.font=this.style.toString();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=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)}};q.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<
c;b++)this.children[b].draw(a)};q.prototype.drawSpace=function(a){};q.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:c;a.font=this.style.toString();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")};q.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=
c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString();a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};q.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};q.prototype.drawFraction=function(a){a.lineWidth=
5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:c;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")};q.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};q.prototype.drawSuperIndex=function(a){for(var b=
0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};q.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};q.prototype.drawRadical=function(d){d.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:c;d.save();d.translate(this.radicalSign.x,this.radicalSign.y);d.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);a.isMsEdge?this.drawRadicalSign(d):
d.fill(b);d.restore();d.beginPath();d.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 e=0,g=this.children.length;e<g;e++)this.children[e].draw(d);this.drawBorder(d,"blue")};q.prototype.drawSum=function(b){b.save();b.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:c;b.translate(this.sigmaSign.x,this.sigmaSign.y);b.scale(this.sigmaSign.scale,this.sigmaSign.scale);
a.isMsEdge?this.drawSigmaSign(b):b.fill(l);b.restore();for(var d=0,e=this.children.length;d<e;d++)this.children[d].draw(b);this.drawBorder(b,"blue")};q.prototype.drawIntegral=function(b){b.save();b.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:c;b.translate(this.sign.x,this.sign.y);b.scale(this.sign.scale,this.sign.scale);a.isMsEdge?this.drawIntegralSign(b):b.fill(m);b.restore();for(var d=0,e=this.children.length;d<e;d++)this.children[d].draw(b);
this.drawBorder(b,"blue")};q.prototype.drawProd=function(b){b.save();b.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:c;b.translate(this.piSign.x,this.piSign.y);b.scale(this.piSign.scale,this.piSign.scale);a.isMsEdge?this.drawProdSign(b):b.fill(h);b.restore();for(var d=0,e=this.children.length;d<e;d++)this.children[d].draw(b);this.drawBorder(b,"blue")};q.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:c;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};q.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:c;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 e=d/2;a.moveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,
this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+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-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-
e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+
b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+
b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-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")};q.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:c;a.beginPath();d=3*this.metrics.marginX;var e=d/2;a.moveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+
this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-
2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};q.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};q.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)};q.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)};q.prototype.drawRadicalSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,
314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.fill();a.stroke()};q.prototype.drawSigmaSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();
a.fill();a.stroke()};q.prototype.drawIntegralSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,
28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.fill();a.stroke()};q.prototype.drawProdSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,
932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.fill();a.stroke()};q.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([])};q.prototype.toRTF=function(){var a=[],b=[],c="";this.mergeTextNodes();for(var d=0,e=this.children.length;d<e;d++){var f=this.children[d];"textLineBlock"===f.nodeType&&(c+=f.toRTFAux(a,b)+(1<e&&d<e-1?"\\par":""))}f="{\\fonttbl";d=0;for(e=a.length;d<e;d++)f+="\\f"+d+"\\fcharset0 "+
a[d]+";";a="";if(0<b.length){a="{\\colortbl";d=0;for(e=b.length;d<e;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(f+"}")+a+c+"}"};q.prototype.toRTFAux=function(a,b){for(var d,e,h,f=null,g="",m,k,n,l,q,p=0,u=this.children.length;p<u;p++)m=k="",d=this.children[p],n=this.addToFontTable(d.style.family,a),l=d.style.size,q=this.addToColorTable(d.style.color,b),null===q&&0<b.length&&(q=this.addToColorTable(c,b)),q!==f&&(m+="\\cf"+q,f=q),n!==e&&(m+="\\f"+n,e=n),l!==h&&(m+="\\fs"+2*l,h=l),d.style.italic&&(m+="\\i",
k="\\i0"+k),d.style.bold&&(m+="\\b",k="\\b0"+k),d.style.underline&&(m+="\\ul",k="\\ulnone"+k),d.style.overline&&(m+="\\ol",k="\\olnone"+k),"text"===d.nodeType?(d.value=d.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),d=""!==m?m+" "+d.value+k:""!==g&&"}"!==g.charAt(g.length-1)?" "+d.value:d.value,g+=d):"formula"===d.nodeType?g+="{\\*\\mjaformula"+d.formulaToRTF(e,h,f,a,b)+"}":"componentSpace"===d.nodeType?g+="{\\*\\component\\Space "+d.value+"}":"componentNumCtrl"===
d.nodeType&&(g+="{\\*\\component\\NumCtrl "+d.value+"}");return g};q.prototype.formulaToRTF=function(a,b,d,e,h){for(var f,g="",m,k,n,l,q=0,p=this.children.length;q<p;q++)m=k="",f=this.children[q],n=this.addToFontTable(f.style.family,e),l=this.addToColorTable(f.style.color,h),null===l&&0<h.length&&(l=this.addToColorTable(c,h)),n!==a&&(m+="\\f"+n,a=n),l!==d&&(m+="\\cf"+l,"text"!==f.nodeType||"text"===f.nodeType&&""!==f.value)&&(d=l),f.style.italic&&(m+="\\i",k="\\i0"+k),f.style.bold&&(m+="\\b",k="\\b0"+
k),f.style.underline&&(m+="\\ul",k="\\ulnone"+k),f.style.overline&&(m+="\\ol",k="\\olnone"+k),"text"===f.nodeType&&""!==f.value?(f.value=f.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==m?m+" "+f.value+k:"}"!==g.charAt(g.length-1)?" "+f.value:f.value,g+=tmpRTF):"dynamicText"===f.nodeType?(f.value=""===f.value?" ":f.value,g+=m+"{\\expr "+f.value+"\\decimals "+(f.decimals||2)+"\\fixed"+(f.fixed?1:0)+"}"+k):"fraction"===f.nodeType||"radical"===f.nodeType||
"index"===f.nodeType||"radicand"===f.nodeType||"sum"===f.nodeType||"integral"===f.nodeType||"prod"===f.nodeType||"limit"===f.nodeType||"from"===f.nodeType||"to"===f.nodeType||"what"===f.nodeType||"element"===f.nodeType?g+="{\\"+f.nodeType+f.formulaToRTF(a,b,d,e,h)+"}":"numerator"===f.nodeType?g+="{\\num"+f.formulaToRTF(a,b,d,e,h)+"}":"denominator"===f.nodeType?g+="{\\den"+f.formulaToRTF(a,b,d,e,h)+"}":"superIndex"===f.nodeType?g+="{\\supix"+f.formulaToRTF(a,b,d,e,h)+"}":"subIndex"===f.nodeType?g+=
"{\\subix"+f.formulaToRTF(a,b,d,e,h)+"}":"matrix"===f.nodeType?g+="{\\matrix\\rows "+(f.rows||2)+"\\columns "+(f.columns||2)+f.formulaToRTF(a,b,d,e,h)+"}":"defparts"===f.nodeType&&(g+="{\\defparts\\parts "+(f.parts||2)+f.formulaToRTF(a,b,d,e,h)+"}");return g};q.prototype.addToFontTable=function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};q.prototype.addToColorTable=function(a,
b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};q.prototype.mergeTextNodes=function(){for(var a=[],b=null,c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[c].style)&&(this.children[c].value=b.value+this.children[c].value,a.push(b)):this.children[c].mergeTextNodes(),
b=this.children[c];c=0;for(d=a.length;c<d;c++)this.removeChild(a[c])};var k={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=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=String.fromCharCode,d,c,u,p,b,l,m,h,q,k,g,n=function(){};n.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];c="";p=u=0;l=a.charAt(0);m=!1;for(h="text";u<a.length;)b=l,l=a.charAt(u+1),m?"\\"===l||"{"===l||"}"===
l||" "===l||";"===l?(m=!1,c+=b," "===l?(u++,l=a.charAt(u+1),g=!0):g=!1,(q=c.match(/^'([0-9a-f]{2})/))?(k="","text"===h&&(k=d.pop().value),c=k+=e(parseInt(q[1],16))+c.substring(3)):(q=c.match(/^u[0-9]+/))?(k="","text"===h&&(k=d.pop().value),c=k+=e(q[0].substring(1))):("{"===c||"}"===c||"\\"==b?(d.push({type:"text",value:c+(g?" ":"")}),h="text"):(d.push({type:"controlWord",value:c}),h="controlWord"),c="")):"{"==b||"}"==b||"\\"==b?(m=!1,d.push({type:"text",value:b}),h="text"):c+=b:"\\"===b?(m=!0,""!==
c&&(d.push({type:"text",value:c}),h="text",c="")):"{"===b?(p++,""!==c&&(d.push({type:"text",value:c}),c=""),d.push({type:"openBlock",value:p}),h="openBlock"):"}"===b?(""!==c&&(d.push({type:"text",value:c}),c=""),d.push({type:"closeBlock",value:p}),h="closeBlock",p--):c+=b,u++;""!==c&&d.push({type:"text",value:c});return d};a.RTFTokenizer=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.max,d,c,u,p,b,l,m,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K,D,A,I,H,M,P,G,O=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};O.prototype.parse=function(C){d=this.tokenizer.tokenize(C);c={};p=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(u=d[0].value;"closeBlock"!==d[p].type&&d[p].value!==u;)c[d[p].value]=d[p+2].value.substring(0,d[p+2].value.length-1),p+=3;p++}b={};l=0;if("openBlock"===d[p].type&&"colortbl"===d[p+1].value){u=
d[p++].value;for(p++;"closeBlock"!==d[p].type&&d[p].value!==u;)m=parseInt(d[p++].value.substring(3)).toString(16),h=parseInt(d[p++].value.substring(5)).toString(16),q=parseInt(d[p++].value.substring(4)).toString(16),";"===d[p].value&&p++,b[l++]="#"+(2>m.length?"0"+m:m)+(2>h.length?"0"+h:h)+(2>q.length?"0"+q:q);p++}y=v=n=null;M=H=I=F=x=w=z=B=f=r=!1;J=[new a.TextStyle];E=J[0];D=K=-1;A=[];k=P=new a.TextNode("","textBlock",E,this.evaluator);g=new a.TextNode("","textLineBlock",E,this.evaluator);k.addChild(g);
P.stableWidth=!0;P.hasFormula=!1;C=p;for(var N=d.length;C<N;C++){if("controlWord"==d[C].type)if(c[d[C].value])E.set({family:c[d[C].value]});else if(d[C].value.match(/^fs(\d+)/))E.set({size:parseInt(d[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==d[C].value)E.set({bold:!0}),0<A.length&&A[A.length-1].style.set({bold:!0});else if("b0"==d[C].value)E.set({bold:!1}),0<A.length&&A[A.length-1].style.set({bold:!1});else if("i"==d[C].value)E.set({italic:!0}),0<A.length&&A[A.length-1].style.set({italic:!0});
else if("i0"==d[C].value)E.set({italic:!1}),0<A.length&&A[A.length-1].style.set({italic:!1});else if("ul"==d[C].value)E.set({underline:!0}),0<A.length&&A[A.length-1].style.set({underline:!0});else if("ulnone"==d[C].value)E.set({underline:!1}),0<A.length&&A[A.length-1].style.set({underline:!1});else if("ol"==d[C].value)E.set({overline:!0}),0<A.length&&A[A.length-1].style.set({overline:!0});else if("olnone"==d[C].value)E.set({overline:!1}),0<A.length&&A[A.length-1].style.set({overline:!1});else if(d[C].value.match(/^cf(\d+)/))E.set({color:b[parseInt(d[C].value.substring(2))]}),
0<A.length&&(A[A.length-1].style.color=E.color);else if("par"==d[C].value){k=new a.TextNode("","textLineBlock",E.clone(),this.evaluator);if("textBlock"!=g.nodeType)for(g=g.parent;"textBlock"!=g.nodeType;)g=g.parent;g.addChild(k);g=k}else if("mjaformula"==d[C].value)P.hasFormula=!0,D=K,r=!0,k=new a.TextNode("","formula",E.clone(),this.evaluator),g.addChild(k),g=k,A[A.length-1]=k;else if("fraction"==d[C].value||"radicand"==d[C].value||"radical"==d[C].value||"what"==d[C].value||"sum"==d[C].value||"integral"==
d[C].value||"limit"==d[C].value){var L=A[A.length-2].style.clone();k=new a.TextNode("",d[C].value,L,this.evaluator);A[A.length-2].addChild(k);A[A.length-1]=k}else"index"==d[C].value?(L=A[A.length-2].style.clone(),L.size=e(parseInt(L.size-.5*L.size),8),k=new a.TextNode("",d[C].value,L,this.evaluator),A[A.length-2].addChild(k),A[A.length-1]=k):"to"==d[C].value||"from"==d[C].value?(L=A[A.length-2].style.clone(),L.size=e(parseInt(L.size-.2*L.size),8),k=new a.TextNode("",d[C].value,L,this.evaluator),A[A.length-
2].addChild(k),A[A.length-1]=k):"num"==d[C].value||"den"==d[C].value?(L=A[A.length-2].style.clone(),L.size=e(Math.round(L.size-.1*L.size),8),"num"==d[C].value?k=new a.TextNode("","numerator",L,this.evaluator):"den"==d[C].value&&(k=new a.TextNode("","denominator",L,this.evaluator)),A[A.length-2].addChild(k),A[A.length-1]=k):"subix"==d[C].value||"supix"==d[C].value?(L=A[A.length-2].style.clone(),L.size=e(Math.floor(L.size-.33*L.size),8),"subix"==d[C].value?k=new a.TextNode("","subIndex",L,this.evaluator):
"supix"==d[C].value&&(k=new a.TextNode("","superIndex",L,this.evaluator)),k.originalStyle=A[A.length-2].style.clone(),A[A.length-2].addChild(k),A[A.length-1]=k):"defparts"==d[C].value||"matrix"==d[C].value||"element"==d[C].value?(L=A[A.length-2].style.clone(),k=new a.TextNode("",d[C].value,L,this.evaluator),A[A.length-2].addChild(k),A[A.length-1]=k,"defparts"==d[C].value?y=k:"matrix"==d[C].value&&(v=k,v.matrix_type=0)):"parts"==d[C].value?F=!0:"type"==d[C].value?z=!0:"rows"==d[C].value?w=!0:"columns"==
d[C].value?x=!0:"expr"==d[C].value?(P.stableWidth=!1,f=!0):"decimals"==d[C].value?B=!0:"fixed1"==d[C].value?n.fixed=!0:"fixed0"==d[C].value?n.fixed=!1:"component"!=d[C].value&&("NumCtrl"==d[C].value?I=!0:"Space"==d[C].value?H=!0:"hyperlink"==d[C].value&&(M=!0));if("text"==d[C].type)if(F)y.parts=parseInt(d[C].value),F=!1;else if(z)v.matrix_type=parseInt(d[C].value),z=!1;else if(w)v.rows=parseInt(d[C].value),w=!1;else if(x)v.columns=parseInt(d[C].value),x=!1;else if(B)n.decimals=this.evaluator.parser.parse(d[C].value+
""),B=!1;else if(M){G=d[C].value.split("|")[0];L=E.clone();k=new a.TextNode(G,"hyperlink",L,this.evaluator);k.URL=d[C].value.split("|")[1];if("textLineBlock"!=g.nodeType)for(g=g.parent;"textLineBlock"!=g.nodeType;)g=g.parent;g.addChild(k);M=!1}else if(I)k=new a.TextNode(d[C].value,"componentNumCtrl",E.clone(),this.evaluator),g.addChild(k),I=!1;else if(H)k=new a.TextNode(d[C].value,"componentSpace",E.clone(),this.evaluator),g.addChild(k),H=!1;else if(f)L=A[A.length-2].style.clone(),G=this.evaluator.parser.parse(d[C].value),
k=new a.TextNode(G,"dynamicText",L,this.evaluator),A[A.length-2].addChild(k),n=A[A.length-1]=k,f=!1;else if(f||r)!f&&r&&(G=d[C].value,k=new a.TextNode(G,"text",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(k));else{G=d[C].value;k=new a.TextNode(G,"text",E.clone(),this.evaluator);if("textLineBlock"!=g.nodeType)for(g=g.parent;"textLineBlock"!=g.nodeType;)g=g.parent;g.addChild(k)}else if("openBlock"==d[C].type)K=d[C].value,E=E.clone(),J.push(E),A.push(null);else if("closeBlock"==
d[C].type)d[C].value==D&&(D=-1,r=!1,g=g.parent),J.pop(),E=J[J.length-1],A.pop();else if("("==d[C].type||")"==d[C].type)L=A[A.length-1].style.clone(),L.italic="",k=new a.TextNode(d[C].type,"mathSymbol",L,this.evaluator),A[A.length-1].addChild(k);else if("+"==d[C].type||"-"==d[C].type||"*"==d[C].type||"="==d[C].type)k=new a.TextNode(d[C].type,"mathSymbol",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(k)}return P.normalize()};a.RTFParser=O;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l,m,h,q,k,g=function(b,e){this.parent=b;d=this.evaluator=this.parent.evaluator;c=d.parser;this.id="";this.type="2D";this.xExpr=c.parse("0");this.yExpr=c.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=c.parse("1");this.fixed=2===b.version;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=2!=b.version?new a.Color("c0c0c0"):"";this.net10=2!=b.version?new a.Color("808080"):"";this.axes=2!=b.version?new a.Color("808080"):"";this.text=new a.Color("ffafaf");this.numbers=!1;this.y_axis=this.x_axis=2!=b.version?"":" ";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.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||
0;this.displaceRegionWest=b.displaceRegionWest||0;Object.assign(this,e);this.initSpace()};g.prototype.initSpace=function(){e=this.parent;d=this.evaluator;u=this.id;this.resizable||(this.displaceRegionNorth=e.displaceRegionNorth||0,this.displaceRegionSouth=e.displaceRegionSouth||0,this.displaceRegionEast=e.displaceRegionEast||0,this.displaceRegionWest=e.displaceRegionWest||0,m=parseInt(e.container.width),l=parseInt(e.container.height),void 0!=this.wExpr&&(this.w=parseInt(m-this.displaceRegionWest-
this.displaceRegionEast)*parseFloat(this.wExpr)/100),void 0!=this.hExpr&&(this.h=parseInt(l-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.hExpr)/100),void 0!=this.xPercentExpr&&(this.xExpr=d.parser.parse((parseInt(m-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.xPercentExpr)/100).toString())),void 0!=this.yPercentExpr&&(this.yExpr=d.parser.parse((parseInt(l-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.yPercentExpr)/100).toString())),this.x=
d.eval(this.xExpr)+this.displaceRegionWest,this.y=d.eval(this.yExpr)+this.plecaHeight+this.displaceRegionNorth,this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px"),0<=this.y?(p=l-this.y,this.h>p&&(this.h=p)):(p=this.h+this.y,this.h=p>=l?l:p),0<=this.x?(b=m-this.x,this.w>b&&(this.w=b)):(b=this.w+this.x,this.w=b>=m?m:b));""==this.imageSrc&&/vacio.gif$/i.test(this.imageSrc.trim())||(this.image=e.getImage(this.imageSrc));this.OxExpr&&(q=this.OxExpr,"%"===q[q.length-
1]?this.Ox=this.w*parseFloat(q)/100:(h=parseFloat(q),h!=q&&(h=0),this.Ox=h));this.OyExpr&&(k=this.OyExpr,"%"===k[k.length-1]?this.Oy=this.h*parseFloat(k)/100:(h=parseFloat(k),h!=k&&(h=0),this.Oy=h));""!==this.id&&2!==e.version?(d.setVariable(u+"._w",this.w),d.setVariable(u+"._h",this.h),d.setVariable(u+".escala",this.scale),d.setVariable(u+".Ox",this.Ox),d.setVariable(u+".Oy",this.Oy),d.setVariable(u+".mouse_x",0),d.setVariable(u+".mouse_y",0),d.setVariable(u+".mouse_pressed",0),d.setVariable(u+".mouse_clicked",
0),d.setVariable(u+".clic_izquierdo",0)):(h=d.getVariable("_w"),void 0===h&&(h=this.w),d.setVariable("_w",h),h=d.getVariable("_h"),void 0===h&&(h=this.h),d.setVariable("_h",h),h=d.getVariable("escala"),void 0===h&&(h=this.scale),d.setVariable("escala",h),h=d.getVariable("Ox"),void 0===h&&(h=this.Ox),d.setVariable("Ox",h),h=d.getVariable("Oy"),void 0===h&&(h=this.Oy),d.setVariable("Oy",h),d.setVariable("mouse_x",0),d.setVariable("mouse_y",0),d.setVariable("mouse_pressed",0),d.setVariable("mouse_clicked",
0),d.setVariable("clic_izquierdo",0),2==e.version&&""===this.x_axis&&""===this.y_axis&&(this.axes=""));this.w_2=this.w/2;this.h_2=this.h/2};g.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};g.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))};g.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,
0)};g.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};g.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};g.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};g.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d=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=[]};d.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 d(a){a.preventDefault();document.body.removeEventListener("mousemove",
c);document.body.removeEventListener("mouseup",d)}e=this;document.body.appendChild(this.container);for(var p=e.parent.evaluator.parser,b=0,l=e.ctrs.length;b<l;b++)e.ctrs[b].expresion=p.parse("(0,"+(e.vSpace+23+35*b)+","+e.width+",35)"),e.ctrs[b].update();e.numCtr=l;b=new a.Button(e.parent,{region:"external",name:"english"==e.language?"about":"cr\u00e9ditos",font_size:p.parse("15"),expresion:p.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:p.parse("15"),action:"config",expresion:p.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:p.parse("15"),action:"init",expresion:p.parse("(0,"+(e.vSpace+23+35*l)+","+e.width/2+",25)")})).update();(new a.Button(e.parent,{region:"external",name:"english"==e.language?"clear":"limpiar",font_size:p.parse("15"),action:"clear",expresion:p.parse("("+e.width/
2+","+(e.vSpace+23+35*l)+","+e.width/2+",25)")})).update();p=new a.Button(e.parent,{region:"external",name:"english"==e.language?"close":"cerrar",font_size:p.parse("15"),expresion:p.parse("("+e.width/4+","+(e.vSpace+46+35*l)+","+e.width/2+",25)")});p.update();p.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",d)});e.hide()};d.prototype.addCtr=function(a){this.ctrs.push(a)};d.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};d.prototype.hide=function(){this.container.style.display="none"};d.prototype.setPositionAndSize=function(){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=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,d=Math.round,c=2*Math.PI,u=a.convertFont("SansSerif,PLAIN,12"),p=a.convertFont("Monospaced,PLAIN,12"),b,l,m,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K,D,A,I,H,M,P,G,O,C,N,L,R,Q=function(c,d){b=d=a.Space.call(this,c,d)||this;b.ratio=c.ratio;b.border_width=b.border_width||0;b.border_color=b.border_color||new a.Color("000000",c.evaluator);b.border_radius=b.border_radius||0;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",
width:b.w*b.ratio});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio});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.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});
b.numericalControlContainer=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:"left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";"+(0<b.border_width?"border:"+b.border_width+"px solid "+b.border_color.getColor()+";":"")+(b.border_radius?"border-radius:"+b.border_radius+"px;":"")});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.numericalControlContainer);c.container.insertBefore(b.container,c.loader);var e=b.id+".image";b.parent.images[e]=b.canvas;b.parent.images[e].ready=1;b.parent.images[e].complete=b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=b.id+".back";b.parent.images[e]=b.backCanvas;b.parent.images[e].ready=1;b.parent.images[e].complete=
b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=""!==b.id&&2!==c.version?b.id+".":"";b.OxStr=e+"Ox";b.OyStr=e+"Oy";b.scaleStr=e+"escala";b.wStr=e+"_w";b.hStr=e+"_h";b.mxStr=e+"mouse_x";b.myStr=e+"mouse_y";b.mpressedStr=e+"mouse_pressed";b.mclickedStr=e+"mouse_clicked";b.mclickIzqStr=e+"clic_izquierdo";b.click=0;b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};
return d};$jscomp.inherits(Q,a.Space);Q.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")};Q.prototype.update=function(a){b=this;l=b.evaluator;m=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),N=b.evaluator.eval(b.hModExpr),b.old_w!=C||b.old_h!=N)b.w=
C,b.h=N,b.w_2=b.w/2,b.h_2=b.h/2,l.setVariable(b.wStr,b.w),l.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 l.setVariable(b.wStr,b.w),l.setVariable(b.hStr,b.h);b.drawIfValue=0<l.eval(b.drawif);if(b.drawIfValue){q=b.x!==l.eval(b.xExpr)+b.displaceRegionWest;k=b.y!==l.eval(b.yExpr)+m.plecaHeight+
b.displaceRegionNorth;b.spaceChange=a||q||k||b.drawBefore!==b.drawIfValue||b.Ox!==l.getVariable(b.OxStr)||b.Oy!==l.getVariable(b.OyStr)||b.scale!==l.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=q?l.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=k?l.eval(b.yExpr)+m.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=l.getVariable(b.OxStr);b.Oy=l.getVariable(b.OyStr);b.scale=l.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));l.setVariable(b.scaleStr,
b.scale);if(q||k)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"};Q.prototype.drawBackground=function(){b=this;l=b.evaluator;h=b.backCtx;h.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);h.fillStyle=b.backColor=b.background.getColor();
h.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===b.bg_display?h.drawImage(b.image,0,0):"stretch"===b.bg_display?h.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(h.fillStyle=h.createPattern(b.image,"repeat"),h.fillRect(0,0,b.w,b.h)):"imgcenter"===b.bg_display&&h.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));n=b.scale;v=0;for(y=0>b.w+b.h?0:b.w+b.h;n>y;)n/=10,v++;for(;n<y/10;)n*=10;h.lineWidth=1;
""!==b.net&&(h.strokeStyle=b.net.getColor(),b.drawMarks(h,n/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&""!==b.net&&""!==b.net10)h.strokeStyle=b.net10.getColor(),b.drawMarks(h,n,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");h.strokeStyle=b.axes.getColor();h.beginPath();"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(h.moveTo(0,e(b.h/2+b.Oy)+.5),h.lineTo(b.w,e(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(h.moveTo(e(b.w/
2+b.Ox)+.5,0),h.lineTo(e(b.w/2+b.Ox)+.5,b.h));h.lineWidth=1.2;h.stroke();h.lineWidth=1;b.drawMarks(h,n,4,a);b.drawMarks(h,n/2,2,a);b.drawMarks(h,n/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)h.fillStyle=""!==b.axes?b.axes.getColor():"#000",h.font=u,h.textAlign="right",h.textBaseline="alphabetic","no"!=b.x_axis&&h.fillText(b.x_axis,e(b.w)-2,e(b.h/2+b.Oy)+12),"no"!=b.y_axis&&h.fillText(b.y_axis,e(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(h.fillStyle=b.axes.getColor(),h.font=u,h.textAlign="start",h.textBaseline=
"bottom",n>(b.w+b.h)/2?b.drawNumbers(h,n/5,n<=b.scale?v+1:v):n>(b.w+b.h)/4?b.drawNumbers(h,n/2,n<=b.scale?v+1:v):b.drawNumbers(h,n,v));a=0;for(var c=this.backGraphics.length;a<c;a++)this.backGraphics[a].draw()};Q.prototype.draw=function(){b=this;h=b.ctx;h.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,d=b.graphics.length;a<d;a++)g=b.graphics[a],""!==g.trace&&b.drawTrace&&g.drawTrace(),g.draw();a=0;for(d=b.graphicsCtr.length;a<d;a++)b.graphicsCtr[a].draw();""!=b.text&&b.click&&"L"===b.whichBtn&&
(h.save(),h.strokeStyle=h.fillStyle=b.text.getColor(),h.lineWidth=1,h.font=p,h.textAlign="center",h.textBaseline="alphabetic",D=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(b.scale.toString().length),A=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(b.scale.toString().length),I="("+D+","+A+")",H=e(h.measureText(I).width/2),M=b.getAbsoluteX(b.mouse_x),P=b.getAbsoluteY(b.mouse_y),G=e(M),O=e(P-10),G+H>b.w?G=b.w-H:0>G-H&&(G=H),O+1>b.h?O=b.h:0>O-14&&(O=15),h.fillText(I,G,O),h.beginPath(),h.arc(M,
P,2.5,0,c,!0),h.stroke(),h.restore())};Q.prototype.drawMarks=function(a,b,c,h){r=this.w;f=this.h;E=F=0;J=r;K=f;w=e(r/2+this.Ox);x=e(f/2+this.Oy);0<=c&&(F=w-c,J=w+c,E=x-c,K=x+c);a.beginPath();if(!h||h&&!h.match("x"))for(c=-d(w/b);(B=w+d(c*b))<r;c++)a.moveTo(B+.5,E+.5),a.lineTo(B+.5,K+.5);if(!h||h&&!h.match("y"))for(c=-d(x/b);(z=x+d(c*b))<f;c++)a.moveTo(F+.5,z+.5),a.lineTo(J+.5,z+.5);a.stroke()};Q.prototype.drawNumbers=function(a,b,c){r=this.w;f=this.h;w=e(r/2+this.Ox);x=e(f/2+this.Oy);for(c=-d(w/b);(B=
w+d(c*b))<r;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),B+1,x-2);for(c=-d(x/b);(z=x+d(c*b))<f;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),w+5,z+5)};Q.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.click=0,h.evaluator.setVariable(h.mpressedStr,0),h.evaluator.setVariable(h.mclickedStr,1),h.evaluator.setVariable(h.mclickIzqStr,
1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),h.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();h.click=0;h.evaluator.setVariable(h.mpressedStr,0);h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclickIzqStr,1);"R"===h.whichBtn&&(window.removeEventListener("mousemove",e),h.posZoom==h.posZoomNew&&a.showConfig&&(h.parent.externalSpace.show(),
h.posZoom=!1,h.posZoomNew=!0));window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",c);h.parent.deactivateGraphicControls();h.parent.update()}function d(b){h.posAnte=a.getCursorPosition(b,h.container);h.mouse_x=h.getRelativeX(h.posAnte.x);h.mouse_y=h.getRelativeY(h.posAnte.y);h.evaluator.setVariable(h.mxStr,h.mouse_x);h.evaluator.setVariable(h.myStr,h.mouse_y);h.evaluator.setVariable(h.mclickedStr,0);h.evaluator.setVariable(h.mclickIzqStr,0);h.parent.update()}function e(b){b.preventDefault();
h.posZoomNew=a.getCursorPosition(b,h.container).y;h.evaluator.setVariable(h.scaleStr,h.tempScale+h.tempScale/45*((h.posZoom-h.posZoomNew)/10));h.parent.update()}function f(b){b.preventDefault();b.stopPropagation();h.fixed||(h.posNext=a.getCursorPosition(b,h.container),L=h.posAnte.x-h.posNext.x,R=h.posAnte.y-h.posNext.y,h.evaluator.setVariable(h.OxStr,h.Ox-L),h.evaluator.setVariable(h.OyStr,h.Oy-R));d(b)}var h=this;h.posZoom=h.posZoomNew=null;h.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&
this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.parent.clearClick(),h.click=1,h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,0),h.parent.deactivateGraphicControls(),d(a),window.addEventListener("touchmove",f),window.addEventListener("touchend",
b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",d);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();h.parent.clearClick();h.click=1;h.parent.deactivateGraphicControls();h.whichBtn=a.whichBtn(b);"R"===h.whichBtn?(window.addEventListener("mouseup",c),h.posZoom=a.getCursorPosition(b,h.container).y,h.posZoomNew=h.posZoom,h.fixed||(h.tempScale=
h.scale,window.addEventListener("mousemove",e))):"L"===h.whichBtn&&(h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,0),d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space2D=Q;return a}(descartesJS||{});
descartesJS=function(a){var e,d,c;function u(b,c){G=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));O=a.add3D(b,a.scalarProduct3D(G,-2));C=a.norm3D(O);return 0!==C?a.scalarProduct3D(O,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var p=Math.floor,b=Math.max,l=Math.cos,m=Math.sin,h,q,k,g,n,v,y,r,f,B,z,w,x,F,J,E,K=[],D,A,I,H,M,P,G,O,C,N,L,R=function(b,c){k=c=a.Space.call(this,b,c)||this;k.border_width=k.border_width||0;k.border_color=k.border_color||new a.Color("000000",b.evaluator);k.border_radius=
k.border_radius||0;k.backCanvas=a.newHTML("canvas",{id:k.id+"_background",width:k.w+"px",height:k.h+"px"});k.canvas=a.newHTML("canvas",{id:k.id+"_canvas",width:k.w+"px",height:k.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+k.zIndex+";"});k.ctx=k.canvas.getContext("2d");k.ctx.imageSmoothingEnabled=!1;var d=k.id+".image";k.parent.images[d]=k.canvas;k.parent.images[d].ready=1;k.parent.images[d].complete=!0;k.parent.images[d].canvas=!0;k.evaluator.setVariable(d,d);k.graphicControlContainer=
a.newHTML("div",{id:k.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+k.zIndex+";"});k.numericalControlContainer=a.newHTML("div",{id:k.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+k.zIndex+";"});k.container=a.newHTML("div",{id:k.id,class:"DescartesSpace3DContainer",style:"left:"+k.x+"px;top:"+k.y+"px;z-index:"+k.zIndex+";"+(0<k.border_width?"border:"+k.border_width+"px solid "+k.border_color.getColor()+";":"")+(k.border_radius?"border-radius:"+
k.border_radius+"px;":"")});k.container.appendChild(k.backCanvas);k.container.appendChild(k.canvas);k.container.appendChild(k.graphicControlContainer);k.container.appendChild(k.numericalControlContainer);b.container.insertBefore(k.container,b.loader);k.eye={x:0,y:0,z:0};k.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var e=k.lights.length;d<e;d++)k.lights[d]=a.normalize3D(k.lights[d]);k.light3={x:0,y:0,z:0};k.intensity=[.4,.5,.3,0];k.userIntensity=0;k.dim=1;k.tmpIntensity=
[];k.OxStr=k.id+".Ox";k.OyStr=k.id+".Oy";k.scaleStr=k.id+".escala";k.wStr=k.id+"._w";k.hStr=k.id+"._h";k.obsStr=k.id+".observador";k.ojoXStr=k.id+".Ojo.x";k.ojoYStr=k.id+".Ojo.y";k.ojoZStr=k.id+".Ojo.z";k.rotZStr=k.id+".rot.z";k.rotYStr=k.id+".rot.y";k.userIDimStr=k.id+".userIlum.dim";k.userIIStr=k.id+".userIlum.I";k.userIxStr=k.id+".userIlum.x";k.userIyStr=k.id+".userIlum.y";k.userIzStr=k.id+".userIlum.z";k.evaluator.setVariable(k.rotZStr,0);k.evaluator.setVariable(k.rotYStr,0);k.evaluator.setVariable(k.userIDimStr,
k.dim);k.evaluator.setVariable(k.userIIStr,k.userIntensity);k.evaluator.setVariable(k.userIxStr,0);k.evaluator.setVariable(k.userIyStr,0);k.evaluator.setVariable(k.userIzStr,0);L=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},k);k.evaluator.setFunction(k.id+"._X3D2D_",function(a,b,c){L.vertices[0].x=a;L.vertices[0].y=b;L.vertices[0].z=c;L.computeDepth(k);return L.projVert[0].x});k.evaluator.setFunction(k.id+"._Y3D2D_",function(a,b,c){L.vertices[0].x=a;L.vertices[0].y=b;L.vertices[0].z=
c;L.computeDepth(k);return L.projVert[0].y});k.resizable&&(k.wModExpr=b.evaluator.parser.parse(k.wModExpr),k.hModExpr=b.evaluator.parser.parse(k.hModExpr));k.ratio=1;k.addEvents();return c};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){k=this;k.initSpace();k.canvas&&(k.canvas.width=k.backCanvas.width=k.w,k.canvas.height=k.backCanvas.height=k.h,k.canvas.style.width=k.backCanvas.style.width=k.w+"px",k.canvas.style.height=k.backCanvas.style.height=k.h+"px");k.w_2=k.w/2;k.h_2=k.h/2;k.w_plus_h=
k.w+k.h;k.oldMouse={x:0,y:0};k.S={x:k.h/1080*-20.6*(40/k.scale),y:0,z:0};k.Ojo={x:3*k.w_2,y:0,z:0};k.evaluator.setVariable(k.ojoXStr,k.Ojo.x);k.evaluator.setVariable(k.ojoYStr,k.Ojo.y);k.evaluator.setVariable(k.ojoZStr,k.Ojo.z)};R.prototype.update=function(a){k=this;h=k.evaluator;q=k.parent;h.setVariable(k.wStr,k.w);h.setVariable(k.hStr,k.h);k.drawIfValue=0<h.eval(k.drawif);if(k.drawIfValue){k.resizable&&(wModExpr=k.evaluator.eval(k.wModExpr),hModExpr=k.evaluator.eval(k.hModExpr),k.old_w!=wModExpr||
k.old_h!=hModExpr)&&(k.w=wModExpr,k.h=hModExpr,k.w_2=k.w/2,k.h_2=k.h/2,h.setVariable(k.wStr,k.w),h.setVariable(k.hStr,k.h),k.old_w=k.w,k.old_h=k.h,k.canvas.width=k.backCanvas.width=k.w*k.ratio,k.canvas.height=k.backCanvas.height=k.h*k.ratio,k.canvas.style.width=k.backCanvas.style.width=k.w+"px",k.canvas.style.height=k.backCanvas.style.height=k.h+"px",a=!0,k.S={x:k.h/1080*-20.6*(40/k.scale),y:0,z:0},k.Ojo={x:3*k.w_2,y:0,z:0},k.evaluator.setVariable(k.ojoXStr,k.Ojo.x),k.evaluator.setVariable(k.ojoYStr,
k.Ojo.y),k.evaluator.setVariable(k.ojoZStr,k.Ojo.z));v=k.x!==h.eval(k.xExpr)+k.displaceRegionWest;y=k.y!==h.eval(k.yExpr)+q.plecaHeight+k.displaceRegionNorth;k.spaceChange=a||v||y||k.drawBefore!==k.drawIfValue||k.Ox!==h.getVariable(k.OxStr)||k.Oy!==h.getVariable(k.OyStr)||k.Ojo.x!==h.getVariable(k.ojoXStr)||k.Ojo.y!==h.getVariable(k.ojoYStr)||k.Ojo.z!==h.getVariable(k.ojoZStr)||k.scale!==h.getVariable(k.scaleStr);k.x=v?h.eval(k.xExpr)+k.displaceRegionWest:k.x;k.y=y?h.eval(k.yExpr)+q.plecaHeight+k.displaceRegionNorth:
k.y;k.Ojo.x=h.getVariable(k.ojoXStr);k.Ojo.y=h.getVariable(k.ojoYStr);k.Ojo.z=h.getVariable(k.ojoZStr);k.Ox=h.getVariable(k.OxStr);k.Oy=h.getVariable(k.OyStr);k.scale=h.getVariable(k.scaleStr);k.drawBefore=k.drawIfValue;if(a||void 0==k.observer){a=0;for(var c=k.parent.controls.length;a<c;a++)k.parent.controls[a].id===k.obsStr&&(N=!0);k.observer=N?h.getVariable(k.obsStr)||2.5*k.w_plus_h:2.5*k.w_plus_h;k.observer=b(k.observer,.25*k.w_plus_h);h.setVariable(k.obsStr,k.observer)}1E-6>k.scale?(k.scale=
1E-6,h.setVariable(k.scaleStr,1E-6)):1E6<k.scale&&(k.scale=1E6,h.setVariable(k.scaleStr,1E6));if(v||y)k.container.style.left=k.x+"px",k.container.style.top=k.y+"px";k.container.style.display="block";k.dim=h.getVariable(k.userIDimStr);k.userIntensity=h.getVariable(k.userIIStr);k.light3={x:parseInt(h.getVariable(k.userIxStr)),y:parseInt(h.getVariable(k.userIyStr)),z:parseInt(h.getVariable(k.userIzStr))};k.updateCamera();k.draw()}else k.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=
a.scalarProduct3D(this.Ojo,1/this.scale)};R.prototype.rotateVertex=function(b){B=a.degToRad(k.evaluator.getVariable(k.rotZStr));z=l(B);w=m(B);e=b.x*z-b.y*w;d=b.x*w+b.y*z;c=b.z;B=a.degToRad(k.evaluator.getVariable(k.rotYStr));z=l(B);w=m(B);return{x:c*w+e*z,y:d,z:c*z-e*w}};R.prototype.project=function(a){k=this;this.evaluator.getVariable("URL.oldProj");var b=k.eye.x/(a.x-k.eye.x);return{x:k.getAbsoluteX(b*(k.eye.y-a.y)),y:k.getAbsoluteY(b*(k.eye.z-a.z)),z:k.eye.x-a.x}};R.prototype.computeColor=function(b,
c,d){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));H=a.subtract3D(this.eye,c.average);M=a.norm3D(H);P=a.scalarProduct3D(H,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);E=a.norm3D(this.lights[3]);for(var e=0,f=this.intensity.length-1;e<f;e++)K[e]=this.intensity[e]*this.dim;K[3]=this.userIntensity*this.userIntensity/E||0;D=d?this.dim/2:this.dim/4;A=0;I=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);e=0;for(f=this.lights.length;e<f;e++)d?(A=Math.max(0,
a.dotProduct3D(u(this.lights[e],I),P)),A*=A*A):A=Math.max(0,a.dotProduct3D(this.lights[e],I)),D+=K[e]*A;D=Math.min(D,1);x=p(b.r*D);F=p(b.g*D);J=p(b.b*D);return"rgba("+x+","+F+","+J+","+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++){g=
this.graphics[a];for(var c=a+1;c<b;c++)n=this.graphics[c],g.splitFace(n),n.splitFace(g);this.primitives=this.primitives.concat(g.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){g=this.graphics[a];if(g.split)for(c=a+1;c<b;c++)n=this.graphics[c],n.split&&g.splitFace(n);this.primitives=this.primitives.concat(g.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===
this.render)this.drawPainter(this.primitives);else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);for(var d=[],e=[],f=0,h=a.length,g=.001,m,k;;){m=h;for(c=0;c<b;c++)if(!a[c].drawn){k=!0;for(var l=0;l<b;l++)if(l!=c&&!a[l].drawn&&a[c].inFrontOf(d,a[l],g)){k=!1;break}k&&(h--,e[f++]=a[c],a[c].drawn=
!0)}if(0==h)break;else if(h==m){if(g*=10,.1<g){for(c=0;c<b;c++)a[c].drawn||(e[f++]=a[c],a[c].drawn=!0);break}}else g=.001}for(c=0;c<b;c++)e[c].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);window.removeEventListener("touchmove",
h,!1);window.removeEventListener("touchend",b,!1);a.preventDefault();g.parent.update()}function c(b){document.body.focus();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);b.preventDefault();"R"===g.whichBtn&&(window.removeEventListener("mousemove",e,!1),g.posZoom==g.posZoomNew&&a.showConfig&&g.parent.externalSpace.show());window.removeEventListener("mousemove",h,!1);window.removeEventListener("mouseup",c,!1);g.parent.update()}function d(b){g.posAnte=a.getCursorPosition(b,g.container);g.mouse_x=
g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.id+".mouse_x",g.mouse_x);g.evaluator.setVariable(g.id+".mouse_y",g.mouse_y);g.parent.update()}function e(b){b.preventDefault();g.posZoomNew=a.getCursorPosition(b,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.posObserverNew=a.getCursorPosition(b,g.container).x;g.evaluator.setVariable(g.obsStr,g.tempObserver-2.5*(g.posObserver-g.posObserverNew));
g.parent.update()}function h(b){if(!g.fixed&&g.click){r=(g.getAbsoluteX(g.oldMouse.x)-g.getAbsoluteX(g.mouse_x))/4;f=(-g.getAbsoluteY(g.oldMouse.y)+g.getAbsoluteY(g.mouse_y))/4;if(r!==g.disp.x||f!==g.disp.y)g.alpha=a.degToRad(g.evaluator.getVariable(g.rotZStr)),g.beta=a.degToRad(-g.evaluator.getVariable(g.rotYStr)),g.alpha=a.radToDeg(g.alpha)-r,g.beta=a.radToDeg(g.beta)-f,g.evaluator.setVariable(g.rotZStr,g.alpha),g.evaluator.setVariable(g.rotYStr,-g.beta),g.disp.x=r,g.disp.y=f,g.oldMouse.x=g.getRelativeX(g.posAnte.x),
g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(b);b.preventDefault()}}var g=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();g.click=1;g.evaluator.setVariable(g.id+".mouse_pressed",1);g.parent.deactivateGraphicControls();g.posAnte=a.getCursorPosition(c,g.container);g.oldMouse.x=g.getRelativeX(g.posAnte.x);g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(c);window.addEventListener("touchmove",h);window.addEventListener("touchend",
b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();g.click=1;g.parent.deactivateGraphicControls();g.whichBtn=a.whichBtn(b);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posObserver=a.getCursorPosition(b,g.container).x,g.posObserverNew=g.posObserver,g.posZoom=a.getCursorPosition(b,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,g.tempObserver=g.observer,window.addEventListener("mousemove",e))):"L"==g.whichBtn&&(g.evaluator.setVariable(g.id+
".mouse_pressed",1),g.posAnte=a.getCursorPosition(b,g.container),g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y),d(b),window.addEventListener("mousemove",h),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e,d,c,u,p,b,l=function(b,c){var d=a.Space.call(this,b,c)||this;e=d.parent.evaluator;void 0!=d._w_&&(b=e.parser.parse(d._w_),d._w_="number"!=b.type?b:void 0);void 0!=d._h_&&(b=e.parser.parse(d._h_),d._h_="number"!=b.type?b:void 0);d.isFirefox=/firefox/i.test(window.navigator.userAgent);d.file=d.file?d.file.trim():"";d.file.match(/^\[/)&&d.file.match(/\]$/)?d.file=e.parser.parse(d.file.substring(1,d.file.length-1)):d.file.match(/^'/)&&d.file.match(/'$/)?
d.file=e.parser.parse(d.file):d.file=e.parser.parse("'"+d.file+"'");d.oldFile=e.eval(d.file);d.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=d.oldFile&&d.MyIFrame.setAttribute("src",d.oldFile);d.container=a.newHTML("div",{id:d.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+
d.zIndex+";background-repeat:no-repeat;background-position:center;"});d.container.appendChild(d.MyIFrame);d.imageSrc&&(d.container.style.backgroundImage="url("+d.imageSrc+")");d.parent.container.insertBefore(d.container,d.parent.loader);d.MyIFrame.onload=function(b){var c=this;d.evaluator.setFunction(d.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});d.evaluator.setFunction(d.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
d.evaluator.setFunction(d.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});d.evaluator.setFunction(d.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var d=a.cacheFiles[b];else d=(d=document.getElementById(b))&&"descartes/embed"===d.type?d.textContent:a.openExternalFile(b),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",a.cacheFiles[b]=d;c.contentWindow.postMessage({type:"change_config",filename:b,content:d},
"*")}return 0});d.ImReady=!d.isFirefox;d.isFirefox||(d.container.style.visibility="visible",d.container.style.opacity="1",d.container.style.zIndex=d.zIndex,d.container.style.display=d.drawIfValue?"block":"none");d.MyIFrame.style.visibility="visible";d.container.style.backgroundImage=""};d.update=d.iframeUpdate;d.evaluator.setVariable(d.id+"._scroll",0);return d};$jscomp.inherits(l,a.Space);l.prototype.init=function(){p=this;p.initSpace();p.MyIFrame&&Object.assign(p.MyIFrame.style,{width:p.w+"px",
height:p.h+"px"})};l.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);d=this.x!==e.eval(this.xExpr)+this.displaceRegionWest;c=this.y!==e.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=d?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(d||c)this.container.style.left=this.x+"px",this.container.style.top=
this.y+"px";u=e.eval(this.file);u!==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=u,this.MyIFrame.contentWindow.location.replace(u));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=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var e=1,d=function(c){this.children=c.children;this.lessonParser=c.lessonParser;this.images=c.images;this.images.length=c.images.length;this.audios=c.audios;this.audios.length=c.audios.length;this.descartesApp=c;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});c.imgLoader?(c.loader.style.backgroundColor="rgba(0,0,0,0)",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()};
d.prototype.initPreloader=function(){var c=this,d=c.children,e=c.images,b=c.audios,l=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,m=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;e["lib/DescartesCCLicense.png"]=a.getCCLImg();e["lib/DescartesCCLicense.png"].ready=1;var h,q;var k=0;for(h=d.length;k<h;k++)if("rtf"!==d[k].name){if(d[k].value.match(/'macro'|'makro'/g)){var g="";var n=c.lessonParser.split(d[k].value);var v=0;for(q=n.length;v<q;v++)"expresion"===babel[n[v][0]]&&(g=n[v][1]);if(g)var y=(y=document.getElementById(g))&&
"descartes/macro"==y.type?y.text:a.openExternalFile(g);if(y&&(n=y.match(l)))for(g=0,q=n.length;g<q;g++)v=n[g],v.toLowerCase().match(/vacio.gif$/)||""==v.substring(0,v.length-4)||(e[v]=new Image,e[v].addEventListener("load",function(){this.ready=1}),e[v].addEventListener("error",function(){this.errorload=1}),e[v].src=v)}if(n=d[k].value.match(l))for(g=0,q=n.length;g<q;g++)v=n[g],v.toLowerCase().match(/vacio.gif$/)||""==v.substring(0,v.length-4)||(e[v]=new Image,e[v].addEventListener("load",function(){this.ready=
1}),e[v].addEventListener("error",function(){this.errorload=1}),e[v].src=v);if(n=d[k].value.match(m))for(g=0,v=n.length;g<v;g++)c.initAudio(n[g])}for(var r in e)e.hasOwnProperty(r)&&c.images.length++;for(r in b)b.hasOwnProperty(r)&&c.audios.length++;var f=c.images.length+c.audios.length;0<f&&c.progress.setAttribute("max",f);var B,z=function(){B=0;for(var d in e)e.hasOwnProperty(d)&&(e[d].ready||e[d].errorload)&&B++;for(d in b)b.hasOwnProperty(d)&&(b[d].ready||b[d].errorload)&&B++;c.progress.setAttribute("value",
B);B!=f?c.timer=a.setTimeout(z,1):c.descartesApp.initBuildApp()};z()};d.prototype.initAudio=function(c){var d=this.audios;d[c]=new Audio(c);d[c].filename=c;var e=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo '"+c+"' no puede ser reproducido"),this.errorload=1):(d[c]=new Audio(this.filename.replace("mp3","ogg")),d[c].filename=this.filename.replace("mp3",
"ogg"),d[c].addEventListener("canplaythrough",e),d[c].addEventListener("load",e),d[c].addEventListener("error",b),d[c].load())};d[c].addEventListener("canplaythrough",e);d[c].addEventListener("load",e);d[c].addEventListener("error",b);a.hasTouchSupport?(d[c].load(),d[c].play(),a.setTimeout(function(){d[c].pause()},20),d[c].ready=1):d[c].load()};a.DescartesLoader=d;return a}(descartesJS||{});
descartesJS=function(a){function e(a){for(var b="[",d=0,m=a.length;d<m;d++)Array.isArray(a[d])?b+=e(a[d]):(c=a[d]||0,"string"==typeof c&&(c="'"+c+"'"),b+=c),d<m-1&&(b+=",");return b+"]"}function d(){u=window.innerWidth/this.width;p=window.innerHeight/this.height;a.cssScale=b=Math.min(u,p);this.container.style.transformOrigin="0 0";u<p?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+b+")"):(this.container.style.left="50%",this.container.style.transform=
"translate3d(0px, 0px, 0px) scale("+b+") translate(-50%, 0)")}if(a.loadLib)return a;var c,u,p,b,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=
0,d=this.children.length;c<d;c++)"CreativeCommonsLicense"===this.children[c].name&&(a.ccLicense="no"!==this.children[c].value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.init()};l.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);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 Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var b=this.children,c,e=0,k=0,g=a.ccLicense?90:0,l=0,p=b.length;l<p;l++)c=b[l],"rtf_height"==c.name&&(e=parseInt(c.value)+120||this.height),"Buttons"==babel[c.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(c.value),k=this.buttonsConfig.height),"image_loader"==c.name&&(this.imgLoader=c.value),"expand"==c.name&&(this.expand=c.value),"docBase"==c.name&&(this.docBase=c.value,c=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(c));"cover"==this.expand&&
(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,e&&(this.height=e+k+g));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&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.parentNode.style.width="100vw",this.container.parentNode.style.height="100vh",this.scaleToFit=d,this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",
new a.DescartesLoader(this)):this.initBuildApp()};l.prototype.initBuildApp=function(){a.showConfig=!0;for(var b=this.children,c,d=this.lessonParser,e=[],g=[],l=[],p=[],u=[],r=[],f=0,B=b.length;f<B;f++)if(c=b[f],"editable"==babel[c.name])a.showConfig="false"==babel[c.value]?!1:!0;else if("language"==babel[c.name])this.language=c.value;else if("pleca"==c.name)c=d.parsePleca(c.value,this.width),this.container.insertBefore(c,this.loader),this.plecaHeight=c.imageHeight?c.imageHeight:c.offsetHeight;else if("Buttons"==
babel[c.name])this.buttonsConfig=d.parseButtonsConfig(c.value);else if("decimal_symbol"==babel[c.name])this.decimal_symbol=c.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[c.name])this.version=parseInt(c.value);else if("language"==babel[c.name])this.language=c.value;else if("rtf"==c.name){var z=(this.width-780)/2,w=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;p.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+
c.value.replace(/'/g,"&squot;")+"'");p.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+z+","+(w-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&p.push("space='descartesJS_stage' type='image' expresion='["+(z+15)+","+w+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==c.name.charAt(0)?(c.value.match(/'HTMLIFrame'/)&&this.nIframes++,e.push(c.value)):/^C_/.test(c.name)?g.push(c.value):/^A_/.test(c.name)?l.push(c.value):/^G_/.test(c.name)?
(c.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),p.push(c.value)):/^S_/.test(c.name)?u.push(c.value):"Animation"==babel[c.name]&&r.push(c.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));f=0;for(B=e.length;f<B;f++)b=d.parseSpace(e[f]),this.arquimedes&&this.stage.container.appendChild(b.container),this.spaces.push(b),this.zIndex++;f=0;for(B=p.length;f<B;f++)if(a.DEBUG.elemIndex=f,e=d.parseGraphic(p[f]))this.editableRegionVisible=this.editableRegionVisible||e.visible,e.space.addGraph(e);f=0;
for(B=u.length;f<B;f++)(e=d.parse3DGraphic(u[f]))&&e.space.addGraph(e,!0);f=0;for(B=g.length;f<B;f++)this.controls.push(d.parseControl(g[f]));f=0;for(B=l.length;f<B;f++)d.parseAuxiliar(l[f]);f=0;for(B=r.length;f<B;f++)this.animation=d.parseAnimation(r[f]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();f=0;for(B=this.controls.length;f<B;f++)this.controls[f].init();this.updateControls();this.updateSpaces(!0);var x=this;this.nIframes?a.setTimeout(function(){x.finishInit()},200*
this.nIframes):this.finishInit()};l.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",
value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(h){console.warn("CustomEvents not supported in this browser")}this.readyApp=!0};l.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var b=parseInt(this.width)+
30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-c)/2);window.resizeTo(b,c);a.onResize()};l.prototype.configRegions=function(){var b=this.evaluator.parser,c=this.buttonsConfig||{},d=this.container,e="15",g=100,l=100,p=100,u=100;2==this.version&&(e="14",g=63,l=50,p=44,u=53);var r=0,f=0,B=0,z=0,w=0,x=this.northSpace.controls,F=this.southSpace.controls,J=this.eastSpace.controls,E=this.westSpace.controls;if(0<c.rowsNorth||0<x.length||c.about||c.config){0>=
c.rowsNorth?(r=c.height,c.rowsNorth=1):r=c.height*c.rowsNorth;var K=this.northSpace.container;K.id="descartesJS_north";K.setAttribute("style","width:"+d.width+"px;height:"+r+"px;left:0;top:"+this.plecaHeight+"px;");d.insertBefore(K,this.loader);K=d.width;var D=0;c.about?(D=g,K-=D):g=0;c.config&&(K-=l);var A=Math.ceil(x.length/c.rowsNorth),I=K/A;var H=0;for(var M=x.length;H<M;H++)x[H].expresion=b.parse("("+(D+H%A*I)+","+c.height*Math.floor(H/A)+","+I+","+c.height+")"),x[H].drawif=b.parse("1"),x[H].init();
c.about&&(H=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(e),expresion:b.parse("(0, 0, "+g+", "+r+")")}),H.actionExec={execute:a.showAbout},H.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(e),action:"config",expresion:b.parse("("+(K+g)+", 0, "+l+", "+r+")")})).update()}if(0<c.rowsSouth||0<F.length||c.init||c.clear){0>=c.rowsSouth?(f=c.height,c.rowsSouth=1):f=c.height*c.rowsSouth;g=d.width;D=0;c.init?
(D=p,g-=D):p=0;c.clear&&(g-=u);K=this.southSpace.container;K.id="descartesJS_south";K.setAttribute("style","width:"+d.width+"px;height:"+f+"px;left:0;bottom:0;");d.insertBefore(K,this.loader);A=Math.ceil(F.length/c.rowsSouth);I=g/A;H=0;for(M=F.length;H<M;H++)F[H].expresion=b.parse("("+(D+H%A*I)+","+c.height*Math.floor(H/A)+","+I+","+c.height+")"),F[H].drawif=b.parse("1"),F[H].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(e),action:"init",
expresion:b.parse("(0, 0, "+p+", "+f+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(e),action:"clear",expresion:b.parse("("+(g+p)+", 0, "+u+", "+f+")")})).update()}if(0<J.length)for(H=d.height-r-f,z=c.widthEast,K=this.eastSpace.container,K.id="descartesJS_east",K.setAttribute("style","width:"+z+"px;height:"+H+"px;right:0;top:"+r+"px;"),d.insertBefore(K,this.loader),H=0,M=J.length;H<M;H++)J[H].expresion=b.parse("(0,"+c.height*
H+","+z+","+c.height+")"),J[H].drawif=b.parse("1"),J[H].init();if(0<E.length)for(H=d.height-r-f,w=c.widthWest,K=this.westSpace.container,K.id="descartesJS_west",K.setAttribute("style","width: "+w+"px;height:"+H+"px;left:0;top:"+r+"px;"),d.insertBefore(K,this.loader),H=0,M=E.length;H<M;H++)E[H].expresion=b.parse("(0,"+c.height*H+","+w+","+c.height+")"),E[H].drawif=b.parse("1"),E[H].init();if(this.editableRegionVisible)for(B=c.height,K=this.editableRegion.container,K.id="descartesJS_editableRegion",
K.setAttribute("style","position:absolute;width:"+d.width+"px;height:"+B+"px;left:0;top:"+(d.height-f-c.height)+"px;"),d.insertBefore(K,this.loader),b=this.editableRegion.textFields,d=d.width/b.length,c=a.getFieldFontSize(B),H=0,M=b.length;H<M;H++)"div"==b[H].type?(K.appendChild(b[H].container),b[H].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(d-4)+"px;height:"+B+"px;position:absolute;left:"+H*d+"px;top:0;"),E=b[H].container.firstChild,E.setAttribute("style","font-family:"+
a.sansserif_font+";font-size:"+c+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+B+"px;text-align:center;line-height:"+B+"px;"),J=E.offsetWidth,E.style.width=J+"px",E.firstChild.textContent=E.firstChild.textContent.substring(3,E.firstChild.textContent.length-3),b[H].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+(d-J)+"px;height:"+B+"px;position:absolute;left:"+J+"px;top:0;border:2px groove white;")):(K.appendChild(b[H]),
b[H].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+d+"px;height:"+B+"px;position:absolute;left:"+H*d+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=r;this.displaceRegionSouth=f+(B||0);this.displaceRegionEast=z;this.displaceRegionWest=w;H=0;for(M=this.spaces.length;H<M;H++)this.spaces[H].init()};l.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};l.prototype.clearClick=
function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};l.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var b=0,c=this.controls.length;b<c;b++)this.controls[b].buttonClick=!1};l.prototype.deactivateGraphicControls=function(){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};l.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};l.prototype.updateEvents=
function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};l.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};l.prototype.updateSpaces=function(a){for(var b=0,c=this.spaces.length;b<c;b++)this.spaces[b].update(a)};l.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].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){var b=this.images;return a?(b[a]||(b[a]=new Image,b[a].addEventListener("load",function(){this.ready=1}),b[a].addEventListener("error",function(){this.ready=0;this.errorload=
1}),b[a].src=a),b[a]):new Image};l.prototype.getAudio=function(b){var c=this.audios;if(b){if(!c[b]){b.lastIndexOf(".");c[b]=new Audio(b);var d=function(a){this.ready=1};c[b].addEventListener("canplaythrough",d);var e=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(c[b]=new Audio(b.replace("mp3","ogg")),c[b].addEventListener("canplaythrough",d),c[b].addEventListener("load",
d),c[b].addEventListener("error",e),c[b].load())};c[b].addEventListener("error",e);c[b].play();a.setTimeout(function(){c[b].pause()},15)}return c[b]}return new Audio};l.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};l.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.controls.length;d<e;d++)if(c=this.controls[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};l.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};l.prototype.getSpaceById=
function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.spaces.length;d<e;d++)if(c=this.spaces[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};l.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b){a=decodeURIComponent(a.substring(b+1)).split("&");for(var c=0,d=a.length;c<d;c++)b=a[c].split("="),2==b.length&&(+b[1]==+b[1]&&(b[1]=parseFloat(b[1])),this.evaluator.setVariable("URL."+b[0],b[1]))}};l.prototype.getState=function(){var a="",b=this.evaluator.variables,
c;for(c in b)if(b.hasOwnProperty(c)){var d=b[c];"string"==typeof d&&(d="'"+d+"'");void 0!=d&&"rnd"!=c&&"\u03c0"!=c&&"pi"!=c&&"e"!=c&&"Infinity"!=c&&"-Infinity"!=c&&"object"!=typeof d&&(a=""!=a?a+"\n"+c+"="+d:c+"="+d)}d=this.evaluator.vectors;for(var g in d)d.hasOwnProperty(g)&&(a+="\n"+g+"="+e(d[g]));g=this.evaluator.matrices;for(var l in g)g.hasOwnProperty(l)&&(a+="\n"+l+"="+e(g[l]));return a};l.prototype.setState=function(a,b){a=a.split("\n");for(var c,d,e=0,h=a.length;e<h;e++)c=a[e].split("="),
2<=c.length&&(d=eval(c[1]),-1!=c[1].indexOf("[[")?(this.evaluator.matrices[c[0]]=d,this.evaluator.matrices[c[0]].rows=d.length,this.evaluator.matrices[c[0]].cols=d[0].length):-1!=c[1].indexOf("[")?(this.evaluator.vectors[c[0]]=d,this.evaluator.variables[c[0]+".long"]=d.length):this.evaluator.variables[c[0]]=d);b||this.update()};l.prototype.getEvaluation=function(){for(var a=correct=0,b="",c=0,d=this.controls.length;c<d;c++)"textfield"==this.controls[c].gui&&this.controls[c].evaluate&&(a++,correct+=
this.controls[c].ok,this.controls[c].value=""==this.controls[c].value?"''":this.controls[c].value,b+=" \\n "+this.controls[c].id+"="+this.controls[c].value+"|"+this.controls[c].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};l.prototype.showSolution=function(){for(var a=this.controls,b=0,c=a.length;b<c;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};l.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<
b;a++)this.evaluator.eval(this.saveState[a]);this.update()};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,d){e="Error: "+e+" en\u300a "+d+" \u300b";var c="";switch(a.DEBUG.objectName){case "Auxiliar":d="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])c=" en la l\u00ednea "+(a.DEBUG.lineCount+1);e+=d+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \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 param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(e)}};return a}(descartesJS||{});
descartesJS=function(a){function e(){d().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function d(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(a.getAttribute("code"))})}function c(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function u(b){b=a.newHTML("div");var d='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbola DJS_extra DJS_sansserif DJS_serif DJS_monospace".split(" ").forEach(function(a){d+='<div style="font-family:'+a+';"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>'});b.innerHTML=d+"</div>";document.body.appendChild(b);a.getFeatures();a.hasCanvas?(window.scrollTo(0,10),c(),e(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";b.remove()}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 p=Object.create(null);a.onMessage=function(b){if(0<a.apps.length){var c=b.data;if(c)if("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;else if("update"===c.type)a.apps[0].update();else if("exec"===c.type)(b=a.apps[0].evaluator.getFunction(c.name))&&b.apply(a.apps[0].evaluator,
c.value.toString().split(","));else if("isResizeNeeded"===c.type)b.source.postMessage({type:"doResize"},"*");else if("doResize"===c.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===c.type){p[c.filename]?b=p[c.filename]:(b=a.newHTML("div"),b.innerHTML=c.content,b=b.getElementsByTagName("param"),p[c.filename]=b);var d=document.querySelector("base");d||(d=a.newHTML("base"),document.body.appendChild(d));d.setAttribute("href",c.filename);a.apps[0].children=b;a.apps[0].init()}}};void 0==
a.loadLib&&(a.loadLib=!0,window.addEventListener("load",u),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(b){window.addEventListener(b,function(b){a.onResize(b)})}),document.fonts.ready.then(function(){setTimeout(function(){a.apps.forEach(function(a){a.updateControls();a.updateSpaces(!0)})},500)}));return a}(descartesJS||{});
