/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2021-04-20
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var g=0;return function(){return g<a.length?{done:!1,value:a[g++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var g="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return g?g.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var g,f=[];!(g=a.next()).done;)f.push(g.value);return f};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var g=function(){};g.prototype=a;return new g};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},g={};try{return g.__proto__=a,g.a}catch(f){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,g){a.__proto__=g;if(a.__proto__!==g)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,g){a.prototype=$jscomp.objectCreate(g.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var f=$jscomp.setPrototypeOf;f(a,g)}else for(f in g)if("prototype"!=f)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(g,f);e&&Object.defineProperty(a,f,e)}else a[f]=g[f];a.superClass_=g.prototype};
$jscomp.checkStringArgs=function(a,g,f){if(null==a)throw new TypeError("The 'this' value for String.prototype."+f+" must not be null or undefined");if(g instanceof RegExp)throw new TypeError("First argument to String.prototype."+f+" must not be a regular expression");return a+""};$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,f){a!=Array.prototype&&a!=Object.prototype&&(a[g]=f.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,g,f,e){if(g){f=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var r=a[e];r in f||(f[r]={});f=f[r]}a=a[a.length-1];e=f[a];g=g(e);g!=e&&null!=g&&$jscomp.defineProperty(f,a,{configurable:!0,writable:!0,value:g})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var f=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var e="";a;)if(a&1&&(e+=f),a>>>=1)f+=f;return e}},"es6","es3");$jscomp.owns=function(a,g){return Object.prototype.hasOwnProperty.call(a,g)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,g){for(var f=1;f<arguments.length;f++){var e=arguments[f];if(e)for(var r in e)$jscomp.owns(e,r)&&(a[r]=e[r])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,f,e){var g=this.length||0;0>f&&(f=Math.max(0,g+f));if(null==e||e>g)e=g;e=Number(e);0>e&&(e=Math.max(0,g+e));for(f=Number(f||0);f<e;f++)this[f]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,g,f){a instanceof String&&(a=String(a));for(var e=a.length,r=0;r<e;r++){var p=a[r];if(g.call(f,p,r,a))return{i:r,v:p}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,f){return $jscomp.findInternal(this,a,f).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var f=[],e=0;e<this.length;e++){var g=this[e];Array.isArray(g)&&0<a?(g=Array.prototype.flat.call(g,a-1),f.push.apply(f,g)):f.push(g)}return f}},"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.shadowColor="shadowColor";a.shadowBlur="shadowBlur";
a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return"@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(e){if(""==e)return"";g=e.split(",");f="";f+=a.getFontStyle(g[1])+" ";f+=g[2]+"px ";return f+=a.getFontName(g[0].split(" ")[0])};a.getFontName=function(f){f=f.toLowerCase();e=a.monospace_font;if("serif"===f||"times new roman"===f||"timesroman"===f||"times"===f)e=a.serif_font;else if("sansserif"===f||"arial"===f||"helvetica"===f)e=a.sansserif_font;return e};
a.getFontStyle=function(a){return r[a.toLowerCase()]||""};a.getTextWidth=function(f,c){a.ctx.font=c;return Math.round(a.ctx.measureText(f).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 g(){var a,b,d,c,h,m,f;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(q){q=q||0;q=0>q?0:parseInt(q);a=this.toString();-1!==a.indexOf("e")&&(c=a.split("e"),m="-"===c[0][0]?"-":"",h="-"===m?parseFloat(c[0].substring(1)).oToFixed(11):parseFloat(c[0]).oToFixed(11),f=parseInt(c[1]),b=h.indexOf("."),h=h.replace(".",""),0>b+f?(b=0>b?1:b,a=m+"0."+"0".repeat(Math.abs(b+f))+h):a=m+h+"0".repeat(f-h.length+1));b=a.indexOf(".");-1===b?0<q&&
(a+="."+"0".repeat(q)):(d=a.length-b-1,a=d>=q?11>=q?parseFloat(a).oToFixed(q):a.substring(0,b+q+1):a+"0".repeat(q-d));return a}}if(a.loadLib)return a;var f=2*Math.PI,e=360/f,r=f/360,p=Math.floor,c,k,l,b;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*e};a.degToRad=function(a){return a*r};a.drawLine=function(a,d,c,h,f,m,e){a.lineWidth=e||1;a.strokeStyle=m||"black";b=a.lineWidth%2*.5;a.beginPath();a.moveTo(p(d)+b,p(c)+b);a.lineTo(p(h)+b,p(f)+b);a.stroke()};a.getColor=function(a,b){if("string"===
typeof b)return b;c=a.eval(b);return"rgba("+p(255*c[0][0])+","+p(255*c[0][1])+","+p(255*c[0][2])+","+(1-c[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=2);g()};var h,d;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(h=a.indexOf("."),-1!==h)){d=a.substring(h);if(0==parseFloat(d))return a.substring(0,h);for(var b=d.length-1;0<b;b--)if("0"!==d.charAt(b))return a.substring(0,h+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,d){a=void 0===a?0:a;b=void 0===
b?100:b;d="linear-gradient("+(void 0===d?0:d)+"deg,";for(var c=2*a,h=a;h<b;h++)a=p(100-h-35),d+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*h-c)+"%, ";return d+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(b,d){k=b.touches?b.touches[0]:b;l=d.getBoundingClientRect();return k?{x:(k.pageX-window.pageXOffset-l.left)/a.cssScale,y:(k.pageY-window.pageYOffset-l.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,d,c=[],h=0,m=0,f=a.length;m<f;m++)d=a.charAt(m),"'"===
d&&(b=!b),b||";"!==d&&"\n"!==d||(c.push(a.substring(h,m).replace(/\n/g,"\\n")),h=m+1);c.push(a.substring(h).replace(/\n/g,"\\n"));return c};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(b){var d=a.newHTML("textarea");d.innerHTML=b;return d.value};a.newHTML=function(a,b){a=document.createElement(a);for(var d in b)a.setAttribute(d,b[d]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||
window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function d(){Date.now()-c>=b&&(a.call(),c=Date.now());h.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setInterval(a,b);var c=Date.now(),h={};h.value=requestAnimationFrame(d);return h};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function d(){Date.now()-
c>=b?a.call():h.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setTimeout(a,b);var c=Date.now(),h={};h.value=requestAnimationFrame(d);return h};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 d=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
d.document.write(b);d.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(g){if(a.cacheFiles[g])return a.cacheFiles[g];var f=null,e=new XMLHttpRequest;e.open("GET",g,!1);try{e.send(null),f=200===e.status||304===e.status?e.responseText:e.responseText||"",f=404===e.status?"":f,f.match(String.fromCharCode(65533))&&(e.open("GET",g,!1),e.overrideMimeType("text/plain;charset=ISO-8859-1"),e.send(null),f=e.responseText)}catch(r){f=null}return f};a.addExternalFileContent=function(g,
f){a.cacheFiles[g]=f};return a}(descartesJS||{});
descartesJS=function(a){function g(a){A=a.indexOf("--radial--");-1!=A&&(a=a.substring(0,A));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 f(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 e(a,m,c){m=parseFloat(m);b=a.expr[0];h=a.expr[1];d=c.eval(b.expr);v=c.eval(h.expr);q="("==b.type||"["==b.type;u=")"==h.type||"]"==h.type;return q&&m>d&&u&&m<=v?1:0}function r(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,
"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var p,c,k,l,b,h,d,v,q,u,A;a.buildRegularExpressionsPatterns=function(a,b){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var d=0,m=a.length;d<m;d++){c=a[d].split("&");k=[];for(var h=0,e=c.length;h<e;h++)p=c[h],-1===p.indexOf(",")||"("!==
p.charAt(0)&&"["!==p.charAt(0)||")"!==p.charAt(p.length-1)&&"]"!==p.charAt(p.length-1)?k.push(g(p)):k.push(f(p,b));a[d]=k}return a};a.escorrecto=function(b,d,h,f){h=h||a.externalEvaluator;f=f||a.buildRegularExpressionsPatterns(b,h);d=r(d);b=0;for(var m=f.length;b<m;b++){c=f[b];l=!0;for(var k=0,q=c.length;k<q;k++)l=c[k].regExp?l&&!!d.match(new RegExp(r(c[k].regExp),"i")):l&&e(c[k],d,h);if(l)return 1}return 0};a.esCorrecto=function(b,d,h,f){h=h||a.externalEvaluator;f=f||a.buildRegularExpressionsPatterns(b,
h);b=0;for(var m=f.length;b<m;b++){c=f[b];l=!0;for(var k=0,q=c.length;k<q;k++)(p=c[k].regExp)?(c[k].ignoreAccents&&(d=r(d),p=r(p)),c[k].ignoreCaps&&(d=d.toLowerCase(),p=r(p).toLowerCase()),l=l&&!!d.match(p)):l=l=l&&e(c[k],d,h);if(l)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,f){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===f?"24c":f)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,f){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+
(void 0===f?"d00018":f)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f,e,r,p,c,k,l,b,h,d,v,q,u,A,n=function(b,d){this.r=this.g=this.b=0;this.a=1;this.evaluator=d;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]){e=[];r=this.splitComa(b.substring(1,b.length-1));b=0;for(d=r.length;b<d;b++)k=r[b],p=parseInt(k,16),k!==p.toString(16)&&k!=="0"+p.toString(16)?("["===k.charAt(0)&&"]"===k.charAt(k.length-1)&&(k=k.substring(1,k.length-1)),e.push(this.evaluator.parser.parse(k))):e.push(this.evaluator.parser.parse((p/
255).toString()));this.rExpr=e[0];this.gExpr=e[1];this.bExpr=e[2];this.aExpr=e[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};n.prototype.splitComa=function(a){c=[];for(var m=h=b=l=0,f=a.length;m<f;m++)d=a.charAt(m),"("===d?l++:")"===d?l--:"["===d?b++:"]"===d?b--:","===d&&0===l&&0===b&&(c.push(a.substring(h,m)),h=m+1);c.push(a.substring(h));return c};n.prototype.getColorStr=function(){return this.colorStr};n.prototype.getColorExp=function(){f=
this.evaluator;this.r=g(255*f.eval(this.rExpr));this.g=g(255*f.eval(this.gExpr));this.b=g(255*f.eval(this.bExpr));this.a=1-f.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};n.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(",");v=parseInt(a[0]).toString(16);q=parseInt(a[1]).toString(16);u=parseInt(a[2]).toString(16);A=(255-
parseInt(255*parseFloat(a[3]))).toString(16);1===v.length&&(v="0"+v);1===q.length&&(q="0"+q);1===u.length&&(u="0"+u);1===A.length&&(A="0"+A);return new n(A+v+q+u)};a.Color=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=document.head,f=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});g.appendChild(f);f=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||g.appendChild(f);f=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});g.appendChild(f);f=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});g.appendChild(f);
f=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});g.appendChild(f);(g=document.getElementById("StyleDescartesApps2"))&&g.remove();g=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(g,document.head.firstChild);g.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\ninput[type='text']:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.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;outline: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.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sin,f=Math.floor,e=Math.random,r=Math.round,p=Math.abs,c=String.fromCharCode,k,l,b,h,d,v,q,u,A,n,m=function(a){this.key=(void 0===a?0:a).toString()};m.prototype.getKey=function(a){k=[];for(var b=0;256>b;b++)k[b]=c(this.alfanum(f(p(7.5*(g(1*b-a)+g(1.4*b+a)+g(.6*b-a)+g(2.2*b+a))))));return k.join("")};m.prototype.encode=function(a){l=f(31*e());this.key=this.getKey(l);return c(this.alfanum(l))+this.encripta(a)};m.prototype.decode=function(a){l=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(l);return this.desencripta(a.substring(1))};m.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};m.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var b=0,d=a.length;b<d;b++)A=256*f(a[b]+128)+r(255*e())+65536*r(255*e()),n=f((A<<this.shift(b))/256),v[3*b]=this.alfanum(n%32),v[3*b+1]=this.alfanum(n/32%32),v[3*b+2]=this.alfanum(n/1024%32);return v};m.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};m.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;q=Array(a.length/3);for(var b=0,d=q.length;b<d;b++)n=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),A=f(256*n>>this.shift(b)),u=f(A/256)%256-128,0>u&&(u+=256),q[b]=u;return q};m.prototype.alfanum=function(a){return(10>a?48:87)+f(a)};m.prototype.numalfa=function(a){return a-(58>a?48:87)};m.prototype.stringToBytes=
function(a){h=[];for(var b=0,d=a.length;b<d;b++)h.push(a.charCodeAt(b));return h};m.prototype.bytesToString=function(a){for(var b=0,d=a.length;b<d;b++)a[b]=c(a[b]);return a.join("")};m.prototype.shift=function(a){b=this.key.charCodeAt(a%this.key.length);h=this.numalfa(b);d=f(h/2%8);0==d&&(d=4);return d};m.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){this.parent=f;var g=f.evaluator,p=g.parser;f=new a.Auxiliary(f);var c=this;c.delay=e.delay?p.parse(e.delay):p.parse("60");c.loop=e.loop?e.loop:!1;c.auto=void 0==e.auto?!0:e.auto;c.controls=e.controls;c.init=f.splitInstructions(p,e.init);c.doExpr=f.splitInstructions(p,e.doExpr);e.whileExpr&&(c.whileExpr=p.parse(e.whileExpr));var k,l=c.doExpr.length;c.animExec=function(){for(k=0;k<l;k++)g.eval(c.doExpr[k]);c.parent.update();c.playing&&
(0<g.eval(c.whileExpr)||c.loop)?c.timer=a.setTimeout(c.animExec,g.eval(c.delay)):(c.stop(),c.pause=!1,c.parent.update())};c.playing=!1;c.auto&&c.play()};g.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))))};g.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};g.prototype.reinit=function(){for(var a=0,e=this.init.length;a<
e;a++)this.parent.evaluator.eval(this.init[a])};a.Animation=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(a,e){this.parent=a;this.evaluator=this.parent.evaluator};g.prototype.execute=function(){};a.Action=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){f=a.Action.call(this,f,e)||this;f.parameter=(e||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return f};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){alert(this.parameter)};a.Message=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){f=a.Action.call(this,f,e)||this;var g=f.evaluator,p=g.parser;e=a.splitSeparator((e||"").replace(/&squot;/g,"'"));for(var c=[],k,l=0,b=e.length;l<b;l++)(k=p.parse(e[l],!0))&&c.push(k);b=c.length;f.execute=function(){for(l=0;l<b;l++)g.eval(c[l])};return f};$jscomp.inherits(g,a.Action);a.Calculate=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){var g=a.Action.call(this,f,e)||this;g.parser=f.evaluator.parser;g.evaluator=f.evaluator;g.parameter=e;g.target="_blank";return g};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){var f=this.parameter;f.match(/^\[.*\]?/)&&(f=this.evaluator.eval(this.parser.parse(f.substring(1,f.length-1))));var e=f.indexOf("target");-1!=e&&(this.target=f.substring(e),this.target=this.target.substring(this.target.indexOf("=")+1),f=f.substring(0,
e-1));if("javascript"==f.substring(0,10)){f=new a.SimpleText(parent,f.substring(11).replace(/&squot;/g,"'"));try{eval(f.toString())}catch(r){}}else"http"!=f.substring(0,4)&&(e=window.__dirname||window.location.href,f=e.substring(0,e.lastIndexOf("/")+1)+f),window.open(f,this.target)};a.OpenURL=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){var g=a.Action.call(this,f,e)||this;g.parser=f.evaluator.parser;g.evaluator=f.evaluator;g.parameter=e.trim();g.target="_blank";return g};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var e=a.indexOf("target");-1!=e&&(this.target=a.substring(e),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
e-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(r){}}else"http"!=a.substring(0,4)&&(e=window.__dirname||window.location.href,a=e.substring(0,e.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=g;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){return a.Action.call(this,f,e)||this};$jscomp.inherits(g,a.Action);g.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=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){return a.Action.call(this,f,e)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.init()};a.Init=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){return a.Action.call(this,f,e)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.clear()};a.Clear=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){return a.Action.call(this,f,e)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.play()};a.Animate=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){return a.Action.call(this,f,e)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,f=function(e,f){e=a.Action.call(this,e,f)||this;f=f||"";f.match(g)?e.filenameExpr=e.evaluator.parser.parse("'"+f.match(g)+"'"):(f.match(/^\[.*\]?/)&&(f=f.substring(1,f.length-1)),e.filenameExpr=e.evaluator.parser.parse(f));return e};$jscomp.inherits(f,a.Action);f.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=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,f)};e.prototype.firstRun=function(){};e.prototype.update=function(){};e.prototype.splitInstructions=function(e,p){f=[];p=p?a.splitSeparator(p):[""];for(var c=0,k=p.length;c<k;c++)a.DEBUG.lineCount=c,(g=e.parse(p[c],!0))&&f.push(g);return f};e.prototype.getPrivateVariables=function(a,e){f=[];e=e?e.split(/;|,/):
[""];for(var c=0,k=e.length;c<k;c++)(g=a.parse(e[c],!0))&&f.push(g);c=0;for(k=f.length;c<k;c++)f[c]="assign"===f[c].type?f[c].childs[0].value:"identifier"===f[c].type?f[c].value:"";return f};e.prototype.parseExpressions=function(f){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(f,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(f,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(f,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
f.parse(this.whileExpr)};a.Auxiliary=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){f=a.Auxiliary.call(this,f,e)||this;e=f.evaluator.parser;f.expresionString=f.expresion;f.expresion=e.parse(f.expresionString);f.expresion&&e.setVariable(f.id,f.expresion);f.editable&&(f.registerTextField(),f.parent.editableRegionVisible=!0);return f};$jscomp.inherits(g,a.Auxiliary);g.prototype.registerTextField=function(){var f=a.newHTML("div"),e=a.newHTML("label");e.appendChild(document.createTextNode("___"+this.id+"=___"));var g=a.newHTML("input");
g.value=this.expresionString;g.disabled=!this.editable;f.appendChild(e);f.appendChild(g);var p=this,c=p.evaluator.parser;g.onkeydown=function(a){13==a.keyCode&&(p.expresion=c.parse(this.value),c.setVariable(p.id,p.expresion),p.parent.update())};this.parent.editableRegion.textFields.push({container:f,type:"div"})};a.Variable=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){f=a.Auxiliary.call(this,f,e)||this;f.expresion=f.evaluator.parser.parse(f.expresion);f.update();return f};$jscomp.inherits(g,a.Auxiliary);g.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p=function(c,k){k=a.Auxiliary.call(this,c,k)||this;g=c.evaluator;f=g.parser;k.size=k.size||f.parse("3");k.expresion=k.expresion.split(";");k.parseFile=f.parse(k.file);k.update();return k};$jscomp.inherits(p,a.Auxiliary);p.prototype.update=function(){var c=this.expresion,k;g=this.evaluator;f=g.parser;this.oldFile=this.file;if(e=g.eval(this.parseFile))this.file=e;if(this.file){r=(k=document.getElementById(this.file))&&"descartes/vectorFile"==
k.type?k.text:a.openExternalFile(this.file);if(null!=r){r=r.replace(/\r/g,"").split("\n");k=[];for(var l=0,b=r.length;l<b;l++)""!=r[l]&&k.push(r[l]);r=k}null==r||1==r.length&&""==r[0]?(r=[],this.size=f.parse("0")):(c=r,this.size=null);null===this.size&&(this.size=f.parse(c.length+""))}var h;k=[];l=0;for(b=c.length;l<b;l++)(h=f.parse(c[l],!0))&&"assign"!=h.type&&(h=f.parse(this.id+"["+l+"]="+c[l],!0)),k.push(h);c=parseInt(Math.abs(g.eval(this.size)));c=Array(c).fill(0);c._size_=c.length;g.vectors[this.id]=
c;g.setVariable(this.id+".long",c._size_);l=0;for(b=k.length;l<b;l++)g.eval(k[l])};a.Vector=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c=function(c,l){l=a.Auxiliary.call(this,c,l)||this;g=c.evaluator;f=g.parser;l.rows=l.rows||f.parse("3");l.columns=l.columns||f.parse("3");l.expresion=l.splitInstructions(f,l.expresion);e=g.eval(l.rows);r=g.eval(l.columns);p=[];p.type="matrix";c=0;for(var b=r;c<b;c++)p[c]=Array(e).fill(0);g.matrices[l.id]=p;l.update();return l};$jscomp.inherits(c,a.Auxiliary);c.prototype.update=function(){g=this.evaluator;e=g.eval(this.rows);r=g.eval(this.columns);
g.setVariable(this.id+".filas",e);g.setVariable(this.id+".columnas",r);p=g.matrices[this.id];p.rows=e;p.cols=r;for(var a=0,c=this.expresion.length;a<c;a++)g.eval(this.expresion[a])};a.Matrix=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){var g=a.Auxiliary.call(this,f,e)||this;var p=g.evaluator;f=p.parser;e=g.id.indexOf("(");g.name=g.id.substring(0,e);g.params=g.id.substring(e+1,g.id.indexOf(")"));g.domain=g.range?f.parse(g.range):f.parse("1");g.params=""===g.params?[]:g.params.split(",");g.numberOfParams=g.params.length;g.algorithm||(g.init="",g.doExpr="",g.whileExpr="");g.parseExpressions(f);g.expresion=f.parse(g.expresion);g.functionExec=function(){g.iterations=0;
if(g.numberOfParams<=arguments.length){for(var c=[],f=0,e=g.privateVars.length;f<e;f++)c.push(p.getVariable(g.privateVars[f])),p.setVariable(g.privateVars[f],0);var b=[];f=0;for(e=g.params.length;f<e;f++)b[f]=p.getVariable(g.params[f]),p.setVariable(g.params[f],arguments[f]);f=0;for(e=g.init.length;f<e;f++)p.eval(g.init[f]);do{f=0;for(e=g.doExpr.length;f<e;f++)p.eval(g.doExpr[f]);if(1E5<++g.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
g.name+" >>"),0}while(0<p.eval(g.whileExpr));var h=p.eval(g.expresion);a.rangeOK=p.eval(g.domain);f=0;for(e=g.params.length;f<e;f++)p.setVariable(g.params[f],b[f]);f=0;for(e=g.privateVars.length;f<e;f++)p.setVariable(g.privateVars[f],c[f]);return h}return 0};p.setFunction(g.name,g.functionExec);return g};$jscomp.inherits(g,a.Auxiliary);a.Function=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){var g=a.Auxiliary.call(this,f,e)||this;var p=g.evaluator;g.parseExpressions(p.parser);g.algorithmExec=function(){for(var a=g.iterations=0,f=g.init.length;a<f;a++)p.eval(g.init[a]);do{a=0;for(f=g.doExpr.length;a<f;a++)p.eval(g.doExpr[a]);if(1E5<++g.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+g.name+" >>"),0}while(0<p.eval(g.whileExpr))};return g};$jscomp.inherits(g,a.Auxiliary);
g.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){f=a.Auxiliary.call(this,f,e)||this;e=f.evaluator;delete f.evaluate;f.condition=e.parser.parse(f.condition);f.lastEvaluation=!1;f.action=f.parent.lessonParser.parseAction(f);"onlyOnce"==f.execution&&(f.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==f.execution&&(f.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"==f.execution&&(f.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return f};$jscomp.inherits(g,a.Auxiliary);g.prototype.update=function(){this.eventExec()};a.Event=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(f,e){var g=a.Auxiliary.call(this,f,e)||this;if(e=e.file){var p=document.getElementById(e);p=p&&"descartes/library"===p.type?p.text:a.openExternalFile(e)}if(p){p=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");e=0;for(var c=p.length;e<c;e++)""!==p[e].trim()&&f.lessonParser.parseAuxiliar(p[e])}return g};$jscomp.inherits(g,a.Auxiliary);a.Library=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b=function(b,d){this.parent=b;this.evaluator=b.evaluator;var h=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=h.parse("1");this.abs_coord=d.type&&"text"===d.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=h.parse("(0,0)");this.family="";this.family_interval=h.parse("[0,1]");this.family_steps=h.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=h.parse("2");Object.assign(this,d);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);
if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};b.prototype.getSpace=
function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};b.prototype.getFamilyValues=function(){g=this.evaluator;f=g.eval(this.family_interval);this.familyInf=f[0][0];this.familySup=f[0][1];this.fSteps=Math.round(g.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};b.prototype.drawFamilyAux=function(a,b,c){g=this.evaluator;this.getFamilyValues();e=g.getVariable(this.family);if(0<=this.fSteps)for(var d=
0,h=this.fSteps;d<=h;d++)g.setVariable(this.family,this.familyInf+d*this.family_sep),0<g.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,b,c));g.setVariable("_Text_H_",0);g.setVariable(this.family,e)};b.prototype.draw=function(a,b){""!==this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,b));this.ctx.setLineDash([])};b.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))};b.prototype.rotate=function(a,b,c){k=Math.cos(c);l=Math.sin(c);return{x:a*k-b*l,y:a*l+b*k}};b.prototype.dashStyle=function(){c=this.ctx;"dot"===this.lineDash?(c.lineCap="butt",c.setLineDash([c.lineWidth,c.lineWidth])):"dash"===this.lineDash?(c.lineCap="butt",c.setLineDash([4*c.lineWidth,3*c.lineWidth])):"dash_dot"===this.lineDash?(c.lineCap="butt",c.setLineDash([4*c.lineWidth,2*c.lineWidth,c.lineWidth,2*c.lineWidth])):c.setLineDash([])};b.prototype.drawText=
function(a,b,c,f,e,l,k,m,w,x,y){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=e.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:c,y:f},b.update(a,c,f,w,x,k,y,e.getColor());else for("simpleText"===b.type&&(b=b.toString(w,x).split("\\n")),g=this.evaluator,a.fillStyle=e.getColor(),a.font=l,a.textAlign=k,a.textBaseline=m,p=1.2*this.fontSize||0,e=0,l=b.length;e<l;e++)r=b[e],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(r,
c,f+p*e)),a.fillText(r,c,f+p*e)};a.Graphic=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l=function(a,h){this.text=h=h.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";g="'";r=e=0;for(p=-1;e<h.length;)c=h.charAt(e),k=h.charAt(e-1),"["===c&&"\\"===k?(this.textElements.push(h.substring(r,e-1)+"["),this.textElementsMacros.push("'"+h.substring(r,e-1)+"['"),r=e+1):"]"===c&&"\\"===k?(this.textElements.push(h.substring(r,
e-1)+"]"),this.textElementsMacros.push("'"+h.substring(r,e-1)+"]'"),r=e+1):"["===c&&-1===p?(this.textElements.push(h.substring(r,e)),this.textElementsMacros.push("'"+h.substring(r,e)+"'"),r=e,p++):"["===c?p++:"]"===c&&0===p?(this.textElements.push(this.evaluator.parser.parse(h.substring(r,e+1))),this.textElementsMacros.push("["+h.substring(r,e+1)+"]"),r=e+1,p--):("]"==h.charAt(e)&&(p=0>p?p:p-1),g+=h.charAt(e)),e++;this.textElements.push(h.substring(r,e));this.textElementsMacros.push("'"+h.substring(r,
e)+"'")};l.prototype.toString=function(b,c){g="";for(var d=0,h=this.textElements.length;d<h;d++)"string"===typeof this.textElements[d]?g+=this.textElements[d]:(f=this.evaluator.eval(this.textElements[d])[0][0],""!==f&&("string"===typeof f?g+=f:Infinity==f?g+="Infinity":-Infinity==f?g+="-Infinity":isNaN(f)||"NaN"==f?g+="NaN":(f=parseFloat(f),f=c?f.toFixed(b):a.removeNeedlessDecimals(f.toFixed(b)),g+=f.toString().replace(".",this.parent.decimal_symbol))));return g};a.SimpleText=l;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fillP=d.fillP||"";d.fillM=d.fillM||"";d.parseExpression();d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();v=new a.R2;q=new a.R2;u=new a.R2;m=new a.R2;A=new a.R2;d.cInd=0;return d};$jscomp.inherits(N,a.Graphic);N.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],d=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||d.contains("y")?"identifier"!=d.type||"y"!=d.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||d.contains("x")?"identifier"!=d.type||"x"!=d.value||b.contains("x")||(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};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,d){f=this.evaluator;this.getFamilyValues();tempParam=f.getVariable(this.family);if(0<=this.fSteps)for(var c=0,h=this.fSteps;c<=h;c++)f.setVariable(this.family,this.familyInf+c*this.family_sep),this.update(),
this.drawAux(a,b,d);f.setVariable(this.family,tempParam)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(K,Q,R){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;f=this.evaluator;e=f.parser;r=this.space;p=f.eval(this.width);K.strokeStyle=this.color.getColor();K.lineWidth=p;c=e.getVariable("x");k=e.getVariable("y");l=r.w+24;b=r.h+24;h=l/9;3>h&&(h=3);d=b/7;3>d&&(d=3);0==this.cInd?(g=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;v.set(0,0);q.set(0,0);u.set(0,0);P=.25;C=8;this.abs_coord||(P/=r.scale,C/=r.scale);K.beginPath();for(B=parseInt(d/2);B<b;B+=d)for(D=parseInt(h/2);D<l;D+=h){if(this.abs_coord){m.set(D,B);n=this.newt.findZero(m,P);if(null==n)continue;f.setVariable("x",n.x);f.setVariable("y",n.y);A.set(n.x,n.y)}else{m.set(r.getRelativeX(D),r.getRelativeY(B));n=this.newt.findZero(m,P);if(null==n)continue;f.setVariable("x",n.x);f.setVariable("y",n.y);A.set(r.getAbsoluteX(n.x),r.getAbsoluteY(n.y))}w=A.ix();x=A.iy();
if(-12<=w&&w<l+24&&-12<=x&&x<b+24){if(g[w+12+(x+12)*r.w]===this.cInd)continue;g[w+12+(x+12)*r.w]=this.cInd}a.rangeOK&&(K.moveTo(w,x),K.lineTo(w,x));v.x=n.x;v.y=n.y;q.x=n.x;q.y=n.y;y=this.newt.getUnitNormal();if(0!=y.x||0!=y.y)for(y.rotL90(),u.x=y.x,u.y=y.y,G=z=0,J=!1;2>G;)if(J&&(u.x=-y.x,u.y=-y.y,n.x=v.x,n.y=v.y,q.x=n.x,q.y=n.y,this.abs_coord?A.set(n.x,n.y):A.set(r.getAbsoluteX(n.x),r.getAbsoluteY(n.y)),w=A.ix(),x=A.iy(),J=!1,z=0),n.x+=C*u.x,n.y+=C*u.y,n=this.newt.findZero(n,P),null!=n){f.setVariable("x",
n.x);f.setVariable("y",n.y);u.x=n.x-q.x;u.y=n.y-q.y;u.normalize();if(0==u.x&&0==u.y)break;q.x=n.x;q.y=n.y;this.abs_coord?A.set(n.x,n.y):A.set(r.getAbsoluteX(n.x),r.getAbsoluteY(n.y));E=parseInt(A.ix());F=parseInt(A.iy());if(E!=w||F!=x)if(L=w,I=x,w=E,x=F,-12<=w&&w<l+24&&-12<=x&&x<b+24){z=0;M=g[w+12+(x+12)*r.w];g[w+12+(x+12)*r.w]=this.cInd;for(Q=1;8>Q;Q++)O=L+Math.round((w-L)*Q/8),H=I+Math.round((x-I)*Q/8),0<=O&&O<l&&0<=H&&H<b&&(g[O+12+(H+12)*r.w]=this.cInd);a.rangeOK&&(K.moveTo(L,I),K.lineTo(w,x));
if(M===this.cInd)break}else J=!0,G++;else 4<++z&&(J=!0,G++)}}K.stroke()}};N.prototype.X=function(a,b,d){d||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};N.prototype.Y=function(a,b,d){d||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};N.prototype.XX=function(a,b,d){return Math.round(this.X(a,b,d))};N.prototype.YY=function(a,b,d){return Math.round(this.Y(a,b,d))};N.prototype.extrapolate=
function(b,d,c,h,m,f){for(var e=this.evaluator.getVariable(d),l=f/2,q=0,g,k,n,p,u,v;1E-15<Math.abs(l);){g=this.evaluator.getVariable(d);k=this.evaluator.getVariable(d)+l;this.evaluator.setVariable(d,k);n=!0;try{p=m,m=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,m),0<this.evaluator.eval(b)?(u=new a.R2(Math.min(p,m),Math.max(p,m)),v=0,v=0<f?this.Singularity(Math.abs(l),d,h,g,p,k,m,u):this.Singularity(Math.abs(l),d,h,k,m,g,p,u),0<v&&(n=!1)):n=!1}catch(Z){n=!1}n?q+=l:this.evaluator.setVariable(d,
g);l/=2}this.evaluator.setVariable(d,e);return new a.R2(q/Math.abs(f),m)};N.prototype.extrapolateOnSingularity=function(b,d,c,h,m,f){h=this.evaluator.getVariable(d);for(var e=f/2,l=0,q=m,g;1E-15<Math.abs(e);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)+e);g=!0;if(0<this.evaluator.eval(b))try{q=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,q),0>=this.evaluator.eval(b)&&(g=!1)}catch(X){g=!1}else g=!1;g?l+=e:this.evaluator.setVariable(d,this.evaluator.getVariable(d)-e);
e/=2}if(0==l)for(e=f/2,l=f,q=m;1E-15<Math.abs(e);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)-e);g=!0;if(0<this.evaluator.eval(b))try{q=this.evaluator.eval(this.funExpr)}catch(X){g=!1}else g=!1;g?l+=-e:this.evaluator.setVariable(d,this.evaluator.getVariable(d)+e);e/=2}this.evaluator.setVariable(d,h);return new a.R2(l/Math.abs(f),q)};N.prototype.Singularity=function(a,b,d,c,h,m,f,e){if(isNaN(f)||isNaN(h)||isNaN(e.y)||isNaN(e.x)||c>=m)return 2;var l=this.evaluator.getVariable(b),q=0;
try{if(1E-15>Math.abs(m-c)||1E-12>Math.abs(m-c)&&Math.abs(f-h)>Math.abs(a))return this.evaluator.setVariable(b,l),1;var g=(c+m)/2;this.evaluator.setVariable(b,g);var k=NaN;try{k=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(k))return 5;if(Math.abs(f-h)>a){this.evaluator.setVariable(b,c-1E-12);var n=this.evaluator.eval(this.funExpr);n=(h-n)/1E-12;this.evaluator.setVariable(b,m+1E-12);var p=(this.evaluator.eval(this.funExpr)-f)/1E-12;if((10>Math.abs(p)||10>Math.abs(n))&&(0<=p&&0<=n||
0>=p&&0>=n)&&4*Math.abs(p)<Math.abs((f-h)/(m-c)))return this.evaluator.setVariable(b,l),2}if(isNaN(e.x)||isNaN(e.y)||isNaN(k))return 2;if(!(e.x<=k&&k<=e.y)){this.evaluator.setVariable(b,g);e.x=Math.min(h,k);e.y=Math.max(h,k);var u=this.Singularity(a/2,b,d,c,h,g,k,e);this.evaluator.setVariable(b,m);e.x=Math.min(f,k);e.y=Math.max(f,k);var v=this.Singularity(a/2,b,d,g,k,m,f,e);q=Math.max(u,v)}}catch(Y){q=1}this.evaluator.setVariable(b,l);return q};N.prototype.drawAuxFun=function(b,d,h){c=this.evaluator.parser.getVariable("x");
k=this.evaluator.parser.getVariable("y");a.rangeOK=1;d="x";var m="y";this.of_y&&(d="y",m="x");var f=this.drawif,e=this.evaluator.eval(this.width),l=!1,q=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),g=this.of_y?q.ix():q.iy(),n=0,p=0,u=0,v=0,y=1/this.space.scale;q=y*(this.of_y?-this.space.h+q.y:-q.x);var r=0;this.abs_coord&&(q=0,y=1);for(var A,G,w,B,I,F,x,z,D,R=this.of_y?this.space.h+2:this.space.w+2;u<=R;){A=!0;G=0;this.evaluator.setVariable(d,q);try{w=this.evaluator.eval(this.funExpr),
isNaN(w)||(this.evaluator.setVariable(m,w),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(l?(B=Math.min(r,w),I=Math.max(r,w),F=new a.R2(B,I),G=this.Singularity(y,d,0,q-y,r,q,w,F),0===G?(r<=w?(r=F.x,w=F.y):(w=F.x,r=F.y),x=parseInt(this.of_y?this.XX(e,r,this.abs_coord):this.YY(e,r,this.abs_coord)),n=this.abs_coord?Math.round(w):parseInt(this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord)),this.fillM&&n>g&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(g+
1,this.space.h-u+.5),b.lineTo(n,this.space.h-u+.5)):(b.moveTo(u+.5,g+1),b.lineTo(u+.5,n)),b.stroke()),this.fillP&&n<g&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(g-1,this.space.h-u+.5),b.lineTo(n,this.space.h-u+.5)):(b.moveTo(u+.5,g-1),b.lineTo(u+.5,n)),b.stroke()),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(x+.5,this.space.h-v),b.lineTo(n+.5,this.space.h-u)):(b.moveTo(v+.5,x),b.lineTo(u+.5,n)),b.stroke()):1===G?(this.evaluator.setVariable(d,
q-y),z=this.extrapolate(f,d,m,0,r,y),n=this.of_y?this.XX(e,z.y,this.abs_coord):this.YY(e,z.y,this.abs_coord),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-v),b.lineTo(n+.5,this.space.h-v+Math.round(z.x))):(b.moveTo(v+.5,p),b.lineTo(v+Math.round(z.x)+.5,n)),this.evaluator.setVariable(d,q),D=this.extrapolate(f,d,m,0,w,-y),p=this.of_y?this.XX(e,D.y,this.abs_coord):this.YY(e,D.y,this.abs_coord),n=this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord),
b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(n+.5,this.space.h-u)):(b.moveTo(u+.5,p),b.lineTo(u+.5,n)),b.stroke()):2===G&&(n=this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(n+.5,this.space.h-u)):(b.moveTo(u+.5,p),b.lineTo(u+.5,n)))):(D=this.extrapolateOnSingularity(f,d,m,0,w,-y),p=this.of_y?this.XX(e,D.y,this.abs_coord):
this.YY(e,D.y,this.abs_coord),n=this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(u+Math.round(D.x))+.5),b.lineTo(n,this.space.h-u+.5)):(b.moveTo(u+Math.round(D.x),p),b.lineTo(u,n)),b.stroke()),r=w):A=!1)}catch(aa){A=!1}l&&!A&&(this.evaluator.setVariable(d,q-y),this.evaluator.setVariable(m,r),z=this.extrapolate(f,d,m,0,r,y),n=parseInt(this.of_y?this.XX(e,z.y,this.abs_coord):this.YY(e,z.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(v+Math.round(z.x))+.5),b.lineTo(n,this.space.h-(v+Math.round(z.x))+.5)):(b.moveTo(v+Math.round(z.x)+.5,p),b.lineTo(v+Math.round(z.x)+.5,n)),b.stroke()),this.evaluator.setVariable(d,q));l=A;q+=y;p=n;v=u++}this.evaluator.parser.setVariable("x",c);this.evaluator.parser.setVariable("y",k)};N.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;
b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parseExpression(),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Equation=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,f,e,r,p,c,k,l,b=function(b,d){d=a.Graphic.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(b,a.Graphic);b.prototype.update=
function(){f=this.evaluator;e=f.eval(this.parameter_interval);this.paraInf=e[0][0];this.paraSup=e[0][1];this.pSteps=f.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};b.prototype.drawAux=function(b,d,e){f=this.evaluator;r=this.space;b.lineWidth=Math.max(1E-6,g(f.eval(this.width)));
b.lineCap=b.lineJoin="round";b.strokeStyle=e.getColor();p=f.getVariable(this.parameter);b.beginPath();f.setVariable(this.parameter,this.paraInf);c=f.eval(this.expresion);this.exprX=g(this.abs_coord?c[0][0]:r.getAbsoluteX(c[0][0]));this.exprY=g(this.abs_coord?c[0][1]:r.getAbsoluteY(c[0][1]));this.rotateExp&&(k=a.degToRad(f.eval(this.rotateExp)),l=this.rotate(c[0][0],c[0][1],k),this.exprX=g(this.abs_coord?l.x:r.getAbsoluteX(l.x)),this.exprY=g(this.abs_coord?l.y:r.getAbsoluteY(l.y)));b.moveTo(this.exprX+
.5,this.exprY+.5);for(e=1;e<=this.pSteps;e++)f.setVariable(this.parameter,this.paraInf+e*this.paraSep),c=f.eval(this.expresion),this.rotateExp&&(l=this.rotate(c[0][0],c[0][1],k),c[0][0]=l.x,c[0][1]=l.y),this.exprX=g(this.abs_coord?c[0][0]:r.getAbsoluteX(c[0][0])),this.exprY=g(this.abs_coord?c[0][1]:r.getAbsoluteY(c[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&b.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(b.fillStyle=d.getColor(),
b.fill("evenodd"));this.dashStyle();b.stroke();b.setLineDash([]);f.setVariable(this.parameter,p)};b.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Curve=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,f=Math.round,e,r,p,c,k,l,b,h,d,v,q=function(b,d){d=a.Graphic.call(this,b,d)||this;d.size=d.size||b.evaluator.parser.parse("2");d.range=d.range||b.evaluator.parser.parse("[1, 100]");d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){e=this.evaluator;p=e.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&
(c=this.rotate(p[0][0],p[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y);b=e.eval(this.range);this.rangeInf=b[0][0];this.rangeMax=b[0][1]};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(b,c){e=this.evaluator;r=this.space;d=h=Math.ceil(e.eval(this.size)-.4);b.fillStyle=c.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);c=e.getVariable("n");for(var q=this.rangeInf,m=this.rangeMax;q<=m;q++)e.setVariable("n",q),p=e.eval(this.expresion),this.exprX=p[0][0],this.exprY=p[0][1],k=f(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX)),l=f(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(k,l,h,0,g,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,e.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,k+d,l-d,this.color,this.font,"start","alphabetic",e.eval(this.decimals),this.fixed,!0));e.setVariable("n",c)};q.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};
a.Sequence=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,f=Math.round,e,r,p,c,k,l,b,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(){e=this.evaluator;p=e.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&(c=this.rotate(p[0][0],p[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.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,c){r=this.space;a.fillStyle=c.getColor();k=f(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX));l=f(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY));b=f(this.evaluator.eval(this.size));0<b&&(a.beginPath(),a.arc(k,l,b,0,g),a.fill());this.text.hasContent&&this.text.draw(a,c,k,l)};a.Point=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,f=2*Math.PI,e,r,p,c,k,l,b,h,d,v,q=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.size=d.size||b.evaluator.parser.parse("2");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){e=this.evaluator;p=e.eval(this.expresion);this.endPoints=[];for(var b=0,d=p.length;b<d;b++)this.endPoints[b]={x:p[b][0],y:p[b][1]};if(this.rotateExp)for(c=a.degToRad(e.eval(this.rotateExp)),
b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,c)};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,c,q){e=this.evaluator;r=this.space;a.lineWidth=Math.max(1E-6,g(e.eval(this.width)));k=e.eval(this.size);a.fillStyle=c.getColor();a.strokeStyle=q.getColor();a.lineCap="round";l=
0==a.lineWidth%2?0:.5;this.abs_coord?(b=g(this.endPoints[0].x),h=g(this.endPoints[0].y),d=g(this.endPoints[1].x),v=g(this.endPoints[1].y)):(b=g(r.getAbsoluteX(this.endPoints[0].x)),h=g(r.getAbsoluteY(this.endPoints[0].y)),d=g(r.getAbsoluteX(this.endPoints[1].x)),v=g(r.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(b+l,h+l);a.lineTo(d+l,v+l);this.dashStyle();a.stroke();0<k&&(a.beginPath(),a.arc(b,h,k,0,f),a.arc(d,v,k,0,f),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
q,parseInt((b+d)/2)-3,parseInt((h+v)/2)+3)};a.Segment=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f=Math.round,e,r,p,c,k,l,b,h,d,v,q,u,A,n=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("5");d.size=d.size||b.evaluator.parser.parse("2");d.spear=d.spear||b.evaluator.parser.parse("8");d.arrow=d.arrow||new a.Color("ee0022");d.text=new a.TextObject(d,d.text);d.endPoints=[];d.vect=new a.Vector2D(0,0);return d};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){e=this.evaluator;r=e.eval(this.expresion);
for(var b=0,d=r.length;b<d;b++)this.endPoints[b]={x:r[b][0],y:r[b][1]};if(this.rotateExp)for(p=a.degToRad(e.eval(this.rotateExp)),b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,p)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};n.prototype.drawAux=function(a,n,p){e=this.evaluator;c=this.space;k=Math.max(0,
e.eval(this.width));l=Math.ceil(k/2);b=c.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;h=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=n.getColor();a.strokeStyle=p.getColor();a.lineWidth=2;this.abs_coord?(d=f(this.endPoints[0].x),v=f(this.endPoints[0].y),q=f(this.endPoints[1].x),u=f(this.endPoints[1].y)):(d=f(c.getAbsoluteX(this.endPoints[0].x)),v=f(c.getAbsoluteY(this.endPoints[0].y)),q=f(c.getAbsoluteX(this.endPoints[1].x)),
u=f(c.getAbsoluteY(this.endPoints[1].y)));A=Math.max(0,e.eval(this.spear));a.save();a.translate(d,v);this.abs_coord?a.rotate(this.angle):(h*=b,a.rotate(-this.angle));a.beginPath();a.moveTo(-l,g(-l));a.lineTo(g(h-A-k),g(-l));a.lineTo(g(h-2*A),g(-A-l));a.lineTo(g(h),0);a.lineTo(g(h-2*A),g(A+l));a.lineTo(g(h-A-k),g(l));a.lineTo(-l,g(l));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,p,parseInt((d+q)/2)-3,parseInt((v+u)/2)+3)};a.Arrow=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,f,e,r,p,c,k,l=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.endPoints=[];return c};$jscomp.inherits(l,a.Graphic);l.prototype.update=function(){f=this.evaluator;r=f.eval(this.expresion);for(var b=0,c=r.length;b<c;b++)this.endPoints[b]={x:r[b][0],y:r[b][1]};if(this.rotateExp)for(p=a.degToRad(f.eval(this.rotateExp)),b=0,c=this.endPoints.length;b<c;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,
this.endPoints[b].y,p)};l.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};l.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};l.prototype.drawAux=function(a,h,d){f=this.evaluator;e=this.space;a.lineWidth=Math.max(1E-6,g(f.eval(this.width)));a.strokeStyle=d.getColor();a.lineCap=a.lineJoin="round";c=g(this.abs_coord?this.endPoints[0].x:e.getAbsoluteX(this.endPoints[0].x));k=g(this.abs_coord?this.endPoints[0].y:e.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(c+0,k+0);d=1;for(var b=this.endPoints.length;d<b;d++)c=g(this.abs_coord?this.endPoints[d].x:e.getAbsoluteX(this.endPoints[d].x)),k=g(this.abs_coord?this.endPoints[d].y:e.getAbsoluteY(this.endPoints[d].y)),a.lineTo(c+0,k+0);this.fill&&(a.fillStyle=h.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,f=Math.min,e=Math.max,r=Math.abs,p,c,k,l,b,h,d,v,q,u,A=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.border_radius=d.border_radius||b.evaluator.parser.parse("0");d.endPoints=[];return d};$jscomp.inherits(A,a.Graphic);A.prototype.update=function(){p=this.evaluator;l=p.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.w=150;this.h=100;this.rotateExp&&(k=this.rotate(l[0][0],
l[0][1],a.degToRad(p.eval(this.rotateExp))),this.exprX=k.x,this.exprY=k.y);4<=l[0].length&&(this.w=l[0][2],this.h=l[0][3]);l[1]&&2==l[1].length&&(this.w=l[1][0],this.h=l[1][1]);this.w=e(0,this.w);this.h=e(0,this.h)};A.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};A.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};A.prototype.drawAux=function(a,m,l,k){p=this.evaluator;c=this.space;a.lineWidth=Math.max(1E-6,g(p.eval(this.width)));
a.strokeStyle=l.getColor();a.lineCap="round";a.lineJoin="miter";b=g(this.abs_coord?this.exprX:c.getAbsoluteX(this.exprX))+0;h=g(this.abs_coord?this.exprY:c.getAbsoluteY(this.exprY))+0;d=this.abs_coord?this.w:this.w*c.scale;v=this.abs_coord?this.h:-this.h*c.scale;q=f(e(0,p.eval(this.border_radius)),.5*r(d),.5*r(v));u=this.abs_coord?1:-1;a.beginPath();0!==q?(a.moveTo(b+q,h),a.lineTo(b+d-q,h),a.quadraticCurveTo(b+d,h,b+d,h+u*q),a.lineTo(b+d,h+v-u*q),a.quadraticCurveTo(b+d,h+v,b+d-q,h+v),a.lineTo(b+q,
h+v),a.quadraticCurveTo(b,h+v,b,h+v-u*q),a.lineTo(b,h+u*q),a.quadraticCurveTo(b,h,b+q,h),a.lineTo(b+q,h)):(a.moveTo(b,h),a.lineTo(b+d,h),a.lineTo(b+d,h+v),a.lineTo(b,h+v),a.lineTo(b,h));this.fill&&(a.fillStyle=m.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,f=Math.min,e=Math.max,r=Math.acos,p=Math.sqrt,c=Math.PI,k=c/2,l=2*c,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.center=d.center||b.evaluator.parser.parse("(0,0)");d.radius=d.radius||b.evaluator.parser.parse("1");d.init=d.init||"0";d.end=d.end||"90";d.init.match(/^_\(/)&&(d.initFlag=!0,d.init=d.init.substring(1));d.end.match(/^_\(/)&&
(d.endFlag=!0,d.end=d.end.substring(1));d.initExpr=b.evaluator.parser.parse(d.init);d.endExpr=b.evaluator.parser.parse(d.end);d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(I,a.Graphic);I.prototype.update=function(){b=this.evaluator;h=b.eval(this.center);this.exprX=h[0][0];this.exprY=h[0][1];d=0;this.rotateExp&&(d=a.degToRad(b.eval(this.rotateExp)),v=Math.cos(d),q=Math.sin(d),u=this.exprX*v-this.exprY*q,A=this.exprX*q+this.exprY*v,this.exprX=u,this.exprY=A);var g=b.eval(this.initExpr),
B=b.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(n=g[0][0],m=g[0][1],w=B[0][0],x=B[0][1],this.vectors?this.abs_coord&&(m=-m,x=-x):(n-=this.exprX,m=-m+this.exprY,w-=this.exprX,x=-x+this.exprY,this.abs_coord||(m=-m,x=-x)),y=0==n?0>m?3*k:k:r(1*n/p(n*n+m*m)),z=0==w?0>x?3*k:k:r(1*w/p(w*w+x*x)),y+=d,z+=d,0<n&&0<m&&this.abs_coord&&(y=l-y),0<n&&0>m&&!this.abs_coord&&(y=l-y),0>n&&0>m&&!this.abs_coord&&(y=l-y),0>n&&0<m&&this.abs_coord&&
(y=l-y),0<w&&0<x&&this.abs_coord&&(z=l-z),0<w&&0>x&&!this.abs_coord&&(z=l-z),0>w&&0>x&&!this.abs_coord&&(z=l-z),0>w&&0<x&&this.abs_coord&&(z=l-z),this.initFlag?(G=y,y=z,z=G):(G=f(y,z),J=e(y,z),y=G,z=J,z-y>c&&this.abs_coord&&(y=J,z=G),z-y<=c&&!this.abs_coord&&(y=J,z=G)),this.iniAng=y,this.endAng=z,this.drawPoints=!0):(this.iniAng=a.degToRad(g)+d,this.endAng=a.degToRad(B)+d,this.drawAngle=!0)};I.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};I.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};I.prototype.drawAux=function(a,d,c){b=this.evaluator;E=this.space;B=Math.max(0,b.eval(this.radius));a.lineWidth=Math.max(1E-6,g(b.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(F=g(this.exprX),D=g(this.exprY)):(F=g(E.getAbsoluteX(this.exprX)),D=g(E.getAbsoluteY(this.exprY)),B*=E.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(L=this.iniAng,this.iniAng=
this.endAng,this.endAng=L);this.fill&&(a.fillStyle=d.getColor(),a.beginPath(),a.moveTo(F,D),a.arc(F,D,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(F,D,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,F,D)};a.Arc=I;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c=function(c,e){e=a.Graphic.call(this,c,e)||this;e.width=e.width||c.evaluator.parser.parse("0");e.align||(e.align="left");e.anchor||(e.anchor="top_left");e.shadowColor=e.shadowColor?e.shadowColor.getColor():"transparent";e.text=new a.TextObject(e,e.text);return e};$jscomp.inherits(c,a.Graphic);c.prototype.update=function(){g=this.evaluator;f=g.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1];this.rotateExp&&(e=this.rotate(f[0][0],
f[0][1],a.degToRad(g.eval(this.rotateExp))),this.exprX=e.x,this.exprY=e.y)};c.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};c.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};c.prototype.drawAux=function(a,c){this.abs_coord?(r=parseInt(this.exprX),p=parseInt(this.exprY)):(r=parseInt(this.space.getAbsoluteX(this.exprX)),p=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,c,r,p)};a.Text=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,f,e,r,p,c,k,l,b,h,d,v,q=function(b,d){d=a.Graphic.call(this,b,d)||this;d.file=d.file||"";d.inirot=d.inirot||b.evaluator.parser.parse("0");d.img=new Image;d.scaleX=d.scaleY=1;d.ratio=b.ratio;b=d.expresion.getChildren();d.x_e=b[0];d.y_e=b[1];2<b.length&&(d.centered=!0,d.s_x_e=b[2],d.s_y_e=3<b.length?b[3]:b[2]);d.evaluator.eval(d.clip)&&(d.clip=d.clip.getChildren());d.update();return d};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){f=
this.evaluator;var b=f.eval(this.x_e),d=f.eval(this.y_e);this.exprX=b;this.exprY=d;this.rotateExp&&(e=this.rotate(b,d,a.degToRad(f.eval(this.rotateExp))),this.exprX=e.x,this.exprY=e.y);this.centered&&(this.scaleX=f.eval(this.s_x_e),this.scaleY=f.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));var c=this;if((r=f.eval(this.file))||""==r)this.img=this.parent.getImage(r),this.img.addEventListener("load",function(a){c.space.update(!0)})};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};
q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};q.prototype.drawAux=function(e){f=this.evaluator;p=this.space;this.img&&this.img.ready&&this.img.complete&&(this.clip?(d=f.eval(this.clip[2]),v=f.eval(this.clip[3])):(d=this.img.width,v=this.img.height),this.img.canvas&&(d=g(d/this.ratio),v=g(v/this.ratio)),c=this.centered?0:g(d/2),k=this.centered?0:g(v/2),l=g(this.abs_coord?this.exprX:p.getAbsoluteX(this.exprX)),b=g(this.abs_coord?this.exprY:p.getAbsoluteY(this.exprY)),h=
a.degToRad(-f.eval(this.inirot)),e.save(),e.translate(l+c,b+k),e.rotate(h),this.opacity&&(e.globalAlpha=f.eval(this.opacity)),e.scale(this.scaleX,this.scaleY),this.clip?e.drawImage(this.img,f.eval(this.clip[0]),f.eval(this.clip[1]),d,v,-d/2,-v/2,d,v):e.drawImage(this.img,-d/2,-v/2,d,v),e.restore())};a.Image=q;return a}(descartesJS||{});
descartesJS=function(a){function g(a,b,c){l=4*(b+c*a.width);return{r:a.data[l],g:a.data[l+1],b:a.data[l+2],a:a.data[l+3]}}if(a.loadLib)return a;var f,e,r,p,c,k,l,b,h=function(b,c){return a.Graphic.call(this,b,c)||this};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){f=this.evaluator.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1]};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,h){h.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(e=parseInt(this.exprX),r=parseInt(this.exprY)):(e=parseInt(this.space.getAbsoluteX(this.exprX)),r=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>e||0>r||e>=this.space.w||r>=this.space.h)){p=[[e,r]];k=g(imageData,e,r);for(b=0;0<p.length;){b++;c=p.pop();e=c[0];r=c[1];var d=g(imageData,e,r);if(k.r===d.r&&k.g===d.g&&k.b===d.b&&k.a===d.a){d=imageData;var f=
h;l=4*(e+r*d.width);d.data[l+0]=f.r;d.data[l+1]=f.g;d.data[l+2]=f.b;d.data[l+3]=255*f.a;0<e&&p.push([e-1,r]);e<imageData.width-1&&p.push([e+1,r]);p.push([e,r-1]);p.push([e,r+1])}if(b>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=h;return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var f=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,r,p=function(c,k){var l=a.Graphic.call(this,c,k)||this;l.hasExpresion=l.hasExpresion||!1;l.inirot=l.inirot||c.evaluator.parser.parse("0");l.inipos=l.inipos||c.evaluator.parser.parse("(0,0)");Object.assign(l,k);l.hasExpresion=void 0!==l.expresion;l.graphics=[];c=c.lessonParser;var b=new a.Tokenizer;if(!l.hasExpresion)return l;
"'"!==l.expresion.charAt(0)&&(l.expresion="'"+l.expresion+"'");l.expresion=l.evaluator.parser.parse(l.expresion);k=l.evaluator.eval(l.expresion);if(k)var h=(h=document.getElementById(k))&&"descartes/macro"==h.type?h.text:a.openExternalFile(k);if(h){var d=a.convertHTMLEntities(h).replace(/\r/g,"").split("\n");h=[];k=0;for(var p=d.length;k<p;k++)if(d[k].trim()){var q=d[k].indexOf("=");if(-1!==q){q=c.split(d[k]);for(var u=0,r=q.length;u<r;u++)if(q[u]&&1<q.length&&("id"===g[q[u][0]]||"type"===g[q[u][0]])){h.push(q);
break}}}u=function(d,c){c=b.tokenize(c.replace(/&squot;/g,"'"));for(var h=0,m=c.length;h<m;h++)if("identifier"==c[h].type&&!a.reservedIds.match("-"+c[h].value+"-")||"R"===c[h].value||"G"===c[h].value||"B"===c[h].value)c[h].value=l.name+"."+c[h].value;return(d.match(/^\\expr/)?"\\expr ":"\\decimals ")+b.flatTokens(c)};k=0;for(p=h.length;k<p;k++){var n=(r=h[k]||[],r[0])&&"id"===r[0][0];d=0;for(q=r.length;d<q;d++){var m=r[d][0].indexOf(".");-1===m||n?m=g[r[d][0]]:(m=g[r[d][0].substring(m+1)],r[d][0]=
l.name+"."+r[d][0]);if(!("font"===m||"font_family"===m||("fill"===m||"color"===m||"border"===m||"arrow"===m)&&"("!==r[d][1].charAt(0)||"file"===m&&r[d][1].match(e)||"id"!==m&&void 0!==g[r[d][1]])||"radius"===m)if("text"==m)if(r[d][1].match(/\{\\rtf1/))m=r[d][1],m=m.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),m=m.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),r[d][1]=m;else{var w=c.parseText(r[d][1]).textElementsMacros;for(var x=0,y=w.length;x<
y;x++){m=b.tokenize(w[x].replace(/&squot;/g,"'"));for(var z=0,G=m.length;z<G;z++)if("identifier"===m[z].type&&!a.reservedIds.match("-"+m[z].value+"-")||"R"===m[z].value||"G"===m[z].value||"B"===m[z].value)m[z].value=l.name+"."+m[z].value;m=b.flatTokens(m).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");w[x]=m.substring(1,m.length-1)}r[d][1]=w.join("")}else{w=r[d][1].replace(/&squot;/g,"'").split(";");x=0;for(y=w.length;x<y;x++){m=b.tokenize(w[x].replace(/\\n/g,";"));z=0;for(G=
m.length;z<G;z++)if("identifier"===m[z].type&&!a.reservedIds.match("-"+m[z].value+"-")||"R"===m[z].value||"G"===m[z].value||"B"===m[z].value)m[z].value=l.name+"."+m[z].value;w[x]=b.flatTokens(m)}r[d][1]=w.join(";")}}}k=0;for(p=h.length;k<p;k++)if(h[k][0]){u="";r=!1;d=0;for(q=h[k].length;d<q;d++)"type"===g[h[k][d][0]]&&f.match("-"+g[h[k][d][1]]+"-")&&(r=!0),u=u+h[k][d][0]+"='"+h[k][d][1]+"' ";h[k]=u+(r?" space='"+l.spaceID+"'":"");r?l.graphics.push(c.parseGraphic(h[k],l.abs_coord,l.background,l.inirot)):
c.parseAuxiliar(h[k])}}return l};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){r=this.evaluator.eval(this.inipos);this.iniPosX=r[0][0];this.iniPosY=r[0][1]};p.prototype.drawAux=function(a){for(var c=0,e=this.graphics.length;c<e;c++)this.graphics[c]&&(a.save(),this.graphics[c].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[c].draw(),a.restore())};a.Macro=p;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sqrt,f=Math.sin,e=Math.cos,r=Math.abs,p,c,k,l,b,h,d,v,q,u,A,n,m,w,x,y=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=c||0;this.adjustDec()};y.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var z=function(a,b,d,c,h,m,e,f,q,g,l,k,n,p,u,v){this.a00=a||0;this.a01=b||0;this.a02=d||0;this.a03=c||0;this.a10=h||0;this.a11=m||0;this.a12=e||0;this.a13=f||0;
this.a20=q||0;this.a21=g||0;this.a22=l||0;this.a23=k||0;this.a30=n||0;this.a31=p||0;this.a32=u||0;this.a33=v||0};z.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};z.prototype.multiplyVector4=function(a){return new y(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};z.prototype.translate=function(a){return new z(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)};z.prototype.rotateX=function(a){c=f(a);k=e(a);v=this.a10;q=this.a11;u=this.a12;
A=this.a13;n=this.a20;m=this.a21;w=this.a22;x=this.a23;return new z(this.a00,this.a01,this.a02,this.a03,v*k+n*c,q*k+m*c,u*k+w*c,A*k+x*c,v*-c+n*k,q*-c+m*k,u*-c+w*k,A*-c+x*k,this.a30,this.a31,this.a32,this.a33)};z.prototype.rotateY=function(a){c=f(a);k=e(a);l=this.a00;b=this.a01;h=this.a02;d=this.a03;n=this.a20;m=this.a21;w=this.a22;x=this.a23;return new z(l*k+n*-c,b*k+m*-c,h*k+w*-c,d*k+x*-c,this.a10,this.a11,this.a12,this.a13,l*c+n*k,b*c+m*k,h*c+w*k,d*c+x*k,this.a30,this.a31,this.a32,this.a33)};z.prototype.rotateZ=
function(a){c=f(a);k=e(a);l=this.a00;b=this.a01;h=this.a02;d=this.a03;v=this.a10;q=this.a11;u=this.a12;A=this.a13;return new z(l*k+v*c,b*k+q*c,h*k+u*c,d*k+A*c,l*-c+v*k,b*-c+q*k,h*-c+u*k,d*-c+A*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return g(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,d){return r(a.x-b.x)<=d&&r(a.y-b.y)<=d&&r(a.z-b.z)<=d};a.Vector4D=y;a.Matrix4x4=z;return a}(descartesJS||{});
descartesJS=function(a){function g(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,c),a.fill(),a.stroke())}function f(a,b){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);q=1;for(u=this.projVert.length;q<u;q++)a.lineTo(this.projVert[q].x,this.projVert[q].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=b.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function e(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";d=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,d)}function r(a){a.textNode=null;a.lineCap=k;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,d,c){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
d),a.subtract3D(b,c)))}if(a.loadLib)return a;var c=2*Math.PI,k=lineJoin="round",l,b,h,d,v,q,u,A,n,m,w,x,y,z=function(a,b){Object.assign(this,a);this.space=b;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=g:"face"===this.type?(this.normal=p(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=f):"text"===this.type?this.draw=e:"edge"===this.type&&(this.draw=r);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};z.prototype.computeDepth=function(b){this.space=b;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};q=0;for(u=this.vertices.length;q<u;q++)this.spaceVertices[q]=b.rotateVertex(this.vertices[q]),this.average.x+=this.spaceVertices[q].x,this.average.y+=this.spaceVertices[q].y,this.average.z+=this.spaceVertices[q].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=b.project(this.average);this.depth=a.norm3D(a.subtract3D(b.eye,this.average));2<this.vertices.length&&(this.normal=p(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));q=0;for(u=this.vertices.length;q<u;q++)this.newSpaceVert[q]=this.spaceVertices[q],this.projVert[q]=this.newProjVert[q]=b.project(this.spaceVertices[q]);2<this.vertices.length&&(this.direction=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;q=0;for(u=this.vertices.length;q<u;q++)A=a.norm3D(a.subtract3D(this.spaceVertices[q],b.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,A),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,A);q=0;for(u=this.vertices.length;q<u;q++)this.minx>this.projVert[q].x&&(this.minx=this.projVert[q].x),this.maxx<this.projVert[q].x&&(this.maxx=this.projVert[q].x),this.miny>this.projVert[q].y&&(this.miny=this.projVert[q].y),
this.maxy<this.projVert[q].y&&(this.maxy=this.projVert[q].y)};z.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];q=0;for(u=this.vertices.length;q<u;q++)(1E-8<Math.abs(this.vertices[q].x-this.vertices[(q+1)%u].x)||1E-8<Math.abs(this.vertices[q].y-this.vertices[(q+1)%u].y)||1E-8<Math.abs(this.vertices[q].z-this.vertices[(q+1)%u].z)||1E-8<Math.abs(this.vertices[q].w-this.vertices[(q+1)%u].w))&&v.push(this.vertices[q]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};z.prototype.drawText=
function(d,c,m,e,f,q,g,k,n,p,u){l=this.evaluator;d.textNode=c;q=l.eval(this.offset_dist);g=-a.degToRad(l.eval(this.offset_angle));m+=q*Math.cos(g);e+=q*Math.sin(g);d.textNode.pos={x:m,y:e};c.hasContent&&(c.draw(d,f,m,e,!0),h=this.fromPoint?c.textNodes.metrics.w/2:0,b=this.fromPoint?c.textNodes.metrics.h/2:0,c.draw(d,f,m-h,e-b))};z.prototype.splitFace=function(b){if(this.intersects(b)){var d=i2=null,c=ix2=0,h,m;var e=this.vertices;var f=b.vertices;var q=0;for(m=f.length;q<m;q++){var g=this.intersection(f[q],
f[(q+1)%m]);if(null!==g)if(null===d){if(d=g,c=q,2===f.length){i2=d;break}}else if(!a.equals3DEpsilon(g,d,1E-8)){i2=g;ix2=q;break}}if(null!==d&&null!==i2){q=this.isInterior(d)||this.isInterior(i2);var l=h=null;if(!q&&3<=f.length)for(m=0,e=e.length;m<e;m++)if(g=b.intersection(this.vertices[m],this.vertices[(m+1)%e]),null!==g)if(null===h)h=g;else if(!a.equals3DEpsilon(g,h,1E-8)){l=g;break}if(q||null!==h&&null!==l&&b.isInterior(h)&&b.isInterior(l)){l=!0;e=g=null;if(2===f.length)a.equals3DEpsilon(d,f[0],
1E-8)||a.equals3DEpsilon(d,f[1],1E-8)?l=!1:(g=[],g[0]=f[0],g[1]=d,e=[],e[0]=d,e[1]=f[1]);else for(g=[],e=[],q=m=h=0;q<f.length;q++)q<c?g[h++]=f[q]:q==c?(g[h++]=f[q],g[h++]=d,e[m++]=d):q<ix2?e[m++]=f[q]:q==ix2?(e[m++]=f[q],e[m++]=i2,g[h++]=i2):g[h++]=f[q];if(l){d=[];d[0]=new z({vertices:g,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);d[0].removeDoubles();d[0].normal=b.normal;d[1]=new z({vertices:e,type:"face",frontColor:b.frontColor,backColor:b.backColor,
edges:b.edges,model:b.model},this.space);d[1].removeDoubles();d[1].normal=b.normal;if(2<d[0].vertices.length)return 2<d[1].vertices.length?d:[d[0]];if(2<d[1].vertices.length)return[d[1]]}}}}return[b]};z.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};z.prototype.intersectsPlane=function(b){var d=this.vertices;var c=b.vertices;if(0<d.length){var h=a.dotProduct3D(c[0],b.normal);var m=a.dotProduct3D(d[0],b.normal);if(1E-8>Math.abs(h-m))return!0;for(var e=1,f=
d.length;e<f;e++)if(c=a.dotProduct3D(d[e],b.normal),1E-8>Math.abs(h-c)||c>h&&m<h||c<h&&m>h)return!0}return!1};z.prototype.intersection=function(b,d){var c=this.vertices;if(0<c.length){d=a.subtract3D(d,b);var h=a.dotProduct3D(d,this.normal);if(0!==h&&(c=a.dotProduct3D(a.subtract3D(c[0],b),this.normal)/h,-1E-8<c&&1.00000001>c))return a.add3D(b,a.scalarProduct3D(d,c))}return null};z.prototype.isInterior=function(b){var d=this.vertices;if(0<d.length)for(var c=0,h=a.subtract3D(d[0],b),m=0,e=d.length;m<
e;m++){var f=a.subtract3D(d[(m+1)%e],b),q=a.dotProduct3D(a.crossProduct3D(h,f),this.normal);if(1E-8>Math.abs(q)){if(0>a.dotProduct3D(h,f))break}else{if(0>c&&0<q||0<c&&0>q)return!1;h=f;c=q}}return!0};z.prototype.inFrontOf=function(a,b,d){if(this.minDistanceToEye>=b.maxDistanceToEye||this.maxx<=b.minx||this.minx>=b.maxx||this.maxy<=b.miny||this.miny>=b.maxy)return!1;for(x=0;3>x;x++)if(n=null,n=0===x?this.intersections(b):1===x?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=n&&0<n.length){for(y=
0;y<n.length;y++)a.push(n[y]);q=0;for(u=n.length;q<u;q++){m=n[q];w=this.space.rayFromEye(m.x,m.y);try{t=this.distanceToEyeAlong(w)-b.distanceToEyeAlong(w);if(t<=-d)return!0;if(t>=d)return!1}catch(F){}}}return!1};z.prototype.intersections=function(b){for(var d=[],c,h,m,e=new a.R2,f=this.newSpaceVert,q=b.newSpaceVert,g=this.newProjVert,l=b.newProjVert,k=0,n=f.length;k<n;k++){b=f[k];c=f[(k+1)%n];for(var p=0,u=q.length;p<u;p++)h=q[p],m=q[(p+1)%u],b!=h&&b!=m&&c!=h&&c!=m&&(h=e.intersection(g[k],g[(k+1)%
n],l[p],l[(p+1)%u]),null!=h&&d.push(h))}return d};z.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");};z.prototype.verticesContainedIn=function(a){for(var b=[],d=this.newSpaceVert,c=this.newProjVert,h=0,m=d.length;h<m;h++)!a.isVertex(d[h])&&a.appearsToContain(c[h])&&b.push(c[h]);return b};z.prototype.appearsToContain=function(a){for(var b=
0,d,c=this.newProjVert,h=0,m=this.newSpaceVert.length;h<m;h++){d=(c[h].x-a.x)*(c[(h+1)%m].y-a.y)-(c[(h+1)%m].x-a.x)*(c[h].y-a.y);if(0!=b)if(1E-8>Math.abs(d)){if(1E-8<Math.abs(c[h].x-c[(h+1)%m].x))return Math.min(c[h].x,c[(h+1)%m].x)<=a.x+1E-8&&a.x<=Math.max(c[h].x,c[(h+1)%m].x)+1E-8;if(1E-8<Math.abs(c[h].y-c[(h+1)%m].y))return Math.min(c[h].y,c[(h+1)%m].y)<=a.y+1E-8&&a.y<=Math.max(c[h].y,c[(h+1)%m].y)+1E-8}else if(0<b&&0>d||0>b&&0<d)return!1;b=d}return!0};z.prototype.isVertex=function(b){for(var d=
this.newSpaceVert,c=0,h=d.length;c<h;c++)if(a.equals3DEpsilon(b,d[c],1E-8))return!0;return!1};a.Primitive3D=z;return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var b=[],d=0,c,h=a.length,e=a.length-1;-1<e;e--)c=a.charAt(e),0==d?"="==c&&(d=1):1==d?" "!=c&&(d="<"===c||">"===c?0:2):2==d&&" "==c&&(b.unshift(a.substring(e+1,h)),h=e,d=0);b.unshift(a.substring(0,h));return b}if(a.loadLib)return a;var f={x:0,y:0,z:0},e,r,p,c,k,l=a.degToRad,b,h=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=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=d.parse("1");this.abs_coord=!1;this.family="";this.family_interval=d.parse("[0,1]");this.family_steps=d.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=d.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=d.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=d.parse("(0,0,0)");this.model="color";Object.assign(this,c);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=d.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=d.parse(this.inirot);this.endrot=d.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};h.prototype.getSpace=function(){for(var a=this.parent.spaces,b,c=0,
h=a.length;c<h;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};h.prototype.getFamilyValues=function(){e=this.evaluator;r=e.eval(this.family_interval);this.familyInf=r[0][0];this.familySup=r[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.buildFamilyPrimitives=function(){e=this.evaluator;this.getFamilyValues();p=e.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)e.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,e.eval(this.drawif)&&this.buildPrimitives();e.setVariable(this.family,p)};h.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};h.prototype.updateMVMatrix=function(){c=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(l(c[0][0])),this.inirotM=
this.inirotM.rotateX(l(c[0][1])),this.inirotM=this.inirotM.rotateZ(l(c[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(l(c[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(l(c[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(l(c[0][2])));c=this.evaluator.eval(this.inipos);f={x:c[0][0],y:c[0][1],z:c[0][2]};this.iniposM=this.iniposM.setIdentity().translate(f);c=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(l(c[0][0])),this.endrotM=this.endrotM.rotateX(l(c[0][1])),this.endrotM=this.endrotM.rotateZ(l(c[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(l(c[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(l(c[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(l(c[0][2])));c=this.evaluator.eval(this.endpos);f={x:c[0][0],y:c[0][1],z:c[0][2]};this.endposM=this.endposM.setIdentity().translate(f)};h.prototype.transformVertex=function(a){this.inirotEuler?k=
this.inirotM.multiplyVector4(a):(k=this.inirotM_X.multiplyVector4(a),k=this.inirotM_Y.multiplyVector4(k),k=this.inirotM_Z.multiplyVector4(k));k=this.iniposM.multiplyVector4(k);this.endrotEuler?k=this.endrotM.multiplyVector4(k):(k=this.endrotM_X.multiplyVector4(k),k=this.endrotM_Y.multiplyVector4(k),k=this.endrotM_Z.multiplyVector4(k));k=this.endposM.multiplyVector4(k);this.macroChildren&&(k=this.applyMacroTransform(k));k.adjustDec();return k};h.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
k=this.macro_inirotM.multiplyVector4(a):(k=this.macro_inirotM_X.multiplyVector4(a),k=this.macro_inirotM_Y.multiplyVector4(k),k=this.macro_inirotM_Z.multiplyVector4(k));k=this.macro_iniposM.multiplyVector4(k);this.macro_endrotEuler?k=this.macro_endrotM.multiplyVector4(k):(k=this.macro_endrotM_X.multiplyVector4(k),k=this.macro_endrotM_Y.multiplyVector4(k),k=this.macro_endrotM_Z.multiplyVector4(k));return k=this.macro_endposM.multiplyVector4(k)};h.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],c=0,h=a.length;c<h;c++)""!==a[c].trim()&&(b=b.concat(g(a[c])));c=0;for(h=b.length;c<h;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};h.prototype.splitFace=function(a){for(var d=0,c=this.primitives.length;d<c;d++)if(b=[],"face"===this.primitives[d].type){for(var h=0,e=a.primitives.length;h<e;h++)"face"===a.primitives[h].type?b=b.concat(this.primitives[d].splitFace(a.primitives[h])):b.push(a.primitives[h]);a.primitives=b}};a.Graphic3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c=function(c,e){return a.Graphic3D.call(this,c,e)||this};$jscomp.inherits(c,a.Graphic3D);c.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();f=g.eval(this.expresion);e=f[0][0];r=f[0][1];p=f[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,r,p,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:g.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||g.parser.parse("10"),this.offset_angle=this.offset_angle||g.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,r,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:g.eval(this.decimals),fixed:this.fixed,evaluator:g,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=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,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();k=l.getVariable("u");l.setVariable("u",this.Nu);b=l.eval(this.expresion);g=b[0][0];f=b[0][1];e=b[0][2];r=b[1][0];p=b[1][1];c=b[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
f,e,1)),this.transformVertex(new a.Vector4D(r,p,c,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:l.eval(this.width)},this.space));l.setVariable("u",k)};a.Segment3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h,d,v,q,u,A=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.expresion=d.parseExpression();return d};$jscomp.inherits(A,a.Graphic3D);A.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();r=g.getVariable("x");p=g.getVariable("y");c=g.getVariable("z");
f=g.getVariable("u");e=g.getVariable("v");g.setVariable("u",0);g.setVariable("v",0);k=parseInt(g.eval(this.Nu));l=parseInt(g.eval(this.Nv));b=[];for(d=0;d<=k;d++)for(g.setVariable("u",d/k),v=0;v<=l;v++){g.setVariable("v",v/l);q=0;for(u=this.expresion.length;q<u;q++)g.eval(this.expresion[q]);b.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}var n=this.color.getColor(),m=this.backcolor.getColor(),w=this.edges?this.edges.getColor():"";for(d=0;d<
k;d++)for(v=0;v<l;v++)h=[],h.push(b[v+d*l+d]),h.push(b[v+1+d*l+d]),h.push(b[v+2+(d+1)*l+d]),h.push(b[v+1+(d+1)*l+d]),this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:n,backColor:m,edges:w,model:this.model},this.space));g.setVariable("x",r);g.setVariable("y",p);g.setVariable("z",c);g.setVariable("u",f);g.setVariable("v",e)};a.Surface3D=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");return d};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();l=k.eval(this.expresion);for(var b=this.color.getColor(),d=0,v=l.length-1;d<v;d++)g=l[d][0],f=l[d][1],e=l[d][2],r=l[d+1][0],p=l[d+1][1],c=l[d+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
f,e,1)),this.transformVertex(new a.Vector4D(r,p,c,1))],type:"edge",frontColor:b,lineWidth:k.eval(this.width)},this.space))};a.Polygon3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l=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(l,a.Graphic3D);l.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();r=k.getVariable("x");p=k.getVariable("y");c=k.getVariable("z");e=k.getVariable("u");k.setVariable("u",0);f=k.eval(this.Nu);g=[];for(var b=0;b<=f;b++){k.setVariable("u",b/f);for(var h=0,d=
this.expresion.length;h<d;h++)k.eval(this.expresion[h]);g.push(this.transformVertex(new a.Vector4D(k.getVariable("x"),k.getVariable("y"),k.getVariable("z"),1)))}b=0;for(h=g.length-1;b<h;b++)this.primitives.push(new a.Primitive3D({vertices:[g[b],g[b+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));this.fill&&2<g.length&&this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));k.setVariable("x",r);k.setVariable("y",c);k.setVariable("z",p);k.setVariable("u",e)};a.Curve3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h,d,v=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();d=h.eval(this.expresion);g=d[0][0];f=d[0][1];e=d[0][2];r=d[1][0];p=d[1][1];c=d[1][2];k=d[2][0];l=d[2][1];b=d[2][2];var q=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,f,e,1)),this.transformVertex(new a.Vector4D(k,
l,b,1)),this.transformVertex(new a.Vector4D(r,p,c,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:q,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r=function(e,c){return a.Graphic3D.call(this,e,c)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();e=f.eval(this.expresion);g=[];for(var p=e.length-1;0<=p;p--)g.push(this.transformVertex(new a.Vector4D(e[p][0],e[p][1],e[p][2],1)));p=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:p,model:this.model},this.space))};a.Face3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("2");b.length=b.length||c.evaluator.parser.parse("2");return b};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){c=this.evaluator;this.updateMVMatrix();g=c.eval(this.Nu);f=[this.transformVertex(new a.Vector4D(0,0,0,1))];e=c.eval(this.width)/2;r=c.eval(this.length)/2;p=2*Math.PI/g;for(var l=0;l<g;l++)f.push(this.transformVertex(new a.Vector4D(e*
Math.cos(p*l),r*Math.sin(p*l),0,1)));var b=this.color.getColor(),h=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";for(l=0;l<g;l++)this.primitives.push(new a.Primitive3D({vertices:[f[0],l+2<=g?f[l+2]:f[1],f[l+1]],type:"face",frontColor:b,backColor:h,edges:d,model:this.model},this.space))};a.Polireg3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p=function(c,e){c=a.Graphic3D.call(this,c,e)||this;c.shadowColor=c.shadowColor?c.shadowColor.getColor():"transparent";return c};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){g=this.evaluator;f=g.eval(this.expresion);e=f[0][0];r=f[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(e,r,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:g.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:g,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=p;return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var f=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,r,p,c=0,k=function(l,b){var h=a.Graphic.call(this,l,b)||this;h.expresion=h.expresion||void 0;h.inirot=h.inirot||"(0,0,0)";h.inirotEuler=h.inirotEuler||!1;h.inipos=h.inipos||l.evaluator.parser.parse("(0,0,0)");h.endrot=h.endrot||
"(0,0,0)";h.endrotEuler=h.endrotEuler||!1;h.endpos=h.endpos||l.evaluator.parser.parse("(0,0,0)");h.name=h.name||"_descartes_empty_name_"+c++;Object.assign(h,b);h.inirot.match("Euler")&&(h.inirot=h.inirot.replace("Euler",""),h.inirotEuler=!0);h.endrot.match("Euler")&&(h.endrot=h.endrot.replace("Euler",""),h.endrotEuler=!0);h.inirot=h.evaluator.parser.parse(h.inirot);h.endrot=h.evaluator.parser.parse(h.endrot);h.inirotM=new a.Matrix4x4;h.inirotM_X=new a.Matrix4x4;h.inirotM_Y=new a.Matrix4x4;h.inirotM_Z=
new a.Matrix4x4;h.iniposM=new a.Matrix4x4;h.endrotM=new a.Matrix4x4;h.endrotM_X=new a.Matrix4x4;h.endrotM_Y=new a.Matrix4x4;h.endrotM_Z=new a.Matrix4x4;h.endposM=new a.Matrix4x4;h.graphics=[];l=l.lessonParser;var d=new a.Tokenizer;if(void 0==h.expresion)return h;"'"!==h.expresion.charAt(0)&&(h.expresion="'"+h.expresion+"'");h.expresion=h.evaluator.parser.parse(h.expresion);b=h.evaluator.eval(h.expresion);if(b)var k=(k=document.getElementById(b))&&"descartes/macro"==k.type?k.text:a.openExternalFile(b);
if(k){var q=a.convertHTMLEntities(k).replace(/\r/g,"").split("\n");k=[];b=0;for(var p=q.length;b<p;b++){var r=q[b].indexOf("=");if(-1!==r){r=l.split(q[b]);for(var n=0,m=r.length;n<m;n++)if(r[n]&&1<r.length&&("id"===g[r[n][0]]||"type"===g[r[n][0]])){k.push(r);break}}}b=0;for(p=k.length;b<p;b++){m=(n=k[b]||[],n[0])&&"id"===n[0][0];var w=!1;q=0;for(r=n.length;q<r;q++){var x=n[q][0].indexOf(".");-1===x||m?x=g[n[q][0]]:(x=g[n[q][0].substring(x+1)],n[q][0]=h.name+"."+n[q][0]);"type"===x&&"surface"===g[n[q][1]]&&
(w=!0);if(!("font"===x||"font_family"===x||("fill"===x||"color"===x||"backcolor"===x||"arrow"===x)&&"("!==n[q][1].charAt(0)||"file"===x&&n[q][1].match(e)||"id"!==x&&void 0!==g[n[q][1]]||w&&"expresion"===x)||"width"===x||"height"===x||"length"===x)if("text"==x)if(n[q][1].match(/\{\\rtf1/)){x=n[q][1];var y=h;var z=function(b,c){c=d.tokenize(c.replace(/&squot;/g,"'"));for(var h=0,m=c.length;h<m;h++)if("identifier"==c[h].type&&!a.reservedIds.match("-"+c[h].value+"-")||"R"===c[h].value||"G"===c[h].value||
"B"===c[h].value)c[h].value=y.name+"."+c[h].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+d.flatTokens(c)};x=x.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,z);x=x.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,z);n[q][1]=x}else{z=l.parseText(n[q][1]).textElementsMacros;for(var G=0,J=z.length;G<J;G++){x=d.tokenize(z[G].replace(/&squot;/g,"'"));for(var E=0,F=x.length;E<F;E++)if("identifier"===x[E].type&&!a.reservedIds.match("-"+x[E].value+
"-")||"R"===x[E].value||"G"===x[E].value||"B"===x[E].value)x[E].value=h.name+"."+x[E].value;x=d.flatTokens(x).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");z[G]=x.substring(1,x.length-1)}n[q][1]=z.join("")}else{z=n[q][1].replace(/&squot;/g,"'").split(";");G=0;for(J=z.length;G<J;G++){x=d.tokenize(z[G].replace(/\\n/g,";"));E=0;for(F=x.length;E<F;E++)if("identifier"===x[E].type&&!a.reservedIds.match("-"+x[E].value+"-")||"R"===x[E].value||"G"===x[E].value||"B"===x[E].value)x[E].value=
h.name+"."+x[E].value;z[G]=d.flatTokens(x)}n[q][1]=z.join(";")}}}b=0;for(p=k.length;b<p;b++)if(k[b][0]){n="";m=!1;q=0;for(r=k[b].length;q<r;q++)"type"===g[k[b][q][0]]&&f.match("-"+g[k[b][q][1]]+"-")&&(m=!0),n=n+k[b][q][0]+"='"+k[b][q][1]+"' ";k[b]=n+(m?" space='"+h.spaceID+"'":"");m?h.graphics.push(l.parse3DGraphic(k[b],h.abs_coord,h.background,h.inirot)):l.parseAuxiliar(k[b])}}b=0;for(p=h.graphics.length;b<p;b++)h.graphics[b].macroChildren=!0;return h};$jscomp.inherits(k,a.Graphic);k.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)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};
k.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var b=this.graphics.length;a<b;a++)r=this.graphics[a],r.macro_inirotEuler=this.inirotEuler,r.macro_inirotM=this.inirotM,r.macro_inirotM_X=this.inirotM_X,r.macro_inirotM_Y=this.inirotM_Y,r.macro_inirotM_Z=this.inirotM_Z,r.macro_iniposM=this.iniposM,r.macro_endrotEuler=this.endrotEuler,r.macro_endrotM=this.endrotM,r.macro_endrotM_X=this.endrotM_X,
r.macro_endrotM_Y=this.endrotM_Y,r.macro_endrotM_Z=this.endrotM_Z,r.macro_endposM=this.endposM,r.update();a=0;for(b=this.graphics.length;a<b;a++){r=this.graphics[a];if(r.split||this.split)for(var c=a+1;c<b;c++)p=this.graphics[c],(p.split||this.split)&&r.splitFace(p);this.primitives=this.primitives.concat(r.primitives||[])}};k.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)};k.prototype.drawAux=function(a){};a.Macro3D=k;return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b,d,c,h){f.call(this,a/n,a/n,a/n,c,h)}function f(a,b,d,c,h){a/=2;b/=2;d/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new m(a,d,b,1),new m(a,-d,b,1),new m(a,d,-b,1),new m(a,-d,-b,1),new m(-a,d,b,1),new m(-a,-d,b,1),new m(-a,d,-b,1),new m(-a,-d,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,d,c,h))}function e(a,b,d,c,h){a/=2;if(!this.changeGeometry(a,b,d,c,h)){var e=2*Math.PI/3,f=2*a*Math.sqrt(2)/3,g=-a/
3,q=f*Math.cos(e)+0*Math.sin(e);e=-f*Math.sin(e)+0*Math.cos(e);this.vertices=[new m(0,0,a,1),new m(q,e,g,1),new m(q,-e,g,1),new m(f,0,g,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,d,c,h)}}function r(a,b,d,c,h){a/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new m(0,0,a,1),new m(a,0,0,1),new m(-a,0,0,1),new m(0,a,0,1),new m(0,-a,0,1),new m(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,d,c,h))}function p(b,
d,c,h,e){b/=Math.PI;if(!this.changeGeometry(b,d,c,h,e)){B=b/1.6180339887;L=1.6180339887*b;this.vertices=[new m(b,b,b,1),new m(b,b,-b,1),new m(b,-b,b,1),new m(b,-b,-b,1),new m(-b,b,b,1),new m(-b,b,-b,1),new m(-b,-b,b,1),new m(-b,-b,-b,1),new m(0,B,L,1),new m(0,B,-L,1),new m(0,-B,L,1),new m(0,-B,-L,1),new m(B,L,0,1),new m(B,-L,0,1),new m(-B,L,0,1),new m(-B,-L,0,1),new m(L,0,B,1),new m(L,0,-B,1),new m(-L,0,B,1),new m(-L,0,-B,1)];I=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(P=this.vertices.length;H<
P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,d,c,h,e)}}function c(b,d,c,h,e){b/=3.8;if(!this.changeGeometry(b,d,c,h,e)){L=1.6180339887*b;this.vertices=[new m(0,b,L,1),new m(0,b,-L,1),new m(0,-b,L,1),new m(0,-b,-L,1),new m(b,L,0,1),new m(b,-L,0,1),new m(-b,L,0,1),new m(-b,-L,0,1),
new m(L,0,b,1),new m(L,0,-b,1),new m(-L,0,b,1),new m(-L,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]];I=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);H=0;for(P=this.vertices.length;H<P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.updateValues(b,d,c,h,e)}}function k(a,b,d,c,h){a/=2;this.isSphere?d=b=a:(b/=2,d/=2);if(!this.changeGeometry(a,
b,d,c,h)){this.vertices=[new m(0,0,b,1)];for(H=1;H<c;H++)for(E=H*u/c,C=0;C<h;C++)J=C*A/h,y=a*v(E)*q(J),z=d*v(E)*v(J),G=b*q(E),this.vertices.push(new m(y,z,G,1));this.vertices.push(new m(0,0,-b,1));this.faces=[];for(H=0;H<h;H++)this.faces.push([0,(H+1)%h+1,H%h+1]);for(H=1;H<c-1;H++)for(C=0;C<h;C++)this.faces.push([C+1+(H-1)*h,(C+1)%h+1+(H-1)*h,(C+1)%h+1+H*h,C+1+H*h]);for(H=0;H<h;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-h+H,this.vertices.length-1-h+(H+1)%h]);this.updateValues(a,
b,d,c,h)}}function l(a,b,d,c,h){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h;H++)for(C=0;C<c;C++)y=a*(h-H)/h*q(C*A/c),z=d*(h-H)/h*v(C*A/c),G=b-2*H*b/h,this.vertices.push(new m(y,z,G,1));this.vertices.push(new m(0,0,-b,1));this.faces=[];for(H=0;H<h-1;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,(C+1)%c+H*c,(C+1)%c+(H+1)*c,C+(H+1)*c]);for(H=0;H<c;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-c+H,this.vertices.length-1-c+(H+1)%c]);this.updateValues(a,
b,d,c,h)}}function b(a,b,d,c,h){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<c;C++)y=a*q(C*A/c),z=d*v(C*A/c),G=b-2*H*b/h,this.vertices.push(new m(y,z,G,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,(C+1)%c+H*c,(C+1)%c+(H+1)*c,C+(H+1)*c]);this.updateValues(a,b,d,c,h)}}function h(a,b,d,c,h){a/=2;b/=2;d/=2;F=w.eval(this.R);D=w.eval(this.r);if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<c;C++)y=
-(F+D*v(A*C/c))*v(A*H/h),z=(F+D*v(A*C/c))*q(A*H/h),G=D*q(A*C/c),this.vertices.push(new m(y,z,G,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,C+(H+1)*c,(C+1)%c+(H+1)*c,(C+1)%c+H*c]);this.updateValues(a,b,d,c,h)}}function d(){this.vertices=[];this.faces=[];H=0;for(P=this.fileData.length;H<P;H++)M=this.fileData[H],M.match(/^V\(/)?(O=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new m(O[0]||0,O[1]||0,O[2]||0,1))):M.match(/^F\(/)&&(O=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var v=Math.sin,q=Math.cos,u=Math.PI,A=2*u,n=Math.sqrt(3),m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K=function(q,n){n=a.Graphic3D.call(this,q,n)||this;n.width=n.width||q.evaluator.parser.parse("2");n.height=n.height||q.evaluator.parser.parse("2");n.length=n.length||q.evaluator.parser.parse("2");n.R=n.R||q.evaluator.parser.parse("2");n.r=n.r||q.evaluator.parser.parse("1");m=a.Vector4D;switch(n.subType){case "cube":n.buildGeometry=
g;break;case "box":n.buildGeometry=f;break;case "tetrahedron":n.buildGeometry=e;break;case "octahedron":n.buildGeometry=r;break;case "sphere":n.isSphere=!0;case "ellipsoid":n.buildGeometry=k;break;case "dodecahedron":n.buildGeometry=p;break;case "icosahedron":n.buildGeometry=c;break;case "cone":n.buildGeometry=l;break;case "cylinder":n.buildGeometry=b;break;case "torus":n.buildGeometry=h;break;case "mesh":n.fileData=a.openExternalFile(n.evaluator.eval(n.file)).split(/\r/),n.buildGeometry=d}return n};
$jscomp.inherits(K,a.Graphic3D);K.prototype.buildPrimitives=function(){w=this.evaluator;this.updateMVMatrix();this.buildGeometry(w.eval(this.width),w.eval(this.height),w.eval(this.length),w.eval(this.Nu),w.eval(this.Nv));var b=this.color.getColor(),d=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";H=0;for(P=this.faces.length;H<P;H++){x=[];C=0;for(N=this.faces[H].length;C<N;C++)x.push(this.transformVertex(this.vertices[this.faces[H][C]]));this.primitives.push(new a.Primitive3D({vertices:x,
type:"face",frontColor:b,backColor:d,edges:c,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,b,d,c,h){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===d&&this.oldNu===c&&this.oldNv===h};K.prototype.updateValues=function(a,b,d,c,h){this.oldWidth=a;this.oldHeight=b;this.oldLength=d;this.oldNv=h;this.oldNu=c};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,f=Math.min,e=Math.PI,r=Math.cos,p=Math.sin,c=Math.abs,k=Math.round,l,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F,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 k(g(f(this.x,32E3),-32E3))};D.prototype.iy=function(){return k(g(f(this.y,32E3),-32E3))};D.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};D.prototype.norm2=function(){return this.x*this.x+this.y*this.y};D.prototype.norm=function(){return Math.sqrt(this.norm2())};D.prototype.distance=function(a){b=this.copy();b.sub(a);return b.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(){l=this.norm();0!=l&&this.div(l)};D.prototype.rotR90=function(){l=this.x;this.x=this.y;this.y=-l};D.prototype.rotL90=function(){l=this.x;this.x=-this.y;this.y=l};D.prototype.rot=function(a){h=this.copy();q=r(a);u=p(a);this.x=h.x*q-h.y*u;this.y=h.x*u+h.y*q};D.prototype.rot2=function(a){this.rot(a*e/180)};D.prototype.intersection=function(a,b,h,e){A=b.x-a.x;n=h.x-e.x;m=h.x-a.x;w=b.y-a.y;x=h.y-e.y;y=h.y-a.y;F=A*
x-n*w;return 1E-6<c(F)?(d=(m*x-y*n)/F,v=(-m*w+y*A)/F,0<=d&&1>=d&&0<=v&&1>=v?new D(a.x+A*d,a.y+w*d):null):(b.x-h.x)*y!=(b.y-h.y)*m?null:a.x!=b.x?(z=f(a.x,b.x),G=g(a.x,b.x),z<=h.x&&h.x<=G?h:z<=e.x&&e.x<=G?e:null):h.x!=e.x?(J=f(h.x,e.x),E=g(h.x,e.x),J<=a.x&&a.x<=E?a:J<=b.x&&b.x<=E?b:null):a.y!=b.y?(z=f(a.y,b.y),G=g(a.y,b.y),z<=h.y&&h.y<=G?h:z<=e.y&&e.y<=G?e:null):h.y!=e.y?(J=f(h.y,e.y),E=g(h.y,e.y),J<=a.y&&a.y<=E?a:J<=b.y&&b.y<=E?b:null):a.x==h.x&&a.y==h.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h=function(d,h){this.evaluator=d;this.constraint=h;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];c=
new a.R2(0,0);p=new a.R2(0,0);b=new a.R2(0,0)};h.prototype.getUnitNormal=function(){this.normal.normalize();return b.set(this.normal.x,this.normal.y)};h.prototype.gradient=function(a){g=this.evaluator;c.x=0;c.y=0;k=g.getVariable("x");l=g.getVariable("y");g.setVariable("x",a.x);g.setVariable("y",a.y);this.f0=g.eval(this.constraint);g.setVariable("x",g.getVariable("x")+1E-6);f=g.eval(this.constraint);c.x=(f-this.f0)/1E-6;c.x=isNaN(c.x)?Infinity:c.x;g.setVariable("x",g.getVariable("x")-1E-6);g.setVariable("y",
g.getVariable("y")+1E-6);f=g.eval(this.constraint);c.y=(f-this.f0)/1E-6;c.y=isNaN(c.y)?Infinity:c.y;g.setVariable("x",k);g.setVariable("y",l);return c};h.prototype.findZero=function(a,b,c){g=this.evaluator;p.x=a.x;p.y=a.y;k=g.getVariable("x");l=g.getVariable("y");g.setVariable("x",a.x);g.setVariable("y",a.y);this.f0=g.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return p;g.setVariable("x",k);g.setVariable("y",l);for(var d=0;16>d;d++)if(e=p.x,r=p.y,this.normal=
this.gradient(p),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),p.x=e+this.normal.x,p.y=r+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 c?p:null};a.R2Newton=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(a,e){this.x=a;this.y=e};g.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};g.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};g.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};g.AXIS_X=new g(1,0);g.AXIS_Y=new g(0,1);a.Vector2D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f=Math.round,e,r,p,c,k,l,b,h,d,v,q,u,A,n=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.parser=b.evaluator.parser;this.id="GraphicControl"!==d.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==d.type?100:350;this.h="Video"!==d.type?23:120;"GraphicControl"!==d.type&&"Audio"!==d.type&&"Video"!==d.type?"TextArea"!==d.type?this.expresion=c.parse("(0,0,100,23)"):(this.expresion=c.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=c.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("222222");this.colorInt=new a.Color("GraphicControl"!==d.type?"f0f8ff":"cc0022");this.font_size=c.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=c.parse("1");this.activeif=c.parse("1");this.valueExpr=c.parse("0");this.decimals=
c.parse("2");this.min=c.parse("-Infinity");this.max=c.parse("Infinity");this.incr=c.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,d);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==this.name||"_nada_"==this.name||"_void_"==this.name?"":this.name;d=this.evaluator.eval(this.expresion);this.x=f(d[0][0]);this.y=f(d[0][1]);4==d[0].length&&
(this.w=f(d[0][2]),this.h=f(d[0][3]));this.actionExec=b.lessonParser.parseAction(this)};n.prototype.init=function(){};n.prototype.update=function(){};n.prototype.draw=function(){};n.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,d=a.length;b<d;b++){var c=a[b];if(c.id===this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.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};
n.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};n.prototype.updatePositionAndSize=function(){p=c=k=l=!1;b=this.evaluator.eval(this.expresion);h=f(b[0][0]);p=f(this.x)!==h;this.x=h;h=f(b[0][1]);c=f(this.y)!==h;this.y=h;4===b[0].length&&(h=f(b[0][2]),k=f(this.w)!==h,this.w=h,h=f(b[0][3]),l=f(this.h)!==h,this.h=h);if(k||l||p||c)this.init(!0,!0),this.draw()};n.prototype.formatOutputValue=function(a){A=this.parent;
d=a+"";v=this.evaluator.eval(this.decimals);q=d.indexOf(".");-1!=q&&(u=d.substring(q+1),u.length>v&&(d=parseFloat(d).toFixed(v)));this.fixed&&(2!==A.version||2===A.version&&!this.exponentialif)&&(d=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(d)&&(d=this.fixed&&2!==A.version?parseFloat(d).toExponential(v):parseFloat(d).toExponential(),d=d.toUpperCase().replace("+",""));return d.replace(".",A.decimal_symbol)};n.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()};n.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);e=b*b;for(a=0;a<b;a++)r=g(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+r*r*192/e/255+")")};a.Control=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f=Math.abs,e=/[\w\.\-//]*(\.gif)/gi,r,p,c,k,l,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K=function(b,d){var c=a.Control.call(this,b,d)||this;c.imageSrc=d.imageSrc||"";c.image=d.image||new Image;c.imageOver=d.imageOver||new Image;c.imageDown=d.imageDown||new Image;c.flat=d.flat||!1;c.borderColor=d.borderColor||!1;c.text_align=d.text_align||"center_center";c.image_align=d.image_align||"center_center";c.font_family=a.getFontName(d.font_family||
"arial");c.ratio=b.ratio;-1===c.font_size&&(c.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.old_name=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.classContainer=c.cssClass?" "+c.cssClass+" ":"";c.extra_style=c.imageSrc.trim().match("^_STYLE_")?c.imageSrc.trim().substring(8):c.extra_style||"";c.imageSrc.trim().match("^_STYLE_")&&
(c.imageSrc="vacio.gif");if(c.extra_style){c.customStyle=!0;c.btnStyle=[];c.conStyle=[];c.conStyle.textBorder=3;b=c.extra_style.split("|");for(var h,m=0,e=b.length;m<e;m++)d=b[m],h=d.match(/rgb/g),d.match("class=")?c.classContainer=" "+d.substring(6):d.match("border=")?(c.btnStyle.push({type:"border-style",value:"solid"}),c.btnStyle.push({type:"border-width",value:d.substring(7).trim()+"px"})):d.match("borderRadius=")?(c.btnStyle.push({type:"border-radius",value:d.substring(13).trim()+"px"}),c.conStyle.push({type:"border-radius",
value:d.substring(13).trim()+"px"})):d.match("borderColor=")?c.btnStyle.push({type:"border-color",value:(h?"":"#")+d.substring(12).trim()}):d.match("overColor=")?c.conStyle.overColor=(h?"":"#")+d.substring(10).trim():d.match("downColor=")?c.conStyle.downColor=(h?"":"#")+d.substring(10).trim():d.match("font=")?c.conStyle.font=d.substring(5).trim().toLowerCase():d.match("inactiveColor=")?c.conStyle.inactiveColor=(h?"":"#")+d.substring(14).trim():d.match("inactiveColorBorder=")?c.conStyle.inactiveColorBorder=
(h?"":"#")+d.substring(20).trim():d.match("shadowTextBlur=")?c.conStyle.shadowTextBlur=parseFloat(d.substring(15).trim()):d.match("shadowTextOffsetX=")?c.conStyle.shadowTextOffsetX=parseFloat(d.substring(18).trim()):d.match("shadowTextOffsetY=")?c.conStyle.shadowTextOffsetY=parseFloat(d.substring(18).trim()):d.match("shadowTextColor=")?c.conStyle.shadowTextColor=(h?"":"#")+d.substring(16).trim():d.match("shadowBoxBlur=")?c.conStyle.shadowBoxBlur=parseFloat(d.substring(14).trim()):d.match("shadowBoxOffsetX=")?
c.conStyle.shadowBoxOffsetX=parseFloat(d.substring(17).trim()):d.match("shadowBoxOffsetY=")?c.conStyle.shadowBoxOffsetY=parseFloat(d.substring(17).trim()):d.match("shadowBoxColor=")?c.conStyle.shadowBoxColor=(h?"":"#")+d.substring(15).trim():d.match("shadowInsetBoxBlur=")?c.conStyle.shadowInsetBoxBlur=parseFloat(d.substring(19).trim()):d.match("shadowInsetBoxOffsetX=")?c.conStyle.shadowInsetBoxOffsetX=parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxOffsetY=")?c.conStyle.shadowInsetBoxOffsetY=
parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxColor=")?c.conStyle.shadowInsetBoxColor=(h?"":"#")+d.substring(20).trim():d.match("textBorder=")?c.conStyle.textBorder=parseFloat(d.substring(11).trim()):d.match("flat=")&&(c.flat=1==parseInt(d.substring(5).trim()))}c.imageSrc.match("_COLORES_")&&(b=c.imageSrc.split("_"),c.colorInt=new a.Color(b[2]),c.color=new a.Color(b[3]),c.font_size=c.parser.parse(b[5]),c.imageSrc="");c.imageSrc.match(/^\[.*\]?/)?c.imageSrc=c.parser.parse(c.imageSrc.substring(1,
c.imageSrc.length-1)):c.imageSrc=c.parser.parse("'"+c.imageSrc+"'");b=c.evaluator.eval(c.imageSrc).toString().trim();if(""!=b)if(d=b.substr(0,b.lastIndexOf(".")),h=b.substr(b.lastIndexOf(".")),b.match(/vacio.gif$/i))c.imageSrc=c.parser.parse("'vacio.gif'"),c.image.ready=1,3===c.parent.version&&(c.name=c.parser.parse("")),c.emptyImage={ready:!0},c.parser.parse("'vacio.gif'");else if(c.image=c.parent.getImage(b),d)try{c.imageOver=c.parent.getImage(d+"_over"+h),c.imageDown=c.parent.getImage(d+"_down"+
h)}catch(S){}c.container=a.newHTML("div",{class:"DescartesButtonContainer"+c.classContainer,id:c.id,style:"width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"});c.btn=a.newHTML("canvas",{width:c.w*c.ratio,height:c.h*c.ratio,style:"position:absolute;left:0;top:0;width:"+c.w+"px;height:"+c.h+"px;"});c.ctx=c.btn.getContext("2d");c.ctx.imageSmoothingEnabled=!1;c.tooltip&&(c.btn.title=c.tooltip);c.container.appendChild(c.btn);c.addControlContainer(c.container);c.addEvents();
c.init();return c};$jscomp.inherits(K,a.Control);K.prototype.init=function(b){r=this.evaluator;y=this.container;p=this.btn;c=this.ctx;k=r.eval(this.expresion);this.x=k[0][0];this.y=k[0][1];4==k[0].length&&(this.w=parseInt(k[0][2]),this.h=parseInt(k[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;");y.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 d=0,h=this.btnStyle.length;d<h;d++)p.style[this.btnStyle[d].type]=this.btnStyle[d].value;if(this.conStyle){d=0;for(h=this.conStyle.length;d<h;d++)y.style[this.conStyle[d].type]=this.conStyle[d].value;if(this.conStyle.shadowBoxColor){d=this.conStyle.shadowBoxOffsetX||0;h=this.conStyle.shadowBoxOffsetY||2;var m=this.conStyle.shadowBoxBlur||2;y.style.boxShadow=d+"px "+h+"px "+m+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&
(d=this.conStyle.shadowInsetBoxOffsetX||0,h=this.conStyle.shadowInsetBoxOffsetY||-2,m=this.conStyle.shadowInsetBoxBlur||1,p.style.boxShadow=d+"px "+h+"px "+m+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.fontSizeNotSet&&(this.font_size=r.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=r.eval(this.font_size);this.createGradient(this.w,this.h);y.style.display=0<r.eval(this.drawif)?"block":"none";c.lineJoin="round";c.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+
this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&
this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(b)};K.prototype.update=function(){r=this.evaluator;y=this.container;p=this.btn;this.activeIfValue=0<r.eval(this.activeif);this.drawIfValue=0<r.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?
(y.style.display="block",this.draw(),y.style.cursor=p.style.cursor=this.activeIfValue?"pointer":"not-allowed",y.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(y.style.display="none",this.buttonClick=!1)};K.prototype.draw=function(f){y=this.container;r=this.evaluator;p=this.btn;c=this.ctx;b=r.eval(this.name);this.text_object.draw(a.ctx,"#000000",0,0);b=this.text_object.textNodes.toStr();h=this.evaluator.eval(this.imageSrc).toString().trim();if(!f&&(z=this.over===this.oldOver,
G=this.buttonClick===this.oldButtonClick,J=this.activeIfValue===this.oldActiveIfValue,E=this.drawIfValue===this.oldDrawIfValue,F=b===this.oldName,D=h===this.oldImageSrc,B=this.colorInt.getColor()===this.oldBackColor,L=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=b,this.oldImageSrc=h,this.oldBackColor=this.colorInt.getColor(),
this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,z&&G&&J&&E&&F&&D&&B&&L&&I))return;c.save();c.setTransform(this.ratio,0,0,this.ratio,0,0);l=this.fs_evaluated;y.setAttribute("data-name",b);h?(d="vacio.gif"===h?this.emptyImage:this.parent.getImage(h),M=h.substr(0,h.lastIndexOf(".")),O=h.substr(h.lastIndexOf(".")),H=M+"_over"+O,P=M+"_down"+O,C="vacio.gif"===h?this.emptyImage:this.parent.getImage(H),N="vacio.gif"===h?this.emptyImage:this.parent.getImage(P)):N=C=d=this.emptyImage;
c.clearRect(0,0,this.w,this.h);v=q=0;this.buttonClick&&(v=q=1);this.text_object.draw(c,this.color.getColor(),0,0,!0);u=this.text_object.textNodes.metrics.w;A=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?w=g(this.w/2+v)-.5:"left"==this.text_align[1]?w=u/2+5+v:"right"==this.text_align[1]&&(w=this.w-u/2+v-5);"center"==this.text_align[0]?x=g(this.h/2+q)-.5:"top"==this.text_align[0]?x=A/2+q+4:"bottom"==this.text_align[0]&&(x=this.h-A/2+q-3);d&&("center"==this.image_align[1]?n=parseInt((this.w-
d.width)/2)+v:"left"==this.image_align[1]?n=v:"right"==this.image_align[1]&&(n=this.w-d.width+v),"center"==this.image_align[0]?m=parseInt((this.h-d.height)/2)+q:"top"==this.image_align[0]?m=q:"bottom"==this.image_align[0]&&(m=this.h-d.height+q));if(d&&d.ready)if(d!==this.emptyImage&&d.complete)if(h.match(e))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+h+"')",this.btn.style.backgroundPosition=n+"px "+m+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])y.style.backgroundColor=
this.colorInt.getColor();c.drawImage(d,n,m)}else this.emptyImage&&this.customStyle&&(y.style.backgroundColor=this.colorInt.getColor());else y.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(c,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(c,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(c,1,0,1,this.h,"rgba(0,0,0,0.03)")),c.fillStyle=this.linearGradient,c.fillRect(0,0,this.w,this.h));this.activeIfValue&&(C!==this.emptyImage&&this.over&&C.ready&&C.complete?
H.match(e)?(this.btn.style.backgroundImage="url('"+H+"')",this.btn.style.backgroundPosition=n+"px "+m+"px"):c.drawImage(C,n,m):this.customStyle&&this.conStyle.overColor&&this.over&&(y.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?N!==this.emptyImage&&this.buttonClick&&N.ready&&N.complete?P.match(e)?(this.btn.style.backgroundImage="url('"+P+"')",this.btn.style.backgroundPosition=n+"px "+m+"px"):c.drawImage(N,n,m):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(y.style.backgroundColor=
this.conStyle.downColor):this.buttonClick&&!d&&(c.fillStyle="rgba(0,0,0,0.09)",c.fillRect(0,0,this.w,this.h));c.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(c.lineWidth=this.conStyle.textBorder,c.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(c.lineWidth=parseInt(l/6),c.strokeStyle=this.borderColor.getColor());this.text_object.draw(c,this.color.getColor(),w,x);this.underlined&&(c.strokeStyle=this.color.getColor(),c.lineWidth=
g(l/10)||2,c.lineCap="round",c.beginPath(),c.moveTo(w-u/2+v,x+g(l/2)+g(l/5)-1.5),c.lineTo(w+u/2+v,x+g(l/2)+g(l/5)-1.5),c.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?y.style.backgroundColor=this.conStyle.inactiveColor:(c.fillStyle="rgba(240,240,240,0.6)",c.fillRect(0,0,this.w,this.h)));c.restore();this._image_pos_x=n;this._image_pos_y=m};K.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(f(this.colorInt.r-this.color.r)+
f(this.colorInt.g-this.color.g)+f(this.colorInt.b-this.color.b))/255)};K.prototype.buttonPressed=function(){this.updateAndExecAction()};K.prototype.addEvents=function(){function b(d,c,e){a.clearTimeout(m);h.buttonClick&&h.drawIfValue&&h.activeIfValue&&(c.call(h),d=e?d:100,m=a.setTimeout(function(){b(d,c,!1)},d))}function d(d){this.focus();d.preventDefault();d.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();h.whichBtn=a.whichBtn(d);"L"==h.whichBtn&&h.activeIfValue&&
(h.buttonClick=!0,h.draw(),"calculate"==h.action&&(h.evaluator.setVariable(h.id,h.evaluator.eval(h.valueExpr)),b(1E3,h.buttonPressed,!0)),h.btn.removeEventListener("touchend",c),h.btn.addEventListener("touchend",c),h.btn.removeEventListener("mouseup",c),h.btn.addEventListener("mouseup",c))}function c(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(h.activeIfValue||h.buttonClick)h.buttonClick=!1,h.draw(),"calculate"!=h.action&&(h.evaluator.setVariable(h.id,h.evaluator.eval(h.valueExpr)),
h.buttonPressed()),h.btn.removeEventListener("touchend",c),h.btn.removeEventListener("mouseup",c);h.parent.update()}var h=this,m;h.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",d);this.btn.addEventListener("mousedown",d);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();h.over=!0;h.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=null;b.preventDefault();b.stopPropagation();
h.over=!1;h.buttonClick=!1;h.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;h.buttonClick=!1})};a.Button=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h,d,v,q,u=function(b,c){c=a.Control.call(this,b,c)||this;c.flat=c.image_dec_src&&c.image_inc_src;c.btn_pos=c.btn_pos||"v_left";c.horizontal="h_left"===c.btn_pos||"h_right"===c.btn_pos||"h_left_right"===c.btn_pos;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.tabindex=++c.parent.tabindex;c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,
c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:c.id});c.divUp=a.newHTML("div",{class:"DJS_Up"});c.divDown=a.newHTML("div",{class:"DJS_Down"});c.field=a.newHTML("input",{type:"text",id:c.id+"_spinner",class:"DescartesSpinnerField",tabindex:c.tabindex});c.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.label);c.container.appendChild(c.field);
c.container.appendChild(c.divUp);c.container.appendChild(c.divDown);c.addControlContainer(c.container);d=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=d;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(u,
a.Control);u.prototype.init=function(b,d){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var c=this.label.textContent;d||(this.value=this.validateValue(g.eval(this.valueExpr)));d=this.formatOutputValue(this.value);this.fieldFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",
width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var h=2!==this.parent.version?"__":"_____",e=a.getTextWidth(d+"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){b=parseInt(this.h);var f=parseInt(this.w/2-b);h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(f=this.w-
2*b,e=0);f<h&&(f=h);""==c&&(f=0);this.w-f-b<e&&(f=this.w-b-e);0>f&&(f=0);c=this.w-(f+2*b);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;");this.divUp.setAttribute("style","width:"+b+"px;height:"+b+"px;"+("h_left"===this.btn_pos?"left:"+(f+b):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+b+"px;height:"+b+"px;left:"+(f+("h_right"===
this.btn_pos?c:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+(b+f+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;")}else b=2+parseInt(this.h/2),f=parseInt(this.w/2-b/2),h=a.getTextWidth(c+h,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(f=this.w-b,e=0),f<h&&(f=h),""==c&&(f=0),this.w-f-b<e&&(f=this.w-b-e),0>f&&
(f=0),c=this.w-(f+b),this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;"),h="width:"+b+"px;left:"+(f+("v_right"===this.btn_pos?c:0))+"px;",this.divUp.setAttribute("style",h+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",h+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;"+(this.flat?"border-width:0;":"")),this.field.setAttribute("style",
"font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?b:0)+f)+"px;");this.field.value=d;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+f+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=f*this.ratio;this.label.height=this.h*this.ratio;
this.image_dec&&this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);g.setVariable(this.id,this.value)};u.prototype.update=function(){g=this.evaluator;0>g.eval(this.decimals)?(f=g.eval(this.incr),0<f?this.originalIncr=this.incr=g.parser.parse(parseInt(f).toString()):
this.incr=d):this.incr=0!==g.eval(this.originalIncr)?this.originalIncr:d;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==v&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")",this.old_image_dec_src=v));this.image_inc&&(q=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==q&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")",this.image_inc_src=q));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(e=this.field.value,r=this.value,this.value=this.validateValue(g.getVariable(this.id)),
this.field.value=this.formatOutputValue(this.value),this.value==r&&this.field.value!=e&&(this.value=this.validateValue(e),this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",
this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};u.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"};u.prototype.validateValue=function(a){g=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(g.eval(g.parser.parse(a)));isNaN(p)&&(p=0);l=g.eval(this.min);b=g.eval(this.max);""===l&&(l=-Infinity);""===b&&(b=Infinity);p=Math.min(Math.max(p,l),b);this.discrete&&(c=g.eval(this.incr),p=0==c?0:c*Math.round(p/
c));k=g.eval(this.decimals);0>=k&&(k=0);return p=parseFloat(parseFloat(p).toFixed(k))};u.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};u.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};u.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())};
u.prototype.addEvents=function(){function b(c,d,h){a.clearTimeout(k);if(g.up||g.down)d.call(g),c=h?c:10,k=a.setTimeout(function(){b(c,d)},c)}function c(c){c.preventDefault();g.whichBtn=a.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.up=!0,b(q,g.increase,!0))}function d(c){c.preventDefault();g.whichBtn=a.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,b(q,g.decrease,!0))}function e(b){g.up=!1;a.clearTimeout(k);g.updateStyle()}function f(b){g.down=!1;a.clearTimeout(k);g.updateStyle()}h=
a.hasTouchSupport;var g=this,q=h?500:200,k;g.divUp.oncontextmenu=g.divDown.oncontextmenu=g.field.oncontextmenu=g.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&&g.changeValue(g.field.value)});this.divUp.addEventListener("touchstart",c);this.divUp.addEventListener("mousedown",c);this.divDown.addEventListener("touchstart",d);this.divDown.addEventListener("mousedown",
d);this.divUp.addEventListener("mouseout",function(b){g.up=!1;a.clearTimeout(k);b.preventDefault();g.updateStyle()});this.divDown.addEventListener("mouseout",function(b){g.down=!1;a.clearTimeout(k);b.preventDefault();g.updateStyle()});this.divUp.addEventListener("touchend",e);window.addEventListener("touchend",e);this.divUp.addEventListener("mouseup",e);window.addEventListener("mouseup",e);this.divDown.addEventListener("touchend",f);window.addEventListener("touchend",f);this.divDown.addEventListener("mouseup",
f);window.addEventListener("mouseup",f);document.addEventListener("visibilitychange",function(b){g.up=!1;g.down=!1;a.clearTimeout(k);g.updateStyle()});this.field.addEventListener("blur",function(a){g.drawIfValue&&g.changeValue(g.field.value,!0)});g.field.addEventListener("click",function(a){this.focus()})};a.Spinner=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f=function(e,f){var g=a.Control.call(this,e,f)||this;g.label_color=g.label_color||new a.Color("e0e4e8",e.evaluator);g.label_text_color=g.label_text_color||new a.Color("000000",e.evaluator);g.typeCtr="checkbox";g.pressed=f.pressed||!1;g.radio_group=(f.radio_group||"").trim();""!==g.radio_group&&(g.typeCtr="radio");g.name_str=g.name;g.name.match(/^\[.*\]?/)?g.name=g.parser.parse(g.name.substring(1,g.name.length-1)):g.name=g.parser.parse("'"+g.name.trim()+
"'");g.tabindex=++g.parent.tabindex;g.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:g.id});g.checkbox=a.newHTML("input",{type:g.typeCtr,id:g.id+g.typeCtr,class:"DescartesCheckbox",tabindex:g.tabindex});""!==g.radio_group&&g.checkbox.setAttribute("name",g.radio_group);g.checkbox.internalID=g.id;g.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});g.label_ctx=g.label.getContext("2d");g.ratio=e.ratio;g.dummyLabel=a.newHTML("label",{"for":g.id+g.typeCtr});g.value=g.evaluator.eval(g.valueExpr);
g.evaluator.setVariable(g.id,g.value);g.containerControl.appendChild(g.label);g.containerControl.appendChild(g.checkbox);g.containerControl.appendChild(g.dummyLabel);g.addControlContainer(g.containerControl);g.addEvents();g.init();return g};$jscomp.inherits(f,a.Control);f.prototype.init=function(e){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();this.labelFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):a.getFieldFontSize(this.h);e=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");"right"==this.position?(this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+e+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+e+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+e+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";")):(this.dummyLabel.setAttribute("style",
"position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+e+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";left:"+this.h+"px"));this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.width=e*this.ratio;this.label.height=
this.h*this.ratio;this.update()};f.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.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!==g.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),g.setVariable(this.id,this.value);else{this.value=g.getVariable(this.id);g.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var f=-1;if(this.pressed){for(var p=a.length-1;0<=p;p--)g.setVariable(a[p].internalID,0),a[p].checked=!1;g.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;g.setVariable(this.radio_group,this.id);this.pressed=0}else{for(p=a.length-1;0<=p;p--)f=0!=g.getVariable(a[p].internalID)?p:f,g.setVariable(a[p].internalID,
0),a[p].checked=!1;0<=f&&(g.setVariable(a[f].internalID,1),a[f].checked=!0,g.setVariable(this.radio_group,a[f].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,
this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};f.prototype.addEvents=function(){var e=this;e.checkbox.oncontextmenu=e.label.oncontextmenu=e.dummyLabel.oncontextmenu=function(){return!1};e.label.addEventListener("touchstart",a.preventDefault);e.label.addEventListener("mousedown",
a.preventDefault);e.dummyLabel.addEventListener("mousedown",a.preventDefault);e.checkbox.addEventListener("click",function(a){e.pressed=!0;e.updateAndExecAction()})};a.Checkbox=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k=function(c,b){b=a.Control.call(this,c,b)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+"'");void 0===b.valueExprString&&(b.valueExprString=b.onlyText?"0":"");b.emptyString=!1;b.ok=0;b.tabindex=++b.parent.tabindex;
b.regExpDecimalSymbol=new RegExp("\\"+b.parent.decimal_symbol,"g");if(b.answer)if(b.answer.match("krypto_")&&(b.answer=(new a.Krypto).decode(b.answer.substring(7))),b.answerPattern=b.answer,b.answer=a.buildRegularExpressionsPatterns(b.answer,b.evaluator),b.onlyText){var h=b.answerPattern.indexOf("|");b.firstAnswer=-1==h?b.answerPattern:b.answerPattern.substring(0,h)}else b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(",")));b.onlyText&&(b.valueExprString.match(/^'/)&&
b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:b.id});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(k,a.Control);k.prototype.init=function(c){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var b=this.label.textContent;c||(this.value=this.validateValue(g.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=
0<g.eval(this.font_size)?g.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var h=a.getTextWidth(c+
"_",this.fieldFontSize+"px "+a.sansserif_font),d=parseInt(this.w/2),e=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(d=this.w,h=0);d<e&&(d=e);""==b&&(d=0);this.w-d<h&&(d=this.w-h);0>d&&(d=0);b=this.w-d;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:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.field.value=
c;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.label.width=d*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};k.prototype.update=function(){g=
this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,e=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===e&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),
g.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",
this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};k.prototype.validateValue=function(a){if(""===a||"''"==a)return"";g=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");r=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(r)&&(r=0);p=g.eval(this.min);c=g.eval(this.max);""===p&&(p=-Infinity);""===c&&(c=Infinity);r<p&&(r=p);r>c&&(r=
c);this.discrete&&(a=g.eval(this.incr),r=0===a?0:a*Math.round(r/a));return r=parseFloat(parseFloat(r).toFixed(g.eval(this.decimals)))};k.prototype.formatOutputValue=function(c){return""===c?"":a.Control.prototype.formatOutputValue.call(this,c)};k.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())};k.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};k.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};k.prototype.addEvents=function(){var c=this;c.field.oncontextmenu=c.label.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);
this.field.addEventListener("blur",function(a){c.drawIfValue&&c.changeValue(c.field.value,!0)});this.field.addEventListener("keydown",function(a){c.activeIfValue&&13==a.keyCode&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(a){this.focus()})};a.TextField=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.abs,f,e,r,p,c,k,l,b,h,d,v=function(b,c){function d(b){m.options=b.split(",");m.menuOptions=[];m.strValue=[];b=0;for(var c=m.options.length;b<c;b++){var d=m.customSplit(m.options[b]);1==d.length?(m.menuOptions.push(d[0]),m.strValue.push(b.toString())):2==d.length&&(m.menuOptions.push(d[0]),""==d[1]?m.strValue.push(b.toString()):m.strValue.push(d[1]))}b=0;for(c=m.menuOptions.length;b<c;b++)m.menuOptions[b].match(/^\[/)&&m.menuOptions[b].match(/\]$/)?
m.menuOptions[b]=f.parse(m.menuOptions[b].substring(1,m.menuOptions[b].length-1)):m.menuOptions[b]=f.parse("'"+m.menuOptions[b]+"'");b=0;for(c=m.strValue.length;b<c;b++)m.strValue[b].match(/^\[/)&&m.strValue[b].match(/\]$/)?m.strValue[b]=f.parse(m.strValue[b].substring(1,m.strValue[b].length-1)):m.strValue[b]=f.parse(m.strValue[b]);m.select.innerHTML="";b=0;for(c=m.menuOptions.length;b<c;b++)d=a.newHTML("option"),d.innerHTML=e.eval(m.menuOptions[b]),m.select.appendChild(d);return 0}var h=a.Control.call(this,
b,c)||this;h.label_color=h.label_color||new a.Color("e0e4e8",b.evaluator);h.label_text_color=h.label_text_color||new a.Color("000000",b.evaluator);h.options=c.options||"";f=h.parser;e=h.evaluator;h.ok=0;h.tabindex=++h.parent.tabindex;h.answer&&(h.answer.match("krypto_")&&(h.answer=(new a.Krypto).decode(h.answer.substring(7))),h.answer=parseInt(h.answer.split(",")[0].replace("[",""))||0);h.name_str=h.name;h.name.match(/^\[.*\]?/)?h.name=h.parser.parse(h.name.substring(1,h.name.length-1)):h.name=h.parser.parse("'"+
h.name+"'");var m=h;h.evaluator.setFunction(h.id+".setOptions",d);h.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:h.id});h.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});h.label_ctx=h.label.getContext("2d");h.ratio=b.ratio;h.select=a.newHTML("select",{id:h.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:h.tabindex});h.field=a.newHTML("input",{type:"text",id:h.id+"_menuField",class:"DescartesMenuField",tabindex:h.tabindex});d(h.options);h.containerControl.appendChild(h.label);
h.containerControl.appendChild(h.select);h.visible&&h.containerControl.appendChild(h.field);h.addControlContainer(h.containerControl);h.addEvents();h.init();return h};$jscomp.inherits(v,a.Control);v.prototype.init=function(b){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();var c=this.label.textContent;this.fieldFontSize=0<e.eval(this.font_size)?e.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},
evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var d=0,h=0;this.value=b?this.value:e.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var m=0,f=this.menuOptions.length;m<f;m++)b=a.getTextWidth(e.eval(this.menuOptions[m]).toString(),
this.fieldFontSize+"px "+a.sansserif_font),b>d&&(d=b,h=m);d+=25;b=a.getTextWidth(this.formatOutputValue(e.eval(this.strValue[h])),this.fieldFontSize+"px "+a.sansserif_font)+7;h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==c&&(h=0);this.visible||(b=0);for(c=this.w-b-h;c<d&&0<h;)h--,c++;for(;c<d&&0<b;)b--,c++;for(;h+c+b+1<this.w;)c++,b++;d=h;m=d+c;b=this.w-m;f=this.formatOutputValue(e.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+
this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+h+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=h*this.ratio;this.label.height=this.h*this.ratio;this.field.value=f;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+
m+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+d+"px;");this.select.selectedIndex=this.indexValue;e.setVariable(this.id,parseFloat(f.replace(this.parent.decimal_symbol,".")));this.update()};v.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?
this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=e.eval(this.menuOptions[a]);this.value=e.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);e.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=
this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/
2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};v.prototype.customSplit=function(a){k=!1;l="";b=0;for(h=-1;b<a.length;){d=a.charAt(b);if("["===d&&-1===h){if(k||""!=l)l+="\u00a6";h++}else"["===d?h++:"]"===d&&0===h?(k=!0,h--):"]"==a.charAt(b)&&(h=0>h?h:h-1);l+=a.charAt(b);b++}return l.split("\u00a6")};v.prototype.getIndex=function(a){a=
parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));r=-1;p=Infinity;for(var b=0,d=this.strValue.length;b<d;b++)c=g(a-parseFloat(this.evaluator.eval(this.strValue[b]))),c<=p&&(p=c,r=b);return r};v.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};v.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())});this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()})};a.Menu=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f,e,r,p,c,k,l,b,h,d,v,q,u,A,n,m,w,x,y=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);
c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(y,a.Control);y.prototype.init=function(){f=this.evaluator;0==f.eval(this.decimals)?this.incr=1:this.incr=(f.eval(this.max)-f.eval(this.min))/100;this.value=this.validateValue(f.eval(this.valueExpr));r=this.formatOutputValue(this.value);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(r);this.changeScrollPositionFromValue();this.prePos=this.pos;f.setVariable(this.id,this.value)};y.prototype.initScroll=function(b){e=this;f=e.evaluator;e.label.innerHTML=f.eval(e.name).toString();x=this.label.textContent;var c="v"===e.orientation?parseInt(19+5*(e.h-100)/100):e.h;e.fieldFontSize=0<f.eval(e.font_size)?f.eval(e.font_size):"v"===e.orientation?c-parseInt(e.h/20)-1:a.getFieldFontSize(c);
this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},e.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);b=a.getTextWidth(b+"_",e.fieldFontSize+"px "+a.sansserif_font);var d=e.parent.getSpaceById(e.spaceID).h;
e.labelHeight=""==x?0:c;e.fieldHeight=""==e.visible?0:c;if("v"===e.orientation)e.canvasWidth=e.w,e.canvasHeight=e.h-e.labelHeight-e.fieldHeight,18<=e.canvasHeight+e.y-d&&(e.canvasHeight=d),c=e.fieldHeight,b=c+e.canvasHeight,e.canvasX=0,e.canvasY=e.fieldHeight,e.labelWidth=e.w,e.labelY=b,e.upWidth=e.downW=e.w,e.upHeight=e.downH=15,e.upX=0,e.upY=e.fieldHeight,e.downX=0,e.downY=b-e.downH,e.fieldWidth=e.w,e.fieldX=0,e.scrollHandlerW=e.w,e.scrollHandlerH=parseInt((e.canvasHeight-e.upHeight-e.downH-e.labelHeight-
e.fieldHeight)/10),e.scrollHandlerH=15>e.scrollHandlerH?15:e.scrollHandlerH,e.limInf=b-e.downH-e.scrollHandlerH,e.limSup=c+e.downH;else{c=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);e.labelWidth=c;e.fieldWidth=b;""==x&&(e.labelWidth=0);e.visible||(e.fieldWidth=0);for(b=e.w-e.fieldWidth-e.labelWidth;58>b&&0<e.labelWidth;)e.labelWidth--,b++;for(;58>b&&0<e.fieldWidth;)e.fieldWidth--,b++;c=e.labelWidth;d=c+b;e.fieldWidth=e.w-d;e.canvasWidth=b;e.canvasHeight=e.h;e.canvasX=e.labelWidth;
e.canvasY=0;e.fieldX=e.canvasWidth+e.labelWidth;e.labelHeight=e.h;e.labelY=0;e.upWidth=e.downW=15;e.upHeight=e.downH=e.h;e.upX=d-e.downW;e.upY=0;e.downX=e.labelWidth;e.downY=0;e.scrollHandlerW=parseInt((e.canvasWidth-e.upWidth-e.downW)/10);e.scrollHandlerW=15>e.scrollHandlerW?15:e.scrollHandlerW;e.scrollHandlerH=e.h;e.limInf=c+e.downW;e.limSup=c+e.canvasWidth-e.downW-e.scrollHandlerW}e.container.setAttribute("style","width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+
";");e.canvas.setAttribute("width",e.w+"px");e.canvas.setAttribute("height",e.h+"px");e.canvas.setAttribute("style","position:absolute;left:0;top:0;");e.ctx=e.canvas.getContext("2d");e.ctx.imageSmoothingEnabled=!1;e.divUp.setAttribute("style","width:"+e.upWidth+"px;height:"+e.upHeight+"px;left:"+e.upX+"px;top:"+e.upY+"px;");e.divDown.setAttribute("style","width:"+e.downW+"px;height:"+e.downH+"px;left:"+e.downX+"px;top:"+e.downY+"px;");e.scrollHandler.setAttribute("style","width:"+e.scrollHandlerW+
"px;height:"+e.scrollHandlerH+"px;left:"+("v"===e.orientation?0:e.limInf)+"px;top:"+("v"===e.orientation?e.limInf:0)+"px;");e.field.setAttribute("style","font-size:"+e.fieldFontSize+"px;width:"+e.fieldWidth+"px;height:"+e.fieldHeight+"px;left:"+e.fieldX+"px;top:0;");0===e.fieldHeight&&(e.field.style.display="none");e.label.setAttribute("style","font-size:"+e.fieldFontSize+"px;width:"+e.labelWidth+"px;height:"+e.labelHeight+"px;line-height:"+e.labelHeight+"px;left:0;top:"+e.labelY+"px;background-color:"+
this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=e.labelWidth*this.ratio;this.label.height=e.labelHeight*this.ratio};y.prototype.update=function(){f=this.evaluator;0==f.eval(this.decimals)?this.incr=1:this.incr=(f.eval(this.max)-f.eval(this.min))/100;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display=
"none";this.updatePositionAndSize();var a=this.validateValue(f.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);f.setVariable(this.id,this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,
this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};y.prototype.draw=function(){e=this;c=e.ctx;l=g(this.w);k=
g(this.h);c.fillStyle="#e0e4e8";c.fillRect(0,0,l,k);c.strokeStyle="#7a8a99";c.fillStyle="#ccdcec";e.down&&c.fillRect(e.downX+.5,e.downY+.5,e.downW,e.downH-1);c.strokeRect(e.downX+.5,e.downY+.5,e.downW,e.downH-1);e.up&&c.fillRect(e.upX+.5,e.upY-.5,e.upWidth,e.upHeight+1);c.strokeRect(e.upX+.5,e.upY-.5,e.upWidth,e.upHeight+1);b=4;c.fillStyle="black";c.beginPath();"h"===e.orientation?(c.moveTo(e.downX+b,e.downH/2),c.lineTo(e.downX+e.downW-b,b),c.lineTo(e.downX+e.downW-b,e.downH-b),c.moveTo(e.upX+e.upWidth-
b,e.downH/2),c.lineTo(e.upX+b,b),c.lineTo(e.upX+b,e.downH-b),c.fill(),e.activeIfValue&&(h=g(e.pos),c.fillStyle="#ccdcec",c.fillRect(h+.5,0,g(e.scrollHandlerW),k),c.strokeStyle="#6382bf",c.strokeRect(h+.5,0,g(e.scrollHandlerW),k),d=g(e.scrollHandlerW/2),c.beginPath(),c.moveTo(h+d+.5-2,3),c.lineTo(h+d+.5-2,k-3),c.moveTo(h+d+.5,3),c.lineTo(h+d+.5,k-3),c.moveTo(h+d+.5+2,3),c.lineTo(h+d+.5+2,k-3),c.stroke())):(c.moveTo(e.downX+e.downW/2,e.downY+e.downH-b),c.lineTo(e.downX+b,e.downY+b),c.lineTo(e.downX+
e.downW-b,e.downY+b),c.moveTo(e.upX+e.upWidth/2,e.upY+b),c.lineTo(e.upX+b,e.upY+e.upHeight-b),c.lineTo(e.upX+e.upWidth-b,e.upY+e.upHeight-b),c.fill(),e.activeIfValue&&(h=g(e.pos),c.fillStyle="#ccdcec",c.fillRect(0,h+.5,l,g(e.scrollHandlerH)),c.strokeStyle="#6382bf",c.strokeRect(0,h+.5,l,g(e.scrollHandlerH)),d=g(e.scrollHandlerH/2),c.beginPath(),c.moveTo(3,h+d+.5-2),c.lineTo(l-3,h+d+.5-2),c.moveTo(3,h+d+.5),c.lineTo(l-3,h+d+.5),c.moveTo(3,h+d+.5+2),c.lineTo(l-3,h+d+.5+2),c.stroke()));c.strokeRect(.5,
.5,l-1,k-1);e.activeIfValue||(c.fillStyle="rgba(240,240,240,"+160/255+")",c.fillRect(0,0,l,k.h))};y.prototype.validateValue=function(a){f=this.evaluator;v=a.toString();v=parseFloat(v.replace(this.parent.decimal_symbol,"."));isNaN(v)&&(v=0);this.minimo=f.eval(this.min);v<this.minimo&&(this.value=null,v=this.minimo);this.maximo=f.eval(this.max);v>this.maximo&&(this.value=null,v=this.maximo);q=this.incr;v=0!=q?v*q/q:0;this.fixed&&(v=parseFloat(parseFloat(v).toFixed(f.eval(this.decimals))));return v};
y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};y.prototype.increase10=function(){b=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+b):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+b)};y.prototype.decrease10=function(){b=(this.evaluator.eval(this.max)-
this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-b):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-b)};y.prototype.changeValue=function(a){this.activeIfValue&&(u=this.validateValue(a),u!=this.value&&(this.value=u,this.field.value=this.formatOutputValue(u),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};y.prototype.changeValueForScrollMovement=
function(){f=this.evaluator;A=this.limInf;n=this.limSup;m=f.eval(this.min);w=f.eval(this.max);q=this.incr;u=g((this.pos-A)*(w-m)/(n-A)/q)*q+m;u!=this.value&&(this.value=u,this.field.value=this.formatOutputValue(u),f.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};y.prototype.changeScrollPositionFromValue=function(){f=this.evaluator;A=this.limInf;n=this.limSup;m=f.eval(this.min);w=f.eval(this.max);q=this.incr;this.pos=(this.value-m)*(n-
A)/(w-m)+A;this.scrollHandler.style["h"==this.orientation?"left":"top"]=this.pos+"px"};y.prototype.addEvents=function(){function b(c,d,h,m){a.clearTimeout(u);(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-m)&&(d.call(n),c=h?c:30,u=a.setTimeout(function(){b(c,d,!1,m)},c))}function c(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.clickPos=a.getCursorPosition(c,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?b(350,n.decrease10,!0,n.minimo):
b(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?b(350,n.increase10,!0,n.maximo):b(350,n.decrease10,!0,n.minimo))}function d(b){n.canvasClick=!1;a.clearTimeout(u)}function h(b){1==n.canvasClick&&(n.clickPos=a.getCursorPosition(b,n.container),b.preventDefault())}function m(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",m,!1);window.removeEventListener("mousemove",f,!1);a.preventDefault()}function e(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",
e,!1);window.removeEventListener("touchmove",f,!1);a.preventDefault()}function f(b){var c=a.getCursorPosition(b,n.container);"h"==n.orientation?(n.pos=n.prePos-(n.initPos.x-c.x),n.pos<n.limInf&&(n.pos=n.limInf),n.pos>n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.scrollHandlerW+"px;height:"+n.h+"px;left:"+n.pos+"px;top:0;")):(n.pos=n.prePos-(n.initPos.y-c.y),n.pos>n.limInf&&(n.pos=n.limInf),n.pos<n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+
n.w+"px;height:"+n.scrollHandlerH+"px;left:0;top:"+n.pos+"px;"));n.changeValueForScrollMovement();b.preventDefault()}function g(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,b(350,n.increase,!0,n.maximo))}function k(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,b(350,n.decrease,!0,n.minimo))}function q(b){n.down=!1;a.clearTimeout(u);b.preventDefault()}function l(b){n.up=!1;a.clearTimeout(u);n.draw()}function p(b){n.down=
!1;a.clearTimeout(u);n.draw()}var n=this,u;n.canvas.oncontextmenu=n.divUp.oncontextmenu=n.divDown.oncontextmenu=n.label.oncontextmenu=n.field.oncontextmenu=n.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});this.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.field.value,!0)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",
q);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);this.canvas.addEventListener("touchmove",h);this.canvas.addEventListener("mousemove",h);this.scrollHandler.addEventListener("touchstart",function(b){n.activeIfValue&&(n.scrollClick=!0,n.initPos=a.getCursorPosition(b,n.container),window.addEventListener("touchend",e),window.addEventListener("touchmove",f),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){n.activeIfValue&&(n.scrollClick=!0,
n.initPos=a.getCursorPosition(b,n.container),window.addEventListener("mouseup",m),window.addEventListener("mousemove",f),b.preventDefault())});this.divUp.addEventListener("touchstart",g);this.divUp.addEventListener("mousedown",g);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(b){n.up=!1;a.clearTimeout(u);b.preventDefault()});this.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",l);
window.addEventListener("mouseup",l);window.addEventListener("touchend",p);window.addEventListener("mouseup",p)};a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e=function(e,f){var c=a.Control.call(this,e,f)||this;c.controls=f.controls||!0;c.file=f.file||"";c.oldDrawIf=0;e=c.evaluator.eval(c.expresion);4==e[0].length?(c.w=e[0][2],c.h=e[0][3]):(c.w=200,c.h=28);c.audio=c.parent.getAudio(c.file);c.oldFile=c.file;"]"===c.file.charAt(c.file.length-1)&&(c.file=c.evaluator.parser.parse(c.file.substring(1,c.file.length-1)));c.autoplay&&(c.audio.setAttribute("autoplay","autoplay"),c.audio.play());c.loop&&c.audio.setAttribute("loop",
"loop");c.controls&&c.audio.setAttribute("controls","controls");c.audio.setAttribute("style","position:absolute;width:"+c.w+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.addControlContainer(c.audio);c.evaluator.setFunction(c.id+".play",function(){try{c.audio.play()}catch(k){}return 0});c.evaluator.setFunction(c.id+".pause",function(){try{c.audio.pause()}catch(k){}return 0});c.evaluator.setFunction(c.id+".stop",function(){try{c.audio.pause(),c.audio.currentTime=0}catch(k){}return 0});
c.evaluator.setFunction(c.id+".currentTime",function(a){try{c.audio.currentTime=parseFloat(a)}catch(l){}return 0});c.audio.addEventListener("timeupdate",function(a){c.evaluator.setVariable(c.id+".currentTime",c.audio.currentTime)});return c};$jscomp.inherits(e,a.Control);e.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};e.prototype.update=function(){g=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=g.eval(this.file),this.oldFile!==
this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(f=0<g.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",f!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=f;this.updatePositionAndSize()};a.Audio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e=function(e,f){var c=a.Control.call(this,e,f)||this;c.controls=f.controls||!0;c.file=f.file||"";c.oldDrawIf=0;g=c.evaluator;e=g.eval(c.expresion);4==e[0].length?(c.w=e[0][2],c.h=e[0][3]):(c.w=null,c.h=null);e=c.file;f=e.lastIndexOf(".");-1!=f&&(e=c.file.substring(0,f));c.video=a.newHTML("video",{poster:e+".png",style:"position:absolute;overflow:hidden;left:"+c.x+"px;top:"+c.y+"px;outline:none;background:rgba(0,0,0,0);"});c.autoplay&&c.video.setAttribute("autoplay",
"autoplay");c.loop&&c.video.setAttribute("loop","loop");c.controls&&c.video.setAttribute("controls","controls");c.w&&(c.video.setAttribute("width",c.w),c.video.setAttribute("height",c.h));c.video.canPlayType("video/mp4")&&(f=a.newHTML("source",{src:e+".mp4",type:"video/mp4"}),c.video.appendChild(f));c.video.canPlayType("video/ogg")&&(f=a.newHTML("source",{src:e+".ogg",type:"video/ogg"}),c.video.appendChild(f),f=a.newHTML("source",{src:e+".ogv",type:"video/ogg"}),c.video.appendChild(f));c.video.canPlayType("video/webm")&&
(f=a.newHTML("source",{src:e+".webm",type:"video/webm"}),c.video.appendChild(f));c.addControlContainer(c.video);g.setFunction(c.id+".play",function(){try{c.video.play()}catch(k){}return 0});g.setFunction(c.id+".pause",function(){try{c.video.pause()}catch(k){}return 0});g.setFunction(c.id+".stop",function(){try{c.video.pause(),c.video.currentTime=0}catch(k){}return 0});g.setFunction(c.id+".currentTime",function(a){try{c.video.currentTime=parseFloat(a)}catch(l){}return 0});c.video.addEventListener("timeupdate",
function(a){g.setVariable(c.id+".currentTime",c.video.currentTime)});return c};$jscomp.inherits(e,a.Control);e.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};e.prototype.update=function(){g=this.evaluator;(f=0<g.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",f!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=f;this.updatePositionAndSize()};a.Video=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r=function(e,c){var f=a.Control.call(this,e,c)||this;f.font_family=c.font_family||"Monospaced";f.style=c.style||",PLAIN,";f.font_size=c.font_size||12;typeof("number"!==f.font_size)&&(f.font_size=f.evaluator.eval(f.font_size));f.font=f.font_family+f.style+f.font_size;f.region="interior";f.tabindex=++f.parent.tabindex;if(f.answer){f.answer.match("krypto_")&&(f.answer=(new a.Krypto).decode(f.answer.substring(7)));var g=f.parent.lessonParser.parseText(f.answer)}f.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:f.id,spellcheck:"false"});f.textArea=a.newHTML("div",{class:"DescartesTextAreaContainer",contenteditable:"true"});f.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});f.showButton=a.newHTML("div",{class:"DJS_Gradient"});f.activeCover=a.newHTML("div");f.containerControl.appendChild(f.textArea);f.containerControl.appendChild(f.textAreaAnswer);f.containerControl.appendChild(f.showButton);f.containerControl.appendChild(f.activeCover);
f.addControlContainer(f.containerControl);f.showAnswer=!1;f.text=void 0==f.text||"simpleText"==f.text.type?f.rawText||"":f.text.hasFormula?f.rawText:f.text.toHTML();g&&"simpleText"!==g.type&&(f.answer=f.text.hasFormula?"":g.toHTML());f.evaluator.setVariable(f.id,f.text);var b,h,d;f.evaluator.setFunction(f.id+".insertAtCursor",function(a){(b=window.getSelection())&&b.getRangeAt&&b.rangeCount&&(d=document.createTextNode(a),h=b.getRangeAt(0),h.deleteContents(),h.insertNode(d),h.setStart(d,d.length),
h.setEnd(d,d.length),b.removeAllRanges(),b.addRange(h),f.textArea.focus());return 0});f.evaluator.setFunction(f.id+".update",function(){f.update()});f.addEvents();f.init();return f};$jscomp.inherits(r,a.Control);r.prototype.init=function(){f=this.answer?28:4;g=this.evaluator;var e=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 c=
"padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-f)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",c);this.textArea.innerHTML=e;this.textAreaAnswer.setAttribute("style",c+"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()};r.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);g.getVariable(this.id)!==this.oldValue&&(this.textArea.innerText=
(g.getVariable(this.id)||"").replace(/\\n/g,"\n"));e=this.textArea.innerText||"";e="\n"===e.charAt(e.length-1)?e.substring(0,e.length-1):e;e=e.replace(/\n/g,"\\n").replace(/\s/g," ");g.setVariable(this.id,e);this.oldFieldValue=e;this.oldValue=g.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};r.prototype.addEvents=function(){function a(a){a.preventDefault()}var c=
this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();c.showAnswer=!c.showAnswer;c.textAreaAnswer.style.display=c.showAnswer?"block":"none";c.showButton.childNodes[0].childNodes[0].textContent=c.showAnswer?"T":"S"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();c.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=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,f,e,r,p,c,k,l,b,h,d,v,q,u=function(b,c){var h=a.Control.call(this,b,c)||this;e=b.evaluator.parser;h.spaceID=c.spaceID||"";h.text=c.text||"";h.size=c.size||e.parse("4");h.font=c.font||"Serif,PLAIN,12";h.image=new Image;h.image.onload=function(){this.ready=1};h.imageSrc=c.imageSrc||"";h.imageSrc.match(/^\[.*\]?/)?h.imageSrc=h.parser.parse(h.imageSrc.substring(1,h.imageSrc.length-1)):h.imageSrc=h.parser.parse("'"+h.imageSrc+"'");h.font=a.convertFont(h.font);
if(h.constraintExpr){h.constraint=e.parse(h.constraintExpr);"(expr)"==h.constraint.type&&(h.constraint=e.parse(h.constraintExpr.substring(1,h.constraintExpr.length-1)));if("compOperator"==h.constraint.type){c=h.constraint.childs[0];var f=h.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||f.contains("y")?"identifier"!=c.type||"x"!=c.value||f.contains("x")?h.newt=new a.R2Newton(h.evaluator,h.constraint):(h.constVar="y",h.noConstVar="x",h.evalConst=h.evalConstXoY,h.constraint=f):(h.constVar=
"x",h.noConstVar="y",h.evalConst=h.evalConstXoY,h.constraint=f)}else h.constraint=null;d=new a.R2(0,0)}h.container=h.getContainer();h.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:h.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+h.zIndex+";"});h.ctx=h.space.ctx;h.container.appendChild(h.mouseCatcher);h.addEvents();h.xStr=h.id+".x";h.yStr=h.id+".y";h.activoStr=h.id+".activo";h.activeStr=h.id+".active";""!==h.space.id&&2!==b.version?(h.mxStr=
h.space.id+".mouse_x",h.myStr=h.space.id+".mouse_y",h.mclickedStr=h.space.id+".mouse_clicked",h.mclicizquierdoStr=h.space.id+".clic_izquierdo"):(h.mxStr="mouse_x",h.myStr="mouse_y",h.mclickedStr="mouse_clicked",h.mclicizquierdoStr="clic_izquierdo");h.init();return h};$jscomp.inherits(u,a.Control);u.prototype.init=function(b){f=this.evaluator;v=a.hasTouchSupport;b||(b=f.eval(this.expresion),this.x=b[0][0],this.y=b[0][1],f.setVariable(this.xStr,this.x),f.setVariable(this.yStr,this.y));this.img_src_eval=
f.eval(this.imageSrc).toString().trim();""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*f.eval(this.size),this.height=2*f.eval(this.size),this._w=v&&48>this.width?48:this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,
32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";f.setVariable(this.activoStr,0);f.setVariable(this.activeStr,0);this.setImage=!1;this.update()};u.prototype.update=function(){f=this.evaluator;f.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);this.activeIfValue=0<
f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.x=f.getVariable(this.xStr);this.y=f.getVariable(this.yStr);r=this.space.getAbsoluteX(this.x);p=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(r-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(p-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){f=this.evaluator;this.drawIfValue&&(b=this.ctx,h=this.space.backgroundCtx,
r=parseInt(this.space.getAbsoluteX(this.x))+.5,p=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(r,p),this.image.ready?(c=this.image.width/2,k=this.image.height/2,this.image.complete&&!this.setImage&&b.drawImage(this.image,parseInt(r-c),parseInt(p-k)),this.trace&&(h.save(),h.translate(r,p),h.scale(parseInt(c),parseInt(k)),h.beginPath(),h.arc(0,0,1,0,g),h.restore(),h.lineWidth=1,h.strokeStyle=this.trace.getColor(),h.stroke())):(c=parseInt(this.width/2),b.beginPath(),b.arc(r,
p,c,0,g),b.fillStyle=this.colorInt.getColor(),b.fill(),b.lineWidth=1,b.strokeStyle=this.color.getColor(),b.stroke(),this.active&&(b.strokeStyle=this.colorInt.borderColor(),b.beginPath(),b.arc(r,p,c-2,0,g),b.stroke()),this.trace&&(h.strokeStyle=this.trace.getColor(),h.beginPath(),h.arc(r,p,c,0,g),h.stroke())))};u.prototype.evalConst=function(){d.set(this.x,this.y);l=this.newt.findZero(d,1/this.space.scale,!0);this.x=l.x;this.y=l.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,
this.y)};u.prototype.evalConstXoY=function(){f=this.evaluator;q=f.getVariable(this.constVar);f.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=f.eval(this.constraint);f.setVariable(this.xStr,this.x);f.setVariable(this.yStr,this.y);f.setVariable(this.constVar,q)};u.prototype.drawText=function(a,c){b=this.ctx;f=this.evaluator;"simpleText"==this.text.type?(b.fillStyle=this.color.getColor(),b.font=this.font,b.textBaseline="alphabetic",b.fillText(this.text.toString(f.eval(this.decimals),
this.fixed),parseInt(a+1+this.width/2),parseInt(c-1-this.height/2))):(b.fillStyle=this.color.getColor(),b.strokeStyle=this.color.getColor(),b.textBaseline="alphabetic",this.text.draw(b,parseInt(a+1+this.width/2),parseInt(c-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};u.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,d=a.length;c<d;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;
a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,0)};u.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",d),window.addEventListener("mouseup",
c),window.addEventListener("mousemove",d))}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",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),f=a.getCursorPosition(b,e.container)||f,e.posX=e.prePos.x-(e.posAnte.x-f.x),e.posY=e.prePos.y-
(e.posAnte.y-f.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(f.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(f.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";b=e.evaluator.getVariable(e.activeStr);e.parent.deactivateGraphicControls();
e.parent.updateControls();e.evaluator.setVariable(e.activoStr,b);e.evaluator.setVariable(e.activeStr,b);e.parent.update()}function d(b){b.preventDefault();e.evaluator.setVariable(e.mclickedStr,0);e.evaluator.setVariable(e.mclicizquierdoStr,0);f=a.getCursorPosition(b,e.container);e.posX=e.prePos.x-(e.posAnte.x-f.x);e.posY=e.prePos.y-(e.posAnte.y-f.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(f.x));e.evaluator.setVariable(e.myStr,e.space.getRelativeY(f.y));80<Date.now()-h&&(e.parent.updateControls(),e.parent.update(),h=Date.now())}var h=0,f,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=u;return a}(descartesJS||{});
descartesJS=function(a,g){var f,e,r,p,c,k,l,b,h,d;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var q=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q,R,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,d=a.length;c<d;c++)switch(n=
a[c][0],m=a[c][1],A=g[n],A){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[A]=parseInt(m);break;case "about":case "config":case "init":case "clear":b[A]="true"===g[m];break;default:console.warn("Propiedad de botones no identificada: <"+n+"> valor: <"+m+">")}return b};S.prototype.parseSpace=function(b){w={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Space",A){case "type":if("R2"===m||
"R3"===m)m=g[m];w[A]=m;break;case "id":a.DEBUG.idName=m;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":w[A]=m;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":w[A]="true"===g[m];break;case "bg_display":case "render":w[A]=g[m];break;case "border_color":case "net":case "net10":case "axes":case "text":w[A]=""!=m?"false"===g[m]?"":new a.Color(m,this.parent.evaluator):"";break;case "O.x":w.OxExpr=
m;break;case "O.y":w.OyExpr=m;break;case "image":w.imageSrc=m;break;case "x":u=m;"%"===u[u.length-1]?(w.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=m;w.xExpr=this.parser.parse(u);break;case "y":u=m;"%"===u[u.length-1]?(w.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=m;w.yExpr=this.parser.parse(u);break;case "width":u=m.trim();w.wModExpr=u;"%"===u[u.length-1]?(w.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(m),u!=m&&(u=this.parent.container.width,w._w_=m.trim()));w.w=u;break;case "height":u=m.trim();w.hModExpr=u;"%"===u[u.length-1]?(w.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(m),u!=m&&(u=this.parent.container.height,w._h_=m.trim()));w.h=u;break;case "drawif":""!=m&&(w.drawif=this.parser.parse(m));break;case "scale":u=parseFloat(m);isNaN(u)&&(u=48);w.scale=u;break;case "background":w.background=new a.Color(m,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
n+"> valor: <"+m+">")}return new a["Space"+w.type](this.parent,w)};S.prototype.parseControl=function(b){x={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Control",A){case "type":u=g[m.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");x.type=v(u);break;case "gui":u=g[m];"textfield"===u&&(u="TextField");x[A]=v(u);break;case "id":a.DEBUG.idName=m;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":x[A]=
m;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":x[A]=g[m];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":x[A]="true"===g[m];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":x[A]=new a.Color(m,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
m&&(x[A]=this.parser.parse(m));break;case "constraint":x.constraintExpr=m;break;case "image":x.imageSrc=m;break;case "image_dec":x.image_dec_src=m;break;case "image_inc":x.image_inc_src=m;break;case "space":x.spaceID=m;break;case "expresion":x.expresion=this.parser.parse(m.replace(")(",","));break;case "borderColor":x[A]="false"===g[m]?"":m;break;case "bold":"false"!=g[m]&&(x.bold="bold");break;case "italics":"false"!=g[m]&&(x.italics="italic");break;case "underlined":"false"!=g[m]&&(x.underlined=
!0);break;case "value":var h=m.replace(/&squot;/g,"'");h.match(/^\|/)&&(h="'"+h.substring(1),h.match(/\|$/)&&(h=h.substring(0,h.length-1)+"'"));x.valueExpr=this.parser.parse(h);x.valueExprString=h;break;case "incr":0!=m&&(x.incr=this.parser.parse(m));break;case "exponentialif":x.exponentialif=parseFloat(m);break;case "text":x.rawText=m;h=this.parseText(m);for(var e=0,f=h.length;e<f;e++)h[e]=this.parser.parse(h[e],!1);x.text=h;break;default:e=n.indexOf("."),h=g[n.substring(0,e)],e=g[n.substring(e+
1)],"parameter"===h&&"font"===e?x.parameterFont=m:"Explanation"===h&&"font"===e?x.ExplanationFont=m:"tooltip"===h&&"font"===e?x.tooltipFont=m:console.warn("Propiedad de control no identificada: <"+n+"> valor: <"+m+">")}return new a["Numeric"===x.type?x.gui:x.type](this.parent,x)};S.prototype.parseGraphic=function(b,c,d,h){y={rotateExp:h,parameter:"t"};b=this.split(b);h=0;for(var e=b.length;h<e;h++)if(n=b[h][0],m=b[h][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Graphic",""!=m)switch(A){case "type":a.DEBUG.idName=
m;y[A]=v(g[m]);break;case "align":case "anchor":case "lineDash":y[A]=g[m];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":y[A]="true"===g[m];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":y[A]="false"===g[m]?"":new a.Color(m,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":y[A]=
m;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==m&&(y[A]=this.parser.parse(m));break;case "font_size":m=m.trim();m.match(/^\[.*\]?/)&&(m=m.substring(1,m.length-1));""!==m&&(y[A]=this.parser.parse(m));break;case "space":y.spaceID=m;break;case "expresion":""!==m&&("Macro"!==y.type?(y.expresion=this.parser.parse(m),y.expresionString=m):y.expresion=m);break;
case "text":y.text=m;break;case "file":var f=m.replace(/&squot;/g,"'");"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));f.match(q)&&(f="'"+f+"'");y.file=this.parser.parse(f);break;case "border":""!=m&&"false"!=g[m]&&(y.border=new a.Color(m,this.parent.evaluator));break;default:if(void 0!=y.family&&n.substring(0,y.family.length+1)===y.family+".")switch(g[n.substring(y.family.length+1)]){case "interval":""!=m&&(y.family_interval=this.parser.parse(m));break;case "steps":""!=
m&&(y.family_steps=this.parser.parse(m))}else if(void 0!=y.parameter&&n.match(y.parameter+"."))switch(y.parameter!==n.substring(0,n.indexOf(y.parameter)+y.parameter.length)&&(y.parameter=n.substring(0,n.indexOf(y.parameter)+y.parameter.length)),g[n.substring(y.parameter.length+1)]){case "interval":""!=m&&(y.parameter_interval=this.parser.parse(m));break;case "steps":""!=m&&(y.parameter_steps=this.parser.parse(m))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+n+"> valor: <"+m+">")}c&&
(y.abs_coord=c);d&&(y.background=d);return new a[y.type](this.parent,y)};S.prototype.parse3DGraphic=function(b,c,d,h){y={rotateExp:h,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Graphic3D",A){case "type":a.DEBUG.idName=m;u=g[m];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":y.subType=
u,u="OtherGeometry"}y[A]=v(u);break;case "model":case "align":case "anchor":case "lineDash":y[A]=g[m];break;case "shadowColor":case "fill":y[A]="false"===g[m]?"":new a.Color(m,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":y[A]="true"===g[m];break;case "edges":"false"===g[m]?y[A]="":("true"===g[m]&&(m="808080"),y[A]=new a.Color(m,this.parent.evaluator));break;case "border":""!=m&&"false"!=g[m]&&(y.border=new a.Color(m,this.parent.evaluator));
break;case "color":case "backcolor":y[A]=new a.Color(m,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":""!=m&&(y[A]=this.parser.parse(m));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":y[A]=
m;break;case "space":y.spaceID=m;break;case "expresion":"Macro"!=y.type&&"Curve"!=y.type&&"Surface"!=y.type?(y.expresion=this.parser.parse(m),y.expresionString=m):y.expresion=m.replace(/\\n/g,";");break;case "text":y.text=m;break;case "file":h=m.replace(/&squot;/g,"'");"["===h.charAt(0)&&"]"===h.charAt(h.length-1)&&(h=h.substring(1,h.length-1));h.match(/./)&&(h="'"+h+"'");y.file=this.parser.parse(h);break;default:void 0!==y.family&&n.substring(0,y.family.length+1)===y.family+"."?"interval"===g[n.substring(y.family.length+
1)]?""!=m&&(y.family_interval=this.parser.parse(m)):""!=m&&(y.family_steps=this.parser.parse(m)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+n+"> valor: <"+m+">")}return new a[y.type+"3D"](this.parent,y)};S.prototype.parseAuxiliar=function(b){z={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)b[c][1]=b[c][1].replace(/&squot;/g,"'");c=0;for(d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Auxiliar",A){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=m;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":z[A]=m.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":z[A]="true"===g[m];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":z[A]=this.parser.parse(m);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":z[A]=
g[m];break;default:var h=n.indexOf("."),e=g[n.substring(0,h)];h=g[n.substring(h+1)];"parameter"===e&&"font"===h?z.parameterFont=m:console.warn("Propiedad del auxiliar no identificada: <"+n+"> valor: <"+m+">")}z.sequence?z.type="sequence":z.constant?z.type="constant":z.algorithm&&z.evaluate?z.type="algorithm":z.array&&!z.matrix&&")"!=z.id.charAt(z.id.length-1)?z.type="vector":z.matrix&&")"!=z.id.charAt(z.id.length-1)?z.type="matrix":z.event&&")"!=z.id.charAt(z.id.length-1)?z.type="event":"library"===
z.type?z.type="library":")"===z.id.charAt(z.id.length-1)?z.type="function":z.type="variable";a.DEBUG.typeName=z.type;switch(z.type){case "sequence":new a.Function(this.parent,z);break;case "constant":b=new a.Constant(this.parent,z);z.evaluate&&"always"===z.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,z));break;case "vector":b=new a.Vector(this.parent,z);z.evaluate&&"always"===z.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,z);z.evaluate&&"always"===z.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,z));break;case "library":new a.Library(this.parent,z);break;case "variable":new a.Variable(this.parent,z);break;default:new a.Function(this.parent,z)}};S.prototype.parseAction=function(b){G=b.action;J=b.parent;E=b.parameter;return G?new (a[v(G)])(J,E):{execute:function(){}}};S.prototype.parseAnimation=function(b){var c={};
b=this.split(b);for(var d=0,h=b.length;d<h;d++)switch(n=b[d][0],m=b[d][1],A=g[n],A){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[A]=m.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[A]="true"===g[m];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+n+">  <"+m+">")}return new a.Animation(this.parent,c)};S.prototype.parsePleca=function(g,q){g=this.split(g);e=f="";r=0;p="#536891";c="white";k=
"left";l="";b="SansSerif,BOLD,20";h="SansSerif,PLAIN,18";d=void 0;for(var u=0,v=g.length;u<v;u++)switch(n=g[u][0],m=g[u][1],n){case "title":f=m;break;case "subtitle":e=m;break;case "subtitlines":r=m;break;case "bgcolor":""!=m&&(p=(new a.Color(m,this.parent.evaluator)).getColor());break;case "fgcolor":""!=m&&(c=(new a.Color(m,this.parent.evaluator)).getColor());break;case "align":""!=m&&(k=m);break;case "titleimage":l=m;break;case "titlefont":b=""!=m?a.convertFont(m):a.convertFont(b);break;case "subtitlefont":h=
""!=m?a.convertFont(m):a.convertFont(h);break;default:console.warn("Propiedad de la pleca no identificada: <"+n+">  <"+m+">")}if(""===f&&""===e)return a.newHTML("div");O=h.substring(0,h.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=l&&(H=this.parent.getImage(l),P=H.height);d=a.newHTML("div",{id:"descartesPleca"});P?(d.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+q+"px;height:"+P+"px;background-color:"+p+";color:"+c+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
H.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),d.appendChild(H)):d.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+q+"px;background:"+p+";color:"+c+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+b+";overflow:hidden;white-space:nowrap;"});C.innerHTML=f;N=a.newHTML("div");if(1===parseInt(r)){V=0;K=a.newHTML("div");K.innerHTML=e;document.body.appendChild(K);R=O;do R-=
V,K.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+R+"px;width:"+(q-30)+"px;line-height:"+R+"px;"),Q=K.offsetHeight,W=Q/R,V=1;while(1<W&&8<R);document.body.removeChild(K);N.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+R+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else N.setAttribute("style","padding:0;margin:0;font:"+h+";line-height:1em;");N.innerHTML=e;d.appendChild(C);d.appendChild(N);d.imageHeight=P;return d};S.prototype.split=function(a){if("string"!==
typeof a)return[];F=[];a=(a||"").replace(/\\'/g,"\u2019");D=B=I=0;for(L=M=!1;D<a.length;)" "!==a.charAt(D)||L||D++," "===a.charAt(D)||L||(L=!0,I=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,F[B]=[a.substring(I,D)],I=D+2,D+=2),M&&"'"===a.charAt(D)&&(L=M=!1,F[B].push(a.substring(I,D)),B++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||M||(F[B]=[a.substring(I,D)],I=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),F[B].push(a.substring(I,
T)),B++,L=!1,D=T),D++;return F};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 g(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||k(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=k(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function f(a,b){A=[];A.type="matrix";A.rows=a;A.cols=b;m=0;for(w=b;m<w;m++)A[m]=Array(a).fill(0);return A}function e(a,b){q=a.rows;u=a.cols;A=f(q,u);var c;for(m=0;m<q;m++)for(n=0;n<u;n++){for(w=c=0;w<u;w++)c+=a[w][m]*b[n][w];A[n][m]=c}return A}function r(a,b,c){for(var d=f(c.length-1,c.length-1),h=0,e=d.length;h<
e;h++)for(var g=0;g<e;g++)d[h][g]=h<a?g<b?c[h][g]:c[h][g+1]:h<b?c[h+1][g]:c[h+1][g+1];return d}function p(a){if(1<a.cols){for(var b=0,c=1,d=0,h=a.cols;d<h;d++)b+=c*a[0][d]*p(r(0,d,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var c={},k=Math.floor,l,b,h,d,v,q,u,A,n,m,w,x=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};x.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};x.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
x.prototype.replaceLastChild=function(a){h=this.childs.length-1;b=this.childs[h];b.parent=null;this.childs[h]=a;a.parent=this;return a};x.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};x.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new x("compOperator","=="),v.addChild(this),v.addChild(new x("number","0")),d=this.getRoot(),d.setAllEvalFun(),
d):this};x.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=0,b=this.childs.length;a<b;a++)if("square_bracket"===this.childs[a].type||"parentheses"===this.childs[a].type)this.childArray=this.childArray.concat(this.childs[a].childs);return this.childArray}return null};x.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};x.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 b;this.evaluate=function(a,c){b=a.variables[this.value];if("object"===typeof b&&void 0==b.length)return b.evaluate(a);void 0==b&&(c||a.matrices[this.value]?b=a.matrices[this.value]:
a.vectors[this.value]&&(b=a.vectors[this.value]));return void 0!==b?b:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var d;this.evaluate=function(a){try{return d=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==d?d: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 d=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==d?d:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var h,v,w;this.evaluate=function(a){h=[];for(var b=0,d=this.childs[0].childs.length;b<d;b++)h[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){l=0<h.length?h[0]:0;if("number"==typeof l)return"NaN";l.match(",")&&parseFloat(l.replace(",","."))==l.replace(",",".")&&(l=l.replace(",","."));if(void 0==c[l]){v=l.match(/:=/g)?!0:!1;if(l.match(";")){var e=
!1,f=[],g=0;b=0;for(d=l.length;b<d;b++){var m=l.charAt(b);"'"===m&&(e=!e);e||";"!==m||(f.push(l.substring(g,b)),g=b+1)}f.push(l.substring(g));l="("+f.join(")(")+")"}c[l]=a.parser.parse(l,v)}w=a.eval(c[l]);return void 0!=w?w:NaN}return a.functions[this.value].apply(a,h)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(b){var c=this.childs[0].evaluate(b,!0);b=this.childs[1].evaluate(b,!0);if("matrix"!==c.type||"matrix"!==b.type)return"number"==typeof c&&"string"==typeof b?c=a.removeNeedlessDecimals(c.toString()):
"string"==typeof c&&"number"==typeof b&&(b=a.removeNeedlessDecimals(b.toString())),c+b;q=c.rows;u=c.cols;A=f(q,u);for(m=0;m<q;m++)for(n=0;n<u;n++)A[n][m]=c[n][m]+b[n][m];return 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;q=b.rows;u=b.cols;A=f(q,u);for(m=0;m<q;m++)for(n=0;n<u;n++)A[n][m]=b[n][m]-a[n][m];return A}:"*"===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:e(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 c=f(a.length,a.length),d=p(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var h=0,g=a.length;h<g;h++){var m=d;for(var q=0;q<g;q++)c[q][h]=m*p(r(h,q,a)),m=-m;d=-d}else c[0][0]=d;a=c}b=0===a?f(b.rows,b.cols):e(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-k(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?g(b,a):1/g(b,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+(1E-8>Math.abs(b-a)):+(b===a)}:"!="===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&
"number"==typeof a?+!(1E-8>Math.abs(b-a)):+(b!==a)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):
this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);
else for(var d=0;d<b;d++){var h=[];for(var e=0,f=this.childs[d].childs.length;e<f;e++)h.push(this.childs[d].childs[e].evaluate(a));c[d]=h}return c};else if("assign"===this.type){var x,D=this.childs[0],B=this.childs[1],L=D.childs[0]?D.childs[0].childs:null;this.evaluate=1===D.childs.length&&"square_bracket"===D.childs[0].type&&1===L.length?function(a){x=B.evaluate(a);a.setVector(D.value,L[0].evaluate(a),x);return x}:1===D.childs.length&&"square_bracket"===D.childs[0].type&&2===L.length?function(a){x=
B.evaluate(a);a.setMatrix(D.value,L[0].evaluate(a),L[1].evaluate(a),x);return x}:function(a){x=B.evaluate(a);return x.type?a.matrices[D.value]=x:"object"!==typeof a.variables[D.value]?a.variables[D.value]=x:0}}};a.Node=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b=/^\s+/,h=/^[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]*)*/,d=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,q=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,A=/^[\?:]/,n=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,m=/^\[|^\]/,w=/^\(|^\)/,x=/^,/,y=/^;/,z=/\|/g,G=/\|\*/g,J=/\*\|/g,E,F=/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(F){function B(a,b,d){f.push({type:a,value:b});c=c.slice(d);r+=d;l=a}if(g=F){var D=F.indexOf("//");0<=D&&":"!==F[D-1]&&(F=F.substring(0,D));F=F.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});F=F.replace(/&sup(.+);/g,"^ $1 ");F=F.replace(/&squot;/g,"'");F.match(/=\|\*/g)&&(F=F.replace(G,"'").replace(J,"'"));F.match(/=\|/g)&&(F=F.replace(z,"'"));D=F.trim();"|"==D.charAt(0)&&"|"==D.charAt(D.length-1)&&
(F=D.replace(z,"'"))}f=[];e=!1;r=0;c=F;for(l="";F&&r<F.length;)if(e=r,"'"==c[0]){for(k=1;"'"!=c[k];)if(k<c.length)k++;else{console.info(">Error, unknown symbol: ["+c+"], in the string \u300a"+g+"\u300b");return}p=c.substring(1,k);B("string",p,p.length+2)}else if(p=c.match(b))c=c.slice(p[0].length),r+=p[0].length;else if(p=c.match(n))p[0]=p[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),B("operator",p[0],p[0].length);else if(p=c.match(h))"number"===l&&
f.push({type:"operator",value:"*"}),B("identifier",p[0],p[0].length);else if(p=c.match(d))B("number",p[0],p[0].length);else if(p=c.match(v))D=p[0],"#"==D&&(D="!="),B("compOperator",D,p[0].length);else if(p=c.match(q))D=p[0],"||"==D?D="|":"&&"==D?D="&":"~"==D&&(D="!"),B("boolOperator",D,p[0].length);else if((p=c.match(u))&&!c.match(/^==/))B("assign",p[0],p[0].length);else if(p=c.match(A))B("conditional",p[0],p[0].length);else if(p=c.match(m))B("square_bracket",p[0],p[0].length);else if(p=c.match(w))"("==
p&&"number"===l&&f.push({type:"operator",value:"*"}),B("parentheses",p[0],p[0].length);else if(p=c.match(x))B("separator",p[0],p[0].length);else if(178===c.charCodeAt(0))f.push({type:"operator",value:"^"}),B("number",2,1);else if(179===c.charCodeAt(0))f.push({type:"operator",value:"^"}),B("number",3,1);else if(p=c.match(y))B("final_of_expression",p[0],p[0].length);else if(e==r){a.DEBUG.setError(a.DEBUG.EXPRESSION,g);return}return f};D.prototype.flatTokens=function(a,b){a=a||[];b=b||"";E="";for(var c=
0,d=a.length;c<d;c++)E="string"==a[c].type?E+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(F)?E+a[c].value:E+b+a[c].value;return E};a.Tokenizer=D;return a}(descartesJS||{});
descartesJS=function(a){function g(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function f(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-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 e=Date.now(),r,p,c,k,l,b,h,d,v,q,u,A,n=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()};n.prototype.setDefinition=function(a,b){this.definitions[a]=b};n.prototype.getDefinition=function(a){return this.definitions[a]};n.prototype.setVariable=function(a,b){this.variables[a]=b};n.prototype.getVariable=function(a,
b){b&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};n.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};n.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};n.prototype.setMatrix=function(a,b,c,d){this.matrices[a][b][c]=d};n.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};n.prototype.setFunction=
function(a,b){this.functions[a]=b};n.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};n.prototype.parse=function(e,f){(c=this.tokenizer.tokenize(e))||(c=[]);k=null;f=!f||!1;r=d=h=b=0;for(p=c.length;r<p;r++){v=c[r];q=v.value;u=v.type;if("identifier"===u)if(r+1<p&&"parentheses"===c[r+1].type&&"("===c[r+1].value)this.getFunction(q);else if(r+1<p&&"square_bracket"===c[r+1].type&&"["===c[r+1].value)c[r+3]&&"square_bracket"===
c[r+3].type&&"]"===c[r+3].value?this.getVector(q):this.getMatrix(q);else{var m=q.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);m&&(this.variables[(m[1]||m[2]||m[3]||m[4]||m[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(q,!0)}"assign"===u&&f&&":="!=q&&(u="compOperator",q="==");if("assign"===u)if(l=new a.Node(u,q),null!=k)if("identifier"===k.type)k.parent&&k.parent.replaceLastChild(l),l.addChild(k),k=l,f=!0;else if("square_bracket"===k.type)l.addChild(k.parent),
k=l,f=!0;else{l.type="compOperator";l.value="==";for(f=!0;k.parent&&g(k.parent.value)>=g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{console.info("Error1: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===q||"square_bracket"===u&&"["===q)if(l=new a.Node(u,q),"("===q&&b++,"["===q&&h++,null===k)"("===q&&(new a.Node("(expr)","(expr)")).addChild(l),"["===q&&(new a.Node("[expr]","[expr]")).addChild(l),
k=l;else if("operator"===k.type||"boolOperator"===k.type||"compOperator"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(l),k=l;else if("sign"===k.type)k.addChild(l),k=l;else if("parentheses"===k.type&&"("===k.value)k.addChild(l),k=l;else if("square_bracket"===k.type&&"["===k.value)k.addChild(l),k=l;else if("parentheses"===k.type&&"()"===k.value)k.parent.addChild(l),k=l;else if("square_bracket"===k.type&&"[]"===k.value)k.parent.addChild(l),k=l;else if("identifier"===k.type)k.addChild(l),
k=l;else{console.info("Error2: en la expresi\u00f3n \u300a "+e+" \u300b, en el token ["+r+"] {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&")"===q)if(b--,null===k)console.info("Error3: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;k&&k.parent&&("("!=k.value||"("==k.value&&"parentheses"!=k.type);)k=k.parent;if(k&&"("===k.value)k.value="()";else break}else if("square_bracket"===u&&"]"===q)if(h--,null===k)console.info("Error5: en la expresi\u00f3n \u300a "+
e+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;k&&k.parent&&("["!=k.value||"["==k.value&&"square_bracket"!=k.type);)k=k.parent;if(k&&"["===k.value)k.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(l=new a.Node(u,q),null===k)k=l;else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"parentheses"===k.type&&"("===k.value||"square_bracket"===
k.type&&"["===k.value||"sign"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(l),k=l;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,e);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(l=new a.Node(u,q),null===k)if("-"===q||"+"===q)l.type="sign",l.value="sign"+q,k=l;else if("!"===q)k=l;else{console.info("Error8: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===
k.type||"assign"===k.type||"conditional"===k.type||"square_bracket"===k.type&&"["===k.value&&("-"===q||"+"===q||"!"===q)||"parentheses"===k.type&&"("===k.value&&("-"===q||"+"===q||"!"===q)){if("-"===q||"+"===q)l.type="sign",l.value="sign"+q;k.addChild(l);k=l}else if("number"===k.type||"parentheses"===k.type&&"()"===k.value||"square_bracket"===k.type&&"[]"===k.value||"string"===k.type||"identifier"===k.type||"conditional"===k.type||"assign"===k.type){for(;k.parent&&g(k.parent.value)>=g(l.value);)k=
k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{console.info("Error9: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("conditional"===u)if(l=new a.Node(u,q),null!=k)if("?"===l.value){for(d++;k.parent&&g(k.parent.value)>g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{for(d--;k&&k.parent&&("?"!=k.value||"?"==k.value&&"conditional"!=k.type);)k=k.parent;if(k&&"?"===k.value)k.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+
e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("separator"===u)if(null!=k)for(;k.parent&&"("!=k.value&&"["!=k.value;)k=k.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}0<
b&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,e);0>b&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,e);0<h&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,e);0>h&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,e);0!=d&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,e);(A=k?k.getRoot():null)&&A.setAllEvalFun();return A};n.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,d,h){return a.esCorrecto(c,d,b.evaluator,
h)};b.functions.escorrecto=function(c,d,h){return a.escorrecto(c,d,b.evaluator,h)};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 d=a.indexOf(b);0<=d;)a=
a.substring(0,d)+c+a.substring(d+b.length),d=a.indexOf(b,d+c.length);return a};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 d=b.matrices[c];if(d){for(var h="<"+c+">\\n",e=b.getVariable(c+".columnas_usadas")||d.cols||0,f=b.getVariable(c+".filas_usadas")||d.rows||0,g,q=0;q<e;q++){for(var m=0;m<f;m++)g=d[q][m],void 0!==g&&("string"==typeof g?g="'"+g+"'":"number"==typeof g&&(g=a.removeNeedlessDecimals(g.toFixed(6))),
h+=g+(m<f-1?" \u00a6 ":""));h=h.replace(/(\u00A6 )$/g,"")+"\\n"}return h+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var d=[],h=!1,e=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,q=a.length;g<q;g++)a[g].match("<"+c+">")?(e=!0,h=a[g].trim().split("<"+c+">"),2==h.length&&""!=h[1]&&d.push(h[1].split(String.fromCharCode("166")).map(f)),h=!0):(a[g].match("</"+c+">")&&(h=a[g].trim().split("</"+c+">"),2==h.length&&""!=h[0]&&d.push(h[0].split(String.fromCharCode("166")).map(f)),
h=!1,g=a.length),h&&d.push(a[g].split(String.fromCharCode("166")).map(f)));b.matrices[c]=d;b.matrices[c].rows=d&&d[0]&&d[0].length?d[0].length:0;b.matrices[c].cols=d&&d.length?d.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 d="<"+a+">\\n",h=b.getVariable(a+
".long_usada")||c._size_||0,e,f=0;f<h;f++)e=c[f],void 0!==e?("number"==typeof e&&(e=parseFloat(e)),d+=e+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var d=[],h=!1,e=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,q=a.length;g<q;g++)a[g].match("<"+c+">")?h=e=!0:(a[g].match("</"+c+">")&&(h=!1,g=a.length),h&&d.push(f(a[g])));d._size_=d.length;b.vectors[c]=d;b.setVariable(c+".long",d.length);b.setVariable(c+".long_usada",d.length)}return e?
"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var d=[],h=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var e=0,f=a.length;e<f;e++)a[e].match("<"+c+">")?(h=a[e].trim().split("<"+c+">"),2==h.length&&""!=h[1]&&(d=d.concat(h[1].split(String.fromCharCode("166")))),h=!0):a[e].match("</"+c+">")?(h=a[e].trim().split("</"+c+">"),2==h.length&&""!=h[0]&&(d=d.concat(h[0].split(String.fromCharCode("166")))),h=!1):h&&(d=d.concat(a[e].split(String.fromCharCode("166"))));
e=0;for(f=d.length;e<f;e++)h=d[e].split("="),h[0]=h[0].trim(),2==h.length&&""!=h[0]&&(isNaN(parseFloat(h[1]))?b.setVariable(h[0],h[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(h[0],parseFloat(h[1])))}return 0};var c=a.newHTML("a",{target:"_blank"}),d,h=null;a.newBlobContent=null;b.functions._Save_=function(f,g){b.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(e=Date.now(),document.body.appendChild(c),h=g.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,
"\\"),d=new Blob(["\ufeff",h],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(d)),c.setAttribute("download",f),h!=a.newBlobContent&&(c.click(),a.newBlobContent=h),document.body.removeChild(c));return 0};var g=a.newHTML("a",{target:"_blank"});b.functions._SaveSpace_=function(c,d){b.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(e=Date.now(),document.body.appendChild(g),h=d,g.setAttribute("href",h),g.setAttribute("download",c),h!=a.newBlobContent&&(g.click(),
a.newBlobContent=h),document.body.removeChild(g));return 0};var q,l,k=a.newHTML("input",{type:"file"});k.addEventListener("change",function(c){q=c.target.files;l=new FileReader;l.onload=function(c){a.addExternalFileContent(q[0].name,c.target.result);b.setVariable("DJS.fileName",q[0].name);b.setVariable("DJS.fileContent",c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());k.value=""};0<q.length&&l.readAsText(q[0])});b.functions._Open_=
function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(b._callback=a,k.click(),e=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,d,h){return a.getTextWidth(b,a.convertFont(c+","+d+","+h))};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=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f=function(e){this.parent=e;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};f.prototype.setDefinition=function(a,f){this.definitions[a]=f};f.prototype.getDefinition=function(a){return this.definitions[a]};f.prototype.setVariable=function(a,f){this.variables[a]=f};f.prototype.getVariable=
function(a){return this.variables[a]};f.prototype.setVector=function(a,f,p){f=0>f?0:g(f);this.vectors[a][f]=p};f.prototype.getVector=function(a,f){f=0>f?0:g(f);return this.vectors[a][f]};f.prototype.setMatrix=function(a,f,p,c){f=0>f?0:g(f);p=0>p?0:g(p);void 0==this.matrices[a][f]&&(this.matrices[a][f]=[]);this.matrices[a][f][p]=c};f.prototype.getMatrix=function(a,f,p){f=0>f?0:g(f);p=0>p?0:g(p);return this.matrices[a][f][p]};f.prototype.setFunction=function(a,f){this.functions[a]=f};f.prototype.getFunction=
function(a){return this.functions[a]};f.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new f;a.Evaluator=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h,d,v,q,u,A,n=function(b,c){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==c;this.textStr=(c||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;c.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=c,this.textNodes=(new a.RTFParser(b.evaluator)).parse(c.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};n.prototype.drawText=function(b,d,h,q,l){g=this.evaluator.eval(this.decimals);f=this.evaluator.eval(this.parent.width);
e=this.evaluator.eval(this.parent.font_size);r=d.getColor?d.getColor():d;p=this.textToString(this.text,g,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=p.indexOf("[")&&(p=this.textToString(this.parseSimpleText(p),g,this.fixed));if(this.oldTextStr!==p||this.oldWidth!==f||this.oldSize!==e||this.oldColor!==r||this.oldPosX!==h||this.oldPoxY!==q)c=new a.TextStyle({size:e,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:r,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(p,this.evaluator,c),this.textNodes.update(h,q,g,this.fixed,this.align,this.anchor,r,f);l||this.textNodes.draw(b);this.oldTextStr=p;this.oldWidth=
f;this.oldSize=e;this.oldColor=r;this.oldPosX=h;this.oldPoxY=q};n.prototype.drawRTF=function(a,b,c,d,h){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));h||this.textNodes.draw(a)};n.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");k=[];l="'";h=b=0;d=-1;for(u=a.length;b<u;)v=a.charAt(b),q=a.charAt(b-1),"["===v&&"\\"===q?(k.push(a.substring(h,b-1)+"["),h=b+1):"]"===v&&"\\"===q?(k.push(a.substring(h,b-1)+"]"),h=b+1):"["===v&&-1===d?(k.push(a.substring(h,b)),h=b,d++):"["===v?d++:"]"===v&&0===d?(k.push(this.evaluator.parser.parse(a.substring(h,b+1))),h=b+1,d--):("]"==a.charAt(b)&&(d=0>d?d:d-1),l+=a.charAt(b)),b++;k.push(a.substring(h,b));return k};n.prototype.textToString=function(b,c,d){l="";if("rtfNode"!==
b.type)for(var h=0,e=b.length;h<e;h++)"string"===typeof b[h]?l+=b[h]:(A=this.evaluator.eval(b[h])[0][0],""!==A&&("string"===typeof A?l+=A:Infinity===A?l+="Infinity":-Infinity===A?l+="-Infinity":isNaN(A)||"NaN"===A?l+="NaN":(A=parseFloat(A),A=d?A.toFixed(c):a.removeNeedlessDecimals(A.toFixed(c)),l+=A.toString().replace(".",this.decimal_symbol))));return l};a.TextObject=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f=function(){};f.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var e=[],f=null,c=0,k=a.length;a.charAt(0);var l=!1,b=!1,h=0;g="";for(var d=0;d<k;d++){var v=a.charAt(d);var q=a.charAt(d+1);"\\"===v&&"$"===q&&(b=!0);"{"===v?h++:"}"===v&&(h--,b&&0===h&&(b=!1));b?"_"===v?"{"===q?g+="\\subindex":(g+="\\subindex{"+q+"}",d++):"^"===v?"{"===q?g+="\\superindex":(g+="\\superindex{"+q+"}",d++):g+=v:g+=v}a=g;q=a.charAt(0);for(k=a.length;c<
k;)v=q,q=a.charAt(c+1),l&&("{"===v||"["===v||"\\"===v||" "===v?(l=!1," "===v&&(f={type:"ignore"},e.push(f))):f.value+=v),l||"\\"!==v?l||"{"!==v&&"["!==v?l||"}"!==v&&"]"!==v?l||(f&&"text"===f.type?f.value+=v:f&&"ignore"===f.type?(e.pop(),f=e[e.length-1]):(f={type:"text",value:v},e.push(f))):(f={type:"close",value:v},e.push(f)):(f={type:"open",value:v},e.push(f)):(l=!0,f={type:"command",value:""},e.push(f)),c++;return e};a.DescarTeXTokenizer=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(){this.tokenizer=new a.DescarTeXTokenizer};g.prototype.parse=function(f,e,g){f=this.tokenizer.tokenize(f);var p=new a.TextNode("","textBlock",g,null),c=new a.TextNode("","textLineBlock",g.clone(),null);p.addChild(c);for(var k=[],l=void 0,b=g,h=[g],d,v,q,u,r=!1,n=0,m=f.length;n<m;n++)if("text"===f[n].type)if("color_parameter"===l)v=new a.Color(f[n].value,e);else if("text_size_parameter"===l)q=parseFloat(f[n].value);else if("textLineBlock"===
c.nodeType){d=f[n].value.split(" ");for(var w=0,x=d.length;w<x;w++)""!==d[w]&&c.addChild(new a.TextNode(d[w],"text",b.clone(),null)),w+1<x&&c.addChild(new a.TextNode(" ","space",b.clone(),null))}else c.addChild(new a.TextNode(f[n].value,"text",b.clone(),null));else"command"===f[n].type&&"curlyBracketOpen"===f[n].value?c.addChild(new a.TextNode("{","text",b.clone(),null)):"command"===f[n].type&&"curlyBracketClose"===f[n].value?c.addChild(new a.TextNode("}","text",b.clone(),null)):"command"===f[n].type&&
"squareBracketOpen"===f[n].value?c.addChild(new a.TextNode("[","text",b.clone(),null)):"command"===f[n].type&&"squareBracketClose"===f[n].value?c.addChild(new a.TextNode("]","text",b.clone(),null)):"command"===f[n].type&&"newline"===f[n].value?(0===c.children.length&&c.addChild(new a.TextNode("","text",b.clone(),null)),c=new a.TextNode("","textLineBlock",g.clone(),null),p.addChild(c)):"command"===f[n].type&&"b"===f[n].value?(l="bold",k.push(l)):"command"===f[n].type&&"i"===f[n].value?(l="italic",
k.push(l)):"command"===f[n].type&&"o"===f[n].value?(l="overline",k.push(l)):"command"===f[n].type&&"u"===f[n].value?(l="underline",k.push(l)):"command"===f[n].type&&"color"===f[n].value?(l="color",k.push(l)):"command"===f[n].type&&"ts"===f[n].value?(l="text_size",k.push(l)):"command"===f[n].type&&"sansserif"===f[n].value.toLowerCase()?(l="sansserif",k.push(l)):"command"===f[n].type&&"serif"===f[n].value.toLowerCase()?(l="serif",k.push(l)):"command"===f[n].type&&"monospace"===f[n].value.toLowerCase()?
(l="monospace",k.push(l)):"command"===f[n].type&&"c"===f[n].value?(l="center",k.push(l)):"command"===f[n].type&&"l"===f[n].value?(l="left",k.push(l)):"command"===f[n].type&&"r"===f[n].value?(l="right",k.push(l)):"command"===f[n].type&&"j"===f[n].value?(l="justify",k.push(l)):"command"===f[n].type&&"$"===f[n].value?(l="formula",k.push(l),r=!0):"command"===f[n].type&&"sum"===f[n].value?(l="sum",k.push(l)):"command"===f[n].type&&"prod"===f[n].value?(l="prod",k.push(l)):"command"===f[n].type&&"int"===
f[n].value?(l="integral",k.push(l)):"command"===f[n].type&&"lim"===f[n].value?(l="limit",k.push(l)):"command"===f[n].type&&"sqrt"===f[n].value?(l="radical",k.push(l)):"command"===f[n].type&&"subindex"===f[n].value?(l="subIndex",k.push(l)):"command"===f[n].type&&"superindex"===f[n].value?(l="superIndex",k.push(l)):"command"===f[n].type&&"frac"===f[n].value?(l="numerator",k.push(l)):"open"===f[n].type&&"{"===f[n].value&&void 0!==l?"bold"===l||"italic"===l||"overline"===l||"underline"===l?(b=b.clone(),
b[l]=!0,h.push(b)):"sansserif"===l?(b=b.clone(),b.family="sansserif",h.push(b)):"serif"===l?(b=b.clone(),b.family="serif",h.push(b)):"monospace"===l?(b=b.clone(),b.family="monospaced",h.push(b)):"text_size"===l?l="text_size_parameter":"text_size_text"===l?(b=b.clone(),b.size=q,h.push(b)):"color"===l?l="color_parameter":"color_text"===l?(b=b.clone(),b.color=v,h.push(b)):"center"===l||"left"===l||"right"===l||"justify"===l?(b=b.clone(),b.align=l,h.push(b),c=new a.TextNode("","textLineBlock",b.clone(),
null),p.addChild(c)):"formula"===l?(b=b.clone(),h.push(b),u=new a.TextNode("","formula",b.clone(),null),c.addChild(u),c=u):"subIndex"===l||"superIndex"===l?r?(b=b.clone(),h.push(b),u=new a.TextNode("",l,b.clone(),null),c.addChild(u),c=u):c.addChild(new a.TextNode("subIndex"===l?"_":"^","text",b.clone(),null)):"radical"===l?r&&(u=new a.TextNode("","radical",b.clone(),null),c.addChild(u),c=u,b=b.clone(),h.push(b),u=new a.TextNode("","index",b.clone(),null),c.addChild(u),c=u,l="index"):"index"===l?r&&
(h.pop(),b=h[h.length-1],u=new a.TextNode("","radicand",b.clone(),null),c.addChild(u),c=u,l="radicand"):"sum"===l||"integral"===l||"limit"===l||"prod"===l?r&&(u=new a.TextNode("",l,b.clone(),null),c.addChild(u),c=u,b=b.clone(),h.push(b),u=new a.TextNode("","from",b.clone(),null),c.addChild(u),c=u,l="from",k[k.length-1]=l):"from"===l?r&&(u=new a.TextNode("","to",b.clone(),null),c.addChild(u),c=u,l="to",k[k.length-1]=l):"to"===l?r&&(h.pop(),b=h[h.length-1],u=new a.TextNode("","what",b.clone(),null),
c.addChild(u),c=u,l="what",k[k.length-1]=l):"numerator"===l?r&&(u=new a.TextNode("","fraction",b.clone(),null),c.addChild(u),c=u,b=b.clone(),h.push(b),u=new a.TextNode("","numerator",b.clone(),null),c.addChild(u),c=u,l="numerator"):"denominator"===l&&(u=new a.TextNode("",l,b.clone(),null),c.addChild(u),c=u):"close"===f[n].type&&"}"===f[n].value&&void 0!==l&&("bold"===l||"italic"===l||"overline"===l||"underline"===l||"color_text"===l||"color"===l||"text_size_text"===l||"text_size"===l||"sansserif"===
l||"serif"===l||"monospace"===l?(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1]):"color_parameter"===l?l="color_text":"text_size_parameter"===l?l="text_size_text":"center"===l||"left"===l||"right"===l||"justify"===l?(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],f[n+1]&&"command"===f[n+1].type&&"newline"===f[n+1].value?c=p:(c=new a.TextNode("","textLineBlock",b.clone(),null),p.addChild(c))):"formula"===c.nodeType?(r=!1,h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],c=c.parent):"subIndex"===c.nodeType||
"superIndex"===c.nodeType?r&&(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],c=c.parent):"index"===c.nodeType?c=c.parent:"radicand"===c.nodeType?(k.pop(),l=k[k.length-1],c=c.parent.parent):"from"===c.nodeType?c=c.parent:"to"===c.nodeType?c=c.parent:"what"===c.nodeType?(k.pop(),l=k[k.length-1],c=c.parent.parent):"numerator"===c.nodeType?(l="denominator",c=c.parent):"denominator"===c.nodeType&&(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],c=c.parent.parent));var y,z,G=null,J=[];p.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)y=a.children[b],z=a.children[b+1],"text"===y.nodeType&&"text"===z.nodeType&&y.style.equals(z.style)?(null===G&&(G=y,u=y.clone(),G.changeNodeType("word"),G.value="___"+u.value,G.addChild(u)),u=z.clone(),G.addChild(u),J.push(z),G.value+=u.value):G=null});J.forEach(function(a){a.parent.removeChild(a)});p.normalize();p.adjustFontSize();return p};a.DescarTeXParser=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};f.prototype.clone=function(){return new f(Object.assign({},this))};f.prototype.set=function(a){Object.assign(this,a)};f.prototype.equals=function(a){var e=!0,f;for(f in this)this.hasOwnProperty(f)&&(e=e&&this[f]===a[f]);return e};f.prototype.toString=function(e){/arial|sansserif/i.test(this.family)?
g=a.sansserif_font:/times|serif/i.test(this.family)?g=e?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(g=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+g).trim()};a.TextStyle=f;return a}(descartesJS||{});
descartesJS=function(a){function g(a,c){for(var b=0,h=0;h<c;h++)b+=a[h];return b}function f(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((l[a].ascent+25)*c/l[a].unitsPerEm);b.descent=Math.ceil(Math.abs((l[a].descent-25)*c/l[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var e=!1,r="#000000",p=2,c=!1;(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")).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";(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")).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";(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")).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";
(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")).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 k=function(b,c,d,e){this.type="rtfNode";this.evaluator=e;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=b;this.style=d;this.changeNodeType(c);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};k.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}};k.prototype.clone=function(){for(var a=new k(this.value,this.nodeType,this.style.clone()),c=0,d=this.children.length;c<d;c++)a.addChild(this.children[c].clone());return a};k.prototype.toStr=function(){for(var a=this.value,c=0,d=this.children.length;c<d;c++)a+=" "+this.children[c].toStr();return a};k.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var c=0,d=this.children.length;c<d;c++)a+=this.children[c].stringify()+(c==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};k.prototype.addChild=function(a,c){c&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};k.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};k.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};k.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};k.prototype.nextSibling=function(){if(this.parent)for(var a=null,c=0,d=this.parent.children.length;c<d;c++){if(a)return this.parent.children[c];this.parent.children[c]===this&&(a=!0)}return null};k.prototype.prevSibling=function(){if(this.parent)for(var a=0,c=this.parent.children.length-1;a<c;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};k.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,e=this.children.length;c<e;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};k.prototype.insertBefore=function(a,c){a=this.children.indexOf(a);-1!==a&&(c.parent=this,this.children.splice(a,0,c))};k.prototype.insertAfter=function(a,c){a=this.children.indexOf(a);-1!==a&&(c.parent=this,this.children.splice(a+1,0,c))};k.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),c=0,d=a.length;c<d;c++)0===a[c].children.length&&a[c].addChild(new k("","text",a[c].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);c=0;for(d=a.length;c<d;c++){var e=a[c];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,
new k("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&e.parent.insertAfter(e,new k("","text",e.parent.style))}return this};k.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),c=0,d=a.length;c<d;c++)""===a[c].value&&a[c].parent&&a[c].parent.removeChild(a[c])};k.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,e=this.children.length;c<e;c++)"text"===this.children[c].nodeType&&
a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=
b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};k.prototype.propagateStyle=function(a,c){this.style[a]=c;this.styleString=this.style.toString();for(var b=0,h=this.children.length;b<h;b++)this.children[b].propagateStyle(a,c)};k.prototype.update=function(a,h,d,e,f,g,l,k){p=d;c=e;r=l;this.metrics.w=this.metrics.h=0;l=h;if(20<=k)for(d=0;d<this.children.length;d++)this.children[d].breakLines(k);d=0;for(e=this.children.length;d<e;d++){var b=this.children[d];
b.updateLine();b.metrics.offsetX=a;b.metrics.y=h;h+=parseInt(b.metrics.ascent+.5);b.metrics.offsetY=h;f=parseInt(b.metrics.descent+.5)+parseInt(1.5+.05*b.style.size);h+=f;this.metrics.h+=b.metrics.h;this.metrics.w=Math.max(this.metrics.w,b.metrics.w)}h=l;g=g||"";g.match("right")?a-=this.metrics.w:g.match("_center")&&(a-=this.metrics.w/2);g.match("bottom")?h-=this.metrics.h:g.match("center_")&&(h-=this.metrics.h/2);g=this.children;d=0;for(e=g.length;d<e;d++)"left"===g[d].style.align?g[d].metrics.offsetX=
a:"right"===g[d].style.align?g[d].metrics.offsetX=a+this.metrics.w-g[d].metrics.w:"center"===g[d].style.align?g[d].metrics.offsetX=a+(this.metrics.w-g[d].metrics.w)/2:"justify"===g[d].style.align&&20<=k&&(f=d<e-1?g[d+1].value:null,g[d].metrics.offsetX=a,"wrap"===f&&g[d].justifyAux(k)),g[d].metrics.y=h,h+=parseInt(g[d].metrics.ascent+.5),g[d].metrics.offsetY=h,f=parseInt(g[d].metrics.descent+.5)+parseInt(1.5+.05*g[d].style.size),h+=f};k.prototype.breakLines=function(b){for(var c,d=0,e=!1,f=[],g=0,
l=this.children.length;g<l;g++)c=this.children[g],e?f.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<g&&(e=!0,f.push(c)));if(0<f.length)for(b=new k("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),g=0,l=f.length;g<l;g++)f[g].parent&&f[g].parent.removeChild(f[g]),b.addChild(f[g])};
k.prototype.updateLine=function(b){var c=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var d=this.metrics.descent=0,e=this.children,g,l=0,k=e.length;l<k;l++){g=e[l];if("text"===g.nodeType){a.ctx.font=g.style.toString();var n=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=f(a.ctx.font);g.metrics.w=a.ctx.measureText(n).width;g.metrics.offsetX=d;Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===g.nodeType?(a.ctx.font=g.style.toString(),g.metrics=f(a.ctx.font),g.metrics.w=l===k-1?0:b?b:a.ctx.measureText(" ").width,g.metrics.offsetX=d,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===g.nodeType&&(g.updateLine(),g.metrics.offsetX_aux=d,Object.defineProperties(g.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===g.nodeType&&(a.ctx.font=g.styleString,n=""!==g.value?g.value:a.in_editor?"\u200a":"",g.metrics=f(a.ctx.font),g.metrics.w=a.ctx.measureText(n).width,g.metrics.offsetX=d,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),g.clickCatcher||(g.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+g.metrics.w+"px;height:"+
g.metrics.h+"px;cursor:pointer;"}),g.clickCatcher.rtfNode=g,g.clickCatcher.action=new a.OpenURL(this.evaluator.parent,g.URL),g.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===g.nodeType&&(g.componentNumCtrl=this.evaluator.parent.getControlByCId(g.value),a.ctx.font=g.styleString,g.metrics=f(a.ctx.font),g.metrics.w=g.componentNumCtrl.w,g.metrics.h=g.componentNumCtrl.h,g.metrics.offsetX=d,Object.defineProperties(g.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===g.nodeType?(g.componentSpace=this.evaluator.parent.getSpaceByCId(g.value),a.ctx.font=g.styleString,g.metrics=f(a.ctx.font),g.metrics.w=g.componentSpace.w,g.metrics.h=g.componentSpace.h,g.metrics.offsetX=d,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===g.nodeType&&(g.updateFormula(),
g.metrics.marginX=g.metrics.marginY=g.metrics.paddingX=g.metrics.paddingY=0,g.metrics.offsetX_aux=d,Object.defineProperties(g.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}}}),g.metrics.w+=2*g.metrics.paddingX,g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h+=2*g.metrics.paddingY,d+=2*g.metrics.marginX);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);d+=g.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};k.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 h=this.children,d,e=0,l={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}},k=0,r=h.length;k<r;k++){d=h[k];if("text"===d.nodeType){a.ctx.font=d.style.toString(!0);var n=""!==d.value?d.value:a.in_editor?"\u200a":"";d.metrics=f(a.ctx.font);d.metrics.w=a.ctx.measureText(n).width;d.metrics.offsetX=e;Object.defineProperties(d.metrics,{x:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}});e+=b.metrics.marginX}else if("dynamicText"===d.nodeType){n=void 0===
d.decimals?p:d.evaluator.eval(d.decimals);var m=void 0===d.fixed?c:d.fixed,w=d.evaluator.eval(d.value);parseFloat(w).toString()===w.toString()&&(w=m?parseFloat(w).toFixed(n):a.removeNeedlessDecimals(parseFloat(w).toFixed(n)),w=(""+w).replace(".",d.decimal_symbol));d.evalValue=w;a.ctx.font=d.style.toString(!0);d.metrics=f(a.ctx.font);d.metrics.marginX=0;d.metrics.paddingX=0;d.metrics.w=a.ctx.measureText(w).width+2*d.metrics.paddingX;d.metrics.offsetX_aux=e;Object.defineProperties(d.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}}});e+=2*d.metrics.marginX}if("superIndex"===d.nodeType)n=d,n.updateFormula(),n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=e,n.metrics.prevChild=l,Object.defineProperties(n.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.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),n.metrics.w+=2*n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,n.metrics.tmp_ascent=n.metrics.h+(n.metrics.prevChild.metrics.ascent-n.metrics.prevChild.metrics.descent)/2,e+=2*n.metrics.marginX;else if("subIndex"===d.nodeType)n=d,n.updateFormula(),
n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=e,n.metrics.prevChild=l,Object.defineProperties(n.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}},offsetY:{get:function(){return b.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),n.metrics.w+=n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,
n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,this.metrics.descent=n.metrics.ascent+(n.metrics.prevChild.metrics.descent-n.metrics.prevChild.metrics.ascent)/2+n.metrics.descent,e+=n.metrics.marginX;else if("fraction"===d.nodeType){m=d;m.updateFormula();n=m.children;w=n[0];n=n[1];m.metrics.marginX=parseInt(.5+.075*this.style.size);m.metrics.paddingX=0;m.metrics.paddingY=0;var x=Math.max(w.metrics.w,n.metrics.w)+2*m.metrics.paddingX;m.metrics.prevChild=l;m.metrics.offsetX_aux=
e;var y=parseInt(-l.metrics.descent+4*l.metrics.h/9);Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+y}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY-y}}});Object.defineProperties(w.metrics,{parent:{value:m},maxWidth:{value:x},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(n.metrics,{parent:{value:m},maxWidth:{value:x},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}}});m.metrics.w=
x;m.metrics.ascent=w.metrics.h+y+2*m.metrics.paddingY;m.metrics.descent=n.metrics.h-y+2*m.metrics.paddingY;m.metrics.h=w.metrics.h+n.metrics.h+4*m.metrics.paddingY;e+=2*m.metrics.marginX}else if("radical"===d.nodeType){l=d;l.updateFormula();n=l.children;m=n[0];var z=n[1];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=e;Object.defineProperties(l.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}}});n=l.style.size;l.radicalSign={w:n,scaleX:n/722,scaleY:z.metrics.h/1E3};w=parseInt(m.metrics.w-2*l.radicalSign.w/3);Object.defineProperties(l.radicalSign,{parent:{value:l},displaceIndex:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return b.metrics.offsetY-z.metrics.ascent}}});Object.defineProperties(m.metrics,{parent:{value:l},displaceIndex:{value:w},fontSize:{value:n},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(z.metrics,{parent:{value:l},
displaceIndex:{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.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return b.metrics.offsetY}}});w=m.metrics.w<2*l.radicalSign.w/3?l.radicalSign.w:parseInt(m.metrics.w+l.radicalSign.w/3);l.metrics.w=w+2*l.metrics.paddingX+z.metrics.w;l.metrics.ascent=Math.max(z.metrics.ascent,m.metrics.h+2*n/5)+
l.metrics.paddingY;l.metrics.descent=z.metrics.descent+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;e+=2*l.metrics.marginX}else if("sum"===d.nodeType){m=d;m.updateFormula();n=m.children;w=n[0];x=n[1];var G=n[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=e;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=d.style.toString();var J=f(a.ctx.font);l=parseInt(1.2*J.h);n=parseInt(.5+780*l/1E3);m.sigmaSign={w:n,h:l,scale:l/1E3};var E=Math.max(x.metrics.w,w.metrics.w,m.sigmaSign.w);m.sigmaSign.parent=m;Object.defineProperties(m.sigmaSign,{sumWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-x.metrics.descent-(l+J.h)/2-m.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:m},sumWidth:{value:E},newBaselineTo:{value:n},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}}});
l=w.metrics.ascent+J.descent+(l-J.h)/2+m.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:m},sumWidth:{value:E},newBaselineFrom:{value:l},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(G.metrics,{parent:{value:m},sumWidth:{value:E},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return b.metrics.offsetY}}});m.metrics.w=E+G.metrics.w+3*m.metrics.paddingX;m.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+m.metrics.paddingY;m.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent)+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;
e+=2*m.metrics.marginX}else if("integral"===d.nodeType){m=d;m.updateFormula();n=m.children;w=n[0];x=n[1];G=n[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=e;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=d.style.toString();J=f(a.ctx.font);E=parseInt(1.2*J.h);var F=parseInt(10.5+529*E/1E3);m.sign={w:F,h:E,scale:E/1E3};m.sign.parent=m;Object.defineProperties(m.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-(E+J.h)/2-x.metrics.descent+E/3;Object.defineProperties(x.metrics,{parent:{value:m},integralWidth:{value:F},
newBaselineTo:{value:n},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}}});l=J.descent+w.metrics.ascent/2;Object.defineProperties(w.metrics,{parent:{value:m},integralWidth:{value:F},newBaselineFrom:{value:l},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}}});F=Math.max(parseInt(3*F/5)+x.metrics.w,parseInt(2*F/5+w.metrics.w))+m.metrics.paddingX;Object.defineProperties(G.metrics,{parent:{value:m},whatDisplace:{value:F},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}}});m.metrics.w=F+G.metrics.w+2*m.metrics.paddingX;m.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+m.metrics.paddingY;m.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent,E-m.metrics.ascent)+m.metrics.paddingY;m.metrics.h=Math.max(m.metrics.ascent+m.metrics.descent,E);e+=2*m.metrics.marginX}else if("prod"===d.nodeType)m=d,m.updateFormula(),n=m.children,w=n[0],x=n[1],G=n[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=e,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=d.style.toString(),J=f(a.ctx.font),l=parseInt(1.2*J.h),n=parseInt(.5+
876*l/1E3),m.piSign={w:n,h:l,scale:l/1E3},E=Math.max(x.metrics.w,w.metrics.w,m.piSign.w),m.piSign.parent=m,Object.defineProperties(m.piSign,{prodWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}}),n=J.descent-x.metrics.descent-(l+J.h)/2-m.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:m},prodWidth:{value:E},newBaselineTo:{value:n},
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}}}),l=w.metrics.ascent+J.descent+(l-J.h)/2+m.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:m},prodWidth:{value:E},newBaselineFrom:{value:l},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(G.metrics,{parent:{value:m},prodWidth:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return b.metrics.offsetY}}}),
m.metrics.w=E+G.metrics.w+3*m.metrics.paddingX,m.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+m.metrics.paddingY,m.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent)+m.metrics.paddingY,m.metrics.h=m.metrics.ascent+m.metrics.descent,e+=2*m.metrics.marginX;else if("limit"===d.nodeType){l=d;l.updateFormula();n=l.children;var D=n[0];m=n[1];n=n[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=
parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=e;Object.defineProperties(l.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=d.style.toString();J=f(a.ctx.font);w=parseInt(.5+a.ctx.measureText("l\u00edm").width);x=parseInt(.5+a.ctx.measureText("\u2192").width);G=Math.max(w,D.metrics.w+x+m.metrics.w);
l.limitText={parent:l};Object.defineProperties(l.limitText,{limitWidth:{value:G},limitTextWidth:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});w=J.descent+Math.max(D.metrics.ascent,m.metrics.ascent,2*J.ascent/3)+l.metrics.paddingY;l.limitArrow={parent:l};Object.defineProperties(l.limitArrow,{newBaseline:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w}},y:{get:function(){return b.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(D.metrics,{parent:{value:l},newBaseline:{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.newBaseline}}});Object.defineProperties(m.metrics,{parent:{value:l},arrowWidth:{value:x},newBaseline:{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+D.metrics.w+this.arrowWidth}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(n.metrics,{parent:{value:l},limitWidth:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return b.metrics.offsetY}}});
l.metrics.w=G+n.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(n.metrics.ascent,J.ascent)+l.metrics.paddingY;x=0;n=Math.max(D.metrics.descent,m.metrics.descent,n.metrics.descent);if(0!=D.metrics.h||0!=m.metrics.h)x=w,n=Math.max(D.metrics.descent,m.metrics.descent,n-x);l.metrics.descent=x+n+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;e+=2*l.metrics.marginX}else if("matrix"===d.nodeType){w=d;w.updateFormula();n=w.children;x=w.rows;G=w.columns;w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=parseInt(5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=e;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=d.style.toString();J=f(a.ctx.font);E=[];F=[];l=0;for(var B=x*G;l<B;l++){var L=
parseInt(l/G);var I=l%G;E[L]=Math.max(E[L]||0,n[l].metrics.h);F[I]=Math.max(F[I]||0,n[l].metrics.w)}var M=(1+G)*w.metrics.paddingX;for(l=0;l<G;l++)M+=F[l];var O=(1+x)*w.metrics.paddingY;for(l=0;l<x;l++)O+=E[l];m=J.descent-J.h/2;l=0;for(B=x*G;l<B;l++)L=parseInt(l/G),I=l%G,n[l].metrics.offsetX_aux=g(F,I)+(F[I]-n[l].metrics.w)/2+I*w.metrics.paddingX,n[l].metrics.offsetY_aux=g(E,L)+(E[L]-n[l].metrics.h)/2+(1+L)*w.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:w},matrixH:{value:O},
dispY:{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+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.w=M;w.metrics.ascent=O/2-m;w.metrics.descent=O/2+m;w.metrics.h=w.metrics.ascent+w.metrics.descent;e+=2*w.metrics.marginX}else if("defparts"===d.nodeType){w=d;w.updateFormula();n=d.children;
x=d.parts;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=e;Object.defineProperties(w.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=
d.style.toString();J=f(a.ctx.font);G=0;E=w.metrics.paddingY;m=J.descent-J.h/2;for(l=0;l<x;l++)n[l].metrics.offsetY_aux=E,G=Math.max(G,n[l].metrics.w),E+=n[l].metrics.h+w.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:w},dispY:{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}},offsetY:{get:function(){return b.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.defpartsH=E;w.metrics.w=G+4*w.metrics.paddingX;w.metrics.ascent=E/2-m;w.metrics.descent=E/2+m;w.metrics.h=w.metrics.ascent+w.metrics.descent;e+=2*w.metrics.marginX}else if("numerator"===d.nodeType||"denominator"===d.nodeType||"index"===d.nodeType||"radicand"===d.nodeType||"from"===d.nodeType||"to"===d.nodeType||"what"===d.nodeType||"element"===d.nodeType)d.updateFormula(),d.metrics.paddingX=parseInt(1.5+.075*this.style.size),d.metrics.paddingY=
parseInt(1.5+.05*this.style.size),d.metrics.ascent+=d.metrics.paddingY,d.metrics.descent+=d.metrics.paddingY,d.metrics.h=d.metrics.ascent+d.metrics.descent,1==d.children.length&&"text"==d.children[0].nodeType&&""==d.children[0].value?(d.metrics.w=0,a.in_editor||(d.metrics.ascent=d.metrics.descent=d.metrics.h=0)):d.metrics.w+=2*d.metrics.paddingX;l=d;this.metrics.ascent=Math.max(this.metrics.ascent,d.metrics.tmp_ascent||d.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,d.metrics.descent);
this.metrics.w+=d.metrics.w+2*d.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;e+=d.metrics.w}};k.prototype.justifyAux=function(a){for(var b=0,c=0,e=0,f=this.children.length;e<f-1;e++)"space"===this.children[e].nodeType?b++:c+=this.children[e].metrics.w;this.updateLine((a-c)/b)};k.prototype.drawTextBlock=function(a){a.fillStyle=r;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.shadowColor="transparent"};k.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)e=!1,this.children[b].draw(a)};k.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(e);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+
parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var f=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=
f}a.fillText(this.value,b,c)}};k.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};k.prototype.drawSpace=function(a){};k.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(e);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+parseInt(1+this.style.size/
25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,c);this.drawBorder(a,"blue")};k.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(e);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)};k.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)e=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};k.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};k.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.save();a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,
this.radicalSign.scaleY);this.drawRadicalSign(a);a.restore();a.beginPath();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.sigmaSign.x,this.sigmaSign.y);a.scale(this.sigmaSign.scale,
this.sigmaSign.scale);if(this.style.border){var b=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineWidth=parseInt(a.lineWidth/this.sigmaSign.scale);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeStyle=b}this.drawSigmaSign(a);a.restore();b=0;for(var c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.sign.x,this.sign.y);a.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.piSign.x,this.piSign.y);
a.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&a.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};k.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-
this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?
(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};k.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/
2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+
this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};k.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.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)};k.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)};k.prototype.drawRadicalSign=function(a){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.stroke();a.fill()};k.prototype.drawSigmaSign=function(a){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.stroke();a.fill()};k.prototype.drawIntegralSign=function(a){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.stroke();a.fill()};k.prototype.drawProdSign=function(a){a.beginPath();a.moveTo(876.3561,999.59384);a.lineTo(876.3561,972.20771);a.lineTo(858.75073,972.20771);a.bezierCurveTo(794.19771,
972.20771,761.92121,931.12852,761.92121,847.99206);a.lineTo(761.92121,144.75542);a.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);a.lineTo(876.3561,1.7633057E-4);a.lineTo(1.184082E-5,1.7633057E-4);a.lineTo(1.184082E-5,27.386304);a.lineTo(16.627304,27.386304);a.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);a.lineTo(115.41298,865.59743);a.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);a.lineTo(1.184082E-5,972.20771);
a.lineTo(1.184082E-5,999.59384);a.lineTo(359.93198,999.59384);a.lineTo(359.93198,972.20771);a.lineTo(329.61162,972.20771);a.bezierCurveTo(265.0586,972.20771,243.54093,932.10659,243.54093,841.14553);a.lineTo(243.54093,64.553192);a.lineTo(633.79325,64.553192);a.lineTo(633.79325,841.14553);a.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);a.lineTo(516.42413,972.20771);a.lineTo(516.42413,999.59384);a.closePath();a.stroke();a.fill()};k.prototype.drawBorderSpecial=function(a,
c){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=c;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([])};k.prototype.toRTF=function(){var a=[],c=[],d="";this.mergeTextNodes();for(var e=0,f=this.children.length;e<f;e++){var g=this.children[e];"textLineBlock"===g.nodeType&&(d+=g.toRTFAux(a,c)+(1<f&&e<f-1?"\\par":""))}g="{\\fonttbl";e=0;for(f=a.length;e<f;e++)g+="\\f"+e+"\\fcharset0 "+a[e]+";";
a="";if(0<c.length){a="{\\colortbl";e=0;for(f=c.length;e<f;e++)a+=c[e];a+="}"}return"{\\rtf1\\uc0"+(g+"}")+a+d+"}"};k.prototype.toRTFAux=function(a,c){for(var b,e,h,f=null,g="",l,k,p,x,y,z=0,G=this.children.length;z<G;z++)l=k="",b=this.children[z],p=this.addToFontTable(b.style.family,a),x=b.style.size,y=this.addToColorTable(b.style.color,c),null===y&&0<c.length&&(y=this.addToColorTable(r,c)),y!==f&&(l+="\\cf"+y,f=y),p!==e&&(l+="\\f"+p,e=p),x!==h&&(l+="\\fs"+2*x,h=x),b.style.italic&&(l+="\\i",k="\\i0"+
k),b.style.bold&&(l+="\\b",k="\\b0"+k),b.style.underline&&(l+="\\ul",k="\\ulnone"+k),b.style.overline&&(l+="\\ol",k="\\olnone"+k),"text"===b.nodeType?(b.value=b.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),b=""!==l?l+" "+b.value+k:""!==g&&"}"!==g.charAt(g.length-1)?" "+b.value:b.value,g+=b):"formula"===b.nodeType?g+="{\\*\\mjaformula"+b.formulaToRTF(e,h,f,a,c)+"}":"componentSpace"===b.nodeType?g+="{\\*\\component\\Space "+b.value+"}":"componentNumCtrl"===b.nodeType&&
(g+="{\\*\\component\\NumCtrl "+b.value+"}");return g};k.prototype.formulaToRTF=function(a,c,d,e,f){for(var b,h="",g,l,k,q,p=0,v=this.children.length;p<v;p++)g=l="",b=this.children[p],k=this.addToFontTable(b.style.family,e),q=this.addToColorTable(b.style.color,f),null===q&&0<f.length&&(q=this.addToColorTable(r,f)),k!==a&&(g+="\\f"+k,a=k),q!==d&&(g+="\\cf"+q,"text"!==b.nodeType||"text"===b.nodeType&&""!==b.value)&&(d=q),b.style.italic&&(g+="\\i",l="\\i0"+l),b.style.bold&&(g+="\\b",l="\\b0"+l),b.style.underline&&
(g+="\\ul",l="\\ulnone"+l),b.style.overline&&(g+="\\ol",l="\\olnone"+l),"text"===b.nodeType&&""!==b.value?(b.value=b.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==g?g+" "+b.value+l:"}"!==h.charAt(h.length-1)?" "+b.value:b.value,h+=tmpRTF):"dynamicText"===b.nodeType?(b.value=""===b.value?" ":b.value,h+=g+"{\\expr "+b.value+"\\decimals "+(b.decimals||2)+"\\fixed"+(b.fixed?1:0)+"}"+l):"fraction"===b.nodeType||"radical"===b.nodeType||"index"===b.nodeType||
"radicand"===b.nodeType||"sum"===b.nodeType||"integral"===b.nodeType||"prod"===b.nodeType||"limit"===b.nodeType||"from"===b.nodeType||"to"===b.nodeType||"what"===b.nodeType||"element"===b.nodeType?h+="{\\"+b.nodeType+b.formulaToRTF(a,c,d,e,f)+"}":"numerator"===b.nodeType?h+="{\\num"+b.formulaToRTF(a,c,d,e,f)+"}":"denominator"===b.nodeType?h+="{\\den"+b.formulaToRTF(a,c,d,e,f)+"}":"superIndex"===b.nodeType?h+="{\\supix"+b.formulaToRTF(a,c,d,e,f)+"}":"subIndex"===b.nodeType?h+="{\\subix"+b.formulaToRTF(a,
c,d,e,f)+"}":"matrix"===b.nodeType?h+="{\\matrix\\rows "+(b.rows||2)+"\\columns "+(b.columns||2)+b.formulaToRTF(a,c,d,e,f)+"}":"defparts"===b.nodeType&&(h+="{\\defparts\\parts "+(b.parts||2)+b.formulaToRTF(a,c,d,e,f)+"}");return h};k.prototype.addToFontTable=function(a,c){var b;a.match(/times/i)?b="Times New Roman":a.match(/courier/i)?b="Courier New":a.match(/arial/i)&&(b="Arial");a=c.indexOf(b);-1===a&&(a=c.length,c.push(b));return a};k.prototype.addToColorTable=function(a,c){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 b=c.indexOf(a);-1===b&&(b=c.length,c.push(a));return b}return null};k.prototype.mergeTextNodes=function(){for(var a=[],c=null,d=0,e=this.children.length;d<e;d++)"text"===this.children[d].nodeType?null!==c&&"text"===c.nodeType&&c.style.equals(this.children[d].style)&&(this.children[d].value=c.value+this.children[d].value,a.push(c)):this.children[d].mergeTextNodes(),c=this.children[d];d=0;for(e=a.length;d<
e;d++)this.removeChild(a[d])};var l={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=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=String.fromCharCode,f,e,r,p,c,k,l,b,h,d,v,q=function(){};q.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];f=[];e="";p=r=0;k=a.charAt(0);l=!1;for(b="text";r<a.length;)c=k,k=a.charAt(r+1),l?"\\"===k||"{"===k||"}"===
k||" "===k||";"===k?(l=!1,e+=c," "===k?(r++,k=a.charAt(r+1),v=!0):v=!1,(h=e.match(/^'([0-9a-f]{2})/))?(d="","text"===b&&(d=f.pop().value),e=d+=g(parseInt(h[1],16))+e.substring(3)):(h=e.match(/^u[0-9]+/))?(d="","text"===b&&(d=f.pop().value),e=d+=g(h[0].substring(1))):("{"===e||"}"===e||"\\"==c?(f.push({type:"text",value:e+(v?" ":"")}),b="text"):(f.push({type:"controlWord",value:e}),b="controlWord"),e="")):"{"==c||"}"==c||"\\"==c?(l=!1,f.push({type:"text",value:c}),b="text"):e+=c:"\\"===c?(l=!0,""!==
e&&(f.push({type:"text",value:e}),b="text",e="")):"{"===c?(p++,""!==e&&(f.push({type:"text",value:e}),e=""),f.push({type:"openBlock",value:p}),b="openBlock"):"}"===c?(""!==e&&(f.push({type:"text",value:e}),e=""),f.push({type:"closeBlock",value:p}),b="closeBlock",p--):e+=c,r++;""!==e&&f.push({type:"text",value:e});return f};a.RTFTokenizer=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,f,e,r,p,c,k,l,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};P.prototype.parse=function(C){f=this.tokenizer.tokenize(C);e={};p=2;if("openBlock"===f[0].type&&"fonttbl"===f[1].value){for(r=f[0].value;"closeBlock"!==f[p].type&&f[p].value!==r;)e[f[p].value]=f[p+2].value.substring(0,f[p+2].value.length-1),p+=3;p++}c={};k=0;if("openBlock"===f[p].type&&"colortbl"===f[p+1].value){r=
f[p++].value;for(p++;"closeBlock"!==f[p].type&&f[p].value!==r;)l=parseInt(f[p++].value.substring(3)).toString(16),b=parseInt(f[p++].value.substring(5)).toString(16),h=parseInt(f[p++].value.substring(4)).toString(16),";"===f[p].value&&p++,c[k++]="#"+(2>l.length?"0"+l:l)+(2>b.length?"0"+b:b)+(2>h.length?"0"+h:h);p++}A=u=q=null;M=I=L=G=z=y=x=w=m=n=!1;J=[new a.TextStyle];E=J[0];D=F=-1;B=[];d=O=new a.TextNode("","textBlock",E,this.evaluator);v=new a.TextNode("","textLineBlock",E,this.evaluator);d.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;C=p;for(var N=f.length;C<N;C++){if("controlWord"==f[C].type)if(e[f[C].value])E.set({family:e[f[C].value]});else if(f[C].value.match(/^fs(\d+)/))E.set({size:parseInt(f[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==f[C].value)E.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==f[C].value)E.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==f[C].value)E.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==f[C].value)E.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==f[C].value)E.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==f[C].value)E.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==f[C].value)E.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==f[C].value)E.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(f[C].value.match(/^cf(\d+)/))E.set({color:c[parseInt(f[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=E.color);else if("par"==f[C].value){d=new a.TextNode("","textLineBlock",E.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(d);v=d}else if("mjaformula"==f[C].value)O.hasFormula=!0,D=F,n=!0,d=new a.TextNode("","formula",E.clone(),this.evaluator),v.addChild(d),v=d,B[B.length-1]=d;else if("fraction"==f[C].value||"radicand"==f[C].value||"radical"==f[C].value||"what"==f[C].value||"sum"==f[C].value||"integral"==
f[C].value||"limit"==f[C].value){var K=B[B.length-2].style.clone();d=new a.TextNode("",f[C].value,K,this.evaluator);B[B.length-2].addChild(d);B[B.length-1]=d}else"index"==f[C].value?(K=B[B.length-2].style.clone(),K.size=g(parseInt(K.size-.5*K.size),8),d=new a.TextNode("",f[C].value,K,this.evaluator),B[B.length-2].addChild(d),B[B.length-1]=d):"to"==f[C].value||"from"==f[C].value?(K=B[B.length-2].style.clone(),K.size=g(parseInt(K.size-.2*K.size),8),d=new a.TextNode("",f[C].value,K,this.evaluator),B[B.length-
2].addChild(d),B[B.length-1]=d):"num"==f[C].value||"den"==f[C].value?(K=B[B.length-2].style.clone(),K.size=g(Math.round(K.size-.1*K.size),8),"num"==f[C].value?d=new a.TextNode("","numerator",K,this.evaluator):"den"==f[C].value&&(d=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(d),B[B.length-1]=d):"subix"==f[C].value||"supix"==f[C].value?(K=B[B.length-2].style.clone(),K.size=g(Math.floor(K.size-.33*K.size),8),"subix"==f[C].value?d=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==f[C].value&&(d=new a.TextNode("","superIndex",K,this.evaluator)),d.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(d),B[B.length-1]=d):"defparts"==f[C].value||"matrix"==f[C].value||"element"==f[C].value?(K=B[B.length-2].style.clone(),d=new a.TextNode("",f[C].value,K,this.evaluator),B[B.length-2].addChild(d),B[B.length-1]=d,"defparts"==f[C].value?A=d:"matrix"==f[C].value&&(u=d,u.matrix_type=0)):"parts"==f[C].value?G=!0:"type"==f[C].value?x=!0:"rows"==f[C].value?y=!0:"columns"==
f[C].value?z=!0:"expr"==f[C].value?(O.stableWidth=!1,m=!0):"decimals"==f[C].value?w=!0:"fixed1"==f[C].value?q.fixed=!0:"fixed0"==f[C].value?q.fixed=!1:"component"!=f[C].value&&("NumCtrl"==f[C].value?L=!0:"Space"==f[C].value?I=!0:"hyperlink"==f[C].value&&(M=!0));if("text"==f[C].type)if(G)A.parts=parseInt(f[C].value),G=!1;else if(x)u.matrix_type=parseInt(f[C].value),x=!1;else if(y)u.rows=parseInt(f[C].value),y=!1;else if(z)u.columns=parseInt(f[C].value),z=!1;else if(w)q.decimals=this.evaluator.parser.parse(f[C].value+
""),w=!1;else if(M){H=f[C].value.split("|")[0];K=E.clone();d=new a.TextNode(H,"hyperlink",K,this.evaluator);d.URL=f[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(d);M=!1}else if(L)d=new a.TextNode(f[C].value,"componentNumCtrl",E.clone(),this.evaluator),v.addChild(d),L=!1;else if(I)d=new a.TextNode(f[C].value,"componentSpace",E.clone(),this.evaluator),v.addChild(d),I=!1;else if(m)K=B[B.length-2].style.clone(),H=this.evaluator.parser.parse(f[C].value),
d=new a.TextNode(H,"dynamicText",K,this.evaluator),B[B.length-2].addChild(d),q=B[B.length-1]=d,m=!1;else if(m||n)!m&&n&&(H=f[C].value,d=new a.TextNode(H,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(d));else{H=f[C].value;d=new a.TextNode(H,"text",E.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(d)}else if("openBlock"==f[C].type)F=f[C].value,E=E.clone(),J.push(E),B.push(null);else if("closeBlock"==
f[C].type)f[C].value==D&&(D=-1,n=!1,v=v.parent),J.pop(),E=J[J.length-1],B.pop();else if("("==f[C].type||")"==f[C].type)K=B[B.length-1].style.clone(),K.italic="",d=new a.TextNode(f[C].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(d);else if("+"==f[C].type||"-"==f[C].type||"*"==f[C].type||"="==f[C].type)d=new a.TextNode(f[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(d)}return O.normalize()};a.RTFParser=P;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k,l,b,h,d,v=function(b,c){this.parent=b;f=this.evaluator=this.parent.evaluator;e=f.parser;this.id="";this.type="2D";this.xExpr=e.parse("0");this.yExpr=e.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=e.parse("1");this.fixed=!1;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=
b.displaceRegionWest||0;Object.assign(this,c);this.initSpace()};v.prototype.initSpace=function(){var a=this;g=a.parent;f=a.evaluator;r=a.id;a.resizable||(a.displaceRegionNorth=g.displaceRegionNorth||0,a.displaceRegionSouth=g.displaceRegionSouth||0,a.displaceRegionEast=g.displaceRegionEast||0,a.displaceRegionWest=g.displaceRegionWest||0,l=parseInt(g.container.width),k=parseInt(g.container.height),void 0!=a.wExpr&&(a.w=parseInt(l-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(k-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=f.parser.parse((parseInt(l-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=f.parser.parse((parseInt(k-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=f.eval(a.xExpr)+a.displaceRegionWest,a.y=f.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&
(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(p=k-a.y,a.h>p&&(a.h=p)):(p=a.h+a.y,a.h=p>=k?k:p),0<=a.x?(c=l-a.x,a.w>c&&(a.w=c)):(c=a.w+a.x,a.w=c>=l?l:c));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=g.getImage(a.imageSrc));a.OxExpr&&(h=a.OxExpr,"%"===h[h.length-1]?a.Ox=a.w*parseFloat(h)/100:(b=parseFloat(h),b!=h&&(b=0),a.Ox=b));a.OyExpr&&(d=a.OyExpr,"%"===d[d.length-1]?a.Oy=a.h*parseFloat(d)/100:(b=parseFloat(d),b!=d&&(b=0),a.Oy=b));""!==a.id&&2!==g.version?
(f.setVariable(r+"._w",a.w),f.setVariable(r+"._h",a.h),f.setVariable(r+".escala",a.scale),f.setVariable(r+".Ox",a.Ox),f.setVariable(r+".Oy",a.Oy),f.setVariable(r+".mouse_x",0),f.setVariable(r+".mouse_y",0),f.setVariable(r+".mouse_pressed",0),f.setVariable(r+".mouse_clicked",0),f.setVariable(r+".clic_izquierdo",0)):(b=f.getVariable("_w"),void 0===b&&(b=a.w),f.setVariable("_w",b),b=f.getVariable("_h"),void 0===b&&(b=a.h),f.setVariable("_h",b),b=f.getVariable("escala"),void 0===b&&(b=a.scale),f.setVariable("escala",
b),b=f.getVariable("Ox"),void 0===b&&(b=a.Ox),f.setVariable("Ox",b),b=f.getVariable("Oy"),void 0===b&&(b=a.Oy),f.setVariable("Oy",b),f.setVariable("mouse_x",0),f.setVariable("mouse_y",0),f.setVariable("mouse_pressed",0),f.setVariable("mouse_clicked",0),f.setVariable("clic_izquierdo",0),2==g.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;f.setFunction(r+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};v.prototype.addCtr=
function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+
this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f=function(e){g=this;g.parent=e;g.width=228;g.vSpace=25;g.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:"+(g.width+27)+"px;height:460px;"});g.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(g.width+27)+"px;height:"+g.vSpace+
"px;line-height:"+g.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});g.movable.innerHTML="Descartes";g.container.appendChild(g.movable);g.ctrs=[]};f.prototype.init=function(){function e(c){g.newPos=a.getCursorPosition(c,document.body);g.container.style.left=g.initialPosition.x+(g.newPos.x-g.oldPos.x)*a.cssScale+"px";g.container.style.top=g.initialPosition.y+(g.newPos.y-g.oldPos.y)*a.cssScale+"px"}function f(a){a.preventDefault();document.body.removeEventListener("mousemove",
e);document.body.removeEventListener("mouseup",f)}g=this;document.body.appendChild(this.container);for(var p=g.parent.evaluator.parser,c=0,k=g.ctrs.length;c<k;c++)g.ctrs[c].expresion=p.parse("(0,"+(g.vSpace+23+35*c)+","+g.width+",35)"),g.ctrs[c].update();g.numCtr=k;c=new a.Button(g.parent,{region:"external",name:"english"==g.language?"about":"cr\u00e9ditos",font_size:p.parse("15"),expresion:p.parse("(0,"+g.vSpace+","+g.width/2+",25)")});c.actionExec={execute:a.showAbout};c.update();(new a.Button(g.parent,
{region:"external",name:"config",font_size:p.parse("15"),action:"config",expresion:p.parse("("+g.width/2+","+g.vSpace+","+g.width/2+",25)")})).update();(new a.Button(g.parent,{region:"external",name:"english"==g.language?"init":"inicio",font_size:p.parse("15"),action:"init",expresion:p.parse("(0,"+(g.vSpace+23+35*k)+","+g.width/2+",25)")})).update();(new a.Button(g.parent,{region:"external",name:"english"==g.language?"clear":"limpiar",font_size:p.parse("15"),action:"clear",expresion:p.parse("("+g.width/
2+","+(g.vSpace+23+35*k)+","+g.width/2+",25)")})).update();p=new a.Button(g.parent,{region:"external",name:"english"==g.language?"close":"cerrar",font_size:p.parse("15"),expresion:p.parse("("+g.width/4+","+(g.vSpace+46+35*k)+","+g.width/2+",25)")});p.update();p.btn.addEventListener("click",function(a){g.hide()});g.setPositionAndSize();g.movable.addEventListener("mousedown",function(c){c.preventDefault();g.oldPos=a.getCursorPosition(c,document.body);g.initialPosition={x:g.container.offsetLeft,y:g.container.offsetTop};
document.body.addEventListener("mousemove",e);document.body.addEventListener("mouseup",f)});g.hide()};f.prototype.addCtr=function(a){this.ctrs.push(a)};f.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};f.prototype.hide=function(){this.container.style.display="none"};f.prototype.setPositionAndSize=function(){g=this;var a=g.vSpace+46+35*g.numCtr+25+10;g.container.style.left=Math.max(parseInt(window.innerWidth-g.width)/2,0)+"px";g.container.style.top="5px";g.container.style.height=
window.innerHeight<g.vSpace+75?g.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,f=Math.round,e=2*Math.PI,r=a.convertFont("Serif,BOLD+ITALIC,16"),p=a.convertFont("Monospaced,PLAIN,12"),c,k,l,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q,R=function(b,d){c=d=a.Space.call(this,b,d)||this;c.ratio=b.ratio;c.canvas=a.newHTML("canvas",{id:c.id+"_canvas",class:"DescartesSpace2DCanvas",width:c.w*c.ratio});c.backCanvas=a.newHTML("canvas",{id:c.id+"_background",width:c.w*c.ratio});c.canvas.style=c.backCanvas.style=
(0<c.border_width?"border:"+c.border_width+"px solid "+c.border_color.getColor()+";":"")+(c.border_radius?"border-radius:"+c.border_radius+"px;":"");c.canvas.style.zIndex=c.zIndex;c.canvas.style.width=c.backCanvas.style.width=c.w+"px";c.canvas.style.height=c.backCanvas.style.height=c.h+"px";c.ctx=c.canvas.getContext("2d");c.backCtx=c.backCanvas.getContext("2d");c.ctx.imageSmoothingEnabled=c.backCtx.imageSmoothingEnabled=!1;c.graphicControlContainer=a.newHTML("div",{id:c.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+
c.zIndex+";"});c.numericalControlContainer=a.newHTML("div",{id:c.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+c.zIndex+";"});c.container=a.newHTML("div",{id:c.id,class:"DescartesSpace2DContainer",style:"z-index:"+c.zIndex+";"});c.parent.arquimedes&&"#f0f8fa"===c.background.getColor()&&(c.container.style.boxShadow="0 0 5px 0 #b8c4c8");c.container.appendChild(c.backCanvas);c.container.appendChild(c.canvas);c.container.appendChild(c.graphicControlContainer);c.container.appendChild(c.numericalControlContainer);
b.container.insertBefore(c.container,b.loader);var e=c.id+".image";c.parent.images[e]=c.canvas;c.parent.images[e].ready=1;c.parent.images[e].complete=c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);e=c.id+".back";c.parent.images[e]=c.backCanvas;c.parent.images[e].ready=1;c.parent.images[e].complete=c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);e=""!==c.id&&2!==b.version?c.id+".":"";c.OxStr=e+"Ox";c.OyStr=e+"Oy";c.scaleStr=e+"escala";c.wStr=e+"_w";c.hStr=e+"_h";c.mxStr=e+"mouse_x";
c.myStr=e+"mouse_y";c.mpressedStr=e+"mouse_pressed";c.mclickedStr=e+"mouse_clicked";c.mclickIzqStr=e+"clic_izquierdo";c.click=0;c.resizable&&(c.wModExpr=b.evaluator.parser.parse(c.wModExpr),c.hModExpr=b.evaluator.parser.parse(c.hModExpr));"descartesJS_stage"!==c.id?c.addEvents():c.canvas.oncontextmenu=function(a){return!1};return d};$jscomp.inherits(R,a.Space);R.prototype.init=function(){c=this;this.initSpace();c.canvas&&(c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=
c.backCanvas.height=c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px")};R.prototype.update=function(a){c=this;k=c.evaluator;l=c.parent;if(c.resizable){if(C=c.evaluator.eval(c.wModExpr),N=c.evaluator.eval(c.hModExpr),c.old_w!=C||c.old_h!=N)c.w=C,c.h=N,c.w_2=c.w/2,c.h_2=c.h/2,k.setVariable(c.wStr,c.w),k.setVariable(c.hStr,c.h),c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=c.backCanvas.height=
c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px",a=!0}else k.setVariable(c.wStr,c.w),k.setVariable(c.hStr,c.h);c.drawIfValue=0<k.eval(c.drawif);if(c.drawIfValue){h=c.x!==k.eval(c.xExpr)+c.displaceRegionWest;d=c.y!==k.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth;c.spaceChange=a||h||d||c.drawBefore!==c.drawIfValue||c.Ox!==k.getVariable(c.OxStr)||c.Oy!==k.getVariable(c.OyStr)||c.scale!==k.getVariable(c.scaleStr)||c.backColor!==
c.background.getColor();c.x=h?k.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=d?k.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth:c.y;c.Ox=k.getVariable(c.OxStr);c.Oy=k.getVariable(c.OyStr);c.scale=k.getVariable(c.scaleStr);c.drawBefore=c.drawIfValue;c.scale=Math.max(1E-6,Math.min(1E6,c.scale));k.setVariable(c.scaleStr,c.scale);if(h||d)c.container.style.left=c.x+"px",c.container.style.top=c.y+"px";c.container.style.display="block";c.drawTrace=!c.spaceChange&&(!c.fixed&&!c.click||c.fixed);c.spaceChange&&
(c.backCtx.setTransform(c.ratio,0,0,c.ratio,0,0),c.drawBackground());c.ctx.setTransform(c.ratio,0,0,c.ratio,0,0);c.draw()}else c.container.style.display="none"};R.prototype.drawBackground=function(){c=this;k=c.evaluator;b=c.backCtx;b.clearRect(0,0,c.backCanvas.width,c.backCanvas.height);b.fillStyle=c.backColor=c.background.getColor();b.fillRect(0,0,c.backCanvas.width,c.backCanvas.height);c.image&&""!=c.image.src&&c.image.ready&&c.image.complete&&("topleft"===c.bg_display?b.drawImage(c.image,0,0):
"stretch"===c.bg_display?b.drawImage(c.image,0,0,c.w,c.h):"patch"===c.bg_display?(b.fillStyle=b.createPattern(c.image,"repeat"),b.fillRect(0,0,c.w,c.h)):"imgcenter"===c.bg_display&&b.drawImage(c.image,(c.w-c.image.width)/2,(c.h-c.image.height)/2));q=c.scale;u=0;for(A=0>c.w+c.h?0:c.w+c.h;q>A;)q/=10,u++;for(;q<A/10;)q*=10;b.lineWidth=1;""!==c.net&&(b.strokeStyle=c.net.getColor(),c.drawMarks(b,q/10,-1));if(2!==c.parent.version&&""!==c.net10||2===c.parent.version&&""!==c.net&&""!==c.net10)b.strokeStyle=
c.net10.getColor(),c.drawMarks(b,q,-1);if(""!==c.axes){var a="";"no"==c.x_axis&&(a+="x");"no"==c.y_axis&&(a+="y");b.strokeStyle=c.axes.getColor();b.beginPath();"no"==c.x_axis||""===c.x_axis&&2===c.parent.version||(b.moveTo(0,g(c.h/2+c.Oy)+.5),b.lineTo(c.w,g(c.h/2+c.Oy)+.5));"no"==c.y_axis||""===c.y_axis&&2===c.parent.version||(b.moveTo(g(c.w/2+c.Ox)+.5,0),b.lineTo(g(c.w/2+c.Ox)+.5,c.h));b.lineWidth=1.2;b.stroke();b.lineWidth=1;c.drawMarks(b,q,4,a);c.drawMarks(b,q/2,2,a);c.drawMarks(b,q/10,1,a)}if(""!==
c.x_axis||""!==c.y_axis)b.fillStyle=""!==c.axes?c.axes.getColor():"#000",b.font=r,b.textAlign="right",b.textBaseline="alphabetic","no"!=c.x_axis&&b.fillText(c.x_axis,g(c.w)-2,g(c.h/2+c.Oy)+12),"no"!=c.y_axis&&b.fillText(c.y_axis,g(c.w/2+c.Ox)-2,12);c.numbers&&""!=c.axes&&(b.fillStyle=c.axes.getColor(),b.font=r,b.textAlign="start",b.textBaseline="bottom",q>(c.w+c.h)/2?c.drawNumbers(b,q/5,q<=c.scale?u+1:u):q>(c.w+c.h)/4?c.drawNumbers(b,q/2,q<=c.scale?u+1:u):c.drawNumbers(b,q,u));a=0;for(var d=this.backGraphics.length;a<
d;a++)this.backGraphics[a].draw()};R.prototype.draw=function(){c=this;b=c.ctx;b.clearRect(0,0,c.canvas.width,c.canvas.height);for(var a=0,d=c.graphics.length;a<d;a++)v=c.graphics[a],""!==v.trace&&c.drawTrace&&v.drawTrace(),v.draw();a=0;for(d=c.graphicsCtr.length;a<d;a++)c.graphicsCtr[a].draw();""!=c.text&&c.click&&"L"===c.whichBtn&&(b.save(),b.strokeStyle=b.fillStyle=c.text.getColor(),b.lineWidth=1,b.font=p,b.textAlign="center",b.textBaseline="alphabetic",D=1>=c.scale?c.mouse_x.toFixed(0):c.mouse_x.toFixed(parseInt(c.scale).toString().length+
1),B=1>=c.scale?c.mouse_y.toFixed(0):c.mouse_y.toFixed(parseInt(c.scale).toString().length+1),L="("+D+","+B+")",I=g(b.measureText(L).width/2),M=c.getAbsoluteX(c.mouse_x),O=c.getAbsoluteY(c.mouse_y),H=g(M),P=g(O-10),H+I>c.w?H=c.w-I:0>H-I&&(H=I),P+1>c.h?P=c.h:0>P-14&&(P=15),b.fillText(L,H,P),b.beginPath(),b.arc(M,O,2.5,0,e,!0),b.stroke(),b.restore())};R.prototype.drawMarks=function(a,b,c,d){n=this.w;m=this.h;E=G=0;J=n;F=m;y=g(n/2+this.Ox);z=g(m/2+this.Oy);0<=c&&(G=y-c,J=y+c,E=z-c,F=z+c);a.beginPath();
if(!d||d&&!d.match("x"))for(c=-f(y/b);(w=y+f(c*b))<n;c++)a.moveTo(w+.5,E+.5),a.lineTo(w+.5,F+.5);if(!d||d&&!d.match("y"))for(c=-f(z/b);(x=z+f(c*b))<m;c++)a.moveTo(G+.5,x+.5),a.lineTo(J+.5,x+.5);a.stroke()};R.prototype.drawNumbers=function(a,b,c){n=this.w;m=this.h;y=g(n/2+this.Ox);z=g(m/2+this.Oy);for(c=-f(y/b);(w=y+f(c*b))<n;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),w+1,z-2);for(c=-f(z/b);(x=z+f(c*b))<m;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),
y+5,x+5)};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.click=0,f.evaluator.setVariable(f.mpressedStr,0),f.evaluator.setVariable(f.mclickedStr,1),f.evaluator.setVariable(f.mclickIzqStr,1),window.removeEventListener("touchmove",h),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),f.parent.update()}function c(b){document.activeElement.blur();
window.focus();b.stopPropagation();b.preventDefault();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);"R"===f.whichBtn&&(window.removeEventListener("mousemove",e),f.posZoom==f.posZoomNew&&a.showConfig&&(f.parent.externalSpace.show(),f.posZoom=!1,f.posZoomNew=!0));window.removeEventListener("mousemove",h);window.removeEventListener("mouseup",c);f.parent.deactivateGraphicControls();f.parent.update()}function d(b){f.posAnte=
a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.evaluator.setVariable(f.mclickedStr,0);f.evaluator.setVariable(f.mclickIzqStr,0);f.parent.update()}function e(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function h(b){b.preventDefault();
b.stopPropagation();f.fixed||(f.posNext=a.getCursorPosition(b,f.container),K=f.posAnte.x-f.posNext.x,Q=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-K),f.evaluator.setVariable(f.OyStr,f.Oy-Q));d(b)}var f=this;f.posZoom=f.posZoomNew=null;f.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+
".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.parent.clearClick(),f.click=1,f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),f.parent.deactivateGraphicControls(),d(a),window.addEventListener("touchmove",h),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();f.parent.clearClick();f.click=1;f.parent.deactivateGraphicControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,window.addEventListener("mousemove",e))):"L"===f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,
0),d(b),window.addEventListener("mousemove",h),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);window.removeEventListener("mousemove",h);window.removeEventListener("mouseup",c)})};a.Space2D=R;return a}(descartesJS||{});
descartesJS=function(a){var g,f,e;function r(b,c){H=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));P=a.add3D(b,a.scalarProduct3D(H,-2));C=a.norm3D(P);return 0!==C?a.scalarProduct3D(P,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var p=Math.floor,c=Math.max,k=Math.cos,l=Math.sin,b,h,d,v,q,u,A,n,m,w,x,y,z,G,J,E,F=[],D,B,L,I,M,O,H,P,C,N,K,Q=function(b,c){d=c=a.Space.call(this,b,c)||this;d.backCanvas=a.newHTML("canvas",{id:d.id+"_background",width:d.w+"px",height:d.h+"px"});d.canvas=a.newHTML("canvas",
{id:d.id+"_canvas",width:d.w+"px",height:d.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+d.zIndex+";"});d.ctx=d.canvas.getContext("2d");d.ctx.imageSmoothingEnabled=!1;d.canvas.style=d.backCanvas.style=(0<d.border_width?"border:"+d.border_width+"px solid "+d.border_color.getColor()+";":"")+(d.border_radius?"border-radius:"+d.border_radius+"px;":"");var e=d.id+".image";d.parent.images[e]=d.canvas;d.parent.images[e].ready=1;d.parent.images[e].complete=!0;d.parent.images[e].canvas=!0;d.evaluator.setVariable(e,
e);d.graphicControlContainer=a.newHTML("div",{id:d.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+d.zIndex+";"});d.numericalControlContainer=a.newHTML("div",{id:d.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+d.zIndex+";"});d.container=a.newHTML("div",{id:d.id,class:"DescartesSpace3DContainer",style:"z-index:"+d.zIndex+";"});d.container.appendChild(d.backCanvas);d.container.appendChild(d.canvas);d.container.appendChild(d.graphicControlContainer);
d.container.appendChild(d.numericalControlContainer);b.container.insertBefore(d.container,b.loader);d.eye={x:0,y:0,z:0};d.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];e=0;for(var f=d.lights.length;e<f;e++)d.lights[e]=a.normalize3D(d.lights[e]);d.light3={x:0,y:0,z:0};d.intensity=[.4,.5,.3,0];d.userIntensity=0;d.dim=1;d.tmpIntensity=[];d.OxStr=d.id+".Ox";d.OyStr=d.id+".Oy";d.scaleStr=d.id+".escala";d.wStr=d.id+"._w";d.hStr=d.id+"._h";d.obsStr=d.id+".observador";d.ojoXStr=
d.id+".Ojo.x";d.ojoYStr=d.id+".Ojo.y";d.ojoZStr=d.id+".Ojo.z";d.rotZStr=d.id+".rot.z";d.rotYStr=d.id+".rot.y";d.userIDimStr=d.id+".userIlum.dim";d.userIIStr=d.id+".userIlum.I";d.userIxStr=d.id+".userIlum.x";d.userIyStr=d.id+".userIlum.y";d.userIzStr=d.id+".userIlum.z";d.evaluator.setVariable(d.rotZStr,0);d.evaluator.setVariable(d.rotYStr,0);d.evaluator.setVariable(d.userIDimStr,d.dim);d.evaluator.setVariable(d.userIIStr,d.userIntensity);d.evaluator.setVariable(d.userIxStr,0);d.evaluator.setVariable(d.userIyStr,
0);d.evaluator.setVariable(d.userIzStr,0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},d);d.evaluator.setFunction(d.id+"._X3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(d);return K.projVert[0].x});d.evaluator.setFunction(d.id+"._Y3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(d);return K.projVert[0].y});d.resizable&&(d.wModExpr=b.evaluator.parser.parse(d.wModExpr),d.hModExpr=b.evaluator.parser.parse(d.hModExpr));
d.ratio=1;d.addEvents();return c};$jscomp.inherits(Q,a.Space);Q.prototype.init=function(a){d=this;d.initSpace();d.canvas&&(d.canvas.width=d.backCanvas.width=d.w,d.canvas.height=d.backCanvas.height=d.h,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px");d.w_2=d.w/2;d.h_2=d.h/2;d.w_plus_h=d.w+d.h;d.oldMouse={x:0,y:0};d.S={x:d.h/1080*-20.6*(40/d.scale),y:0,z:0};d.Ojo={x:3*d.w_2,y:0,z:0};d.evaluator.setVariable(d.ojoXStr,d.Ojo.x);d.evaluator.setVariable(d.ojoYStr,
d.Ojo.y);d.evaluator.setVariable(d.ojoZStr,d.Ojo.z)};Q.prototype.update=function(a){d=this;b=d.evaluator;h=d.parent;b.setVariable(d.wStr,d.w);b.setVariable(d.hStr,d.h);d.drawIfValue=0<b.eval(d.drawif);if(d.drawIfValue){d.resizable&&(wModExpr=d.evaluator.eval(d.wModExpr),hModExpr=d.evaluator.eval(d.hModExpr),d.old_w!=wModExpr||d.old_h!=hModExpr)&&(d.w=wModExpr,d.h=hModExpr,d.w_2=d.w/2,d.h_2=d.h/2,b.setVariable(d.wStr,d.w),b.setVariable(d.hStr,d.h),d.old_w=d.w,d.old_h=d.h,d.canvas.width=d.backCanvas.width=
d.w*d.ratio,d.canvas.height=d.backCanvas.height=d.h*d.ratio,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px",a=!0,d.S={x:d.h/1080*-20.6*(40/d.scale),y:0,z:0},d.Ojo={x:3*d.w_2,y:0,z:0},d.evaluator.setVariable(d.ojoXStr,d.Ojo.x),d.evaluator.setVariable(d.ojoYStr,d.Ojo.y),d.evaluator.setVariable(d.ojoZStr,d.Ojo.z));u=d.x!==b.eval(d.xExpr)+d.displaceRegionWest;A=d.y!==b.eval(d.yExpr)+h.plecaHeight+d.displaceRegionNorth;d.spaceChange=a||u||
A||d.drawBefore!==d.drawIfValue||d.Ox!==b.getVariable(d.OxStr)||d.Oy!==b.getVariable(d.OyStr)||d.Ojo.x!==b.getVariable(d.ojoXStr)||d.Ojo.y!==b.getVariable(d.ojoYStr)||d.Ojo.z!==b.getVariable(d.ojoZStr)||d.scale!==b.getVariable(d.scaleStr);d.x=u?b.eval(d.xExpr)+d.displaceRegionWest:d.x;d.y=A?b.eval(d.yExpr)+h.plecaHeight+d.displaceRegionNorth:d.y;d.Ojo.x=b.getVariable(d.ojoXStr);d.Ojo.y=b.getVariable(d.ojoYStr);d.Ojo.z=b.getVariable(d.ojoZStr);d.Ox=b.getVariable(d.OxStr);d.Oy=b.getVariable(d.OyStr);
d.scale=b.getVariable(d.scaleStr);d.drawBefore=d.drawIfValue;if(a||void 0==d.observer){a=0;for(var e=d.parent.controls.length;a<e;a++)d.parent.controls[a].id===d.obsStr&&(N=!0);d.observer=N?b.getVariable(d.obsStr)||2.5*d.w_plus_h:2.5*d.w_plus_h;d.observer=c(d.observer,.25*d.w_plus_h);b.setVariable(d.obsStr,d.observer)}1E-6>d.scale?(d.scale=1E-6,b.setVariable(d.scaleStr,1E-6)):1E6<d.scale&&(d.scale=1E6,b.setVariable(d.scaleStr,1E6));if(u||A)d.container.style.left=d.x+"px",d.container.style.top=d.y+
"px";d.container.style.display="block";d.dim=b.getVariable(d.userIDimStr);d.userIntensity=b.getVariable(d.userIIStr);d.light3={x:parseInt(b.getVariable(d.userIxStr)),y:parseInt(b.getVariable(d.userIyStr)),z:parseInt(b.getVariable(d.userIzStr))};d.updateCamera();d.draw()}else d.container.style.display="none"};Q.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};Q.prototype.rotateVertex=function(b){w=a.degToRad(d.evaluator.getVariable(d.rotZStr));x=k(w);y=l(w);g=b.x*
x-b.y*y;f=b.x*y+b.y*x;e=b.z;w=a.degToRad(d.evaluator.getVariable(d.rotYStr));x=k(w);y=l(w);return{x:e*y+g*x,y:f,z:e*x-g*y}};Q.prototype.project=function(a){d=this;this.evaluator.getVariable("URL.oldProj");var b=d.eye.x/(a.x-d.eye.x);return{x:d.getAbsoluteX(b*(d.eye.y-a.y)),y:d.getAbsoluteY(b*(d.eye.z-a.z)),z:d.eye.x-a.x}};Q.prototype.computeColor=function(b,c,d){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));I=a.subtract3D(this.eye,c.average);M=a.norm3D(I);O=a.scalarProduct3D(I,
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++)F[e]=this.intensity[e]*this.dim;F[3]=this.userIntensity*this.userIntensity/E||0;D=d?this.dim/2:this.dim/4;B=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);e=0;for(f=this.lights.length;e<f;e++)d?(B=Math.max(0,a.dotProduct3D(r(this.lights[e],L),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[e],L)),D+=F[e]*B;D=Math.min(D,1);z=p(b.r*D);G=p(b.g*D);J=p(b.b*D);
return"rgba("+z+","+G+","+J+","+b.a+")"};Q.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,
"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];for(var c=a+1;c<b;c++)q=this.graphics[c],v.splitFace(q),q.splitFace(v);this.primitives=this.primitives.concat(v.primitives||[])}else for(a=
0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)q=this.graphics[c],q.split&&v.splitFace(q);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<
b;a++)this.graphicsCtr[a].draw()};Q.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,l,k;;){l=h;for(c=0;c<b;c++)if(!a[c].drawn){k=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(d,a[m],g)){k=!1;break}k&&(h--,e[f++]=a[c],a[c].drawn=!0)}if(0==h)break;else if(h==l){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)};
Q.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}};Q.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();h.click=0;h.evaluator.setVariable(h.id+".mouse_pressed",0);window.removeEventListener("touchmove",f,!1);window.removeEventListener("touchend",b,!1);a.preventDefault();h.parent.update()}function c(b){document.body.focus();h.click=0;h.evaluator.setVariable(h.id+
".mouse_pressed",0);b.preventDefault();"R"===h.whichBtn&&(window.removeEventListener("mousemove",e,!1),h.posZoom==h.posZoomNew&&a.showConfig&&h.parent.externalSpace.show());window.removeEventListener("mousemove",f,!1);window.removeEventListener("mouseup",c,!1);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.id+".mouse_x",h.mouse_x);h.evaluator.setVariable(h.id+".mouse_y",
h.mouse_y);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.posObserverNew=a.getCursorPosition(b,h.container).x;h.evaluator.setVariable(h.obsStr,h.tempObserver-2.5*(h.posObserver-h.posObserverNew));h.parent.update()}function f(b){if(!h.fixed&&h.click){n=(h.getAbsoluteX(h.oldMouse.x)-h.getAbsoluteX(h.mouse_x))/4;m=(-h.getAbsoluteY(h.oldMouse.y)+h.getAbsoluteY(h.mouse_y))/
4;if(n!==h.disp.x||m!==h.disp.y)h.alpha=a.degToRad(h.evaluator.getVariable(h.rotZStr)),h.beta=a.degToRad(-h.evaluator.getVariable(h.rotYStr)),h.alpha=a.radToDeg(h.alpha)-n,h.beta=a.radToDeg(h.beta)-m,h.evaluator.setVariable(h.rotZStr,h.alpha),h.evaluator.setVariable(h.rotYStr,-h.beta),h.disp.x=n,h.disp.y=m,h.oldMouse.x=h.getRelativeX(h.posAnte.x),h.oldMouse.y=h.getRelativeY(h.posAnte.y);d(b);b.preventDefault()}}var h=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",
function(c){window.focus();document.activeElement.blur();h.click=1;h.evaluator.setVariable(h.id+".mouse_pressed",1);h.parent.deactivateGraphicControls();h.posAnte=a.getCursorPosition(c,h.container);h.oldMouse.x=h.getRelativeX(h.posAnte.x);h.oldMouse.y=h.getRelativeY(h.posAnte.y);d(c);window.addEventListener("touchmove",f);window.addEventListener("touchend",b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();h.click=1;h.parent.deactivateGraphicControls();
h.whichBtn=a.whichBtn(b);"R"===h.whichBtn?(window.addEventListener("mouseup",c),h.posObserver=a.getCursorPosition(b,h.container).x,h.posObserverNew=h.posObserver,h.posZoom=a.getCursorPosition(b,h.container).y,h.posZoomNew=h.posZoom,h.fixed||(h.tempScale=h.scale,h.tempObserver=h.observer,window.addEventListener("mousemove",e))):"L"==h.whichBtn&&(h.evaluator.setVariable(h.id+".mouse_pressed",1),h.posAnte=a.getCursorPosition(b,h.container),h.oldMouse.x=h.getRelativeX(h.posAnte.x),h.oldMouse.y=h.getRelativeY(h.posAnte.y),
d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=Q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,f,e,r,p,c,k=function(c,b){var e=a.Space.call(this,c,b)||this;g=e.parent.evaluator;void 0!=e._w_&&(c=g.parser.parse(e._w_),e._w_="number"!=c.type?c:void 0);void 0!=e._h_&&(c=g.parser.parse(e._h_),e._h_="number"!=c.type?c:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";e.file.match(/^\[/)&&e.file.match(/\]$/)?e.file=g.parser.parse(e.file.substring(1,e.file.length-1)):e.file.match(/^'/)&&e.file.match(/'$/)?
e.file=g.parser.parse(e.file):e.file=g.parser.parse("'"+e.file+"'");e.oldFile=g.eval(e.file);e.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=a.newHTML("div",{id:e.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+
e.zIndex+";background-repeat:no-repeat;background-position:center;"});e.container.appendChild(e.MyIFrame);e.imageSrc&&(e.container.style.backgroundImage="url("+e.imageSrc+")");e.parent.container.insertBefore(e.container,e.parent.loader);e.MyIFrame.onload=function(b){var c=this;e.evaluator.setFunction(e.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
e.evaluator.setFunction(e.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var 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});e.ImReady=!e.isFirefox;e.isFirefox||(e.container.style.visibility="visible",e.container.style.opacity="1",e.container.style.zIndex=e.zIndex,e.container.style.display=e.drawIfValue?"block":"none");e.MyIFrame.style.visibility="visible";e.container.style.backgroundImage=""};e.update=e.iframeUpdate;e.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(k,a.Space);k.prototype.init=function(){p=this;p.initSpace();p.MyIFrame&&Object.assign(p.MyIFrame.style,{width:p.w+"px",
height:p.h+"px"})};k.prototype.iframeUpdate=function(a){g=this.evaluator;this.drawIfValue=0<g.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);f=this.x!==g.eval(this.xExpr)+this.displaceRegionWest;e=this.y!==g.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=f?g.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=e?g.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=g.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=a+"px",this.w=a));void 0!=this._h_&&(a=g.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(f||e)this.container.style.left=this.x+"px",this.container.style.top=
this.y+"px";r=g.eval(this.file);r!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),this.MyIFrame.style.visibility="hidden",this.oldFile=r,this.MyIFrame.contentWindow.location.replace(r));c=g.getVariable(this.id+
"._scroll");1==c?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==c?(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=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=1,f=function(e){this.children=e.children;this.lessonParser=e.lessonParser;this.images=e.images;this.images.length=e.images.length;this.audios=e.audios;this.audios.length=e.audios.length;this.descartesApp=e;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});e.imgLoader?(e.loader.style.backgroundColor="rgba(0,0,0,0)",this.imgLoader.setAttribute("style","background-image:url("+
e.imgLoader+");background-size:contain;")):(g=e.width<e.height?e.width/1144:e.height/1092,g=2.5<g?2.5:g,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*g+"px;"),this.progress.setAttribute("style","visibility:visible; left:"+(e.width-726*g)/2+"px; top:"+(33.5*e.height/100+940*g/2)+"px; width:"+726*g+"px; height:"+14*g+"px;"));e.loader.appendChild(this.imgLoader);e.loader.appendChild(this.progress);e.firstRun=!1;this.initPreloader()};
f.prototype.initPreloader=function(){var e=this,f=e.children,g=e.images,c=e.audios,k=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,l=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;g["lib/DescartesCCLicense.png"]=a.getCCLImg();g["lib/DescartesCCLicense.png"].ready=1;var b,h;var d=0;for(b=f.length;d<b;d++)if("rtf"!==f[d].name){if(f[d].value.match(/'macro'|'makro'/g)){var v="";var q=e.lessonParser.split(f[d].value);var u=0;for(h=q.length;u<h;u++)"expresion"===babel[q[u][0]]&&(v=q[u][1]);if(v)var A=(A=document.getElementById(v))&&
"descartes/macro"==A.type?A.text:a.openExternalFile(v);if(A&&(q=A.match(k)))for(v=0,h=q.length;v<h;v++)u=q[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(g[u]=new Image,g[u].addEventListener("load",function(){this.ready=1}),g[u].addEventListener("error",function(){this.errorload=1}),g[u].src=u)}if(q=f[d].value.match(k))for(v=0,h=q.length;v<h;v++)u=q[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(g[u]=new Image,g[u].addEventListener("load",function(){this.ready=
1}),g[u].addEventListener("error",function(){this.errorload=1}),g[u].src=u);if(q=f[d].value.match(l))for(v=0,u=q.length;v<u;v++)e.initAudio(q[v])}for(var n in g)g.hasOwnProperty(n)&&e.images.length++;for(n in c)c.hasOwnProperty(n)&&e.audios.length++;var m=e.images.length+e.audios.length;0<m&&e.progress.setAttribute("max",m);var w,x=function(){w=0;for(var b in g)g.hasOwnProperty(b)&&(g[b].ready||g[b].errorload)&&w++;for(b in c)c.hasOwnProperty(b)&&(c[b].ready||c[b].errorload)&&w++;e.progress.setAttribute("value",
w);w!=m?e.timer=a.setTimeout(x,1):e.descartesApp.initBuildApp()};x()};f.prototype.initAudio=function(e){var f=this.audios;f[e]=new Audio(e);f[e].filename=e;var g=function(){this.ready=1},c=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo '"+e+"' no puede ser reproducido"),this.errorload=1):(f[e]=new Audio(this.filename.replace("mp3","ogg")),f[e].filename=this.filename.replace("mp3",
"ogg"),f[e].addEventListener("canplaythrough",g),f[e].addEventListener("load",g),f[e].addEventListener("error",c),f[e].load())};f[e].addEventListener("canplaythrough",g);f[e].addEventListener("load",g);f[e].addEventListener("error",c);a.hasTouchSupport?(f[e].load(),f[e].play(),a.setTimeout(function(){f[e].pause()},20),f[e].ready=1):f[e].load()};a.DescartesLoader=f;return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var b="[",c=0,d=a.length;c<d;c++)Array.isArray(a[c])?b+=g(a[c]):(e=a[c]||0,"string"==typeof e&&(e="'"+e+"'"),b+=e),c<d-1&&(b+=",");return b+"]"}function f(){r=window.innerWidth/this.width;p=window.innerHeight/this.height;a.cssScale=c=Math.min(r,p);this.container.style.transformOrigin="0 0";r<p?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+c+")"):(this.container.style.left="50%",this.container.style.transform=
"translate3d(0px, 0px, 0px) scale("+c+") translate(-50%, 0)")}if(a.loadLib)return a;var e,r,p,c,k=function(c){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=c;this.parentC=c.parentNode;this.width=parseFloat(c.getAttribute("width"));this.height=parseFloat(c.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=c.getElementsByTagName("param");a.ccLicense=!0;for(var b=
0,e=this.children.length;b<e;b++)"CreativeCommonsLicense"===this.children[b].name&&(a.ccLicense="no"!==this.children[b].value);this.code=c.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.init()};k.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 c=this.children,b,e=0,d=0,g=a.ccLicense?90:0,k=0,p=c.length;k<p;k++)b=c[k],"rtf_height"==b.name&&(e=parseInt(b.value)+120||this.height),"Buttons"==babel[b.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value),d=this.buttonsConfig.height),"image_loader"==b.name&&(this.imgLoader=b.value),"expand"==b.name&&(this.expand=b.value),"docBase"==b.name&&(this.docBase=b.value,b=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(b));"cover"==this.expand&&
(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,e&&(this.height=e+d+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=f,this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",
new a.DescartesLoader(this)):this.initBuildApp()};k.prototype.initBuildApp=function(){a.showConfig=!0;for(var c=this.children,b,e=this.lessonParser,d=[],f=[],g=[],k=[],p=[],n=[],m=0,r=c.length;m<r;m++)if(b=c[m],"editable"==babel[b.name])a.showConfig="false"==babel[b.value]?!1:!0;else if("language"==babel[b.name])this.language=b.value;else if("pleca"==b.name)b=e.parsePleca(b.value,this.width),this.container.insertBefore(b,this.loader),this.plecaHeight=b.imageHeight?b.imageHeight:b.offsetHeight;else if("Buttons"==
babel[b.name])this.buttonsConfig=e.parseButtonsConfig(b.value);else if("decimal_symbol"==babel[b.name])this.decimal_symbol=b.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[b.name])this.version=parseInt(b.value);else if("language"==babel[b.name])this.language=b.value;else if("rtf"==b.name){var x=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+
b.value.replace(/'/g,"&squot;")+"'");k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+x+","+(y-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&k.push("space='descartesJS_stage' type='image' expresion='["+(x+15)+","+y+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==b.name.charAt(0)?(b.value.match(/'HTMLIFrame'/)&&this.nIframes++,d.push(b.value)):/^C_/.test(b.name)?f.push(b.value):/^A_/.test(b.name)?g.push(b.value):/^G_/.test(b.name)?
(b.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),k.push(b.value)):/^S_/.test(b.name)?p.push(b.value):"Animation"==babel[b.name]&&n.push(b.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_stage' fondo='"+(a.TextController?"ffffffff":"blanco")+"' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+
this.width+"' alto='"+this.height+"'"),this.stage.container.appendChild(this.stage.stageSpace.container),this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));m=0;for(r=d.length;m<r;m++)c=e.parseSpace(d[m]),this.arquimedes&&this.stage.container.appendChild(c.container),this.spaces.push(c),this.zIndex++;m=0;for(r=k.length;m<r;m++)if(a.DEBUG.elemIndex=m,d=e.parseGraphic(k[m]))this.editableRegionVisible=this.editableRegionVisible||d.visible,d.space.addGraph(d);m=0;
for(r=p.length;m<r;m++)(d=e.parse3DGraphic(p[m]))&&d.space.addGraph(d,!0);m=0;for(r=f.length;m<r;m++)this.controls.push(e.parseControl(f[m]));m=0;for(r=g.length;m<r;m++)e.parseAuxiliar(g[m]);m=0;for(r=n.length;m<r;m++)this.animation=e.parseAnimation(n[m]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();m=0;for(r=this.controls.length;m<r;m++)this.controls[m].init();this.updateControls();this.updateSpaces(!0);var z=this;this.nIframes?a.setTimeout(function(){z.finishInit()},200*
this.nIframes):this.finishInit()};k.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 c=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(c)}catch(b){console.warn("CustomEvents not supported in this browser")}this.readyApp=!0};k.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var c=parseInt(this.width)+
30,b=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-c)/2,(parseInt(screen.height)-b)/2);window.resizeTo(c,b);a.onResize()};k.prototype.configRegions=function(){var c=this.evaluator.parser,b=this.buttonsConfig||{},e=this.container,d="15",f=100,g=100,k=100,p=100;2==this.version&&(d="14",f=63,g=50,k=44,p=53);var n=0,m=0,r=0,x=0,y=0,z=this.northSpace.controls,G=this.southSpace.controls,J=this.eastSpace.controls,E=this.westSpace.controls;if(0<b.rowsNorth||0<z.length||b.about||b.config){0>=
b.rowsNorth?(n=b.height,b.rowsNorth=1):n=b.height*b.rowsNorth;var F=this.northSpace.container;F.id="descartesJS_north";F.setAttribute("style","width:"+e.width+"px;height:"+n+"px;left:0;top:"+this.plecaHeight+"px;");e.insertBefore(F,this.loader);F=e.width;var D=0;b.about?(D=f,F-=D):f=0;b.config&&(F-=g);var B=Math.ceil(z.length/b.rowsNorth),L=F/B;var I=0;for(var M=z.length;I<M;I++)z[I].expresion=c.parse("("+(D+I%B*L)+","+b.height*Math.floor(I/B)+","+L+","+b.height+")"),z[I].drawif=c.parse("1"),z[I].init();
b.about&&(I=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:c.parse(d),expresion:c.parse("(0, 0, "+f+", "+n+")")}),I.actionExec={execute:a.showAbout},I.update());b.config&&(new a.Button(this,{region:"north",name:"config",font_size:c.parse(d),action:"config",expresion:c.parse("("+(F+f)+", 0, "+g+", "+n+")")})).update()}if(0<b.rowsSouth||0<G.length||b.init||b.clear){0>=b.rowsSouth?(m=b.height,b.rowsSouth=1):m=b.height*b.rowsSouth;f=e.width;D=0;b.init?
(D=k,f-=D):k=0;b.clear&&(f-=p);F=this.southSpace.container;F.id="descartesJS_south";F.setAttribute("style","width:"+e.width+"px;height:"+m+"px;left:0;bottom:0;");e.insertBefore(F,this.loader);B=Math.ceil(G.length/b.rowsSouth);L=f/B;I=0;for(M=G.length;I<M;I++)G[I].expresion=c.parse("("+(D+I%B*L)+","+b.height*Math.floor(I/B)+","+L+","+b.height+")"),G[I].drawif=c.parse("1"),G[I].init();b.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:c.parse(d),action:"init",
expresion:c.parse("(0, 0, "+k+", "+m+")")})).update();b.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:c.parse(d),action:"clear",expresion:c.parse("("+(f+k)+", 0, "+p+", "+m+")")})).update()}if(0<J.length)for(I=e.height-n-m,x=b.widthEast,F=this.eastSpace.container,F.id="descartesJS_east",F.setAttribute("style","width:"+x+"px;height:"+I+"px;right:0;top:"+n+"px;"),e.insertBefore(F,this.loader),I=0,M=J.length;I<M;I++)J[I].expresion=c.parse("(0,"+b.height*
I+","+x+","+b.height+")"),J[I].drawif=c.parse("1"),J[I].init();if(0<E.length)for(I=e.height-n-m,y=b.widthWest,F=this.westSpace.container,F.id="descartesJS_west",F.setAttribute("style","width: "+y+"px;height:"+I+"px;left:0;top:"+n+"px;"),e.insertBefore(F,this.loader),I=0,M=E.length;I<M;I++)E[I].expresion=c.parse("(0,"+b.height*I+","+y+","+b.height+")"),E[I].drawif=c.parse("1"),E[I].init();if(this.editableRegionVisible)for(r=b.height,F=this.editableRegion.container,F.id="descartesJS_editableRegion",
F.setAttribute("style","position:absolute;width:"+e.width+"px;height:"+r+"px;left:0;top:"+(e.height-m-b.height)+"px;"),e.insertBefore(F,this.loader),c=this.editableRegion.textFields,e=e.width/c.length,b=a.getFieldFontSize(r),I=0,M=c.length;I<M;I++)"div"==c[I].type?(F.appendChild(c[I].container),c[I].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+r+"px;position:absolute;left:"+I*e+"px;top:0;"),E=c[I].container.firstChild,E.setAttribute("style","font-family:"+
a.sansserif_font+";font-size:"+b+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+r+"px;text-align:center;line-height:"+r+"px;"),J=E.offsetWidth,E.style.width=J+"px",E.firstChild.textContent=E.firstChild.textContent.substring(3,E.firstChild.textContent.length-3),c[I].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+b+"px;width:"+(e-J)+"px;height:"+r+"px;position:absolute;left:"+J+"px;top:0;border:2px groove white;")):(F.appendChild(c[I]),
c[I].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+b+"px;width:"+e+"px;height:"+r+"px;position:absolute;left:"+I*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=n;this.displaceRegionSouth=m+(r||0);this.displaceRegionEast=x;this.displaceRegionWest=y;I=0;for(M=this.spaces.length;I<M;I++)this.spaces[I].init()};k.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};k.prototype.clearClick=
function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};k.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var c=0,b=this.controls.length;c<b;c++)this.controls[c].buttonClick=!1};k.prototype.deactivateGraphicControls=function(){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};k.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};k.prototype.updateEvents=
function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};k.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};k.prototype.updateSpaces=function(a){for(var b=0,c=this.spaces.length;b<c;b++)this.spaces[b].update(a)};k.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()};k.prototype.play=function(){this.animation.play()};
k.prototype.stop=function(){this.animation.stop()};k.prototype.reinitAnimation=function(){this.animation.reinit()};k.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)};k.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};k.prototype.getAudio=function(c){var b=this.audios;if(c){if(!b[c]){c.lastIndexOf(".");b[c]=new Audio(c);var e=function(a){this.ready=1};b[c].addEventListener("canplaythrough",e);var d=function(a){this.canPlayType("audio/"+c.substring(c.length-3))||"mp3"!=c.substring(c.length-3)?(console.warn("El archivo '"+c+"' no puede ser reproducido"),this.errorload=1):(b[c]=new Audio(c.replace("mp3","ogg")),b[c].addEventListener("canplaythrough",e),b[c].addEventListener("load",
e),b[c].addEventListener("error",d),b[c].load())};b[c].addEventListener("error",d);b[c].play();a.setTimeout(function(){b[c].pause()},15)}return b[c]}return new Audio};k.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};k.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}};k.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};k.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}};k.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]))}};k.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 e in d)d.hasOwnProperty(e)&&(a+="\n"+e+"="+g(d[e]));e=this.evaluator.matrices;for(var f in e)e.hasOwnProperty(f)&&(a+="\n"+f+"="+g(e[f]));return a};k.prototype.setState=function(a,b){a=a.split("\n");for(var c,d,e=0,f=a.length;e<f;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()};k.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};k.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()};k.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<
b;a++)this.evaluator.eval(this.saveState[a]);this.update()};k.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=k;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(g,f){g="Error: "+g+" en\u300a "+f+" \u300b";var e="";switch(a.DEBUG.objectName){case "Auxiliar":f="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])e=" en la l\u00ednea "+(a.DEBUG.lineCount+1);g+=f+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+e+".";break;case "Graphic":g+="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(g)}};return a}(descartesJS||{});
descartesJS=function(a){function g(){f().forEach(function(c){a.apps.push(new a.DescartesApp(c));c.className="DescartesJS"})}function f(){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 e(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function r(c){c=a.newHTML("div");var f='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbol DJS_sansserif DJS_serif DJS_monospace DJS_math".split(" ").forEach(function(a){f+='<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>'});c.innerHTML=f+"</div>";document.body.appendChild(c);a.getFeatures();a.hasCanvas?(window.scrollTo(0,10),e(),g(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";c.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var c=document.getElementById("StyleDescartesApps");c&&c.remove();c=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});c.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(c)})();a.onResize=
function(c){0<a.apps.length&&a.apps[0].scaleToFit()};var p=Object.create(null);a.onMessage=function(c){if(0<a.apps.length){var e=c.data;if(e)if("set"===e.type)"string"==typeof e.value||"number"==typeof e.value?a.apps[0].evaluator.setVariable(e.name,e.value):e.value&&void 0!=e.value.rows?a.apps[0].evaluator.matrices[e.name]=e.value:a.apps[0].evaluator.vectors[e.name]=e.value;else if("update"===e.type)a.apps[0].update();else if("exec"===e.type)(c=a.apps[0].evaluator.getFunction(e.name))&&c.apply(a.apps[0].evaluator,
e.value.toString().split(","));else if("isResizeNeeded"===e.type)c.source.postMessage({type:"doResize"},"*");else if("doResize"===e.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===e.type){p[e.filename]?c=p[e.filename]:(c=a.newHTML("div"),c.innerHTML=e.content,c=c.getElementsByTagName("param"),p[e.filename]=c);var f=document.querySelector("base");f||(f=a.newHTML("base"),document.body.appendChild(f));f.setAttribute("href",e.filename);a.apps[0].children=c;a.apps[0].init()}}};void 0==
a.loadLib&&(a.loadLib=!0,window.addEventListener("load",r),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(c){window.addEventListener(c,function(c){a.onResize(c)})}),document.fonts.ready.then(function(){setTimeout(function(){a.apps.forEach(function(a){a.updateControls();a.updateSpaces(!0)})},500)}));return a}(descartesJS||{});
