/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2019-01-16
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,k){a!=Array.prototype&&a!=Object.prototype&&(a[g]=k.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,k,f){if(g){k=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var m=a[f];m in k||(k[m]={});k=k[m]}a=a[a.length-1];f=k[a];g=g(f);g!=f&&null!=g&&$jscomp.defineProperty(k,a,{configurable:!0,writable:!0,value:g})}};$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,k,f){var g=this.length||0;0>k&&(k=Math.max(0,g+k));if(null==f||f>g)f=g;f=Number(f);0>f&&(f=Math.max(0,g+f));for(k=Number(k||0);k<f;k++)this[k]=a;return this}},"es6","es3");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.no=a.ez=a.non=a["n\u00e3o"]="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a["sim "]="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.texto=
a.text=a.testua=a.texte="text";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.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.ancho=a.width=a.ample=a.zabalera=a.large=a.largura="width";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="text";a.punto=a.point=a.punt=a.puntu=a.ponto="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="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.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";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.alto=a.height=a.alt=a.altu=a.haut=a.altura="height";a.x=a.left="x";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.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.ancho=a.profundidade=a.amplada=a.width="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";
a.alto=a.height=a["al\u00e7ada"]=a.altu=a.hauteur=a.alto=a.altura=a["al\u00e7ada"]="height";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.imagen=a.bg_image=a.imatge=a.irudia=a.imaxe=a.imagem_de_fundo=a.image="image";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="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.tipo_de_macro=a.macro_type=a.tipus_de_macro=a.makro_mota=a.type_de_macro=a.tipo_de_macro=a.tipo_de_macro=a.tipus_de_macro="macro_type";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.imagen=a.image=a.imatge=a.irundia=a.imaxe=a.imagem="image";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.tipo=a.type=a.tipus=a.mota="type";a.R2="R2";a.R3="R3";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["ecuaci\u00f3n"]=a.equation=a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.punto=a.dot=a.punt=a.puntu=a.point=a.ponto="point";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.loop="loop";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.cssClass="cssClass";a.doc="doc";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.jsfun="jsfun";return a}(babel||{}),descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m;a.serif_font="descartesJS_serif,DJS_symbola,DJS_extra,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbola,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";
a.monospace_font="descartesJS_monospace,DJS_symbola,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.convertFont=function(e){if(""==e)return"";g=e.split(",");k="";k+=a.getFontStyle(g[1]);k+=g[2]+"px ";return k+=a.getFontName(g[0].split(" ")[0])};a.getFontName=function(e){e=e.toLowerCase();f=a.monospace_font;if("serif"===e||"times new roman"===e||"timesroman"===e||"times"===e)f=a.serif_font;else if("sansserif"===e||"arial"===e||"helvetica"===e)f=a.sansserif_font;return f};
a.getFontStyle=function(a){m="";a=a.toLowerCase();"bold"==a?m+="Bold ":"italic"==a||"italics"==a?m+="Italic ":"bold+italic"==a&&(m+="Italic Bold ");return m};a.getTextWidth=function(e,d){a.ctx.font=d;return Math.round(a.ctx.measureText(e).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};document.createElement("canvas");var e;a.getFontMetrics=function(a){var d={};e=parseInt(a.match(/(\d+\.*)+px/)[0]);a.match("sansserif")?(d.ascent=
-3.140767846E-4*(e^2)+.921017849*e+.7767317469,d.descent=-5.851175551E-4*(e^2)+.2674451709*e+1.0887015962,d.h=d.ascent+d.descent,d.baseline=d.ascent):a.match("serif")?(d.ascent=-3.647238191E-5*(e^2)+.8914890964*e+.668615541,d.descent=-9.807742367E-4*(e^2)+.3184618868*e+.8663797537,d.h=d.ascent+d.descent,d.baseline=d.ascent):a.match("monospace")&&(d.ascent=1.192160435E-4*(e^2)+.7541188887*e+1.4106492466,d.descent=-.001256260588*(e^2)+.3926891751*e+.57969422598,d.h=d.ascent+d.descent,d.baseline=d.ascent);
return d};return a}(descartesJS||{});
descartesJS=function(a){function g(){var a,b,c,d,e,l,n;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(f){f=f||0;f=0>f?0:f>>0;a=this.toString();-1!==a.indexOf("e")&&(d=a.split("e"),l="-"===d[0][0]?"-":"",e="-"===l?parseFloat(d[0].substring(1)).oToFixed(11):parseFloat(d[0]).oToFixed(11),n=d[1]>>0,b=e.indexOf("."),0>b+n?(b=0>b?1:b,a=l+"0."+Array(Math.abs(b+n)+1).join("0")+e.replace(".","")):(e=e.replace(".",""),a=l+e+Array(n-e.length+2).join("0")));b=a.indexOf(".");
extraZero="";-1===b?(0<f&&(a+="."),a+=Array(f+1).join("0")):(c=a.length-b-1,a=c>=f?11>=f?parseFloat(a).oToFixed(f):0<f?a.substring(0,b+f+1):a.substring(0,b):a+Array(f-c+1).join("0"));return a}}if(a.loadLib)return a;var k=2*Math.PI,f=360/k,m=k/360,e=Math.floor,h,d,c,v,l,b,n,y,p,q;a.rangeOK=1;a.cssScale=1;a.extend=function(a,b){if("function"==typeof Object.create)a.prototype=Object.create(b.prototype);else if(a.prototype.__proto__)a.prototype.__proto__=b.prototype;else for(var c in b.prototype)b.prototype.hasOwnProperty(c)&&
(a.prototype[c]=b.prototype[c]);a.prototype.uber=b.prototype};a.radToDeg=function(a){return a*f};a.degToRad=function(a){return a*m};a.drawLine=function(a,b,c,d,l,n,f){a.lineWidth=f||1;a.strokeStyle=n||"black";q=a.lineWidth%2?.5:0;a.beginPath();a.moveTo(e(b)+q,e(c)+q);a.lineTo(e(d)+q,e(l)+q);a.stroke()};a.getColor=function(a,b){if("string"==typeof b)return b;h=a.eval(b);d=e(255*h[0][0]);c=e(255*h[0][1]);v=e(255*h[0][2]);l=1-h[0][3];return"rgba("+d+","+c+","+v+","+l+")"};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/.test(navigator.userAgent);b=document.createElement("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(a.ctx=document.createElement("canvas").getContext("2d"),a._ratio=1.5);g()};var r,u;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(r=a.indexOf("."),
-1!=r)){u=a.substring(r);if(0==parseFloat(u))return a.substring(0,r);for(var b=u.length;0<b;b--)if(0!=u.charAt(b))return a.substring(0,r+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return null!==a.which?2>a.which?"L":2===a.which?"M":"R":2>a.button?"L":4===a.button?"M":"R"};a.getCursorPosition=function(c,d){c.touches?(b=c.touches[0],n=b.pageX,y=b.pageY):(n=c.pageX,y=c.pageY);p=d.getBoundingClientRect();return{x:(n-window.pageXOffset-
p.left)/a.cssScale,y:(y-window.pageYOffset-p.top)/a.cssScale}};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function c(){(new Date).getTime()-d>=b&&(a.call(),d=(new Date).getTime());e.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setInterval(a,b);var d=
(new Date).getTime(),e={};e.value=requestAnimationFrame(c);return e};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function c(){(new Date).getTime()-d>=b?a.call():e.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setTimeout(a,b);var d=(new Date).getTime(),e={};e.value=requestAnimationFrame(c);return e};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&ntilde;o funcional:</dt>\n<dd>\n<nobr>Jos&eacute; Luis Abreu Leon,</nobr>\n<nobr>Jos&eacute; R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos&eacute; Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver&oacute; Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz&aacute;lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est&aacute; 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&aacute; bajo licencia\n<a href='http://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci&oacute;n y el c&oacute;digo fuente se encuentran en :\n<br>\n<a href='http://arquimedes.matem.unam.mx/Descartes5/'>http://arquimedes.matem.unam.mx/Descartes5/</a>\n</p>";
a.ccLicense&&(b+="<p>\nEste objeto, creado con Descartes, est&aacute; licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>");b+="</body> </html>";var c=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
c.document.write(b);c.document.close()};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,c,d=[],e=0,l=0,n=a.length;l<n;l++)c=a.charAt(l),"'"===c&&(b=!b),b||";"!==c&&"\n"!==c||(d.push(a.substring(e,l).replace(/\n/g,"\\n")),e=l+1);d.push(a.substring(e).replace(/\n/g,"\\n"));return d};a.preventDefault=function(a){a.preventDefault();return!1};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k;a.cacheFiles={};a.openExternalFile=function(f){if(a.cacheFiles[f])return a.cacheFiles[f];g=null;var m=!1;if(window.XMLHttpRequest)try{m=new XMLHttpRequest}catch(e){m=!1}else if(window.ActiveXObject)try{m=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{m=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){m=!1}}k=m;k.open("GET",f,!1);try{k.send(null),g=200===k.status||304===k.status?k.responseText:k.responseText||"",g=404===k.status?"":g,g.match(String.fromCharCode(65533))&&
(k.open("GET",f,!1),k.overrideMimeType("text/plain; charset=ISO-8859-1"),k.send(null),g=k.responseText)}catch(e){console.log("Error to load the file :",f),g=null}return g};a.addExternalFileContent=function(f,g){a.cacheFiles[f]=g};return a}(descartesJS||{});
descartesJS=function(a){function g(a){q=a.indexOf("--radial--");-1!=q&&(a=a.substring(0,q));e=a.trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};e[0]==e[e.length-1]&&"'"==e[0]&&(a.ignoreCaps=!0,e=e.substring(1,e.length-1),"`"==e[0]&&"\u00b4"==e[e.length-1]&&(a.ignoreAcents=!0,e=e.substring(1,e.length-1)));"`"==e[0]&&"\u00b4"==e[e.length-1]&&(a.ignoreAcents=!0,e=e.substring(1,e.length-1),e[0]==e[e.length-1]&&"'"==e[0]&&(a.ignoreCaps=!0,e=e.substring(1,e.length-1)));"*"===e.charAt(0)&&"*"!==e.charAt(e.length-
1)?e=e.substring(1)+"$":"*"!==e.charAt(0)&&"*"===e.charAt(e.length-1)?e="^"+e.substring(0,e.length-1):"*"!==e.charAt(0)&&"*"!==e.charAt(e.length-1)?e="^"+e+"$":"*"===e.charAt(0)&&"*"===e.charAt(e.length-1)&&(e=e.substring(1,e.length-1));a.regExp=e.replace(/\?/g,"[\\S\\s]{1}");return a}function k(a,b){e=(a||"").trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};a.expr=e.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 f(a,c,d){c=parseFloat(c);v=a.expr[0];l=a.expr[1];b=d.eval(v.expr);n=d.eval(l.expr);y="("==v.type||"["==v.type;p=")"==l.type||"]"==l.type;return y&&c>b&&p&&c<=n?1:0}function m(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 e,h,d,c,v,l,b,n,y,p,q;a.buildRegularExpresionsPatterns=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 c=0,l=a.length;c<l;c++){h=a[c].split("&");d=[];for(var n=0,f=h.length;n<f;n++)e=h[n],-1===e.indexOf(",")||"("!==
e.charAt(0)&&"["!==e.charAt(0)||")"!==e.charAt(e.length-1)&&"]"!==e.charAt(e.length-1)?d.push(g(e)):d.push(k(e,b));a[c]=d}return a};a.escorrecto=function(b,d,e,l){e=e||a.externalEvaluator;l=l||a.buildRegularExpresionsPatterns(b,e);d=m(d);b=0;for(var n=l.length;b<n;b++){h=l[b];c=!0;for(var g=0,k=h.length;g<k;g++)c=h[g].regExp?c&&!!d.match(new RegExp(m(h[g].regExp),"i")):c&&f(h[g],d,e);if(c)return 1}return 0};a.esCorrecto=function(b,d,l,n){l=l||a.externalEvaluator;n=n||a.buildRegularExpresionsPatterns(b,
l);b=0;for(var g=n.length;b<g;b++){h=n[b];c=!0;for(var k=0,p=h.length;k<p;k++)(e=h[k].regExp)?(h[k].ignoreAcents&&(d=m(d),e=m(e)),h[k].ignoreCaps&&(d=d.toLowerCase(),e=m(e).toLowerCase()),c=c&&!!d.match(e)):c=c=c&&f(h[k],d,l);if(c)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, ";a.getCCLImg=
function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAMAAABUFvrSAAABC1BMVEUAAAC1urSEhYRDREMNDg2EhoR5fHkpKSmRk5EbGxuRlJGVmZQoKShAQEBwcHCTmJNQUVAQEBBgYGCAgIC/v78ODg5QUFDf39/////v7++fn5+Rj49aV1jj4+PIx8cwMDB9f3zW1dUyMTGamJkZGRkNDA12c3SjoaEjHyC6ubkpKikoJSY/OzxoZWaHhoesq6s/NzljX2HPz891cnN4dXbx8fGflpqOh4uenZ0xLS4kJCQoKCjo5+ePj4+1tbUtLS3g3+Cvr6/JyMggICAqKip+e3wfGxyEgYIqJyeYlpd/gX5ubGyMiovLyst6fXmeoJ18f3xdXl2ChYJwcm81NjWWmZYyMzE+Pz6JjIk4KLQtAAACcklEQVR4AbyVhXbjMBREx2UIGWq/MCcqMy2Wu8z0/1+yz5ElKyrjlG99bpQR4eniPEmeRTwyOgbO2Oi4Y2ViEpzJiTuQVDw1DZ3pGVM7mwGyuVwWyOQlyd9MtLgAwPX8IPA9F0DBEM8hjIgThZjL35YAUF7XL5JMidUZ7Z2ExwyI/yFxZkDKFYtUa7WqJgASbz0inWI9HXMDYVOJKcQEt4lWm72dbq+qCT/TF5x5SZR4ir1quNqc9LyAKOURJuO3sCiWluGvYFWTiGpibb0nRFmSRDwNd4OGUnQxLcXIEscDPOJkEZPNLSFEr9pMCW3viF2iPbEviRSPAD5ZKQFy1SFHHEB2kYMktR6AXjMl2y/ES65ZiFdMlHgULhcRhNmsL3+8JiIXo9eI2dHbF6Iyr8mbt8FAfGCIx+CxEHGyh+DEf3sYu7wKSbb3qCk4S4rM94+IVoUwqwB4iHUcR8FxqY56dHhcGnQxEJ/IyQOMyWNSEfv76K2enimyJ8T5+Tvx3pw8ICBKetZ1B4n4A0KylxuT6nmnW942ybngfNyW5EYxZyHdIDlzg3yqWOTz6mpTEruK4saxz1XEP2QVD9zScvKSWdOTl8NYuqlR93J1dcBwMjcRKS7AJb3cDrODH3SMUUflyz2PzSnu4tIN8oDoLR1dvqUfKP562SE09VAxvjnOdzYbx1Akj80feGB+Dh/0Rd8FfjnONzw4jXjM9tX0Gypyf0B+cfQfzK2H6KL5q3mZTpleUPJJKZF/Wy+lgNWGM6Wu/xlnuAd1bBok+TCijhNY+eMM5S+M2EVIQvYALaDz95+y/jO1l49Yy+15IPzfkAUAdrZiwIT3fTYAAAAASUVORK5CYII=";
return a};a.getSvgMenu=function(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTYuNjQgOEwxMiAxMi45NjIgMTcuMzYgOCAxOSA5LjUxOSAxMiAxNiA1IDkuNTE5eiIvPjwvc3ZnPg=="};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0NSIgaGVpZ2h0PSI0NSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzcuMDk1IDYuMjg0TDE1LjQ3MyAyNy45MDVsLTcuNTY4LTcuNTY3TDIuNSAyNS43NDNsMTIuOTczIDEyLjk3M0w0Mi41IDExLjY5eiIgY29sb3I9IiMwMDAiIHNvbGlkLWNvbG9yPSIjMDAwMDAwIiBzdHlsZT0iYmxvY2stcHJvZ3Jlc3Npb246dGI7aXNvbGF0aW9uOmF1dG87bWl4LWJsZW5kLW1vZGU6bm9ybWFsO3RleHQtZGVjb3JhdGlvbi1jb2xvcjojMDAwO3RleHQtZGVjb3JhdGlvbi1saW5lOm5vbmU7dGV4dC1kZWNvcmF0aW9uLXN0eWxlOnNvbGlkO3RleHQtaW5kZW50OjA7dGV4dC10cmFuc2Zvcm06bm9uZSIgd2hpdGUtc3BhY2U9Im5vcm1hbCIvPjwvc3ZnPg=="};
a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.min,f,m,e,h,d,c,v,l,b,n,y,p,q,r;a.Color=function(a,b){this.b=this.g=this.r=0;this.a=1;this.evaluator=b;this.getColor=this.getColorStr;if(a){if(babel[a]&&("net"===babel[a]&&(a="rojo"),a=babel[a],this.r=parseInt("0x"+a.substring(1,3),16),this.g=parseInt("0x"+a.substring(3,5),16),this.b=parseInt("0x"+a.substring(5,7),16),this.colorStr=a),6===a.length&&(this.r=parseInt("0x"+a.substring(0,2),16),this.g=parseInt("0x"+a.substring(2,4),
16),this.b=parseInt("0x"+a.substring(4,6),16),this.colorStr="#"+a),8===a.length&&(this.r=parseInt("0x"+a.substring(2,4),16),this.g=parseInt("0x"+a.substring(4,6),16),this.b=parseInt("0x"+a.substring(6,8),16),this.a=1-parseInt("0x"+a.substring(0,2),16)/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===a[0]){m=[];e=this.splitComa(a.substring(1,a.length-1));a=0;for(b=e.length;a<b;a++)c=e[a],h=parseInt(c,16),c!==h.toString(16)&&c!=="0"+h.toString(16)?("["===c.charAt(0)&&"]"===
c.charAt(c.length-1)&&(c=c.substring(1,c.length-1)),m.push(this.evaluator.parser.parse(c))):m.push(this.evaluator.parser.parse((h/255).toString()));this.rExpr=m[0];this.gExpr=m[1];this.bExpr=m[2];this.aExpr=m[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};a.Color.prototype.splitComa=function(a){d=[];for(var c=b=l=v=0,e=a.length;c<e;c++)n=a.charAt(c),"("===n?v++:")"===n?v--:"["===n?l++:"]"===n?l--:","===n&&0===v&&0===l&&(d.push(a.substring(b,
c)),b=c+1);d.push(a.substring(b));return d};a.Color.prototype.getColorStr=function(){return this.colorStr};a.Color.prototype.getColorExp=function(){f=this.evaluator;this.r=k(255,g(255*f.eval(this.rExpr)));this.g=k(255,g(255*f.eval(this.gExpr)));this.b=k(255,g(255*f.eval(this.bExpr)));this.a=1-f.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};a.Color.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.RGBAToHexColor=function(b){b=b.substring(5,
b.length-1).split(",");y=(b[0]>>0).toString(16);p=(b[1]>>0).toString(16);q=(b[2]>>0).toString(16);r=(255-(255*parseFloat(b[3])>>0)).toString(16);1===y.length&&(y="0"+y);1===p.length&&(p="0"+p);1===q.length&&(q="0"+q);1===r.length&&(r="0"+r);return new a.Color(r+y+p+q)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=document.head,k=document.createElement("meta");k.setAttribute("http-equiv","X-UA-Compatible");k.setAttribute("content","IE=edge,chrome=1");g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","viewport");k.setAttribute("content","width=device-width,initial-scale=1.0,user-scalable=yes");document.querySelector("meta[name=viewport]")||g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","apple-mobile-web-app-capable");
k.setAttribute("content","yes");g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","apple-mobile-web-app-status-bar-style");k.setAttribute("content","black");g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","DescartesJS_author");k.setAttribute("content","Joel Espinosa Longi");g.appendChild(k);(g=document.getElementById("StyleDescartesApps2"))&&g.parentNode.removeChild(g);g=document.createElement("style");g.type="text/css";g.id="StyleDescartesApps2";g.setAttribute("rel",
"stylesheet");document.head.insertBefore(g,document.head.firstChild);g.innerHTML="@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+
"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@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;}\ncanvas{transform:translate3d(0,0,0);}\ndiv.DescartesAppContainer html,div.DescartesAppContainer *,div.DescartesAppContainer *:before,div.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}\ndiv.DescartesCatcher{background-color:rgba(255,255,255,0);cursor:pointer;position:absolute;}\ndiv.DescartesAppContainer{border:0 solid #000;overflow:hidden;position:relative;top:0;left:0;}\ndiv.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;}\ndiv.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;}\ncanvas.DescartesLoaderBar{position:absolute;overflow:hidden;top:0;left:0;}\ncanvas.DescartesSpace2DCanvas,canvas.DescartesSpace3DCanvas,div.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\ndiv.DescartesSpace2DContainer,div.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,.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:white;border: 1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after,.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:white;}\ncanvas.DescartesButton{position:absolute;cursor:pointer;}\ndiv.DescartesButtonContainer{position:absolute;overflow:hidden;}\ndiv.DescartesButtonContainer div{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%;}\ndiv.DescartesButtonContainer[data-active='false']::after{content:' ';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(240,240,240,0.6);pointer-events:none;}\ndiv.DescartesSpinnerContainer,div.DescartesCheckboxContainer,div.DescartesTextFieldContainer,div.DescartesMenuContainer{background:lightgray;position:absolute;overflow:hidden;}\ndiv.DescartesSpinnerContainer input,div.DescartesCheckboxContainer,div.DescartesTextFieldContainer input,div.DescartesMenuContainer select{border-radius:0;}\n.DescartesCheckbox{position:absolute;}\ninput.DescartesSpinnerField,input.DescartesTextFieldField,input.DescartesMenuField,input.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;top:0;}\nlabel.DescartesSpinnerLabel,label.DescartesCheckboxLabel,label.DescartesMenuLabel,label.DescartesScrollbarLabel,label.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;background-color:#e0e4e8;position:absolute;left:0;top:0;}\ndiv.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\ndiv.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;}\nselect.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;}\nselect.DescartesMenuSelect::-ms-expand{display:none;}\ndiv.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n";return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sin,k=Math.floor,f=Math.random,m=Math.round,e=Math.abs,h=String.fromCharCode,d,c,v,l,b,n,y,p,q,r;a.Krypto=function(a){this.key=(a||0).toString()};a.Krypto.prototype.getKey=function(a){d=[];for(var b=0;256>b;b++)d[b]=h(this.alfanum(k(e(7.5*(g(1*b-a)+g(1.4*b+a)+g(.6*b-a)+g(2.2*b+a))))));return d.join("")};a.Krypto.prototype.encode=function(a){c=k(31*f());this.key=this.getKey(c);return h(this.alfanum(c))+this.encripta(a)};a.Krypto.prototype.decode=
function(a){c=this.numalfa(a.charCodeAt(0));this.key=this.getKey(c);return this.desencripta(a.substring(1))};a.Krypto.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};a.Krypto.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;n=Array(3*a.length);for(var b=0,c=a.length;b<c;b++)q=256*k(a[b]+128)+m(255*f())+65536*m(255*f()),r=k((q<<this.shift(b))/256),n[3*b]=this.alfanum(r%32),n[3*b+1]=this.alfanum(r/32%32),n[3*b+2]=this.alfanum(r/
1024%32);return n};a.Krypto.prototype.desencripta=function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};a.Krypto.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;y=Array(a.length/3);for(var b=0,c=y.length;b<c;b++)r=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),q=k(256*r>>this.shift(b)),p=k(q/256)%256-128,0>p&&(p+=256),y[b]=p;return y};a.Krypto.prototype.alfanum=function(a){a=k(a);return 10>a?48+a:87+a};a.Krypto.prototype.numalfa=
function(a){return 58>a?a-48:a-87};a.Krypto.prototype.stringToBytes=function(a){l=Array(a.length);for(var b=0,c=a.length;b<c;b++)l[b]=a.charCodeAt(b);return l};a.Krypto.prototype.bytesToString=function(a){for(var b=0,c=a.length;b<c;b++)a[b]=h(a[b]);return a.join("")};a.Krypto.prototype.shift=function(a){v=this.key.charCodeAt(a%this.key.length);l=this.numalfa(v);b=k(l/2%8);0==b&&(b=4);return b};a.Krypto.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max;a.Animation=function(g,f){this.parent=g;var k=g.evaluator,e=k.parser;g=new a.Auxiliary(g);var h=this;h.delay=f.delay?e.parse(f.delay):e.parse("60");h.loop=f.loop?f.loop:!1;h.auto=void 0==f.auto?!0:f.auto;h.controls=f.controls;h.init=g.splitInstructions(e,f.init);h.doExpr=g.splitInstructions(e,f.doExpr);f.whileExpr&&(h.whileExpr=e.parse(f.whileExpr));var d,c=h.doExpr.length;h.animExec=function(){for(d=0;d<c;d++)k.eval(h.doExpr[d]);h.parent.update();h.playing&&
(0<k.eval(h.whileExpr)||h.loop)?h.timer=a.setTimeout(h.animExec,k.eval(h.delay)):(h.stop(),h.pause=!1,h.parent.update())};h.playing=!1;h.auto&&h.play()};a.Animation.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,g(10,this.parent.evaluator.eval(this.delay))))};a.Animation.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};a.Animation.prototype.reinit=function(){for(var a=
0,f=this.init.length;a<f;a++)this.parent.evaluator.eval(this.init[a])};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.Action=function(a,k){this.parent=a;this.evaluator=this.parent.evaluator};a.Action.prototype.execute=function(){};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Message=function(g,k){a.Action.call(this,g,k);this.parameter=(k||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'")};a.extend(a.Message,a.Action);a.Message.prototype.execute=function(){alert(this.parameter)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Calculate=function(g,k){a.Action.call(this,g,k);var f=this.evaluator;g=f.parser;k=(k||"").replace(/&squot;/g,"'");k=a.splitSeparator(k);for(var m=[],e,h=0,d=k.length;h<d;h++)(e=g.parse(k[h],!0))&&m.push(e);d=m.length;this.execute=function(){for(h=0;h<d;h++)f.eval(m[h])}};a.extend(a.Calculate,a.Action);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.OpenURL=function(g,k){a.Action.call(this,g,k);this.parser=g.evaluator.parser;this.evaluator=g.evaluator;this.parameter=k;this.target="_blank"};a.extend(a.OpenURL,a.Action);a.OpenURL.prototype.execute=function(){var g=this.parameter;"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=this.evaluator.eval(this.parser.parse(g.substring(1,g.length-1))));var k=g.indexOf("target");-1!=k&&(this.target=g.substring(k),this.target=this.target.substring(this.target.indexOf("=")+
1),g=g.substring(0,k-1));if("javascript"==g.substring(0,10)){g=new a.SimpleText(parent,g.substring(11).replace(/&squot;/g,"'"));try{eval(g.toString())}catch(f){}}else"http"!=g.substring(0,4)&&(k=window.__dirname||window.location.href,g=k.substring(0,k.lastIndexOf("/")+1)+g),window.open(g,this.target)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.OpenScene=function(g,k){a.Action.call(this,g,k);this.parser=g.evaluator.parser;this.evaluator=g.evaluator;this.parameter=k.trim();this.target="_blank"};a.extend(a.OpenScene,a.Action);a.OpenScene.prototype.execute=function(){var a=this.parameter;"["===a.charAt(0)&&"]"===a.charAt(a.length-1)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var k=a.indexOf("target");-1!=k&&(this.target=a.substring(k),this.target=this.target.substring(this.target.indexOf("=")+
1),a=a.substring(0,k-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(f){}}else"http"!=a.substring(0,4)&&(k=window.__dirname||window.location.href,a=k.substring(0,k.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")};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Config=function(g,k){a.Action.call(this,g,k)};a.extend(a.Config,a.Action);a.Config.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>\n"+this.parent.applet.outerHTML.replace(/<applet/g,
"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.Init=function(g,k){a.Action.call(this,g,k)};a.extend(a.Init,a.Action);a.Init.prototype.execute=function(){this.parent.init()};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.Clear=function(g,k){a.Action.call(this,g,k)};a.extend(a.Clear,a.Action);a.Clear.prototype.execute=function(){this.parent.clear()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Animate=function(g,k){a.Action.call(this,g,k)};a.extend(a.Animate,a.Action);a.Animate.prototype.execute=function(){this.parent.play()};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.InitAnimation=function(g,k){a.Action.call(this,g,k)};a.extend(a.InitAnimation,a.Action);a.InitAnimation.prototype.execute=function(){this.parent.reinitAnimation()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;a.PlayAudio=function(k,f){a.Action.call(this,k,f);f=f||"";f.match(g)?this.filenameExpr=this.evaluator.parser.parse("'"+f.match(g)+"'"):(""!==f&&"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1)),this.filenameExpr=this.evaluator.parser.parse(f))};a.extend(a.PlayAudio,a.Action);a.PlayAudio.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));
a.paused?a.play():(a.pause(),a.currentTime=0)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Auxiliary=function(a,g){this.parent=a;this.evaluator=this.parent.evaluator;this.expresion=this.id="";this.evaluate="onlyOnce";this.local="";for(var e in g)g.hasOwnProperty(e)&&(this[e]=g[e])};a.Auxiliary.prototype.firstRun=function(){};a.Auxiliary.prototype.update=function(){};var g,k;a.Auxiliary.prototype.splitInstructions=function(f,m){k=[];m=m?a.splitSeparator(m):[""];for(var e=0,h=m.length;e<h;e++)a.DEBUG.lineCount=e,(g=f.parse(m[e],!0))&&k.push(g);
return k};a.Auxiliary.prototype.getPrivateVariables=function(a,m){k=[];m=m?m.split(/;|,/):[""];for(var e=0,f=m.length;e<f;e++)(g=a.parse(m[e],!0))&&k.push(g);e=0;for(f=k.length;e<f;e++)k[e]="asign"===k[e].type?k[e].childs[0].value:"identifier"===k[e].type?k[e].value:"";return k};a.Auxiliary.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)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Variable=function(g,k){a.Auxiliary.call(this,g,k);g=this.evaluator.parser;this.expresionString=this.expresion;(this.expresion=g.parse(this.expresionString))&&g.setVariable(this.id,this.expresion);this.editable&&(this.registerTextField(),this.parent.editableRegionVisible=!0)};a.extend(a.Variable,a.Auxiliary);a.Variable.prototype.registerTextField=function(){var a=document.createElement("div"),k=document.createElement("label");k.appendChild(document.createTextNode("___"+
this.id+"=___"));var f=document.createElement("input");f.value=this.expresionString;f.disabled=!this.editable;a.appendChild(k);a.appendChild(f);var m=this,e=m.evaluator.parser;f.onkeydown=function(a){13==a.keyCode&&(m.expresion=e.parse(this.value),e.setVariable(m.id,m.expresion),m.parent.update())};this.parent.editableRegion.textFields.push({container:a,type:"div"})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Constant=function(g,k){a.Auxiliary.call(this,g,k);this.expresion=this.evaluator.parser.parse(this.expresion);this.update()};a.extend(a.Constant,a.Auxiliary);a.Constant.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f;a.Vector=function(f,e){g=f.evaluator;k=g.parser;this.size=k.parse("3");a.Auxiliary.call(this,f,e);this.expresion=this.expresion.split(";");this.parseFile=k.parse(this.file);this.update()};a.extend(a.Vector,a.Auxiliary);a.Vector.prototype.update=function(){var m=this.expresion;g=this.evaluator;k=g.parser;this.oldFile=this.file;if(f=g.eval(this.parseFile))this.file=f;if(this.file){var e=(vectorElement=document.getElementById(this.file))&&"descartes/vectorFile"==
vectorElement.type?vectorElement.text:a.openExternalFile(this.file);if(null!=e){e=e.replace(/\r/g,"").split("\n");for(var h=[],d=0,c=e.length;d<c;d++)""!=e[d]&&h.push(e[d]);e=h}null==e||1==e.length&&""==e[0]?this.size=k.parse("0"):(m=e,this.size=null);null===this.size&&(this.size=k.parse(m.length+""))}e=[];d=0;for(c=m.length;d<c;d++)(h=k.parse(m[d],!0))&&"asign"!=h.type&&(h=k.parse(this.id+"["+d+"]="+m[d],!0)),e.push(h);m=[];m._size_=g.eval(this.size);d=0;for(c=this._size_;d<c;d++)m.push(0);g.vectors[this.id]=
m;g.setVariable(this.id+".long",m._size_);d=0;for(c=e.length;d<c;d++)g.eval(e[d])};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Matrix=function(g,k){var f=g.evaluator,m=f.parser;this.rows=m.parse("3");this.columns=m.parse("3");a.Auxiliary.call(this,g,k);this.expresion=this.splitInstructions(m,this.expresion);g=f.eval(this.rows);k=f.eval(this.columns);m=[];m.type="matrix";for(var e,h=0;h<k;h++){e=[];for(var d=0,c=g;d<c;d++)e.push(0);m[h]=e}f.matrices[this.id]=m;this.update()};a.extend(a.Matrix,a.Auxiliary);a.Matrix.prototype.update=function(){var a=this.evaluator,k=a.eval(this.rows),
f=a.eval(this.columns);a.setVariable(this.id+".filas",k);a.setVariable(this.id+".columnas",f);var m=a.matrices[this.id];m.rows=k;m.cols=f;k=0;for(f=this.expresion.length;k<f;k++)a.eval(this.expresion[k])};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Function=function(g,k){a.Auxiliary.call(this,g,k);var f=this.evaluator;g=f.parser;k=this.id.indexOf("(");this.name=this.id.substring(0,k);this.params=this.id.substring(k+1,this.id.indexOf(")"));this.domain=this.range?g.parse(this.range):g.parse("1");this.params=""==this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;this.algorithm||(this.whileExpr=this.doExpr=this.init="");this.parseExpressions(g);this.expresion=g.parse(this.expresion);
var m=this;this.functionExec=function(){m.iterations=0;if(m.numberOfParams<=arguments.length){for(var e=[],g=0,d=m.privateVars.length;g<d;g++)e.push(f.getVariable(m.privateVars[g])),f.setVariable(m.privateVars[g],0);var c=[];g=0;for(d=m.params.length;g<d;g++)c[g]=f.getVariable(m.params[g]),f.setVariable(m.params[g],arguments[g]);g=0;for(d=m.init.length;g<d;g++)f.eval(m.init[g]);do{g=0;for(d=m.doExpr.length;g<d;g++)f.eval(m.doExpr[g]);if(1E5<++m.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
m.name+" >>"),0}while(0<f.eval(m.whileExpr));var k=f.eval(m.expresion);a.rangeOK=f.eval(m.domain);g=0;for(d=m.params.length;g<d;g++)f.setVariable(m.params[g],c[g]);g=0;for(d=m.privateVars.length;g<d;g++)f.setVariable(m.privateVars[g],e[g]);return k}return 0};f.setFunction(this.name,this.functionExec)};a.extend(a.Function,a.Auxiliary);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.JsFunction=function(g,k){this.code="";a.Auxiliary.call(this,g,k);g=this.evaluator;k=this.id.indexOf("(");this.name=this.id.substring(0,k);this.params=this.id.substring(k+1,this.id.indexOf(")"));this.params=""===this.params?[]:this.params.split(",");this.functionCode=this.code.replace(/\\;/g,";")+";\nreturn "+(this.expresion||0)+";";this.functionExec=new Function(this.params,this.functionCode);g.setFunction(this.name,this.functionExec)};a.extend(a.JsFunction,
a.Auxiliary);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Algorithm=function(g,k){a.Auxiliary.call(this,g,k);var f=this.evaluator;this.parseExpressions(f.parser);var m=this;this.algorithmExec=function(){for(var a=m.iterations=0,g=m.init.length;a<g;a++)f.eval(m.init[a]);do{a=0;for(g=m.doExpr.length;a<g;a++)f.eval(m.doExpr[a]);if(1E5<++m.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+m.name+" >>"),0}while(0<f.eval(m.whileExpr))}};a.extend(a.Algorithm,
a.Auxiliary);a.Algorithm.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Event=function(g,k){a.Auxiliary.call(this,g,k);g=this.evaluator;delete this.evaluate;this.condition=g.parser.parse(this.condition);this.lastEvaluation=!1;this.action=this.parent.lessonParser.parseAction(this);"onlyOnce"==this.execution&&(this.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==this.execution&&(this.eventExec=function(){var a=0<this.evaluator.eval(this.condition);
3==this.parent.version?a!=this.lastEvaluation&&(this.action.execute(),this.lastEvaluation=a?!0:!1):a&&!this.lastEvaluation?(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==this.execution&&(this.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()})};a.extend(a.Event,a.Auxiliary);a.Event.prototype.update=function(){this.eventExec()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Library=function(g,k){a.Auxiliary.call(this,g,k);if(k=k.file){var f=document.getElementById(k);response=f&&"descartes/library"==f.type?f.text:a.openExternalFile(k)}if(response)for(response=response.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,
"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&").replace(/\r/g,"").split("\n"),k=0,f=response.length;k<f;k++)""!==response[k].trim()&&g.lessonParser.parseAuxiliar(response[k])};a.extend(a.Library,a.Auxiliary);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.Graphic=function(d,c){this.parent=d;this.evaluator=d.evaluator;var e=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=e.parse("1");this.abs_coord=c.type&&"text"===c.type?!0:!1;this.color=new a.Color("blue");2!==this.parent.version&&(this.color=new a.Color("20303a"),this.parent.arquimedes&&(this.color=new a.Color("black")));this.trace="";this.expresion=e.parse("(0,0)");this.family="";this.family_interval=
e.parse("[0,1]");this.family_steps=e.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=e.parse("2");for(var l in c)c.hasOwnProperty(l)&&(this[l]=c[l]);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=d.evaluator.parser.parse(this.fontSize.toString()))};a.Graphic.prototype.getSpace=function(){for(var a=this.parent.spaces,c,e=0,l=a.length;e<l;e++)if(c=a[e],c.id==this.spaceID)return c;return a[0]};a.Graphic.prototype.getFamilyValues=function(){g=this.evaluator;k=g.eval(this.family_interval);this.familyInf=k[0][0];this.familySup=k[0][1];this.fSteps=Math.round(g.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/
this.fSteps:0};a.Graphic.prototype.drawFamilyAux=function(a,c,e){g=this.evaluator;this.getFamilyValues();f=g.getVariable(this.family);if(0<=this.fSteps)for(var d=0,b=this.fSteps;d<=b;d++)g.setVariable(this.family,this.familyInf+d*this.family_sep),0<g.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,e));g.setVariable("_Text_H_",0);g.setVariable(this.family,f)};a.Graphic.prototype.draw=function(a,c){""!=this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.eval(this.drawif)&&
(this.update(),this.drawAux(this.ctx,a,c))};a.Graphic.prototype.drawTrace=function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,c))};a.Graphic.prototype.dashStyle=function(){h=this.ctx;"dot"===this.lineDash?(h.lineCap="butt",h.setLineDash([h.lineWidth,h.lineWidth])):"dash"===this.lineDash?(h.lineCap="butt",h.setLineDash([4*h.lineWidth,3*h.lineWidth])):"dash_dot"===this.lineDash?(h.lineCap="butt",h.setLineDash([4*
h.lineWidth,2*h.lineWidth,h.lineWidth,2*h.lineWidth])):h.setLineDash([])};a.Graphic.prototype.drawText=function(a,c,f,l,b,n,k,p,q,r,h){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=b.getColor(),a.strokeStyle=b.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:f,y:l},c.update(a,f,l,q,r,k,h,b.getColor());else for("simpleText"===c.type&&(c=c.toString(q,r).split("\\n")),g=this.evaluator,a.fillStyle=b.getColor(),a.font=n,a.textAlign=k,a.textBaseline=p,e=1.2*this.fontSize||0,b=0,n=c.length;b<n;b++)m=
c[b],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(m,f,l+e*b)),a.fillText(m,f,l+e*b)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.SimpleText=function(a,g){this.text=g=g.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";a="'";for(var e=0,f=0,d=-1,c,k;e<g.length;)c=g.charAt(e),k=g.charAt(e-1),"["===c&&"\\"===k?(this.textElements.push(g.substring(f,e-1)+"["),this.textElementsMacros.push("'"+g.substring(f,e-1)+"['"),f=e+1):"]"===c&&"\\"===k?(this.textElements.push(g.substring(f,
e-1)+"]"),this.textElementsMacros.push("'"+g.substring(f,e-1)+"]'"),f=e+1):"["===c&&-1===d?(this.textElements.push(g.substring(f,e)),this.textElementsMacros.push("'"+g.substring(f,e)+"'"),f=e,d++):"["===c?d++:"]"===c&&0===d?(this.textElements.push(this.evaluator.parser.parse(g.substring(f,e+1))),this.textElementsMacros.push("["+g.substring(f,e+1)+"]"),f=e+1,d--):("]"==g.charAt(e)&&(d=0>d?d:d-1),a+=g.charAt(e)),e++;this.textElements.push(g.substring(f,e));this.textElementsMacros.push("'"+g.substring(f,
e)+"'")};var g,k;a.SimpleText.prototype.toString=function(f,m){g="";for(var e=0,h=this.textElements.length;e<h;e++)"string"===typeof this.textElements[e]?g+=this.textElements[e]:(k=this.evaluator.eval(this.textElements[e])[0][0],""!==k&&("string"===typeof k?g+=k:Infinity==k?g+="Infinity":-Infinity==k?g+="-Infinity":isNaN(k)||"NaN"==k?g+="NaN":(k=parseFloat(k),k=m?k.toFixed(f):a.removeNeedlessDecimals(k.toFixed(f)),g+=k.toString().replace(".",this.parent.decimal_symbol))));return g};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w,x,B,D,H,G,I,E,A,F;a._debug_vez=0;a.Equation=function(b,c){this.width=b.evaluator.parser.parse("1");this.fillM=this.fillP="";a.Graphic.call(this,b,c);this.parseExpression();(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField();n=new a.R2;y=new a.R2;p=new a.R2;u=new a.R2;q=new a.R2;this.cInd=0};a.extend(a.Equation,a.Graphic);a.Equation.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],c=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||c.contains("x")?"identifier"!=c.type||"x"!=c.value||b.contains("x")||(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};a.Equation.prototype.update=function(){};a.Equation.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};a.Equation.prototype.drawFamilyAux=function(a,b,c){k=this.evaluator;this.getFamilyValues();tempParam=k.getVariable(this.family);if(0<=this.fSteps)for(var d=0,e=this.fSteps;d<=e;d++)k.setVariable(this.family,this.familyInf+
d*this.family_sep),this.update(),this.drawAux(a,b,c);k.setVariable(this.family,tempParam)};a.Equation.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};var J,K,L,z,N,C,O;a.Equation.prototype.drawAux=function(M,P,Q){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;k=this.evaluator;f=k.parser;m=this.space;e=k.eval(this.width);M.strokeStyle=this.color.getColor();M.lineWidth=e;h=f.getVariable("x");d=f.getVariable("y");c=m.w+24;v=m.h+24;l=c/9;3>l&&(l=3);b=v/7;3>
b&&(b=3);0==this.cInd?(g=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;n.set(0,0);y.set(0,0);p.set(0,0);C=.25;O=8;this.abs_coord||(C/=m.scale,O/=m.scale);M.beginPath();for(F=parseInt(b/2);F<v;F+=b)for(A=parseInt(l/2);A<c;A+=l){if(this.abs_coord){u.set(A,F);r=this.newt.findZero(u,C);if(null==r)continue;k.setVariable("x",r.x);k.setVariable("y",r.y);q.set(r.x,r.y)}else{u.set(m.getRelativeX(A),m.getRelativeY(F));r=this.newt.findZero(u,C);if(null==r)continue;k.setVariable("x",r.x);k.setVariable("y",r.y);
q.set(m.getAbsoluteX(r.x),m.getAbsoluteY(r.y))}w=q.ix();x=q.iy();if(-12<=w&&w<c+24&&-12<=x&&x<v+24){if(g[w+12+(x+12)*m.w]===this.cInd)continue;g[w+12+(x+12)*m.w]=this.cInd}a.rangeOK&&(M.moveTo(w,x),M.lineTo(w,x));n.x=r.x;n.y=r.y;y.x=r.x;y.y=r.y;B=this.newt.getUnitNormal();if(0!=B.x||0!=B.y)for(B.rotL90(),p.x=B.x,p.y=B.y,H=D=0,G=!1;2>H;)if(G&&(p.x=-B.x,p.y=-B.y,r.x=n.x,r.y=n.y,y.x=r.x,y.y=r.y,this.abs_coord?q.set(r.x,r.y):q.set(m.getAbsoluteX(r.x),m.getAbsoluteY(r.y)),w=q.ix(),x=q.iy(),G=!1,D=0),r.x+=
O*p.x,r.y+=O*p.y,r=this.newt.findZero(r,C),null!=r){k.setVariable("x",r.x);k.setVariable("y",r.y);p.x=r.x-y.x;p.y=r.y-y.y;p.normalize();if(0==p.x&&0==p.y)break;y.x=r.x;y.y=r.y;this.abs_coord?q.set(r.x,r.y):q.set(m.getAbsoluteX(r.x),m.getAbsoluteY(r.y));I=parseInt(q.ix());E=parseInt(q.iy());if(I!=w||E!=x)if(J=w,K=x,w=I,x=E,-12<=w&&w<c+24&&-12<=x&&x<v+24){D=0;L=g[w+12+(x+12)*m.w];g[w+12+(x+12)*m.w]=this.cInd;for(P=1;8>P;P++)z=J+Math.round((w-J)*P/8),N=K+Math.round((x-K)*P/8),0<=z&&z<c&&0<=N&&N<v&&(g[z+
12+(N+12)*m.w]=this.cInd);a.rangeOK&&(M.moveTo(J,K),M.lineTo(w,x));if(L===this.cInd)break}else G=!0,H++;else 4<++D&&(G=!0,H++)}}M.stroke()}};a.Equation.prototype.X=function(a,b,c){c||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};a.Equation.prototype.Y=function(a,b,c){c||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};a.Equation.prototype.XX=function(a,b,c){return Math.round(this.X(a,
b,c))};a.Equation.prototype.YY=function(a,b,c){return Math.round(this.Y(a,b,c))};a.Equation.prototype.extrapolate=function(b,c,d,e,l,n){for(var f=this.evaluator.getVariable(c),g=n/2,k=0,p,q,r,h,m,v;1E-15<Math.abs(g);){p=this.evaluator.getVariable(c);q=this.evaluator.getVariable(c)+g;this.evaluator.setVariable(c,q);r=!0;try{h=l,l=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(d,l),0<this.evaluator.eval(b)?(m=new a.R2(Math.min(h,l),Math.max(h,l)),v=0,v=0<n?this.Singularity(Math.abs(g),
c,e,p,h,q,l,m):this.Singularity(Math.abs(g),c,e,q,l,p,h,m),0<v&&(r=!1)):r=!1}catch(X){r=!1}r?k+=g:this.evaluator.setVariable(c,p);g/=2}this.evaluator.setVariable(c,f);return new a.R2(k/Math.abs(n),l)};a.Equation.prototype.extrapolateOnSingularity=function(b,c,d,e,l,n){e=this.evaluator.getVariable(c);for(var f=n/2,g=0,k=l,p;1E-15<Math.abs(f);){this.evaluator.setVariable(c,this.evaluator.getVariable(c)+f);p=!0;if(0<this.evaluator.eval(b))try{k=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(d,
k),0>=this.evaluator.eval(b)&&(p=!1)}catch(V){p=!1}else p=!1;p?g+=f:this.evaluator.setVariable(c,this.evaluator.getVariable(c)-f);f/=2}if(0==g)for(f=n/2,g=n,k=l;1E-15<Math.abs(f);){this.evaluator.setVariable(c,this.evaluator.getVariable(c)-f);p=!0;if(0<this.evaluator.eval(b))try{k=this.evaluator.eval(this.funExpr)}catch(V){p=!1}else p=!1;p?g+=-f:this.evaluator.setVariable(c,this.evaluator.getVariable(c)+f);f/=2}this.evaluator.setVariable(c,e);return new a.R2(g/Math.abs(n),k)};a.Equation.prototype.Singularity=
function(a,b,c,d,e,l,n,f){if(isNaN(n)||isNaN(e)||isNaN(f.y)||isNaN(f.x)||d>=l)return 2;var g=this.evaluator.getVariable(b),k=0;try{if(1E-15>Math.abs(l-d)||1E-12>Math.abs(l-d)&&Math.abs(n-e)>Math.abs(a))return this.evaluator.setVariable(b,g),1;var p=(d+l)/2;this.evaluator.setVariable(b,p);var q=NaN;try{q=this.evaluator.eval(this.funExpr)}catch(W){return 2}if(isNaN(q))return 5;if(Math.abs(n-e)>a){this.evaluator.setVariable(b,d-1E-12);var r=this.evaluator.eval(this.funExpr);r=(e-r)/1E-12;this.evaluator.setVariable(b,
l+1E-12);var h=(this.evaluator.eval(this.funExpr)-n)/1E-12;if((10>Math.abs(h)||10>Math.abs(r))&&(0<=h&&0<=r||0>=h&&0>=r)&&4*Math.abs(h)<Math.abs((n-e)/(l-d)))return this.evaluator.setVariable(b,g),2}if(isNaN(f.x)||isNaN(f.y)||isNaN(q))return 2;if(!(f.x<=q&&q<=f.y)){this.evaluator.setVariable(b,p);f.x=Math.min(e,q);f.y=Math.max(e,q);var m=this.Singularity(a/2,b,c,d,e,p,q,f);this.evaluator.setVariable(b,l);f.x=Math.min(n,q);f.y=Math.max(n,q);var v=this.Singularity(a/2,b,c,p,q,l,n,f);k=Math.max(m,v)}}catch(W){k=
1}this.evaluator.setVariable(b,g);return k};a.Equation.prototype.drawAuxFun=function(b,c,e){h=this.evaluator.parser.getVariable("x");d=this.evaluator.parser.getVariable("y");a.rangeOK=1;c="x";var l="y";this.of_y&&(c="y",l="x");var n=this.drawif,f=this.evaluator.eval(this.width),g=!1,k=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),p=this.of_y?k.ix():k.iy(),q=0,r=0,m=0,v=0,u=1/this.space.scale;k=u*(this.of_y?-this.space.h+k.y:-k.x);var B=0;this.abs_coord&&(k=0,u=1);for(var y,x,
w,G,D,A,I,M,z,H=this.of_y?this.space.h+2:this.space.w+2;m<=H;){y=!0;x=0;this.evaluator.setVariable(c,k);try{w=this.evaluator.eval(this.funExpr),isNaN(w)||(this.evaluator.setVariable(l,w),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(g?(G=Math.min(B,w),D=Math.max(B,w),A=new a.R2(G,D),x=this.Singularity(u,c,0,k-u,B,k,w,A),0===x?(B<=w?(B=A.x,w=A.y):(w=A.x,B=A.y),I=parseInt(this.of_y?this.XX(f,B,this.abs_coord):this.YY(f,B,this.abs_coord)),q=this.abs_coord?Math.round(w):parseInt(this.of_y?this.XX(f,
w,this.abs_coord):this.YY(f,w,this.abs_coord)),this.fillM&&q>p&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+1,this.space.h-m+.5),b.lineTo(q,this.space.h-m+.5)):(b.moveTo(m+.5,p+1),b.lineTo(m+.5,q)),b.stroke()),this.fillP&&q<p&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(p-1,this.space.h-m+.5),b.lineTo(q,this.space.h-m+.5)):(b.moveTo(m+.5,p-1),b.lineTo(m+.5,q)),b.stroke()),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),
this.of_y?(b.moveTo(I+.5,this.space.h-v),b.lineTo(q+.5,this.space.h-m)):(b.moveTo(v+.5,I),b.lineTo(m+.5,q)),b.stroke()):1===x?(this.evaluator.setVariable(c,k-u),M=this.extrapolate(n,c,l,0,B,u),q=this.of_y?this.XX(f,M.y,this.abs_coord):this.YY(f,M.y,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(r+.5,this.space.h-v),b.lineTo(q+.5,this.space.h-v+Math.round(M.x))):(b.moveTo(v+.5,r),b.lineTo(v+Math.round(M.x)+.5,q)),this.evaluator.setVariable(c,k),z=this.extrapolate(n,
c,l,0,w,-u),r=this.of_y?this.XX(f,z.y,this.abs_coord):this.YY(f,z.y,this.abs_coord),q=this.of_y?this.XX(f,w,this.abs_coord):this.YY(f,w,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(r+.5,this.space.h-m),b.lineTo(q+.5,this.space.h-m)):(b.moveTo(m+.5,r),b.lineTo(m+.5,q)),b.stroke()):2===x&&(q=this.of_y?this.XX(f,w,this.abs_coord):this.YY(f,w,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(r+.5,this.space.h-m),b.lineTo(q+
.5,this.space.h-m)):(b.moveTo(m+.5,r),b.lineTo(m+.5,q)),b.stroke())):(z=this.extrapolateOnSingularity(n,c,l,0,w,-u),r=this.of_y?this.XX(f,z.y,this.abs_coord):this.YY(f,z.y,this.abs_coord),q=this.of_y?this.XX(f,w,this.abs_coord):this.YY(f,w,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(r,this.space.h-(m+Math.round(z.x))+.5),b.lineTo(q,this.space.h-m+.5)):(b.moveTo(m+Math.round(z.x),r),b.lineTo(m,q)),b.stroke()),B=w):y=!1)}catch(Y){y=!1}g&&!y&&(this.evaluator.setVariable(c,
k-u),this.evaluator.setVariable(l,B),M=this.extrapolate(n,c,l,0,B,u),q=parseInt(this.of_y?this.XX(f,M.y,this.abs_coord):this.YY(f,M.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(r,this.space.h-(v+Math.round(M.x))+.5),b.lineTo(q,this.space.h-(v+Math.round(M.x))+.5)):(b.moveTo(v+Math.round(M.x)+.5,r),b.lineTo(v+Math.round(M.x)+.5,q)),b.stroke()),this.evaluator.setVariable(c,k));g=y;k+=u;r=q;v=m++}this.evaluator.parser.setVariable("x",
h);this.evaluator.parser.setVariable("y",d)};a.Equation.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parseExpression(),b.parent.update())};this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k,f,m,e,h,d,c,v,l,b,n;a.Curve=function(b,c){this.parameter="t";this.parameter_interval=b.evaluator.parser.parse("[0,1]");this.parameter_steps=b.evaluator.parser.parse("8");this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,c);(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField()};a.extend(a.Curve,a.Graphic);a.Curve.prototype.update=function(){k=this.evaluator;f=
k.eval(this.parameter_interval);this.paraInf=f[0][0];this.paraSup=f[0][1];this.pSteps=k.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};a.Curve.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Curve.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Curve.prototype.drawAux=function(f,p,q){k=this.evaluator;m=this.space;e=g(k.eval(this.width));f.lineWidth=0<e?e:1E-6;f.lineCap="round";
f.lineJoin="round";f.strokeStyle=q.getColor();h=k.getVariable(this.parameter);f.beginPath();k.setVariable(this.parameter,this.paraInf);d=k.eval(this.expresion);this.exprX=g(this.abs_coord?d[0][0]:m.getAbsoluteX(d[0][0]));this.exprY=g(this.abs_coord?d[0][1]:m.getAbsoluteY(d[0][1]));this.rotateExp&&(c=a.degToRad(k.eval(this.rotateExp)),v=Math.cos(c),l=Math.sin(c),b=this.exprX*v-this.exprY*l,n=this.exprX*l+this.exprY*v,this.exprX=b,this.exprY=n);f.moveTo(this.exprX+.5,this.exprY+.5);for(q=1;q<=this.pSteps;q++)k.setVariable(this.parameter,
this.paraInf+q*this.paraSep),d=k.eval(this.expresion),this.exprX=this.abs_coord?g(d[0][0]):g(m.getAbsoluteX(d[0][0])),this.exprY=this.abs_coord?g(d[0][1]):g(m.getAbsoluteY(d[0][1])),this.rotateExp&&(b=this.exprX*v-this.exprY*l,n=this.exprX*l+this.exprY*v,this.exprX=b,this.exprY=n),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&f.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(f.fillStyle=p.getColor(),f.fill("evenodd"));this.dashStyle();f.stroke();
f.setLineDash([]);k.setVariable(this.parameter,h)};a.Curve.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;a.oncontextmenu=function(a){return!1};a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,k=Math.round,f,m,e,h,d,c,v,l,b,n,y,p,q,r;a.Sequence=function(b,c){this.size=b.evaluator.parser.parse("2");this.range=b.evaluator.parser.parse("[1, 100]");a.Graphic.call(this,b,c);(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField()};a.extend(a.Sequence,a.Graphic);a.Sequence.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&
(h=a.degToRad(f.eval(this.rotateExp)),d=Math.cos(h),c=Math.sin(h),v=this.exprX*d-this.exprY*c,l=this.exprX*c+this.exprY*d,this.exprX=v,this.exprY=l);y=f.eval(this.range);this.rangeInf=y[0][0];this.rangeMax=y[0][1]};a.Sequence.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Sequence.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Sequence.prototype.drawAux=function(a,c){f=this.evaluator;m=this.space;q=p=Math.ceil(f.eval(this.size)-
.4);a.fillStyle=c.getColor();a.beginPath();this.rangeInf>this.rangeMax&&(r=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=r);c=f.getVariable("n");for(var d=this.rangeInf,l=this.rangeMax;d<=l;d++)f.setVariable("n",d),e=f.eval(this.expresion),this.exprX=e[0][0],this.exprY=e[0][1],b=k(this.abs_coord?this.exprX:m.getAbsoluteX(this.exprX)),n=k(this.abs_coord?this.exprY:m.getAbsoluteY(this.exprY)),a.beginPath(),a.arc(b,n,p,0,g,!0),a.fill();a.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),
this.font=this.font_style+" "+this.fontSize+"px "+this.font_family,this.uber.drawText.call(this,a,this.text,b+q,n-q,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",c)};a.Sequence.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};
this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,k=Math.round,f,m,e,h,d,c,v,l,b,n,y;a.Point=function(b,c){this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,c);this.text=new a.TextObject(this,this.text)};a.extend(a.Point,a.Graphic);a.Point.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(h=a.degToRad(f.eval(this.rotateExp)),d=Math.cos(h),c=Math.sin(h),v=this.exprX*d-this.exprY*c,l=this.exprX*c+this.exprY*
d,this.exprX=v,this.exprY=l)};a.Point.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Point.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Point.prototype.drawAux=function(a,c){f=this.evaluator;m=this.space;y=k(f.eval(this.size));a.fillStyle=c.getColor();b=k(this.abs_coord?this.exprX:m.getAbsoluteX(this.exprX));n=k(this.abs_coord?this.exprY:m.getAbsoluteY(this.exprY));a.beginPath();a.arc(b,n,y,0,g,!0);a.fill();this.text.hasContent&&
this.text.draw(a,c,b,n)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k=2*Math.PI,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w,x;a.Segment=function(b,c){this.width=b.evaluator.parser.parse("1");this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,c);this.text=new a.TextObject(this,this.text)};a.extend(a.Segment,a.Graphic);a.Segment.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.endPoints=[];for(var b=0,n=e.length;b<n;b++)this.endPoints[b]={x:e[b][0],y:e[b][1]};if(this.rotateExp)for(h=
a.degToRad(f.eval(this.rotateExp)),d=Math.cos(h),c=Math.sin(h),b=0,n=this.endPoints.length;b<n;b++)v=this.endPoints[b].x*d-this.endPoints[b].y*c,l=this.endPoints[b].x*c+this.endPoints[b].y*d,this.endPoints[b].x=v,this.endPoints[b].y=l};a.Segment.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Segment.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Segment.prototype.drawAux=function(a,c,d){f=this.evaluator;m=this.space;b=g(f.eval(this.width));
a.lineWidth=0<b?b:1E-6;p=f.eval(this.size);0>p&&(p=0);a.fillStyle=c.getColor();a.strokeStyle=d.getColor();a.lineCap="round";q=0==a.lineWidth%2?0:.5;this.abs_coord?(r=g(this.endPoints[0].x),u=g(this.endPoints[0].y),w=g(this.endPoints[1].x),x=g(this.endPoints[1].y)):(r=g(m.getAbsoluteX(this.endPoints[0].x)),u=g(m.getAbsoluteY(this.endPoints[0].y)),w=g(m.getAbsoluteX(this.endPoints[1].x)),x=g(m.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(r+q,u+q);a.lineTo(w+q,x+q);this.dashStyle();a.stroke();
0<p&&(a.beginPath(),a.arc(r,u,p,0,k,!0),a.arc(w,x,p,0,k,!0),a.fill());a.setLineDash([]);this.text.hasContent&&(n=parseInt((r+w)/2)-3,y=parseInt((u+x)/2)+3,this.text.draw(a,d,n,y))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.round,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w,x,B;a.Arrow=function(b,c){this.width=b.evaluator.parser.parse("5");this.size=b.evaluator.parser.parse("2");this.spear=b.evaluator.parser.parse("8");this.arrow=new a.Color("ee0022");a.Graphic.call(this,b,c);this.text=new a.TextObject(this,this.text)};a.extend(a.Arrow,a.Graphic);a.Arrow.prototype.update=function(){f=this.evaluator;m=f.eval(this.expresion);this.endPoints=[];for(var b=0,l=m.length;b<
l;b++)this.endPoints[b]={x:m[b][0],y:m[b][1]};if(this.rotateExp)for(e=a.degToRad(f.eval(this.rotateExp)),h=Math.cos(e),d=Math.sin(e),b=0,l=this.endPoints.length;b<l;b++)c=this.endPoints[b].x*h-this.endPoints[b].y*d,v=this.endPoints[b].x*d+this.endPoints[b].y*h,this.endPoints[b].x=c,this.endPoints[b].y=v};a.Arrow.prototype.draw=function(){this.uber.draw.call(this,this.arrow,this.color)};a.Arrow.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.arrow,this.trace)};a.Arrow.prototype.drawAux=
function(c,d,e){f=this.evaluator;l=this.space;f.eval(this.size);y=f.eval(this.width);0>y&&(y=0);p=Math.ceil(y/2);q=l.scale;this.vect=new a.Vector2D(this.endPoints[1].x-this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);r=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);c.fillStyle=d.getColor();c.strokeStyle=e.getColor();c.lineWidth=2;this.abs_coord?(u=k(this.endPoints[0].x),w=k(this.endPoints[0].y),x=k(this.endPoints[1].x),B=k(this.endPoints[1].y)):(u=
k(l.getAbsoluteX(this.endPoints[0].x)),w=k(l.getAbsoluteY(this.endPoints[0].y)),x=k(l.getAbsoluteX(this.endPoints[1].x)),B=k(l.getAbsoluteY(this.endPoints[1].y)));d=f.eval(this.spear);0>d&&(d=0);c.save();c.translate(u,w,r);this.abs_coord?0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?c.rotate(this.angle):c.rotate(-this.angle):(r*=q,0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?c.rotate(-this.angle):c.rotate(this.angle));c.beginPath();c.moveTo(-p,g(-p));c.lineTo(g(r-
d-y),g(-p));c.lineTo(g(r-2*d),g(-d-p));c.lineTo(g(r),0);c.lineTo(g(r-2*d),g(d+p));c.lineTo(g(r-d-y),g(p));c.lineTo(-p,g(p));c.closePath();c.stroke();c.fill();c.restore();this.text.hasContent&&(b=parseInt((u+x)/2)-3,n=parseInt((w+B)/2)+3,this.text.draw(c,e,b,n))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k,f,m,e,h,d,c,v,l,b,n,y;a.Polygon=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,c);this.endPoints=[]};a.extend(a.Polygon,a.Graphic);a.Polygon.prototype.update=function(){k=this.evaluator;m=k.eval(this.expresion);for(var b=0,f=m.length;b<f;b++)this.endPoints[b]={x:m[b][0],y:m[b][1]};if(this.rotateExp)for(e=a.degToRad(k.eval(this.rotateExp)),h=Math.cos(e),d=Math.sin(e),b=0,f=this.endPoints.length;b<
f;b++)c=this.endPoints[b].x*h-this.endPoints[b].y*d,v=this.endPoints[b].x*d+this.endPoints[b].y*h,this.endPoints[b].x=c,this.endPoints[b].y=v};a.Polygon.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Polygon.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Polygon.prototype.drawAux=function(a,c,d){k=this.evaluator;f=this.space;l=g(k.eval(this.width));a.lineWidth=0<l?l:1E-6;a.strokeStyle=d.getColor();a.lineCap="round";a.lineJoin="round";
b=0<l?.5:0;n=g(this.abs_coord?this.endPoints[0].x:f.getAbsoluteX(this.endPoints[0].x));y=g(this.abs_coord?this.endPoints[0].y:f.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(n+b,y+b);d=1;for(var e=this.endPoints.length;d<e;d++)n=g(this.abs_coord?this.endPoints[d].x:f.getAbsoluteX(this.endPoints[d].x)),y=g(this.abs_coord?this.endPoints[d].y:f.getAbsoluteY(this.endPoints[d].y)),a.lineTo(n+b,y+b);this.fill&&(a.fillStyle=c.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k=Math.min,f=Math.max,m=Math.abs,e,h,d,c,v,l,b,n,y,p,q,r,u,w,x;a.Rectangle=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";this.border_radius=b.evaluator.parser.parse("0");a.Graphic.call(this,b,c);this.endPoints=[]};a.extend(a.Rectangle,a.Graphic);a.Rectangle.prototype.update=function(){e=this.evaluator;expr=e.eval(this.expresion);this.exprX=expr[0][0];this.exprY=expr[0][1];this.w=150;this.h=100;this.rotateExp&&(d=
a.degToRad(e.eval(this.rotateExp)),c=Math.cos(d),v=Math.sin(d),l=this.exprX*c-this.exprY*v,b=this.exprX*v+this.exprY*c,this.exprX=l,this.exprY=b);4<=expr[0].length&&(this.w=expr[0][2],this.h=expr[0][3]);expr[1]&&2==expr[1].length&&(this.w=expr[1][0],this.h=expr[1][1]);this.w=f(0,this.w);this.h=f(0,this.h)};a.Rectangle.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Rectangle.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace,"trace")};a.Rectangle.prototype.drawAux=
function(a,b,c,d){e=this.evaluator;h=this.space;n=g(e.eval(this.width));a.lineWidth=0<n?n:1E-6;a.strokeStyle=c.getColor();a.lineCap="round";a.lineJoin="miter";y=0<n?.5:0;p=g(this.abs_coord?this.exprX:h.getAbsoluteX(this.exprX))+y;q=g(this.abs_coord?this.exprY:h.getAbsoluteY(this.exprY))+y;r=this.abs_coord?this.w:this.w*h.scale;u=this.abs_coord?this.h:-this.h*h.scale;w=k(f(0,e.eval(this.border_radius)),.5*m(r),.5*m(u));x=this.abs_coord?1:-1;a.beginPath();0!==w?(a.moveTo(p+w,q),a.lineTo(p+r-w,q),a.quadraticCurveTo(p+
r,q,p+r,q+x*w),a.lineTo(p+r,q+u-x*w),a.quadraticCurveTo(p+r,q+u,p+r-w,q+u),a.lineTo(p+w,q+u),a.quadraticCurveTo(p,q+u,p,q+u-x*w),a.lineTo(p,q+x*w),a.quadraticCurveTo(p,q,p+w,q),a.closePath()):(a.moveTo(p,q),a.lineTo(p+r,q),a.lineTo(p+r,q+u),a.lineTo(p,q+u));a.closePath();this.fill&&(a.fillStyle=b.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k=Math.min,f=Math.max,m=Math.acos,e=Math.sqrt,h=Math.PI,d=h/2,c=2*h,v,l,b,n,y,p,q,r,u,w,x,B,D,H,G,I,E,A,F,J,K;a.Arc=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";this.center=b.evaluator.parser.parse("(0,0)");this.radius=b.evaluator.parser.parse("1");this.init="0";this.end="90";a.Graphic.call(this,b,c);this.init.match(/^_\(/)&&(this.initFlag=!0,this.init=this.init.substring(1));this.end.match(/^_\(/)&&(this.endFlag=
!0,this.end=this.end.substring(1));this.initExpr=b.evaluator.parser.parse(this.init);this.endExpr=b.evaluator.parser.parse(this.end);this.text=new a.TextObject(this,this.text)};a.extend(a.Arc,a.Graphic);a.Arc.prototype.update=function(){v=this.evaluator;l=v.eval(this.center);this.exprX=l[0][0];this.exprY=l[0][1];b=0;this.rotateExp&&(b=a.degToRad(v.eval(this.rotateExp)),n=Math.cos(b),y=Math.sin(b),p=this.exprX*n-this.exprY*y,q=this.exprX*y+this.exprY*n,this.exprX=p,this.exprY=q);var g=v.eval(this.initExpr),
A=v.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(r=g[0][0],u=g[0][1],w=A[0][0],x=A[0][1],this.vectors?this.abs_coord&&(u=-u,x=-x):this.abs_coord?(r-=this.exprX,u=-u+this.exprY,w-=this.exprX,x=-x+this.exprY):(r-=this.exprX,u-=this.exprY,w-=this.exprX,x-=this.exprY),B=0==r?0>u?3*d:d:m(1*r/e(r*r+u*u)),D=0==w?0>x?3*d:d:m(1*w/e(w*w+x*x)),B+=b,D+=b,0<r&&0<u&&this.abs_coord&&(B=c-B),0<r&&0>u&&!this.abs_coord&&(B=c-B),0>r&&0>u&&!this.abs_coord&&
(B=c-B),0>r&&0<u&&this.abs_coord&&(B=c-B),0<w&&0<x&&this.abs_coord&&(D=c-D),0<w&&0>x&&!this.abs_coord&&(D=c-D),0>w&&0>x&&!this.abs_coord&&(D=c-D),0>w&&0<x&&this.abs_coord&&(D=c-D),this.initFlag?(H=B,B=D,D=H):(H=k(B,D),G=f(B,D),B=H,D=G,D-B>h&&this.abs_coord&&(B=G,D=H),D-B<=h&&!this.abs_coord&&(B=G,D=H)),this.iniAng=B,this.endAng=D,this.drawPoints=!0):(this.iniAng=a.degToRad(g)+b,this.endAng=a.degToRad(A)+b,this.drawAngle=!0)};a.Arc.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};
a.Arc.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Arc.prototype.drawAux=function(a,b,c){v=this.evaluator;I=this.space;F=v.eval(this.radius);0>F&&(F=0);K=g(v.eval(this.width));a.lineWidth=0<K?K:1E-6;a.lineCap="round";a.strokeStyle=c.getColor();this.drawAngle?(this.abs_coord?(E=g(this.exprX),A=g(this.exprY)):(E=g(I.getAbsoluteX(this.exprX)),A=g(I.getAbsoluteY(this.exprY)),F*=I.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>this.endAng&&
(J=this.iniAng,this.iniAng=this.endAng,this.endAng=J)):this.drawPoints&&(this.abs_coord?(E=g(this.exprX),A=g(this.exprY)):(E=g(I.getAbsoluteX(this.exprX)),A=g(I.getAbsoluteY(this.exprY)),F*=I.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(E,A),a.arc(E,A,F,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(E,A,F,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,
E,A)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v;a.Text=function(c,b){this.width=c.evaluator.parser.parse("0");a.Graphic.call(this,c,b);this.align||(this.align="left");this.anchor||(this.anchor="top_left");this.text=new a.TextObject(this,this.text)};a.extend(a.Text,a.Graphic);a.Text.prototype.update=function(){g=this.evaluator;k=g.eval(this.expresion);this.exprX=k[0][0];this.exprY=k[0][1];this.rotateExp&&(f=a.degToRad(g.eval(this.rotateExp)),m=Math.cos(f),e=Math.sin(f),h=this.exprX*
m-this.exprY*e,d=this.exprX*e+this.exprY*m,this.exprX=h,this.exprY=d)};a.Text.prototype.draw=function(){this.uber.draw.call(this,this.color)};a.Text.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace)};a.Text.prototype.drawAux=function(a,b){this.abs_coord?(c=parseInt(this.exprX),v=parseInt(this.exprY)):(c=parseInt(this.space.getAbsoluteX(this.exprX)),v=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,c,v)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u;a.Image=function(b,c){this.file="";this.inirot=b.evaluator.parser.parse("0");a.Graphic.call(this,b,c);this.img=new Image;this.scaleY=this.scaleX=1;this.ratio=b.ratio;this.update()};a.extend(a.Image,a.Graphic);a.Image.prototype.update=function(){k=this.evaluator;f=k.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1];this.rotateExp&&(m=a.degToRad(k.eval(this.rotateExp)),e=Math.cos(m),h=Math.sin(m),
d=this.exprX*e-this.exprY*h,c=this.exprX*h+this.exprY*e,this.exprX=d,this.exprY=c);4<=f[0].length&&(this.centered=!0,this.scaleX=f[0][2],this.scaleY=f[0][3]);f[1]&&2==f[1].length&&(this.centered=!0,this.scaleX=f[1][0],this.scaleY=f[1][1]);0==this.scaleX&&(this.scaleX=1E-5);0==this.scaleY&&(this.scaleY=1E-5);var b=this;if((v=k.eval(this.file))||""==v)this.img=this.parent.getImage(v),this.img.addEventListener("load",function(a){b.space.update(!0)})};a.Image.prototype.draw=function(){this.uber.draw.call(this)};
a.Image.prototype.drawTrace=function(){this.uber.drawTrace.call(this)};a.Image.prototype.drawAux=function(c){k=this.evaluator;l=this.space;this.img&&this.img.ready&&this.img.complete&&(r=this.img.width,u=this.img.height,this.img.canvas&&(r=g(r/this.ratio),u=g(u/this.ratio)),b=this.centered?0:g(r/2),n=this.centered?0:g(u/2),y=g(this.abs_coord?this.exprX:l.getAbsoluteX(this.exprX)),p=g(this.abs_coord?this.exprY:l.getAbsoluteY(this.exprY)),q=a.degToRad(-k.eval(this.inirot)),c.save(),c.translate(y+b,
p+n),c.rotate(q),this.opacity&&(c.globalAlpha=k.eval(this.opacity)),c.scale(this.scaleX,this.scaleY),c.drawImage(this.img,-r/2,-u/2,r,u),c.restore())};return a}(descartesJS||{});
descartesJS=function(a){function g(a,b,d){c=4*(b+d*a.width);return{r:a.data[c],g:a.data[c+1],b:a.data[c+2],a:a.data[c+3]}}if(a.loadLib)return a;var k,f,m,e,h,d,c,v;a.Fill=function(c,b){a.Graphic.call(this,c,b)};a.extend(a.Fill,a.Graphic);a.Fill.prototype.update=function(){k=this.evaluator.eval(this.expresion);this.exprX=k[0][0];this.exprY=k[0][1]};a.Fill.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Fill.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,
this.trace)};a.Fill.prototype.drawAux=function(a,b){b.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(f=parseInt(this.exprX),m=parseInt(this.exprY)):(f=parseInt(this.space.getAbsoluteX(this.exprX)),m=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>f||0>m||f>=this.space.w||m>=this.space.h)){e=[[f,m]];d=g(imageData,f,m);for(v=0;0<e.length;){v++;h=e.pop();f=h[0];m=h[1];var l=g(imageData,f,m);if(d.r===l.r&&d.g===l.g&&d.b===l.b&&d.a===l.a){l=imageData;var k=b;c=
4*(f+m*l.width);l.data[c+0]=k.r;l.data[c+1]=k.g;l.data[c+2]=k.b;l.data[c+3]=255*k.a;0<f&&e.push([f-1,m]);f<imageData.width-1&&e.push([f+1,m]);e.push([f,m-1]);e.push([f,m+1])}if(v>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var k=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,m;a.Macro=function(e,h){this.hasExpresion=!1;this.inirot=e.evaluator.parser.parse("0");this.inipos=e.evaluator.parser.parse("(0,0)");a.Graphic.call(this,e,h);for(var d in h)"expresion"==d&&(this.hasExpresion=!0),h.hasOwnProperty(d)&&(this[d]=h[d]);this.graphics=[];e=e.lessonParser;var c=new a.Tokenizer;
if(this.hasExpresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);h=this.evaluator.eval(this.expresion);if(h)var m=(m=document.getElementById(h))&&"descartes/macro"==m.type?m.text:a.openExternalFile(h);if(m){var l=m.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,
"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&").replace(/\r/g,"").split("\n");m=[];h=0;for(d=l.length;h<d;h++)if(l[h].trim()){var b=l[h].indexOf("=");if(-1!==b){b=e.split(l[h]);for(var n=0,y=b.length;n<y;n++)if(b[n]&&1<b.length&&("id"===g[b[n][0]]||"type"===g[b[n][0]])){m.push(b);break}}}h=0;for(d=m.length;h<d;h++)for(y=(n=
m[h]||[],n[0])&&"id"===n[0][0],l=0,b=n.length;l<b;l++){var p=n[l][0].indexOf(".");-1===p||y?p=g[n[l][0]]:(p=g[n[l][0].substring(p+1)],n[l][0]=this.name+"."+n[l][0]);if(!("font"===p||"font_family"===p||("fill"===p||"color"===p||"border"===p||"arrow"===p)&&"("!==n[l][1].charAt(0)||"file"===p&&n[l][1].match(f)||"id"!==p&&void 0!==g[n[l][1]]))if("text"==p)if(n[l][1].match(/\{\\rtf1/)){p=n[l][1];var q=this;var r=function(b,d){d=c.tokenize(d.replace(/&squot;/g,"'"));for(var e=0,f=d.length;e<f;e++)"identifier"!=
d[e].type||a.reservedIds.match("-"+d[e].value+"-")||(d[e].value=q.name+"."+d[e].value);return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+c.flatTokens(d)};p=p.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,r);p=p.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,r);n[l][1]=p}else{r=e.parseText(n[l][1]).textElementsMacros;for(var u=0,w=r.length;u<w;u++){p=c.tokenize(r[u].replace(/&squot;/g,"'"));for(var x=0,B=p.length;x<B;x++)"identifier"!==p[x].type||a.reservedIds.match("-"+
p[x].value+"-")||(p[x].value=this.name+"."+p[x].value);p=c.flatTokens(p).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");r[u]=p.substring(1,p.length-1)}n[l][1]=r.join("")}else{r=n[l][1].replace(/&squot;/g,"'").split(";");u=0;for(w=r.length;u<w;u++){p=c.tokenize(r[u].replace(/\\n/g,";"));x=0;for(B=p.length;x<B;x++)"identifier"!==p[x].type||a.reservedIds.match("-"+p[x].value+"-")||(p[x].value=this.name+"."+p[x].value);r[u]=c.flatTokens(p)}n[l][1]=r.join(";")}}h=0;for(d=m.length;h<
d;h++)if(m[h][0]){n="";y=!1;l=0;for(b=m[h].length;l<b;l++)"type"===g[m[h][l][0]]&&k.match("-"+g[m[h][l][1]]+"-")&&(y=!0),n=n+m[h][l][0]+"='"+m[h][l][1]+"' ";m[h]=n+(y?" space='"+this.spaceID+"'":"");y?this.graphics.push(e.parseGraphic(m[h],this.abs_coord,this.background,this.inirot)):e.parseAuxiliar(m[h])}}}};a.extend(a.Macro,a.Graphic);a.Macro.prototype.update=function(){m=this.evaluator.eval(this.inipos);this.iniPosX=m[0][0];this.iniPosY=m[0][1]};a.Macro.prototype.drawAux=function(a){for(var e=
0,d=this.graphics.length;e<d;e++)this.graphics[e]&&(a.save(),this.graphics[e].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[e].draw(),a.restore())};return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sqrt,k=Math.sin,f=Math.cos,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w;a.norm3D=function(a){return g(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){m=a.norm3D(b);if(0===m)return{x:0,y:0,z:0};if(1===m)return{x:b.x,y:b.y,z:b.z};m=1/m;return{x:b.x*m,y:b.y*m,z:b.z*m}};a.dotProduct3D=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*
b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};a.add3D=function(a,b){return{x:a.x+b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,c){return Math.abs(a.x-b.x)<=c&&Math.abs(a.y-b.y)<=c&&Math.abs(a.z-b.z)<=c};a.Vector4D=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||0;this.adjustDec()};a.Vector4D.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};a.Matrix4x4=function(a,
b,c,d,e,f,l,n,g,k,p,q,r,m,h,v){this.a00=a||0;this.a01=b||0;this.a02=c||0;this.a03=d||0;this.a10=e||0;this.a11=f||0;this.a12=l||0;this.a13=n||0;this.a20=g||0;this.a21=k||0;this.a22=p||0;this.a23=q||0;this.a30=r||0;this.a31=m||0;this.a32=h||0;this.a33=v||0};a.Matrix4x4.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};a.Matrix4x4.prototype.multiplyVector4=
function(b){return new a.Vector4D(b.x*this.a00+b.y*this.a10+b.z*this.a20+b.w*this.a30,b.x*this.a01+b.y*this.a11+b.z*this.a21+b.w*this.a31,b.x*this.a02+b.y*this.a12+b.z*this.a22+b.w*this.a32,b.x*this.a03+b.y*this.a13+b.z*this.a23+b.w*this.a33)};a.Matrix4x4.prototype.translate=function(b){return new a.Matrix4x4(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*b.x+this.a10*b.y+this.a20*b.z+this.a30,this.a01*b.x+this.a11*b.y+this.a21*
b.z+this.a31,this.a02*b.x+this.a12*b.y+this.a22*b.z+this.a32,this.a03*b.x+this.a13*b.y+this.a23*b.z+this.a33)};a.Matrix4x4.prototype.rotateX=function(c){e=k(c);h=f(c);b=this.a10;n=this.a11;y=this.a12;p=this.a13;q=this.a20;r=this.a21;u=this.a22;w=this.a23;return new a.Matrix4x4(this.a00,this.a01,this.a02,this.a03,b*h+q*e,n*h+r*e,y*h+u*e,p*h+w*e,b*-e+q*h,n*-e+r*h,y*-e+u*h,p*-e+w*h,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateY=function(b){e=k(b);h=f(b);d=this.a00;c=this.a01;v=this.a02;
l=this.a03;q=this.a20;r=this.a21;u=this.a22;w=this.a23;return new a.Matrix4x4(d*h+q*-e,c*h+r*-e,v*h+u*-e,l*h+w*-e,this.a10,this.a11,this.a12,this.a13,d*e+q*h,c*e+r*h,v*e+u*h,l*e+w*h,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateZ=function(g){e=k(g);h=f(g);d=this.a00;c=this.a01;v=this.a02;l=this.a03;b=this.a10;n=this.a11;y=this.a12;p=this.a13;return new a.Matrix4x4(d*h+b*e,c*h+n*e,v*h+y*e,l*h+p*e,d*-e+b*h,c*-e+n*h,v*-e+y*h,l*-e+p*h,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,
this.a32,this.a33)};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,h),a.fill(),a.stroke())}function k(a,c){a.textNode=null;a.lineCap="round";a.lineJoin="round";a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);b=1;for(n=this.projVert.length;b<n;b++)a.lineTo(this.projVert[b].x,this.projVert[b].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=c.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 f(a){a.textNode=
null;a.oldTextNode="_a1b2c3_";l=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,l)}function m(a){a.textNode=null;a.lineCap="round";a.lineJoin="round";
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 e(b,c,d){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
c),a.subtract3D(b,d)))}if(a.loadLib)return a;var h=2*Math.PI,d,c,v,l,b,n,y,p;a.Primitive3D=function(a,b){this.space=b;for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=g:"face"===this.type?(this.normal=e(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=k):"text"===this.type?this.draw=f:"edge"===this.type&&(this.draw=m);this.isText&&(this.computeDepth=function(){this.normal=
{x:0,y:0,z:0};this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};a.Primitive3D.prototype.computeDepth=function(c){this.space=c;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};b=0;for(n=this.vertices.length;b<n;b++)this.spaceVertices[b]=c.rotateVertex(this.vertices[b]),this.average.x+=this.spaceVertices[b].x,this.average.y+=this.spaceVertices[b].y,this.average.z+=this.spaceVertices[b].z;this.average=a.scalarProduct3D(this.average,
1/n);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=e(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));b=0;for(n=this.vertices.length;b<n;b++)this.newSpaceVert[b]=this.spaceVertices[b],this.projVert[b]=this.newProjVert[b]=c.project(this.spaceVertices[b]);2<this.vertices.length&&(this.direction=e(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;b=0;for(n=this.vertices.length;b<n;b++)y=a.norm3D(a.subtract3D(this.spaceVertices[b],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,y),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,y);b=0;for(n=this.vertices.length;b<n;b++)this.minx>this.projVert[b].x&&(this.minx=this.projVert[b].x),this.maxx<this.projVert[b].x&&(this.maxx=this.projVert[b].x),this.miny>this.projVert[b].y&&(this.miny=this.projVert[b].y),
this.maxy<this.projVert[b].y&&(this.maxy=this.projVert[b].y)};a.Primitive3D.prototype.removeDoubles=function(){if("edge"!==this.type){p=[];b=0;for(n=this.vertices.length;b<n;b++)(1E-8<Math.abs(this.vertices[b].x-this.vertices[(b+1)%n].x)||1E-8<Math.abs(this.vertices[b].y-this.vertices[(b+1)%n].y)||1E-8<Math.abs(this.vertices[b].z-this.vertices[(b+1)%n].z)||1E-8<Math.abs(this.vertices[b].w-this.vertices[(b+1)%n].w))&&p.push(this.vertices[b]);0===p.length&&p.push(this.vertices[0]);this.vertices=p}};
a.Primitive3D.prototype.drawText=function(b,e,f,l,n,g,k,p,q,r,m){d=this.evaluator;b.textNode=e;g=d.eval(this.offset_dist);k=-a.degToRad(d.eval(this.offset_angle));f+=g*Math.cos(k);l+=g*Math.sin(k);b.textNode.pos={x:f,y:l};e.hasContent&&(e.draw(b,n,f,l,!0),v=this.fromPoint?e.textNodes.metrics.w/2:0,c=this.fromPoint?e.textNodes.metrics.h/2:0,e.draw(b,n,f-v,l-c))};a.Primitive3D.prototype.splitFace=function(b){if(this.intersects(b)){var c=i2=null,d=ix2=0,e,f;var l=this.vertices;var n=b.vertices;var g=
0;for(f=n.length;g<f;g++){var k=this.intersection(n[g],n[(g+1)%f]);if(null!==k)if(null===c){if(c=k,d=g,2===n.length){i2=c;break}}else if(!a.equals3DEpsilon(k,c,1E-8)){i2=k;ix2=g;break}}if(null!==c&&null!==i2){g=this.isInterior(c)||this.isInterior(i2);var p=e=null;if(!g&&3<=n.length)for(f=0,l=l.length;f<l;f++)if(k=b.intersection(this.vertices[f],this.vertices[(f+1)%l]),null!==k)if(null===e)e=k;else if(!a.equals3DEpsilon(k,e,1E-8)){p=k;break}if(g||null!==e&&null!==p&&b.isInterior(e)&&b.isInterior(p)){p=
!0;l=k=null;if(2===n.length)a.equals3DEpsilon(c,n[0],1E-8)||a.equals3DEpsilon(c,n[1],1E-8)?p=!1:(k=[],k[0]=n[0],k[1]=c,l=[],l[0]=c,l[1]=n[1]);else for(k=[],l=[],g=f=e=0;g<n.length;g++)g<d?k[e++]=n[g]:g==d?(k[e++]=n[g],k[e++]=c,l[f++]=c):g<ix2?l[f++]=n[g]:g==ix2?(l[f++]=n[g],l[f++]=i2,k[e++]=i2):k[e++]=n[g];if(p){c=[];c[0]=new a.Primitive3D({vertices:k,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);c[0].removeDoubles();c[0].normal=b.normal;c[1]=new a.Primitive3D({vertices:l,
type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);c[1].removeDoubles();c[1].normal=b.normal;if(2<c[0].vertices.length)return 2<c[1].vertices.length?c:[c[0]];if(2<c[1].vertices.length)return[c[1]]}}}}return[b]};a.Primitive3D.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};a.Primitive3D.prototype.intersectsPlane=function(b){var c=this.vertices;var d=b.vertices;if(0<c.length){var e=a.dotProduct3D(d[0],b.normal);
var f=a.dotProduct3D(c[0],b.normal);if(1E-8>Math.abs(e-f))return!0;for(var l=1,n=c.length;l<n;l++)if(d=a.dotProduct3D(c[l],b.normal),1E-8>Math.abs(e-d)||d>e&&f<e||d<e&&f>e)return!0}return!1};a.Primitive3D.prototype.intersection=function(b,c){var d=this.vertices;if(0<d.length){c=a.subtract3D(c,b);var e=a.dotProduct3D(c,this.normal);if(0!==e&&(d=a.dotProduct3D(a.subtract3D(d[0],b),this.normal)/e,-1E-8<d&&1.00000001>d))return a.add3D(b,a.scalarProduct3D(c,d))}return null};a.Primitive3D.prototype.isInterior=
function(b){var c=this.vertices;if(0<c.length)for(var d=0,e=a.subtract3D(c[0],b),f=0,l=c.length;f<l;f++){var n=a.subtract3D(c[(f+1)%l],b),g=a.dotProduct3D(a.crossProduct3D(e,n),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(e,n))break}else{if(0>d&&0<g||0<d&&0>g)return!1;e=n;d=g}}return!0};var q,r,u,w,x;a.Primitive3D.prototype.inFrontOf=function(a,c,d){if(this.minDistanceToEye>=c.maxDistanceToEye||this.maxx<=c.minx||this.minx>=c.maxx||this.maxy<=c.miny||this.miny>=c.maxy)return!1;for(w=0;3>
w;w++)if(q=null,q=0===w?this.intersections(c):1===w?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=q&&0<q.length){for(x=0;x<q.length;x++)a.push(q[x]);b=0;for(n=q.length;b<n;b++){r=q[b];u=this.space.rayFromEye(r.x,r.y);try{t=this.distanceToEyeAlong(u)-c.distanceToEyeAlong(u);if(t<=-d)return!0;if(t>=d)return!1}catch(G){}}}return!1};a.Primitive3D.prototype.intersections=function(b){for(var c=[],d,e,f,l=new a.R2,n=this.newSpaceVert,g=b.newSpaceVert,k=this.newProjVert,p=b.newProjVert,q=
0,r=n.length;q<r;q++){b=n[q];d=n[(q+1)%r];for(var m=0,h=g.length;m<h;m++)e=g[m],f=g[(m+1)%h],b!=e&&b!=f&&d!=e&&d!=f&&(e=l.intersection(k[q],k[(q+1)%r],p[m],p[(m+1)%h]),null!=e&&c.push(e))}return c};a.Primitive3D.prototype.distanceToEyeAlong=function(b){b=a.dotProduct3D(this.normal,b);if(1E-6<Math.abs(b))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/b;throw new Exception("Face is invisible");};a.Primitive3D.prototype.verticesContainedIn=function(a){for(var b=[],c=this.newSpaceVert,
d=this.newProjVert,e=0,f=c.length;e<f;e++)!a.isVertex(c[e])&&a.appearsToContain(d[e])&&b.push(d[e]);return b};a.Primitive3D.prototype.appearsToContain=function(a){for(var b=0,c,d=this.newProjVert,e=0,f=this.newSpaceVert.length;e<f;e++){c=(d[e].x-a.x)*(d[(e+1)%f].y-a.y)-(d[(e+1)%f].x-a.x)*(d[e].y-a.y);if(0!=b)if(1E-8>Math.abs(c)){if(1E-8<Math.abs(d[e].x-d[(e+1)%f].x))return Math.min(d[e].x,d[(e+1)%f].x)<=a.x+1E-8&&a.x<=Math.max(d[e].x,d[(e+1)%f].x)+1E-8;if(1E-8<Math.abs(d[e].y-d[(e+1)%f].y))return Math.min(d[e].y,
d[(e+1)%f].y)<=a.y+1E-8&&a.y<=Math.max(d[e].y,d[(e+1)%f].y)+1E-8}else if(0<b&&0>c||0>b&&0<c)return!1;b=c}return!0};a.Primitive3D.prototype.isVertex=function(b){for(var c=this.newSpaceVert,d=0,e=c.length;d<e;d++)if(a.equals3DEpsilon(b,c[d],1E-8))return!0;return!1};return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var c=[],b=0,d,e=a.length,f=a.length-1;-1<f;f--)d=a.charAt(f),0==b?"="==d&&(b=1):1==b?" "!=d&&(b="<"===d||">"===d?0:2):2==b&&" "==d&&(c.unshift(a.substring(f+1,e)),e=f,b=0);c.unshift(a.substring(0,e));return c}if(a.loadLib)return a;var k={x:0,y:0,z:0},f,m,e,h,d=a.degToRad;a.Graphic3D=function(c,d){this.parent=c;this.evaluator=c.evaluator;var b=c.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=b.parse("1");this.abs_coord=!1;this.family="";this.family_interval=b.parse("[0,1]");this.family_steps=b.parse("8");this.font="Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=b.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=b.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=b.parse("(0,0,0)");this.model="color";for(var e in d)d.hasOwnProperty(e)&&
(this[e]=d[e]);void 0==this.expresion&&"macro"!=this.type&&(this.expresion=b.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=c.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=b.parse(this.inirot);this.endrot=b.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};a.Graphic3D.prototype.getSpace=function(){for(var a=
this.parent.spaces,c,b=0,d=a.length;b<d;b++)if(c=a[b],c.id==this.spaceID)return c;return a[0]};a.Graphic3D.prototype.getFamilyValues=function(){f=this.evaluator;m=f.eval(this.family_interval);this.familyInf=m[0][0];this.familySup=m[0][1];this.fSteps=Math.round(f.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};a.Graphic3D.prototype.buildFamilyPrimitives=function(){f=this.evaluator;this.getFamilyValues();e=f.getVariable(this.family);if(0<=this.fSteps)for(var a=
0,c=this.fSteps;a<=c;a++)f.setVariable(this.family,this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,f.eval(this.drawif)&&this.buildPrimitives();f.setVariable(this.family,e)};a.Graphic3D.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};a.Graphic3D.prototype.updateMVMatrix=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=
this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(d(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(d(tmpExpr[0][1])),this.inirotM=this.inirotM.rotateZ(d(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(d(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(d(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(d(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);k={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=
this.iniposM.setIdentity().translate(k);tmpExpr=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(d(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(d(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(d(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(d(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(d(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(d(tmpExpr[0][2])));
tmpExpr=this.evaluator.eval(this.endpos);k={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(k)};a.Graphic3D.prototype.transformVertex=function(a){this.inirotEuler?h=this.inirotM.multiplyVector4(a):(h=this.inirotM_X.multiplyVector4(a),h=this.inirotM_Y.multiplyVector4(h),h=this.inirotM_Z.multiplyVector4(h));h=this.iniposM.multiplyVector4(h);this.endrotEuler?h=this.endrotM.multiplyVector4(h):(h=this.endrotM_X.multiplyVector4(h),h=this.endrotM_Y.multiplyVector4(h),
h=this.endrotM_Z.multiplyVector4(h));h=this.endposM.multiplyVector4(h);this.macroChildren&&(h=this.applyMacroTransform(h));h.adjustDec();return h};a.Graphic3D.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?h=this.macro_inirotM.multiplyVector4(a):(h=this.macro_inirotM_X.multiplyVector4(a),h=this.macro_inirotM_Y.multiplyVector4(h),h=this.macro_inirotM_Z.multiplyVector4(h));h=this.macro_iniposM.multiplyVector4(h);this.macro_endrotEuler?h=this.macro_endrotM.multiplyVector4(h):(h=this.macro_endrotM_X.multiplyVector4(h),
h=this.macro_endrotM_Y.multiplyVector4(h),h=this.macro_endrotM_Z.multiplyVector4(h));return h=this.macro_endposM.multiplyVector4(h)};a.Graphic3D.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),c=[],b=0,d=a.length;b<d;b++)""!==a[b].trim()&&(c=c.concat(g(a[b])));b=0;for(d=c.length;b<d;b++)c[b]=this.evaluator.parser.parse(c[b],!0);return c};var c;a.Graphic3D.prototype.splitFace=function(a){for(var d=0,b=this.primitives.length;d<b;d++)if(c=[],"face"===this.primitives[d].type){for(var e=
0,f=a.primitives.length;e<f;e++)"face"===a.primitives[e].type?c=c.concat(this.primitives[d].splitFace(a.primitives[e])):c.push(a.primitives[e]);a.primitives=c}};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e;a.Point3D=function(e,d){a.Graphic3D.call(this,e,d)};a.extend(a.Point3D,a.Graphic3D);a.Point3D.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();k=g.eval(this.expresion);f=k[0][0];m=k[0][1];e=k[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,m,e,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(f,m,e,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)))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d;a.Segment3D=function(c,d){this.width=c.evaluator.parser.parse("1");a.Graphic3D.call(this,c,d)};a.extend(a.Segment3D,a.Graphic3D);a.Segment3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();d=evaluator.getVariable("u");evaluator.setVariable("u",this.Nu);expr=evaluator.eval(this.expresion);g=expr[0][0];k=expr[0][1];f=expr[0][2];m=expr[1][0];e=expr[1][1];h=expr[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
k,f,1)),this.transformVertex(new a.Vector4D(m,e,h,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:evaluator.eval(this.width)},this.space));evaluator.setVariable("u",d)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v,l,b,n,y,p;a.Surface3D=function(b,c){this.parameter="t";this.parameter_interval=b.evaluator.parser.parse("[0,1]");this.parameter_steps=b.evaluator.parser.parse("8");a.Graphic3D.call(this,b,c);this.expresion=this.parseExpression()};a.extend(a.Surface3D,a.Graphic3D);a.Surface3D.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();m=g.getVariable("x");e=g.getVariable("y");h=g.getVariable("z");k=g.getVariable("u");
f=g.getVariable("v");g.setVariable("u",0);g.setVariable("v",0);d=parseInt(g.eval(this.Nu));c=parseInt(g.eval(this.Nv));v=[];for(b=0;b<=d;b++)for(g.setVariable("u",b/d),n=0;n<=c;n++){g.setVariable("v",n/c);y=0;for(p=this.expresion.length;y<p;y++)g.eval(this.expresion[y]);v.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}var q=this.color.getColor(),r=this.backcolor.getColor(),u=this.edges?this.edges.getColor():"";for(b=0;b<d;b++)for(n=0;n<c;n++)l=
[],l.push(v[n+b*c+b]),l.push(v[n+1+b*c+b]),l.push(v[n+2+(b+1)*c+b]),l.push(v[n+1+(b+1)*c+b]),this.primitives.push(new a.Primitive3D({vertices:l,type:"face",frontColor:q,backColor:r,edges:u,model:this.model},this.space));g.setVariable("x",m);g.setVariable("y",e);g.setVariable("z",h);g.setVariable("u",k);g.setVariable("v",f)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.Polygon3D=function(d,c){this.width=d.evaluator.parser.parse("1");a.Graphic3D.call(this,d,c)};a.extend(a.Polygon3D,a.Graphic3D);a.Polygon3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.eval(this.expresion);for(var d=this.color.getColor(),c=0,v=expr.length-1;c<v;c++)g=expr[c][0],k=expr[c][1],f=expr[c][2],m=expr[c+1][0],e=expr[c+1][1],h=expr[c+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
k,f,1)),this.transformVertex(new a.Vector4D(m,e,h,1))],type:"edge",frontColor:d,lineWidth:evaluator.eval(this.width)},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.Curve3D=function(d,c){this.width=d.evaluator.parser.parse("1");a.Graphic3D.call(this,d,c);this.expresion=this.parseExpression()};a.extend(a.Curve3D,a.Graphic3D);a.Curve3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();m=evaluator.getVariable("x");e=evaluator.getVariable("y");h=evaluator.getVariable("z");f=evaluator.getVariable("u");evaluator.setVariable("u",0);k=evaluator.eval(this.Nu);g=[];for(var d=
0;d<=k;d++){evaluator.setVariable("u",d/k);for(var c=0,v=this.expresion.length;c<v;c++)evaluator.eval(this.expresion[c]);g.push(this.transformVertex(new a.Vector4D(evaluator.getVariable("x"),evaluator.getVariable("y"),evaluator.getVariable("z"),1)))}d=0;for(c=g.length-1;d<c;d++)this.primitives.push(new a.Primitive3D({vertices:[g[d],g[d+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:evaluator.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));evaluator.setVariable("x",m);evaluator.setVariable("y",h);evaluator.setVariable("z",e);evaluator.setVariable("u",f)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v;a.Triangle3D=function(c,b){a.Graphic3D.call(this,c,b)};a.extend(a.Triangle3D,a.Graphic3D);a.Triangle3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.eval(this.expresion);g=expr[0][0];k=expr[0][1];f=expr[0][2];m=expr[1][0];e=expr[1][1];h=expr[1][2];d=expr[2][0];c=expr[2][1];v=expr[2][2];var l=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
k,f,1)),this.transformVertex(new a.Vector4D(d,c,v,1)),this.transformVertex(new a.Vector4D(m,e,h,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:l,model:this.model},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.Face3D=function(g,f){a.Graphic3D.call(this,g,f)};a.extend(a.Face3D,a.Graphic3D);a.Face3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.eval(this.expresion);g=[];for(var k=expr.length-1;0<=k;k--)g.push(this.transformVertex(new a.Vector4D(expr[k][0],expr[k][1],expr[k][2],1)));k=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.color.getColor(),
backColor:this.backcolor.getColor(),edges:k,model:this.model},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e;a.Polireg3D=function(e,d){this.width=e.evaluator.parser.parse("2");this.length=e.evaluator.parser.parse("2");a.Graphic3D.call(this,e,d)};a.extend(a.Polireg3D,a.Graphic3D);a.Polireg3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();g=evaluator.eval(this.Nu);k=[this.transformVertex(new a.Vector4D(0,0,0,1))];f=evaluator.eval(this.width)/2;m=evaluator.eval(this.length)/2;e=2*Math.PI/g;for(var h=0;h<g;h++)k.push(this.transformVertex(new a.Vector4D(f*
Math.cos(e*h),m*Math.sin(e*h),0,1)));var d=this.color.getColor(),c=this.backcolor.getColor(),v=this.edges?this.edges.getColor():"";for(h=0;h<g;h++)this.primitives.push(new a.Primitive3D({vertices:[k[0],h+2<=g?k[h+2]:k[1],k[h+1]],type:"face",frontColor:d,backColor:c,edges:v,model:this.model},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m;a.Text3D=function(e,f){a.Graphic3D.call(this,e,f)};a.extend(a.Text3D,a.Graphic3D);a.Text3D.prototype.buildPrimitives=function(){g=this.evaluator;k=g.eval(this.expresion);f=k[0][0];m=k[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(f,m,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))};return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var k=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-");new String("-x-y-z-u-v-w-");var f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,m,e,h=0;a.Macro3D=function(d,c){this.expresion=void 0;this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=d.evaluator.parser.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=
d.evaluator.parser.parse("(0,0,0)");this.name="_descartes_empty_name_"+h++;a.Graphic.call(this,d,c);for(var e in c)c.hasOwnProperty(e)&&(this[e]=c[e]);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=this.evaluator.parser.parse(this.inirot);this.endrot=this.evaluator.parser.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;this.graphics=[];d=d.lessonParser;var l=new a.Tokenizer;if(void 0!=this.expresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);c=this.evaluator.eval(this.expresion);if(c)var b=
(b=document.getElementById(c))&&"descartes/macro"==b.type?b.text:a.openExternalFile(c);if(b){var n=b.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,
"&").replace(/\r/g,"").split("\n");b=[];c=0;for(e=n.length;c<e;c++){var m=n[c].indexOf("=");if(-1!==m){m=d.split(n[c]);for(var p=0,q=m.length;p<q;p++)if(m[p]&&1<m.length&&("id"===g[m[p][0]]||"type"===g[m[p][0]])){b.push(m);break}}}c=0;for(e=b.length;c<e;c++){q=(p=b[c]||[],p[0])&&"id"===p[0][0];var r=!1;n=0;for(m=p.length;n<m;n++){var u=p[n][0].indexOf(".");-1===u||q?u=g[p[n][0]]:(u=g[p[n][0].substring(u+1)],p[n][0]=this.name+"."+p[n][0]);"type"===u&&"surface"===g[p[n][1]]&&(r=!0);if(!("font"===u||
"font_family"===u||("fill"===u||"color"===u||"backcolor"===u||"arrow"===u)&&"("!==p[n][1].charAt(0)||"file"===u&&p[n][1].match(f)||"id"!==u&&void 0!==g[p[n][1]]||r&&"expresion"===u)||"width"===u||"height"===u||"length"===u)if("text"==u)if(p[n][1].match(/\{\\rtf1/)){u=p[n][1];var w=this;var x=function(b,c){c=l.tokenize(c.replace(/&squot;/g,"'"));for(var d=0,e=c.length;d<e;d++)"identifier"!=c[d].type||a.reservedIds.match("-"+c[d].value+"-")||(c[d].value=w.name+"."+c[d].value);return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+l.flatTokens(c)};u=u.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);u=u.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);p[n][1]=u}else{x=d.parseText(p[n][1]).textElementsMacros;for(var B=0,D=x.length;B<D;B++){u=l.tokenize(x[B].replace(/&squot;/g,"'"));for(var H=0,G=u.length;H<G;H++)"identifier"!==u[H].type||a.reservedIds.match("-"+u[H].value+"-")||(u[H].value=this.name+"."+u[H].value);u=l.flatTokens(u).replace(/&squot;/g,
"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");x[B]=u.substring(1,u.length-1)}p[n][1]=x.join("")}else{x=p[n][1].replace(/&squot;/g,"'").split(";");B=0;for(D=x.length;B<D;B++){u=l.tokenize(x[B].replace(/\\n/g,";"));H=0;for(G=u.length;H<G;H++)"identifier"!==u[H].type||a.reservedIds.match("-"+u[H].value+"-")||(u[H].value=this.name+"."+u[H].value);x[B]=l.flatTokens(u)}p[n][1]=x.join(";")}}}c=0;for(e=b.length;c<e;c++)if(b[c][0]){p="";q=!1;n=0;for(m=b[c].length;n<m;n++)"type"===g[b[c][n][0]]&&k.match("-"+
g[b[c][n][1]]+"-")&&(q=!0),p=p+b[c][n][0]+"='"+b[c][n][1]+"' ";b[c]=p+(q?" space='"+this.spaceID+"'":"");q?this.graphics.push(d.parse3DGraphic(b[c],this.abs_coord,this.background,this.inirot)):d.parseAuxiliar(b[c])}}c=0;for(e=this.graphics.length;c<e;c++)this.graphics[c].macroChildren=!0}};a.extend(a.Macro3D,a.Graphic);a.Macro3D.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var c=0,e=this.fSteps;c<=
e;c++)evaluator.setVariable(this.family,this.familyInf+c*this.family_sep),this.familyValue=this.familyInf+c*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};a.Macro3D.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};a.Macro3D.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 c=this.graphics.length;a<c;a++)m=this.graphics[a],m.macro_inirotEuler=this.inirotEuler,m.macro_inirotM=this.inirotM,m.macro_inirotM_X=this.inirotM_X,m.macro_inirotM_Y=this.inirotM_Y,m.macro_inirotM_Z=this.inirotM_Z,m.macro_iniposM=this.iniposM,m.macro_endrotEuler=this.endrotEuler,m.macro_endrotM=this.endrotM,m.macro_endrotM_X=this.endrotM_X,m.macro_endrotM_Y=this.endrotM_Y,m.macro_endrotM_Z=this.endrotM_Z,m.macro_endposM=this.endposM,m.update();
a=0;for(c=this.graphics.length;a<c;a++){m=this.graphics[a];if(m.split||this.split)for(var f=a+1;f<c;f++)e=this.graphics[f],(e.split||this.split)&&m.splitFace(e);this.primitives=this.primitives.concat(m.primitives||[])}};a.Macro3D.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)};a.Macro3D.prototype.drawAux=function(a){};return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b,c,e,d){k.call(this,a/1.8,a/1.8,a/1.8,e,d)}function k(a,b,c,e,d){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,e,d)||(this.vertices=[new r(a,c,b,1),new r(a,-c,b,1),new r(a,c,-b,1),new r(a,-c,-b,1),new r(-a,c,b,1),new r(-a,-c,b,1),new r(-a,c,-b,1),new r(-a,-c,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,c,e,d))}function f(a,b,c,e,d){a/=2;this.changeGeometry(a,b,c,e,d)||(this.vertices=[new r(0,0,a,1),new r(-.49*
a,-.86*a,-.32*a,1),new r(-.49*a,.86*a,-.32*a,1),new r(1*a,0,-.32*a,1)],this.faces=[[3,2,1],[1,2,0],[2,3,0],[3,1,0]],this.updateValues(a,b,c,e,d))}function m(a,b,c,e,d){a/=2;this.changeGeometry(a,b,c,e,d)||(this.vertices=[new r(0,0,a,1),new r(a,0,0,1),new r(-a,0,0,1),new r(0,a,0,1),new r(0,-a,0,1),new r(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,c,e,d))}function e(b,c,e,d,f){b/=3.4;if(!this.changeGeometry(b,c,e,d,f)){A=b/1.6180339887;
F=1.6180339887*b;this.vertices=[new r(b,b,b,1),new r(b,b,-b,1),new r(b,-b,b,1),new r(b,-b,-b,1),new r(-b,b,b,1),new r(-b,b,-b,1),new r(-b,-b,b,1),new r(-b,-b,-b,1),new r(0,A,F,1),new r(0,A,-F,1),new r(0,-A,F,1),new r(0,-A,-F,1),new r(A,F,0,1),new r(A,-F,0,1),new r(-A,F,0,1),new r(-A,-F,0,1),new r(F,0,A,1),new r(F,0,-A,1),new r(-F,0,A,1),new r(-F,0,-A,1)];J=(new a.Matrix4x4).setIdentity().rotateY(-p/6);z=0;for(N=this.vertices.length;z<N;z++)this.vertices[z]=J.multiplyVector4(this.vertices[z]);this.faces=
[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,c,e,d,f)}}function h(b,c,e,d,f){b/=4;if(!this.changeGeometry(b,c,e,d,f)){F=1.6180339887*b;this.vertices=[new r(0,b,F,1),new r(0,b,-F,1),new r(0,-b,F,1),new r(0,-b,-F,1),new r(b,F,0,1),new r(b,-F,0,1),new r(-b,F,0,1),new r(-b,-F,0,1),new r(F,0,b,1),new r(F,0,-b,1),new r(-F,0,b,1),new r(-F,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]];J=(new a.Matrix4x4).setIdentity().rotateY(-1.029);z=0;for(N=this.vertices.length;z<N;z++)this.vertices[z]=J.multiplyVector4(this.vertices[z]);this.updateValues(b,c,e,d,f)}}function d(a,b,c,e,d){a/=2;this.isSphere?c=b=a:(b/=2,c/=2);if(!this.changeGeometry(a,b,c,e,d)){this.vertices=[new r(0,0,b,1)];for(z=1;z<e;z++)for(G=z*p/e,C=0;C<
d;C++)H=C*q/d,x=a*n(G)*y(H),B=c*n(G)*n(H),D=b*y(G),this.vertices.push(new r(x,B,D,1));this.vertices.push(new r(0,0,-b,1));this.faces=[];for(z=0;z<d;z++)this.faces.push([0,(z+1)%d+1,z%d+1]);for(z=1;z<e-1;z++)for(C=0;C<d;C++)this.faces.push([C+1+(z-1)*d,(C+1)%d+1+(z-1)*d,(C+1)%d+1+z*d,C+1+z*d]);for(z=0;z<d;z++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+z,this.vertices.length-1-d+(z+1)%d]);this.updateValues(a,b,c,e,d)}}function c(a,b,c,d,e){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,
b,c,d,e)){this.vertices=[];for(z=0;z<e;z++)for(C=0;C<d;C++)x=a*(e-z)/e*y(C*q/d),B=c*(e-z)/e*n(C*q/d),D=b-2*z*b/e,this.vertices.push(new r(x,B,D,1));this.vertices.push(new r(0,0,-b,1));this.faces=[];for(z=0;z<e-1;z++)for(C=0;C<d;C++)this.faces.push([C+z*d,(C+1)%d+z*d,(C+1)%d+(z+1)*d,C+(z+1)*d]);for(z=0;z<d;z++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+z,this.vertices.length-1-d+(z+1)%d]);this.updateValues(a,b,c,d,e)}}function v(a,b,c,d,e){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,
b,c,d,e)){this.vertices=[];for(z=0;z<e+1;z++)for(C=0;C<d;C++)x=a*y(C*q/d),B=c*n(C*q/d),D=b-2*z*b/e,this.vertices.push(new r(x,B,D,1));this.faces=[];for(z=0;z<e;z++)for(C=0;C<d;C++)this.faces.push([C+z*d,(C+1)%d+z*d,(C+1)%d+(z+1)*d,C+(z+1)*d]);this.updateValues(a,b,c,d,e)}}function l(a,b,c,d,e){a/=2;b/=2;c/=2;I=u.eval(this.R);E=u.eval(this.r);if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(z=0;z<e+1;z++)for(C=0;C<d;C++)x=-(I+E*n(q*C/d))*n(q*z/e),B=(I+E*n(q*C/d))*y(q*z/e),D=E*y(q*C/d),this.vertices.push(new r(x,
B,D,1));this.faces=[];for(z=0;z<e;z++)for(C=0;C<d;C++)this.faces.push([C+z*d,C+(z+1)*d,(C+1)%d+(z+1)*d,(C+1)%d+z*d]);this.updateValues(a,b,c,d,e)}}function b(){function a(a){return parseInt(a)}function b(a){return parseFloat(a)}this.vertices=[];this.faces=[];z=0;for(N=this.fileData.length;z<N;z++)K=this.fileData[z],K.match(/^V\(/)?(L=K.substring(2,K.length-1).split(",").map(b),this.vertices.push(new r(L[0]||0,L[1]||0,L[2]||0,1))):K.match(/^F\(/)&&(L=K.substring(2,K.length-1).split(",").map(a),this.faces.push(L.reverse()))}
if(a.loadLib)return a;var n=Math.sin,y=Math.cos,p=Math.PI,q=2*p,r,u,w,x,B,D,H,G,I,E,A,F,J,K,L,z,N,C,O;a.OtherGeometry=function(n,p){this.width=n.evaluator.parser.parse("2");this.height=n.evaluator.parser.parse("2");this.length=n.evaluator.parser.parse("2");this.R=n.evaluator.parser.parse("2");this.r=n.evaluator.parser.parse("1");r=a.Vector4D;a.Graphic3D.call(this,n,p);switch(this.type){case "cube":this.buildGeometry=g;break;case "box":this.buildGeometry=k;break;case "tetrahedron":this.buildGeometry=
f;break;case "octahedron":this.buildGeometry=m;break;case "sphere":this.isSphere=!0;case "ellipsoid":this.buildGeometry=d;break;case "dodecahedron":this.buildGeometry=e;break;case "icosahedron":this.buildGeometry=h;break;case "cone":this.buildGeometry=c;break;case "cylinder":this.buildGeometry=v;break;case "torus":this.buildGeometry=l;break;case "mesh":this.fileData=a.openExternalFile(this.evaluator.eval(this.file)).split(/\r/),this.buildGeometry=b}};a.extend(a.OtherGeometry,a.Graphic3D);a.OtherGeometry.prototype.buildPrimitives=
function(){u=this.evaluator;this.updateMVMatrix();this.buildGeometry(u.eval(this.width),u.eval(this.height),u.eval(this.length),u.eval(this.Nu),u.eval(this.Nv));var b=this.color.getColor(),c=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";z=0;for(N=this.faces.length;z<N;z++){w=[];C=0;for(O=this.faces[z].length;C<O;C++)w.push(this.transformVertex(this.vertices[this.faces[z][C]]));this.primitives.push(new a.Primitive3D({vertices:w,type:"face",frontColor:b,backColor:c,edges:d,model:this.model},
this.space))}};a.OtherGeometry.prototype.changeGeometry=function(a,b,c,d,e){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===c&&this.oldNu===d&&this.oldNv===e};a.OtherGeometry.prototype.updateValues=function(a,b,c,d,e){this.oldWidth=a;this.oldHeight=b;this.oldLength=c;this.oldNv=e;this.oldNu=d};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,k=Math.min,f=Math.PI,m=Math.cos,e=Math.sin,h=Math.abs,d=Math.round,c,v,l,b,n,y,p,q,r,u,w,x,B,D,H,G,I,E;a.R2=function(a,b){this.x=a||0;this.y=b||0};a.R2.prototype.set=function(a,b){this.x=a||0;this.y=b||0;return this};a.R2.prototype.copy=function(){return new a.R2(this.x,this.y)};a.R2.prototype.ix=function(){return d(g(k(this.x,32E3),-32E3))};a.R2.prototype.iy=function(){return d(g(k(this.y,32E3),-32E3))};a.R2.prototype.equals=function(a){return this.x===
a.x&&this.y===a.y};a.R2.prototype.norm2=function(){return this.x*this.x+this.y*this.y};a.R2.prototype.norm=function(){return Math.sqrt(this.norm2())};a.R2.prototype.distance=function(a){v=this.copy();v.sub(a);return v.norm()};a.R2.prototype.dot=function(a){return this.x*a.x+this.y*a.y};a.R2.prototype.det=function(a){return this.x*a.y-this.y*a.x};a.R2.prototype.mul=function(a){this.x*=a;this.y*=a};a.R2.prototype.div=function(a){this.x/=a;this.y/=a};a.R2.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};a.R2.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};a.R2.prototype.normalize=function(){c=this.norm();0!=c&&this.div(c)};a.R2.prototype.rotR90=function(){c=this.x;this.x=this.y;this.y=-c};a.R2.prototype.rotL90=function(){c=this.x;this.x=-this.y;this.y=c};a.R2.prototype.rot=function(a){l=this.copy();y=m(a);p=e(a);this.x=l.x*y-l.y*p;this.y=l.x*p+l.y*y};a.R2.prototype.rot=function(a){this.rot(a*f/180)};a.R2.prototype.intersection=function(c,d,e,f){q=d.x-c.x;r=e.x-f.x;u=e.x-c.x;w=d.y-c.y;x=e.y-
f.y;B=e.y-c.y;E=q*x-r*w;return 1E-6<h(E)?(b=(u*x-B*r)/E,n=(-u*w+B*q)/E,0<=b&&1>=b&&0<=n&&1>=n?new a.R2(c.x+q*b,c.y+w*b):null):(d.x-e.x)*B!=(d.y-e.y)*u?null:c.x!=d.x?(D=k(c.x,d.x),H=g(c.x,d.x),D<=e.x&&e.x<=H?e:D<=f.x&&f.x<=H?f:null):e.x!=f.x?(G=k(e.x,f.x),I=g(e.x,f.x),G<=c.x&&c.x<=I?c:G<=d.x&&d.x<=I?d:null):c.y!=d.y?(D=k(c.y,d.y),H=g(c.y,d.y),D<=e.y&&e.y<=H?e:D<=f.y&&f.y<=H?f:null):e.y!=f.y?(G=k(e.y,f.y),I=g(e.y,f.y),G<=c.y&&c.y<=I?c:G<=d.y&&d.y<=I?d:null):c.x==e.x&&c.y==e.y?c:null};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v;a.R2Newton=function(c,b){this.evaluator=c;this.constraint=b;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];h=
new a.R2(0,0);e=new a.R2(0,0);v=new a.R2(0,0)};a.R2Newton.prototype.getUnitNormal=function(){this.normal.normalize();return v.set(this.normal.x,this.normal.y)};a.R2Newton.prototype.gradient=function(a){g=this.evaluator;h.x=0;h.y=0;d=g.getVariable("x");c=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);k=g.eval(this.constraint);h.x=(k-this.f0)/1E-6;h.x=isNaN(h.x)?Infinity:h.x;g.setVariable("x",g.getVariable("x")-
1E-6);g.setVariable("y",g.getVariable("y")+1E-6);k=g.eval(this.constraint);h.y=(k-this.f0)/1E-6;h.y=isNaN(h.y)?Infinity:h.y;g.setVariable("x",d);g.setVariable("y",c);return h};a.R2Newton.prototype.findZero=function(a,b,n){g=this.evaluator;e.x=a.x;e.y=a.y;d=g.getVariable("x");c=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 e;g.setVariable("x",d);g.setVariable("y",c);for(var l=
0;16>l;l++)if(f=e.x,m=e.y,this.normal=this.gradient(e),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),e.x=f+this.normal.x,e.y=m+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=e.x-a.x,this.normal.y=e.y-a.y),e;return n?e:null};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Vector2D=function(a,k){this.x=a;this.y=k};a.Vector2D.AXIS_X=new a.Vector2D(1,0);a.Vector2D.AXIS_Y=new a.Vector2D(0,1);a.Vector2D.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};a.Vector2D.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};a.Vector2D.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.round,f,m,e,h,d,c,v,l,b,n,y,p,q;a.Control=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=this.parser=b.evaluator.parser;this.id="graphic"!==c.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="video"!==c.type?100:350;this.h="video"!==c.type?23:120;"graphic"!==c.type&&"audio"!==c.type&&"video"!==c.type?"text"!==c.type?this.expresion=d.parse("(0,0,100,23)"):(this.expresion=d.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=d.parse("(0,0)");this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color=new a.Color(4>this.parent.version?"000000":"222222");this.colorInt=new a.Color("graphic"!==c.type?"f0f8ff":"cc0022");this.underlined=this.italics=this.bold="";this.font_size=4>this.parent.version?-1:d.parse("12");this.parameter=this.action="";this.parameterFont="Monospace 12px";this.drawif=d.parse("1");this.activeif=d.parse("1");this.tooltip="";this.tooltipFont="Monospace 12px";
this.Explanation="";this.ExplanationFont="Monospace 12px";this.cID=this.msg_pos="";this.valueExpr=d.parse("0");this.decimals=d.parse("2");this.min=d.parse("-Infinity");this.max=d.parse("Infinity");this.incr=d.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;for(var e in c)c.hasOwnProperty(e)&&(this[e]=c[e]);"video"!==this.type&&"audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==
this.name||"_nada_"==this.name||"_void_"==this.name?"":this.name;c=this.evaluator.eval(this.expresion);this.x=k(c[0][0]);this.y=k(c[0][1]);4==c[0].length&&(this.w=k(c[0][2]),this.h=k(c[0][3]));this.actionExec=b.lessonParser.parseAction(this)};a.Control.prototype.init=function(){};a.Control.prototype.update=function(){};a.Control.prototype.draw=function(){};a.Control.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,c=a.length;b<c;b++){var d=a[b];if(d.id===
this.spaceID)return d.addCtr(this),this.zIndex=d.zIndex,this.space=d,d.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};a.Control.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};a.Control.prototype.updatePositionAndSize=function(){e=h=d=c=!1;v=this.evaluator.eval(this.expresion);l=k(v[0][0]);e=k(this.x)!==
l;this.x=l;l=k(v[0][1]);h=k(this.y)!==l;this.y=l;4===v[0].length&&(l=k(v[0][2]),d=k(this.w)!==l,this.w=l,l=k(v[0][3]),c=k(this.h)!==l,this.h=l);if(d||c||e||h)this.init(!0),this.draw()};a.Control.prototype.formatOutputValue=function(a){q=this.parent;b=a+"";n=this.evaluator.eval(this.decimals);y=b.indexOf(".");-1!=y&&(p=b.substring(y+1),p.length>n&&(b=parseFloat(b).toFixed(n)));this.fixed&&(2!==q.version||2===q.version&&!this.exponentialif)&&(b=parseFloat(a).toFixed(n));this.exponentialif&&0!=parseFloat(b)&&
(b=this.fixed&&2!==q.version?parseFloat(b).toExponential(n):parseFloat(b).toExponential(),b=b.toUpperCase().replace("+",""));return b.replace(".",q.decimal_symbol)};a.Control.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()};a.Control.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,
0,0,b);f=b*b;for(a=0;a<b;a++)m=g(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+m*m*192/f/255+")")};a.Control.prototype.createCSSGradient=function(a){var b="linear-gradient(";f=a*a;for(var c=0;c<a;c++)m=g(c-35*a/100),b+="rgba(0,0,0,"+m*m*200/f/255+") "+100*c/(a-1)+"%,";b=b.substring(0,b.length-1);return b+")"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.abs,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w=/[\w\.\-//]*(\.gif)/gi,x,B,D,H,G,I,E,A,F,J,K,L,z,N,C,O;a.Button=function(b,c){this.imageSrc="";this.image=new Image;this.imageOver=new Image;this.imageDown=new Image;this.borderColor=this.flat=!1;this.image_align=this.text_align="center_center";this.font_family="arial";a.Control.call(this,b,c);this.font_family=a.getFontName(this.font_family);this.ratio=b.ratio;-1===this.font_size&&(this.fontSizeNotSet=
!0);this.borderColor&&(this.borderColor=new a.Color(this.borderColor));this.text_align=this.text_align.split("_");this.image_align=this.image_align.split("_");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.classContainer=this.cssClass?" "+this.cssClass+" ":"";if(this.imageSrc.trim().match("^_STYLE_")){this.customStyle=!0;this.btnStyle=[];this.conStyle=[];
this.conStyle.textBorder=3;b=this.imageSrc.trim().substring(8).split("|");for(var d,e=0,f=b.length;e<f;e++)c=b[e],d=c.match(/rgb/g),c.match("class=")?this.classContainer=" "+c.substring(6):c.match("border=")?(this.btnStyle.push({type:"border-style",value:"solid"}),this.btnStyle.push({type:"border-width",value:c.substring(7).trim()+"px"})):c.match("borderRadius=")?(this.btnStyle.push({type:"border-radius",value:c.substring(13).trim()+"px"}),this.conStyle.push({type:"border-radius",value:c.substring(13).trim()+
"px"})):c.match("borderColor=")?this.btnStyle.push({type:"border-color",value:(d?"":"#")+c.substring(12).trim()}):c.match("overColor=")?this.conStyle.overColor=(d?"":"#")+c.substring(10).trim():c.match("downColor=")?this.conStyle.downColor=(d?"":"#")+c.substring(10).trim():c.match("font=")?this.conStyle.font=c.substring(5).trim().toLowerCase():c.match("inactiveColor=")?this.conStyle.inactiveColor=(d?"":"#")+c.substring(14).trim():c.match("inactiveColorBorder=")?this.conStyle.inactiveColorBorder=(d?
"":"#")+c.substring(20).trim():c.match("shadowTextBlur=")?this.conStyle.shadowTextBlur=parseFloat(c.substring(15).trim()):c.match("shadowTextOffsetX=")?this.conStyle.shadowTextOffsetX=parseFloat(c.substring(18).trim()):c.match("shadowTextOffsetY=")?this.conStyle.shadowTextOffsetY=parseFloat(c.substring(18).trim()):c.match("shadowTextColor=")?this.conStyle.shadowTextColor=(d?"":"#")+c.substring(16).trim():c.match("shadowBoxBlur=")?this.conStyle.shadowBoxBlur=parseFloat(c.substring(14).trim()):c.match("shadowBoxOffsetX=")?
this.conStyle.shadowBoxOffsetX=parseFloat(c.substring(17).trim()):c.match("shadowBoxOffsetY=")?this.conStyle.shadowBoxOffsetY=parseFloat(c.substring(17).trim()):c.match("shadowBoxColor=")?this.conStyle.shadowBoxColor=(d?"":"#")+c.substring(15).trim():c.match("shadowInsetBoxBlur=")?this.conStyle.shadowInsetBoxBlur=parseFloat(c.substring(19).trim()):c.match("shadowInsetBoxOffsetX=")?this.conStyle.shadowInsetBoxOffsetX=parseFloat(c.substring(22).trim()):c.match("shadowInsetBoxOffsetY=")?this.conStyle.shadowInsetBoxOffsetY=
parseFloat(c.substring(22).trim()):c.match("shadowInsetBoxColor=")?this.conStyle.shadowInsetBoxColor=(d?"":"#")+c.substring(20).trim():c.match("textBorder=")&&(this.conStyle.textBorder=parseFloat(c.substring(11).trim()));this.imageSrc="vacio.gif"}this.imageSrc.match("_COLORES_")&&(b=this.imageSrc.split("_"),this.colorInt=new a.Color(b[2]),this.color=new a.Color(b[3]),this.font_size=this.parser.parse(b[5]),this.imageSrc="");"["==this.imageSrc.charAt(0)?this.imageSrc=this.parser.parse(this.imageSrc.substring(1,
this.imageSrc.length-1)):this.imageSrc=this.parser.parse("'"+this.imageSrc+"'");b=this.evaluator.eval(this.imageSrc).toString().trim();""!=b&&(c=b.substr(0,b.lastIndexOf(".")),d=b.substr(b.lastIndexOf(".")),b.toLowerCase().match(/vacio.gif$/)?(this.imageSrc=this.parser.parse("'vacio.gif'"),this.image.ready=1,3===this.parent.version&&(this.name=this.parser.parse("")),this.emptyImage={ready:!0},this.parser.parse("'vacio.gif'")):(this.image=this.parent.getImage(b),c&&(this.imageOver=this.parent.getImage(c+
"_over"+d),this.imageDown=this.parent.getImage(c+"_down"+d))));this.container=document.createElement("div");this.container.setAttribute("class","DescartesButtonContainer"+this.classContainer);this.container.setAttribute("id",this.id);this.container.setAttribute("style","width:"+this.w+"px; height:"+this.h+"px; left:"+this.x+"px; top:"+this.y+"px; z-index:"+this.zIndex+";");this.btn=document.createElement("canvas");this.btn.width=this.w*this.ratio;this.btn.height=this.h*this.ratio;this.btn.setAttribute("style",
"position:absolute; left:0; top:0; width:"+this.w+"px; height:"+this.h+"px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box;");this.ctx=this.btn.getContext("2d");this.ctx.imageSmoothingEnabled=!1;this.container.appendChild(this.btn);this.addControlContainer(this.container);this.addEvents();this.init()};a.extend(a.Button,a.Control);a.Button.prototype.init=function(b){f=this.evaluator;x=this.container;m=this.btn;e=this.ctx;h=f.eval(this.expresion);this.x=h[0][0];this.y=
h[0][1];4==h[0].length&&(this.w=parseInt(h[0][2]),this.h=parseInt(h[0][3]));m.width=this.w*this.ratio;m.height=this.h*this.ratio;m.setAttribute("style","position:absolute; left:0; top:0; width:"+this.w+"px; height:"+this.h+"px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box;");x.setAttribute("style","width:"+this.w+"px; height:"+this.h+"px; left:"+this.x+"px; top:"+this.y+"px; z-index:"+this.zIndex+"; display:block;");if(this.btnStyle)for(var c=0,d=this.btnStyle.length;c<
d;c++)m.style[this.btnStyle[c].type]=this.btnStyle[c].value;if(this.conStyle){c=0;for(d=this.conStyle.length;c<d;c++)x.style[this.conStyle[c].type]=this.conStyle[c].value;if(this.conStyle.shadowBoxColor){c=this.conStyle.shadowBoxOffsetX||0;d=this.conStyle.shadowBoxOffsetY||2;var l=this.conStyle.shadowBoxBlur||2;x.style.boxShadow=c+"px "+d+"px "+l+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(c=this.conStyle.shadowInsetBoxOffsetX||0,d=this.conStyle.shadowInsetBoxOffsetY||
-2,l=this.conStyle.shadowInsetBoxBlur||1,m.style.boxShadow=c+"px "+d+"px "+l+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset");this.conStyle.shadowTextColor&&(e.shadowBlur=this.conStyle.shadowTextBlur||1,e.shadowOffsetX=this.conStyle.shadowTextOffsetX||0,e.shadowOffsetY=this.conStyle.shadowTextOffsetY||2,e.shadowColor=this.conStyle.shadowTextColor)}this.fontSizeNotSet&&(this.font_size=f.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=f.eval(this.font_size);this.createGradient(this.w,
this.h);x.style.display=0<f.eval(this.drawif)?"block":"none";e.textAlign="center";e.textBaseline="middle";e.lineJoin="round";e.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.customStyle&&("serif"==this.conStyle.font?e.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family:"monospace"==this.conStyle.font&&(e.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+a.monospace_font));this.draw(b)};a.Button.prototype.update=function(){f=this.evaluator;
x=this.container;m=this.btn;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(x.style.display="block",this.draw(),x.style.cursor=m.style.cursor=this.activeIfValue?"pointer":"not-allowed",this.updatePositionAndSize()):(x.style.display="none",this.buttonClick=!1)};a.Button.prototype.draw=function(k){x=this.container;f=this.evaluator;m=this.btn;e=this.ctx;c=f.eval(this.name);v=this.evaluator.eval(this.imageSrc).toString().trim();
if(!k&&(B=this.over===this.oldOver,D=this.buttonClick===this.oldButtonClick,H=this.activeIfValue===this.oldActiveIfValue,G=this.drawIfValue===this.oldDrawIfValue,I=c===this.oldName,E=v===this.oldImageSrc,A=this.colorInt.getColor()===this.oldBackColor,F=this.color.getColor()===this.oldTextColor,J=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=c,this.oldImageSrc=
v,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,B&&D&&H&&G&&I&&E&&A&&F&&J))return;e.save();e.setTransform(this.ratio,0,0,this.ratio,0,0);d=this.fs_evaluated;x.setAttribute("data-name",c);v?(l="vacio.gif"===v?this.emptyImage:this.parent.getImage(v),K=v.substr(0,v.lastIndexOf(".")),L=v.substr(v.lastIndexOf(".")),z=K+"_over"+L,N=K+"_down"+L,C="vacio.gif"===v?this.emptyImage:this.parent.getImage(z),O="vacio.gif"===v?this.emptyImage:
this.parent.getImage(N)):O=C=l=this.emptyImage;e.clearRect(0,0,this.w,this.h);b=n=0;this.buttonClick&&(b=n=1);"center"==this.text_align[1]?r=g(this.w/2+b)-.5:"left"==this.text_align[1]?(y=e.measureText(c).width,r=y/2+5+b):"right"==this.text_align[1]&&(y=e.measureText(c).width,r=this.w-y/2+b-5);"center"==this.text_align[0]?u=g(this.h/2+n)-.5:"top"==this.text_align[0]?u=d/2+n+4:"bottom"==this.text_align[0]&&(u=this.h-d/2+n-3);l&&("center"==this.image_align[1]?p=parseInt((this.w-l.width)/2)+b:"left"==
this.image_align[1]?p=b:"right"==this.image_align[1]&&(p=this.w-l.width+b),"center"==this.image_align[0]?q=parseInt((this.h-l.height)/2)+n:"top"==this.image_align[0]?q=n:"bottom"==this.image_align[0]&&(q=this.h-l.height+n));if(l&&l.ready)if(l!==this.emptyImage&&l.complete)if(v.match(w))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+v+"')",this.btn.style.backgroundPosition=p+"px "+q+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])x.style.backgroundColor=
this.colorInt.getColor();e.drawImage(l,p,q)}else this.emptyImage&&this.customStyle&&(x.style.backgroundColor=this.colorInt.getColor());else x.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(e,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(e,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(e,1,0,1,this.h,"rgba(0,0,0,0.03)")),e.fillStyle=this.linearGradient,e.fillRect(0,0,this.w,this.h));this.activeIfValue&&(C!==this.emptyImage&&this.over&&C.ready&&C.complete?
z.match(w)?(this.btn.style.backgroundImage="url('"+z+"')",this.btn.style.backgroundPosition=p+"px "+q+"px"):e.drawImage(C,p,q):this.customStyle&&this.conStyle.overColor&&this.over&&(x.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?O!==this.emptyImage&&this.buttonClick&&O.ready&&O.complete?N.match(w)?(this.btn.style.backgroundImage="url('"+N+"')",this.btn.style.backgroundPosition=p+"px "+q+"px"):e.drawImage(O,p,q):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(x.style.backgroundColor=
this.conStyle.downColor):this.buttonClick&&!l&&(e.fillStyle="rgba(0,0,0,0.09)",e.fillRect(0,0,this.w,this.h));e.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(e.lineWidth=this.conStyle.textBorder,e.strokeStyle=this.conStyle.shadowTextColor,e.strokeText(c,r,u));this.borderColor&&(e.lineWidth=parseInt(d/7),e.strokeStyle=this.borderColor.getColor(),e.strokeText(c,r,u));e.fillText(c,r,u);this.underlined&&(y=e.measureText(c).width,e.strokeStyle=
this.color.getColor(),e.lineWidth=g(d/10)||2,e.lineCap="round",e.beginPath(),e.moveTo(r-y/2+b,u+g(d/2)+g(d/5)-1.5),e.lineTo(r+y/2+b,u+g(d/2)+g(d/5)-1.5),e.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?x.style.backgroundColor=this.conStyle.inactiveColor:(e.fillStyle="rgba(240,240,240,0.6)",e.fillRect(0,0,this.w,this.h)));e.restore();this._image_pos_x=p;this._image_pos_y=q};a.Button.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>
(k(this.colorInt.r-this.color.r)+k(this.colorInt.g-this.color.g)+k(this.colorInt.b-this.color.b))/255)};a.Button.prototype.buttonPressed=function(){this.updateAndExecAction()};a.Button.prototype.addEvents=function(){function b(c,d,l){a.clearTimeout(f);e.buttonClick&&e.drawIfValue&&e.activeIfValue&&(d.call(e),c=l?c:100,f=a.setTimeout(function(){b(c,d,!1)},c))}function c(c){this.focus();c.preventDefault();c.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();e.whichBtn=
a.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&(e.buttonClick=!0,e.draw(),"calculate"==e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),b(1E3,e.buttonPressed,!0)),e.btn.removeEventListener("touchend",d),e.btn.addEventListener("touchend",d),e.btn.removeEventListener("mouseup",d),e.btn.addEventListener("mouseup",d))}function d(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(e.activeIfValue||e.buttonClick)e.buttonClick=!1,e.draw(),"calculate"!=e.action&&
(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),e.buttonPressed()),e.btn.removeEventListener("touchend",d),e.btn.removeEventListener("mouseup",d);e.parent.update()}var e=this,f;e.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",c);this.btn.addEventListener("mousedown",c);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();e.over=!0;e.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=
null;b.preventDefault();b.stopPropagation();e.over=!1;e.buttonClick=!1;e.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;e.buttonClick=!1})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w;a.Spinner=function(b,c){a.Control.call(this,b,c);this.tabindex=++this.parent.tabindex;"_._"==this.name&&(this.name="");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.container=document.createElement("div");this.canvas=document.createElement("canvas");this.divUp=document.createElement("div");
this.divDown=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.container.appendChild(this.label);this.container.appendChild(this.field);this.container.appendChild(this.canvas);this.container.appendChild(this.divUp);this.container.appendChild(this.divDown);this.addControlContainer(this.container);w=this.evaluator.parser.parse("1");this.originalIncr=this.incr;if(0>this.evaluator.eval(this.decimals)||0==this.evaluator.eval(this.incr))b=
this.evaluator.eval(this.incr),0<b?this.originalIncr=this.incr=this.evaluator.parser.parse(parseInt(b).toString()):this.incr=w;this.addEvents();this.init()};a.extend(a.Spinner,a.Control);a.Spinner.prototype.init=function(){g=this.evaluator;var b=g.eval(this.name).toString();this.label.innerHTML=b;this.value=this.validateValue(g.eval(this.valueExpr));var c=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var d=2!==this.parent.version?"__":
"_____",e=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),f=2+parseInt(this.h/2),l=parseInt(this.w/2-f/2);d=a.getTextWidth(b+d,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(l=this.w-f,e=0);l<d&&(l=d);""==b&&(l=0);this.w-l-f<e&&(l=this.w-f-e);0>l&&(l=0);b=this.w-(l+f);this.container.setAttribute("class","DescartesSpinnerContainer");this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.container.setAttribute("id",
this.id);this.canvas.setAttribute("width",f+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","position:absolute;left:"+l+"px;top:0;");this.ctx=this.canvas.getContext("2d");this.ctx.imageSmoothingEnabled=!1;d="opacity:0;cursor:pointer;position:absolute;width:"+f+"px;height:"+this.h/2+"px;left:"+l+"px;";this.divUp.setAttribute("class","up");this.divUp.setAttribute("style",d+"top:0;");this.divDown.setAttribute("class","down");this.divDown.setAttribute("style",d+"top:"+
this.h/2+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",this.id+"_spinner");this.field.setAttribute("class","DescartesSpinnerField");this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+(f+l)+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=c;this.visible||(this.field.style.display="none");this.label.setAttribute("class","DescartesSpinnerLabel");this.label.setAttribute("style",
"font-size:"+this.fieldFontSize+"px;width:"+l+"px;height:"+this.h+"px;line-height:"+this.h+"px;");g.setVariable(this.id,this.value);this.createGradient(this.h/2,this.h)};a.Spinner.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();0>g.eval(this.decimals)?(k=g.eval(this.incr),0<k?this.originalIncr=this.incr=g.parser.parse(parseInt(k).toString()):this.incr=w):this.incr=0!==g.eval(this.originalIncr)?this.originalIncr:w;this.activeIfValue=0<g.eval(this.activeif);
this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):(this.click=!1,this.container.style.display="none");this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,m=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==m&&this.field.value!=f&&(this.value=this.validateValue(f),
this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value))};a.Spinner.prototype.draw=function(){e=this.ctx;h=this.canvas.width;d=this.canvas.height;e.fillStyle="#f0f8ff";e.fillRect(0,0,h,d);e.fillStyle=this.linearGradient;e.fillRect(0,0,h,d);this.up?(c="gray",v="#f0f8ff"):(c="#f0f8ff",v="gray");a.drawLine(e,0,0,h,0,c);a.drawLine(e,0,0,0,d/2,c);a.drawLine(e,0,d/2,h,d/2,v);this.down?(c="gray",v="#f0f8ff"):(c="#f0f8ff",v="gray");a.drawLine(e,0,d/2+1,h,d/2+1,c);a.drawLine(e,
0,d/2+1,0,d,c);a.drawLine(e,0,d-1,h,d-1,v);l=[parseInt(h/2+1),parseInt(h/5+1),parseInt(h-h/5+1)];b=[parseInt(d/8+1),parseInt(d/8+1+d/4),parseInt(d/8+1+d/4)];e.fillStyle=this.activeIfValue?"#2244cc":"#8888aa";e.beginPath();e.moveTo(l[0],b[0]);e.lineTo(l[1],b[1]);e.lineTo(l[2],b[2]);e.fill();b=[parseInt(d-d/8),parseInt(d-d/8-d/4),parseInt(d-d/8-d/4)];e.fillStyle=this.activeIfValue?"#d00018":"#aa8888";e.beginPath();e.moveTo(l[0],b[0]);e.lineTo(l[1],b[1]);e.lineTo(l[2],b[2]);e.fill();e.fillStyle="rgba(0,0,0,"+
24/255+")";this.up&&e.fillRect(0,0,h,d/2);this.down&&e.fillRect(0,d/2,h,d)};a.Spinner.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,".");n=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(n)&&(n=0);q=g.eval(this.min);r=g.eval(this.max);""===q&&(q=-Infinity);""===r&&(r=Infinity);n=Math.min(Math.max(n,q),r);this.discrete&&(y=
g.eval(this.incr),n=0==y?0:y*Math.round(n/y));p=g.eval(this.decimals);0>=p&&(p=0);return n=parseFloat(parseFloat(n).toFixed(p))};a.Spinner.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};a.Spinner.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};a.Spinner.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())};a.Spinner.prototype.addEvents=function(){function b(c,d,e){a.clearTimeout(g);if(l.up||l.down)d.call(l),c=e?c:10,g=a.setTimeout(function(){b(c,d)},c)}function c(c){c.preventDefault();l.whichBtn=a.whichBtn(c);"L"==l.whichBtn&&l.activeIfValue&&(l.up=!0,b(n,l.increase,!0),l.draw())}function d(c){c.preventDefault();l.whichBtn=a.whichBtn(c);"L"==l.whichBtn&&l.activeIfValue&&(l.down=!0,b(n,l.decrease,!0),l.draw())}function e(b){l.up=
!1;a.clearTimeout(g);l.draw()}function f(b){l.down=!1;a.clearTimeout(g);l.draw()}u=a.hasTouchSupport;var l=this,n=u?500:200,g;l.divUp.oncontextmenu=l.divDown.oncontextmenu=l.field.oncontextmenu=l.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&&l.changeValue(l.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){l.up=!1;a.clearTimeout(g);l.draw();b.preventDefault()});this.divDown.addEventListener("mouseout",function(b){l.down=!1;a.clearTimeout(g);l.draw();b.preventDefault()});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){l.up=!1;l.down=!1;a.clearTimeout(g);l.draw()});l.field.addEventListener("click",function(a){this.select();this.focus()})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k=function(){function f(f,e){this.radio_group="";this.typeCtr="checkbox";this.pressed=!1;a.Control.call(this,f,e);this.radio_group=this.radio_group.trim();""!==this.radio_group&&(this.typeCtr="radio");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name.trim()+"'");this.tabindex=++this.parent.tabindex;this.containerControl=
document.createElement("div");this.checkbox=document.createElement("input");this.checkbox.setAttribute("type",this.typeCtr);""!==this.radio_group&&this.checkbox.setAttribute("name",this.radio_group);this.checkbox.internalID=this.id;this.label=document.createElement("label");this.dummyLabel=document.createElement("label");this.value=this.evaluator.eval(this.valueExpr);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.checkbox);this.containerControl.appendChild(this.dummyLabel);
this.addControlContainer(this.containerControl);this.addEvents();this.init()}a.extend(f,a.Control);f.prototype.init=function(f){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();this.labelFontSize=a.getFieldFontSize(this.h);f=Math.max(this.w-this.h,0);this.containerControl.setAttribute("class","DescartesCheckboxContainer");this.containerControl.setAttribute("style","width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.dummyLabel.setAttribute("style",
"position:absolute; width : "+this.h+"px; height : "+this.h+"px; left: "+f+"px;");this.dummyLabel.setAttribute("for",this.id+this.typeCtr);this.checkbox.setAttribute("type",this.typeCtr);this.checkbox.setAttribute("id",this.id+this.typeCtr);this.checkbox.setAttribute("class","DescartesCheckbox");this.checkbox.setAttribute("style","width : "+this.h+"px; height : "+this.h+"px; left: "+f+"px;");this.checkbox.setAttribute("tabindex",this.tabindex);this.checkbox.checked=0!=this.value;this.label.setAttribute("class",
"DescartesCheckboxLabel");this.label.setAttribute("style","font-size:"+this.labelFontSize+"px; width: "+f+"px; height: "+this.h+"px; line-height: "+this.h+"px;");this.evaluator.setVariable(this.id,this.value);this.update()};f.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();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;""===this.radio_group?this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=0!==this.value):(this.value=this.checkbox.checked?1:0,this.pressed&&(g.setVariable(this.radio_group,this.id),this.pressed=!1));g.setVariable(this.id,this.value)}this.updatePositionAndSize()};f.prototype.addEvents=function(){var f=this;f.checkbox.oncontextmenu=
f.label.oncontextmenu=f.dummyLabel.oncontextmenu=function(){return!1};f.label.addEventListener("touchstart",a.preventDefault);f.label.addEventListener("mousedown",a.preventDefault);f.dummyLabel.addEventListener("touchstart",a.preventDefault);f.dummyLabel.addEventListener("mousedown",a.preventDefault);f.checkbox.addEventListener("click",function(a){f.pressed=!0;f.updateAndExecAction()})};return f}();a.Checkbox=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.TextField=function(d,c){a.Control.call(this,d,c);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name.trim()+"'");void 0===this.valueExprString&&(this.valueExprString=this.onlyText?"0":"");this.emptyString=!1;this.ok=0;this.tabindex=++this.parent.tabindex;this.regExpDecimalSymbol=new RegExp("\\"+this.parent.decimal_symbol,
"g");this.answer&&(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answerPattern=this.answer,this.answer=a.buildRegularExpresionsPatterns(this.answer,this.evaluator),this.onlyText?(d=this.answerPattern.indexOf("|"),this.firstAnswer=-1==d?this.answerPattern:this.answerPattern.substring(0,d)):this.firstAnswer=this.parser.parse(this.answerPattern.substring(1,this.answerPattern.indexOf(","))));this.onlyText&&(this.valueExprString.match(/^'/)&&this.valueExprString.match(/'$/)||
(this.valueExpr=this.evaluator.parser.parse("'"+this.valueExprString+"'")),this.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},this.formatOutputValue=function(a){return a.toString()});""==name.trim()&&(name="");this.containerControl=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.field);
this.addControlContainer(this.containerControl);this.addEvents();this.init()};a.extend(a.TextField,a.Control);a.TextField.prototype.init=function(d){g=this.evaluator;var c=g.eval(this.name).toString();this.label.innerHTML=c;d||(this.value=this.validateValue(g.eval(this.valueExpr)));d=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var e=a.getTextWidth(d+"_",this.fieldFontSize+"px "+a.sansserif_font),f=parseInt(this.w/2),b=a.getTextWidth(c,this.fieldFontSize+"px "+
a.sansserif_font);this.visible||(f=this.w,e=0);f<b&&(f=b);""==c&&(f=0);this.w-f<e&&(f=this.w-e);0>f&&(f=0);c=this.w-f;this.containerControl.setAttribute("class","DescartesTextFieldContainer");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("type","text");this.field.setAttribute("id",this.id+"TextField");this.field.setAttribute("class","DescartesTextFieldField");this.field.setAttribute("style",
"font-size: "+this.fieldFontSize+"px; width : "+c+"px; height : "+this.h+"px; left: "+f+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=d;this.label.setAttribute("class","DescartesTextFieldLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+f+"px; height: "+this.h+"px; line-height: "+this.h+"px;");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()};a.TextField.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();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||(k=this.field.value,f=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=
this.formatOutputValue(this.value),this.value===f&&this.field.value!=k&&(this.value=this.validateValue(k),this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value));this.updatePositionAndSize()};a.TextField.prototype.validateValue=function(a){if(""===a||"''"==a)return"";g=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");m=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(m)&&(m=0);e=g.eval(this.min);h=g.eval(this.max);""===
e&&(e=-Infinity);h=g.eval(this.max);""===h&&(h=Infinity);m<e&&(m=e);m>h&&(m=h);this.discrete&&(a=g.eval(this.incr),m=0===a?0:a*Math.round(m/a));return m=parseFloat(parseFloat(m).toFixed(g.eval(this.decimals)))};a.TextField.prototype.formatOutputValue=function(a){return""===a?"":this.uber.formatOutputValue.call(this,a)};a.TextField.prototype.changeValue=function(a,c){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())};a.TextField.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};a.TextField.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};a.TextField.prototype.addEvents=function(){var d=this;d.field.oncontextmenu=d.label.oncontextmenu=function(){return!1};
d.label.addEventListener("touchstart",a.preventDefault);d.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){d.evaluator.eval(d.drawIf)&&d.changeValue(d.field.value,!0)});this.field.addEventListener("keydown",function(a){d.activeIfValue&&13==a.keyCode&&d.changeValue(d.field.value,!0)});d.field.addEventListener("click",function(a){this.select();this.focus()})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.abs,k,f,m,e,h,d,c,v,l,b;a.Menu=function(b,c){function d(a){e.options=a.split(",");e.menuOptions=[];e.strValue=[];a=0;for(var b=e.options.length;a<b;a++){var c=e.customSplit(e.options[a]);1==c.length?(e.menuOptions.push(c[0]),e.strValue.push(a.toString())):2==c.length&&(e.menuOptions.push(c[0]),""==c[1]?e.strValue.push(a.toString()):e.strValue.push(c[1]))}a=0;for(b=e.menuOptions.length;a<b;a++)e.menuOptions[a].match(/^\[/)&&e.menuOptions[a].match(/\]$/)?
e.menuOptions[a]=k.parse(e.menuOptions[a].substring(1,e.menuOptions[a].length-1)):e.menuOptions[a]=k.parse("'"+e.menuOptions[a]+"'");a=0;for(b=e.strValue.length;a<b;a++)e.strValue[a].match(/^\[/)&&e.strValue[a].match(/\]$/)?e.strValue[a]=k.parse(e.strValue[a].substring(1,e.strValue[a].length-1)):e.strValue[a]=k.parse(e.strValue[a]);for(;e.select.firstChild;)e.select.removeChild(e.select.firstChild);a=0;for(b=e.menuOptions.length;a<b;a++)c=document.createElement("option"),c.innerHTML=f.eval(e.menuOptions[a]),
e.select.appendChild(c);return 0}this.options="";a.Control.call(this,b,c);k=this.parser;f=this.evaluator;this.ok=0;this.tabindex=++this.parent.tabindex;this.answer&&(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answer=parseInt(this.answer.split(",")[0].replace("[",""))||0);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+
"'");var e=this;this.evaluator.setFunction(this.id+".setOptions",d);this.containerControl=document.createElement("div");this.label=document.createElement("label");this.select=document.createElement("select");this.field=document.createElement("input");d(this.options);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.select);this.visible&&this.containerControl.appendChild(this.field);this.addControlContainer(this.containerControl);this.addEvents();this.init()};a.extend(a.Menu,
a.Control);a.Menu.prototype.init=function(b){f=this.evaluator;var c=f.eval(this.name).toString();this.label.innerHTML=c;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var e=0,d=0;this.value=b?this.value:f.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var l=0,g=this.menuOptions.length;l<g;l++)b=a.getTextWidth(f.eval(this.menuOptions[l]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>e&&(e=b,d=l);e+=25;b=a.getTextWidth(this.formatOutputValue(f.eval(this.strValue[d])),
this.fieldFontSize+"px "+a.sansserif_font)+7;d=a.getTextWidth(c,this.fieldFontSize+"px "+a.sansserif_font)+10;""==c&&(d=0);this.visible||(b=0);for(c=this.w-b-d;c<e&&0<d;)d--,c++;for(;c<e&&0<b;)b--,c++;for(;d+c+b+1<this.w;)c++,b++;e=d;l=e+c;b=this.w-l;g=this.formatOutputValue(f.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("class","DescartesMenuContainer");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("class","DescartesMenuLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width:"+d+"px; height:"+this.h+"px; line-height:"+this.h+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",this.id+"_menuField");this.field.value=g;this.field.setAttribute("class","DescartesMenuField");this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width: "+b+"px; height: "+this.h+"px; left:"+l+"px;");
this.field.setAttribute("tabindex",this.tabindex);this.select.setAttribute("id",this.id+"_menuSelect");this.select.setAttribute("class","DescartesMenuSelect");this.select.setAttribute("style","text-align:left; font-size:"+this.fieldFontSize+"px; width: "+c+"px; height: "+this.h+"px; left: "+e+"px;");this.select.setAttribute("tabindex",this.tabindex);this.select.selectedIndex=this.indexValue;f.setVariable(this.id,parseFloat(g.replace(this.parent.decimal_symbol,".")));this.update()};a.Menu.prototype.update=
function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){this.label.innerHTML=f.eval(this.name).toString();for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=
f.eval(this.menuOptions[a]);this.value=f.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);f.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()};a.Menu.prototype.customSplit=function(a){d=!1;c="";v=0;for(l=-1;v<a.length;){b=a.charAt(v);a.charAt(v-1);if("["===b&&-1===l){if(d||
""!=c)c+="\u00a6";l++}else"["===b?l++:"]"===b&&0===l?(d=!0,l--):"]"==a.charAt(v)&&(l=0>l?l:l-1);c+=a.charAt(v);v++}return c.split("\u00a6")};a.Menu.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));m=-1;e=Infinity;for(var b=0,c=this.strValue.length;b<c;b++)h=g(a-parseFloat(this.evaluator.eval(this.strValue[b]))),h<=e&&(e=h,m=b);return m};a.Menu.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};
a.Menu.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.select.addEventListener("change",function(a){b.value=b.evaluator.eval(b.strValue[this.selectedIndex]);b.field.value=b.formatOutputValue(b.value);b.evaluator.setVariable(b.id,b.field.value);b.changeValue();a.preventDefault()});this.field.addEventListener("keydown",
function(a){13==a.keyCode&&(b.indexValue=b.getIndex(b.field.value),b.value=b.evaluator.eval(b.strValue[b.indexValue]),b.field.value=b.formatOutputValue(b.indexValue),b.select.selectedIndex=b.indexValue,b.changeValue())});b.field.addEventListener("click",function(a){this.focus()})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w,x;a.Scrollbar=function(b,c){a.Control.call(this,b,c);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.orientation=this.w>=this.h?"h":"v";this.container=document.createElement("div");this.canvas=document.createElement("canvas");this.divUp=document.createElement("div");
this.divDown=document.createElement("div");this.field=document.createElement("input");this.scrollHandler=document.createElement("div");this.label=document.createElement("label");this.container.appendChild(this.canvas);this.container.appendChild(this.label);this.container.appendChild(this.divUp);this.container.appendChild(this.divDown);this.container.appendChild(this.field);this.container.appendChild(this.scrollHandler);this.addControlContainer(this.container);this.addEvents();this.init()};a.extend(a.Scrollbar,
a.Control);a.Scrollbar.prototype.init=function(){k=this.evaluator;0==k.eval(this.decimals)?this.incr=1:this.incr=(k.eval(this.max)-k.eval(this.min))/100;this.value=this.validateValue(k.eval(this.valueExpr));m=this.formatOutputValue(this.value);e=this.evaluator.eval(this.expresion);this.x=e[0][0];this.y=e[0][1];4==e[0].length&&(this.w=e[0][2],this.h=e[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(m);this.changeScrollPositionFromValue();this.prePos=this.pos;k.setVariable(this.id,this.value)};
a.Scrollbar.prototype.initScroll=function(b){f=this;k=f.evaluator;x=k.eval(f.name).toString();f.label.innerHTML=x;var c="v"===f.orientation?parseInt(19+5*(f.h-100)/100):f.h;f.fieldFontSize="v"===f.orientation?c-parseInt(f.h/20)-1:2!==f.parent.version?a.getFieldFontSize(c):10;var e=a.getTextWidth(b+"_",f.fieldFontSize+"px "+a.sansserif_font),d=f.parent.getSpaceById(f.spaceID).h;f.labelHeight=""==x?0:c;f.fieldHeight=""==f.visible?0:c;if("v"===f.orientation)f.canvasWidth=f.w,f.canvasHeight=f.h-f.labelHeight-
f.fieldHeight,18<=f.canvasHeight+f.y-d&&(f.canvasHeight=d),e=f.fieldHeight,c=e+f.canvasHeight,f.canvasX=0,f.canvasY=f.fieldHeight,f.labelWidth=f.w,f.labelY=c,f.upWidth=f.downW=f.w,f.upHeight=f.downH=15,f.upX=0,f.upY=f.fieldHeight,f.downX=0,f.downY=c-f.downH,f.fieldWidth=f.w,f.fieldX=0,f.scrollHandlerW=f.w,f.scrollHandlerH=parseInt((f.canvasHeight-f.upHeight-f.downH-f.labelHeight-f.fieldHeight)/10),f.scrollHandlerH=15>f.scrollHandlerH?15:f.scrollHandlerH,f.limInf=c-f.downH-f.scrollHandlerH,f.limSup=
e+f.downH;else{c=a.getTextWidth(x,f.fieldFontSize+"px "+a.sansserif_font)+10;f.labelWidth=c;f.fieldWidth=e;""==x&&(f.labelWidth=0);f.visible||(f.fieldWidth=0);for(c=f.w-f.fieldWidth-f.labelWidth;58>c&&0<f.labelWidth;)f.labelWidth--,c++;for(;58>c&&0<f.fieldWidth;)f.fieldWidth--,c++;e=f.labelWidth;d=e+c;f.fieldWidth=f.w-d;f.canvasWidth=c;f.canvasHeight=f.h;f.canvasX=f.labelWidth;f.canvasY=0;f.fieldX=f.canvasWidth+f.labelWidth;f.labelHeight=f.h;f.labelY=0;f.upWidth=f.downW=15;f.upHeight=f.downH=f.h;
f.upX=d-f.downW;f.upY=0;f.downX=f.labelWidth;f.downY=0;f.scrollHandlerW=parseInt((f.canvasWidth-f.upWidth-f.downW)/10);f.scrollHandlerW=15>f.scrollHandlerW?15:f.scrollHandlerW;f.scrollHandlerH=f.h;f.limInf=e+f.downW;f.limSup=e+f.canvasWidth-f.downW-f.scrollHandlerW}f.container.setAttribute("class","DescartesScrollbarContainer");f.container.setAttribute("id",f.id);f.container.setAttribute("style","width: "+f.w+"px; height: "+f.h+"px; left: "+f.x+"px; top: "+f.y+"px; z-index: "+f.zIndex+";");f.canvas.setAttribute("width",
f.w+"px");f.canvas.setAttribute("height",f.h+"px");f.canvas.setAttribute("style","position: absolute; left: 0px; top: 0px;");f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.divUp.setAttribute("class","DescartesCatcher up");f.divUp.setAttribute("style","width : "+f.upWidth+"px; height : "+f.upHeight+"px; left: "+f.upX+"px; top: "+f.upY+"px;");f.divDown.setAttribute("class","DescartesCatcher down");f.divDown.setAttribute("style","width : "+f.downW+"px; height : "+f.downH+"px; left: "+
f.downX+"px; top: "+f.downY+"px;");f.scrollHandler.setAttribute("class","DescartesCatcher manipulator");f.scrollHandler.setAttribute("style","width : "+f.scrollHandlerW+"px; height : "+f.scrollHandlerH+"px;");f.scrollHandler.style.top=("v"===f.orientation?f.limInf:0)+"px";f.scrollHandler.style.left=("v"===f.orientation?0:f.limInf)+"px";f.field.setAttribute("type","text");f.field.setAttribute("id",f.id+"scrollbar");f.field.setAttribute("class","DescartesScrollbarField");f.field.setAttribute("style",
"font-size: "+f.fieldFontSize+"px; width : "+f.fieldWidth+"px; height : "+f.fieldHeight+"px; left: "+f.fieldX+"px; top: 0px;");f.field.value=b;0===f.fieldHeight&&(f.field.style.display="none");f.label.setAttribute("class","DescartesScrollbarLabel");f.label.setAttribute("style","font-size:"+f.fieldFontSize+"px; width: "+f.labelWidth+"px; height: "+f.labelHeight+"px; line-height: "+f.labelHeight+"px; left: 0px; top:"+f.labelY+"px;")};a.Scrollbar.prototype.update=function(){k=this.evaluator;this.label.innerHTML=
k.eval(this.name).toString();0==k.eval(this.decimals)?this.incr=1:this.incr=(k.eval(this.max)-k.eval(this.min))/100;this.activeIfValue=0<k.eval(this.activeif);this.drawIfValue=0<k.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(k.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);k.setVariable(this.id,this.value)};a.Scrollbar.prototype.draw=function(){f=this;h=f.ctx;c=g(this.w);d=g(this.h);h.fillStyle="#e0e4e8";h.fillRect(0,0,c,d);h.strokeStyle="#7a8a99";f.down&&(h.fillStyle="#ccdcec",h.fillRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1));h.strokeRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1);f.up&&(h.fillStyle="#ccdcec",h.fillRect(f.upX+.5,f.upY-.5,f.upWidth,
f.upHeight+1));h.strokeRect(f.upX+.5,f.upY-.5,f.upWidth,f.upHeight+1);v=4;h.fillStyle="black";h.beginPath();"h"===f.orientation?(h.moveTo(f.downX+v,f.downH/2),h.lineTo(f.downX+f.downW-v,v),h.lineTo(f.downX+f.downW-v,f.downH-v),h.moveTo(f.upX+f.upWidth-v,f.downH/2),h.lineTo(f.upX+v,v),h.lineTo(f.upX+v,f.downH-v),h.fill(),f.activeIfValue&&(l=g(f.pos),h.fillStyle="#ccdcec",h.fillRect(l+.5,0,g(f.scrollHandlerW),d),h.strokeStyle="#6382bf",h.strokeRect(l+.5,0,g(f.scrollHandlerW),d),b=g(f.scrollHandlerW/
2),h.beginPath(),h.moveTo(l+b+.5-2,3),h.lineTo(l+b+.5-2,d-3),h.moveTo(l+b+.5,3),h.lineTo(l+b+.5,d-3),h.moveTo(l+b+.5+2,3),h.lineTo(l+b+.5+2,d-3),h.stroke())):(h.moveTo(f.downX+f.downW/2,f.downY+f.downH-v),h.lineTo(f.downX+v,f.downY+v),h.lineTo(f.downX+f.downW-v,f.downY+v),h.moveTo(f.upX+f.upWidth/2,f.upY+v),h.lineTo(f.upX+v,f.upY+f.upHeight-v),h.lineTo(f.upX+f.upWidth-v,f.upY+f.upHeight-v),h.fill(),f.activeIfValue&&(l=g(f.pos),h.fillStyle="#ccdcec",h.fillRect(0,l+.5,c,g(f.scrollHandlerH)),h.strokeStyle=
"#6382bf",h.strokeRect(0,l+.5,c,g(f.scrollHandlerH)),b=g(f.scrollHandlerH/2),h.beginPath(),h.moveTo(3,l+b+.5-2),h.lineTo(c-3,l+b+.5-2),h.moveTo(3,l+b+.5),h.lineTo(c-3,l+b+.5),h.moveTo(3,l+b+.5+2),h.lineTo(c-3,l+b+.5+2),h.stroke()));h.strokeRect(.5,.5,c-1,d-1);f.activeIfValue||(h.fillStyle="rgba(240,240,240,"+160/255+")",h.fillRect(0,0,c,d.h))};a.Scrollbar.prototype.validateValue=function(a){k=this.evaluator;n=a.toString();n=parseFloat(n.replace(this.parent.decimal_symbol,"."));isNaN(n)&&(n=0);this.minimo=
k.eval(this.min);n<this.minimo&&(this.value=null,n=this.minimo);this.maximo=k.eval(this.max);n>this.maximo&&(this.value=null,n=this.maximo);y=this.incr;n=0!=y?n*y/y:0;this.fixed&&(n=parseFloat(parseFloat(n).toFixed(k.eval(this.decimals))));return n};a.Scrollbar.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};a.Scrollbar.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};a.Scrollbar.prototype.increase10=function(){v=(this.evaluator.eval(this.max)-
this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+v):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+v)};a.Scrollbar.prototype.decrease10=function(){v=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-v):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-v)};a.Scrollbar.prototype.changeValue=
function(a){this.activeIfValue&&(p=this.validateValue(a),p!=this.value&&(this.value=p,this.field.value=this.formatOutputValue(p),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction()))};a.Scrollbar.prototype.changeValueForScrollMovement=function(){k=this.evaluator;q=this.limInf;r=this.limSup;u=k.eval(this.min);w=k.eval(this.max);y=this.incr;p=g((this.pos-q)*(w-u)/(r-q)/y)*y+u;p!=this.value&&(this.value=p,this.field.value=
this.formatOutputValue(p),k.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};a.Scrollbar.prototype.changeScrollPositionFromValue=function(){k=this.evaluator;q=this.limInf;r=this.limSup;u=k.eval(this.min);w=k.eval(this.max);y=this.incr;this.pos=(this.value-u)*(r-q)/(w-u)+q;"h"==this.orientation?this.scrollHandler.style.left=this.pos+"px":this.scrollHandler.style.top=this.pos+"px"};a.Scrollbar.prototype.addEvents=function(){function b(c,e,
d,f){a.clearTimeout(r);(h.up||h.down||h.canvasClick)&&1E-7<Math.abs(h.value-f)&&(e.call(h),c=d?c:30,r=a.setTimeout(function(){b(c,e,!1,f)},c))}function c(c){c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.clickPos=a.getCursorPosition(c,h.container),h.canvasClick=!0,"h"==h.orientation?h.clickPos.x<h.prePos?b(350,h.decrease10,!0,h.minimo):b(350,h.increase10,!0,h.maximo):h.clickPos.y<h.prePos?b(350,h.increase10,!0,h.maximo):b(350,h.decrease10,!0,h.minimo))}function e(b){h.canvasClick=
!1;a.clearTimeout(r)}function d(b){1==h.canvasClick&&(h.clickPos=a.getCursorPosition(b,h.container),b.preventDefault())}function f(a){h.scrollClick=!1;h.prePos=h.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",g,!1);a.preventDefault()}function l(a){h.scrollClick=!1;h.prePos=h.pos;window.removeEventListener("touchend",l,!1);window.removeEventListener("touchmove",g,!1);a.preventDefault()}function g(b){var c=a.getCursorPosition(b,h.container);"h"==h.orientation?
(h.pos=h.prePos-(h.initPos.x-c.x),h.pos<h.limInf&&(h.pos=h.limInf),h.pos>h.limSup&&(h.pos=h.limSup),h.scrollHandler.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+h.scrollHandlerW+"px; height : "+h.h+"px; left: "+h.pos+"px; top: 0px;")):(h.pos=h.prePos-(h.initPos.y-c.y),h.pos>h.limInf&&(h.pos=h.limInf),h.pos<h.limSup&&(h.pos=h.limSup),h.scrollHandler.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+
h.w+"px; height : "+h.scrollHandlerH+"px; left: 0px; top: "+h.pos+"px;"));h.changeValueForScrollMovement();b.preventDefault()}function n(c){c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.up=!0,b(350,h.increase,!0,h.maximo))}function k(c){c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.down=!0,b(350,h.decrease,!0,h.minimo))}function p(b){h.down=!1;a.clearTimeout(r);b.preventDefault()}function q(b){h.up=!1;a.clearTimeout(r);h.draw()}
function m(b){h.down=!1;a.clearTimeout(r);h.draw()}var h=this,r;h.canvas.oncontextmenu=h.divUp.oncontextmenu=h.divDown.oncontextmenu=h.label.oncontextmenu=h.field.oncontextmenu=h.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&h.changeValue(h.field.value)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",p);window.addEventListener("touchend",e);window.addEventListener("mouseup",
e);this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("mousemove",d);this.scrollHandler.addEventListener("touchstart",function(b){h.activeIfValue&&(h.scrollClick=!0,h.initPos=a.getCursorPosition(b,h.container),window.addEventListener("touchend",l),window.addEventListener("touchmove",g),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){h.activeIfValue&&(h.scrollClick=!0,h.initPos=a.getCursorPosition(b,h.container),window.addEventListener("mouseup",
f),window.addEventListener("mousemove",g),b.preventDefault())});this.divUp.addEventListener("touchstart",n);this.divUp.addEventListener("mousedown",n);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(b){h.up=!1;a.clearTimeout(r);b.preventDefault()});this.divDown.addEventListener("mouseout",p);window.addEventListener("touchend",q);window.addEventListener("mouseup",q);window.addEventListener("touchend",m);window.addEventListener("mouseup",
m)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.Audio=function(f,g){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,f,g);var e=this;f=e.evaluator.eval(e.expresion);4==f[0].length?(e.w=f[0][2],e.h=f[0][3]):(e.w=200,e.h=28);e.audio=e.parent.getAudio(e.file);e.oldFile=e.file;"]"===e.file.charAt(e.file.length-1)&&(e.file=e.evaluator.parser.parse(e.file.substring(1,e.file.length-1)));e.autoplay&&(e.audio.setAttribute("autoplay","autoplay"),e.audio.play());e.loop&&e.audio.setAttribute("loop",
"loop");e.controls&&e.audio.setAttribute("controls","controls");e.audio.setAttribute("style","position: absolute; width: "+e.w+"px; left: "+e.x+"px; top: "+e.y+"px; z-index: "+e.zIndex+";");e.addControlContainer(e.audio);e.evaluator.setFunction(e.id+".play",function(){try{e.audio.play()}catch(h){}return 0});e.evaluator.setFunction(e.id+".pause",function(){try{e.audio.pause()}catch(h){}return 0});e.evaluator.setFunction(e.id+".stop",function(){try{e.audio.pause(),e.audio.currentTime=0}catch(h){}return 0});
e.evaluator.setFunction(e.id+".currentTime",function(a){try{e.audio.currentTime=parseFloat(a)}catch(d){}return 0});e.audio.addEventListener("timeupdate",function(a){e.evaluator.setVariable(e.id+".currentTime",e.audio.currentTime)})};a.extend(a.Audio,a.Control);a.Audio.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};var k;a.Audio.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));(k=0<g.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",k!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=k;this.updatePositionAndSize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.Video=function(f,k){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,f,k);var e=this;g=e.evaluator;f=e.evaluator.eval(e.expresion);4==f[0].length?(e.w=f[0][2],e.h=f[0][3]):(e.w=null,e.h=null);f=e.file;k=f.lastIndexOf(".");-1!=k&&(f=e.file.substring(0,k));e.video=document.createElement("video");e.autoplay&&e.video.setAttribute("autoplay","autoplay");e.loop&&e.video.setAttribute("loop","loop");e.controls&&e.video.setAttribute("controls",
"controls");e.video.setAttribute("poster",f+".png");e.w&&(e.video.setAttribute("width",e.w),e.video.setAttribute("height",e.h));e.video.setAttribute("style","position:absolute; overflow:hidden; left:"+e.x+"px; top:"+e.y+"px; outline:none; background:rgba(0,0,0,0);");e.video.canPlayType("video/mp4")&&(k=document.createElement("source"),k.setAttribute("src",f+".mp4"),e.video.appendChild(k));e.video.canPlayType("video/ogg")&&(k=document.createElement("source"),k.setAttribute("src",f+".ogg"),k.setAttribute("type",
"video/ogg"),e.video.appendChild(k),k=document.createElement("source"),k.setAttribute("src",f+".ogv"),k.setAttribute("type","video/ogg"),e.video.appendChild(k));e.video.canPlayType("video/webm")&&(k=document.createElement("source"),k.setAttribute("src",f+".webm"),k.setAttribute("type","video/webm"),e.video.appendChild(k));e.addControlContainer(e.video);e.evaluator.setFunction(e.id+".play",function(){try{e.video.play()}catch(h){}return 0});e.evaluator.setFunction(e.id+".pause",function(){try{e.video.pause()}catch(h){}return 0});
e.evaluator.setFunction(e.id+".stop",function(){try{e.video.pause(),e.video.currentTime=0}catch(h){}return 0});e.evaluator.setFunction(e.id+".currentTime",function(a){try{e.video.currentTime=parseFloat(a)}catch(d){}return 0});e.video.addEventListener("timeupdate",function(a){e.evaluator.setVariable(e.id+".currentTime",e.video.currentTime)})};a.extend(a.Video,a.Control);a.Video.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};var k;a.Video.prototype.update=
function(){g=this.evaluator;(k=0<g.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",k!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=k;this.updatePositionAndSize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f;a.TextArea=function(f,e){this.font="Monospaced,PLAIN,12";a.Control.call(this,f,e);this.region="interior";this.tabindex=++this.parent.tabindex;if(this.answer){this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7)));var g=this.parent.lessonParser.parseText(this.answer)}this.containerControl=document.createElement("div");this.textArea=document.createElement("div");this.textAreaAnswer=document.createElement("div");
this.showButton=document.createElement("div");this.activeCover=document.createElement("div");this.containerControl.appendChild(this.textArea);this.containerControl.appendChild(this.textAreaAnswer);this.containerControl.appendChild(this.showButton);this.containerControl.appendChild(this.activeCover);this.addControlContainer(this.containerControl);this.showAnswer=!1;this.text=void 0==this.text||"simpleText"==this.text.type?this.rawText||"":this.text.hasFormula?this.rawText:this.text.toHTML();g&&"simpleText"!==
g.type&&(this.answer=this.text.hasFormula?"":g.toHTML());this.evaluator.setVariable(this.id,this.text);this.drawButton();var d=this,c,k,l;this.evaluator.setFunction(this.id+".insertAtCursor",function(a){(c=window.getSelection())&&c.getRangeAt&&c.rangeCount&&(l=document.createTextNode(a),k=c.getRangeAt(0),k.deleteContents(),k.insertNode(l),k.setStart(l,l.length),k.setEnd(l,l.length),c.removeAllRanges(),c.addRange(k),d.textArea.focus());return 0});this.evaluator.setFunction(this.id+".update",function(){d.update()});
this.addEvents();this.init()};a.extend(a.TextArea,a.Control);a.TextArea.prototype.init=function(){k=this.answer?28:4;g=this.evaluator;var f=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");this.containerControl.setAttribute("class","DescartesTextAreaContainer");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.containerControl.style.display=0<g.eval(this.drawif)?"block":
"none";this.containerControl.setAttribute("spellcheck","false");this.textArea.setAttribute("class","DescartesTextAreaContainer");this.textArea.setAttribute("style","padding: 5px; width: "+(this.w-4)+"px; height: "+(this.h-k)+"px; left: 2px; top: 2px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");this.textArea.setAttribute("contenteditable","true");this.textArea.innerHTML=f;this.textAreaAnswer.setAttribute("class","DescartesTextAreaContainer");this.textAreaAnswer.setAttribute("style",
"width: "+(this.w-8)+"px; height: "+(this.h-k)+"px; left: 4px; top: 4px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");this.textAreaAnswer.style.display=this.showAnswer?"block":"none";this.textAreaAnswer.innerHTML="<span style='position: relative; top: 10px; left: 10px; white-space: nowrap;'>"+this.answer+"</span>";this.showButton.setAttribute("style","width: 20px; height: 16px; position: absolute; bottom: 4px; right: 4px; cursor: pointer;");this.showButton.style.backgroundImage=
"url("+this.imageUnPush+")";this.showButton.style.display=this.answer?"block":"none";this.showButton.innerHTML="<span style='position: relative; top: 2px; text-align: center; font: 9px Arial'> 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()};a.TextArea.prototype.drawButton=function(){var f=document.createElement("canvas");f.setAttribute("width",20);f.setAttribute("height",16);var e=
f.getContext("2d");e.imageSmoothingEnabled=!1;this.canvas=f;this.ctx=e;this.createGradient(20,16);e.lineWidth=1;e.fillStyle="white";e.fillRect(0,0,20,16);e.fillStyle=this.linearGradient;e.fillRect(0,0,20,16);a.drawLine(e,19,0,19,16,"rgba(0,0,0,"+128/255+")");a.drawLine(e,0,0,0,16,"rgba(0,0,0,"+24/255+")");a.drawLine(e,1,0,1,16,"rgba(0,0,0,"+8/255+")");this.imageUnPush=f.toDataURL();e.fillStyle="white";e.fillRect(0,0,20,16);e.fillStyle=this.linearGradient;e.fillRect(0,0,20,16);a.drawLine(e,0,0,0,14,
"gray");a.drawLine(e,0,0,19,0,"gray");e.fillStyle="rgba(0, 0, 0,"+24/255+")";e.fillRect(0,0,this.w,this.h);this.imagePush=f.toDataURL()};a.TextArea.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"));f=this.textArea.innerText||"";f="\n"===f.charAt(f.length-1)?f.substring(0,f.length-1):f;f=f.replace(/\n/g,"\\n").replace(/\s/g,
" ");g.setVariable(this.id,f);this.oldFieldValue=f;this.oldValue=g.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};a.TextArea.prototype.addEvents=function(){function a(a){a.preventDefault();e.showButton.style.backgroundImage="url("+e.imageUnPush+")"}var e=this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();e.showAnswer=!e.showAnswer;e.textAreaAnswer.style.display=
e.showAnswer?"block":"none";e.showButton.childNodes[0].childNodes[0].textContent=e.showAnswer?"T":"S";e.showButton.style.backgroundImage="url("+e.imagePush+")"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();e.cursorInd=a.focusOffset})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,k,f,m,e,h,d,c,v,l,b;a.GraphicControl=function(b,c){f=b.evaluator.parser;this.text=this.spaceID="";this.size=f.parse("4");this.font="Monospaced,PLAIN,12";this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";a.Control.call(this,b,c);this.font=a.convertFont(this.font);if(this.constraintExpr){this.constraint=f.parse(this.constraintExpr);"(expr)"==this.constraint.type&&(this.constraint=f.parse(this.constraintExpr.substring(1,
this.constraintExpr.length-1)));if("compOperator"==this.constraint.type){c=this.constraint.childs[0];var e=this.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||e.contains("y")?"identifier"!=c.type||"x"!=c.value||e.contains("x")?this.newt=new a.R2Newton(this.evaluator,this.constraint):(this.constVar="y",this.noConstVar="x",this.evalConst=this.evalConstXoY,this.constraint=e):(this.constVar="x",this.noConstVar="y",this.evalConst=this.evalConstXoY,this.constraint=e)}else this.constraint=null;
v=new a.R2(0,0)}this.container=this.getContainer();this.mouseCacher=document.createElement("div");this.mouseCacher.setAttribute("class","DescartesGraphicControl");this.mouseCacher.setAttribute("id",this.id);this.mouseCacher.setAttribute("dragged",!0);this.mouseCacher.setAttribute("tabindex","-1");this.ctx=this.space.ctx;this.container.appendChild(this.mouseCacher);this.addEvents();this.xStr=this.id+".x";this.yStr=this.id+".y";this.activoStr=this.id+".activo";this.activeStr=this.id+".active";""!==
this.space.id&&2!==b.version?(this.mxStr=this.space.id+".mouse_x",this.myStr=this.space.id+".mouse_y",this.mclickedStr=this.space.id+".mouse_clicked",this.mclicizquierdoStr=this.space.id+".clic_izquierdo"):(this.mxStr="mouse_x",this.myStr="mouse_y",this.mclickedStr="mouse_clicked",this.mclicizquierdoStr="clic_izquierdo");this.init()};a.GraphicControl.prototype.init=function(){k=this.evaluator;l=a.hasTouchSupport;var b=k.eval(this.expresion);this.x=b[0][0];this.y=b[0][1];k.setVariable(this.xStr,this.x);
k.setVariable(this.yStr,this.y);this.mouseCacher.setAttribute("style","cursor:pointer;background-color:rgba(255, 255, 255, 0);z-index:"+this.zIndex+";");""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*k.eval(this.size),this.height=2*k.eval(this.size),this._w=l&&48>this.width?48:this.width,this._h=l&&48>this.height?48:this.height,this.mouseCacher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.imageSrc),this.width=
this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCacher.style.width=this._w+"px";this.mouseCacher.style.height=this._h+"px";this.mouseCacher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCacher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";k.setVariable(this.activoStr,0);k.setVariable(this.activeStr,0);this.setImage=!1;this.update()};a.GraphicControl.prototype.update=function(){k=
this.evaluator;this.activeIfValue=0<k.eval(this.activeif);this.drawIfValue=0<k.eval(this.drawif);this.x=k.getVariable(this.xStr);this.y=k.getVariable(this.yStr);m=this.space.getAbsoluteX(this.x);e=this.space.getAbsoluteY(this.y);this.mouseCacher.style.display=this.activeIfValue?"block":"none";this.mouseCacher.style.left=parseInt(m-this._w/2)+"px";this.mouseCacher.style.top=parseInt(e-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};a.GraphicControl.prototype.draw=function(){k=this.evaluator;
this.drawIfValue&&(d=this.ctx,c=this.space.backgroundCtx,m=parseInt(this.space.getAbsoluteX(this.x))+.5,e=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(m,e),this.image.ready?(this.image.complete&&!this.setImage&&d.drawImage(this.image,parseInt(m-this.image.width/2),parseInt(e-this.image.height/2)),this.trace&&(c.save(),c.translate(m,e),c.scale(parseInt(this.image.width/2),parseInt(this.image.height/2)),c.beginPath(),c.arc(0,0,1,0,g,!1),c.restore(),c.lineWidth=1,c.strokeStyle=
this.trace.getColor(),c.stroke())):(d.beginPath(),d.arc(m,e,parseInt(this.width/2),0,g,!1),d.fillStyle=this.colorInt.getColor(),d.fill(),d.lineWidth=1,d.strokeStyle=this.color.getColor(),d.stroke(),this.active&&(d.strokeStyle=this.colorInt.borderColor(),d.beginPath(),d.arc(m,e,parseInt(this.width/2)-2,0,g,!1),d.stroke()),this.trace&&(c.strokeStyle=this.trace.getColor(),c.beginPath(),c.arc(m,e,parseInt(this.width/2),0,g,!1),c.stroke())))};a.GraphicControl.prototype.evalConst=function(){v.set(this.x,
this.y);h=this.newt.findZero(v,1/this.space.scale,!0);this.x=h.x;this.y=h.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};a.GraphicControl.prototype.evalConstXoY=function(){k=this.evaluator;b=k.getVariable(this.constVar);k.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=k.eval(this.constraint);k.setVariable(this.xStr,this.x);k.setVariable(this.yStr,this.y);k.setVariable(this.constVar,b)};a.GraphicControl.prototype.drawText=function(a,
b){d=this.ctx;k=this.evaluator;"simpleText"==this.text.type?(d.fillStyle=this.color.getColor(),d.font=this.font,d.textBaseline="alphabetic",d.fillText(this.text.toString(k.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))):(d.fillStyle=this.color.getColor(),d.strokeStyle=this.color.getColor(),d.textBaseline="alphabetic",this.text.draw(d,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};a.GraphicControl.prototype.getContainer=
function(){for(var a=this.parent.spaces,b,c=0,e=a.length;c<e;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};a.GraphicControl.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,0)};a.GraphicControl.prototype.addEvents=
function(){function b(e){document.body.focus();e.preventDefault();e.stopPropagation();d.evaluator.setVariable(d.mclickedStr,1);d.evaluator.setVariable(d.mclicizquierdoStr,1);if(d.activeIfValue||d.active)d.click=!1,window.removeEventListener("mouseup",b,!1),window.removeEventListener("mousemove",c,!1),window.removeEventListener("touchend",b,!1),window.removeEventListener("touchmove",c,!1),f=a.getCursorPosition(e,d.container),d.posX=d.prePos.x-(d.posAnte.x-f.x),d.posY=d.prePos.y-(d.posAnte.y-f.y),d.evaluator.setVariable(d.xStr,
d.space.getRelativeX(d.posX)),d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY)),d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(f.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(f.y)),d.parent.updateControls(),d.parent.update(),d.mouseCacher.style.left=d.space.getAbsoluteX(d.x)-d._w/2+"px",d.mouseCacher.style.top=d.space.getAbsoluteY(d.y)-d._h/2+"px";d.parent.deactivateGraphiControls()}function c(b){b.preventDefault();d.evaluator.setVariable(d.mclickedStr,0);d.evaluator.setVariable(d.mclicizquierdoStr,
0);f=a.getCursorPosition(b,d.container);d.posX=d.prePos.x-(d.posAnte.x-f.x);d.posY=d.prePos.y-(d.posAnte.y-f.y);d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX));d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY));d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(f.x));d.evaluator.setVariable(d.myStr,d.space.getRelativeY(f.y));20<Date.now()-e&&(d.parent.updateControls(),d.parent.update(),e=Date.now())}var e=0,d=this;this.active=this.over=this.click=!1;this.mouseCacher.oncontextmenu=
function(){return!1};this.mouseCacher.addEventListener("touchstart",function(e){document.body.focus();e.preventDefault();d.activeIfValue&&(d.parent.deactivateGraphiControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,1),d.evaluator.setVariable(d.activeStr,1),d.evaluator.setVariable(d.mclickedStr,0),d.evaluator.setVariable(d.mclicizquierdoStr,0),d.posAnte=a.getCursorPosition(e,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mxStr,
d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("touchend",b),window.addEventListener("touchmove",c))});this.mouseCacher.addEventListener("mousedown",function(e){document.body.focus();e.preventDefault();d.whichBtn=a.whichBtn(e);"L"==d.whichBtn&&d.activeIfValue&&d.over&&(d.parent.deactivateGraphiControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,1),d.evaluator.setVariable(d.activeStr,1),
d.evaluator.setVariable(d.mclickedStr,0),d.evaluator.setVariable(d.mclicizquierdoStr,0),d.posAnte=a.getCursorPosition(e,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("mouseup",b),window.addEventListener("mousemove",c))});this.mouseCacher.addEventListener("mouseover",function(a){d.over=!0});
this.mouseCacher.addEventListener("mouseout",function(a){d.over=!1;d.click=!1});var f};return a}(descartesJS||{});
descartesJS=function(a,g){var k,f,m,e,h,d,c,v,l,b;if(a.loadLib)return a;var n,y,p,q,r,u,w,x,B=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,D,H,G,I,E,A,F,J,K,L,z,N,C,O,M,P,Q,U,T,S,R;a.LessonParser=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};a.LessonParser.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(p=a[c][0],q=a[c][1],y=g[p],y){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[y]=
parseInt(q);break;case "about":case "config":case "init":case "clear":b[y]="true"===g[q];break;default:console.log("Propiedad de botones no identificada: <"+p+"> valor: <"+q+">")}return b};a.LessonParser.prototype.parseSpace=function(b){r={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(p=b[c][0],q=b[c][1],y=g[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Space",y){case "id":a.DEBUG.idName=q;case "x_axis":case "y_axis":case "type":case "cID":case "file":case "info":r[y]=q;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "R3":case "split":case "resizable":r[y]=
"true"===g[q];break;case "bg_display":case "render":r[y]=g[q];break;case "net":case "net10":case "axes":case "text":r[y]=""!=q?"false"===g[q]?"":new a.Color(q,this.parent.evaluator):"";break;case "O.x":r.OxExpr=q;break;case "O.y":r.OyExpr=q;break;case "image":r.imageSrc=q;break;case "x":n=q;"%"===n[n.length-1]?(r.xPercentExpr=n.trim(),n=(this.parent.container.width*parseFloat(n)/100).toString()):n=q;r.xExpr=this.parser.parse(n);break;case "y":n=q;"%"===n[n.length-1]?(r.yPercentExpr=n.trim(),n=(this.parent.container.height*
parseFloat(n)/100).toString()):n=q;r.yExpr=this.parser.parse(n);break;case "width":n=q.trim();r.wModExpr=n;"%"===n[n.length-1]?(r.wExpr=n,n=this.parent.container.width*parseFloat(n)/100):(n=parseFloat(q),n!=q&&(n=this.parent.container.width,r._w_=q.trim()));r.w=n;break;case "height":n=q.trim();r.hModExpr=n;"%"===n[n.length-1]?(r.hExpr=n,n=this.parent.container.height*parseFloat(n)/100):(n=parseFloat(q),n!=q&&(n=this.parent.container.height,r._h_=q.trim()));r.h=n;break;case "drawif":""!=q&&(r.drawif=
this.parser.parse(q));break;case "scale":n=parseFloat(q);isNaN(n)&&(n=48);r.scale=n;break;case "background":r.background=new a.Color(q,this.parent.evaluator);break;default:console.log("Propiedad del espacio no identificada: <"+p+"> valor: <"+q+">")}switch(r.type){case "R2":return new a.Space2D(this.parent,r);case "R3":return new a.Space3D(this.parent,r);case "AP":return new a.SpaceAP(this.parent,r);case "HTMLIFrame":return new a.SpaceHTML_IFrame(this.parent,r);default:return new a.Space2D(this.parent,
r)}};a.LessonParser.prototype.parseControl=function(b){u={type:"numeric"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(p=b[c][0],q=b[c][1],y=g[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Control",y){case "id":a.DEBUG.idName=q;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 "info":u[y]=q;break;case "gui":case "region":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":u[y]=
g[q];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":u[y]="true"===g[q];break;case "color":case "colorInt":case "trace":u[y]=new a.Color(q,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==q&&(u[y]=this.parser.parse(q));break;case "constraint":u.constraintExpr=q;break;case "image":u.imageSrc=q;break;case "space":u.spaceID=q;break;
case "type":u.type=g[q.trim()];break;case "expresion":u.expresion=this.parser.parse(q.replace(")(",","));break;case "borderColor":u[y]="false"===g[q]?"":q;break;case "bold":"false"!=g[q]&&(u.bold="bold");break;case "italics":"false"!=g[q]&&(u.italics="italic");break;case "underlined":"false"!=g[q]&&(u.underlined=!0);break;case "value":var e=q.replace(/&squot;/g,"'");e.match(/^\|/)&&(e="'"+e.substring(1),e.match(/\|$/)&&(e=e.substring(0,e.length-1)+"'"));u.valueExpr=this.parser.parse(e);u.valueExprString=
e;break;case "incr":0!=q&&(u.incr=this.parser.parse(q));break;case "exponentialif":u.exponentialif=parseFloat(q);break;case "text":u.rawText=q;e=this.parseText(q);for(var f=0,l=e.length;f<l;f++)e[f]=this.parser.parse(e[f],!1);u.text=e;break;default:f=p.indexOf("."),e=g[p.substring(0,f)],f=g[p.substring(f+1)],"parameter"===e&&"font"===f?u.parameterFont=q:"Explanation"===e&&"font"===f?u.ExplanationFont=q:"tooltip"===e&&"font"===f?u.tooltipFont=q:console.log("Propiedad de control no identificada: <"+
p+"> valor: <"+q+">")}if("numeric"===u.type)switch(u.gui){case "spinner":return new a.Spinner(this.parent,u);case "button":return new a.Button(this.parent,u);case "textfield":return new a.TextField(this.parent,u);case "menu":return new a.Menu(this.parent,u);case "scrollbar":return new a.Scrollbar(this.parent,u);default:return new a.Spinner(this.parent,u)}else{if("video"===u.type)return new a.Video(this.parent,u);if("audio"===u.type)return new a.Audio(this.parent,u);if("graphic"===u.type)return new a.GraphicControl(this.parent,
u);if("text"===u.type)return new a.TextArea(this.parent,u);if("checkbox"===u.type)return new a.Checkbox(this.parent,u)}};a.LessonParser.prototype.parseGraphic=function(b,c,d,e){w={rotateExp:e,parameter:"t"};b=this.split(b);e=0;for(var f=b.length;e<f;e++)if(p=b[e][0],q=b[e][1],y=g[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Graphic",""!=q)switch(y){case "type":a.DEBUG.idName=q;case "align":case "anchor":case "lineDash":w[y]=g[q];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":w[y]=
"true"===g[q];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":w[y]="false"===g[q]?"":new a.Color(q,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":w[y]=q;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 "font_size":""!=q&&(w[y]=this.parser.parse(q));
break;case "space":w.spaceID=q;break;case "expresion":""!=q&&("macro"!=w.type?(w.expresion=this.parser.parse(q),w.expresionString=q):w.expresion=q);break;case "text":w.text=q;break;case "file":var l=q.replace(/&squot;/g,"'");"["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substring(1,l.length-1));l.match(B)&&(l="'"+l+"'");w.file=this.parser.parse(l);break;case "border":""!=q&&"false"!=g[q]&&(w.border=new a.Color(q,this.parent.evaluator));break;default:if(void 0!=w.family&&p.substring(0,w.family.length+
1)===w.family+".")switch(g[p.substring(w.family.length+1)]){case "interval":""!=q&&(w.family_interval=this.parser.parse(q));break;case "steps":""!=q&&(w.family_steps=this.parser.parse(q))}else if(void 0!=w.parameter&&p.match(w.parameter+"."))switch(w.parameter!==p.substring(0,p.indexOf(w.parameter)+w.parameter.length)&&(w.parameter=p.substring(0,p.indexOf(w.parameter)+w.parameter.length)),g[p.substring(w.parameter.length+1)]){case "interval":""!=q&&(w.parameter_interval=this.parser.parse(q));break;
case "steps":""!=q&&(w.parameter_steps=this.parser.parse(q))}else console.log("Propiedad del grafico no identificada: <"+p+"> valor: <"+q+">")}c&&(w.abs_coord=c);d&&(w.background=d);switch(w.type){case "text":return new a.Text(this.parent,w);case "image":return new a.Image(this.parent,w);case "point":return new a.Point(this.parent,w);case "polygon":return new a.Polygon(this.parent,w);case "arc":return new a.Arc(this.parent,w);case "segment":return new a.Segment(this.parent,w);case "arrow":return new a.Arrow(this.parent,
w);case "macro":return new a.Macro(this.parent,w);case "curve":return new a.Curve(this.parent,w);case "equation":return new a.Equation(this.parent,w);case "sequence":return new a.Sequence(this.parent,w);case "rectangle":return new a.Rectangle(this.parent,w);case "fill":return new a.Fill(this.parent,w)}};a.LessonParser.prototype.parse3DGraphic=function(b,c,d,e){w={rotateExp:e,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(p=b[c][0],q=b[c][1],y=g[p],a.DEBUG.paramName=p,a.DEBUG.objectName=
"Graphic3D",y){case "type":a.DEBUG.idName=q;case "model":case "lineDash":w[y]=g[q];break;case "fill":w[y]="false"===g[q]?"":new a.Color(q,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":w[y]="true"===g[q];break;case "edges":"false"===g[q]?w[y]="":("true"===g[q]&&(q="808080"),w[y]=new a.Color(q,this.parent.evaluator));break;case "color":case "backcolor":w[y]=new a.Color(q,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":""!=
q&&(w[y]=this.parser.parse(q));break;case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":w[y]=q;break;case "space":w.spaceID=q;break;case "expresion":"macro"!=w.type&&"curve"!=w.type&&"surface"!=w.type?(w.expresion=this.parser.parse(q),w.expresionString=q):w.expresion=q.replace(/\\n/g,";");break;case "text":w.text=q;break;case "file":e=q.replace(/&squot;/g,"'");"["===e.charAt(0)&&"]"===e.charAt(e.length-1)&&(e=e.substring(1,e.length-1));
e.match(/./)&&(e="'"+e+"'");w.file=this.parser.parse(e);break;default:void 0!==w.family&&p.substring(0,w.family.length+1)===w.family+"."?"interval"===g[p.substring(w.family.length+1)]?""!=q&&(w.family_interval=this.parser.parse(q)):""!=q&&(w.family_steps=this.parser.parse(q)):console.log("Propiedad del grafico 3D no identificada: <"+p+"> valor: <"+q+">")}switch(w.type){case "point":return new a.Point3D(this.parent,w);case "segment":return new a.Segment3D(this.parent,w);case "polygon":return new a.Polygon3D(this.parent,
w);case "curve":return new a.Curve3D(this.parent,w);case "triangle":return new a.Triangle3D(this.parent,w);case "face":return new a.Face3D(this.parent,w);case "polireg":return new a.Polireg3D(this.parent,w);case "surface":return new a.Surface3D(this.parent,w);case "text":return new a.Text3D(this.parent,w);case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":return new a.OtherGeometry(this.parent,
w);case "macro":return new a.Macro3D(this.parent,w)}};a.LessonParser.prototype.parseAuxiliar=function(b){x={};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(p=b[c][0],q=b[c][1],y=g[p],a.DEBUG.paramName=p,a.DEBUG.objectName="Auxiliar",y){case "info":case "code":x[y]=q;break;case "id":a.DEBUG.idName=q;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":x[y]=
q.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":x[y]="true"===g[q];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":x[y]=this.parser.parse(q);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":x[y]=g[q];break;case "doc":break;default:var e=p.indexOf("."),f=g[p.substring(0,e)];e=g[p.substring(e+1)];"parameter"===f&&"font"===e?x.parameterFont=
q:console.log("Propiedad del auxiliar no identificada: <"+p+"> valor: <"+q+">")}x.sequence?x.type="sequence":x.constant?x.type="constant":x.algorithm&&x.evaluate?x.type="algorithm":x.array&&!x.matrix&&")"!=x.id.charAt(x.id.length-1)?x.type="vector":x.matrix&&")"!=x.id.charAt(x.id.length-1)?x.type="matrix":x.event&&")"!=x.id.charAt(x.id.length-1)?x.type="event":"library"===x.type?x.type="library":"jsfun"===x.type?x.type="jsfun":")"===x.id.charAt(x.id.length-1)?x.type="function":x.type="variable";a.DEBUG.typeName=
x.type;switch(x.type){case "sequence":new a.Function(this.parent,x);break;case "constant":b=new a.Constant(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,x));break;case "vector":b=new a.Vector(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);break;case "matrix":b=new a.Matrix(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);
break;case "event":this.parent.events.push(new a.Event(this.parent,x));break;case "library":new a.Library(this.parent,x);break;case "function":new a.Function(this.parent,x);break;case "variable":new a.Variable(this.parent,x);break;case "jsfun":new a.JsFunction(this.parent,x)}};a.LessonParser.prototype.parseAction=function(b){D=b.action;H=b.parent;G=b.parameter;if(D)switch(D){case "message":return new a.Message(H,G);case "calculate":return new a.Calculate(H,G);case "openURL":return new a.OpenURL(H,
G);case "openScene":return new a.OpenScene(H,G);case "about":return new a.About(H,G);case "config":return new a.Config(H,G);case "init":return new a.Init(H,G);case "clear":return new a.Clear(H,G);case "animate":return new a.Animate(H,G);case "initAnimation":return new a.InitAnimation(H,G);case "playAudio":return new a.PlayAudio(H,G);default:console.log("Accion no soportada: <"+D+">")}else return{execute:function(){}}};a.LessonParser.prototype.parseAnimation=function(b){var c={};b=this.split(b);for(var d=
0,e=b.length;d<e;d++)switch(p=b[d][0],q=b[d][1],y=g[p],y){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[y]=q.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[y]="true"===g[q];break;default:console.log("Propiedad de la animacion no identificada: <"+p+">  <"+q+">")}return new a.Animation(this.parent,c)};a.LessonParser.prototype.parsePleca=function(g,n){g=this.split(g);f=k="";m=0;e="#536891";h="white";d="left";c="";v="SansSerif,BOLD,20";
l="SansSerif,PLAIN,18";b=void 0;for(var r=0,u=g.length;r<u;r++)switch(p=g[r][0],q=g[r][1],p){case "title":k=q;break;case "subtitle":f=q;break;case "subtitlines":m=q;break;case "bgcolor":""!=q&&(e=(new a.Color(q,this.parent.evaluator)).getColor());break;case "fgcolor":""!=q&&(h=(new a.Color(q,this.parent.evaluator)).getColor());break;case "align":""!=q&&(d=q);break;case "titleimage":c=q;break;case "titlefont":v=""!=q?a.convertFont(q):a.convertFont(v);break;case "subtitlefont":l=""!=q?a.convertFont(q):
a.convertFont(l);break;default:console.log("Propiedad de la pleca no identificada: <"+p+">  <"+q+">")}if(""===k&&""===f)return document.createElement("div");L=l.substring(0,l.indexOf("px"));L=L.substring(L.lastIndexOf(" "));""!=c&&(z=this.parent.getImage(c),N=z.height);b=document.createElement("div");b.setAttribute("id","descartesPleca");N?(b.setAttribute("style","position:absolute;left:0;top:0;text-align:"+d+";width:"+(n-30)+"px;height:"+(N-16)+"px;background:"+e+";color:"+h+";padding-top:8px;padding-bottom:8px;padding-left:15px;padding-right:15px;margin:0;overflow:hidden;z-index:100;"),
z.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),b.appendChild(z)):b.setAttribute("style","position:absolute;left:0;top:0;text-align:"+d+";width:"+n+"px;background:"+e+";color:"+h+";padding-top:12px;padding-bottom:12px;padding-left:15px;padding-right:15px;margin:0;z-index:100;");C=document.createElement("div");C.setAttribute("style","padding:0;margin:0;font:"+v+";overflow:hidden;white-space:nowrap;");C.innerHTML=k;O=document.createElement("div");if(1===
parseInt(m)){T=0;M=document.createElement("div");M.innerHTML=f;document.body.appendChild(M);Q=L;do Q-=T,M.setAttribute("style","padding:0;margin:0;font:"+l+";font-size:"+Q+"px;width:"+(n-30)+"px;line-height:"+Q+"px;"),P=M.offsetHeight,U=P/Q,T=1;while(1<U&&8<Q);document.body.removeChild(M);O.setAttribute("style","padding:0;margin:0;font:"+l+";font-size:"+Q+"px;line-height: 110%;overflow:hidden;white-space:nowrap;")}else O.setAttribute("style","padding:0;margin:0;font:"+l+";line-height:110%;");O.innerHTML=
f;b.appendChild(C);b.appendChild(O);b.imageHeight=N;return b};a.LessonParser.prototype.split=function(a){if("string"!=typeof a)return[];a=(a||"").replace(/\\'/g,"\u2019");I=[];E=A=J=0;for(F=K=!1;E<a.length;)" "!==a.charAt(E)||F||E++," "===a.charAt(E)||F||(F=!0,J=E),"="!==a.charAt(E)||"'"!==a.charAt(E+1)||K||(K=!0,I[A]=[a.substring(J,E)],J=E+2,E+=2),K&&"'"===a.charAt(E)&&(F=K=!1,I[A].push(a.substring(J,E)),A++),"="!==a.charAt(E)||"'"===a.charAt(E+1)||K||(I[A]=[a.substring(J,E)],J=E+1,E++,S=a.substring(E).indexOf("="),
-1===S?R=S=a.length:(S+=E,R=a.substring(E,S).lastIndexOf(" "),R=-1===R?a.length:R+E),I[A].push(a.substring(J,R)),A++,F=!1,E=R),E++;return I};a.LessonParser.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||Math.floor(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=Math.floor(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function k(a,b){q=[];q.type="matrix";q.rows=a;q.cols=b;u=0;for(w=b;u<w;u++){b=[];r=0;for(x=a;r<x;r++)b.push(0);q[u]=b}return q}function f(a,b){y=a.rows;p=a.cols;q=k(y,p);var c;for(u=0;u<y;u++)for(r=0;r<p;r++){for(w=c=0;w<p;w++)c+=a[w][u]*b[r][w];q[r][u]=c}return q}function m(a,b,c){for(var d=
k(c.length-1,c.length-1),e=0,f=d.length;e<f;e++)for(var l=0;l<f;l++)d[e][l]=e<a?l<b?c[e][l]:c[e][l+1]:e<b?c[e+1][l]:c[e+1][l+1];return d}function e(a){if(1<a.cols){for(var b=0,c=1,d=0,f=a.cols;d<f;d++)b+=c*a[0][d]*e(m(0,d,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var h,d={},c=Math.floor,v,l,b,n;a.fullDecimals=!1;a.Node=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};a.Node.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};
a.Node.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};a.Node.prototype.replaceLastChild=function(a){v=this.childs.length-1;lastChild=this.childs[v];lastChild.parent=null;this.childs[v]=a;a.parent=this;return a};a.Node.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};a.Node.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",b=new a.Node("compOperator",
"=="),n=new a.Node("number","0"),b.addChild(this),b.addChild(n),l=this.getRoot(),l.setAllEvalFun(),l):this};a.Node.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};a.Node.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=function(a){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(a){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"==
this.value)this.evaluate=function(a){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 l;this.evaluate=function(a){C=this.childs[0].childs[0].evaluate(a);
try{return l=a.vectors[this.value][0>C?0:c(C)],void 0!==l?l:0}catch(M){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length){var n,v;this.evaluate=function(a){n=this.childs[0].childs[0].evaluate(a);v=this.childs[0].childs[1].evaluate(a);try{return l=a.matrices[this.value][0>n?0:c(n)][0>v?0:c(v)],void 0!==l?l:0}catch(M){return 0}}}else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var w,x,A;this.evaluate=function(a){w=
[];for(var b=0,c=this.childs[0].childs.length;b<c;b++)w[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){h=0<w.length?w[0]:0;if("number"==typeof h)return"NaN";h.match(",")&&parseFloat(h.replace(",","."))==h.replace(",",".")&&(h=h.replace(",","."));if(void 0==d[h]){x=h.match(/:=/g)?!0:!1;if(h.match(";")){var e=!1,f=[],l=0;b=0;for(c=h.length;b<c;b++){var g=h.charAt(b);"'"===g&&(e=!e);e||";"!==g||(f.push(h.substring(l,b)),l=b+1)}f.push(h.substring(l));h="("+f.join(")(")+")"}d[h]=a.parser.parse(h,
x)}A=a.eval(d[h]);return void 0!=A?A:NaN}return a.functions[this.value].apply(a,w)}}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;y=c.rows;p=c.cols;q=k(y,p);for(u=0;u<y;u++)for(r=0;r<p;r++)q[r][u]=
c[r][u]+b[r][u];return q}:"-"===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;y=b.rows;p=b.cols;q=k(y,p);for(u=0;u<y;u++)for(r=0;r<p;r++)q[r][u]=b[r][u]-a[r][u];return q}:"*"===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:f(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=k(a.length,a.length),d=e(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var l=0,g=a.length;l<g;l++){var n=d;for(var h=0;h<g;h++)c[h][l]=n*e(m(l,h,a)),n=-n;d=-d}else c[0][0]=d;a=c}b=0===a?k(b.rows,b.cols):f(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-c(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)?1:0}:"<="===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)<=this.childs[1].evaluate(a)?1:0}:">"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)>this.childs[1].evaluate(a)?1:0}:">="===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)>=
this.childs[1].evaluate(a)?1:0}:"=="===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)===this.childs[1].evaluate(a)?1:0}:"!="===this.value&&(this.evaluate=function(a){return this.childs[0].evaluate(a)!==this.childs[1].evaluate(a)?1:0});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)?0:1});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2].evaluate(a)};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===
this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);else for(var d=0;d<b;d++){var e=[];for(var f=0,l=this.childs[d].childs.length;f<l;f++)e.push(this.childs[d].childs[f].evaluate(a));c[d]=e}return c};else if("asign"===this.type){var F,J,K,L,z=this.childs[0],N=this.childs[1];var C=z.childs[0]?z.childs[0].childs:null;this.evaluate=1===z.childs.length&&"square_bracket"===
z.childs[0].type&&1===C.length?function(a){F=C[0].evaluate(a);F=0>F?0:c(F);L=N.evaluate(a);return a.vectors[z.value][F]=L}:1===z.childs.length&&"square_bracket"===z.childs[0].type&&2===C.length?function(a){J=C[0].evaluate(a);K=C[1].evaluate(a);J=0>J?0:c(J);K=0>K?0:c(K);a.matrices[z.value][J]||(a.matrices[z.value][J]=[]);L=N.evaluate(a);return a.matrices[z.value][J][K]=L}:function(a){L=N.evaluate(a);return L.type?a.matrices[z.value]=L:"object"!==typeof a.variables[z.value]?a.variables[z.value]=L:0}}};
var y,p,q,r,u,w,x;a.Node.prototype.toString=function(){var a="tipo: "+this.type+", valor: "+this.value+"\n";this.sep="   "+(this.parent?this.parent.sep:"");for(var b=0,c=this.childs.length;b<c;b++)a+=this.sep+this.childs[b].toString();return a};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v,l=/^\s+/,b=/^[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]*)*/,n=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,y=/^==|^!=|^<=|^<|^>=|^>|^#/,p=/^!|^~|^&&|^&|^\|\||^\|/,q=/^=|^:=/,r=/^[\?:]/,u=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,w=/^\[|^\]/,x=/^\(|^\)/,B=/^,/,D=/^;/,H=/\|/g,G=/\|\*/g,I=/\*\|/g;a.Tokenizer=function(){};a.Tokenizer.prototype.tokenize=function(A){function E(a,
b,d){k.push({type:a,value:b});h=h.slice(d);m+=d;c++;v=a}if(g=A){var F=A.indexOf("//");0<=F&&":"!==A[F-1]&&(A=A.substring(0,F));A=A.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});A=A.replace(/&sup(.+);/g,"^ $1 ");A=A.replace(/&squot;/g,"'");A.match(/=\|\*/g)&&(A=A.replace(G,"'").replace(I,"'"));A.match(/=\|/g)&&(A=A.replace(H,"'"));F=A.trim();"|"==F.charAt(0)&&"|"==F.charAt(F.length-1)&&(A=F.replace(H,"'"))}k=[];f=!1;m=0;h=A;c=0;for(v="";A&&m<
A.length;)if(f=m,"'"==h[0]){for(d=1;"'"!=h[d];)if(d<h.length)d++;else{console.info(">Error, unknown symbol: ["+h+"], in the string \u300a"+g+"\u300b");return}e=h.substring(1,d);E("string",e,e.length+2)}else if(e=h.match(l))h=h.slice(e[0].length),m+=e[0].length,c++;else if(e=h.match(u))e[0]=e[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),E("operator",e[0],e[0].length);else if(e=h.match(b))"number"===v&&k.push({type:"operator",value:"*"}),E("identifier",
e[0],e[0].length);else if(e=h.match(n))E("number",e[0],e[0].length);else if(e=h.match(y))F=e[0],"#"==F&&(F="!="),E("compOperator",F,e[0].length);else if(e=h.match(p))F=e[0],"||"==F?F="|":"&&"==F?F="&":"~"==F&&(F="!"),E("boolOperator",F,e[0].length);else if((e=h.match(q))&&!h.match(/^==/))E("asign",e[0],e[0].length);else if(e=h.match(r))E("conditional",e[0],e[0].length);else if(e=h.match(w))E("square_bracket",e[0],e[0].length);else if(e=h.match(x))"("==e&&"number"===v&&k.push({type:"operator",value:"*"}),
E("parentheses",e[0],e[0].length);else if(e=h.match(B))E("separator",e[0],e[0].length);else if(178===h.charCodeAt(0))k.push({type:"operator",value:"^"}),E("number",2,1);else if(179===h.charCodeAt(0))k.push({type:"operator",value:"^"}),E("number",3,1);else if(e=h.match(D))E("final_of_expresion",e[0],e[0].length);else if(f==m){a.DEBUG.setError(a.DEBUG.EXPRESSION,g);return}return k};var E,A=/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/;
a.Tokenizer.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(A)?E+a[c].value:E+b+a[c].value;return E};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 k(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-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var f=Date.now();a.Parser=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()};a.Parser.prototype.setDefinition=function(a,b){this.definitions[a]=b};a.Parser.prototype.getDefinition=function(a){return this.definitions[a]};a.Parser.prototype.setVariable=function(a,b){this.variables[a]=b};a.Parser.prototype.getVariable=
function(a,b){b&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};a.Parser.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};a.Parser.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};a.Parser.prototype.setMatrix=function(a,b,c,d){this.matrices[a][b][c]=d};a.Parser.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};
a.Parser.prototype.setFunction=function(a,b){this.functions[a]=b};a.Parser.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};var m,e,h,d,c,v,l,b,n,y,p,q;a.Parser.prototype.parse=function(f,k){(h=this.tokenizer.tokenize(f))||(h=[]);d=null;k=!k||!1;m=b=l=v=0;for(e=h.length;m<e;m++){n=h[m];y=n.value;p=n.type;if("identifier"===p)if(m+1<e&&"parentheses"===h[m+1].type&&"("===h[m+1].value)this.getFunction(y);else if(m+1<
e&&"square_bracket"===h[m+1].type&&"["===h[m+1].value)h[m+3]&&"square_bracket"===h[m+3].type&&"]"===h[m+3].value?this.getVector(y):this.getMatrix(y);else{var r=y.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);r&&(this.variables[(r[1]||r[2]||r[3]||r[4]||r[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(y,!0)}"asign"===p&&k&&":="!=y&&(p="compOperator",y="==");if("asign"===p)if(c=new a.Node(p,y),null!=d)if("identifier"===d.type)d.parent&&d.parent.replaceLastChild(c),
c.addChild(d),d=c,k=!0;else if("square_bracket"===d.type)c.addChild(d.parent),d=c,k=!0;else{c.type="compOperator";c.value="==";for(k=!0;d.parent&&g(d.parent.value)>=g(c.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(c);c.addChild(d);d=c}else{console.info("Error1: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}else if("parentheses"===p&&"("===y||"square_bracket"===p&&"["===y)if(c=new a.Node(p,y),"("===y&&v++,"["===y&&l++,null===d)"("===y&&(new a.Node("(expr)",
"(expr)")).addChild(c),"["===y&&(new a.Node("[expr]","[expr]")).addChild(c),d=c;else if("operator"===d.type||"boolOperator"===d.type||"compOperator"===d.type||"conditional"===d.type||"asign"===d.type)d.addChild(c),d=c;else if("sign"===d.type)d.addChild(c),d=c;else if("parentheses"===d.type&&"("===d.value)d.addChild(c),d=c;else if("square_bracket"===d.type&&"["===d.value)d.addChild(c),d=c;else if("parentheses"===d.type&&"()"===d.value)d.parent.addChild(c),d=c;else if("square_bracket"===d.type&&"[]"===
d.value)d.parent.addChild(c),d=c;else if("identifier"===d.type)d.addChild(c),d=c;else{console.info("Error2: en la expresion \u300a "+f+" \u300b, en el token ["+m+"] {valor: "+y+", tipo: "+p+"}");break}else if("parentheses"===p&&")"===y)if(v--,null===d)console.info("Error3: en la expresion \u300a "+f+" \u300b, en el token (valor:"+y+", tipo:"+p);else{for(;d&&d.parent&&("("!=d.value||"("==d.value&&"parentheses"!=d.type);)d=d.parent;if(d&&"("===d.value)d.value="()";else break}else if("square_bracket"===
p&&"]"===y)if(l--,null===d)console.info("Error5: en la expresion \u300a "+f+" \u300b, en el token (valor:"+y+", tipo:"+p);else{for(;d&&d.parent&&("["!=d.value||"["==d.value&&"square_bracket"!=d.type);)d=d.parent;if(d&&"["===d.value)d.value="[]";else{console.info("Error6: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}}else if("number"===p||"string"===p||"identifier"===p)if(c=new a.Node(p,y),null===d)d=c;else if("operator"===d.type||"compOperator"===d.type||"boolOperator"===
d.type||"parentheses"===d.type&&"("===d.value||"square_bracket"===d.type&&"["===d.value||"sign"===d.type||"conditional"===d.type||"asign"===d.type)d.addChild(c),d=c;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,f);break}else if("operator"===p||"compOperator"===p||"boolOperator"===p)if(c=new a.Node(p,y),null===d)if("-"===y||"+"===y)c.type="sign",c.value="sign"+y,d=c;else if("!"===y)d=c;else{console.info("Error8: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}else if("operator"===
d.type||"compOperator"===d.type||"boolOperator"===d.type||"asign"===d.type||"conditional"===d.type||"square_bracket"===d.type&&"["===d.value&&("-"===y||"+"===y||"!"===y)||"parentheses"===d.type&&"("===d.value&&("-"===y||"+"===y||"!"===y)){if("-"===y||"+"===y)c.type="sign",c.value="sign"+y;d.addChild(c);d=c}else if("number"===d.type||"parentheses"===d.type&&"()"===d.value||"square_bracket"===d.type&&"[]"===d.value||"string"===d.type||"identifier"===d.type||"conditional"===d.type||"asign"===d.type){for(;d.parent&&
g(d.parent.value)>=g(c.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(c);c.addChild(d);d=c}else{console.info("Error9: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}else if("conditional"===p)if(c=new a.Node(p,y),null!=d)if("?"===c.value){for(b++;d.parent&&g(d.parent.value)>g(c.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(c);c.addChild(d);d=c}else{for(b--;d&&d.parent&&("?"!=d.value||"?"==d.value&&"conditional"!=d.type);)d=d.parent;if(d&&"?"===
d.value)d.value="?:";else{console.info("Error10: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}}else{console.info("Error11: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}else if("separator"===p)if(null!=d)for(;d.parent&&"("!=d.value&&"["!=d.value;)d=d.parent;else{console.info("Error12: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}else{console.info("Error13: en la expresion \u300a "+
f+" \u300b, en el token {valor: "+y+", tipo: "+p+"}");break}}0<v&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,f);0>v&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,f);0<l&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,f);0>l&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,f);0!=b&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,f);(q=d?d.getRoot():null)&&q.setAllEvalFun();return q};a.Parser.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,e){return a.esCorrecto(c,d,b.evaluator,e)};b.functions.escorrecto=function(c,d,e){return a.escorrecto(c,d,b.evaluator,e)};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);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};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 e="<"+c+">\\n",f=b.getVariable(c+".columnas_usadas")||d.cols||0,l=b.getVariable(c+".filas_usadas")||d.rows||0,g,n=0;n<f;n++){for(var k=0;k<l;k++)g=d[n][k],void 0!==g&&("string"==typeof g?g="'"+g+"'":"number"==typeof g&&(g=a.removeNeedlessDecimals(g.toFixed(6))),
e+=g+(k<l-1?" \u00a6 ":""));e=e.replace(/(\u00A6 )$/g,"")+"\\n"}return e+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var d=[],e=!1,f=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var l=0,g=a.length;l<g;l++)a[l].match("<"+c+">")?(f=!0,e=a[l].trim().split("<"+c+">"),2==e.length&&""!=e[1]&&d.push(e[1].split(String.fromCharCode("166")).map(k)),e=!0):(a[l].match("</"+c+">")&&(e=a[l].trim().split("</"+c+">"),2==e.length&&""!=e[0]&&d.push(e[0].split(String.fromCharCode("166")).map(k)),
e=!1,l=a.length),e&&d.push(a[l].split(String.fromCharCode("166")).map(k)));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 f?"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",e=b.getVariable(a+
".long_usada")||c._size_||0,f,l=0;l<e;l++)f=c[l],void 0!==f?("number"==typeof f&&(f=parseFloat(f)),d+=f+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var d=[],e=!1,f=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var l=0,g=a.length;l<g;l++)a[l].match("<"+c+">")?e=f=!0:(a[l].match("</"+c+">")&&(e=!1,l=a.length),e&&d.push(k(a[l])));d._size_=d.length;b.vectors[c]=d;b.setVariable(c+".long",d.length);b.setVariable(c+".long_usada",d.length)}return f?
"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var d=[],e=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,l=a.length;f<l;f++)a[f].match("<"+c+">")?(e=a[f].trim().split("<"+c+">"),2==e.length&&""!=e[1]&&(d=d.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[f].match("</"+c+">")?(e=a[f].trim().split("</"+c+">"),2==e.length&&""!=e[0]&&(d=d.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(d=d.concat(a[f].split(String.fromCharCode("166"))));
f=0;for(l=d.length;f<l;f++)e=d[f].split("="),e[0]=e[0].trim(),2==e.length&&""!=e[0]&&(isNaN(parseFloat(e[1]))?b.setVariable(e[0],e[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(e[0],parseFloat(e[1])))}return 0};var c=document.createElement("a");c.setAttribute("target","_blank");var d,e=null;a.newBlobContent=null;b.functions._Save_=function(l,g){b.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(f=Date.now(),document.body.appendChild(c),e=g.replace(/\\r/g,"").replace(/\\n/g,
"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),d=new Blob(["\ufeff",e],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(d)),c.setAttribute("download",l),e!=a.newBlobContent&&(c.click(),a.newBlobContent=e),document.body.removeChild(c));return 0};var l,g,n=document.createElement("input");n.setAttribute("type","file");n.addEventListener("change",function(c){l=c.target.files;g=new FileReader;g.onload=function(c){a.addExternalFileContent(l[0].name,c.target.result);
b.setVariable("DJS.fileName",l[0].name);b.setVariable("DJS.fileContent",c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());n.value=""};0<l.length&&g.readAsText(l[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(b._callback=a,n.click(),f=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,d,e){return a.getTextWidth(b,a.convertFont(c+","+d+","+e))};
b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/255};b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};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}};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor;a.Evaluator=function(g){this.parent=g;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};a.Evaluator.prototype.setDefinition=function(a,f){this.definitions[a]=f};a.Evaluator.prototype.getDefinition=function(a){return this.definitions[a]};a.Evaluator.prototype.setVariable=function(a,
f){this.variables[a]=f};a.Evaluator.prototype.getVariable=function(a){return this.variables[a]};a.Evaluator.prototype.setVector=function(a,f,m){f=0>f?0:g(f);this.vectors[a][f]=m};a.Evaluator.prototype.getVector=function(a,f){f=0>f?0:g(f);return this.vectors[a][f]};a.Evaluator.prototype.setMatrix=function(a,f,m,e){f=0>f?0:g(f);m=0>m?0:g(m);this.matrices[a][f][m]=e};a.Evaluator.prototype.getMatrix=function(a,f,m){f=0>f?0:g(f);m=0>m?0:g(m);return this.matrices[a][f][m]};a.Evaluator.prototype.setFunction=
function(a,f){this.functions[a]=f};a.Evaluator.prototype.getFunction=function(a){return this.functions[a]};a.Evaluator.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new a.Evaluator;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.TextObject=function(g,k){this.parent=g;this.evaluator=g.evaluator;this.decimals=g.decimals;this.fixed=g.fixed;this.align=g.align||"left";this.anchor=g.anchor||"a_top_left";this.decimal_symbol=g.parent.decimal_symbol;this.h=this.w=100;this.hasContent=""!==k;this.textStr=(k||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");this.oldPoxY=this.oldPosX=
this.oldColor=this.oldSize=this.oldWidth=this.oldTextStr=null;k.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=k,this.textNodes=(new a.RTFParser(g.evaluator)).parse(k.substring(10))):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null))};a.TextObject.prototype.draw=function(a,k,f,m,e){"rtfNode"===this.type?this.drawRTF(a,k,f,m,e):this.drawText(a,k,f,m,e)};a.TextObject.prototype.drawText=function(g,k,
f,m,e){var h=this.evaluator.eval(this.decimals),d=this.evaluator.eval(this.parent.width),c=this.evaluator.eval(this.parent.font_size);k=k.getColor?k.getColor():k;var v=this.textToString(this.text,h,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=v.indexOf("[")&&(v=this.textToString(this.parseSimpleText(v),h,this.fixed));if(this.oldTextStr!==v||this.oldWidth!==d||this.oldSize!==
c||this.oldColor!==k||this.oldPosX!==f||this.oldPoxY!==m){var l=new a.TextStyle({size:c,family:this.parent.font_family||"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:k,align:this.align,border:this.parent.border});this.textNodes=this.descarTeXParser.parse(v,this.evaluator,l);this.textNodes.update(f,m,h,this.fixed,this.align,this.anchor,k,d)}e||this.textNodes.draw(g);this.oldTextStr=v;this.oldWidth=d;this.oldSize=c;this.oldColor=k;this.oldPosX=f;this.oldPoxY=m};a.TextObject.prototype.drawRTF=
function(a,k,f,m,e){k=k.getColor?k.getColor():k;a.fillStyle=k;a.strokeStyle=k;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(f,m,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,k,this.evaluator.eval(this.parent.width));e||this.textNodes.draw(a)};a.TextObject.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");for(var g=[],f="'",m=0,e=0,h=-1,d,
c,v=a.length;m<v;)d=a.charAt(m),c=a.charAt(m-1),"["===d&&"\\"===c?(g.push(a.substring(e,m-1)+"["),e=m+1):"]"===d&&"\\"===c?(g.push(a.substring(e,m-1)+"]"),e=m+1):"["===d&&-1===h?(g.push(a.substring(e,m)),e=m,h++):"["===d?h++:"]"===d&&0===h?(g.push(this.evaluator.parser.parse(a.substring(e,m+1))),e=m+1,h--):("]"==a.charAt(m)&&(h=0>h?h:h-1),f+=a.charAt(m)),m++;g.push(a.substring(e,m));return g};a.TextObject.prototype.textToString=function(g,k,f){var m="";if("rtfNode"!==g.type)for(var e,h=0,d=g.length;h<
d;h++)"string"===typeof g[h]?m+=g[h]:(e=this.evaluator.eval(g[h])[0][0],""!==e&&("string"===typeof e?m+=e:Infinity===e?m+="Infinity":-Infinity===e?m+="-Infinity":isNaN(e)||"NaN"===e?m+="NaN":(e=parseFloat(e),e=f?e.toFixed(k):a.removeNeedlessDecimals(e.toFixed(k)),m+=e.toString().replace(".",this.decimal_symbol))));return m};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DescarTeXTokenizer=function(){};a.DescarTeXTokenizer.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var g=[],f=null,m=0,e=a.length;a.charAt(0);var h=!1,d=!1,c=0;newInput="";for(var v=0;v<e;v++){var l=a.charAt(v);var b=a.charAt(v+1);"\\"===l&&"$"===b&&(d=!0);"{"===l?c++:"}"===l&&(c--,d&&0===c&&(d=!1));d?"_"===l?"{"===b?newInput+="\\subindex":(newInput+="\\subindex{"+b+"}",v++):"^"===l?"{"===b?newInput+="\\superindex":(newInput+="\\superindex{"+
b+"}",v++):newInput+=l:newInput+=l}a=newInput;b=a.charAt(0);for(e=a.length;m<e;)l=b,b=a.charAt(m+1),h&&("{"===l||"["===l||"\\"===l||" "===l?(h=!1," "===l&&(f={type:"ignore"},g.push(f))):f.value+=l),h||"\\"!==l?h||"{"!==l&&"["!==l?h||"}"!==l&&"]"!==l?h||(f&&"text"===f.type?f.value+=l:f&&"ignore"===f.type?(g.pop(),f=g[g.length-1]):(f={type:"text",value:l},g.push(f))):(f={type:"close",value:l},g.push(f)):(f={type:"open",value:l},g.push(f)):(h=!0,f={type:"command",value:""},g.push(f)),m++;return g};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;a.DescarTeXParser=function(){this.tokenizer=new a.DescarTeXTokenizer};a.DescarTeXParser.prototype.parse=function(g,k,f){g=this.tokenizer.tokenize(g);var m=new a.TextNode("","textBlock",f,null),e=new a.TextNode("","textLineBlock",f.clone(),null);m.addChild(e);for(var h=[],d=null,c=f,v=[f],l,b,n,y=!1,p=0,q=g.length;p<q;p++)if("text"===g[p].type)if("textLineBlock"===e.nodeType)if("color_parameter"===d)b=new a.Color(g[p].value,k);else{l=g[p].value.split(" ");for(var r=
0,u=l.length;r<u;r++)""!==l[r]&&e.addChild(new a.TextNode(l[r],"text",c.clone(),null)),r+1<u&&e.addChild(new a.TextNode(" ","space",c.clone(),null))}else e.addChild(new a.TextNode(g[p].value,"text",c.clone(),null));else if("command"===g[p].type&&"curlyBracketOpen"===g[p].value)e.addChild(new a.TextNode("{","text",c.clone(),null));else if("command"===g[p].type&&"curlyBracketClose"===g[p].value)e.addChild(new a.TextNode("}","text",c.clone(),null));else if("command"===g[p].type&&"squareBracketOpen"===
g[p].value)e.addChild(new a.TextNode("[","text",c.clone(),null));else if("command"===g[p].type&&"squareBracketClose"===g[p].value)e.addChild(new a.TextNode("]","text",c.clone(),null));else if("command"===g[p].type&&"newline"===g[p].value)0===e.children.length&&e.addChild(new a.TextNode("","text",c.clone(),null)),e=new a.TextNode("","textLineBlock",f.clone(),null),m.addChild(e);else if("command"===g[p].type&&"b"===g[p].value)d="bold",h.push(d);else if("command"===g[p].type&&"i"===g[p].value)d="italic",
h.push(d);else if("command"===g[p].type&&"color"===g[p].value)d="color",h.push(d);else if("command"===g[p].type&&"c"===g[p].value)d="center",h.push(d);else if("command"===g[p].type&&"l"===g[p].value)d="left",h.push(d);else if("command"===g[p].type&&"r"===g[p].value)d="right",h.push(d);else if("command"===g[p].type&&"j"===g[p].value)d="justify",h.push(d);else if("command"===g[p].type&&"$"===g[p].value)d="formula",h.push(d),y=!0;else if("command"===g[p].type&&"sum"===g[p].value)d="sum",h.push(d);else if("command"===
g[p].type&&"int"===g[p].value)d="integral",h.push(d);else if("command"===g[p].type&&"lim"===g[p].value)d="limit",h.push(d);else if("command"===g[p].type&&"sqrt"===g[p].value)d="radical",h.push(d);else if("command"===g[p].type&&"subindex"===g[p].value)d="subIndex",h.push(d);else if("command"===g[p].type&&"superindex"===g[p].value)d="superIndex",h.push(d);else if("command"===g[p].type&&"frac"===g[p].value)d="numerator",h.push(d);else if("open"===g[p].type&&"{"===g[p].value&&null!==d)"bold"===d||"italic"===
d?(newStyle=c.clone(),newStyle[d]=!0,v.push(newStyle),c=newStyle):"color"===d?d="color_parameter":"color_text"===d?(newStyle=c.clone(),newStyle.color=b,v.push(newStyle),c=newStyle):"center"===d||"left"===d||"right"===d||"justify"===d?(newStyle=c.clone(),newStyle.align=d,v.push(newStyle),c=newStyle,e=new a.TextNode("","textLineBlock",c.clone(),null),m.addChild(e)):"formula"===d?(newStyle=c.clone(),newStyle.italic=!0,v.push(newStyle),c=newStyle,n=new a.TextNode("","formula",c.clone(),null),e.addChild(n),
e=n):"subIndex"===d||"superIndex"===d?y?(newStyle=c.clone(),v.push(newStyle),c=newStyle,n=new a.TextNode("",d,c.clone(),null),e.addChild(n),e=n):e.addChild(new a.TextNode("subIndex"===d?"_":"^","text",c.clone(),null)):"radical"===d?y&&(n=new a.TextNode("","radical",c.clone(),null),e.addChild(n),e=n,newStyle=c.clone(),v.push(newStyle),c=newStyle,n=new a.TextNode("","index",c.clone(),null),e.addChild(n),e=n,d="index"):"index"===d?y&&(v.pop(),c=v[v.length-1],n=new a.TextNode("","radicand",c.clone(),
null),e.addChild(n),e=n,d="radicand"):"sum"===d||"integral"===d||"limit"===d?y&&(n=new a.TextNode("",d,c.clone(),null),e.addChild(n),e=n,newStyle=c.clone(),v.push(newStyle),c=newStyle,n=new a.TextNode("","from",c.clone(),null),e.addChild(n),e=n,d="from"):"from"===d?y&&(n=new a.TextNode("","to",c.clone(),null),e.addChild(n),e=n,d="to"):"to"===d?y&&(v.pop(),c=v[v.length-1],n=new a.TextNode("","what",c.clone(),null),e.addChild(n),e=n,d="what"):"numerator"===d?y&&(n=new a.TextNode("","fraction",c.clone(),
null),e.addChild(n),e=n,newStyle=c.clone(),v.push(newStyle),c=newStyle,n=new a.TextNode("","numerator",c.clone(),null),e.addChild(n),e=n,d="numerator"):"denominator"===d&&(n=new a.TextNode("",d,c.clone(),null),e.addChild(n),e=n);else if("close"===g[p].type&&"}"===g[p].value&&null!==d){if("bold"===d||"italic"===d||"color_text"===d||"color"===d)v.pop(),c=v[v.length-1],h.pop(),d=h[h.length-1];else if("color_parameter"===d)d="color_text";else if("center"===d||"left"===d||"right"===d||"justify"===d)v.pop(),
c=v[v.length-1],h.pop(),d=h[h.length-1],g[p+1]&&"command"===g[p+1].type&&"newline"===g[p+1].value?e=m:(e=new a.TextNode("","textLineBlock",c.clone(),null),m.addChild(e));"formula"===e.nodeType?(y=!1,v.pop(),c=v[v.length-1],h.pop(),d=h[h.length-1],e=e.parent):"subIndex"===e.nodeType||"superIndex"===e.nodeType?y&&(v.pop(),c=v[v.length-1],h.pop(),d=h[h.length-1],e=e.parent):"index"===e.nodeType?e=e.parent:"radicand"===e.nodeType?(h.pop(),d=h[h.length-1],e=e.parent.parent):"from"===e.nodeType?e=e.parent:
"to"===e.nodeType?e=e.parent:"what"===e.nodeType?(h.pop(),d=h[h.length-1],e=e.parent.parent):"numerator"===e.nodeType?(d="denominator",e=e.parent):"denominator"===e.nodeType&&(v.pop(),c=v[v.length-1],h.pop(),d=h[h.length-1],e=e.parent.parent)}else"open"===g[p].type&&"{"===g[p].value&&null===d?e.addChild(new a.TextNode("{","text",c.clone(),null)):"close"===g[p].type&&"}"===g[p].value&&null===d&&e.addChild(new a.TextNode("}","text",c.clone(),null));var w,x,B=null,D=[];m.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)w=a.children[b],x=a.children[b+1],"text"===w.nodeType&&"text"===x.nodeType?(null===B&&(B=w,n=w.clone(),B.changeNodeType("word"),B.value="___"+n.value,B.addChild(n)),n=x.clone(),B.addChild(n),D.push(x),B.value+=n.value):B=null});D.forEach(function(a){a.parent.removeChild(a)});m.adjustFontSize();return m.normalize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k=[a.sansserif_font,a.serif_font,a.monospace_font];a.TextStyle=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.color=null;this.align="left";this.border=null;a=a||{};this.set(a)};a.TextStyle.prototype.clone=function(){var f={},g;for(g in this)this.hasOwnProperty(g)&&(f[g]=this[g]);return new a.TextStyle(f)};a.TextStyle.prototype.set=function(a){for(var f in a)a.hasOwnProperty(f)&&(this[f]=a[f])};
a.TextStyle.prototype.equals=function(a){var f=!0,e;for(e in this)this.hasOwnProperty(e)&&(f=f&&this[e]===a[e]);return f};a.TextStyle.prototype.toString=function(){/arial|sansserif/i.test(this.family)?g=k[0]:/times|serif/i.test(this.family)?g=k[1]:/courier|monospaced/i.test(this.family)&&(g=k[2]);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+g).trim()};return a}(descartesJS||{});
descartesJS=function(a){function g(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function k(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((v[a].ascent+25)*c/v[a].unitsPerEm);b.descent=Math.ceil(Math.abs((v[a].descent-25)*c/v[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
a.auxCtx=document.createElement("canvas").getContext("2d");var f="#000000",m=2,e=!1,h=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");h.svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";var d=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");
d.svgData="M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";var c=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");c.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";
a.TextNode=function(a,b,c,d){this.type="rtfNode";this.evaluator=d;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=a;this.style=c;this.changeNodeType(b);this.drawBorder=function(){}};a.TextNode.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 "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}};a.TextNode.prototype.clone=function(){for(var c=new a.TextNode(this.value,this.nodeType,this.style.clone()),b=0,d=this.children.length;b<d;b++)c.addChild(this.children[b].clone());return c};a.TextNode.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};a.TextNode.prototype.stringify=function(){var a="{"+('"NT":"'+this.nodeType+'",');a+=
'"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,c=this.children.length;b<c;b++)a+=this.children[b].stringify()+(b==c-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};a.TextNode.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};a.TextNode.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};a.TextNode.prototype.getFirstTextNode=function(){for(var a=
this;0<a.children.length;)a=a.children[0];return a};a.TextNode.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};a.TextNode.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,c=this.parent.children.length;b<c;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};a.TextNode.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+
1]===this)return this.parent.children[a];return null};a.TextNode.prototype.querySelectorAll=function(a){for(var b=[],c=0,d=this.children.length;c<d;c++)b=b.concat(this.children[c].querySelectorAll(a));this.nodeType===a&&b.push(this);return b};a.TextNode.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};a.TextNode.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};a.TextNode.prototype.normalize=
function(){for(var c=this.querySelectorAll("textLineBlock").concat(this.querySelectorAll("formula")).concat(this.querySelectorAll("numerator")).concat(this.querySelectorAll("denominator")).concat(this.querySelectorAll("superIndex")).concat(this.querySelectorAll("subIndex")).concat(this.querySelectorAll("index")).concat(this.querySelectorAll("subIndex")).concat(this.querySelectorAll("radicand")).concat(this.querySelectorAll("from")).concat(this.querySelectorAll("to")).concat(this.querySelectorAll("what")).concat(this.querySelectorAll("element")),
b=0,d=c.length;b<d;b++)0===c[b].children.length&&c[b].addChild(new a.TextNode("","text",c[b].style));c=this.querySelectorAll("formula").concat(this.querySelectorAll("fraction")).concat(this.querySelectorAll("superIndex")).concat(this.querySelectorAll("subIndex")).concat(this.querySelectorAll("radical")).concat(this.querySelectorAll("sum")).concat(this.querySelectorAll("integral")).concat(this.querySelectorAll("limit")).concat(this.querySelectorAll("matrix")).concat(this.querySelectorAll("defparts")).concat(this.querySelectorAll("dynamicText")).concat(this.querySelectorAll("componentNumCtrl")).concat(this.querySelectorAll("componentSpace"));
b=0;for(d=c.length;b<d;b++)(null===c[b].prevSibling()||null!==c[b].prevSibling()&&"text"!==c[b].prevSibling().nodeType)&&c[b].parent.insertBefore(c[b],new a.TextNode("","text",c[b].parent.style)),(null===c[b].nextSibling()||null!==c[b].nextSibling()&&"text"!==c[b].nextSibling().nodeType)&&c[b].parent.insertAfter(c[b],new a.TextNode("","text",c[b].parent.style));return this};a.TextNode.prototype.removeEmptyText=function(){for(var a=this.querySelectorAll("text"),b=0,c=a.length;b<c;b++)""===a[b].value&&
a[b].parent&&a[b].parent.removeChild(a[b])};a.TextNode.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType&&a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||
"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.fontSize=b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};a.TextNode.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,
b)};a.TextNode.prototype.update=function(a,b,c,d,g,k,h,v){m=c;e=d;f=h;this.metrics.w=this.metrics.h=0;h=b;if(20<=v)for(c=0;c<this.children.length;c++)this.children[c].breakLines(v);c=0;for(g=this.children.length;c<g;c++){var l=this.children[c];l.updateLine();l.metrics.offsetX=a;l.metrics.y=b;b+=parseInt(l.metrics.ascent+.5);l.metrics.offsetY=b;d=parseInt(l.metrics.descent+.5)+parseInt(1.5+.05*l.style.size);b+=d;this.metrics.h+=l.metrics.h;this.metrics.w=Math.max(this.metrics.w,l.metrics.w)}b=h;k=
k||"";k.match("right")?a-=this.metrics.w:k.match("_center")&&(a-=this.metrics.w/2);k.match("bottom")?b-=this.metrics.h:k.match("center_")&&(b-=this.metrics.h/2);k=this.children;c=0;for(g=k.length;c<g;c++)"left"===k[c].style.align?k[c].metrics.offsetX=a:"right"===k[c].style.align?k[c].metrics.offsetX=a+this.metrics.w-k[c].metrics.w:"center"===k[c].style.align?k[c].metrics.offsetX=a+(this.metrics.w-k[c].metrics.w)/2:"justify"===k[c].style.align&&20<=v&&(lineValue=c<g-1?k[c+1].value:null,k[c].metrics.offsetX=
a,"wrap"===lineValue&&k[c].justifyAux(v)),k[c].metrics.y=b,b+=parseInt(k[c].metrics.ascent+.5),k[c].metrics.offsetY=b,d=parseInt(k[c].metrics.descent+.5)+parseInt(1.5+.05*k[c].style.size),b+=d};a.TextNode.prototype.breakLines=function(c){for(var b,d=0,e=!1,f=[],g=0,l=this.children.length;g<l;g++)b=this.children[g],e?f.push(b):("text"===b.nodeType||"space"===b.nodeType?(a.auxCtx.font=b.style.toString(),b.metrics.w=a.auxCtx.measureText(b.value).width):"word"===b.nodeType?b.updateLine():"formula"===
b.nodeType&&b.updateFormula(),d+=b.metrics.w,d>c&&"space"!==b.nodeType&&0<g&&(e=!0,f.push(b)));if(0<f.length)for(c=new a.TextNode("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),g=0,l=f.length;g<l;g++)f[g].parent&&f[g].parent.removeChild(f[g]),c.addChild(f[g])};a.TextNode.prototype.updateLine=function(c){var b=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,f,g=
0,l=e.length;g<l;g++){f=e[g];if("text"===f.nodeType){a.auxCtx.font=f.style.toString();var h=""!==f.value?f.value:"\u200a";f.metrics=k(a.auxCtx.font);f.metrics.w=a.auxCtx.measureText(h).width;f.metrics.offsetX=d;Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===f.nodeType?(a.auxCtx.font=f.style.toString(),f.metrics=k(a.auxCtx.font),f.metrics.w=g===l-1?0:c?c:a.auxCtx.measureText(" ").width,
f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===f.nodeType&&(f.updateLine(),f.metrics.offsetX_aux=d,Object.defineProperties(f.metrics,{offsetX:{get:function(){return b.metrics.offsetX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===f.nodeType&&(a.auxCtx.font=f.styleString,h=""!==f.value?f.value:"\u200a",f.metrics=k(a.auxCtx.font),
f.metrics.w=a.auxCtx.measureText(h).width,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),f.clickCacher||(f.clickCacher=document.createElement("div"),f.clickCacher.setAttribute("style","position:absolute;width:"+f.metrics.w+"px;height:"+f.metrics.h+"px;cursor:pointer;"),f.clickCacher.rtfNode=f,f.clickCacher.action=new a.OpenURL(this.evaluator.parent,f.URL),f.clickCacher.addEventListener("click",
function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===f.nodeType&&(f.componentNumCtrl=this.evaluator.parent.getControlByCId(f.value),a.auxCtx.font=f.styleString,f.metrics=k(a.auxCtx.font),f.metrics.w=f.componentNumCtrl.w,f.metrics.h=f.componentNumCtrl.h,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));"componentSpace"===f.nodeType?
(f.componentSpace=this.evaluator.parent.getSpaceByCId(f.value),a.auxCtx.font=f.styleString,f.metrics=k(a.auxCtx.font),f.metrics.w=f.componentSpace.w,f.metrics.h=f.componentSpace.h,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===f.nodeType&&(f.updateFormula(),f.metrics.offsetX_aux=d,Object.defineProperties(f.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),f.metrics.w+=2*f.metrics.paddingX,f.metrics.ascent+=f.metrics.paddingY,f.metrics.descent+=f.metrics.paddingY,f.metrics.h+=2*f.metrics.paddingY,d+=2*f.metrics.marginX);this.metrics.w+=f.metrics.w+2*f.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,f.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,f.metrics.descent);d+=f.metrics.w}this.metrics.h=
this.metrics.ascent+this.metrics.descent}};a.TextNode.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var b=this.children,d,f=0,h={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},v=0,r=b.length;v<r;v++){d=b[v];if("text"===d.nodeType){a.auxCtx.font=d.style.toString();var u=""!==d.value?d.value:"\u200a";d.metrics=k(a.auxCtx.font);
d.metrics.w=a.auxCtx.measureText(u).width;d.metrics.offsetX=f;Object.defineProperties(d.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});f+=c.metrics.marginX}else if("dynamicText"===d.nodeType){u=void 0===d.decimals?m:d.evaluator.eval(d.decimals);var w=void 0===d.fixed?e:d.fixed,x=d.evaluator.eval(d.value);parseFloat(x).toString()===x.toString()&&(x=w?parseFloat(x).toFixed(u):a.removeNeedlessDecimals(parseFloat(x).toFixed(u)),
x=(""+x).replace(".",d.decimal_symbol));d.evalValue=x;a.auxCtx.font=d.style.toString();d.metrics=k(a.auxCtx.font);d.metrics.marginX=parseInt(1.5+.075*this.style.size);d.metrics.paddingX=parseInt(1.5+.075*this.style.size);d.metrics.w=a.auxCtx.measureText(x).width+2*d.metrics.paddingX;d.metrics.offsetX_aux=f;Object.defineProperties(d.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+
this.marginX}},offsetY:{get:function(){return c.metrics.offsetY}}});f+=2*d.metrics.marginX}if("superIndex"===d.nodeType)u=d,u.updateFormula(),u.metrics.marginX=0*parseInt(1.5+.075*this.style.size),u.metrics.paddingX=0*parseInt(1.5+.075*this.style.size),u.metrics.paddingY=parseInt(1.5+.05*this.style.size),u.metrics.offsetX_aux=f,u.metrics.prevChild=h,Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY-this.descent+this.prevChild.metrics.descent-parseInt(2*this.prevChild.metrics.h/7)}}}),u.metrics.w+=2*u.metrics.paddingX,u.metrics.ascent+=u.metrics.paddingY,u.metrics.descent+=u.metrics.paddingY,u.metrics.h+=2*u.metrics.paddingY,this.metrics.ascent=u.metrics.descent-u.metrics.prevChild.metrics.descent+parseInt(2*u.metrics.prevChild.metrics.h/7)+u.metrics.ascent,f+=2*u.metrics.marginX;else if("subIndex"===
d.nodeType){var B=d;B.updateFormula();B.metrics.marginX=parseInt(1.5+.09375*this.style.size);B.metrics.paddingX=0*parseInt(1.5+.01875*this.style.size);B.metrics.paddingY=parseInt(1.5+.05*this.style.size);B.metrics.offsetX_aux=f;B.metrics.prevChild=h;Object.defineProperties(B.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+0*this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+
this.ascent+B.metrics.prevChild.metrics.descent-parseInt(4*B.metrics.prevChild.metrics.h/7)}}});B.metrics.w+=B.metrics.paddingX;B.metrics.ascent+=B.metrics.paddingY;B.metrics.descent+=B.metrics.paddingY;B.metrics.h+=2*B.metrics.paddingY;this.metrics.descent=B.metrics.ascent+B.metrics.prevChild.metrics.descent-parseInt(4*B.metrics.prevChild.metrics.h/7)+B.metrics.descent;f+=B.metrics.marginX}else if("fraction"===d.nodeType){w=d;w.updateFormula();u=w.children;x=u[0];u=u[1];w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=0*parseInt(1.5+.075*this.style.size);w.metrics.paddingY=0*parseInt(1.5+.05*this.style.size);var D=Math.max(x.metrics.w,u.metrics.w)+2*w.metrics.paddingX;w.metrics.prevChild=h;w.metrics.offsetX_aux=f;var H=parseInt(-h.metrics.descent+4*h.metrics.h/9);Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+H}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY-H}}});Object.defineProperties(x.metrics,{parent:{value:w},maxWidth:{value:D},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(u.metrics,{parent:{value:w},maxWidth:{value:D},x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});w.metrics.w=D;w.metrics.ascent=x.metrics.h+H+2*w.metrics.paddingY;w.metrics.descent=u.metrics.h-H+2*w.metrics.paddingY;w.metrics.h=x.metrics.h+u.metrics.h+4*w.metrics.paddingY;f+=2*w.metrics.marginX}else if("radical"===d.nodeType){h=d;h.updateFormula();u=h.children;
w=u[0];var G=u[1];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});u=h.style.size;h.radicalSign={w:u,
scaleX:u/722,scaleY:G.metrics.h/1E3};x=parseInt(w.metrics.w-2*h.radicalSign.w/3);Object.defineProperties(h.radicalSign,{parent:{value:h},displaceIndex:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},y:{get:function(){return c.metrics.offsetY-G.metrics.ascent}}});Object.defineProperties(w.metrics,{parent:{value:h},displaceIndex:{value:x},fontSize:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(G.metrics,{parent:{value:h},displaceIndex:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,
0)}},offsetY:{get:function(){return c.metrics.offsetY}}});x=w.metrics.w<2*h.radicalSign.w/3?h.radicalSign.w:parseInt(w.metrics.w+h.radicalSign.w/3);h.metrics.w=x+2*h.metrics.paddingX+G.metrics.w;h.metrics.ascent=Math.max(G.metrics.ascent,w.metrics.h+2*u/5)+h.metrics.paddingY;h.metrics.descent=G.metrics.descent+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("sum"===d.nodeType){w=d;w.updateFormula();u=w.children;x=u[0];D=u[1];var I=u[2];w.metrics.marginX=
parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=f;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();var E=k(a.auxCtx.font);h=parseInt(1.2*
E.h);u=parseInt(.5+780*h/1E3);w.sigmaSign={w:u,h:h,scale:h/1E3};var A=Math.max(D.metrics.w,x.metrics.w,w.sigmaSign.w);w.sigmaSign.parent=w;Object.defineProperties(w.sigmaSign,{sumWidth:{value:A},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}});u=E.descent-D.metrics.descent-(h+E.h)/2-w.metrics.paddingY;Object.defineProperties(D.metrics,{parent:{value:w},sumWidth:{value:A},
newBaselineTo:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});h=x.metrics.ascent+E.descent+(h-E.h)/2+w.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:w},sumWidth:{value:A},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(I.metrics,{parent:{value:w},sumWidth:{value:A},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
w.metrics.w=A+I.metrics.w+3*w.metrics.paddingX;w.metrics.ascent=Math.max(I.metrics.ascent,-u+D.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(I.metrics.descent,h+x.metrics.descent)+w.metrics.paddingY;w.metrics.h=w.metrics.ascent+w.metrics.descent;f+=2*w.metrics.marginX}else if("integral"===d.nodeType){w=d;w.updateFormula();u=w.children;x=u[0];D=u[1];I=u[2];w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+
.05*this.style.size);w.metrics.offsetX_aux=f;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);A=parseInt(1.2*E.h);var F=parseInt(10.5+529*A/1E3);w.sign={w:F,h:A,scale:A/1E3};w.sign.parent=w;Object.defineProperties(w.sign,{x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}});u=E.descent-(A+E.h)/2-D.metrics.descent+A/3;Object.defineProperties(D.metrics,{parent:{value:w},integralWidth:{value:F},newBaselineTo:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
h=E.descent+x.metrics.ascent/2;Object.defineProperties(x.metrics,{parent:{value:w},integralWidth:{value:F},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});F=Math.max(parseInt(4*F/5)+D.metrics.w,parseInt(2*F/5+x.metrics.w))+w.metrics.paddingX;Object.defineProperties(I.metrics,
{parent:{value:w},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 c.metrics.offsetY}}});w.metrics.w=F+I.metrics.w+2*w.metrics.paddingX;w.metrics.ascent=Math.max(I.metrics.ascent,-u+D.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(I.metrics.descent,h+x.metrics.descent,A-w.metrics.ascent)+w.metrics.paddingY;
w.metrics.h=Math.max(w.metrics.ascent+w.metrics.descent,A);f+=2*w.metrics.marginX}else if("limit"===d.nodeType){h=d;h.updateFormula();u=h.children;var J=u[0];w=u[1];u=u[2];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);D=parseInt(.5+a.auxCtx.measureText("l\u00edm").width);x=parseInt(.5+a.auxCtx.measureText("\u2192").width);limitWidth=Math.max(D,J.metrics.w+x+w.metrics.w);h.limitText={parent:h};Object.defineProperties(h.limitText,{limitWidth:{value:limitWidth},limitTextWidth:{value:D},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
(this.limitWidth-this.limitTextWidth)/2}}});D=E.descent+Math.max(J.metrics.ascent,w.metrics.ascent,2*E.ascent/3)+h.metrics.paddingY;h.limitArrow={parent:h};Object.defineProperties(h.limitArrow,{newBaseline:{value:D},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+J.metrics.w}},y:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(J.metrics,{parent:{value:h},newBaseline:{value:D},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(w.metrics,{parent:{value:h},arrowWidth:{value:x},newBaseline:{value:D},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+J.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(u.metrics,{parent:{value:h},limitWidth:{value:limitWidth},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});h.metrics.w=limitWidth+u.metrics.w+3*h.metrics.paddingX;h.metrics.ascent=Math.max(u.metrics.ascent,E.ascent)+h.metrics.paddingY;h.metrics.descent=D+Math.max(J.metrics.descent,
w.metrics.descent)+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("matrix"===d.nodeType){x=d;x.updateFormula();u=x.children;D=x.rows;I=x.columns;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=f;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);A=[];F=[];h=0;for(var K=D*I;h<K;h++){var L=parseInt(h/I);var z=h%I;A[L]=Math.max(A[L]||0,u[h].metrics.h);F[z]=Math.max(F[z]||0,u[h].metrics.w)}var N=(1+I)*x.metrics.paddingX;for(h=0;h<I;h++)N+=F[h];var C=(1+D)*x.metrics.paddingY;for(h=0;h<D;h++)C+=A[h];w=E.descent-E.h/2;h=0;for(K=D*I;h<K;h++)L=parseInt(h/I),z=h%I,u[h].metrics.offsetX_aux=g(F,z)+
(F[z]-u[h].metrics.w)/2+z*x.metrics.paddingX,u[h].metrics.offsetY_aux=g(A,L)+(A[L]-u[h].metrics.h)/2+(1+L)*x.metrics.paddingY,Object.defineProperties(u[h].metrics,{parent:{value:x},matrixH:{value:C},dispY:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});
x.metrics.w=N;x.metrics.ascent=C/2-w;x.metrics.descent=C/2+w;x.metrics.h=x.metrics.ascent+x.metrics.descent;f+=2*x.metrics.marginX}else if("defparts"===d.nodeType){x=d;x.updateFormula();u=d.children;D=d.parts;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=f;Object.defineProperties(x.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);I=0;A=x.metrics.paddingY;w=E.descent-E.h/2;for(h=0;h<D;h++)u[h].metrics.offsetY_aux=A,I=Math.max(I,u[h].metrics.w),A+=u[h].metrics.h+x.metrics.paddingY,Object.defineProperties(u[h].metrics,{parent:{value:x},dispY:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=A;x.metrics.w=I+4*x.metrics.paddingX;x.metrics.ascent=A/2-w;x.metrics.descent=A/2+w;x.metrics.h=x.metrics.ascent+x.metrics.descent;f+=2*x.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.w+=2*d.metrics.paddingX,d.metrics.ascent+=d.metrics.paddingY,d.metrics.descent+=d.metrics.paddingY,d.metrics.h=d.metrics.ascent+d.metrics.descent;h=d;this.metrics.ascent=Math.max(this.metrics.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;f+=d.metrics.w}};a.TextNode.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,e=this.children.length;d<e-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};a.TextNode.prototype.drawTextBlock=function(a){a.fillStyle=f;for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};a.TextNode.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<
c;b++)this.children[b].draw(a)};a.TextNode.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:f;a.font=this.style.toString();a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,
parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var d=a.strokeStyle;a.lineWidth=1+parseInt(this.style.size/13);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=d}a.fillText(this.value,b,c)}};a.TextNode.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};a.TextNode.prototype.drawSpace=function(a){};a.TextNode.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:f;a.font=this.style.toString();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")};a.TextNode.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCacher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCacher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCacher,a.canvas.nextSibling));this.clickCacher.style.left=b+"px";this.clickCacher.style.top=c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,
this.metrics.h),a.fillStyle="red");a.font=this.style.toString();a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};a.TextNode.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawFraction=function(a){a.lineWidth=6;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:
f;a.beginPath();var b=parseInt(1+this.style.size/20);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")};a.TextNode.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawSubIndex=
function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawRadical=function(c){c.save();c.translate(this.radicalSign.x,this.radicalSign.y);c.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);a.isMsEdge?this.drawRadicalSign(c):c.fill(h);c.restore();c.beginPath();c.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,d=this.children.length;b<
d;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};a.TextNode.prototype.drawSum=function(c){c.save();c.translate(this.sigmaSign.x,this.sigmaSign.y);c.scale(this.sigmaSign.scale,this.sigmaSign.scale);a.isMsEdge?this.drawSigmaSign(c):c.fill(d);c.restore();for(var b=0,e=this.children.length;b<e;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};a.TextNode.prototype.drawIntegral=function(d){d.save();d.translate(this.sign.x,this.sign.y);d.scale(this.sign.scale,this.sign.scale);a.isMsEdge?this.drawIntegralSign(d):
d.fill(c);d.restore();for(var b=0,e=this.children.length;b<e;b++)this.children[b].draw(d);this.drawBorder(d,"blue")};a.TextNode.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:f;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};
a.TextNode.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);b=parseInt(1.5+this.style.size/25);c=b/2;a.lineWidth=b;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:f;a.beginPath();a.moveTo(this.metrics.x+c+1.5*this.metrics.marginX,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+c,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+c,this.metrics.y-c-this.metrics.ascent+
this.metrics.h);a.lineTo(this.metrics.x+c+1.5*this.metrics.marginX,this.metrics.y-c-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w-c-1.5*this.metrics.marginX,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+this.metrics.w-c,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+this.metrics.w-c,this.metrics.y+c-this.metrics.ascent+this.metrics.h);a.lineTo(this.metrics.x+this.metrics.w-c-1.5*this.metrics.marginX,this.metrics.y+c-this.metrics.ascent+this.metrics.h);
a.stroke();this.drawBorder(a,"blue")};a.TextNode.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:f;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};a.TextNode.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.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)};a.TextNode.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)};a.TextNode.prototype.drawRadicalSign=function(a){a.strokeStyle="rgba(0,0,0,0)";
a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.fill();a.stroke()};a.TextNode.prototype.drawSigmaSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";
a.miterLimit=4;a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.fill();a.stroke()};a.TextNode.prototype.drawIntegralSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(150,
828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,
18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.fill();a.stroke()};a.TextNode.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};a.TextNode.prototype.toRTF=function(){var a=[],b=[],c="";this.mergeTextNodes();for(var d=0,e=this.children.length;d<e;d++){var f=this.children[d];"textLineBlock"===
f.nodeType&&(c+=f.toRTFAux(a,b)+(1<e&&d<e-1?"\\par":""))}f="{\\fonttbl";d=0;for(e=a.length;d<e;d++)f+="\\f"+d+"\\fcharset0 "+a[d]+";";a="";if(0<b.length){a="{\\colortbl";d=0;for(e=b.length;d<e;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(f+"}")+a+c+"}"};a.TextNode.prototype.toRTFAux=function(a,b){for(var c,d,e,g=null,k="",h,l,m,v,D,H=0,G=this.children.length;H<G;H++)h=l="",c=this.children[H],m=this.addToFontTable(c.style.family,a),v=c.style.size,D=this.addToColorTable(c.style.color,b),null===D&&0<b.length&&
(D=this.addToColorTable(f,b)),D!==g&&(h+="\\cf"+D,g=D),m!==d&&(h+="\\f"+m,d=m),v!==e&&(h+="\\fs"+2*v,e=v),c.style.italic&&(h+="\\i",l="\\i0"+l),c.style.bold&&(h+="\\b",l="\\b0"+l),c.style.underline&&(h+="\\ul",l="\\ulnone"+l),c.style.overline&&(h+="\\ol",l="\\olnone"+l),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==h?h+" "+c.value+l:""!==k&&"}"!==k.charAt(k.length-1)?" "+c.value:c.value,k+=c):"formula"===c.nodeType?k+="{\\*\\mjaformula"+
c.formulaToRTF(d,e,g,a,b)+"}":"componentSpace"===c.nodeType?k+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(k+="{\\*\\component\\NumCtrl "+c.value+"}");return k};a.TextNode.prototype.formulaToRTF=function(a,b,c,d,e){for(var g,h="",k,l,m,n,v=0,p=this.children.length;v<p;v++)k=l="",g=this.children[v],m=this.addToFontTable(g.style.family,d),n=this.addToColorTable(g.style.color,e),null===n&&0<e.length&&(n=this.addToColorTable(f,e)),m!==a&&(k+="\\f"+m,a=m),n!==c&&(k+="\\cf"+
n,"text"!==g.nodeType||"text"===g.nodeType&&""!==g.value)&&(c=n),g.style.italic&&(k+="\\i",l="\\i0"+l),g.style.bold&&(k+="\\b",l="\\b0"+l),g.style.underline&&(k+="\\ul",l="\\ulnone"+l),g.style.overline&&(k+="\\ol",l="\\olnone"+l),"text"===g.nodeType&&""!==g.value?(g.value=g.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==k?k+" "+g.value+l:"}"!==h.charAt(h.length-1)?" "+g.value:g.value,h+=tmpRTF):"dynamicText"===g.nodeType?(g.value=""===g.value?" ":
g.value,h+=k+"{\\expr "+g.value+"\\decimals "+(g.decimals||2)+"\\fixed"+(g.fixed?1:0)+"}"+l):"fraction"===g.nodeType||"radical"===g.nodeType||"index"===g.nodeType||"radicand"===g.nodeType||"sum"===g.nodeType||"integral"===g.nodeType||"limit"===g.nodeType||"from"===g.nodeType||"to"===g.nodeType||"what"===g.nodeType||"element"===g.nodeType?h+="{\\"+g.nodeType+g.formulaToRTF(a,b,c,d,e)+"}":"numerator"===g.nodeType?h+="{\\num"+g.formulaToRTF(a,b,c,d,e)+"}":"denominator"===g.nodeType?h+="{\\den"+g.formulaToRTF(a,
b,c,d,e)+"}":"superIndex"===g.nodeType?h+="{\\supix"+g.formulaToRTF(a,b,c,d,e)+"}":"subIndex"===g.nodeType?h+="{\\subix"+g.formulaToRTF(a,b,c,d,e)+"}":"matrix"===g.nodeType?h+="{\\matrix\\rows "+(g.rows||2)+"\\columns "+(g.columns||2)+g.formulaToRTF(a,b,c,d,e)+"}":"defparts"===g.nodeType&&(h+="{\\defparts\\parts "+(g.parts||2)+g.formulaToRTF(a,b,c,d,e)+"}");return h};a.TextNode.prototype.addToFontTable=function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&
(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};a.TextNode.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};a.TextNode.prototype.mergeTextNodes=function(){for(var a=[],b=null,c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[c].style)&&
(this.children[c].value=b.value+this.children[c].value,a.push(b)):this.children[c].mergeTextNodes(),b=this.children[c];c=0;for(d=a.length;c<d;c++)this.removeChild(a[c])};var v={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}};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=String.fromCharCode,k,f,m,e,h,d,c,v,l,b,n,y;a.RTFTokenizer=function(){};a.RTFTokenizer.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[];k=a.length;f=[];m="";h=e=0;c=a.charAt(0);v=!1;for(l="text";e<k;)d=c,c=a.charAt(e+
1),v?"\\"===c||"{"===c||"}"===c||" "===c||";"===c?(v=!1,m+=d," "===c?(e++,c=a.charAt(e+1),y=!0):y=!1,(b=m.match(/^'([0-9a-f]{2})/))?(n="","text"===l&&(n=f.pop().value),m=n+=g(parseInt(b[1],16))+m.substring(3)):(b=m.match(/^u[0-9]+/))?(n="","text"===l&&(n=f.pop().value),m=n+=g(b[0].substring(1))):("{"===m||"}"===m||"\\"==d?(f.push({type:"text",value:m+(y?" ":"")}),l="text"):(f.push({type:"controlWord",value:m}),l="controlWord"),m="")):"{"==d||"}"==d||"\\"==d?(v=!1,f.push({type:"text",value:d}),l="text"):
m+=d:"\\"===d?(v=!0,""!==m&&(f.push({type:"text",value:m}),l="text",m="")):"{"===d?(h++,""!==m&&(f.push({type:"text",value:m}),m=""),f.push({type:"openBlock",value:h}),l="openBlock"):"}"===d?(""!==m&&(f.push({type:"text",value:m}),m=""),f.push({type:"closeBlock",value:h}),l="closeBlock",h--):m+=d,e++;""!==m&&f.push({type:"text",value:m});return f};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,k,f,m,e,h,d,c,v,l,b,n,y,p,q,r,u,w,x,B,D,H,G,I,E,A,F,J,K,L;a.RTFParser=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};a.RTFParser.prototype.parse=function(z){k=this.tokenizer.tokenize(z);f={};e=2;if("openBlock"===k[0].type&&"fonttbl"===k[1].value){for(m=k[0].value;"closeBlock"!==k[e].type&&k[e].value!==m;)f[k[e].value]=k[e+2].value.substring(0,k[e+2].value.length-1),e+=3;e++}h={};d=0;if("openBlock"===k[e].type&&"colortbl"===
k[e+1].value){m=k[e++].value;for(e++;"closeBlock"!==k[e].type&&k[e].value!==m;)c=parseInt(k[e++].value.substring(3)).toString(16),v=parseInt(k[e++].value.substring(5)).toString(16),l=parseInt(k[e++].value.substring(4)).toString(16),";"===k[e].value&&e++,h[d++]="#"+(2>c.length?"0"+c:c)+(2>v.length?"0"+v:v)+(2>l.length?"0"+l:l);e++}q=p=y=null;D=B=x=w=u=r=!1;H=[new a.TextStyle];G=H[0];E=I=-1;A=[];K=J=F=!1;b=L=new a.TextNode("","textBlock",G,this.evaluator);n=new a.TextNode("","textLineBlock",G,this.evaluator);
b.addChild(n);L.stableWidth=!0;L.hasFormula=!1;z=e;for(var N=k.length;z<N;z++){if("controlWord"==k[z].type)if(f[k[z].value])G.set({family:f[k[z].value]});else if(k[z].value.match(/^fs(\d+)/))G.set({size:parseInt(k[z].value.match(/^fs(\d+)/)[1]/2)});else if("b"==k[z].value)G.set({bold:!0}),0<A.length&&A[A.length-1].style.set({bold:!0});else if("b0"==k[z].value)G.set({bold:!1}),0<A.length&&A[A.length-1].style.set({bold:!1});else if("i"==k[z].value)G.set({italic:!0}),0<A.length&&A[A.length-1].style.set({italic:!0});
else if("i0"==k[z].value)G.set({italic:!1}),0<A.length&&A[A.length-1].style.set({italic:!1});else if("ul"==k[z].value)G.set({underline:!0}),0<A.length&&A[A.length-1].style.set({underline:!0});else if("ulnone"==k[z].value)G.set({underline:!1}),0<A.length&&A[A.length-1].style.set({underline:!1});else if("ol"==k[z].value)G.set({overline:!0}),0<A.length&&A[A.length-1].style.set({overline:!0});else if("olnone"==k[z].value)G.set({overline:!1}),0<A.length&&A[A.length-1].style.set({overline:!1});else if(k[z].value.match(/^cf(\d+)/))G.set({color:h[parseInt(k[z].value.substring(2))]}),
0<A.length&&(A[A.length-1].style.color=G.color);else if("par"==k[z].value){b=new a.TextNode("","textLineBlock",G.clone(),this.evaluator);if("textBlock"!=n.nodeType)for(n=n.parent;"textBlock"!=n.nodeType;)n=n.parent;n.addChild(b);n=b}else if("mjaformula"==k[z].value)L.hasFormula=!0,E=I,r=!0,b=new a.TextNode("","formula",G.clone(),this.evaluator),n.addChild(b),n=b,A[A.length-1]=b;else if("fraction"==k[z].value||"radicand"==k[z].value||"radical"==k[z].value||"what"==k[z].value||"sum"==k[z].value||"integral"==
k[z].value||"limit"==k[z].value){var C=A[A.length-2].style.clone();b=new a.TextNode("",k[z].value,C,this.evaluator);A[A.length-2].addChild(b);A[A.length-1]=b}else"index"==k[z].value?(C=A[A.length-2].style.clone(),C.size=g(parseInt(C.size-.5*C.size),8),b=new a.TextNode("",k[z].value,C,this.evaluator),A[A.length-2].addChild(b),A[A.length-1]=b):"to"==k[z].value||"from"==k[z].value?(C=A[A.length-2].style.clone(),C.size=g(parseInt(C.size-.2*C.size),8),b=new a.TextNode("",k[z].value,C,this.evaluator),A[A.length-
2].addChild(b),A[A.length-1]=b):"num"==k[z].value||"den"==k[z].value?(C=A[A.length-2].style.clone(),C.size=g(Math.round(C.size-.1*C.size),8),"num"==k[z].value?b=new a.TextNode("","numerator",C,this.evaluator):"den"==k[z].value&&(b=new a.TextNode("","denominator",C,this.evaluator)),A[A.length-2].addChild(b),A[A.length-1]=b):"subix"==k[z].value||"supix"==k[z].value?(C=A[A.length-2].style.clone(),C.size=g(Math.floor(C.size-.33*C.size),8),"subix"==k[z].value?b=new a.TextNode("","subIndex",C,this.evaluator):
"supix"==k[z].value&&(b=new a.TextNode("","superIndex",C,this.evaluator)),b.originalStyle=A[A.length-2].style.clone(),A[A.length-2].addChild(b),A[A.length-1]=b):"defparts"==k[z].value||"matrix"==k[z].value||"element"==k[z].value?(C=A[A.length-2].style.clone(),b=new a.TextNode("",k[z].value,C,this.evaluator),A[A.length-2].addChild(b),A[A.length-1]=b,"defparts"==k[z].value?q=b:"matrix"==k[z].value&&(p=b)):"parts"==k[z].value?D=!0:"rows"==k[z].value?x=!0:"columns"==k[z].value?B=!0:"expr"==k[z].value?
(L.stableWidth=!1,u=!0):"decimals"==k[z].value?w=!0:"fixed1"==k[z].value?y.fixed=!0:"fixed0"==k[z].value?y.fixed=!1:"component"!=k[z].value&&("NumCtrl"==k[z].value?F=!0:"Space"==k[z].value?J=!0:"hyperlink"==k[z].value&&(K=!0));if("text"==k[z].type)if(D)q.parts=parseInt(k[z].value),D=!1;else if(x)p.rows=parseInt(k[z].value),x=!1;else if(B)p.columns=parseInt(k[z].value),B=!1;else if(w)y.decimals=this.evaluator.parser.parse(k[z].value+""),w=!1;else if(K){textContent=k[z].value.split("|")[0];C=G.clone();
b=new a.TextNode(textContent,"hyperlink",C,this.evaluator);b.URL=k[z].value.split("|")[1];if("textLineBlock"!=n.nodeType)for(n=n.parent;"textLineBlock"!=n.nodeType;)n=n.parent;n.addChild(b);K=!1}else if(F)b=new a.TextNode(k[z].value,"componentNumCtrl",G.clone(),this.evaluator),n.addChild(b),F=!1;else if(J)b=new a.TextNode(k[z].value,"componentSpace",G.clone(),this.evaluator),n.addChild(b),J=!1;else if(u)C=A[A.length-2].style.clone(),textContent=this.evaluator.parser.parse(k[z].value),b=new a.TextNode(textContent,
"dynamicText",C,this.evaluator),A[A.length-2].addChild(b),y=A[A.length-1]=b,u=!1;else if(u||r)!u&&r&&(textContent=k[z].value,b=new a.TextNode(textContent,"text",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(b));else{textContent=k[z].value;b=new a.TextNode(textContent,"text",G.clone(),this.evaluator);if("textLineBlock"!=n.nodeType)for(n=n.parent;"textLineBlock"!=n.nodeType;)n=n.parent;n.addChild(b)}else if("openBlock"==k[z].type)I=k[z].value,G=G.clone(),H.push(G),A.push(null);
else if("closeBlock"==k[z].type)k[z].value==E&&(E=-1,r=!1,n=n.parent),H.pop(),G=H[H.length-1],A.pop();else if("("==k[z].type||")"==k[z].type)C=A[A.length-1].style.clone(),C.italic="",b=new a.TextNode(k[z].type,"mathSymbol",C,this.evaluator),A[A.length-1].addChild(b);else if("+"==k[z].type||"-"==k[z].type||"*"==k[z].type||"="==k[z].type)b=new a.TextNode(k[z].type,"mathSymbol",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(b)}return L.normalize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,v,l,b;a.Space=function(b,c){this.parent=b;k=this.evaluator=this.parent.evaluator;f=k.parser;this.id="";this.values=c;this.type="R2";this.xExpr=f.parse("0");this.yExpr=f.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=f.parse("1");this.fixed=2===b.version;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";
this.background=new a.Color(/DescartesJS.class/i.test(b.code)||b.arquimedes?"f0f8fa":"ffffff");this.net=2!=b.version?new a.Color("c0c0c0"):"";this.net10=2!=b.version?new a.Color("808080"):"";this.axes=2!=b.version?new a.Color("808080"):"";this.text=new a.Color("ffafaf");this.numbers=!1;this.y_axis=this.x_axis=2!=b.version?"":" ";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.plecaHeight=
b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=b.displaceRegionWest||0;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.initSpace()};a.Space.prototype.initSpace=function(){g=this.parent;k=this.evaluator;m=this.id;this.resizable||(this.displaceRegionNorth=g.displaceRegionNorth||0,this.displaceRegionSouth=g.displaceRegionSouth||0,this.displaceRegionEast=g.displaceRegionEast||0,this.displaceRegionWest=g.displaceRegionWest||0,c=parseInt(g.container.width),
d=parseInt(g.container.height),void 0!=this.wExpr&&(this.w=parseInt(c-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.wExpr)/100),void 0!=this.hExpr&&(this.h=parseInt(d-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.hExpr)/100),void 0!=this.xPercentExpr&&(this.xExpr=k.parser.parse((parseInt(c-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.xPercentExpr)/100).toString())),void 0!=this.yPercentExpr&&(this.yExpr=k.parser.parse((parseInt(d-this.displaceRegionNorth-
this.displaceRegionSouth)*parseFloat(this.yPercentExpr)/100).toString())),this.x=k.eval(this.xExpr)+this.displaceRegionWest,this.y=k.eval(this.yExpr)+this.plecaHeight+this.displaceRegionNorth,this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px"),0<=this.y?(e=d-this.y,this.h>e&&(this.h=e)):(e=this.h+this.y,this.h=e>=d?d:e),0<=this.x?(h=c-this.x,this.w>h&&(this.w=h)):(h=this.w+this.x,this.w=h>=c?c:h));""==this.imageSrc&&/vacio.gif$/i.test(this.imageSrc.trim())||
(this.image=g.getImage(this.imageSrc));this.OxExpr&&(l=this.OxExpr,"%"===l[l.length-1]?this.Ox=this.w*parseFloat(l)/100:(v=parseFloat(l),v!=l&&(v=0),this.Ox=v));this.OyExpr&&(b=this.OyExpr,"%"===b[b.length-1]?this.Oy=this.h*parseFloat(b)/100:(v=parseFloat(b),v!=b&&(v=0),this.Oy=v));""!==this.id&&2!==g.version?(k.setVariable(m+"._w",this.w),k.setVariable(m+"._h",this.h),k.setVariable(m+".escala",this.scale),k.setVariable(m+".Ox",this.Ox),k.setVariable(m+".Oy",this.Oy),k.setVariable(m+".mouse_x",0),
k.setVariable(m+".mouse_y",0),k.setVariable(m+".mouse_pressed",0),k.setVariable(m+".mouse_clicked",0),k.setVariable(m+".clic_izquierdo",0)):(v=k.getVariable("_w"),void 0===v&&(v=this.w),k.setVariable("_w",v),v=k.getVariable("_h"),void 0===v&&(v=this.h),k.setVariable("_h",v),v=k.getVariable("escala"),void 0===v&&(v=this.scale),k.setVariable("escala",v),v=k.getVariable("Ox"),void 0===v&&(v=this.Ox),k.setVariable("Ox",v),v=k.getVariable("Oy"),void 0===v&&(v=this.Oy),k.setVariable("Oy",v),k.setVariable("mouse_x",
0),k.setVariable("mouse_y",0),k.setVariable("mouse_pressed",0),k.setVariable("mouse_clicked",0),k.setVariable("clic_izquierdo",0),2==g.version&&""===this.x_axis&&""===this.y_axis&&(this.axes=""));this.w_2=this.w/2;this.h_2=this.h/2};a.Space.prototype.addCtr=function(a){"graphic"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};a.Space.prototype.addGraph=function(a,b){"R2"===this.type&&b||"R3"===this.type&&!b||(a.background&&"R3"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};a.Space.prototype.clearClick=
function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};a.Space.prototype.getRelativeX=function(a){return((a>>0)-this.w_2-this.Ox)/this.scale};a.Space.prototype.getRelativeY=function(a){return(-(a>>0)+this.h_2+this.Oy)/this.scale};a.Space.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};a.Space.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.SpaceExternal=function(a){g=this;g.parent=a;g.width=228;g.vSpace=25;g.container=document.createElement("div");g.container.setAttribute("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;width:"+(g.width+27)+"px;height:460px;background-color:#63b4fb");g.movable=document.createElement("div");g.movable.setAttribute("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:Sans-Serif;font-size:18px;");g.movable.innerHTML="Descartes";g.container.appendChild(g.movable);g.ctrs=[]};a.SpaceExternal.prototype.init=function(){function k(d){g.newPos=a.getCursorPosition(d,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",k);document.body.removeEventListener("mouseup",f)}document.body.appendChild(this.container);g=this;for(var m=g.parent.evaluator.parser,e=0,h=g.ctrs.length;e<h;e++)g.ctrs[e].expresion=m.parse("(0,"+(g.vSpace+23+35*e)+","+g.width+",35)"),g.ctrs[e].update();g.numCtr=h;e=new a.Button(g.parent,{region:"external",name:"english"==g.language?"about":"cr\u00e9ditos",font_size:m.parse("15"),
expresion:m.parse("(0,"+g.vSpace+","+g.width/2+",25)")});e.actionExec={execute:a.showAbout};e.update();(new a.Button(g.parent,{region:"external",name:"config",font_size:m.parse("15"),action:"config",expresion:m.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:m.parse("15"),action:"init",expresion:m.parse("(0,"+(g.vSpace+23+35*h)+","+g.width/2+",25)")})).update();(new a.Button(g.parent,
{region:"external",name:"english"==g.language?"clear":"limpiar",font_size:m.parse("15"),action:"clear",expresion:m.parse("("+g.width/2+","+(g.vSpace+23+35*h)+","+g.width/2+",25)")})).update();m=new a.Button(g.parent,{region:"external",name:"english"==g.language?"close":"cerrar",font_size:m.parse("15"),expresion:m.parse("("+g.width/4+","+(g.vSpace+46+35*h)+","+g.width/2+",25)")});m.update();m.btn.addEventListener("click",function(a){g.hide()});g.setPositionAndSize();g.movable.addEventListener("mousedown",
function(d){d.preventDefault();g.oldPos=a.getCursorPosition(d,document.body);g.initialPosition={x:g.container.offsetLeft,y:g.container.offsetTop};document.body.addEventListener("mousemove",k);document.body.addEventListener("mouseup",f)});g.hide()};a.SpaceExternal.prototype.addCtr=function(a){this.ctrs.push(a)};a.SpaceExternal.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};a.SpaceExternal.prototype.hide=function(){this.container.style.display="none"};a.SpaceExternal.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"};return a}(descartesJS||{});
descartesJS=function(a){var g,k;if(a.loadLib)return a;var f=Math.floor,m=Math.round,e=2*Math.PI,h=a.convertFont("SansSerif,PLAIN,12"),d=a.convertFont("Monospaced,PLAIN,12"),c,v,l,b,n,y,p,q,r,u,w,x,B,D,H,G,I,E,A,F,J,K,L,z,N,C,O,M,P,Q;a.Space2D=function(b,d){a.Space.call(this,b,d);c=this;c.ratio=b.ratio;c.canvas=document.createElement("canvas");c.canvas.setAttribute("id",c.id+"_canvas");c.canvas.setAttribute("class","DescartesSpace2DCanvas");c.backCanvas=document.createElement("canvas");c.backCanvas.setAttribute("id",
c.id+"_background");c.canvas.style.zIndex=c.zIndex;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";c.ctx=c.canvas.getContext("2d");c.backCtx=c.backCanvas.getContext("2d");c.ctx.imageSmoothingEnabled=c.backCtx.imageSmoothingEnabled=!1;c.graphicControlContainer=document.createElement("div");c.graphicControlContainer.setAttribute("id",c.id+"_graphicControls");
c.graphicControlContainer.setAttribute("style","position:absolute;left:0;top:0;z-index:"+c.zIndex+";");c.numericalControlContainer=document.createElement("div");c.numericalControlContainer.setAttribute("id",c.id+"_numericalControls");c.numericalControlContainer.setAttribute("style","position:absolute;left:0;top:0;z-index:"+c.zIndex+";");c.container=document.createElement("div");c.container.setAttribute("id",c.id);c.container.setAttribute("class","DescartesSpace2DContainer");c.container.setAttribute("style",
"left:"+c.x+"px;top:"+c.y+"px;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);d=c.id+".image";c.parent.images[d]=c.canvas;c.parent.images[d].ready=1;c.parent.images[d].complete=c.parent.images[d].canvas=
!0;c.evaluator.setVariable(d,d);d=c.id+".back";c.parent.images[d]=c.backCanvas;c.parent.images[d].ready=1;c.parent.images[d].complete=c.parent.images[d].canvas=!0;c.evaluator.setVariable(d,d);d=""!==c.id&&2!==b.version?c.id+".":"";c.OxStr=d+"Ox";c.OyStr=d+"Oy";c.scaleStr=d+"escala";c.wStr=d+"_w";c.hStr=d+"_h";c.mxStr=d+"mouse_x";c.myStr=d+"mouse_y";c.mpressedStr=d+"mouse_pressed";c.mclickedStr=d+"mouse_clicked";c.mclickIzqStr=d+"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.stage_height=0,c.canvas.oncontextmenu=function(a){return!1})};a.extend(a.Space2D,a.Space);a.Space2D.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");if("descartesJS_stage"===
c.id&&(c.setArquimedesHeight(),a.TextController&&!c.textController)){var b=null;c.backGraphics[0]&&c.backGraphics[0].text&&c.backGraphics[0].text.textNodes&&(b=c.backGraphics[0].text.textNodes);b&&(c.textController=new a.TextController(this,c.container,c.backCanvas,b,{fontFamily:"Times New Roman",fontSize:"30px",fontStyle:"normal",fontWeight:"normal",textDecoration:"none",decimals:2,fixed:!1},"000000"))}};a.Space2D.prototype.update=function(a){c=this;v=c.evaluator;l=c.parent;c.resizable||(v.setVariable(c.wStr,
c.w),v.setVariable(c.hStr,c.h));c.drawIfValue=0<v.eval(c.drawif);if(c.drawIfValue){c.resizable&&(P=c.evaluator.eval(c.wModExpr),Q=c.evaluator.eval(c.hModExpr),c.old_w!=P||c.old_h!=Q)&&(c.w=P,c.h=Q,c.w_2=c.w/2,c.h_2=c.h/2,v.setVariable(c.wStr,c.w),v.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);n=c.x!==v.eval(c.xExpr)+c.displaceRegionWest;y=c.y!==v.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth;c.spaceChange=a||n||y||c.drawBefore!==c.drawIfValue||c.Ox!==v.getVariable(c.OxStr)||c.Oy!==v.getVariable(c.OyStr)||c.scale!==v.getVariable(c.scaleStr)||c.backColor!==c.background.getColor();c.x=n?v.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=y?v.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth:c.y;c.Ox=v.getVariable(c.OxStr);c.Oy=v.getVariable(c.OyStr);c.scale=v.getVariable(c.scaleStr);c.drawBefore=
c.drawIfValue;c.scale=Math.max(1E-6,Math.min(1E6,c.scale));v.setVariable(c.scaleStr,c.scale);if(n||y)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"};a.Space2D.prototype.drawBackground=function(){c=this;v=c.evaluator;b=
c.backCtx;b.clearRect(0,0,c.backCanvas.width,c.backCanvas.height);c.backColor=c.background.getColor();b.fillStyle=c.backColor;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;r=0;for(u=0>c.w+c.h?0:c.w+c.h;q>u;)q/=10,r++;for(;q<u/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,
f(c.h/2+c.Oy)+.5),b.lineTo(c.w,f(c.h/2+c.Oy)+.5));"no"==c.y_axis||""===c.y_axis&&2===c.parent.version||(b.moveTo(f(c.w/2+c.Ox)+.5,0),b.lineTo(f(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=h,b.textAlign="right",b.textBaseline="alphabetic","no"!=c.x_axis&&b.fillText(c.x_axis,f(c.w)-2,f(c.h/2+c.Oy)+12),"no"!=c.y_axis&&b.fillText(c.y_axis,
f(c.w/2+c.Ox)-2,12);c.numbers&&""!=c.axes&&(b.fillStyle=c.axes.getColor(),b.font=h,b.textAlign="start",b.textBaseline="bottom",q>(c.w+c.h)/2?c.drawNumbers(b,q/5,q<=c.scale?r+1:r):q>(c.w+c.h)/4?c.drawNumbers(b,q/2,q<=c.scale?r+1:r):c.drawNumbers(b,q,r));a=0;for(var d=this.backGraphics.length;a<d;a++)this.backGraphics[a].draw()};a.Space2D.prototype.setArquimedesHeight=function(){this.update(!0);if(0<this.backGraphics.length&&this.backGraphics[0].text.textNodes.metrics.h!==this.stage_height){this.stage_height=
this.backGraphics[0].text.textNodes.metrics.h;var a=0;1<this.backGraphics.length&&(a=this.backGraphics[1].text.textNodes.metrics.h+25);this.h=this.stage_height+a+75;1<this.backGraphics.length&&(this.backGraphics[1].expresion=this.evaluator.parser.parse("["+this.backGraphics[1].exprX+","+(this.stage_height+a)+"]"));2<this.backGraphics.length&&(this.backGraphics[2].expresion=this.evaluator.parser.parse("["+this.backGraphics[2].exprX+","+(this.stage_height+a+25)+"]"));this.canvas.width=this.backCanvas.width=
this.w*this.ratio;this.canvas.height=this.backCanvas.height=this.h*this.ratio;this.canvas.style.width=this.backCanvas.style.width=this.w+"px";this.canvas.style.height=this.backCanvas.style.height=this.h+"px";this.parent.container.style.height=this.h+this.plecaHeight+"px";this.update(!0)}};a.Space2D.prototype.draw=function(){c=this;b=c.ctx;b.clearRect(0,0,c.canvas.width,c.canvas.height);for(var a=0,g=c.graphics.length;a<g;a++)p=c.graphics[a],""!==p.trace&&c.drawTrace&&p.drawTrace(),p.draw();a=0;for(g=
c.graphicsCtr.length;a<g;a++)c.graphicsCtr[a].draw();""!=c.text&&c.click&&"L"===c.whichBtn&&(b.save(),b.fillStyle=c.text.getColor(),b.strokeStyle=b.fillStyle,b.lineWidth=1,b.font=d,b.textAlign="center",b.textBaseline="alphabetic",J=1>=c.scale?c.mouse_x.toFixed(0):c.mouse_x.toFixed(c.scale.toString().length),K=1>=c.scale?c.mouse_y.toFixed(0):c.mouse_y.toFixed(c.scale.toString().length),L="("+J+","+K+")",z=f(b.measureText(L).width/2),N=c.getAbsoluteX(c.mouse_x),C=c.getAbsoluteY(c.mouse_y),O=f(N),M=
f(C-10),O+z>c.w?O=c.w-z:0>O-z&&(O=z),M+1>c.h?M=c.h:0>M-14&&(M=15),b.fillText(L,O,M),b.beginPath(),b.arc(N,C,2.5,0,e,!0),b.stroke(),b.restore())};a.Space2D.prototype.drawMarks=function(a,b,c,d){w=this.w;x=this.h;A=I=0;E=w;F=x;H=f(w/2+this.Ox);G=f(x/2+this.Oy);0<=c&&(I=H-c,E=H+c,A=G-c,F=G+c);a.beginPath();if(!d||d&&!d.match("x"))for(c=-m(H/b);(B=H+m(c*b))<w;c++)a.moveTo(B+.5,A+.5),a.lineTo(B+.5,F+.5);if(!d||d&&!d.match("y"))for(c=-m(G/b);(D=G+m(c*b))<x;c++)a.moveTo(I+.5,D+.5),a.lineTo(E+.5,D+.5);a.stroke()};
a.Space2D.prototype.drawNumbers=function(a,b,c){w=this.w;x=this.h;H=f(w/2+this.Ox);G=f(x/2+this.Oy);for(c=-m(H/b);(B=H+m(c*b))<w;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),B+1,G-2);for(c=-m(G/b);(D=G+m(c*b))<x;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),H+5,D+5)};a.Space2D.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.click=
0,h.evaluator.setVariable(h.mpressedStr,0),h.evaluator.setVariable(h.mclickedStr,1),h.evaluator.setVariable(h.mclickIzqStr,1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),h.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();h.click=0;h.evaluator.setVariable(h.mpressedStr,0);h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclickIzqStr,1);"R"===
h.whichBtn&&(window.removeEventListener("mousemove",e),h.posZoom==h.posZoomNew&&a.showConfig&&(h.parent.externalSpace.show(),h.posZoom=!1,h.posZoomNew=!0));window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",c);h.parent.deactivateGraphiControls();h.parent.update()}function d(b){h.posAnte=a.getCursorPosition(b,h.container);h.mouse_x=h.getRelativeX(h.posAnte.x);h.mouse_y=h.getRelativeY(h.posAnte.y);h.evaluator.setVariable(h.mxStr,h.mouse_x);h.evaluator.setVariable(h.myStr,
h.mouse_y);h.evaluator.setVariable(h.mclickedStr,0);h.evaluator.setVariable(h.mclickIzqStr,0);h.parent.update()}function e(b){b.preventDefault();h.posZoomNew=a.getCursorPosition(b,h.container).y;h.evaluator.setVariable(h.scaleStr,h.tempScale+h.tempScale/45*((h.posZoom-h.posZoomNew)/10));h.parent.update()}function f(b){b.preventDefault();b.stopPropagation();h.fixed||(h.posNext=a.getCursorPosition(b,h.container),g=h.posAnte.x-h.posNext.x,k=h.posAnte.y-h.posNext.y,h.evaluator.setVariable(h.OxStr,h.Ox-
g),h.evaluator.setVariable(h.OyStr,h.Oy-k));d(b)}var h=this;h.posZoom=h.posZoomNew=null;h.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.parent.clearClick(),h.click=1,h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,
0),h.evaluator.setVariable(h.mclickIzqStr,0),h.parent.deactivateGraphiControls(),d(a),window.addEventListener("touchmove",f),window.addEventListener("touchend",b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",d);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();h.parent.clearClick();h.click=1;h.parent.deactivateGraphiControls();h.whichBtn=a.whichBtn(b);
"R"===h.whichBtn?(window.addEventListener("mouseup",c),h.posZoom=a.getCursorPosition(b,h.container).y,h.posZoomNew=h.posZoom,h.fixed||(h.tempScale=h.scale,window.addEventListener("mousemove",e))):"L"===h.whichBtn&&(h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,0),d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c))});this.canvas.addEventListener("dblclick",function(a){});document.addEventListener("visibilitychange",
function(a){c(a)})};return a}(descartesJS||{});
descartesJS=function(a){var g,k,f;function m(b,c){N=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));C=a.add3D(b,a.scalarProduct3D(N,-2));O=a.norm3D(C);return 0!==O?a.scalarProduct3D(C,1/O):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var e=Math.floor,h=Math.max,d=Math.cos,c=Math.sin,v,l,b,n,y,p,q,r,u,w,x,B,D,H,G,I,E=[],A,F,J,K,L,z,N,C,O,M,P;a.Space3D=function(c,d){a.Space.call(this,c,d);b=this;b.backCanvas=document.createElement("canvas");b.backCanvas.setAttribute("id",b.id+"_background");
b.backCanvas.setAttribute("width",b.w+"px");b.backCanvas.setAttribute("height",b.h+"px");b.canvas=document.createElement("canvas");b.canvas.setAttribute("id",b.id+"_canvas");b.canvas.setAttribute("width",b.w+"px");b.canvas.setAttribute("height",b.h+"px");b.canvas.setAttribute("class","DescartesSpace3DCanvas");b.canvas.setAttribute("style","z-index: "+b.zIndex+";");b.ctx=b.canvas.getContext("2d");b.ctx.imageSmoothingEnabled=!1;d=b.id+".image";b.parent.images[d]=b.canvas;b.parent.images[d].ready=1;
b.parent.images[d].complete=!0;b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);b.graphicControlContainer=document.createElement("div");b.graphicControlContainer.setAttribute("id",b.id+"_graphicControls");b.graphicControlContainer.setAttribute("style","position:absolute;left:0px;top:0px;z-index:"+b.zIndex+";");b.numericalControlContainer=document.createElement("div");b.numericalControlContainer.setAttribute("id",b.id+"_numericalControls");b.numericalControlContainer.setAttribute("style",
"position:absolute;left:0px;top:0px;z-index:"+b.zIndex+";");b.container=document.createElement("div");b.container.setAttribute("id",b.id);b.container.setAttribute("class","DescartesSpace3DContainer");b.container.setAttribute("style","left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numericalControlContainer);c.container.insertBefore(b.container,c.loader);
b.eye={x:0,y:0,z:0};b.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var e=b.lights.length;d<e;d++)b.lights[d]=a.normalize3D(b.lights[d]);b.light3={x:0,y:0,z:0};b.intensity=[.4,.5,.3,0];b.userIntensity=0;b.dim=1;b.tmpIntensity=[];b.OxStr=b.id+".Ox";b.OyStr=b.id+".Oy";b.scaleStr=b.id+".escala";b.wStr=b.id+"._w";b.hStr=b.id+"._h";b.obsStr=b.id+".observador";b.ojoXStr=b.id+".Ojo.x";b.ojoYStr=b.id+".Ojo.y";b.ojoZStr=b.id+".Ojo.z";b.rotZStr=b.id+".rot.z";b.rotYStr=b.id+
".rot.y";b.userIDimStr=b.id+".userIlum.dim";b.userIIStr=b.id+".userIlum.I";b.userIxStr=b.id+".userIlum.x";b.userIyStr=b.id+".userIlum.y";b.userIzStr=b.id+".userIlum.z";b.evaluator.setVariable(b.rotZStr,0);b.evaluator.setVariable(b.rotYStr,0);b.evaluator.setVariable(b.userIDimStr,b.dim);b.evaluator.setVariable(b.userIIStr,b.userIntensity);b.evaluator.setVariable(b.userIxStr,0);b.evaluator.setVariable(b.userIyStr,0);b.evaluator.setVariable(b.userIzStr,0);P=new a.Primitive3D({vertices:[new a.Vector4D(0,
0,0,1)],type:"vertex"},b);b.evaluator.setFunction(b.id+"._X3D2D_",function(a,c,d){P.vertices[0].x=a;P.vertices[0].y=c;P.vertices[0].z=d;P.computeDepth(b);return P.projVert[0].x});b.evaluator.setFunction(b.id+"._Y3D2D_",function(a,c,d){P.vertices[0].x=a;P.vertices[0].y=c;P.vertices[0].z=d;P.computeDepth(b);return P.projVert[0].y});b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));b.ratio=1;b.addEvents()};a.extend(a.Space3D,a.Space);a.Space3D.prototype.init=
function(a){b=this;b.initSpace();b.canvas&&(b.canvas.width=b.backCanvas.width=b.w,b.canvas.height=b.backCanvas.height=b.h,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px");b.w_2=b.w/2;b.h_2=b.h/2;b.w_plus_h=b.w+b.h;b.oldMouse={x:0,y:0};b.S={x:b.h/1080*-20.6*(40/b.scale),y:0,z:0};b.Ojo={x:3*b.w_2,y:0,z:0};b.evaluator.setVariable(b.ojoXStr,b.Ojo.x);b.evaluator.setVariable(b.ojoYStr,b.Ojo.y);b.evaluator.setVariable(b.ojoZStr,b.Ojo.z)};a.Space3D.prototype.update=
function(a){b=this;v=b.evaluator;l=b.parent;v.setVariable(b.wStr,b.w);v.setVariable(b.hStr,b.h);b.drawIfValue=0<v.eval(b.drawif);if(b.drawIfValue){b.resizable&&(wModExpr=b.evaluator.eval(b.wModExpr),hModExpr=b.evaluator.eval(b.hModExpr),b.old_w!=wModExpr||b.old_h!=hModExpr)&&(b.w=wModExpr,b.h=hModExpr,b.w_2=b.w/2,b.h_2=b.h/2,v.setVariable(b.wStr,b.w),v.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=
b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",a=!0,b.S={x:b.h/1080*-20.6*(40/b.scale),y:0,z:0},b.Ojo={x:3*b.w_2,y:0,z:0},b.evaluator.setVariable(b.ojoXStr,b.Ojo.x),b.evaluator.setVariable(b.ojoYStr,b.Ojo.y),b.evaluator.setVariable(b.ojoZStr,b.Ojo.z));p=b.x!==v.eval(b.xExpr)+b.displaceRegionWest;q=b.y!==v.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||p||q||b.drawBefore!==b.drawIfValue||b.Ox!==v.getVariable(b.OxStr)||b.Oy!==v.getVariable(b.OyStr)||
b.Ojo.x!==v.getVariable(b.ojoXStr)||b.Ojo.y!==v.getVariable(b.ojoYStr)||b.Ojo.z!==v.getVariable(b.ojoZStr)||b.scale!==v.getVariable(b.scaleStr);b.x=p?v.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=q?v.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth:b.y;b.Ojo.x=v.getVariable(b.ojoXStr);b.Ojo.y=v.getVariable(b.ojoYStr);b.Ojo.z=v.getVariable(b.ojoZStr);b.Ox=v.getVariable(b.OxStr);b.Oy=v.getVariable(b.OyStr);b.scale=v.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;if(a||void 0==b.observer){a=0;for(var c=
b.parent.controls.length;a<c;a++)b.parent.controls[a].id===b.obsStr&&(M=!0);b.observer=M?v.getVariable(b.obsStr)||2.5*b.w_plus_h:2.5*b.w_plus_h;b.observer=h(b.observer,.25*b.w_plus_h);v.setVariable(b.obsStr,b.observer)}1E-6>b.scale?(b.scale=1E-6,v.setVariable(b.scaleStr,1E-6)):1E6<b.scale&&(b.scale=1E6,v.setVariable(b.scaleStr,1E6));if(p||q)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.dim=v.getVariable(b.userIDimStr);b.userIntensity=v.getVariable(b.userIIStr);
b.light3={x:parseInt(v.getVariable(b.userIxStr)),y:parseInt(v.getVariable(b.userIyStr)),z:parseInt(v.getVariable(b.userIzStr))};b.updateCamera();b.draw()}else b.container.style.display="none"};a.Space3D.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};a.Space3D.prototype.rotateVertex=function(e){w=a.degToRad(b.evaluator.getVariable(b.rotZStr));x=d(w);B=c(w);g=e.x*x-e.y*B;k=e.x*B+e.y*x;f=e.z;w=a.degToRad(b.evaluator.getVariable(b.rotYStr));x=d(w);B=c(w);return{x:f*
B+g*x,y:k,z:f*x-g*B}};a.Space3D.prototype.project=function(a){b=this;this.evaluator.getVariable("URL.oldProj");var c=b.eye.x/(a.x-b.eye.x);return{x:b.getAbsoluteX(c*(b.eye.y-a.y)),y:b.getAbsoluteY(c*(b.eye.z-a.z)),z:b.eye.x-a.x}};a.Space3D.prototype.computeColor=function(b,c,d){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));K=a.subtract3D(this.eye,c.average);L=a.norm3D(K);z=a.scalarProduct3D(K,1/L);this.lights[3]=a.subtract3D(this.light3,c.average);I=a.norm3D(this.lights[3]);
for(var f=0,g=this.intensity.length-1;f<g;f++)E[f]=this.intensity[f]*this.dim;E[3]=this.userIntensity*this.userIntensity/I||0;A=d?this.dim/2:this.dim/4;F=0;J=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);f=0;for(g=this.lights.length;f<g;f++)d?(F=Math.max(0,a.dotProduct3D(m(this.lights[f],J),z)),F*=F*F):F=Math.max(0,a.dotProduct3D(this.lights[f],J)),A+=E[f]*F;A=Math.min(A,1);D=e(b.r*A);H=e(b.g*A);G=e(b.b*A);return"rgba("+D+","+H+","+G+","+b.a+")"};a.Space3D.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++){n=this.graphics[a];for(var c=a+1;c<b;c++)y=this.graphics[c],n.splitFace(y),y.splitFace(n);this.primitives=this.primitives.concat(n.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){n=this.graphics[a];if(n.split)for(c=
a+1;c<b;c++)y=this.graphics[c],y.split&&n.splitFace(y);this.primitives=this.primitives.concat(n.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()};a.Space3D.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,g=a.length,h=.001,k,l;;){k=g;for(c=0;c<b;c++)if(!a[c].drawn){l=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(d,a[m],h)){l=!1;break}l&&(g--,e[f++]=a[c],a[c].drawn=!0)}if(0==g)break;else if(g==k){if(h*=10,.1<h){for(c=0;c<b;c++)a[c].drawn||(e[f++]=a[c],a[c].drawn=!0);break}}else h=.001}for(c=0;c<b;c++)e[c].draw(this.ctx,this)};a.Space3D.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}};a.Space3D.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);window.removeEventListener("touchmove",f,!1);window.removeEventListener("touchend",b,!1);a.preventDefault();g.parent.update()}function c(b){document.body.focus();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);b.preventDefault();"R"===g.whichBtn&&
(window.removeEventListener("mousemove",e,!1),g.posZoom==g.posZoomNew&&a.showConfig&&g.parent.externalSpace.show());window.removeEventListener("mousemove",f,!1);window.removeEventListener("mouseup",c,!1);g.parent.update()}function d(b){g.posAnte=a.getCursorPosition(b,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.id+".mouse_x",g.mouse_x);g.evaluator.setVariable(g.id+".mouse_y",g.mouse_y);g.parent.update();Date.now()}function e(b){b.preventDefault();
g.posZoomNew=a.getCursorPosition(b,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.posObserverNew=a.getCursorPosition(b,g.container).x;g.evaluator.setVariable(g.obsStr,g.tempObserver-2.5*(g.posObserver-g.posObserverNew));g.parent.update()}function f(b){if(!g.fixed&&g.click){r=(g.getAbsoluteX(g.oldMouse.x)-g.getAbsoluteX(g.mouse_x))/4;u=(-g.getAbsoluteY(g.oldMouse.y)+g.getAbsoluteY(g.mouse_y))/4;if(r!==g.disp.x||u!==g.disp.y)g.alpha=a.degToRad(g.evaluator.getVariable(g.rotZStr)),
g.beta=a.degToRad(-g.evaluator.getVariable(g.rotYStr)),g.alpha=a.radToDeg(g.alpha)-r,g.beta=a.radToDeg(g.beta)-u,g.evaluator.setVariable(g.rotZStr,g.alpha),g.evaluator.setVariable(g.rotYStr,-g.beta),g.disp.x=r,g.disp.y=u,g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(b);b.preventDefault()}}var g=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();g.click=1;g.evaluator.setVariable(g.id+
".mouse_pressed",1);g.parent.deactivateGraphiControls();g.posAnte=a.getCursorPosition(c,g.container);g.oldMouse.x=g.getRelativeX(g.posAnte.x);g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(c);window.addEventListener("touchmove",f);window.addEventListener("touchend",b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();g.click=1;g.parent.deactivateGraphiControls();g.whichBtn=a.whichBtn(b);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posObserver=
a.getCursorPosition(b,g.container).x,g.posObserverNew=g.posObserver,g.posZoom=a.getCursorPosition(b,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,g.tempObserver=g.observer,window.addEventListener("mousemove",e))):"L"==g.whichBtn&&(g.evaluator.setVariable(g.id+".mouse_pressed",1),g.posAnte=a.getCursorPosition(b,g.container),g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y),d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",
c));b.preventDefault()});this.disp={x:0,y:0};this.canvas.addEventListener("dblclick",function(a){})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.SpaceHTML_IFrame=function(d,c){a.Space.call(this,d,c);g=this.parent.evaluator;void 0!=this._w_&&(d=g.parser.parse(this._w_),this._w_="number"!=d.type?d:void 0);void 0!=this._h_&&(d=g.parser.parse(this._h_),this._h_="number"!=d.type?d:void 0);this.isFirefox=/firefox/i.test(window.navigator.userAgent);this.file=this.file?this.file.trim():"";this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=g.parser.parse(this.file.substring(1,this.file.length-
1)):this.file.match(/^'/)&&this.file.match(/'$/)?this.file=g.parser.parse(this.file):this.file=g.parser.parse("'"+this.file+"'");this.oldFile=g.eval(this.file);this.MyIFrame=document.createElement("iframe");0!=this.oldFile&&this.MyIFrame.setAttribute("src",this.oldFile);this.MyIFrame.setAttribute("marginheight",0);this.MyIFrame.setAttribute("marginwidth",0);this.MyIFrame.setAttribute("frameborder",0);this.MyIFrame.setAttribute("scrolling","auto");this.MyIFrame.setAttribute("style","position:static;left:0;top:0;");
this.container=document.createElement("div");this.container.setAttribute("id",this.id);this.container.setAttribute("style",(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-repeat:no-repeat;background-position:center;");this.container.appendChild(this.MyIFrame);this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+
")");this.parent.container.insertBefore(this.container,this.parent.loader);var e=this;this.MyIFrame.onload=function(a){var b=this;e.evaluator.setFunction(e.id+".set",function(a,c){b.contentWindow.postMessage({type:"set",name:a,value:c},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){b.contentWindow.postMessage({type:"update"},"*");return 0});e.evaluator.setFunction(e.id+".exec",function(a,c){b.contentWindow.postMessage({type:"exec",name:a,value:c},"*");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=""};this.update=this.iframeUpdate;this.evaluator.setVariable(this.id+"._scroll",0)};a.extend(a.SpaceHTML_IFrame,a.Space);a.SpaceHTML_IFrame.prototype.init=function(){e=this;e.initSpace();e.MyIFrame&&(e.MyIFrame.style.width=e.w+"px",e.MyIFrame.style.height=
e.h+"px",e.MyIFrame.style.left=e.x+"px",e.MyIFrame.style.top=e.y+"px")};a.SpaceHTML_IFrame.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){this.MyIFrame.contentWindow.focus();a&&
(this.y=this.x=Infinity);k=this.x!==g.eval(this.xExpr)+this.displaceRegionWest;f=this.y!==g.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=k?g.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=f?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(k||f)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";m=g.eval(this.file);m!==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=m,this.MyIFrame.contentWindow.location.replace(m));h=g.getVariable(this.id+"._scroll");1==h?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==h?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.DescartesLoader=function(f){var m=this;this.children=f.children;this.lessonParser=f.lessonParser;this.images=f.images;this.images.length=f.images.length;this.audios=f.audios;this.audios.length=f.audios.length;this.descartesApp=f;var e=f.imgLoader?f.imgLoader:k(f.loader.width,f.loader.height,f.ratio);this.imageLoader=document.createElement("div");this.imageLoader.width=f.width;this.imageLoader.height=f.height;this.imageLoader.setAttribute("class",
"DescartesLoaderImage");this.imageLoader.setAttribute("style","background-image:url("+e+");background-size:cover;width:"+f.width+"px;height:"+f.height+"px;");f.loader.appendChild(this.imageLoader);this.loaderBar=document.createElement("canvas");this.loaderBar.width=f.width;this.loaderBar.height=f.height;this.loaderBar.setAttribute("class","DescartesLoaderBar");this.loaderBar.setAttribute("style","width:"+f.width+"px;height:"+f.height+"px;");this.loaderBar.ctx=this.loaderBar.getContext("2d");this.loaderBar.ctx.lineCap=
"round";this.loaderBar.ctx.lineWidth=14;this.loaderBar.ctx.translate(f.width/2,(f.height-840*g)/3+760*g);this.loaderBar.ctx.scale(g,g);f.loader.appendChild(this.loaderBar);this.timer=a.setInterval(function(){m.drawLoaderBar(m.loaderBar.ctx,356)},10);f.firstRun=!1;this.initPreloader()};a.DescartesLoader.prototype.initPreloader=function(){var f=this.children,g=this.images,e=this.audios,h=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,d=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;g["lib/DescartesCCLicense.png"]=
a.getCCLImg();g["lib/DescartesCCLicense.png"].addEventListener("load",function(){this.ready=1});g["lib/DescartesCCLicense.png"].addEventListener("error",function(){this.errorload=1});var c,k;var l=0;for(c=f.length;l<c;l++)if("rtf"!==f[l].name){if(f[l].value.match(/'macro'|'makro'/g)){var b="";var n;var y=this.lessonParser.split(f[l].value);var p=0;for(k=y.length;p<k;p++)"expresion"===babel[y[p][0]]&&(b=y[p][1]);b&&((n=document.getElementById(b))&&"descartes/macro"==n.type?n=n.text:(n=a.openExternalFile(b))&&
!n.match(/tipo_de_macro/g)&&(n=null));if(n&&(y=n.match(h)))for(b=0,k=y.length;b<k;b++)p=y[b],p.toLowerCase().match(/vacio.gif$/)||""==p.substring(0,p.length-4)||(g[p]=new Image,g[p].addEventListener("load",function(){this.ready=1}),g[p].addEventListener("error",function(){this.errorload=1}),g[p].src=p)}if(y=f[l].value.match(h))for(b=0,k=y.length;b<k;b++)p=y[b],p.toLowerCase().match(/vacio.gif$/)||""==p.substring(0,p.length-4)||(g[p]=new Image,g[p].addEventListener("load",function(){this.ready=1}),
g[p].addEventListener("error",function(){this.errorload=1}),g[p].src=p);if(y=f[l].value.match(d))for(b=0,p=y.length;b<p;b++)this.initAudio(y[b])}for(var q in g)g.hasOwnProperty(q)&&this.images.length++;for(q in e)e.hasOwnProperty(q)&&this.audios.length++;var r=this,u=this.images.length+this.audios.length;this.sep=712/(u-1);var w=function(){r.readys=0;for(var b in g)g.hasOwnProperty(b)&&(g[b].ready||g[b].errorload)&&r.readys++;for(b in e)e.hasOwnProperty(b)&&(e[b].ready||e[b].errorload)&&r.readys++;
r.readys!=u?a.setTimeout(w,30):(a.clearInterval(r.timer),r.descartesApp.initBuildApp())};w()};a.DescartesLoader.prototype.initAudio=function(f){var g=this.audios;g[f]=new Audio(f);g[f].filename=f;var e=function(){this.ready=1},h=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.log("El archivo '"+f+"' no puede ser reproducido"),this.errorload=1):(g[f]=new Audio(this.filename.replace("mp3","ogg")),
g[f].filename=this.filename.replace("mp3","ogg"),g[f].addEventListener("canplaythrough",e),g[f].addEventListener("load",e),g[f].addEventListener("error",h),g[f].load())};g[f].addEventListener("canplaythrough",e);g[f].addEventListener("load",e);g[f].addEventListener("error",h);a.hasTouchSupport?(g[f].load(),g[f].play(),a.setTimeout(function(){g[f].pause()},20),g[f].ready=1):g[f].load()};a.DescartesLoader.prototype.drawLoaderBar=function(a){a.beginPath();a.strokeStyle="#f2f2f2";a.moveTo(-356,0);a.lineTo(356,
0);a.stroke();a.beginPath();a.strokeStyle="#2daae4";a.moveTo(-356,0);a.lineTo(-356+this.readys*this.sep,0);a.stroke()};var k=function(f,k,e){var h=document.createElement("canvas");e=5E6<f*this.ratio*k*this.ratio?1:e;h.width=f*e;h.height=k*e;h.style.width=f+"px";h.style.height=k+"px";var d=h.getContext("2d");d.setTransform(e,0,0,e,0,0);g=f<k?f/1144:k/1092;g=2.5<g?2.5:g;d.translate((f-880*g)/2,(k-840*g)/3);d.scale(g,g);d.drawImage(a.loaderImg,0,0);return h.toDataURL()};return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var c="[",d=0,e=a.length;d<e;d++)a[d]instanceof Array?c+=g(a[d]):(f=a[d],"undefined"!=typeof f&&f||(f=0),"string"==typeof f&&(f="'"+f+"'"),c+=f),d<e-1&&(c+=",");return c+"]"}function k(){m=window.innerWidth/this.width;e=window.innerHeight/this.height;h=Math.min(m,e);a.cssScale=h;this.container.parentNode.setAttribute("align","");this.container.style.transformOrigin="0 0";m<e?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+
h+")"):(this.container.style.left="50%",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+h+") translate(-50%, 0)")}if(a.loadLib)return a;var f,m,e,h;a.DescartesApp=function(d){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=d;this.parentC=d.parentNode;this.width=parseFloat(d.getAttribute("width"));this.height=parseFloat(d.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language=
"espa\u00f1ol";this.children=d.getElementsByTagName("param");a.ccLicense=!0;for(var c=0,e=this.children.length;c<e;c++)"CreativeCommonsLicense"===this.children[c].name&&(a.ccLicense="no"!==this.children[c].value);this.code=d.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.init()};a.DescartesApp.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 {\\*\\hyperlink licencia Creative Commons|http://creativecommons.org/licenses/by-nc-sa/4.0/}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Arqu\u00edmedes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var d=this.children,c,e=0,f=0,b=a.ccLicense?90:0,g=0,h=d.length;g<h;g++)c=d[g],"rtf_height"==c.name&&(e=parseInt(c.value)||this.height),"Buttons"==babel[c.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(c.value),f=this.buttonsConfig.height),"image_loader"==c.name&&(this.imgLoader=c.value),"expand"==c.name&&("cover"==c.value?this.expand=c.value:"fit"==c.value&&(this.scaleToFit=k)),"docBase"==c.name&&(this.docBase=c.value,c=document.createElement("base"),c.setAttribute("id","descartesJS_base"),
c.setAttribute("href",this.docBase),document.head.appendChild(c));this.expand&&"cover"==this.expand&&(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,e&&(this.height=e+f+b));this.spaces=[];this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:document.createElement("div"),controls:[]};this.southSpace={container:document.createElement("div"),controls:[]};this.eastSpace=
{container:document.createElement("div"),controls:[]};this.westSpace={container:document.createElement("div"),controls:[]};this.editableRegion={container:document.createElement("div"),textFields:[]};a.Editor&&(this.editor=new a.Editor(this));this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&this.parentC.removeChild(this.container);this.container=document.createElement("div");this.loader=document.createElement("div");
this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.width;this.container.height=this.height;this.container.setAttribute("class","DescartesAppContainer");this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.scaleToFit();this.container.appendChild(this.loader);this.loader.width=this.width;this.loader.height=this.height;this.loader.setAttribute("class","DescartesLoader");this.loader.setAttribute("style","width:"+this.width+
"px;height:"+this.height+"px;z-index:1000;");this.imgLoader&&(this.loader.style.backgroundColor="rgba(0,0,0,0)");this.firstRun?this.descartesLoader=new a.DescartesLoader(this):this.initBuildApp()};a.DescartesApp.prototype.initBuildApp=function(){a.showConfig=!0;for(var d=this.children,c,e=this.lessonParser,f=[],b=[],g=[],h=[],k=[],m=[],r=0,u=d.length;r<u;r++)if(c=d[r],"editable"==babel[c.name])a.showConfig="false"==babel[c.value]?!1:!0;else if("language"==babel[c.name])this.language=c.value;else if("pleca"==
c.name)c=e.parsePleca(c.value,this.width),this.container.insertBefore(c,this.loader),this.plecaHeight=c.imageHeight?c.imageHeight:c.offsetHeight;else if("Buttons"==babel[c.name])this.buttonsConfig=e.parseButtonsConfig(c.value);else if("decimal_symbol"==babel[c.name])this.decimal_symbol=c.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[c.name])this.version=parseInt(c.value);else if("language"==babel[c.name])this.language=c.value;else if("rtf"==c.name){var w=
(this.width-780)/2,x=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;h.push("space='descartesJS_stage' type='text' expresion='[10,20]' background='yes' text='"+c.value.replace(/'/g,"&squot;")+"'");h.push("space='descartesJS_stage' type='text' expresion='["+w+","+(x-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&h.push("space='descartesJS_stage' type='image' expresion='["+(w+15)+","+x+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==
c.name.charAt(0)?(c.value.match(/'HTMLIFrame'/)&&this.nIframes++,f.push(c.value)):/^C_/.test(c.name)?b.push(c.value):/^A_/.test(c.name)?g.push(c.value):/^G_/.test(c.name)?(c.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),h.push(c.value)):/^S_/.test(c.name)?k.push(c.value):"Animation"==babel[c.name]&&m.push(c.value);this.stage={container:document.createElement("div"),scroll:0};this.stage.container.setAttribute("id",
"descartesJS_Stage");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.arquimedes&&(this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));r=0;for(u=f.length;r<u;r++)d=e.parseSpace(f[r]),this.arquimedes&&
this.stage.container.appendChild(d.container),this.spaces.push(d),this.zIndex++;r=0;for(u=h.length;r<u;r++)if(a.DEBUG.elemIndex=r,f=e.parseGraphic(h[r]))this.editableRegionVisible=this.editableRegionVisible||f.visible,f.space.addGraph(f);r=0;for(u=k.length;r<u;r++)(f=e.parse3DGraphic(k[r]))&&f.space.addGraph(f,!0);r=0;for(u=b.length;r<u;r++)this.controls.push(e.parseControl(b[r]));r=0;for(u=g.length;r<u;r++)e.parseAuxiliar(g[r]);r=0;for(u=m.length;r<u;r++)this.animation=e.parseAnimation(m[r]);this.configRegions();
this.updateAuxiliaries();this.updateAuxiliaries();r=0;for(u=this.controls.length;r<u;r++)this.controls[r].init();this.updateControls();this.updateSpaces(!0);var B=this;this.nIframes?a.setTimeout(function(){B.finishInit()},200*this.nIframes):this.finishInit()};a.DescartesApp.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin="0px",this.parentC.style.padding=
"0px",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 d=new CustomEvent("descartesReady",{detail:this})}catch(c){console.warn("CustomEvents not supported in this browser")}window.dispatchEvent(d);this.readyApp=!0};a.DescartesApp.prototype.adjustSize=
function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var d=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-d)/2,(parseInt(screen.height)-c)/2);window.resizeTo(d,c);a.onResize()};a.DescartesApp.prototype.adjustDimensions=function(){if(void 0==this.init_w||void 0==this.init_h)this.init_w=parseInt(this.container.style.width),this.init_h=parseInt(this.container.style.height);var a=parseInt(this.parentC.offsetWidth);
var c=this.init_w;var e=a/c;c>a?(this.parentC!=document.body&&(this.parentC.style.height=this.init_h*e+"px"),this.percent=e,this.container.style.webkitTransform=this.container.style.MozTransform="scale("+e+")",this.container.style.webkitTransformOrigin=this.container.style.MozTransformOrigin="top left"):(this.parentC!=document.body&&(this.parentC.style.height="auto"),this.percent=1,this.container.style.webkitTransform=this.container.style.MozTransform="",this.container.style.webkitTransformOrigin=
this.container.style.MozTransformOrigin="")};a.DescartesApp.prototype.configRegions=function(){var d=this.evaluator.parser,c=this.buttonsConfig,e=this.container,f="15",b=configWidth=initWidth=clearWidth=100;2==this.version&&(f="14",b=63,configWidth=50,initWidth=44,clearWidth=53);var g=southRegionHeight=eastRegionHeight=westRegionHeight=editableRegionHeight=northRegionWidht=southRegionWidht=eastRegionWidth=westRegionWidth=0,h=this.northSpace.controls,k=this.southSpace.controls,m=this.eastSpace.controls,
r=this.westSpace.controls;if(0<c.rowsNorth||0<h.length||c.about||c.config){0>=c.rowsNorth?(g=c.height,c.rowsNorth=1):g=c.height*c.rowsNorth;var u=this.northSpace.container;u.setAttribute("id","descartesJS_north");u.setAttribute("style","width:"+e.width+"px;height:"+g+"px;background:#c0c0c0;position:absolute;left:0px;top:"+this.plecaHeight+"px;z-index:100;");e.insertBefore(u,this.loader);northRegionWidht=e.width;var w=0;c.about?(w=b,northRegionWidht-=w):b=0;c.config&&(northRegionWidht-=configWidth);
u=Math.ceil(h.length/c.rowsNorth);for(var x=northRegionWidht/u,B=0,D=h.length;B<D;B++)h[B].expresion=d.parse("("+(w+B%u*x)+","+c.height*Math.floor(B/u)+","+x+","+c.height+")"),h[B].drawif=d.parse("1"),h[B].init();c.about&&(B=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:d.parse(f),expresion:d.parse("(0, 0, "+b+", "+g+")")}),B.actionExec={execute:a.showAbout},B.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:d.parse(f),
action:"config",expresion:d.parse("("+(northRegionWidht+b)+", 0, "+configWidth+", "+g+")")})).update()}if(0<c.rowsSouth||0<k.length||c.init||c.clear){0>=c.rowsSouth?(southRegionHeight=c.height,c.rowsSouth=1):southRegionHeight=c.height*c.rowsSouth;southRegionWidht=e.width;w=0;c.init?(w=initWidth,southRegionWidht-=w):initWidth=0;c.clear&&(southRegionWidht-=clearWidth);u=this.southSpace.container;u.setAttribute("id","descartesJS_south");u.setAttribute("style","width:"+e.width+"px;height:"+southRegionHeight+
"px;background:#c0c0c0;position:absolute;left:0px;top:"+(e.height-southRegionHeight)+"px;z-index:100;");e.insertBefore(u,this.loader);u=Math.ceil(k.length/c.rowsSouth);x=southRegionWidht/u;B=0;for(D=k.length;B<D;B++)k[B].expresion=d.parse("("+(w+B%u*x)+","+c.height*Math.floor(B/u)+","+x+","+c.height+")"),k[B].drawif=d.parse("1"),k[B].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:d.parse(f),action:"init",expresion:d.parse("(0, 0, "+initWidth+
", "+southRegionHeight+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:d.parse(f),action:"clear",expresion:d.parse("("+(southRegionWidht+initWidth)+", 0, "+clearWidth+", "+southRegionHeight+")")})).update()}if(0<m.length)for(eastRegionHeight=e.height-g-southRegionHeight,eastRegionWidth=c.widthEast,u=this.eastSpace.container,u.setAttribute("id","descartesJS_east"),u.setAttribute("style","width:"+eastRegionWidth+"px;height:"+eastRegionHeight+
"px;background:#c0c0c0;position:absolute;left:"+(e.width-eastRegionWidth)+"px;top:"+g+"px;z-index:100;"),e.insertBefore(u,this.loader),B=0,D=m.length;B<D;B++)m[B].expresion=d.parse("(0,"+c.height*B+","+eastRegionWidth+","+c.height+")"),m[B].drawif=d.parse("1"),m[B].init();if(0<r.length)for(westRegionHeight=e.height-g-southRegionHeight,westRegionWidth=c.widthWest,u=this.westSpace.container,u.setAttribute("id","descartesJS_west"),u.setAttribute("style","width: "+westRegionWidth+"px;height:"+westRegionHeight+
"px;background:#c0c0c0;position:absolute;left:0px;top:"+g+"px;z-index:100;"),e.insertBefore(u,this.loader),B=0,D=r.length;B<D;B++)r[B].expresion=d.parse("(0,"+c.height*B+","+westRegionWidth+","+c.height+")"),r[B].drawif=d.parse("1"),r[B].init();if(this.editableRegionVisible)for(editableRegionHeight=c.height,u=this.editableRegion.container,u.setAttribute("id","descartesJS_editableRegion"),u.setAttribute("style","width:"+e.width+"px;height:"+editableRegionHeight+"px;position:absolute;left:0px;top:"+
(e.height-southRegionHeight-c.height)+"px;z-index:100;background:#c0c0c0;overflow:hidden;"),e.insertBefore(u,this.loader),d=this.editableRegion.textFields,e=e.width/d.length,c=a.getFieldFontSize(editableRegionHeight),B=0,D=d.length;B<D;B++)"div"==d[B].type?(u.appendChild(d[B].container),d[B].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+editableRegionHeight+"px;position:absolute;left:"+B*e+"px;top:0;"),f=d[B].container.firstChild,f.setAttribute("style",
"font-family:"+a.sansserif_font+";font-size:"+c+"px;padding-top:0px;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+editableRegionHeight+"px;text-align:center;line-height:"+editableRegionHeight+"px;"),b=f.offsetWidth,f.style.width=b+"px",f.firstChild.textContent=f.firstChild.textContent.substring(3,f.firstChild.textContent.length-3),d[B].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+(e-b)+"px;height:"+editableRegionHeight+"px;position:absolute;left:"+
b+"px;top:0;border:2px groove white;")):(u.appendChild(d[B]),d[B].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+e+"px;height:"+editableRegionHeight+"px;position:absolute;left:"+B*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=g;this.displaceRegionSouth=southRegionHeight;this.displaceRegionEast=eastRegionWidth;this.displaceRegionWest=westRegionWidth;B=0;for(D=this.spaces.length;B<D;B++)this.spaces[B].init()};a.DescartesApp.prototype.update=function(){this.updateAuxiliaries();
this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};a.DescartesApp.prototype.clearClick=function(){for(var a=0,c=this.spaces.length;a<c;a++)this.spaces[a].clearClick()};a.DescartesApp.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var d=0,c=this.controls.length;d<c;d++)this.controls[d].buttonClick=!1};a.DescartesApp.prototype.deactivateGraphiControls=function(){for(var a,c=0,e=this.controls.length;c<e;c++)a=this.controls[c],"graphic"==a.type&&a.deactivate()};
a.DescartesApp.prototype.updateAuxiliaries=function(){for(var a=0,c=this.auxiliaries.length;a<c;a++)this.auxiliaries[a].update()};a.DescartesApp.prototype.updateEvents=function(){for(var a=0,c=this.events.length;a<c;a++)this.events[a].update()};a.DescartesApp.prototype.updateControls=function(){for(var a=0,c=this.controls.length;a<c;a++)this.controls[a].update()};a.DescartesApp.prototype.updateSpaces=function(a){for(var c=0,d=this.spaces.length;c<d;c++)this.spaces[c].update(a)};a.DescartesApp.prototype.clear=
function(){for(var a=0,c=this.spaces.length;a<c;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};a.DescartesApp.prototype.play=function(){this.animation.play()};a.DescartesApp.prototype.stop=function(){this.animation.stop()};a.DescartesApp.prototype.reinitAnimation=function(){this.animation.reinit()};a.DescartesApp.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)};a.DescartesApp.prototype.getImage=function(a){var c=this.images;return a?(c[a]||(c[a]=new Image,c[a].addEventListener("load",function(){this.ready=1}),c[a].addEventListener("error",function(){this.ready=0;this.errorload=1}),c[a].src=a),c[a]):new Image};a.DescartesApp.prototype.getAudio=function(d){var c=this.audios;if(d){if(!c[d]){var e=d.lastIndexOf(".");e=-1===e?d.lenght:e;d.substring(0,e);c[d]=new Audio(d);var f=function(a){this.ready=1};c[d].addEventListener("canplaythrough",
f);var b=function(a){this.canPlayType("audio/"+d.substring(d.length-3))||"mp3"!=d.substring(d.length-3)?(console.log("El archivo '"+d+"' no puede ser reproducido"),this.errorload=1):(c[d]=new Audio(d.replace("mp3","ogg")),c[d].addEventListener("canplaythrough",f),c[d].addEventListener("load",f),c[d].addEventListener("error",b),c[d].load())};c[d].addEventListener("error",b);c[d].play();a.setTimeout(function(){c[d].pause()},15)}return c[d]}return new Audio};a.DescartesApp.prototype.getControlByCId=
function(a){return this.getControlById(a,!0)};a.DescartesApp.prototype.getControlById=function(a,c){c=c?"cID":"id";for(var d,e=0,b=this.controls.length;e<b;e++)if(d=this.controls[e],d[c]==a)return d;return{update:function(){},w:0,h:0}};a.DescartesApp.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};a.DescartesApp.prototype.getSpaceById=function(a,c){c=c?"cID":"id";for(var d,e=0,b=this.spaces.length;e<b;e++)if(d=this.spaces[e],d[c]==a)return d;return{update:function(){},w:0,h:0}};
a.DescartesApp.prototype.getURLParameters=function(){var a=window.location.href,c=a.indexOf("?");if(-1!=c){a=decodeURIComponent(a.substring(c+1)).split("&");for(var e=0,f=a.length;e<f;e++)c=a[e].split("="),2==c.length&&(+c[1]==+c[1]&&(c[1]=parseFloat(c[1])),this.evaluator.setVariable("URL."+c[0],c[1]))}};a.DescartesApp.prototype.getState=function(){var a="",c=this.evaluator.variables,e;for(e in c)if(c.hasOwnProperty(e)){var f=c[e];"string"==typeof f&&(f="'"+f+"'");void 0!=f&&"rnd"!=e&&"pi"!=e&&"e"!=
e&&"Infinity"!=e&&"-Infinity"!=e&&"object"!=typeof f&&(a=""!=a?a+"\n"+e+"="+f:e+"="+f)}c=this.evaluator.vectors;for(var b in c)c.hasOwnProperty(b)&&(f=c[b],a=a+"\n"+b+"="+g(f));b=this.evaluator.matrices;for(var h in b)b.hasOwnProperty(h)&&(f=b[h],a=a+"\n"+h+"="+g(f));return a};a.DescartesApp.prototype.setState=function(a,c){a=a.split("\n");for(var d,e,b=0,f=a.length;b<f;b++)d=a[b].split("="),2<=d.length&&(e=eval(d[1]),-1!=d[1].indexOf("[[")?(this.evaluator.matrices[d[0]]=e,this.evaluator.matrices[d[0]].rows=
e.length,this.evaluator.matrices[d[0]].cols=e[0].length):-1!=d[1].indexOf("[")?(this.evaluator.vectors[d[0]]=e,this.evaluator.variables[d[0]+".long"]=e.length):this.evaluator.variables[d[0]]=e);c||this.update()};a.DescartesApp.prototype.getEvaluation=function(){for(var a=0,c=0,e="",f=0,b=this.controls.length;f<b;f++)"textfield"==this.controls[f].gui&&this.controls[f].evaluate&&(a++,c+=this.controls[f].ok,this.controls[f].value=""==this.controls[f].value?"''":this.controls[f].value,e+=" \\n "+this.controls[f].id+
"="+this.controls[f].value+"|"+this.controls[f].ok);return"questions="+a+" \\n correct="+c+" \\n wrong="+(a-c)+e};a.DescartesApp.prototype.showSolution=function(){for(var a=this.controls,c=0,e=a.length;c<e;c++)"textfield"==a[c].gui&&a[c].evaluate&&a[c].changeValue(a[c].getFirstAnswer());this.update()};a.DescartesApp.prototype.showAnswer=function(){for(var a=0,c=this.saveState.length;a<c;a++)this.evaluator.eval(this.saveState[a]);this.update()};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"};a.DEBUG.setError=function(g,k){g="Error: "+g+" en\u300a "+k+" \u300b. ";var f="";switch(a.DEBUG.objectName){case "Auxiliar":k="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])f=" en la l\u00ednea "+(a.DEBUG.lineCount+1);g+=k+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+f+".";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(e){e=document.createElement("div");e.innerHTML='<div style="font-size:12px;visibility:hidden;">\n<div style="font-family:descartesJS_serif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:descartesJS_sansserif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:descartesJS_monospace;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_symbola;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_extra;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_sansserif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_monospace;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_serif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n</div>';
document.body.appendChild(e);a.getFeatures();if(a.hasCanvas){window.scrollTo(0,10);for(var f=document.querySelectorAll(".DescartesAppContainer"),d=0,c=f.length;d<c;d++)f[d].parentNode.removeChild(f[d]);d=document.querySelectorAll("applet,ajs");c=/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i;f=[];for(var g=0,k=d.length;g<k;g++)c.test(d[g].getAttribute("code"))&&f.push(d[g]);d=0;for(c=f.length;d<c;d++)a.apps.push(new a.DescartesApp(f[d])),f[d].className="DescartesJS";window.addEventListener("resize",
a.onResize);window.scrollTo(0,0)}else document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";document.body.removeChild(e)}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var a=document.getElementById("StyleDescartesApps");a&&a.parentNode.removeChild(a);a=document.createElement("style");a.id="StyleDescartesApps";a.type="text/css";a.setAttribute("rel","stylesheet");a.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";
document.head.appendChild(a)})();a.onResize=function(e){0<a.apps.length&&a.apps[0].scaleToFit()};a.onMessage=function(e){if(0<a.apps.length){var f=e.data;f&&("set"===f.type?"string"==typeof f.value||"number"==typeof f.value?a.apps[0].evaluator.setVariable(f.name,f.value):f.value&&void 0!=f.value.rows?a.apps[0].evaluator.matrices[f.name]=f.value:a.apps[0].evaluator.vectors[f.name]=f.value:"update"===f.type?a.apps[0].update():"exec"===f.type?(e=a.apps[0].evaluator.getFunction(f.name))&&e.apply(a.apps[0].evaluator,
f.value.toString().split(",")):"isResizeNeeded"===f.type?e.source.postMessage({type:"doResize"},"*"):"doResize"===f.type&&0<a.apps.length&&a.apps[0].adjustSize())}};if(void 0==a.loadLib){a.loadLib=!0;window.addEventListener("load",g);window.addEventListener("message",a.onMessage);for(var k=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"],f=0,m=k.length;f<m;f++)window.addEventListener(k[f],function(e){a.onResize(e)})}return a}(descartesJS||{});
