/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2021-01-18
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var h=0;return function(){return h<a.length?{done:!1,value:a[h++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var h="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return h?h.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var h,e=[];!(h=a.next()).done;)e.push(h.value);return e};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var h=function(){};h.prototype=a;return new h};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},h={};try{return h.__proto__=a,h.a}catch(e){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,h){a.__proto__=h;if(a.__proto__!==h)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,h){a.prototype=$jscomp.objectCreate(h.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var e=$jscomp.setPrototypeOf;e(a,h)}else for(e in h)if("prototype"!=e)if(Object.defineProperties){var f=Object.getOwnPropertyDescriptor(h,e);f&&Object.defineProperty(a,e,f)}else a[e]=h[e];a.superClass_=h.prototype};
$jscomp.checkStringArgs=function(a,h,e){if(null==a)throw new TypeError("The 'this' value for String.prototype."+e+" must not be null or undefined");if(h instanceof RegExp)throw new TypeError("First argument to String.prototype."+e+" must not be a regular expression");return a+""};$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,h,e){a!=Array.prototype&&a!=Object.prototype&&(a[h]=e.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,h,e,f){if(h){e=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var q=a[f];q in e||(e[q]={});e=e[q]}a=a[a.length-1];f=e[a];h=h(f);h!=f&&null!=h&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:h})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var e=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var f="";a;)if(a&1&&(f+=e),a>>>=1)e+=e;return f}},"es6","es3");$jscomp.owns=function(a,h){return Object.prototype.hasOwnProperty.call(a,h)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,h){for(var e=1;e<arguments.length;e++){var f=arguments[e];if(f)for(var q in f)$jscomp.owns(f,q)&&(a[q]=f[q])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,e,f){var h=this.length||0;0>e&&(e=Math.max(0,h+e));if(null==f||f>h)f=h;f=Number(f);0>f&&(f=Math.max(0,h+f));for(e=Number(e||0);e<f;e++)this[e]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,h,e){a instanceof String&&(a=String(a));for(var f=a.length,q=0;q<f;q++){var p=a[q];if(h.call(e,p,q,a))return{i:q,v:p}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,e){return $jscomp.findInternal(this,a,e).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var e=[],f=0;f<this.length;f++){var h=this[f];Array.isArray(h)&&0<a?(h=Array.prototype.flat.call(h,a-1),e.push.apply(e,h)):e.push(h)}return e}},"es9","es5");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="expand";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";a.shadowBlur="shadowBlur";
a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+
a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";
a.math_font="descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(f){if(""==f)return"";h=f.split(",");e="";e+=a.getFontStyle(h[1])+" ";e+=h[2]+"px ";return e+=a.getFontName(h[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){return q[a.toLowerCase()]||""};a.getTextWidth=function(f,c){a.ctx.font=c;return Math.round(a.ctx.measureText(f).width)};a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function h(){var a,b,d,c,g,l,k;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(f){f=f||0;f=0>f?0:parseInt(f);a=this.toString();-1!==a.indexOf("e")&&(c=a.split("e"),l="-"===c[0][0]?"-":"",g="-"===l?parseFloat(c[0].substring(1)).oToFixed(11):parseFloat(c[0]).oToFixed(11),k=parseInt(c[1]),b=g.indexOf("."),g=g.replace(".",""),0>b+k?(b=0>b?1:b,a=l+"0."+"0".repeat(Math.abs(b+k))+g):a=l+g+"0".repeat(k-g.length+1));b=a.indexOf(".");-1===b?0<f&&
(a+="."+"0".repeat(f)):(d=a.length-b-1,a=d>=f?11>=f?parseFloat(a).oToFixed(f):a.substring(0,b+f+1):a+"0".repeat(f-d));return a}}if(a.loadLib)return a;var e=2*Math.PI,f=360/e,q=e/360,p=Math.floor,c,k,n,b;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*f};a.degToRad=function(a){return a*q};a.drawLine=function(a,d,c,g,f,l,k){a.lineWidth=k||1;a.strokeStyle=l||"black";b=a.lineWidth%2*.5;a.beginPath();a.moveTo(p(d)+b,p(c)+b);a.lineTo(p(g)+b,p(f)+b);a.stroke()};a.getColor=function(a,b){if("string"===
typeof b)return b;c=a.eval(b);return"rgba("+p(255*c[0][0])+","+p(255*c[0][1])+","+p(255*c[0][2])+","+(1-c[0][3])+")"};a.getFeatures=function(){var b=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(b);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);b=a.newHTML("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(b.width=b.height=1,
a.ctx=a.hasCanvas,a._ratio=2);h()};var g,d;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(g=a.indexOf("."),-1!==g)){d=a.substring(g);if(0==parseFloat(d))return a.substring(0,g);for(var b=d.length-1;0<b;b--)if("0"!==d.charAt(b))return a.substring(0,g+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,b,d){a=void 0===a?0:a;b=void 0===
b?100:b;d="linear-gradient("+(void 0===d?0:d)+"deg,";for(var c=2*a,g=a;g<b;g++)a=p(100-g-35),d+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*g-c)+"%, ";return d+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(b,d){k=b.touches?b.touches[0]:b;n=d.getBoundingClientRect();return k?{x:(k.pageX-window.pageXOffset-n.left)/a.cssScale,y:(k.pageY-window.pageYOffset-n.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,d,c=[],g=0,l=0,f=a.length;l<f;l++)d=a.charAt(l),"'"===
d&&(b=!b),b||";"!==d&&"\n"!==d||(c.push(a.substring(g,l).replace(/\n/g,"\\n")),g=l+1);c.push(a.substring(g).replace(/\n/g,"\\n"));return c};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(b){var d=a.newHTML("textarea");d.innerHTML=b;return d.value};a.newHTML=function(a,b){a=document.createElement(a);for(var d in b)a.setAttribute(d,b[d]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||
window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function d(){Date.now()-c>=b&&(a.call(),c=Date.now());g.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setInterval(a,b);var c=Date.now(),g={};g.value=requestAnimationFrame(d);return g};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function d(){Date.now()-
c>=b?a.call():g.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setTimeout(a,b);var c=Date.now(),g={};g.value=requestAnimationFrame(d);return g};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var b="<html>\n<head>\n<style>\nbody{text-align:center;}\niframe{width:650px;height:73px;overflow:hidden;border:1px solid black;}\ndt{font-weight:bold;margin-top:10px;}\n</style>\n</head>\n<body>\n<iframe src='http://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='http://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='http://descartesjs.org' target='_blank'>DescartesJS.org</a></h2>\n<dl>\n<dt>Dise\u00f1o funcional:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Jos\u00e9 R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver\u00e1 Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz\u00e1lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est\u00e1 bajo la licencia\n<a href='https://joinup.ec.europa.eu/software/page/eupl/licence-eupl'>EUPL v.1.1</a>\n<br>\nEl software en JavaScript est\u00e1 bajo licencia\n<a href='http://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci\u00f3n y el c\u00f3digo fuente se encuentran en :\n<br>\n<a href='http://descartes.matem.unam.mx/'>http://descartes.matem.unam.mx/</a>\n</p>";
a.ccLicense&&(b+="<p>\nEste objeto, creado con Descartes, est\u00e1 licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>");b+="</body> </html>";var d=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
d.document.write(b);d.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(h){if(a.cacheFiles[h])return a.cacheFiles[h];var e=null,f=new XMLHttpRequest;f.open("GET",h,!1);try{f.send(null),e=200===f.status||304===f.status?f.responseText:f.responseText||"",e=404===f.status?"":e,e.match(String.fromCharCode(65533))&&(f.open("GET",h,!1),f.overrideMimeType("text/plain;charset=ISO-8859-1"),f.send(null),e=f.responseText)}catch(q){e=null}return e};a.addExternalFileContent=function(h,
e){a.cacheFiles[h]=e};return a}(descartesJS||{});
descartesJS=function(a){function h(a){y=a.indexOf("--radial--");-1!=y&&(a=a.substring(0,y));p=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1),"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1)));"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1),p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1)));"*"===p.charAt(0)&&"*"!==
p.charAt(p.length-1)?p=p.substring(1)+"$":"*"!==p.charAt(0)&&"*"===p.charAt(p.length-1)?p="^"+p.substring(0,p.length-1):"*"!==p.charAt(0)&&"*"!==p.charAt(p.length-1)?p="^"+p+"$":"*"===p.charAt(0)&&"*"===p.charAt(p.length-1)&&(p=p.substring(1,p.length-1));a.regExp=p.replace(/\?/g,"[\\S\\s]{1}");return a}function e(a,b){p=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=p.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),expr:b.parser.parse(a.expr[0].substring(1))};
a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),expr:b.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function f(a,l,c){l=parseFloat(l);b=a.expr[0];g=a.expr[1];d=c.eval(b.expr);v=c.eval(g.expr);r="("==b.type||"["==b.type;u=")"==g.type||"]"==g.type;return r&&l>d&&u&&l<=v?1:0}function q(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,
"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var p,c,k,n,b,g,d,v,r,u,y;a.buildRegularExpressionsPatterns=function(a,b){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var d=0,l=a.length;d<l;d++){c=a[d].split("&");k=[];for(var g=0,f=c.length;g<f;g++)p=c[g],-1===p.indexOf(",")||"("!==
p.charAt(0)&&"["!==p.charAt(0)||")"!==p.charAt(p.length-1)&&"]"!==p.charAt(p.length-1)?k.push(h(p)):k.push(e(p,b));a[d]=k}return a};a.escorrecto=function(b,d,g,k){g=g||a.externalEvaluator;k=k||a.buildRegularExpressionsPatterns(b,g);d=q(d);b=0;for(var l=k.length;b<l;b++){c=k[b];n=!0;for(var e=0,r=c.length;e<r;e++)n=c[e].regExp?n&&!!d.match(new RegExp(q(c[e].regExp),"i")):n&&f(c[e],d,g);if(n)return 1}return 0};a.esCorrecto=function(b,d,g,k){g=g||a.externalEvaluator;k=k||a.buildRegularExpressionsPatterns(b,
g);b=0;for(var l=k.length;b<l;b++){c=k[b];n=!0;for(var e=0,r=c.length;e<r;e++)(p=c[e].regExp)?(c[e].ignoreAccents&&(d=q(d),p=q(p)),c[e].ignoreCaps&&(d=d.toLowerCase(),p=q(p).toLowerCase()),n=n&&!!d.match(p)):n=n=n&&f(c[e],d,g);if(n)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,e){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===e?"24c":e)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,e){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+
(void 0===e?"d00018":e)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e,f,q,p,c,k,n,b,g,d,v,r,u,y,m=function(b,d){this.r=this.g=this.b=0;this.a=1;this.evaluator=d;this.getColor=this.getColorStr;if(b){if(babel[b]&&("net"===babel[b]&&(b="rojo"),b=babel[b],this.r=a.toHex(b.substring(1,3)),this.g=a.toHex(b.substring(3,5)),this.b=a.toHex(b.substring(5,7)),this.colorStr=b),6===b.length&&(this.r=a.toHex(b.substring(0,2)),this.g=a.toHex(b.substring(2,4)),this.b=a.toHex(b.substring(4,6)),this.colorStr="#"+b),8===
b.length&&(this.r=a.toHex(b.substring(2,4)),this.g=a.toHex(b.substring(4,6)),this.b=a.toHex(b.substring(6,8)),this.a=1-a.toHex(b.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===b[0]){f=[];q=this.splitComa(b.substring(1,b.length-1));b=0;for(d=q.length;b<d;b++)k=q[b],p=parseInt(k,16),k!==p.toString(16)&&k!=="0"+p.toString(16)?("["===k.charAt(0)&&"]"===k.charAt(k.length-1)&&(k=k.substring(1,k.length-1)),f.push(this.evaluator.parser.parse(k))):f.push(this.evaluator.parser.parse((p/
255).toString()));this.rExpr=f[0];this.gExpr=f[1];this.bExpr=f[2];this.aExpr=f[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};m.prototype.splitComa=function(a){c=[];for(var l=g=b=n=0,k=a.length;l<k;l++)d=a.charAt(l),"("===d?n++:")"===d?n--:"["===d?b++:"]"===d?b--:","===d&&0===n&&0===b&&(c.push(a.substring(g,l)),g=l+1);c.push(a.substring(g));return c};m.prototype.getColorStr=function(){return this.colorStr};m.prototype.getColorExp=function(){e=
this.evaluator;this.r=h(255*e.eval(this.rExpr));this.g=h(255*e.eval(this.gExpr));this.b=h(255*e.eval(this.bExpr));this.a=1-e.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};m.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.toHex=function(a){return parseInt("0x"+a,16)};a.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");v=parseInt(a[0]).toString(16);r=parseInt(a[1]).toString(16);u=parseInt(a[2]).toString(16);y=(255-
parseInt(255*parseFloat(a[3]))).toString(16);1===v.length&&(v="0"+v);1===r.length&&(r="0"+r);1===u.length&&(u="0"+u);1===y.length&&(y="0"+y);return new m(y+v+r+u)};a.Color=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=document.head,e=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});h.appendChild(e);e=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||h.appendChild(e);e=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});h.appendChild(e);e=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});h.appendChild(e);
e=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});h.appendChild(e);(h=document.getElementById("StyleDescartesApps2"))&&h.remove();h=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(h,document.head.firstChild);h.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100)+", url('"+a.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+a.createGradient(50,100,90)+", url('"+a.getSvgArrowUp(!0)+"');}\n.DJS_up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+a.createGradient(0,50)+", url('"+a.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100,-90)+", url('"+a.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Gradient{position:absolute;display:none;}\n"+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sin,e=Math.floor,f=Math.random,q=Math.round,p=Math.abs,c=String.fromCharCode,k,n,b,g,d,v,r,u,y,m,l=function(a){this.key=(void 0===a?0:a).toString()};l.prototype.getKey=function(a){k=[];for(var b=0;256>b;b++)k[b]=c(this.alfanum(e(p(7.5*(h(1*b-a)+h(1.4*b+a)+h(.6*b-a)+h(2.2*b+a))))));return k.join("")};l.prototype.encode=function(a){n=e(31*f());this.key=this.getKey(n);return c(this.alfanum(n))+this.encripta(a)};l.prototype.decode=function(a){n=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(n);return this.desencripta(a.substring(1))};l.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};l.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var b=0,d=a.length;b<d;b++)y=256*e(a[b]+128)+q(255*f())+65536*q(255*f()),m=e((y<<this.shift(b))/256),v[3*b]=this.alfanum(m%32),v[3*b+1]=this.alfanum(m/32%32),v[3*b+2]=this.alfanum(m/1024%32);return v};l.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};l.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;r=Array(a.length/3);for(var b=0,d=r.length;b<d;b++)m=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),y=e(256*m>>this.shift(b)),u=e(y/256)%256-128,0>u&&(u+=256),r[b]=u;return r};l.prototype.alfanum=function(a){return(10>a?48:87)+e(a)};l.prototype.numalfa=function(a){return a-(58>a?48:87)};l.prototype.stringToBytes=
function(a){g=[];for(var b=0,d=a.length;b<d;b++)g.push(a.charCodeAt(b));return g};l.prototype.bytesToString=function(a){for(var b=0,d=a.length;b<d;b++)a[b]=c(a[b]);return a.join("")};l.prototype.shift=function(a){b=this.key.charCodeAt(a%this.key.length);g=this.numalfa(b);d=e(g/2%8);0==d&&(d=4);return d};l.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){this.parent=e;var h=e.evaluator,p=h.parser;e=new a.Auxiliary(e);var c=this;c.delay=f.delay?p.parse(f.delay):p.parse("60");c.loop=f.loop?f.loop:!1;c.auto=void 0==f.auto?!0:f.auto;c.controls=f.controls;c.init=e.splitInstructions(p,f.init);c.doExpr=e.splitInstructions(p,f.doExpr);f.whileExpr&&(c.whileExpr=p.parse(f.whileExpr));var k,n=c.doExpr.length;c.animExec=function(){for(k=0;k<n;k++)h.eval(c.doExpr[k]);c.parent.update();c.playing&&
(0<h.eval(c.whileExpr)||c.loop)?c.timer=a.setTimeout(c.animExec,h.eval(c.delay)):(c.stop(),c.pause=!1,c.parent.update())};c.playing=!1;c.auto&&c.play()};h.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};h.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};h.prototype.reinit=function(){for(var a=0,f=this.init.length;a<
f;a++)this.parent.evaluator.eval(this.init[a])};a.Animation=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator};h.prototype.execute=function(){};a.Action=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){e=a.Action.call(this,e,f)||this;e.parameter=(f||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return e};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){alert(this.parameter)};a.Message=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){e=a.Action.call(this,e,f)||this;var h=e.evaluator,p=h.parser;f=a.splitSeparator((f||"").replace(/&squot;/g,"'"));for(var c=[],k,n=0,b=f.length;n<b;n++)(k=p.parse(f[n],!0))&&c.push(k);b=c.length;e.execute=function(){for(n=0;n<b;n++)h.eval(c[n])};return e};$jscomp.inherits(h,a.Action);a.Calculate=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){var h=a.Action.call(this,e,f)||this;h.parser=e.evaluator.parser;h.evaluator=e.evaluator;h.parameter=f;h.target="_blank";return h};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var e=this.parameter;e.match(/^\[.*\]?/)&&(e=this.evaluator.eval(this.parser.parse(e.substring(1,e.length-1))));var f=e.indexOf("target");-1!=f&&(this.target=e.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),e=e.substring(0,
f-1));if("javascript"==e.substring(0,10)){e=new a.SimpleText(parent,e.substring(11).replace(/&squot;/g,"'"));try{eval(e.toString())}catch(q){}}else"http"!=e.substring(0,4)&&(f=window.__dirname||window.location.href,e=f.substring(0,f.lastIndexOf("/")+1)+e),window.open(e,this.target)};a.OpenURL=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){var h=a.Action.call(this,e,f)||this;h.parser=e.evaluator.parser;h.evaluator=e.evaluator;h.parameter=f.trim();h.target="_blank";return h};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var f=a.indexOf("target");-1!=f&&(this.target=a.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
f-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(q){}}else"http"!=a.substring(0,4)&&(f=window.__dirname||window.location.href,a=f.substring(0,f.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+", top="+(window.screen.height-this.parent.height)/2+"location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=h;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'><script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'>\x3c/script>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,
"</ajs")+"</xmp>")};a.Config=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.init()};a.Init=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.clear()};a.Clear=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.play()};a.Animate=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,e=function(f,e){f=a.Action.call(this,f,e)||this;e=e||"";e.match(h)?f.filenameExpr=f.evaluator.parser.parse("'"+e.match(h)+"'"):(e.match(/^\[.*\]?/)&&(e=e.substring(1,e.length-1)),f.filenameExpr=f.evaluator.parser.parse(e));return f};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,f)};f.prototype.firstRun=function(){};f.prototype.update=function(){};f.prototype.splitInstructions=function(f,p){e=[];p=p?a.splitSeparator(p):[""];for(var c=0,k=p.length;c<k;c++)a.DEBUG.lineCount=c,(h=f.parse(p[c],!0))&&e.push(h);return e};f.prototype.getPrivateVariables=function(a,f){e=[];f=f?f.split(/;|,/):
[""];for(var c=0,k=f.length;c<k;c++)(h=a.parse(f[c],!0))&&e.push(h);c=0;for(k=e.length;c<k;c++)e[c]="assign"===e[c].type?e[c].childs[0].value:"identifier"===e[c].type?e[c].value:"";return e};f.prototype.parseExpressions=function(f){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(f,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(f,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(f,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
f.parse(this.whileExpr)};a.Auxiliary=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){e=a.Auxiliary.call(this,e,f)||this;f=e.evaluator.parser;e.expresionString=e.expresion;e.expresion=f.parse(e.expresionString);e.expresion&&f.setVariable(e.id,e.expresion);e.editable&&(e.registerTextField(),e.parent.editableRegionVisible=!0);return e};$jscomp.inherits(h,a.Auxiliary);h.prototype.registerTextField=function(){var e=a.newHTML("div"),f=a.newHTML("label");f.appendChild(document.createTextNode("___"+this.id+"=___"));var h=a.newHTML("input");
h.value=this.expresionString;h.disabled=!this.editable;e.appendChild(f);e.appendChild(h);var p=this,c=p.evaluator.parser;h.onkeydown=function(a){13==a.keyCode&&(p.expresion=c.parse(this.value),c.setVariable(p.id,p.expresion),p.parent.update())};this.parent.editableRegion.textFields.push({container:e,type:"div"})};a.Variable=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){e=a.Auxiliary.call(this,e,f)||this;e.expresion=e.evaluator.parser.parse(e.expresion);e.update();return e};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p=function(c,f){f=a.Auxiliary.call(this,c,f)||this;h=c.evaluator;e=h.parser;f.size=f.size||e.parse("3");f.expresion=f.expresion.split(";");f.parseFile=e.parse(f.file);f.update();return f};$jscomp.inherits(p,a.Auxiliary);p.prototype.update=function(){var c=this.expresion,k;h=this.evaluator;e=h.parser;this.oldFile=this.file;if(f=h.eval(this.parseFile))this.file=f;if(this.file){q=(k=document.getElementById(this.file))&&"descartes/vectorFile"==
k.type?k.text:a.openExternalFile(this.file);if(null!=q){q=q.replace(/\r/g,"").split("\n");var n=[];k=0;for(var b=q.length;k<b;k++)""!=q[k]&&n.push(q[k]);q=n}null==q||1==q.length&&""==q[0]?(q=[],this.size=e.parse("0")):(c=q,this.size=null);null===this.size&&(this.size=e.parse(c.length+""))}var g;n=[];k=0;for(b=c.length;k<b;k++)(g=e.parse(c[k],!0))&&"assign"!=g.type&&(g=e.parse(this.id+"["+k+"]="+c[k],!0)),n.push(g);c=Array(h.eval(this.size)).fill(0);c._size_=c.length;h.vectors[this.id]=c;h.setVariable(this.id+
".long",c._size_);k=0;for(b=n.length;k<b;k++)h.eval(n[k])};a.Vector=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c=function(c,n){n=a.Auxiliary.call(this,c,n)||this;h=c.evaluator;e=h.parser;n.rows=n.rows||e.parse("3");n.columns=n.columns||e.parse("3");n.expresion=n.splitInstructions(e,n.expresion);f=h.eval(n.rows);q=h.eval(n.columns);p=[];p.type="matrix";c=0;for(var b=q;c<b;c++)p[c]=Array(f).fill(0);h.matrices[n.id]=p;n.update();return n};$jscomp.inherits(c,a.Auxiliary);c.prototype.update=function(){h=this.evaluator;f=h.eval(this.rows);q=h.eval(this.columns);
h.setVariable(this.id+".filas",f);h.setVariable(this.id+".columnas",q);p=h.matrices[this.id];p.rows=f;p.cols=q;for(var a=0,c=this.expresion.length;a<c;a++)h.eval(this.expresion[a])};a.Matrix=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){var h=a.Auxiliary.call(this,e,f)||this;var p=h.evaluator;e=p.parser;f=h.id.indexOf("(");h.name=h.id.substring(0,f);h.params=h.id.substring(f+1,h.id.indexOf(")"));h.domain=h.range?e.parse(h.range):e.parse("1");h.params=""===h.params?[]:h.params.split(",");h.numberOfParams=h.params.length;h.algorithm||(h.init="",h.doExpr="",h.whileExpr="");h.parseExpressions(e);h.expresion=e.parse(h.expresion);h.functionExec=function(){h.iterations=0;
if(h.numberOfParams<=arguments.length){for(var c=[],f=0,e=h.privateVars.length;f<e;f++)c.push(p.getVariable(h.privateVars[f])),p.setVariable(h.privateVars[f],0);var b=[];f=0;for(e=h.params.length;f<e;f++)b[f]=p.getVariable(h.params[f]),p.setVariable(h.params[f],arguments[f]);f=0;for(e=h.init.length;f<e;f++)p.eval(h.init[f]);do{f=0;for(e=h.doExpr.length;f<e;f++)p.eval(h.doExpr[f]);if(1E5<++h.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
h.name+" >>"),0}while(0<p.eval(h.whileExpr));var g=p.eval(h.expresion);a.rangeOK=p.eval(h.domain);f=0;for(e=h.params.length;f<e;f++)p.setVariable(h.params[f],b[f]);f=0;for(e=h.privateVars.length;f<e;f++)p.setVariable(h.privateVars[f],c[f]);return g}return 0};p.setFunction(h.name,h.functionExec);return h};$jscomp.inherits(h,a.Auxiliary);a.Function=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){var h=a.Auxiliary.call(this,e,f)||this;var p=h.evaluator;h.parseExpressions(p.parser);h.algorithmExec=function(){for(var a=h.iterations=0,f=h.init.length;a<f;a++)p.eval(h.init[a]);do{a=0;for(f=h.doExpr.length;a<f;a++)p.eval(h.doExpr[a]);if(1E5<++h.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+h.name+" >>"),0}while(0<p.eval(h.whileExpr))};return h};$jscomp.inherits(h,a.Auxiliary);
h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){e=a.Auxiliary.call(this,e,f)||this;f=e.evaluator;delete e.evaluate;e.condition=f.parser.parse(e.condition);e.lastEvaluation=!1;e.action=e.parent.lessonParser.parseAction(e);"onlyOnce"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==e.execution&&(e.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEvaluation?
(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return e};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.eventExec()};a.Event=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,f){var h=a.Auxiliary.call(this,e,f)||this;if(f=f.file){var p=document.getElementById(f);p=p&&"descartes/library"===p.type?p.text:a.openExternalFile(f)}if(p){p=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");f=0;for(var c=p.length;f<c;f++)""!==p[f].trim()&&e.lessonParser.parseAuxiliar(p[f])}return h};$jscomp.inherits(h,a.Auxiliary);a.Library=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=c.parse("1");this.abs_coord=d.type&&"text"===d.type.toLowerCase()?!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=c.parse("(0,0)");this.family="";this.family_interval=
c.parse("[0,1]");this.family_steps=c.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=c.parse("2");Object.assign(this,d);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?
parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&
(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};b.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};b.prototype.getFamilyValues=function(){h=this.evaluator;e=h.eval(this.family_interval);this.familyInf=e[0][0];this.familySup=e[0][1];this.fSteps=Math.round(h.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};b.prototype.drawFamilyAux=function(a,
b,c){h=this.evaluator;this.getFamilyValues();f=h.getVariable(this.family);if(0<=this.fSteps)for(var d=0,g=this.fSteps;d<=g;d++)h.setVariable(this.family,this.familyInf+d*this.family_sep),0<h.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,b,c));h.setVariable("_Text_H_",0);h.setVariable(this.family,f)};b.prototype.draw=function(a,b){""!==this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,b));this.ctx.setLineDash([])};
b.prototype.drawTrace=function(a,b){""!=this.family?this.drawFamilyAux(this.traceCtx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,b))};b.prototype.rotate=function(a,b,c){k=Math.cos(c);n=Math.sin(c);return{x:a*k-b*n,y:a*n+b*k}};b.prototype.dashStyle=function(){c=this.ctx;"dot"===this.lineDash?(c.lineCap="butt",c.setLineDash([c.lineWidth,c.lineWidth])):"dash"===this.lineDash?(c.lineCap="butt",c.setLineDash([4*c.lineWidth,3*c.lineWidth])):"dash_dot"===this.lineDash?
(c.lineCap="butt",c.setLineDash([4*c.lineWidth,2*c.lineWidth,c.lineWidth,2*c.lineWidth])):c.setLineDash([])};b.prototype.drawText=function(a,b,c,f,e,k,n,l,w,x,z){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=e.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:c,y:f},b.update(a,c,f,w,x,n,z,e.getColor());else for("simpleText"===b.type&&(b=b.toString(w,x).split("\\n")),h=this.evaluator,a.fillStyle=e.getColor(),a.font=k,a.textAlign=n,a.textBaseline=l,p=1.2*this.fontSize||0,e=0,k=
b.length;e<k;e++)q=b[e],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(q,c,f+p*e)),a.fillText(q,c,f+p*e)};a.Graphic=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n=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";h="'";q=f=0;for(p=-1;f<g.length;)c=g.charAt(f),k=g.charAt(f-1),"["===c&&"\\"===k?(this.textElements.push(g.substring(q,f-1)+"["),this.textElementsMacros.push("'"+g.substring(q,f-1)+"['"),q=f+1):"]"===c&&"\\"===k?(this.textElements.push(g.substring(q,
f-1)+"]"),this.textElementsMacros.push("'"+g.substring(q,f-1)+"]'"),q=f+1):"["===c&&-1===p?(this.textElements.push(g.substring(q,f)),this.textElementsMacros.push("'"+g.substring(q,f)+"'"),q=f,p++):"["===c?p++:"]"===c&&0===p?(this.textElements.push(this.evaluator.parser.parse(g.substring(q,f+1))),this.textElementsMacros.push("["+g.substring(q,f+1)+"]"),q=f+1,p--):("]"==g.charAt(f)&&(p=0>p?p:p-1),h+=g.charAt(f)),f++;this.textElements.push(g.substring(q,f));this.textElementsMacros.push("'"+g.substring(q,
f)+"'")};n.prototype.toString=function(b,c){h="";for(var d=0,g=this.textElements.length;d<g;d++)"string"===typeof this.textElements[d]?h+=this.textElements[d]:(e=this.evaluator.eval(this.textElements[d])[0][0],""!==e&&("string"===typeof e?h+=e:Infinity==e?h+="Infinity":-Infinity==e?h+="-Infinity":isNaN(e)||"NaN"==e?h+="NaN":(e=parseFloat(e),e=c?e.toFixed(b):a.removeNeedlessDecimals(e.toFixed(b)),h+=e.toString().replace(".",this.parent.decimal_symbol))));return h};a.SimpleText=n;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G,E,B,L,I,M,O,H,P,D,N=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fillP=d.fillP||"";d.fillM=d.fillM||"";d.parseExpression();d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();v=new a.R2;r=new a.R2;u=new a.R2;l=new a.R2;y=new a.R2;d.cInd=0;return d};$jscomp.inherits(N,a.Graphic);N.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],d=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||d.contains("y")?"identifier"!=d.type||"y"!=d.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||d.contains("x")?"identifier"!=d.type||"x"!=d.value||b.contains("x")||(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};N.prototype.update=function(){};N.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};N.prototype.drawFamilyAux=function(a,b,d){e=this.evaluator;this.getFamilyValues();tempParam=e.getVariable(this.family);if(0<=this.fSteps)for(var c=0,l=this.fSteps;c<=l;c++)e.setVariable(this.family,this.familyInf+c*this.family_sep),this.update(),
this.drawAux(a,b,d);e.setVariable(this.family,tempParam)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(K,R,Q){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;e=this.evaluator;f=e.parser;q=this.space;p=e.eval(this.width);K.strokeStyle=this.color.getColor();K.lineWidth=p;c=f.getVariable("x");k=f.getVariable("y");n=q.w+24;b=q.h+24;g=n/9;3>g&&(g=3);d=b/7;3>d&&(d=3);0==this.cInd?(h=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;v.set(0,0);r.set(0,0);u.set(0,0);P=.25;D=8;this.abs_coord||(P/=q.scale,D/=q.scale);K.beginPath();for(B=parseInt(d/2);B<b;B+=d)for(E=parseInt(g/2);E<n;E+=g){if(this.abs_coord){l.set(E,B);m=this.newt.findZero(l,P);if(null==m)continue;e.setVariable("x",m.x);e.setVariable("y",m.y);y.set(m.x,m.y)}else{l.set(q.getRelativeX(E),q.getRelativeY(B));m=this.newt.findZero(l,P);if(null==m)continue;e.setVariable("x",m.x);e.setVariable("y",m.y);y.set(q.getAbsoluteX(m.x),q.getAbsoluteY(m.y))}w=y.ix();x=y.iy();
if(-12<=w&&w<n+24&&-12<=x&&x<b+24){if(h[w+12+(x+12)*q.w]===this.cInd)continue;h[w+12+(x+12)*q.w]=this.cInd}a.rangeOK&&(K.moveTo(w,x),K.lineTo(w,x));v.x=m.x;v.y=m.y;r.x=m.x;r.y=m.y;z=this.newt.getUnitNormal();if(0!=z.x||0!=z.y)for(z.rotL90(),u.x=z.x,u.y=z.y,F=A=0,J=!1;2>F;)if(J&&(u.x=-z.x,u.y=-z.y,m.x=v.x,m.y=v.y,r.x=m.x,r.y=m.y,this.abs_coord?y.set(m.x,m.y):y.set(q.getAbsoluteX(m.x),q.getAbsoluteY(m.y)),w=y.ix(),x=y.iy(),J=!1,A=0),m.x+=D*u.x,m.y+=D*u.y,m=this.newt.findZero(m,P),null!=m){e.setVariable("x",
m.x);e.setVariable("y",m.y);u.x=m.x-r.x;u.y=m.y-r.y;u.normalize();if(0==u.x&&0==u.y)break;r.x=m.x;r.y=m.y;this.abs_coord?y.set(m.x,m.y):y.set(q.getAbsoluteX(m.x),q.getAbsoluteY(m.y));C=parseInt(y.ix());G=parseInt(y.iy());if(C!=w||G!=x)if(L=w,I=x,w=C,x=G,-12<=w&&w<n+24&&-12<=x&&x<b+24){A=0;M=h[w+12+(x+12)*q.w];h[w+12+(x+12)*q.w]=this.cInd;for(R=1;8>R;R++)O=L+Math.round((w-L)*R/8),H=I+Math.round((x-I)*R/8),0<=O&&O<n&&0<=H&&H<b&&(h[O+12+(H+12)*q.w]=this.cInd);a.rangeOK&&(K.moveTo(L,I),K.lineTo(w,x));
if(M===this.cInd)break}else J=!0,F++;else 4<++A&&(J=!0,F++)}}K.stroke()}};N.prototype.X=function(a,b,d){d||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};N.prototype.Y=function(a,b,d){d||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};N.prototype.XX=function(a,b,d){return Math.round(this.X(a,b,d))};N.prototype.YY=function(a,b,d){return Math.round(this.Y(a,b,d))};N.prototype.extrapolate=
function(b,d,c,l,g,f){for(var e=this.evaluator.getVariable(d),k=f/2,h=0,n,r,m,p,v,u;1E-15<Math.abs(k);){n=this.evaluator.getVariable(d);r=this.evaluator.getVariable(d)+k;this.evaluator.setVariable(d,r);m=!0;try{p=g,g=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,g),0<this.evaluator.eval(b)?(v=new a.R2(Math.min(p,g),Math.max(p,g)),u=0,u=0<f?this.Singularity(Math.abs(k),d,l,n,p,r,g,v):this.Singularity(Math.abs(k),d,l,r,g,n,p,v),0<u&&(m=!1)):m=!1}catch(Z){m=!1}m?h+=k:this.evaluator.setVariable(d,
n);k/=2}this.evaluator.setVariable(d,e);return new a.R2(h/Math.abs(f),g)};N.prototype.extrapolateOnSingularity=function(b,d,c,g,l,f){g=this.evaluator.getVariable(d);for(var e=f/2,k=0,h=l,n;1E-15<Math.abs(e);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)+e);n=!0;if(0<this.evaluator.eval(b))try{h=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,h),0>=this.evaluator.eval(b)&&(n=!1)}catch(X){n=!1}else n=!1;n?k+=e:this.evaluator.setVariable(d,this.evaluator.getVariable(d)-e);
e/=2}if(0==k)for(e=f/2,k=f,h=l;1E-15<Math.abs(e);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)-e);n=!0;if(0<this.evaluator.eval(b))try{h=this.evaluator.eval(this.funExpr)}catch(X){n=!1}else n=!1;n?k+=-e:this.evaluator.setVariable(d,this.evaluator.getVariable(d)+e);e/=2}this.evaluator.setVariable(d,g);return new a.R2(k/Math.abs(f),h)};N.prototype.Singularity=function(a,b,d,c,g,l,f,e){if(isNaN(f)||isNaN(g)||isNaN(e.y)||isNaN(e.x)||c>=l)return 2;var k=this.evaluator.getVariable(b),h=0;
try{if(1E-15>Math.abs(l-c)||1E-12>Math.abs(l-c)&&Math.abs(f-g)>Math.abs(a))return this.evaluator.setVariable(b,k),1;var n=(c+l)/2;this.evaluator.setVariable(b,n);var r=NaN;try{r=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(r))return 5;if(Math.abs(f-g)>a){this.evaluator.setVariable(b,c-1E-12);var m=this.evaluator.eval(this.funExpr);m=(g-m)/1E-12;this.evaluator.setVariable(b,l+1E-12);var p=(this.evaluator.eval(this.funExpr)-f)/1E-12;if((10>Math.abs(p)||10>Math.abs(m))&&(0<=p&&0<=m||
0>=p&&0>=m)&&4*Math.abs(p)<Math.abs((f-g)/(l-c)))return this.evaluator.setVariable(b,k),2}if(isNaN(e.x)||isNaN(e.y)||isNaN(r))return 2;if(!(e.x<=r&&r<=e.y)){this.evaluator.setVariable(b,n);e.x=Math.min(g,r);e.y=Math.max(g,r);var v=this.Singularity(a/2,b,d,c,g,n,r,e);this.evaluator.setVariable(b,l);e.x=Math.min(f,r);e.y=Math.max(f,r);var u=this.Singularity(a/2,b,d,n,r,l,f,e);h=Math.max(v,u)}}catch(Y){h=1}this.evaluator.setVariable(b,k);return h};N.prototype.drawAuxFun=function(b,d,g){c=this.evaluator.parser.getVariable("x");
k=this.evaluator.parser.getVariable("y");a.rangeOK=1;d="x";var l="y";this.of_y&&(d="y",l="x");var f=this.drawif,e=this.evaluator.eval(this.width),h=!1,n=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?n.ix():n.iy(),m=0,p=0,v=0,u=0,z=1/this.space.scale;n=z*(this.of_y?-this.space.h+n.y:-n.x);var q=0;this.abs_coord&&(n=0,z=1);for(var w,F,y,C,x,B,I,A,Q,G=this.of_y?this.space.h+2:this.space.w+2;v<=G;){w=!0;F=0;this.evaluator.setVariable(d,n);try{y=this.evaluator.eval(this.funExpr),
isNaN(y)||(this.evaluator.setVariable(l,y),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(h?(C=Math.min(q,y),x=Math.max(q,y),B=new a.R2(C,x),F=this.Singularity(z,d,0,n-z,q,n,y,B),0===F?(q<=y?(q=B.x,y=B.y):(y=B.x,q=B.y),I=parseInt(this.of_y?this.XX(e,q,this.abs_coord):this.YY(e,q,this.abs_coord)),m=this.abs_coord?Math.round(y):parseInt(this.of_y?this.XX(e,y,this.abs_coord):this.YY(e,y,this.abs_coord)),this.fillM&&m>r&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(r+
1,this.space.h-v+.5),b.lineTo(m,this.space.h-v+.5)):(b.moveTo(v+.5,r+1),b.lineTo(v+.5,m)),b.stroke()),this.fillP&&m<r&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(r-1,this.space.h-v+.5),b.lineTo(m,this.space.h-v+.5)):(b.moveTo(v+.5,r-1),b.lineTo(v+.5,m)),b.stroke()),b.lineWidth=e,b.strokeStyle=g.getColor(),b.beginPath(),this.of_y?(b.moveTo(I+.5,this.space.h-u),b.lineTo(m+.5,this.space.h-v)):(b.moveTo(u+.5,I),b.lineTo(v+.5,m)),b.stroke()):1===F?(this.evaluator.setVariable(d,
n-z),A=this.extrapolate(f,d,l,0,q,z),m=this.of_y?this.XX(e,A.y,this.abs_coord):this.YY(e,A.y,this.abs_coord),b.lineWidth=e,b.strokeStyle=g.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(m+.5,this.space.h-u+Math.round(A.x))):(b.moveTo(u+.5,p),b.lineTo(u+Math.round(A.x)+.5,m)),this.evaluator.setVariable(d,n),Q=this.extrapolate(f,d,l,0,y,-z),p=this.of_y?this.XX(e,Q.y,this.abs_coord):this.YY(e,Q.y,this.abs_coord),m=this.of_y?this.XX(e,y,this.abs_coord):this.YY(e,y,this.abs_coord),
b.lineWidth=e,b.strokeStyle=g.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-v),b.lineTo(m+.5,this.space.h-v)):(b.moveTo(v+.5,p),b.lineTo(v+.5,m)),b.stroke()):2===F&&(m=this.of_y?this.XX(e,y,this.abs_coord):this.YY(e,y,this.abs_coord),b.lineWidth=e,b.strokeStyle=g.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-v),b.lineTo(m+.5,this.space.h-v)):(b.moveTo(v+.5,p),b.lineTo(v+.5,m)))):(Q=this.extrapolateOnSingularity(f,d,l,0,y,-z),p=this.of_y?this.XX(e,Q.y,this.abs_coord):
this.YY(e,Q.y,this.abs_coord),m=this.of_y?this.XX(e,y,this.abs_coord):this.YY(e,y,this.abs_coord),b.lineWidth=e,b.strokeStyle=g.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(v+Math.round(Q.x))+.5),b.lineTo(m,this.space.h-v+.5)):(b.moveTo(v+Math.round(Q.x),p),b.lineTo(v,m)),b.stroke()),q=y):w=!1)}catch(aa){w=!1}h&&!w&&(this.evaluator.setVariable(d,n-z),this.evaluator.setVariable(l,q),A=this.extrapolate(f,d,l,0,q,z),m=parseInt(this.of_y?this.XX(e,A.y,this.abs_coord):this.YY(e,A.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=e,b.strokeStyle=g.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(u+Math.round(A.x))+.5),b.lineTo(m,this.space.h-(u+Math.round(A.x))+.5)):(b.moveTo(u+Math.round(A.x)+.5,p),b.lineTo(u+Math.round(A.x)+.5,m)),b.stroke()),this.evaluator.setVariable(d,n));h=w;n+=z;p=m;u=v++}this.evaluator.parser.setVariable("x",c);this.evaluator.parser.setVariable("y",k)};N.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;
b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parseExpression(),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Equation=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e,f,q,p,c,k,n,b,g=function(b,c){c=a.Graphic.call(this,b,c)||this;c.parameter=c.parameter||"t";c.parameter_interval=c.parameter_interval||b.evaluator.parser.parse("[0,1]");c.parameter_steps=c.parameter_steps||b.evaluator.parser.parse("8");c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();return c};$jscomp.inherits(g,a.Graphic);
g.prototype.update=function(){e=this.evaluator;f=e.eval(this.parameter_interval);this.paraInf=f[0][0];this.paraSup=f[0][1];this.pSteps=e.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};g.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};g.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};g.prototype.drawAux=function(d,g,f){e=this.evaluator;q=this.space;p=h(e.eval(this.width));
d.lineWidth=0<p?p:1E-6;d.lineCap=d.lineJoin="round";d.strokeStyle=f.getColor();c=e.getVariable(this.parameter);d.beginPath();e.setVariable(this.parameter,this.paraInf);k=e.eval(this.expresion);this.exprX=h(this.abs_coord?k[0][0]:q.getAbsoluteX(k[0][0]));this.exprY=h(this.abs_coord?k[0][1]:q.getAbsoluteY(k[0][1]));this.rotateExp&&(n=a.degToRad(e.eval(this.rotateExp)),b=this.rotate(k[0][0],k[0][1],n),this.exprX=h(this.abs_coord?b.x:q.getAbsoluteX(b.x)),this.exprY=h(this.abs_coord?b.y:q.getAbsoluteY(b.y)));
d.moveTo(this.exprX+.5,this.exprY+.5);for(f=1;f<=this.pSteps;f++)e.setVariable(this.parameter,this.paraInf+f*this.paraSep),k=e.eval(this.expresion),this.rotateExp&&(b=this.rotate(k[0][0],k[0][1],n),k[0][0]=b.x,k[0][1]=b.y),this.exprX=h(this.abs_coord?k[0][0]:q.getAbsoluteX(k[0][0])),this.exprY=h(this.abs_coord?k[0][1]:q.getAbsoluteY(k[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&d.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(d.fillStyle=
g.getColor(),d.fill("evenodd"));this.dashStyle();d.stroke();d.setLineDash([]);e.setVariable(this.parameter,c)};g.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var c=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(a){13==a.keyCode&&(c.expresion=c.evaluator.parser.parse(this.value),c.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Curve=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,e=Math.round,f,q,p,c,k,n,b,g,d,v,r=function(b,d){d=a.Graphic.call(this,b,d)||this;d.size=d.size||b.evaluator.parser.parse("2");d.range=d.range||b.evaluator.parser.parse("[1, 100]");d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){f=this.evaluator;p=f.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&
(c=this.rotate(p[0][0],p[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y);b=f.eval(this.range);this.rangeInf=b[0][0];this.rangeMax=b[0][1]};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(b,c){f=this.evaluator;q=this.space;d=g=Math.ceil(f.eval(this.size)-.4);b.fillStyle=c.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);c=f.getVariable("n");for(var r=this.rangeInf,l=this.rangeMax;r<=l;r++)f.setVariable("n",r),p=f.eval(this.expresion),this.exprX=p[0][0],this.exprY=p[0][1],k=e(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX)),n=e(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(k,n,g,0,h,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,k+d,n-d,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",c)};r.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};
a.Sequence=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,e=Math.round,f,q,p,c,k,n,b=function(b,d){d=a.Graphic.call(this,b,d)||this;d.size=d.size||b.evaluator.parser.parse("2");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){f=this.evaluator;p=f.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&(c=this.rotate(p[0][0],p[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y)};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};b.prototype.drawAux=function(a,b){q=this.space;a.fillStyle=b.getColor();k=e(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX));n=e(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY));a.beginPath();a.arc(k,n,e(this.evaluator.eval(this.size)),0,h,!0);a.fill();this.text.hasContent&&this.text.draw(a,b,k,n)};a.Point=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e=2*Math.PI,f,q,p,c,k,n,b,g,d,v,r,u,y,m=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.size=d.size||b.evaluator.parser.parse("2");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(m,a.Graphic);m.prototype.update=function(){f=this.evaluator;p=f.eval(this.expresion);this.endPoints=[];for(var b=0,d=p.length;b<d;b++)this.endPoints[b]={x:p[b][0],y:p[b][1]};if(this.rotateExp)for(c=
a.degToRad(f.eval(this.rotateExp)),b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,c)};m.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};m.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};m.prototype.drawAux=function(a,c,m){f=this.evaluator;q=this.space;k=h(f.eval(this.width));a.lineWidth=0<k?k:1E-6;g=f.eval(this.size);0>g&&(g=0);a.fillStyle=c.getColor();a.strokeStyle=
m.getColor();a.lineCap="round";d=0==a.lineWidth%2?0:.5;this.abs_coord?(v=h(this.endPoints[0].x),r=h(this.endPoints[0].y),u=h(this.endPoints[1].x),y=h(this.endPoints[1].y)):(v=h(q.getAbsoluteX(this.endPoints[0].x)),r=h(q.getAbsoluteY(this.endPoints[0].y)),u=h(q.getAbsoluteX(this.endPoints[1].x)),y=h(q.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(v+d,r+d);a.lineTo(u+d,y+d);this.dashStyle();a.stroke();0<g&&(a.beginPath(),a.arc(v,r,g,0,e,!0),a.arc(u,y,g,0,e,!0),a.fill());a.setLineDash([]);
this.text.hasContent&&(n=parseInt((v+u)/2)-3,b=parseInt((r+y)/2)+3,this.text.draw(a,m,n,b))};a.Segment=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.round,f,q,p,c,k,n,b,g,d,v,r,u,y,m,l,w=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("5");d.size=d.size||b.evaluator.parser.parse("2");d.spear=d.spear||b.evaluator.parser.parse("8");d.arrow=d.arrow||new a.Color("ee0022");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(w,a.Graphic);w.prototype.update=function(){f=this.evaluator;q=f.eval(this.expresion);this.endPoints=[];for(var b=
0,d=q.length;b<d;b++)this.endPoints[b]={x:q[b][0],y:q[b][1]};if(this.rotateExp)for(p=a.degToRad(f.eval(this.rotateExp)),b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,p)};w.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};w.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};w.prototype.drawAux=function(p,q,w){f=this.evaluator;c=this.space;b=f.eval(this.width);
0>b&&(b=0);g=Math.ceil(b/2);d=c.scale;this.vect=new a.Vector2D(this.endPoints[1].x-this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);v=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);p.fillStyle=q.getColor();p.strokeStyle=w.getColor();p.lineWidth=2;this.abs_coord?(r=e(this.endPoints[0].x),u=e(this.endPoints[0].y),y=e(this.endPoints[1].x),m=e(this.endPoints[1].y)):(r=e(c.getAbsoluteX(this.endPoints[0].x)),u=e(c.getAbsoluteY(this.endPoints[0].y)),y=e(c.getAbsoluteX(this.endPoints[1].x)),
m=e(c.getAbsoluteY(this.endPoints[1].y)));l=f.eval(this.spear);0>l&&(l=0);p.save();p.translate(r,u,v);this.abs_coord?p.rotate(this.angle*(0<=this.vect.y?1:-1)):(v*=d,p.rotate(this.angle*(0<=this.vect.y?-1:1)));p.beginPath();p.moveTo(-g,h(-g));p.lineTo(h(v-l-b),h(-g));p.lineTo(h(v-2*l),h(-l-g));p.lineTo(h(v),0);p.lineTo(h(v-2*l),h(l+g));p.lineTo(h(v-l-b),h(g));p.lineTo(-g,h(g));p.closePath();p.stroke();p.fill();p.restore();this.text.hasContent&&(k=parseInt((r+y)/2)-3,n=parseInt((u+m)/2)+3,this.text.draw(p,
w,k,n))};a.Arrow=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e,f,q,p,c,k,n,b,g=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.endPoints=[];return c};$jscomp.inherits(g,a.Graphic);g.prototype.update=function(){e=this.evaluator;q=e.eval(this.expresion);for(var b=0,c=q.length;b<c;b++)this.endPoints[b]={x:q[b][0],y:q[b][1]};if(this.rotateExp)for(p=a.degToRad(e.eval(this.rotateExp)),b=0,c=this.endPoints.length;b<c;b++)this.endPoints[b]=
this.rotate(this.endPoints[b].x,this.endPoints[b].y,p)};g.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};g.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};g.prototype.drawAux=function(a,g,r){e=this.evaluator;f=this.space;c=h(e.eval(this.width));a.lineWidth=0<c?c:1E-6;a.strokeStyle=r.getColor();a.lineCap=a.lineJoin="round";k=0<c?.5:0;n=h(this.abs_coord?this.endPoints[0].x:f.getAbsoluteX(this.endPoints[0].x));b=h(this.abs_coord?
this.endPoints[0].y:f.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(n+k,b+k);r=1;for(var d=this.endPoints.length;r<d;r++)n=h(this.abs_coord?this.endPoints[r].x:f.getAbsoluteX(this.endPoints[r].x)),b=h(this.abs_coord?this.endPoints[r].y:f.getAbsoluteY(this.endPoints[r].y)),a.lineTo(n+k,b+k);this.fill&&(a.fillStyle=g.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e=Math.min,f=Math.max,q=Math.abs,p,c,k,n,b,g,d,v,r,u,y,m,l=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.border_radius=d.border_radius||b.evaluator.parser.parse("0");d.endPoints=[];return d};$jscomp.inherits(l,a.Graphic);l.prototype.update=function(){p=this.evaluator;g=p.eval(this.expresion);this.exprX=g[0][0];this.exprY=g[0][1];this.w=150;this.h=100;this.rotateExp&&(k=
this.rotate(g[0][0],g[0][1],a.degToRad(p.eval(this.rotateExp))),this.exprX=k.x,this.exprY=k.y);4<=g[0].length&&(this.w=g[0][2],this.h=g[0][3]);g[1]&&2==g[1].length&&(this.w=g[1][0],this.h=g[1][1]);this.w=f(0,this.w);this.h=f(0,this.h)};l.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};l.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};l.prototype.drawAux=function(a,g,l,k){p=this.evaluator;c=this.space;n=h(p.eval(this.width));
a.lineWidth=0<n?n:1E-6;a.strokeStyle=l.getColor();a.lineCap="round";a.lineJoin="miter";b=0<n?.5:0;d=h(this.abs_coord?this.exprX:c.getAbsoluteX(this.exprX))+b;v=h(this.abs_coord?this.exprY:c.getAbsoluteY(this.exprY))+b;r=this.abs_coord?this.w:this.w*c.scale;u=this.abs_coord?this.h:-this.h*c.scale;y=e(f(0,p.eval(this.border_radius)),.5*q(r),.5*q(u));m=this.abs_coord?1:-1;a.beginPath();0!==y?(a.moveTo(d+y,v),a.lineTo(d+r-y,v),a.quadraticCurveTo(d+r,v,d+r,v+m*y),a.lineTo(d+r,v+u-m*y),a.quadraticCurveTo(d+
r,v+u,d+r-y,v+u),a.lineTo(d+y,v+u),a.quadraticCurveTo(d,v+u,d,v+u-m*y),a.lineTo(d,v+m*y),a.quadraticCurveTo(d,v,d+y,v),a.lineTo(d+y,v)):(a.moveTo(d,v),a.lineTo(d+r,v),a.lineTo(d+r,v+u),a.lineTo(d,v+u),a.lineTo(d,v));this.fill&&(a.fillStyle=g.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e=Math.min,f=Math.max,q=Math.acos,p=Math.sqrt,c=Math.PI,k=c/2,n=2*c,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G,E,B,L,I,M=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.center=d.center||b.evaluator.parser.parse("(0,0)");d.radius=d.radius||b.evaluator.parser.parse("1");d.init=d.init||"0";d.end=d.end||"90";d.init.match(/^_\(/)&&(d.initFlag=!0,d.init=d.init.substring(1));d.end.match(/^_\(/)&&
(d.endFlag=!0,d.end=d.end.substring(1));d.initExpr=b.evaluator.parser.parse(d.init);d.endExpr=b.evaluator.parser.parse(d.end);d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(M,a.Graphic);M.prototype.update=function(){b=this.evaluator;g=b.eval(this.center);this.exprX=g[0][0];this.exprY=g[0][1];d=0;this.rotateExp&&(d=a.degToRad(b.eval(this.rotateExp)),v=Math.cos(d),r=Math.sin(d),u=this.exprX*v-this.exprY*r,y=this.exprX*r+this.exprY*v,this.exprX=u,this.exprY=y);var h=b.eval(this.initExpr),
C=b.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(m=h[0][0],l=h[0][1],w=C[0][0],x=C[0][1],this.vectors?this.abs_coord&&(l=-l,x=-x):this.abs_coord?(m-=this.exprX,l=-l+this.exprY,w-=this.exprX,x=-x+this.exprY):(m-=this.exprX,l-=this.exprY,w-=this.exprX,x-=this.exprY),z=0==m?0>l?3*k:k:q(1*m/p(m*m+l*l)),A=0==w?0>x?3*k:k:q(1*w/p(w*w+x*x)),z+=d,A+=d,0<m&&0<l&&this.abs_coord&&(z=n-z),0<m&&0>l&&!this.abs_coord&&(z=n-z),0>m&&0>l&&!this.abs_coord&&
(z=n-z),0>m&&0<l&&this.abs_coord&&(z=n-z),0<w&&0<x&&this.abs_coord&&(A=n-A),0<w&&0>x&&!this.abs_coord&&(A=n-A),0>w&&0>x&&!this.abs_coord&&(A=n-A),0>w&&0<x&&this.abs_coord&&(A=n-A),this.initFlag?(F=z,z=A,A=F):(F=e(z,A),J=f(z,A),z=F,A=J,A-z>c&&this.abs_coord&&(z=J,A=F),A-z<=c&&!this.abs_coord&&(z=J,A=F)),this.iniAng=z,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(h)+d,this.endAng=a.degToRad(C)+d,this.drawAngle=!0)};M.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,
this.color)};M.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};M.prototype.drawAux=function(a,d,c){b=this.evaluator;C=this.space;B=b.eval(this.radius);0>B&&(B=0);I=h(b.eval(this.width));a.lineWidth=0<I?I:1E-6;a.lineCap="round";a.strokeStyle=c.getColor();this.drawAngle?(this.abs_coord?(G=h(this.exprX),E=h(this.exprY)):(G=h(C.getAbsoluteX(this.exprX)),E=h(C.getAbsoluteY(this.exprY)),B*=C.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>
this.endAng&&(L=this.iniAng,this.iniAng=this.endAng,this.endAng=L)):this.drawPoints&&(this.abs_coord?(G=h(this.exprX),E=h(this.exprY)):(G=h(C.getAbsoluteX(this.exprX)),E=h(C.getAbsoluteY(this.exprY)),B*=C.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=d.getColor(),a.beginPath(),a.moveTo(G,E),a.arc(G,E,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(G,E,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,
this.color,G,E)};a.Arc=M;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c=function(c,f){f=a.Graphic.call(this,c,f)||this;f.width=f.width||c.evaluator.parser.parse("0");f.align||(f.align="left");f.anchor||(f.anchor="top_left");f.shadowColor=f.shadowColor?f.shadowColor.getColor():"transparent";f.text=new a.TextObject(f,f.text);return f};$jscomp.inherits(c,a.Graphic);c.prototype.update=function(){h=this.evaluator;e=h.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(f=this.rotate(e[0][0],
e[0][1],a.degToRad(h.eval(this.rotateExp))),this.exprX=f.x,this.exprY=f.y)};c.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};c.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};c.prototype.drawAux=function(a,c){this.abs_coord?(q=parseInt(this.exprX),p=parseInt(this.exprY)):(q=parseInt(this.space.getAbsoluteX(this.exprX)),p=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,c,q,p)};a.Text=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e,f,q,p,c,k,n,b,g,d,v,r,u=function(b,d){d=a.Graphic.call(this,b,d)||this;d.file=d.file||"";d.inirot=d.inirot||b.evaluator.parser.parse("0");d.img=new Image;d.scaleX=d.scaleY=1;d.ratio=b.ratio;d.update();return d};$jscomp.inherits(u,a.Graphic);u.prototype.update=function(){e=this.evaluator;f=e.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1];this.rotateExp&&(q=this.rotate(f[0][0],f[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=
q.x,this.exprY=q.y);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((p=e.eval(this.file))||""==p)this.img=this.parent.getImage(p),this.img.addEventListener("load",function(a){b.space.update(!0)})};u.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};u.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};
u.prototype.drawAux=function(f){e=this.evaluator;c=this.space;this.img&&this.img.ready&&this.img.complete&&(v=this.img.width,r=this.img.height,this.img.canvas&&(v=h(v/this.ratio),r=h(r/this.ratio)),k=this.centered?0:h(v/2),n=this.centered?0:h(r/2),b=h(this.abs_coord?this.exprX:c.getAbsoluteX(this.exprX)),g=h(this.abs_coord?this.exprY:c.getAbsoluteY(this.exprY)),d=a.degToRad(-e.eval(this.inirot)),f.save(),f.translate(b+k,g+n),f.rotate(d),this.opacity&&(f.globalAlpha=e.eval(this.opacity)),f.scale(this.scaleX,
this.scaleY),f.drawImage(this.img,-v/2,-r/2,v,r),f.restore())};a.Image=u;return a}(descartesJS||{});
descartesJS=function(a){function h(a,b,c){n=4*(b+c*a.width);return{r:a.data[n],g:a.data[n+1],b:a.data[n+2],a:a.data[n+3]}}if(a.loadLib)return a;var e,f,q,p,c,k,n,b,g=function(b,c){return a.Graphic.call(this,b,c)||this};$jscomp.inherits(g,a.Graphic);g.prototype.update=function(){e=this.evaluator.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1]};g.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};g.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};g.prototype.drawAux=function(a,g){g.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(f=parseInt(this.exprX),q=parseInt(this.exprY)):(f=parseInt(this.space.getAbsoluteX(this.exprX)),q=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>f||0>q||f>=this.space.w||q>=this.space.h)){p=[[f,q]];k=h(imageData,f,q);for(b=0;0<p.length;){b++;c=p.pop();f=c[0];q=c[1];var d=h(imageData,f,q);if(k.r===d.r&&k.g===d.g&&k.b===d.b&&k.a===d.a){d=imageData;var e=
g;n=4*(f+q*d.width);d.data[n+0]=e.r;d.data[n+1]=e.g;d.data[n+2]=e.b;d.data[n+3]=255*e.a;0<f&&p.push([f-1,q]);f<imageData.width-1&&p.push([f+1,q]);p.push([f,q-1]);p.push([f,q+1])}if(b>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=g;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var e=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,q,p=function(c,k){var n=a.Graphic.call(this,c,k)||this;n.hasExpresion=n.hasExpresion||!1;n.inirot=n.inirot||c.evaluator.parser.parse("0");n.inipos=n.inipos||c.evaluator.parser.parse("(0,0)");Object.assign(n,k);n.hasExpresion=void 0!==n.expresion;n.graphics=[];c=c.lessonParser;var b=new a.Tokenizer;if(!n.hasExpresion)return n;
"'"!==n.expresion.charAt(0)&&(n.expresion="'"+n.expresion+"'");n.expresion=n.evaluator.parser.parse(n.expresion);k=n.evaluator.eval(n.expresion);if(k)var g=(g=document.getElementById(k))&&"descartes/macro"==g.type?g.text:a.openExternalFile(k);if(g){var d=a.convertHTMLEntities(g).replace(/\r/g,"").split("\n");g=[];k=0;for(var p=d.length;k<p;k++)if(d[k].trim()){var r=d[k].indexOf("=");if(-1!==r){r=c.split(d[k]);for(var u=0,q=r.length;u<q;u++)if(r[u]&&1<r.length&&("id"===h[r[u][0]]||"type"===h[r[u][0]])){g.push(r);
break}}}u=function(d,c){c=b.tokenize(c.replace(/&squot;/g,"'"));for(var g=0,l=c.length;g<l;g++)if("identifier"==c[g].type&&!a.reservedIds.match("-"+c[g].value+"-")||"R"===c[g].value||"G"===c[g].value||"B"===c[g].value)c[g].value=n.name+"."+c[g].value;return(d.match(/^\\expr/)?"\\expr ":"\\decimals ")+b.flatTokens(c)};k=0;for(p=g.length;k<p;k++){var m=(q=g[k]||[],q[0])&&"id"===q[0][0];d=0;for(r=q.length;d<r;d++){var l=q[d][0].indexOf(".");-1===l||m?l=h[q[d][0]]:(l=h[q[d][0].substring(l+1)],q[d][0]=
n.name+"."+q[d][0]);if(!("font"===l||"font_family"===l||("fill"===l||"color"===l||"border"===l||"arrow"===l)&&"("!==q[d][1].charAt(0)||"file"===l&&q[d][1].match(f)||"id"!==l&&void 0!==h[q[d][1]])||"radius"===l)if("text"==l)if(q[d][1].match(/\{\\rtf1/))l=q[d][1],l=l.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),l=l.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),q[d][1]=l;else{var w=c.parseText(q[d][1]).textElementsMacros;for(var x=0,z=w.length;x<
z;x++){l=b.tokenize(w[x].replace(/&squot;/g,"'"));for(var A=0,F=l.length;A<F;A++)if("identifier"===l[A].type&&!a.reservedIds.match("-"+l[A].value+"-")||"R"===l[A].value||"G"===l[A].value||"B"===l[A].value)l[A].value=n.name+"."+l[A].value;l=b.flatTokens(l).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");w[x]=l.substring(1,l.length-1)}q[d][1]=w.join("")}else{w=q[d][1].replace(/&squot;/g,"'").split(";");x=0;for(z=w.length;x<z;x++){l=b.tokenize(w[x].replace(/\\n/g,";"));A=0;for(F=
l.length;A<F;A++)if("identifier"===l[A].type&&!a.reservedIds.match("-"+l[A].value+"-")||"R"===l[A].value||"G"===l[A].value||"B"===l[A].value)l[A].value=n.name+"."+l[A].value;w[x]=b.flatTokens(l)}q[d][1]=w.join(";")}}}k=0;for(p=g.length;k<p;k++)if(g[k][0]){u="";q=!1;d=0;for(r=g[k].length;d<r;d++)"type"===h[g[k][d][0]]&&e.match("-"+h[g[k][d][1]]+"-")&&(q=!0),u=u+g[k][d][0]+"='"+g[k][d][1]+"' ";g[k]=u+(q?" space='"+n.spaceID+"'":"");q?n.graphics.push(c.parseGraphic(g[k],n.abs_coord,n.background,n.inirot)):
c.parseAuxiliar(g[k])}}return n};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){q=this.evaluator.eval(this.inipos);this.iniPosX=q[0][0];this.iniPosY=q[0][1]};p.prototype.drawAux=function(a){for(var c=0,f=this.graphics.length;c<f;c++)this.graphics[c]&&(a.save(),this.graphics[c].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[c].draw(),a.restore())};a.Macro=p;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sqrt,e=Math.sin,f=Math.cos,q=Math.abs,p,c,k,n,b,g,d,v,r,u,y,m,l,w,x,z=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=c||0;this.adjustDec()};z.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,b,d,c,g,l,f,e,h,k,n,r,m,p,u,v){this.a00=a||0;this.a01=b||0;this.a02=d||0;this.a03=c||0;this.a10=g||0;this.a11=l||0;this.a12=f||0;this.a13=e||0;
this.a20=h||0;this.a21=k||0;this.a22=n||0;this.a23=r||0;this.a30=m||0;this.a31=p||0;this.a32=u||0;this.a33=v||0};A.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};A.prototype.multiplyVector4=function(a){return new z(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};A.prototype.translate=function(a){return new A(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};A.prototype.rotateX=function(a){c=e(a);k=f(a);v=this.a10;r=this.a11;u=this.a12;
y=this.a13;m=this.a20;l=this.a21;w=this.a22;x=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,v*k+m*c,r*k+l*c,u*k+w*c,y*k+x*c,v*-c+m*k,r*-c+l*k,u*-c+w*k,y*-c+x*k,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){c=e(a);k=f(a);n=this.a00;b=this.a01;g=this.a02;d=this.a03;m=this.a20;l=this.a21;w=this.a22;x=this.a23;return new A(n*k+m*-c,b*k+l*-c,g*k+w*-c,d*k+x*-c,this.a10,this.a11,this.a12,this.a13,n*c+m*k,b*c+l*k,g*c+w*k,d*c+x*k,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){c=e(a);k=f(a);n=this.a00;b=this.a01;g=this.a02;d=this.a03;v=this.a10;r=this.a11;u=this.a12;y=this.a13;return new A(n*k+v*c,b*k+r*c,g*k+u*c,d*k+y*c,n*-c+v*k,b*-c+r*k,g*-c+u*k,d*-c+y*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return h(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){p=a.norm3D(b);if(0===p)return{x:0,y:0,z:0};if(1===p)return{x:b.x,y:b.y,z:b.z};p=1/p;return{x:b.x*p,y:b.y*p,z:b.z*p}};a.dotProduct3D=function(a,b){return a.x*
b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};a.add3D=function(a,b){return{x:a.x+b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,d){return q(a.x-b.x)<=d&&q(a.y-b.y)<=d&&q(a.z-b.z)<=d};a.Vector4D=z;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,c),a.fill(),a.stroke())}function e(a,b){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);r=1;for(u=this.projVert.length;r<u;r++)a.lineTo(this.projVert[r].x,this.projVert[r].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=b.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function f(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";d=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.fontSize=Math.max(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,d)}function q(a){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function p(b,d,c){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
d),a.subtract3D(b,c)))}if(a.loadLib)return a;var c=2*Math.PI,k=lineJoin="round",n,b,g,d,v,r,u,y,m,l,w,x,z,A=function(a,b){Object.assign(this,a);this.space=b;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=h:"face"===this.type?(this.normal=p(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=e):"text"===this.type?this.draw=f:"edge"===this.type&&(this.draw=q);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};A.prototype.computeDepth=function(b){this.space=b;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};r=0;for(u=this.vertices.length;r<u;r++)this.spaceVertices[r]=b.rotateVertex(this.vertices[r]),this.average.x+=this.spaceVertices[r].x,this.average.y+=this.spaceVertices[r].y,this.average.z+=this.spaceVertices[r].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=b.project(this.average);this.depth=a.norm3D(a.subtract3D(b.eye,this.average));2<this.vertices.length&&(this.normal=p(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));r=0;for(u=this.vertices.length;r<u;r++)this.newSpaceVert[r]=this.spaceVertices[r],this.projVert[r]=this.newProjVert[r]=b.project(this.spaceVertices[r]);2<this.vertices.length&&(this.direction=p(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;r=0;for(u=this.vertices.length;r<u;r++)y=a.norm3D(a.subtract3D(this.spaceVertices[r],b.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,y),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,y);r=0;for(u=this.vertices.length;r<u;r++)this.minx>this.projVert[r].x&&(this.minx=this.projVert[r].x),this.maxx<this.projVert[r].x&&(this.maxx=this.projVert[r].x),this.miny>this.projVert[r].y&&(this.miny=this.projVert[r].y),
this.maxy<this.projVert[r].y&&(this.maxy=this.projVert[r].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];r=0;for(u=this.vertices.length;r<u;r++)(1E-8<Math.abs(this.vertices[r].x-this.vertices[(r+1)%u].x)||1E-8<Math.abs(this.vertices[r].y-this.vertices[(r+1)%u].y)||1E-8<Math.abs(this.vertices[r].z-this.vertices[(r+1)%u].z)||1E-8<Math.abs(this.vertices[r].w-this.vertices[(r+1)%u].w))&&v.push(this.vertices[r]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};A.prototype.drawText=
function(d,c,l,f,e,h,k,r,m,p,u){n=this.evaluator;d.textNode=c;h=n.eval(this.offset_dist);k=-a.degToRad(n.eval(this.offset_angle));l+=h*Math.cos(k);f+=h*Math.sin(k);d.textNode.pos={x:l,y:f};c.hasContent&&(c.draw(d,e,l,f,!0),g=this.fromPoint?c.textNodes.metrics.w/2:0,b=this.fromPoint?c.textNodes.metrics.h/2:0,c.draw(d,e,l-g,f-b))};A.prototype.splitFace=function(b){if(this.intersects(b)){var d=i2=null,c=ix2=0,g,l;var f=this.vertices;var e=b.vertices;var h=0;for(l=e.length;h<l;h++){var k=this.intersection(e[h],
e[(h+1)%l]);if(null!==k)if(null===d){if(d=k,c=h,2===e.length){i2=d;break}}else if(!a.equals3DEpsilon(k,d,1E-8)){i2=k;ix2=h;break}}if(null!==d&&null!==i2){h=this.isInterior(d)||this.isInterior(i2);var n=g=null;if(!h&&3<=e.length)for(l=0,f=f.length;l<f;l++)if(k=b.intersection(this.vertices[l],this.vertices[(l+1)%f]),null!==k)if(null===g)g=k;else if(!a.equals3DEpsilon(k,g,1E-8)){n=k;break}if(h||null!==g&&null!==n&&b.isInterior(g)&&b.isInterior(n)){n=!0;f=k=null;if(2===e.length)a.equals3DEpsilon(d,e[0],
1E-8)||a.equals3DEpsilon(d,e[1],1E-8)?n=!1:(k=[],k[0]=e[0],k[1]=d,f=[],f[0]=d,f[1]=e[1]);else for(k=[],f=[],h=l=g=0;h<e.length;h++)h<c?k[g++]=e[h]:h==c?(k[g++]=e[h],k[g++]=d,f[l++]=d):h<ix2?f[l++]=e[h]:h==ix2?(f[l++]=e[h],f[l++]=i2,k[g++]=i2):k[g++]=e[h];if(n){d=[];d[0]=new A({vertices:k,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);d[0].removeDoubles();d[0].normal=b.normal;d[1]=new A({vertices:f,type:"face",frontColor:b.frontColor,backColor:b.backColor,
edges:b.edges,model:b.model},this.space);d[1].removeDoubles();d[1].normal=b.normal;if(2<d[0].vertices.length)return 2<d[1].vertices.length?d:[d[0]];if(2<d[1].vertices.length)return[d[1]]}}}}return[b]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(b){var d=this.vertices;var c=b.vertices;if(0<d.length){var g=a.dotProduct3D(c[0],b.normal);var l=a.dotProduct3D(d[0],b.normal);if(1E-8>Math.abs(g-l))return!0;for(var f=1,e=
d.length;f<e;f++)if(c=a.dotProduct3D(d[f],b.normal),1E-8>Math.abs(g-c)||c>g&&l<g||c<g&&l>g)return!0}return!1};A.prototype.intersection=function(b,d){var c=this.vertices;if(0<c.length){d=a.subtract3D(d,b);var g=a.dotProduct3D(d,this.normal);if(0!==g&&(c=a.dotProduct3D(a.subtract3D(c[0],b),this.normal)/g,-1E-8<c&&1.00000001>c))return a.add3D(b,a.scalarProduct3D(d,c))}return null};A.prototype.isInterior=function(b){var d=this.vertices;if(0<d.length)for(var c=0,g=a.subtract3D(d[0],b),l=0,f=d.length;l<
f;l++){var e=a.subtract3D(d[(l+1)%f],b),h=a.dotProduct3D(a.crossProduct3D(g,e),this.normal);if(1E-8>Math.abs(h)){if(0>a.dotProduct3D(g,e))break}else{if(0>c&&0<h||0<c&&0>h)return!1;g=e;c=h}}return!0};A.prototype.inFrontOf=function(a,b,d){if(this.minDistanceToEye>=b.maxDistanceToEye||this.maxx<=b.minx||this.minx>=b.maxx||this.maxy<=b.miny||this.miny>=b.maxy)return!1;for(x=0;3>x;x++)if(m=null,m=0===x?this.intersections(b):1===x?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=m&&0<m.length){for(z=
0;z<m.length;z++)a.push(m[z]);r=0;for(u=m.length;r<u;r++){l=m[r];w=this.space.rayFromEye(l.x,l.y);try{t=this.distanceToEyeAlong(w)-b.distanceToEyeAlong(w);if(t<=-d)return!0;if(t>=d)return!1}catch(G){}}}return!1};A.prototype.intersections=function(b){for(var d=[],c,g,l,f=new a.R2,e=this.newSpaceVert,h=b.newSpaceVert,k=this.newProjVert,n=b.newProjVert,r=0,m=e.length;r<m;r++){b=e[r];c=e[(r+1)%m];for(var p=0,u=h.length;p<u;p++)g=h[p],l=h[(p+1)%u],b!=g&&b!=l&&c!=g&&c!=l&&(g=f.intersection(k[r],k[(r+1)%
m],n[p],n[(p+1)%u]),null!=g&&d.push(g))}return d};A.prototype.distanceToEyeAlong=function(b){b=a.dotProduct3D(this.normal,b);if(1E-6<Math.abs(b))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/b;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var b=[],d=this.newSpaceVert,c=this.newProjVert,g=0,l=d.length;g<l;g++)!a.isVertex(d[g])&&a.appearsToContain(c[g])&&b.push(c[g]);return b};A.prototype.appearsToContain=function(a){for(var b=
0,d,c=this.newProjVert,g=0,l=this.newSpaceVert.length;g<l;g++){d=(c[g].x-a.x)*(c[(g+1)%l].y-a.y)-(c[(g+1)%l].x-a.x)*(c[g].y-a.y);if(0!=b)if(1E-8>Math.abs(d)){if(1E-8<Math.abs(c[g].x-c[(g+1)%l].x))return Math.min(c[g].x,c[(g+1)%l].x)<=a.x+1E-8&&a.x<=Math.max(c[g].x,c[(g+1)%l].x)+1E-8;if(1E-8<Math.abs(c[g].y-c[(g+1)%l].y))return Math.min(c[g].y,c[(g+1)%l].y)<=a.y+1E-8&&a.y<=Math.max(c[g].y,c[(g+1)%l].y)+1E-8}else if(0<b&&0>d||0>b&&0<d)return!1;b=d}return!0};A.prototype.isVertex=function(b){for(var d=
this.newSpaceVert,c=0,g=d.length;c<g;c++)if(a.equals3DEpsilon(b,d[c],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var b=[],d=0,c,g=a.length,f=a.length-1;-1<f;f--)c=a.charAt(f),0==d?"="==c&&(d=1):1==d?" "!=c&&(d="<"===c||">"===c?0:2):2==d&&" "==c&&(b.unshift(a.substring(f+1,g)),g=f,d=0);b.unshift(a.substring(0,g));return b}if(a.loadLib)return a;var e={x:0,y:0,z:0},f,q,p,c,k,n=a.degToRad,b,g=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=b.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=d.parse("1");this.abs_coord=!1;this.family="";this.family_interval=d.parse("[0,1]");this.family_steps=d.parse("8");this.font="Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=d.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=d.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=d.parse("(0,0,0)");this.model="color";Object.assign(this,c);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=d.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style=
"Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=d.parse(this.inirot);this.endrot=d.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};g.prototype.getSpace=function(){for(var a=this.parent.spaces,b,c=0,
g=a.length;c<g;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};g.prototype.getFamilyValues=function(){f=this.evaluator;q=f.eval(this.family_interval);this.familyInf=q[0][0];this.familySup=q[0][1];this.fSteps=Math.round(f.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};g.prototype.buildFamilyPrimitives=function(){f=this.evaluator;this.getFamilyValues();p=f.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;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,p)};g.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};g.prototype.updateMVMatrix=function(){c=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(n(c[0][0])),this.inirotM=
this.inirotM.rotateX(n(c[0][1])),this.inirotM=this.inirotM.rotateZ(n(c[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(n(c[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(n(c[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(n(c[0][2])));c=this.evaluator.eval(this.inipos);e={x:c[0][0],y:c[0][1],z:c[0][2]};this.iniposM=this.iniposM.setIdentity().translate(e);c=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(n(c[0][0])),this.endrotM=this.endrotM.rotateX(n(c[0][1])),this.endrotM=this.endrotM.rotateZ(n(c[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(n(c[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(n(c[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(n(c[0][2])));c=this.evaluator.eval(this.endpos);e={x:c[0][0],y:c[0][1],z:c[0][2]};this.endposM=this.endposM.setIdentity().translate(e)};g.prototype.transformVertex=function(a){this.inirotEuler?k=
this.inirotM.multiplyVector4(a):(k=this.inirotM_X.multiplyVector4(a),k=this.inirotM_Y.multiplyVector4(k),k=this.inirotM_Z.multiplyVector4(k));k=this.iniposM.multiplyVector4(k);this.endrotEuler?k=this.endrotM.multiplyVector4(k):(k=this.endrotM_X.multiplyVector4(k),k=this.endrotM_Y.multiplyVector4(k),k=this.endrotM_Z.multiplyVector4(k));k=this.endposM.multiplyVector4(k);this.macroChildren&&(k=this.applyMacroTransform(k));k.adjustDec();return k};g.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
k=this.macro_inirotM.multiplyVector4(a):(k=this.macro_inirotM_X.multiplyVector4(a),k=this.macro_inirotM_Y.multiplyVector4(k),k=this.macro_inirotM_Z.multiplyVector4(k));k=this.macro_iniposM.multiplyVector4(k);this.macro_endrotEuler?k=this.macro_endrotM.multiplyVector4(k):(k=this.macro_endrotM_X.multiplyVector4(k),k=this.macro_endrotM_Y.multiplyVector4(k),k=this.macro_endrotM_Z.multiplyVector4(k));return k=this.macro_endposM.multiplyVector4(k)};g.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],c=0,g=a.length;c<g;c++)""!==a[c].trim()&&(b=b.concat(h(a[c])));c=0;for(g=b.length;c<g;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};g.prototype.splitFace=function(a){for(var d=0,c=this.primitives.length;d<c;d++)if(b=[],"face"===this.primitives[d].type){for(var g=0,f=a.primitives.length;g<f;g++)"face"===a.primitives[g].type?b=b.concat(this.primitives[d].splitFace(a.primitives[g])):b.push(a.primitives[g]);a.primitives=b}};a.Graphic3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c=function(c,f){return a.Graphic3D.call(this,c,f)||this};$jscomp.inherits(c,a.Graphic3D);c.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();e=h.eval(this.expresion);f=e[0][0];q=e[0][1];p=e[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,q,p,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:h.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||h.parser.parse("10"),this.offset_angle=this.offset_angle||h.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,q,p,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:h.eval(this.decimals),fixed:this.fixed,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(g,a.Graphic3D);g.prototype.buildPrimitives=function(){n=this.evaluator;this.updateMVMatrix();k=n.getVariable("u");n.setVariable("u",this.Nu);b=n.eval(this.expresion);h=b[0][0];e=b[0][1];f=b[0][2];q=b[1][0];p=b[1][1];c=b[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
e,f,1)),this.transformVertex(new a.Vector4D(q,p,c,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:n.eval(this.width)},this.space));n.setVariable("u",k)};a.Segment3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g,d,v,r,u,y=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.expresion=d.parseExpression();return d};$jscomp.inherits(y,a.Graphic3D);y.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();q=h.getVariable("x");p=h.getVariable("y");c=h.getVariable("z");
e=h.getVariable("u");f=h.getVariable("v");h.setVariable("u",0);h.setVariable("v",0);k=parseInt(h.eval(this.Nu));n=parseInt(h.eval(this.Nv));b=[];for(d=0;d<=k;d++)for(h.setVariable("u",d/k),v=0;v<=n;v++){h.setVariable("v",v/n);r=0;for(u=this.expresion.length;r<u;r++)h.eval(this.expresion[r]);b.push(this.transformVertex(new a.Vector4D(h.getVariable("x"),h.getVariable("y"),h.getVariable("z"),1)))}var m=this.color.getColor(),l=this.backcolor.getColor(),w=this.edges?this.edges.getColor():"";for(d=0;d<
k;d++)for(v=0;v<n;v++)g=[],g.push(b[v+d*n+d]),g.push(b[v+1+d*n+d]),g.push(b[v+2+(d+1)*n+d]),g.push(b[v+1+(d+1)*n+d]),this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:m,backColor:l,edges:w,model:this.model},this.space));h.setVariable("x",q);h.setVariable("y",p);h.setVariable("z",c);h.setVariable("u",e);h.setVariable("v",f)};a.Surface3D=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");return d};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();n=k.eval(this.expresion);for(var b=this.color.getColor(),d=0,v=n.length-1;d<v;d++)h=n[d][0],e=n[d][1],f=n[d][2],q=n[d+1][0],p=n[d+1][1],c=n[d+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
e,f,1)),this.transformVertex(new a.Vector4D(q,p,c,1))],type:"edge",frontColor:b,lineWidth:k.eval(this.width)},this.space))};a.Polygon3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.expresion=c.parseExpression();return c};$jscomp.inherits(n,a.Graphic3D);n.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();q=k.getVariable("x");p=k.getVariable("y");c=k.getVariable("z");f=k.getVariable("u");k.setVariable("u",0);e=k.eval(this.Nu);h=[];for(var b=0;b<=e;b++){k.setVariable("u",b/e);for(var g=0,d=
this.expresion.length;g<d;g++)k.eval(this.expresion[g]);h.push(this.transformVertex(new a.Vector4D(k.getVariable("x"),k.getVariable("y"),k.getVariable("z"),1)))}b=0;for(g=h.length-1;b<g;b++)this.primitives.push(new a.Primitive3D({vertices:[h[b],h[b+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));this.fill&&2<h.length&&this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));k.setVariable("x",q);k.setVariable("y",c);k.setVariable("z",p);k.setVariable("u",f)};a.Curve3D=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g,d,v=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();d=g.eval(this.expresion);h=d[0][0];e=d[0][1];f=d[0][2];q=d[1][0];p=d[1][1];c=d[1][2];k=d[2][0];n=d[2][1];b=d[2][2];var r=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,e,f,1)),this.transformVertex(new a.Vector4D(k,
n,b,1)),this.transformVertex(new a.Vector4D(q,p,c,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:r,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q=function(f,c){return a.Graphic3D.call(this,f,c)||this};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();f=e.eval(this.expresion);h=[];for(var p=f.length-1;0<=p;p--)h.push(this.transformVertex(new a.Vector4D(f[p][0],f[p][1],f[p][2],1)));p=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:p,model:this.model},this.space))};a.Face3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("2");b.length=b.length||c.evaluator.parser.parse("2");return b};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){c=this.evaluator;this.updateMVMatrix();h=c.eval(this.Nu);e=[this.transformVertex(new a.Vector4D(0,0,0,1))];f=c.eval(this.width)/2;q=c.eval(this.length)/2;p=2*Math.PI/h;for(var k=0;k<h;k++)e.push(this.transformVertex(new a.Vector4D(f*
Math.cos(p*k),q*Math.sin(p*k),0,1)));var b=this.color.getColor(),g=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";for(k=0;k<h;k++)this.primitives.push(new a.Primitive3D({vertices:[e[0],k+2<=h?e[k+2]:e[1],e[k+1]],type:"face",frontColor:b,backColor:g,edges:d,model:this.model},this.space))};a.Polireg3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p=function(c,f){c=a.Graphic3D.call(this,c,f)||this;c.shadowColor=c.shadowColor?c.shadowColor.getColor():"transparent";return c};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){h=this.evaluator;e=h.eval(this.expresion);f=e[0][0];q=e[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(f,q,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:h.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=p;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var e=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,q,p,c=0,k=function(k,b){var g=a.Graphic.call(this,k,b)||this;g.expresion=g.expresion||void 0;g.inirot=g.inirot||"(0,0,0)";g.inirotEuler=g.inirotEuler||!1;g.inipos=g.inipos||k.evaluator.parser.parse("(0,0,0)");g.endrot=g.endrot||
"(0,0,0)";g.endrotEuler=g.endrotEuler||!1;g.endpos=g.endpos||k.evaluator.parser.parse("(0,0,0)");g.name=g.name||"_descartes_empty_name_"+c++;Object.assign(g,b);g.inirot.match("Euler")&&(g.inirot=g.inirot.replace("Euler",""),g.inirotEuler=!0);g.endrot.match("Euler")&&(g.endrot=g.endrot.replace("Euler",""),g.endrotEuler=!0);g.inirot=g.evaluator.parser.parse(g.inirot);g.endrot=g.evaluator.parser.parse(g.endrot);g.inirotM=new a.Matrix4x4;g.inirotM_X=new a.Matrix4x4;g.inirotM_Y=new a.Matrix4x4;g.inirotM_Z=
new a.Matrix4x4;g.iniposM=new a.Matrix4x4;g.endrotM=new a.Matrix4x4;g.endrotM_X=new a.Matrix4x4;g.endrotM_Y=new a.Matrix4x4;g.endrotM_Z=new a.Matrix4x4;g.endposM=new a.Matrix4x4;g.graphics=[];k=k.lessonParser;var d=new a.Tokenizer;if(void 0==g.expresion)return g;"'"!==g.expresion.charAt(0)&&(g.expresion="'"+g.expresion+"'");g.expresion=g.evaluator.parser.parse(g.expresion);b=g.evaluator.eval(g.expresion);if(b)var n=(n=document.getElementById(b))&&"descartes/macro"==n.type?n.text:a.openExternalFile(b);
if(n){var r=a.convertHTMLEntities(n).replace(/\r/g,"").split("\n");n=[];b=0;for(var p=r.length;b<p;b++){var q=r[b].indexOf("=");if(-1!==q){q=k.split(r[b]);for(var m=0,l=q.length;m<l;m++)if(q[m]&&1<q.length&&("id"===h[q[m][0]]||"type"===h[q[m][0]])){n.push(q);break}}}b=0;for(p=n.length;b<p;b++){l=(m=n[b]||[],m[0])&&"id"===m[0][0];var w=!1;r=0;for(q=m.length;r<q;r++){var x=m[r][0].indexOf(".");-1===x||l?x=h[m[r][0]]:(x=h[m[r][0].substring(x+1)],m[r][0]=g.name+"."+m[r][0]);"type"===x&&"surface"===h[m[r][1]]&&
(w=!0);if(!("font"===x||"font_family"===x||("fill"===x||"color"===x||"backcolor"===x||"arrow"===x)&&"("!==m[r][1].charAt(0)||"file"===x&&m[r][1].match(f)||"id"!==x&&void 0!==h[m[r][1]]||w&&"expresion"===x)||"width"===x||"height"===x||"length"===x)if("text"==x)if(m[r][1].match(/\{\\rtf1/)){x=m[r][1];var z=g;var A=function(b,c){c=d.tokenize(c.replace(/&squot;/g,"'"));for(var g=0,l=c.length;g<l;g++)if("identifier"==c[g].type&&!a.reservedIds.match("-"+c[g].value+"-")||"R"===c[g].value||"G"===c[g].value||
"B"===c[g].value)c[g].value=z.name+"."+c[g].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+d.flatTokens(c)};x=x.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,A);x=x.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,A);m[r][1]=x}else{A=k.parseText(m[r][1]).textElementsMacros;for(var F=0,J=A.length;F<J;F++){x=d.tokenize(A[F].replace(/&squot;/g,"'"));for(var C=0,G=x.length;C<G;C++)if("identifier"===x[C].type&&!a.reservedIds.match("-"+x[C].value+
"-")||"R"===x[C].value||"G"===x[C].value||"B"===x[C].value)x[C].value=g.name+"."+x[C].value;x=d.flatTokens(x).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");A[F]=x.substring(1,x.length-1)}m[r][1]=A.join("")}else{A=m[r][1].replace(/&squot;/g,"'").split(";");F=0;for(J=A.length;F<J;F++){x=d.tokenize(A[F].replace(/\\n/g,";"));C=0;for(G=x.length;C<G;C++)if("identifier"===x[C].type&&!a.reservedIds.match("-"+x[C].value+"-")||"R"===x[C].value||"G"===x[C].value||"B"===x[C].value)x[C].value=
g.name+"."+x[C].value;A[F]=d.flatTokens(x)}m[r][1]=A.join(";")}}}b=0;for(p=n.length;b<p;b++)if(n[b][0]){m="";l=!1;r=0;for(q=n[b].length;r<q;r++)"type"===h[n[b][r][0]]&&e.match("-"+h[n[b][r][1]]+"-")&&(l=!0),m=m+n[b][r][0]+"='"+n[b][r][1]+"' ";n[b]=m+(l?" space='"+g.spaceID+"'":"");l?g.graphics.push(k.parse3DGraphic(n[b],g.abs_coord,g.background,g.inirot)):k.parseAuxiliar(n[b])}}b=0;for(p=g.graphics.length;b<p;b++)g.graphics[b].macroChildren=!0;return g};$jscomp.inherits(k,a.Graphic);k.prototype.buildFamilyPrimitives=
function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var b=0,c=this.fSteps;b<=c;b++)evaluator.setVariable(this.family,this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};
k.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var b=this.graphics.length;a<b;a++)q=this.graphics[a],q.macro_inirotEuler=this.inirotEuler,q.macro_inirotM=this.inirotM,q.macro_inirotM_X=this.inirotM_X,q.macro_inirotM_Y=this.inirotM_Y,q.macro_inirotM_Z=this.inirotM_Z,q.macro_iniposM=this.iniposM,q.macro_endrotEuler=this.endrotEuler,q.macro_endrotM=this.endrotM,q.macro_endrotM_X=this.endrotM_X,
q.macro_endrotM_Y=this.endrotM_Y,q.macro_endrotM_Z=this.endrotM_Z,q.macro_endposM=this.endposM,q.update();a=0;for(b=this.graphics.length;a<b;a++){q=this.graphics[a];if(q.split||this.split)for(var c=a+1;c<b;c++)p=this.graphics[c],(p.split||this.split)&&q.splitFace(p);this.primitives=this.primitives.concat(q.primitives||[])}};k.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),
this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);
tmpExpr=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));
tmpExpr=this.evaluator.eval(this.endpos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};k.prototype.drawAux=function(a){};a.Macro3D=k;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(a,b,d,c,g){e.call(this,a/m,a/m,a/m,c,g)}function e(a,b,d,c,g){a/=2;b/=2;d/=2;this.changeGeometry(a,b,d,c,g)||(this.vertices=[new l(a,d,b,1),new l(a,-d,b,1),new l(a,d,-b,1),new l(a,-d,-b,1),new l(-a,d,b,1),new l(-a,-d,b,1),new l(-a,d,-b,1),new l(-a,-d,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,d,c,g))}function f(a,b,d,c,g){a/=2;if(!this.changeGeometry(a,b,d,c,g)){var f=2*Math.PI/3,e=2*a*Math.sqrt(2)/3,k=-a/
3,h=e*Math.cos(f)+0*Math.sin(f);f=-e*Math.sin(f)+0*Math.cos(f);this.vertices=[new l(0,0,a,1),new l(h,f,k,1),new l(h,-f,k,1),new l(e,0,k,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,d,c,g)}}function q(a,b,d,c,g){a/=2;this.changeGeometry(a,b,d,c,g)||(this.vertices=[new l(0,0,a,1),new l(a,0,0,1),new l(-a,0,0,1),new l(0,a,0,1),new l(0,-a,0,1),new l(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,d,c,g))}function p(b,
d,c,g,f){b/=Math.PI;if(!this.changeGeometry(b,d,c,g,f)){B=b/1.6180339887;L=1.6180339887*b;this.vertices=[new l(b,b,b,1),new l(b,b,-b,1),new l(b,-b,b,1),new l(b,-b,-b,1),new l(-b,b,b,1),new l(-b,b,-b,1),new l(-b,-b,b,1),new l(-b,-b,-b,1),new l(0,B,L,1),new l(0,B,-L,1),new l(0,-B,L,1),new l(0,-B,-L,1),new l(B,L,0,1),new l(B,-L,0,1),new l(-B,L,0,1),new l(-B,-L,0,1),new l(L,0,B,1),new l(L,0,-B,1),new l(-L,0,B,1),new l(-L,0,-B,1)];I=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(P=this.vertices.length;H<
P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,d,c,g,f)}}function c(b,d,c,g,f){b/=3.8;if(!this.changeGeometry(b,d,c,g,f)){L=1.6180339887*b;this.vertices=[new l(0,b,L,1),new l(0,b,-L,1),new l(0,-b,L,1),new l(0,-b,-L,1),new l(b,L,0,1),new l(b,-L,0,1),new l(-b,L,0,1),new l(-b,-L,0,1),
new l(L,0,b,1),new l(L,0,-b,1),new l(-L,0,b,1),new l(-L,0,-b,1)];this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];I=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);H=0;for(P=this.vertices.length;H<P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.updateValues(b,d,c,g,f)}}function k(a,b,d,c,g){a/=2;this.isSphere?d=b=a:(b/=2,d/=2);if(!this.changeGeometry(a,
b,d,c,g)){this.vertices=[new l(0,0,b,1)];for(H=1;H<c;H++)for(C=H*u/c,D=0;D<g;D++)J=D*y/g,z=a*v(C)*r(J),A=d*v(C)*v(J),F=b*r(C),this.vertices.push(new l(z,A,F,1));this.vertices.push(new l(0,0,-b,1));this.faces=[];for(H=0;H<g;H++)this.faces.push([0,(H+1)%g+1,H%g+1]);for(H=1;H<c-1;H++)for(D=0;D<g;D++)this.faces.push([D+1+(H-1)*g,(D+1)%g+1+(H-1)*g,(D+1)%g+1+H*g,D+1+H*g]);for(H=0;H<g;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-g+H,this.vertices.length-1-g+(H+1)%g]);this.updateValues(a,
b,d,c,g)}}function n(a,b,d,c,g){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,g)){this.vertices=[];for(H=0;H<g;H++)for(D=0;D<c;D++)z=a*(g-H)/g*r(D*y/c),A=d*(g-H)/g*v(D*y/c),F=b-2*H*b/g,this.vertices.push(new l(z,A,F,1));this.vertices.push(new l(0,0,-b,1));this.faces=[];for(H=0;H<g-1;H++)for(D=0;D<c;D++)this.faces.push([D+H*c,(D+1)%c+H*c,(D+1)%c+(H+1)*c,D+(H+1)*c]);for(H=0;H<c;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-c+H,this.vertices.length-1-c+(H+1)%c]);this.updateValues(a,
b,d,c,g)}}function b(a,b,d,c,g){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,g)){this.vertices=[];for(H=0;H<g+1;H++)for(D=0;D<c;D++)z=a*r(D*y/c),A=d*v(D*y/c),F=b-2*H*b/g,this.vertices.push(new l(z,A,F,1));this.faces=[];for(H=0;H<g;H++)for(D=0;D<c;D++)this.faces.push([D+H*c,(D+1)%c+H*c,(D+1)%c+(H+1)*c,D+(H+1)*c]);this.updateValues(a,b,d,c,g)}}function g(a,b,d,c,g){a/=2;b/=2;d/=2;G=w.eval(this.R);E=w.eval(this.r);if(!this.changeGeometry(a,b,d,c,g)){this.vertices=[];for(H=0;H<g+1;H++)for(D=0;D<c;D++)z=
-(G+E*v(y*D/c))*v(y*H/g),A=(G+E*v(y*D/c))*r(y*H/g),F=E*r(y*D/c),this.vertices.push(new l(z,A,F,1));this.faces=[];for(H=0;H<g;H++)for(D=0;D<c;D++)this.faces.push([D+H*c,D+(H+1)*c,(D+1)%c+(H+1)*c,(D+1)%c+H*c]);this.updateValues(a,b,d,c,g)}}function d(){this.vertices=[];this.faces=[];H=0;for(P=this.fileData.length;H<P;H++)M=this.fileData[H],M.match(/^V\(/)?(O=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new l(O[0]||0,O[1]||0,O[2]||0,1))):M.match(/^F\(/)&&(O=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var v=Math.sin,r=Math.cos,u=Math.PI,y=2*u,m=Math.sqrt(3),l,w,x,z,A,F,J,C,G,E,B,L,I,M,O,H,P,D,N,K=function(m,r){r=a.Graphic3D.call(this,m,r)||this;r.width=r.width||m.evaluator.parser.parse("2");r.height=r.height||m.evaluator.parser.parse("2");r.length=r.length||m.evaluator.parser.parse("2");r.R=r.R||m.evaluator.parser.parse("2");r.r=r.r||m.evaluator.parser.parse("1");l=a.Vector4D;switch(r.subType){case "cube":r.buildGeometry=
h;break;case "box":r.buildGeometry=e;break;case "tetrahedron":r.buildGeometry=f;break;case "octahedron":r.buildGeometry=q;break;case "sphere":r.isSphere=!0;case "ellipsoid":r.buildGeometry=k;break;case "dodecahedron":r.buildGeometry=p;break;case "icosahedron":r.buildGeometry=c;break;case "cone":r.buildGeometry=n;break;case "cylinder":r.buildGeometry=b;break;case "torus":r.buildGeometry=g;break;case "mesh":r.fileData=a.openExternalFile(r.evaluator.eval(r.file)).split(/\r/),r.buildGeometry=d}return r};
$jscomp.inherits(K,a.Graphic3D);K.prototype.buildPrimitives=function(){w=this.evaluator;this.updateMVMatrix();this.buildGeometry(w.eval(this.width),w.eval(this.height),w.eval(this.length),w.eval(this.Nu),w.eval(this.Nv));var b=this.color.getColor(),d=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";H=0;for(P=this.faces.length;H<P;H++){x=[];D=0;for(N=this.faces[H].length;D<N;D++)x.push(this.transformVertex(this.vertices[this.faces[H][D]]));this.primitives.push(new a.Primitive3D({vertices:x,
type:"face",frontColor:b,backColor:d,edges:c,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,b,d,c,g){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===d&&this.oldNu===c&&this.oldNv===g};K.prototype.updateValues=function(a,b,d,c,g){this.oldWidth=a;this.oldHeight=b;this.oldLength=d;this.oldNv=g;this.oldNu=c};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,e=Math.min,f=Math.PI,q=Math.cos,p=Math.sin,c=Math.abs,k=Math.round,n,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G,E=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};E.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};E.prototype.copy=function(){return new E(this.x,this.y)};E.prototype.ix=function(){return k(h(e(this.x,32E3),-32E3))};E.prototype.iy=function(){return k(h(e(this.y,32E3),-32E3))};E.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};E.prototype.norm2=function(){return this.x*this.x+this.y*this.y};E.prototype.norm=function(){return Math.sqrt(this.norm2())};E.prototype.distance=function(a){b=this.copy();b.sub(a);return b.norm()};E.prototype.dot=function(a){return this.x*a.x+this.y*a.y};E.prototype.det=function(a){return this.x*a.y-this.y*a.x};E.prototype.mul=function(a){this.x*=a;this.y*=a};E.prototype.div=function(a){this.x/=a;this.y/=a};E.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};E.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};E.prototype.normalize=function(){n=this.norm();0!=n&&this.div(n)};E.prototype.rotR90=function(){n=this.x;this.x=this.y;this.y=-n};E.prototype.rotL90=function(){n=this.x;this.x=-this.y;this.y=n};E.prototype.rot=function(a){g=this.copy();r=q(a);u=p(a);this.x=g.x*r-g.y*u;this.y=g.x*u+g.y*r};E.prototype.rot2=function(a){this.rot(a*f/180)};E.prototype.intersection=function(a,b,g,f){y=b.x-a.x;m=g.x-f.x;l=g.x-a.x;w=b.y-a.y;x=g.y-f.y;z=g.y-a.y;G=y*
x-m*w;return 1E-6<c(G)?(d=(l*x-z*m)/G,v=(-l*w+z*y)/G,0<=d&&1>=d&&0<=v&&1>=v?new E(a.x+y*d,a.y+w*d):null):(b.x-g.x)*z!=(b.y-g.y)*l?null:a.x!=b.x?(A=e(a.x,b.x),F=h(a.x,b.x),A<=g.x&&g.x<=F?g:A<=f.x&&f.x<=F?f:null):g.x!=f.x?(J=e(g.x,f.x),C=h(g.x,f.x),J<=a.x&&a.x<=C?a:J<=b.x&&b.x<=C?b:null):a.y!=b.y?(A=e(a.y,b.y),F=h(a.y,b.y),A<=g.y&&g.y<=F?g:A<=f.y&&f.y<=F?f:null):g.y!=f.y?(J=e(g.y,f.y),C=h(g.y,f.y),J<=a.y&&a.y<=C?a:J<=b.y&&b.y<=C?b:null):a.x==g.x&&a.y==g.y?a:null};a.R2=E;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g=function(d,g){this.evaluator=d;this.constraint=g;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];c=
new a.R2(0,0);p=new a.R2(0,0);b=new a.R2(0,0)};g.prototype.getUnitNormal=function(){this.normal.normalize();return b.set(this.normal.x,this.normal.y)};g.prototype.gradient=function(a){h=this.evaluator;c.x=0;c.y=0;k=h.getVariable("x");n=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);h.setVariable("x",h.getVariable("x")+1E-6);e=h.eval(this.constraint);c.x=(e-this.f0)/1E-6;c.x=isNaN(c.x)?Infinity:c.x;h.setVariable("x",h.getVariable("x")-1E-6);h.setVariable("y",
h.getVariable("y")+1E-6);e=h.eval(this.constraint);c.y=(e-this.f0)/1E-6;c.y=isNaN(c.y)?Infinity:c.y;h.setVariable("x",k);h.setVariable("y",n);return c};g.prototype.findZero=function(a,b,c){h=this.evaluator;p.x=a.x;p.y=a.y;k=h.getVariable("x");n=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return p;h.setVariable("x",k);h.setVariable("y",n);for(var d=0;16>d;d++)if(f=p.x,q=p.y,this.normal=
this.gradient(p),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),p.x=f+this.normal.x,p.y=q+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=p.x-a.x,this.normal.y=p.y-a.y),p;return c?p:null};a.R2Newton=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(a,f){this.x=a;this.y=f};h.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};h.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};h.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};h.AXIS_X=new h(1,0);h.AXIS_Y=new h(0,1);a.Vector2D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.round,f,q,p,c,k,n,b,g,d,v,r,u,y,m=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.parser=b.evaluator.parser;this.id="GraphicControl"!==d.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==d.type?100:350;this.h="Video"!==d.type?23:120;"GraphicControl"!==d.type&&"Audio"!==d.type&&"Video"!==d.type?"TextArea"!==d.type?this.expresion=c.parse("(0,0,100,23)"):(this.expresion=c.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=c.parse("(0,0)");this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color=new a.Color(4>this.parent.version?"000000":"222222");this.colorInt=new a.Color("GraphicControl"!==d.type?"f0f8ff":"cc0022");this.font_size=c.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=c.parse("1");this.activeif=
c.parse("1");this.valueExpr=c.parse("0");this.decimals=c.parse("2");this.min=c.parse("-Infinity");this.max=c.parse("Infinity");this.incr=c.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,d);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==this.name||"_nada_"==this.name||"_void_"==this.name?"":this.name;d=this.evaluator.eval(this.expresion);
this.x=e(d[0][0]);this.y=e(d[0][1]);4==d[0].length&&(this.w=e(d[0][2]),this.h=e(d[0][3]));this.actionExec=b.lessonParser.parseAction(this)};m.prototype.init=function(){};m.prototype.update=function(){};m.prototype.draw=function(){};m.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,d=a.length;b<d;b++){var c=a[b];if(c.id===this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.numericalControlContainer}else{if("external"===this.region)return this.parent.externalSpace.addCtr(this),
this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numericalControlContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);
this.zIndex=a[0].zIndex;return a[0].numericalControlContainer};m.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};m.prototype.updatePositionAndSize=function(){p=c=k=n=!1;b=this.evaluator.eval(this.expresion);g=e(b[0][0]);p=e(this.x)!==g;this.x=g;g=e(b[0][1]);c=e(this.y)!==g;this.y=g;4===b[0].length&&(g=e(b[0][2]),k=e(this.w)!==g,this.w=g,g=e(b[0][3]),n=e(this.h)!==g,this.h=g);if(k||n||p||c)this.init(!1,!0),this.draw()};
m.prototype.formatOutputValue=function(a){y=this.parent;d=a+"";v=this.evaluator.eval(this.decimals);r=d.indexOf(".");-1!=r&&(u=d.substring(r+1),u.length>v&&(d=parseFloat(d).toFixed(v)));this.fixed&&(2!==y.version||2===y.version&&!this.exponentialif)&&(d=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(d)&&(d=this.fixed&&2!==y.version?parseFloat(d).toExponential(v):parseFloat(d).toExponential(),d=d.toUpperCase().replace("+",""));return d.replace(".",y.decimal_symbol)};m.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()};m.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);f=b*b;for(a=0;a<b;a++)q=h(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+q*q*192/f/255+")")};a.Control=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.abs,f=/[\w\.\-//]*(\.gif)/gi,q,p,c,k,n,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G,E,B,L,I,M,O,H,P,D,N,K=function(b,d){var c=a.Control.call(this,b,d)||this;c.imageSrc=d.imageSrc||"";c.image=d.image||new Image;c.imageOver=d.imageOver||new Image;c.imageDown=d.imageDown||new Image;c.flat=d.flat||!1;c.borderColor=d.borderColor||!1;c.text_align=d.text_align||"center_center";c.image_align=d.image_align||"center_center";c.font_family=a.getFontName(d.font_family||
"arial");c.ratio=b.ratio;-1===c.font_size&&(c.fontSizeNotSet=!0);c.borderColor&&(c.borderColor=new a.Color(c.borderColor));c.text_align=c.text_align.split("_");c.image_align=c.image_align.split("_");c.old_name=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.classContainer=c.cssClass?" "+c.cssClass+" ":"";c.extra_style=c.imageSrc.trim().match("^_STYLE_")?c.imageSrc.trim().substring(8):c.extra_style||"";c.imageSrc.trim().match("^_STYLE_")&&
(c.imageSrc="vacio.gif");if(c.extra_style){c.customStyle=!0;c.btnStyle=[];c.conStyle=[];c.conStyle.textBorder=3;b=c.extra_style.split("|");for(var g,l=0,f=b.length;l<f;l++)d=b[l],g=d.match(/rgb/g),d.match("class=")?c.classContainer=" "+d.substring(6):d.match("border=")?(c.btnStyle.push({type:"border-style",value:"solid"}),c.btnStyle.push({type:"border-width",value:d.substring(7).trim()+"px"})):d.match("borderRadius=")?(c.btnStyle.push({type:"border-radius",value:d.substring(13).trim()+"px"}),c.conStyle.push({type:"border-radius",
value:d.substring(13).trim()+"px"})):d.match("borderColor=")?c.btnStyle.push({type:"border-color",value:(g?"":"#")+d.substring(12).trim()}):d.match("overColor=")?c.conStyle.overColor=(g?"":"#")+d.substring(10).trim():d.match("downColor=")?c.conStyle.downColor=(g?"":"#")+d.substring(10).trim():d.match("font=")?c.conStyle.font=d.substring(5).trim().toLowerCase():d.match("inactiveColor=")?c.conStyle.inactiveColor=(g?"":"#")+d.substring(14).trim():d.match("inactiveColorBorder=")?c.conStyle.inactiveColorBorder=
(g?"":"#")+d.substring(20).trim():d.match("shadowTextBlur=")?c.conStyle.shadowTextBlur=parseFloat(d.substring(15).trim()):d.match("shadowTextOffsetX=")?c.conStyle.shadowTextOffsetX=parseFloat(d.substring(18).trim()):d.match("shadowTextOffsetY=")?c.conStyle.shadowTextOffsetY=parseFloat(d.substring(18).trim()):d.match("shadowTextColor=")?c.conStyle.shadowTextColor=(g?"":"#")+d.substring(16).trim():d.match("shadowBoxBlur=")?c.conStyle.shadowBoxBlur=parseFloat(d.substring(14).trim()):d.match("shadowBoxOffsetX=")?
c.conStyle.shadowBoxOffsetX=parseFloat(d.substring(17).trim()):d.match("shadowBoxOffsetY=")?c.conStyle.shadowBoxOffsetY=parseFloat(d.substring(17).trim()):d.match("shadowBoxColor=")?c.conStyle.shadowBoxColor=(g?"":"#")+d.substring(15).trim():d.match("shadowInsetBoxBlur=")?c.conStyle.shadowInsetBoxBlur=parseFloat(d.substring(19).trim()):d.match("shadowInsetBoxOffsetX=")?c.conStyle.shadowInsetBoxOffsetX=parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxOffsetY=")?c.conStyle.shadowInsetBoxOffsetY=
parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxColor=")?c.conStyle.shadowInsetBoxColor=(g?"":"#")+d.substring(20).trim():d.match("textBorder=")?c.conStyle.textBorder=parseFloat(d.substring(11).trim()):d.match("flat=")&&(c.flat=1==parseInt(d.substring(5).trim()))}c.imageSrc.match("_COLORES_")&&(b=c.imageSrc.split("_"),c.colorInt=new a.Color(b[2]),c.color=new a.Color(b[3]),c.font_size=c.parser.parse(b[5]),c.imageSrc="");c.imageSrc.match(/^\[.*\]?/)?c.imageSrc=c.parser.parse(c.imageSrc.substring(1,
c.imageSrc.length-1)):c.imageSrc=c.parser.parse("'"+c.imageSrc+"'");b=c.evaluator.eval(c.imageSrc).toString().trim();if(""!=b)if(d=b.substr(0,b.lastIndexOf(".")),g=b.substr(b.lastIndexOf(".")),b.match(/vacio.gif$/i))c.imageSrc=c.parser.parse("'vacio.gif'"),c.image.ready=1,3===c.parent.version&&(c.name=c.parser.parse("")),c.emptyImage={ready:!0},c.parser.parse("'vacio.gif'");else if(c.image=c.parent.getImage(b),d)try{c.imageOver=c.parent.getImage(d+"_over"+g),c.imageDown=c.parent.getImage(d+"_down"+
g)}catch(S){}c.container=a.newHTML("div",{class:"DescartesButtonContainer"+c.classContainer,id:c.id,style:"width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"});c.btn=a.newHTML("canvas",{width:c.w*c.ratio,height:c.h*c.ratio,style:"position:absolute;left:0;top:0;width:"+c.w+"px;height:"+c.h+"px;"});c.ctx=c.btn.getContext("2d");c.ctx.imageSmoothingEnabled=!1;c.tooltip&&(c.btn.title=c.tooltip);c.container.appendChild(c.btn);c.addControlContainer(c.container);c.addEvents();
c.init();return c};$jscomp.inherits(K,a.Control);K.prototype.init=function(b){q=this.evaluator;z=this.container;p=this.btn;c=this.ctx;k=q.eval(this.expresion);this.x=k[0][0];this.y=k[0][1];4==k[0].length&&(this.w=parseInt(k[0][2]),this.h=parseInt(k[0][3]));p.width=this.w*this.ratio;p.height=this.h*this.ratio;p.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+this.h+"px;box-sizing:border-box;");z.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+
"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var d=0,g=this.btnStyle.length;d<g;d++)p.style[this.btnStyle[d].type]=this.btnStyle[d].value;if(this.conStyle){d=0;for(g=this.conStyle.length;d<g;d++)z.style[this.conStyle[d].type]=this.conStyle[d].value;if(this.conStyle.shadowBoxColor){d=this.conStyle.shadowBoxOffsetX||0;g=this.conStyle.shadowBoxOffsetY||2;var l=this.conStyle.shadowBoxBlur||2;z.style.boxShadow=d+"px "+g+"px "+l+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&
(d=this.conStyle.shadowInsetBoxOffsetX||0,g=this.conStyle.shadowInsetBoxOffsetY||-2,l=this.conStyle.shadowInsetBoxBlur||1,p.style.boxShadow=d+"px "+g+"px "+l+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.fontSizeNotSet&&(this.font_size=q.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=q.eval(this.font_size);this.createGradient(this.w,this.h);z.style.display=0<q.eval(this.drawif)?"block":"none";c.lineJoin="round";c.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+
this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&
this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(b)};K.prototype.update=function(){q=this.evaluator;z=this.container;p=this.btn;this.activeIfValue=0<q.eval(this.activeif);this.drawIfValue=0<q.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?
(z.style.display="block",this.draw(),z.style.cursor=p.style.cursor=this.activeIfValue?"pointer":"not-allowed",this.updatePositionAndSize()):(z.style.display="none",this.buttonClick=!1)};K.prototype.draw=function(e){z=this.container;q=this.evaluator;p=this.btn;c=this.ctx;b=q.eval(this.name);g=this.evaluator.eval(this.imageSrc).toString().trim();if(!e&&(A=this.over===this.oldOver,F=this.buttonClick===this.oldButtonClick,J=this.activeIfValue===this.oldActiveIfValue,C=this.drawIfValue===this.oldDrawIfValue,
G=b===this.oldName,E=g===this.oldImageSrc,B=this.colorInt.getColor()===this.oldBackColor,L=this.color.getColor()===this.oldTextColor,I=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=b,this.oldImageSrc=g,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,A&&F&&J&&C&&G&&E&&B&&L&&I))return;c.save();
c.setTransform(this.ratio,0,0,this.ratio,0,0);n=this.fs_evaluated;z.setAttribute("data-name",b);g?(d="vacio.gif"===g?this.emptyImage:this.parent.getImage(g),M=g.substr(0,g.lastIndexOf(".")),O=g.substr(g.lastIndexOf(".")),H=M+"_over"+O,P=M+"_down"+O,D="vacio.gif"===g?this.emptyImage:this.parent.getImage(H),N="vacio.gif"===g?this.emptyImage:this.parent.getImage(P)):N=D=d=this.emptyImage;c.clearRect(0,0,this.w,this.h);v=r=0;this.buttonClick&&(v=r=1);this.text_object.draw(c,this.color.getColor(),0,0,
!0);u=this.text_object.textNodes.metrics.w;y=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?w=h(this.w/2+v)-.5:"left"==this.text_align[1]?w=u/2+5+v:"right"==this.text_align[1]&&(w=this.w-u/2+v-5);"center"==this.text_align[0]?x=h(this.h/2+r)-.5:"top"==this.text_align[0]?x=y/2+r+4:"bottom"==this.text_align[0]&&(x=this.h-y/2+r-3);d&&("center"==this.image_align[1]?m=parseInt((this.w-d.width)/2)+v:"left"==this.image_align[1]?m=v:"right"==this.image_align[1]&&(m=this.w-d.width+v),"center"==
this.image_align[0]?l=parseInt((this.h-d.height)/2)+r:"top"==this.image_align[0]?l=r:"bottom"==this.image_align[0]&&(l=this.h-d.height+r));if(d&&d.ready)if(d!==this.emptyImage&&d.complete)if(g.match(f))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+g+"')",this.btn.style.backgroundPosition=m+"px "+l+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])z.style.backgroundColor=this.colorInt.getColor();c.drawImage(d,m,l)}else this.emptyImage&&this.customStyle&&
(z.style.backgroundColor=this.colorInt.getColor());else z.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(c,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(c,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(c,1,0,1,this.h,"rgba(0,0,0,0.03)")),c.fillStyle=this.linearGradient,c.fillRect(0,0,this.w,this.h));this.activeIfValue&&(D!==this.emptyImage&&this.over&&D.ready&&D.complete?H.match(f)?(this.btn.style.backgroundImage="url('"+H+"')",this.btn.style.backgroundPosition=
m+"px "+l+"px"):c.drawImage(D,m,l):this.customStyle&&this.conStyle.overColor&&this.over&&(z.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?N!==this.emptyImage&&this.buttonClick&&N.ready&&N.complete?P.match(f)?(this.btn.style.backgroundImage="url('"+P+"')",this.btn.style.backgroundPosition=m+"px "+l+"px"):c.drawImage(N,m,l):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(z.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!d&&(c.fillStyle="rgba(0,0,0,0.09)",
c.fillRect(0,0,this.w,this.h));c.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(c.lineWidth=this.conStyle.textBorder,c.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(c.lineWidth=parseInt(n/6),c.strokeStyle=this.borderColor.getColor());this.text_object.draw(c,this.color.getColor(),w,x);this.underlined&&(c.strokeStyle=this.color.getColor(),c.lineWidth=h(n/10)||2,c.lineCap="round",c.beginPath(),c.moveTo(w-u/2+v,x+h(n/2)+h(n/
5)-1.5),c.lineTo(w+u/2+v,x+h(n/2)+h(n/5)-1.5),c.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?z.style.backgroundColor=this.conStyle.inactiveColor:(c.fillStyle="rgba(240,240,240,0.6)",c.fillRect(0,0,this.w,this.h)));c.restore();this._image_pos_x=m;this._image_pos_y=l};K.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(e(this.colorInt.r-this.color.r)+e(this.colorInt.g-this.color.g)+e(this.colorInt.b-this.color.b))/255)};K.prototype.buttonPressed=
function(){this.updateAndExecAction()};K.prototype.addEvents=function(){function b(d,c,f){a.clearTimeout(l);g.buttonClick&&g.drawIfValue&&g.activeIfValue&&(c.call(g),d=f?d:100,l=a.setTimeout(function(){b(d,c,!1)},d))}function d(d){this.focus();d.preventDefault();d.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();g.whichBtn=a.whichBtn(d);"L"==g.whichBtn&&g.activeIfValue&&(g.buttonClick=!0,g.draw(),"calculate"==g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),
b(1E3,g.buttonPressed,!0)),g.btn.removeEventListener("touchend",c),g.btn.addEventListener("touchend",c),g.btn.removeEventListener("mouseup",c),g.btn.addEventListener("mouseup",c))}function c(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(g.activeIfValue||g.buttonClick)g.buttonClick=!1,g.draw(),"calculate"!=g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),g.buttonPressed()),g.btn.removeEventListener("touchend",c),g.btn.removeEventListener("mouseup",
c);g.parent.update()}var g=this,l;g.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",d);this.btn.addEventListener("mousedown",d);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();g.over=!0;g.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=null;b.preventDefault();b.stopPropagation();g.over=!1;g.buttonClick=!1;g.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=
null;g.buttonClick=!1})};a.Button=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g,d,v,r,u=function(b,c){c=a.Control.call(this,b,c)||this;c.flat=c.image_dec_src&&c.image_inc_src;c.btn_pos=c.btn_pos||"v_left";c.horizontal="h_left"===c.btn_pos||"h_right"===c.btn_pos||"h_left_right"===c.btn_pos;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.tabindex=++c.parent.tabindex;c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,
c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:c.id});c.divUp=a.newHTML("div",{class:"DJS_Up"});c.divDown=a.newHTML("div",{class:"DJS_Down"});c.field=a.newHTML("input",{type:"text",id:c.id+"_spinner",class:"DescartesSpinnerField",tabindex:c.tabindex});c.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.label);c.container.appendChild(c.field);
c.container.appendChild(c.divUp);c.container.appendChild(c.divDown);c.addControlContainer(c.container);d=c.evaluator.parser.parse("1");c.originalIncr=c.incr;if(0>c.evaluator.eval(c.decimals)||0===c.evaluator.eval(c.incr))b=c.evaluator.eval(c.incr),0<b?(c.incr=c.evaluator.parser.parse(parseInt(b).toString()),c.originalIncr=c.incr):c.incr=d;c.image_dec_src&&(c.image_dec_src.match(/^\[.*\]?/)?c.image_dec_src=c.parser.parse(c.image_dec_src.substring(1,c.image_dec_src.length-1)):c.image_dec_src=c.parser.parse("'"+
c.image_dec_src+"'"),c.old_image_dec_src=c.evaluator.eval(c.image_dec_src).toString().trim(),c.image_dec=c.parent.getImage(c.old_image_dec_src));c.image_inc_src&&(c.image_inc_src.match(/^\[.*\]?/)?c.image_inc_src=c.parser.parse(c.image_inc_src.substring(1,c.image_inc_src.length-1)):c.image_inc_src=c.parser.parse("'"+c.image_inc_src+"'"),c.old_image_inc_src=c.evaluator.eval(c.image_inc_src).toString().trim(),c.image_inc=c.parent.getImage(c.old_image_inc_src));c.addEvents();c.init();return c};$jscomp.inherits(u,
a.Control);u.prototype.init=function(b,c){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();var d=this.label.textContent;c||(this.value=this.validateValue(h.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<h.eval(this.font_size)?h.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",
width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var g=2!==this.parent.version?"__":"_____",f=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){b=parseInt(this.h);var e=parseInt(this.w/2-b);g=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(e=this.w-
2*b,f=0);e<g&&(e=g);""==d&&(e=0);this.w-e-b<f&&(e=this.w-b-f);0>e&&(e=0);d=this.w-(e+2*b);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;");this.divUp.setAttribute("style","width:"+b+"px;height:"+b+"px;"+("h_left"===this.btn_pos?"left:"+(e+b):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+b+"px;height:"+b+"px;left:"+(e+("h_right"===
this.btn_pos?d:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+(b+e+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;")}else b=2+parseInt(this.h/2),e=parseInt(this.w/2-b/2),g=a.getTextWidth(d+g,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(e=this.w-b,f=0),e<g&&(e=g),""==d&&(e=0),this.w-e-b<f&&(e=this.w-b-f),0>e&&
(e=0),d=this.w-(e+b),this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;"),g="width:"+b+"px;left:"+(e+("v_right"===this.btn_pos?d:0))+"px;",this.divUp.setAttribute("style",g+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",g+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;"+(this.flat?"border-width:0;":"")),this.field.setAttribute("style",
"font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?b:0)+e)+"px;");this.field.value=c;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=e*this.ratio;this.label.height=this.h*this.ratio;
this.image_dec&&this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);h.setVariable(this.id,this.value)};u.prototype.update=function(){h=this.evaluator;0>h.eval(this.decimals)?(e=h.eval(this.incr),0<e?this.originalIncr=this.incr=h.parser.parse(parseInt(e).toString()):
this.incr=d):this.incr=0!==h.eval(this.originalIncr)?this.originalIncr:d;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==v&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")",this.old_image_dec_src=v));this.image_inc&&(r=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==r&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")",this.image_inc_src=r));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,q=this.value,this.value=this.validateValue(h.getVariable(this.id)),
this.field.value=this.formatOutputValue(this.value),this.value==q&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),h.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};u.prototype.updateStyle=function(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":
this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"};u.prototype.validateValue=
function(a){h=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");p=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(p)&&(p=0);n=h.eval(this.min);b=h.eval(this.max);""===n&&(n=-Infinity);""===b&&(b=Infinity);p=Math.min(Math.max(p,n),b);this.discrete&&(c=h.eval(this.incr),p=0==c?0:c*Math.round(p/c));k=h.eval(this.decimals);0>=k&&(k=0);return p=parseFloat(parseFloat(p).toFixed(k))};
u.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};u.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};u.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};u.prototype.addEvents=function(){function b(c,d,g){a.clearTimeout(n);if(k.up||
k.down)d.call(k),c=g?c:10,n=a.setTimeout(function(){b(c,d)},c)}function c(c){c.preventDefault();k.whichBtn=a.whichBtn(c);"L"==k.whichBtn&&k.activeIfValue&&(k.up=!0,b(h,k.increase,!0))}function d(c){c.preventDefault();k.whichBtn=a.whichBtn(c);"L"==k.whichBtn&&k.activeIfValue&&(k.down=!0,b(h,k.decrease,!0))}function f(b){k.up=!1;a.clearTimeout(n);k.updateStyle()}function e(b){k.down=!1;a.clearTimeout(n);k.updateStyle()}g=a.hasTouchSupport;var k=this,h=g?500:200,n;k.divUp.oncontextmenu=k.divDown.oncontextmenu=
k.field.oncontextmenu=k.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&&k.changeValue(k.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){k.up=
!1;a.clearTimeout(n);b.preventDefault();k.updateStyle()});this.divDown.addEventListener("mouseout",function(b){k.down=!1;a.clearTimeout(n);b.preventDefault();k.updateStyle()});this.divUp.addEventListener("touchend",f);window.addEventListener("touchend",f);this.divUp.addEventListener("mouseup",f);window.addEventListener("mouseup",f);this.divDown.addEventListener("touchend",e);window.addEventListener("touchend",e);this.divDown.addEventListener("mouseup",e);window.addEventListener("mouseup",e);document.addEventListener("visibilitychange",
function(b){k.up=!1;k.down=!1;a.clearTimeout(n);k.updateStyle()});k.field.addEventListener("click",function(a){this.focus()})};a.Spinner=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(f,e){var h=a.Control.call(this,f,e)||this;h.label_color=h.label_color||new a.Color("e0e4e8",f.evaluator);h.label_text_color=h.label_text_color||new a.Color("000000",f.evaluator);h.typeCtr="checkbox";h.pressed=e.pressed||!1;h.radio_group=(e.radio_group||"").trim();""!==h.radio_group&&(h.typeCtr="radio");h.name_str=h.name;h.name.match(/^\[.*\]?/)?h.name=h.parser.parse(h.name.substring(1,h.name.length-1)):h.name=h.parser.parse("'"+h.name.trim()+
"'");h.tabindex=++h.parent.tabindex;h.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:h.id});h.checkbox=a.newHTML("input",{type:h.typeCtr,id:h.id+h.typeCtr,class:"DescartesCheckbox",tabindex:h.tabindex});""!==h.radio_group&&h.checkbox.setAttribute("name",h.radio_group);h.checkbox.internalID=h.id;h.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});h.label_ctx=h.label.getContext("2d");h.ratio=f.ratio;h.dummyLabel=a.newHTML("label",{"for":h.id+h.typeCtr});h.value=h.evaluator.eval(h.valueExpr);
h.evaluator.setVariable(h.id,h.value);h.containerControl.appendChild(h.label);h.containerControl.appendChild(h.checkbox);h.containerControl.appendChild(h.dummyLabel);h.addControlContainer(h.containerControl);h.addEvents();h.init();return h};$jscomp.inherits(e,a.Control);e.prototype.init=function(f){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();this.labelFontSize=0<h.eval(this.font_size)?h.eval(this.font_size):a.getFieldFontSize(this.h);f=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+f+"px;");this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+f+"px;");this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+f+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+
";");this.label.width=f*this.ratio;this.label.height=this.h*this.ratio;this.update()};e.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.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!==h.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?
1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=0!==this.value),h.setVariable(this.id,this.value);else{this.value=h.getVariable(this.id);h.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var e=-1;if(this.pressed){for(var p=a.length-1;0<=p;p--)h.setVariable(a[p].internalID,0),a[p].checked=!1;h.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;h.setVariable(this.radio_group,this.id);this.pressed=0}else{for(p=a.length-1;0<=p;p--)e=0!=h.getVariable(a[p].internalID)?
p:e,h.setVariable(a[p].internalID,0),a[p].checked=!1;0<=e&&(h.setVariable(a[e].internalID,1),a[e].checked=!0,h.setVariable(this.radio_group,a[e].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};e.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("mousedown",a.preventDefault);f.checkbox.addEventListener("click",function(a){f.pressed=!0;f.updateAndExecAction()})};a.Checkbox=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k=function(c,b){b=a.Control.call(this,c,b)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+"'");void 0===b.valueExprString&&(b.valueExprString=b.onlyText?"0":"");b.emptyString=!1;b.ok=0;b.tabindex=++b.parent.tabindex;
b.regExpDecimalSymbol=new RegExp("\\"+b.parent.decimal_symbol,"g");if(b.answer)if(b.answer.match("krypto_")&&(b.answer=(new a.Krypto).decode(b.answer.substring(7))),b.answerPattern=b.answer,b.answer=a.buildRegularExpressionsPatterns(b.answer,b.evaluator),b.onlyText){var g=b.answerPattern.indexOf("|");b.firstAnswer=-1==g?b.answerPattern:b.answerPattern.substring(0,g)}else b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(",")));b.onlyText&&(b.valueExprString.match(/^'/)&&
b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:b.id});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(k,a.Control);k.prototype.init=function(c){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();var b=this.label.textContent;c||(this.value=this.validateValue(h.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=
0<h.eval(this.font_size)?h.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var g=a.getTextWidth(c+
"_",this.fieldFontSize+"px "+a.sansserif_font),d=parseInt(this.w/2),f=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(d=this.w,g=0);d<f&&(d=f);""==b&&(d=0);this.w-d<g&&(d=this.w-g);0>d&&(d=0);b=this.w-d;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.field.value=
c;this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=d*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};k.prototype.update=function(){h=
this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(e=this.field.value,f=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===f&&this.field.value!=e&&(this.value=this.validateValue(e),this.field.value=this.formatOutputValue(this.value)),
h.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};k.prototype.validateValue=function(a){if(""===a||"''"==a)return"";h=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");q=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(q)&&(q=0);p=h.eval(this.min);c=h.eval(this.max);""===p&&(p=-Infinity);""===c&&(c=Infinity);q<p&&(q=p);q>c&&(q=c);this.discrete&&(a=h.eval(this.incr),q=0===a?0:a*Math.round(q/a));return q=
parseFloat(parseFloat(q).toFixed(h.eval(this.decimals)))};k.prototype.formatOutputValue=function(c){return""===c?"":a.Control.prototype.formatOutputValue.call(this,c)};k.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};k.prototype.evaluateAnswer=
function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};k.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};k.prototype.addEvents=function(){var c=this;c.field.oncontextmenu=c.label.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){c.drawIfValue&&c.changeValue(c.field.value,
!0)});this.field.addEventListener("keydown",function(a){c.activeIfValue&&13==a.keyCode&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(a){this.focus()})};a.TextField=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.abs,e,f,q,p,c,k,n,b,g,d,v=function(b,c){function d(b){l.options=b.split(",");l.menuOptions=[];l.strValue=[];b=0;for(var c=l.options.length;b<c;b++){var d=l.customSplit(l.options[b]);1==d.length?(l.menuOptions.push(d[0]),l.strValue.push(b.toString())):2==d.length&&(l.menuOptions.push(d[0]),""==d[1]?l.strValue.push(b.toString()):l.strValue.push(d[1]))}b=0;for(c=l.menuOptions.length;b<c;b++)l.menuOptions[b].match(/^\[/)&&l.menuOptions[b].match(/\]$/)?
l.menuOptions[b]=e.parse(l.menuOptions[b].substring(1,l.menuOptions[b].length-1)):l.menuOptions[b]=e.parse("'"+l.menuOptions[b]+"'");b=0;for(c=l.strValue.length;b<c;b++)l.strValue[b].match(/^\[/)&&l.strValue[b].match(/\]$/)?l.strValue[b]=e.parse(l.strValue[b].substring(1,l.strValue[b].length-1)):l.strValue[b]=e.parse(l.strValue[b]);for(;l.select.firstChild;)l.select.remove();b=0;for(c=l.menuOptions.length;b<c;b++)d=a.newHTML("option"),d.innerHTML=f.eval(l.menuOptions[b]),l.select.appendChild(d);return 0}
var g=a.Control.call(this,b,c)||this;g.label_color=g.label_color||new a.Color("e0e4e8",b.evaluator);g.label_text_color=g.label_text_color||new a.Color("000000",b.evaluator);g.options=c.options||"";e=g.parser;f=g.evaluator;g.ok=0;g.tabindex=++g.parent.tabindex;g.answer&&(g.answer.match("krypto_")&&(g.answer=(new a.Krypto).decode(g.answer.substring(7))),g.answer=parseInt(g.answer.split(",")[0].replace("[",""))||0);g.name_str=g.name;g.name.match(/^\[.*\]?/)?g.name=g.parser.parse(g.name.substring(1,g.name.length-
1)):g.name=g.parser.parse("'"+g.name+"'");var l=g;g.evaluator.setFunction(g.id+".setOptions",d);g.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:g.id});g.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});g.label_ctx=g.label.getContext("2d");g.ratio=b.ratio;g.select=a.newHTML("select",{id:g.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:g.tabindex});g.field=a.newHTML("input",{type:"text",id:g.id+"_menuField",class:"DescartesMenuField",tabindex:g.tabindex});d(g.options);
g.containerControl.appendChild(g.label);g.containerControl.appendChild(g.select);g.visible&&g.containerControl.appendChild(g.field);g.addControlContainer(g.containerControl);g.addEvents();g.init();return g};$jscomp.inherits(v,a.Control);v.prototype.init=function(b){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();var c=this.label.textContent;this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},
evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var d=0,g=0;this.value=b?this.value:f.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var l=0,e=this.menuOptions.length;l<e;l++)b=a.getTextWidth(f.eval(this.menuOptions[l]).toString(),
this.fieldFontSize+"px "+a.sansserif_font),b>d&&(d=b,g=l);d+=25;b=a.getTextWidth(this.formatOutputValue(f.eval(this.strValue[g])),this.fieldFontSize+"px "+a.sansserif_font)+7;g=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==c&&(g=0);this.visible||(b=0);for(c=this.w-b-g;c<d&&0<g;)g--,c++;for(;c<d&&0<b;)b--,c++;for(;g+c+b+1<this.w;)c++,b++;d=g;l=d+c;b=this.w-l;e=this.formatOutputValue(f.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+
this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=g*this.ratio;this.label.height=this.h*this.ratio;this.field.value=e;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+
l+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+d+"px;");this.select.selectedIndex=this.indexValue;f.setVariable(this.id,parseFloat(e.replace(this.parent.decimal_symbol,".")));this.update()};v.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){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();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,
this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};v.prototype.customSplit=function(a){k=!1;n="";b=0;for(g=-1;b<a.length;){d=a.charAt(b);if("["===d&&-1===g){if(k||""!=n)n+="\u00a6";g++}else"["===d?g++:"]"===d&&0===g?(k=!0,g--):"]"==a.charAt(b)&&(g=0>g?g:g-1);n+=a.charAt(b);b++}return n.split("\u00a6")};v.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));q=-1;p=Infinity;
for(var b=0,d=this.strValue.length;b<d;b++)c=h(a-parseFloat(this.evaluator.eval(this.strValue[b]))),c<=p&&(p=c,q=b);return q};v.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};v.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);
this.select.addEventListener("change",function(a){b.value=b.evaluator.eval(b.strValue[this.selectedIndex]);b.field.value=b.formatOutputValue(b.value);b.evaluator.setVariable(b.id,b.field.value);b.changeValue();a.preventDefault()});this.field.addEventListener("keydown",function(a){13==a.keyCode&&(b.indexValue=b.getIndex(b.field.value),b.value=b.evaluator.eval(b.strValue[b.indexValue]),b.field.value=b.formatOutputValue(b.indexValue),b.select.selectedIndex=b.indexValue,b.changeValue())});b.field.addEventListener("click",
function(a){this.focus()})};a.Menu=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e,f,q,p,c,k,n,b,g,d,v,r,u,y,m,l,w,x,z=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);
c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(z,a.Control);z.prototype.init=function(){e=this.evaluator;0==e.eval(this.decimals)?this.incr=1:this.incr=(e.eval(this.max)-e.eval(this.min))/100;this.value=this.validateValue(e.eval(this.valueExpr));q=this.formatOutputValue(this.value);p=this.evaluator.eval(this.expresion);this.x=p[0][0];this.y=p[0][1];4==
p[0].length&&(this.w=p[0][2],this.h=p[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(q);this.changeScrollPositionFromValue();this.prePos=this.pos;e.setVariable(this.id,this.value)};z.prototype.initScroll=function(b){f=this;e=f.evaluator;f.label.innerHTML=e.eval(f.name).toString();x=this.label.textContent;var c="v"===f.orientation?parseInt(19+5*(f.h-100)/100):f.h;f.fieldFontSize=0<e.eval(f.font_size)?e.eval(f.font_size):"v"===f.orientation?c-parseInt(f.h/20)-1:a.getFieldFontSize(c);
this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},f.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);b=a.getTextWidth(b+"_",f.fieldFontSize+"px "+a.sansserif_font);var 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),c=f.fieldHeight,b=c+f.canvasHeight,f.canvasX=0,f.canvasY=f.fieldHeight,f.labelWidth=f.w,f.labelY=b,f.upWidth=f.downW=f.w,f.upHeight=f.downH=15,f.upX=0,f.upY=f.fieldHeight,f.downX=0,f.downY=b-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=b-f.downH-f.scrollHandlerH,f.limSup=c+f.downH;else{c=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);f.labelWidth=c;f.fieldWidth=b;""==x&&(f.labelWidth=0);f.visible||(f.fieldWidth=0);for(b=f.w-f.fieldWidth-f.labelWidth;58>b&&0<f.labelWidth;)f.labelWidth--,b++;for(;58>b&&0<f.fieldWidth;)f.fieldWidth--,b++;c=f.labelWidth;d=c+b;f.fieldWidth=f.w-d;f.canvasWidth=b;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=c+f.downW;f.limSup=c+f.canvasWidth-f.downW-f.scrollHandlerW}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:0;top:0;");f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.divUp.setAttribute("style","width:"+f.upWidth+"px;height:"+f.upHeight+"px;left:"+f.upX+"px;top:"+f.upY+"px;");f.divDown.setAttribute("style","width:"+f.downW+"px;height:"+f.downH+"px;left:"+f.downX+"px;top:"+f.downY+"px;");f.scrollHandler.setAttribute("style","width:"+f.scrollHandlerW+
"px;height:"+f.scrollHandlerH+"px;left:"+("v"===f.orientation?0:f.limInf)+"px;top:"+("v"===f.orientation?f.limInf:0)+"px;");f.field.setAttribute("style","font-size:"+f.fieldFontSize+"px;width:"+f.fieldWidth+"px;height:"+f.fieldHeight+"px;left:"+f.fieldX+"px;top:0;");0===f.fieldHeight&&(f.field.style.display="none");f.label.setAttribute("style","font-size:"+f.fieldFontSize+"px;width:"+f.labelWidth+"px;height:"+f.labelHeight+"px;line-height:"+f.labelHeight+"px;left:0;top:"+f.labelY+"px;background-color:"+
this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=f.labelWidth*this.ratio;this.label.height=f.labelHeight*this.ratio};z.prototype.update=function(){e=this.evaluator;0==e.eval(this.decimals)?this.incr=1:this.incr=(e.eval(this.max)-e.eval(this.min))/100;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.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(e.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);e.setVariable(this.id,this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);this.text_object.textNodes.metrics.w>this.label.width/
this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};z.prototype.draw=function(){f=this;c=f.ctx;n=h(this.w);k=h(this.h);c.fillStyle="#e0e4e8";c.fillRect(0,0,n,k);c.strokeStyle="#7a8a99";
c.fillStyle="#ccdcec";f.down&&c.fillRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1);c.strokeRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1);f.up&&c.fillRect(f.upX+.5,f.upY-.5,f.upWidth,f.upHeight+1);c.strokeRect(f.upX+.5,f.upY-.5,f.upWidth,f.upHeight+1);b=4;c.fillStyle="black";c.beginPath();"h"===f.orientation?(c.moveTo(f.downX+b,f.downH/2),c.lineTo(f.downX+f.downW-b,b),c.lineTo(f.downX+f.downW-b,f.downH-b),c.moveTo(f.upX+f.upWidth-b,f.downH/2),c.lineTo(f.upX+b,b),c.lineTo(f.upX+b,f.downH-b),c.fill(),
f.activeIfValue&&(g=h(f.pos),c.fillStyle="#ccdcec",c.fillRect(g+.5,0,h(f.scrollHandlerW),k),c.strokeStyle="#6382bf",c.strokeRect(g+.5,0,h(f.scrollHandlerW),k),d=h(f.scrollHandlerW/2),c.beginPath(),c.moveTo(g+d+.5-2,3),c.lineTo(g+d+.5-2,k-3),c.moveTo(g+d+.5,3),c.lineTo(g+d+.5,k-3),c.moveTo(g+d+.5+2,3),c.lineTo(g+d+.5+2,k-3),c.stroke())):(c.moveTo(f.downX+f.downW/2,f.downY+f.downH-b),c.lineTo(f.downX+b,f.downY+b),c.lineTo(f.downX+f.downW-b,f.downY+b),c.moveTo(f.upX+f.upWidth/2,f.upY+b),c.lineTo(f.upX+
b,f.upY+f.upHeight-b),c.lineTo(f.upX+f.upWidth-b,f.upY+f.upHeight-b),c.fill(),f.activeIfValue&&(g=h(f.pos),c.fillStyle="#ccdcec",c.fillRect(0,g+.5,n,h(f.scrollHandlerH)),c.strokeStyle="#6382bf",c.strokeRect(0,g+.5,n,h(f.scrollHandlerH)),d=h(f.scrollHandlerH/2),c.beginPath(),c.moveTo(3,g+d+.5-2),c.lineTo(n-3,g+d+.5-2),c.moveTo(3,g+d+.5),c.lineTo(n-3,g+d+.5),c.moveTo(3,g+d+.5+2),c.lineTo(n-3,g+d+.5+2),c.stroke()));c.strokeRect(.5,.5,n-1,k-1);f.activeIfValue||(c.fillStyle="rgba(240,240,240,"+160/255+
")",c.fillRect(0,0,n,k.h))};z.prototype.validateValue=function(a){e=this.evaluator;v=a.toString();v=parseFloat(v.replace(this.parent.decimal_symbol,"."));isNaN(v)&&(v=0);this.minimo=e.eval(this.min);v<this.minimo&&(this.value=null,v=this.minimo);this.maximo=e.eval(this.max);v>this.maximo&&(this.value=null,v=this.maximo);r=this.incr;v=0!=r?v*r/r:0;this.fixed&&(v=parseFloat(parseFloat(v).toFixed(e.eval(this.decimals))));return v};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+
this.incr)};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};z.prototype.increase10=function(){b=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+b):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+b)};z.prototype.decrease10=function(){b=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<
this.prePos&&this.changeValue(parseFloat(this.value)-b):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-b)};z.prototype.changeValue=function(a){this.activeIfValue&&(u=this.validateValue(a),u!=this.value&&(this.value=u,this.field.value=this.formatOutputValue(u),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction()))};z.prototype.changeValueForScrollMovement=function(){e=this.evaluator;y=this.limInf;m=
this.limSup;l=e.eval(this.min);w=e.eval(this.max);r=this.incr;u=h((this.pos-y)*(w-l)/(m-y)/r)*r+l;u!=this.value&&(this.value=u,this.field.value=this.formatOutputValue(u),e.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};z.prototype.changeScrollPositionFromValue=function(){e=this.evaluator;y=this.limInf;m=this.limSup;l=e.eval(this.min);w=e.eval(this.max);r=this.incr;this.pos=(this.value-l)*(m-y)/(w-l)+y;this.scrollHandler.style["h"==this.orientation?
"left":"top"]=this.pos+"px"};z.prototype.addEvents=function(){function b(c,d,g,f){a.clearTimeout(u);(m.up||m.down||m.canvasClick)&&1E-7<Math.abs(m.value-f)&&(d.call(m),c=g?c:30,u=a.setTimeout(function(){b(c,d,!1,f)},c))}function c(c){c.preventDefault();m.whichBtn=a.whichBtn(c);"L"==m.whichBtn&&m.activeIfValue&&(m.clickPos=a.getCursorPosition(c,m.container),m.canvasClick=!0,"h"==m.orientation?m.clickPos.x<m.prePos?b(350,m.decrease10,!0,m.minimo):b(350,m.increase10,!0,m.maximo):m.clickPos.y<m.prePos?
b(350,m.increase10,!0,m.maximo):b(350,m.decrease10,!0,m.minimo))}function d(b){m.canvasClick=!1;a.clearTimeout(u)}function g(b){1==m.canvasClick&&(m.clickPos=a.getCursorPosition(b,m.container),b.preventDefault())}function f(a){m.scrollClick=!1;m.prePos=m.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",e,!1);a.preventDefault()}function l(a){m.scrollClick=!1;m.prePos=m.pos;window.removeEventListener("touchend",l,!1);window.removeEventListener("touchmove",e,!1);
a.preventDefault()}function e(b){var c=a.getCursorPosition(b,m.container);"h"==m.orientation?(m.pos=m.prePos-(m.initPos.x-c.x),m.pos<m.limInf&&(m.pos=m.limInf),m.pos>m.limSup&&(m.pos=m.limSup),m.scrollHandler.setAttribute("style","width:"+m.scrollHandlerW+"px;height:"+m.h+"px;left:"+m.pos+"px;top:0;")):(m.pos=m.prePos-(m.initPos.y-c.y),m.pos>m.limInf&&(m.pos=m.limInf),m.pos<m.limSup&&(m.pos=m.limSup),m.scrollHandler.setAttribute("style","width:"+m.w+"px;height:"+m.scrollHandlerH+"px;left:0;top:"+
m.pos+"px;"));m.changeValueForScrollMovement();b.preventDefault()}function h(c){c.preventDefault();m.whichBtn=a.whichBtn(c);"L"==m.whichBtn&&m.activeIfValue&&(m.up=!0,b(350,m.increase,!0,m.maximo))}function k(c){c.preventDefault();m.whichBtn=a.whichBtn(c);"L"==m.whichBtn&&m.activeIfValue&&(m.down=!0,b(350,m.decrease,!0,m.minimo))}function n(b){m.down=!1;a.clearTimeout(u);b.preventDefault()}function r(b){m.up=!1;a.clearTimeout(u);m.draw()}function p(b){m.down=!1;a.clearTimeout(u);m.draw()}var m=this,
u;m.canvas.oncontextmenu=m.divUp.oncontextmenu=m.divDown.oncontextmenu=m.label.oncontextmenu=m.field.oncontextmenu=m.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&m.changeValue(m.field.value)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",n);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);this.canvas.addEventListener("touchmove",
g);this.canvas.addEventListener("mousemove",g);this.scrollHandler.addEventListener("touchstart",function(b){m.activeIfValue&&(m.scrollClick=!0,m.initPos=a.getCursorPosition(b,m.container),window.addEventListener("touchend",l),window.addEventListener("touchmove",e),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){m.activeIfValue&&(m.scrollClick=!0,m.initPos=a.getCursorPosition(b,m.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",e),
b.preventDefault())});this.divUp.addEventListener("touchstart",h);this.divUp.addEventListener("mousedown",h);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(b){m.up=!1;a.clearTimeout(u);b.preventDefault()});this.divDown.addEventListener("mouseout",n);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);window.addEventListener("touchend",p);window.addEventListener("mouseup",p)};a.Scrollbar=
z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f=function(f,e){var c=a.Control.call(this,f,e)||this;c.controls=e.controls||!0;c.file=e.file||"";c.oldDrawIf=0;f=c.evaluator.eval(c.expresion);4==f[0].length?(c.w=f[0][2],c.h=f[0][3]):(c.w=200,c.h=28);c.audio=c.parent.getAudio(c.file);c.oldFile=c.file;"]"===c.file.charAt(c.file.length-1)&&(c.file=c.evaluator.parser.parse(c.file.substring(1,c.file.length-1)));c.autoplay&&(c.audio.setAttribute("autoplay","autoplay"),c.audio.play());c.loop&&c.audio.setAttribute("loop",
"loop");c.controls&&c.audio.setAttribute("controls","controls");c.audio.setAttribute("style","position:absolute;width:"+c.w+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.addControlContainer(c.audio);c.evaluator.setFunction(c.id+".play",function(){try{c.audio.play()}catch(k){}return 0});c.evaluator.setFunction(c.id+".pause",function(){try{c.audio.pause()}catch(k){}return 0});c.evaluator.setFunction(c.id+".stop",function(){try{c.audio.pause(),c.audio.currentTime=0}catch(k){}return 0});
c.evaluator.setFunction(c.id+".currentTime",function(a){try{c.audio.currentTime=parseFloat(a)}catch(n){}return 0});c.audio.addEventListener("timeupdate",function(a){c.evaluator.setVariable(c.id+".currentTime",c.audio.currentTime)});return c};$jscomp.inherits(f,a.Control);f.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};f.prototype.update=function(){h=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=h.eval(this.file),this.oldFile!==
this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(e=0<h.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",e!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=e;this.updatePositionAndSize()};a.Audio=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f=function(f,e){var c=a.Control.call(this,f,e)||this;c.controls=e.controls||!0;c.file=e.file||"";c.oldDrawIf=0;h=c.evaluator;f=h.eval(c.expresion);4==f[0].length?(c.w=f[0][2],c.h=f[0][3]):(c.w=null,c.h=null);f=c.file;e=f.lastIndexOf(".");-1!=e&&(f=c.file.substring(0,e));c.video=a.newHTML("video",{poster:f+".png",style:"position:absolute;overflow:hidden;left:"+c.x+"px;top:"+c.y+"px;outline:none;background:rgba(0,0,0,0);"});c.autoplay&&c.video.setAttribute("autoplay",
"autoplay");c.loop&&c.video.setAttribute("loop","loop");c.controls&&c.video.setAttribute("controls","controls");c.w&&(c.video.setAttribute("width",c.w),c.video.setAttribute("height",c.h));c.video.canPlayType("video/mp4")&&(e=a.newHTML("source",{src:f+".mp4",type:"video/mp4"}),c.video.appendChild(e));c.video.canPlayType("video/ogg")&&(e=a.newHTML("source",{src:f+".ogg",type:"video/ogg"}),c.video.appendChild(e),e=a.newHTML("source",{src:f+".ogv",type:"video/ogg"}),c.video.appendChild(e));c.video.canPlayType("video/webm")&&
(e=a.newHTML("source",{src:f+".webm",type:"video/webm"}),c.video.appendChild(e));c.addControlContainer(c.video);h.setFunction(c.id+".play",function(){try{c.video.play()}catch(k){}return 0});h.setFunction(c.id+".pause",function(){try{c.video.pause()}catch(k){}return 0});h.setFunction(c.id+".stop",function(){try{c.video.pause(),c.video.currentTime=0}catch(k){}return 0});h.setFunction(c.id+".currentTime",function(a){try{c.video.currentTime=parseFloat(a)}catch(n){}return 0});c.video.addEventListener("timeupdate",
function(a){h.setVariable(c.id+".currentTime",c.video.currentTime)});return c};$jscomp.inherits(f,a.Control);f.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};f.prototype.update=function(){h=this.evaluator;(e=0<h.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",e!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=e;this.updatePositionAndSize()};a.Video=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q=function(f,c){var e=a.Control.call(this,f,c)||this;e.font_family=c.font_family||"Monospaced";e.style=c.style||",PLAIN,";e.font_size=c.font_size||12;typeof("number"!==e.font_size)&&(e.font_size=e.evaluator.eval(e.font_size));e.font=e.font_family+e.style+e.font_size;e.region="interior";e.tabindex=++e.parent.tabindex;if(e.answer){e.answer.match("krypto_")&&(e.answer=(new a.Krypto).decode(e.answer.substring(7)));var h=e.parent.lessonParser.parseText(e.answer)}e.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:e.id,spellcheck:"false"});e.textArea=a.newHTML("div",{class:"DescartesTextAreaContainer",contenteditable:"true"});e.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});e.showButton=a.newHTML("div",{class:"DJS_Gradient"});e.activeCover=a.newHTML("div");e.containerControl.appendChild(e.textArea);e.containerControl.appendChild(e.textAreaAnswer);e.containerControl.appendChild(e.showButton);e.containerControl.appendChild(e.activeCover);
e.addControlContainer(e.containerControl);e.showAnswer=!1;e.text=void 0==e.text||"simpleText"==e.text.type?e.rawText||"":e.text.hasFormula?e.rawText:e.text.toHTML();h&&"simpleText"!==h.type&&(e.answer=e.text.hasFormula?"":h.toHTML());e.evaluator.setVariable(e.id,e.text);var b,g,d;e.evaluator.setFunction(e.id+".insertAtCursor",function(a){(b=window.getSelection())&&b.getRangeAt&&b.rangeCount&&(d=document.createTextNode(a),g=b.getRangeAt(0),g.deleteContents(),g.insertNode(d),g.setStart(d,d.length),
g.setEnd(d,d.length),b.removeAllRanges(),b.addRange(g),e.textArea.focus());return 0});e.evaluator.setFunction(e.id+".update",function(){e.update()});e.addEvents();e.init();return e};$jscomp.inherits(q,a.Control);q.prototype.init=function(){e=this.answer?28:4;h=this.evaluator;var f=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var c=
"padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-e)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",c);this.textArea.innerHTML=f;this.textAreaAnswer.setAttribute("style",c+"display:"+(this.showAnswer?"block":"none")+";");this.textAreaAnswer.innerHTML="<span>"+this.answer+"</span>";this.showButton.setAttribute("style","width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:"+
(this.answer?"block":"none")+";");this.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+a.sansserif_font+';">S</span>';this.activeCover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;");this.update()};q.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);h.getVariable(this.id)!==this.oldValue&&(this.textArea.innerText=
(h.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," ");h.setVariable(this.id,f);this.oldFieldValue=f;this.oldValue=h.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};q.prototype.addEvents=function(){function a(a){a.preventDefault()}var c=
this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();c.showAnswer=!c.showAnswer;c.textAreaAnswer.style.display=c.showAnswer?"block":"none";c.showButton.childNodes[0].childNodes[0].textContent=c.showAnswer?"T":"S"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();c.cursorInd=a.focusOffset});this.textArea.addEventListener("paste",function(a){a.preventDefault();
document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});this.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()})};a.TextArea=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,e,f,q,p,c,k,n,b,g,d,v,r,u=function(b,c){var g=a.Control.call(this,b,c)||this;f=b.evaluator.parser;g.spaceID=c.spaceID||"";g.text=c.text||"";g.size=c.size||f.parse("4");g.font=c.font||"Monospaced,PLAIN,12";g.image=new Image;g.image.onload=function(){this.ready=1};g.imageSrc=c.imageSrc||"";g.font=a.convertFont(g.font);if(g.constraintExpr){g.constraint=f.parse(g.constraintExpr);"(expr)"==g.constraint.type&&(g.constraint=f.parse(g.constraintExpr.substring(1,
g.constraintExpr.length-1)));if("compOperator"==g.constraint.type){c=g.constraint.childs[0];var e=g.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||e.contains("y")?"identifier"!=c.type||"x"!=c.value||e.contains("x")?g.newt=new a.R2Newton(g.evaluator,g.constraint):(g.constVar="y",g.noConstVar="x",g.evalConst=g.evalConstXoY,g.constraint=e):(g.constVar="x",g.noConstVar="y",g.evalConst=g.evalConstXoY,g.constraint=e)}else g.constraint=null;d=new a.R2(0,0)}g.container=g.getContainer();g.mouseCatcher=
a.newHTML("div",{class:"DescartesGraphicControl",id:g.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:rgba(0,0,0,0);z-index:"+g.zIndex+";"});g.ctx=g.space.ctx;g.container.appendChild(g.mouseCatcher);g.addEvents();g.xStr=g.id+".x";g.yStr=g.id+".y";g.activoStr=g.id+".activo";g.activeStr=g.id+".active";""!==g.space.id&&2!==b.version?(g.mxStr=g.space.id+".mouse_x",g.myStr=g.space.id+".mouse_y",g.mclickedStr=g.space.id+".mouse_clicked",g.mclicizquierdoStr=g.space.id+".clic_izquierdo"):
(g.mxStr="mouse_x",g.myStr="mouse_y",g.mclickedStr="mouse_clicked",g.mclicizquierdoStr="clic_izquierdo");g.init();return g};$jscomp.inherits(u,a.Control);u.prototype.init=function(){e=this.evaluator;v=a.hasTouchSupport;var b=e.eval(this.expresion);this.x=b[0][0];this.y=b[0][1];e.setVariable(this.xStr,this.x);e.setVariable(this.yStr,this.y);""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*e.eval(this.size),this.height=2*e.eval(this.size),this._w=v&&48>this.width?48:
this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.imageSrc),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=
parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";e.setVariable(this.activoStr,0);e.setVariable(this.activeStr,0);this.setImage=!1;this.update()};u.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.x=e.getVariable(this.xStr);this.y=e.getVariable(this.yStr);q=this.space.getAbsoluteX(this.x);p=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=
parseInt(q-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(p-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){e=this.evaluator;this.drawIfValue&&(b=this.ctx,g=this.space.backgroundCtx,q=parseInt(this.space.getAbsoluteX(this.x))+.5,p=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(q,p),this.image.ready?(c=this.image.width/2,k=this.image.height/2,this.image.complete&&!this.setImage&&b.drawImage(this.image,parseInt(q-c),parseInt(p-
k)),this.trace&&(g.save(),g.translate(q,p),g.scale(parseInt(c),parseInt(k)),g.beginPath(),g.arc(0,0,1,0,h),g.restore(),g.lineWidth=1,g.strokeStyle=this.trace.getColor(),g.stroke())):(c=parseInt(this.width/2),b.beginPath(),b.arc(q,p,c,0,h),b.fillStyle=this.colorInt.getColor(),b.fill(),b.lineWidth=1,b.strokeStyle=this.color.getColor(),b.stroke(),this.active&&(b.strokeStyle=this.colorInt.borderColor(),b.beginPath(),b.arc(q,p,c-2,0,h),b.stroke()),this.trace&&(g.strokeStyle=this.trace.getColor(),g.beginPath(),
g.arc(q,p,c,0,h),g.stroke())))};u.prototype.evalConst=function(){d.set(this.x,this.y);n=this.newt.findZero(d,1/this.space.scale,!0);this.x=n.x;this.y=n.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};u.prototype.evalConstXoY=function(){e=this.evaluator;r=e.getVariable(this.constVar);e.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=e.eval(this.constraint);e.setVariable(this.xStr,this.x);e.setVariable(this.yStr,this.y);e.setVariable(this.constVar,
r)};u.prototype.drawText=function(a,c){b=this.ctx;e=this.evaluator;"simpleText"==this.text.type?(b.fillStyle=this.color.getColor(),b.font=this.font,b.textBaseline="alphabetic",b.fillText(this.text.toString(e.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(c-1-this.height/2))):(b.fillStyle=this.color.getColor(),b.strokeStyle=this.color.getColor(),b.textBaseline="alphabetic",this.text.draw(b,parseInt(a+1+this.width/2),parseInt(c-1-this.height/2),this.decimals,this.fixed,"start",
!0,this.color.getColor()))};u.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,d=a.length;c<d;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,
0)};u.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();e.whichBtn=a.whichBtn(b);"L"==e.whichBtn&&e.activeIfValue&&(e.parent.deactivateGraphicControls(),e.click=e.active=!0,e.evaluator.setVariable(e.activoStr,1),e.evaluator.setVariable(e.activeStr,1),e.evaluator.setVariable(e.mclickedStr,0),e.evaluator.setVariable(e.mclicizquierdoStr,0),e.posAnte=a.getCursorPosition(b,e.container),e.prePos={x:e.space.getAbsoluteX(e.x),y:e.space.getAbsoluteY(e.y)},e.evaluator.setVariable(e.mxStr,
e.space.getRelativeX(e.posAnte.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(e.posAnte.y)),e.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",d),window.addEventListener("mouseup",c),window.addEventListener("mousemove",d))}function c(b){document.body.focus();b.preventDefault();b.stopPropagation();e.evaluator.setVariable(e.mclickedStr,1);e.evaluator.setVariable(e.mclicizquierdoStr,1);if(e.activeIfValue||e.active)e.click=!1,window.removeEventListener("mouseup",
c),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),f=a.getCursorPosition(b,e.container)||f,e.posX=e.prePos.x-(e.posAnte.x-f.x),e.posY=e.prePos.y-(e.posAnte.y-f.y),e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX)),e.evaluator.setVariable(e.yStr,e.space.getRelativeY(e.posY)),e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(f.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(f.y)),e.parent.updateControls(),
e.parent.update(),e.mouseCatcher.style.left=e.space.getAbsoluteX(e.x)-e._w/2+"px",e.mouseCatcher.style.top=e.space.getAbsoluteY(e.y)-e._h/2+"px";e.parent.deactivateGraphicControls();e.parent.updateControls()}function d(b){b.preventDefault();e.evaluator.setVariable(e.mclickedStr,0);e.evaluator.setVariable(e.mclicizquierdoStr,0);f=a.getCursorPosition(b,e.container);e.posX=e.prePos.x-(e.posAnte.x-f.x);e.posY=e.prePos.y-(e.posAnte.y-f.y);e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX));e.evaluator.setVariable(e.yStr,
e.space.getRelativeY(e.posY));e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(f.x));e.evaluator.setVariable(e.myStr,e.space.getRelativeY(f.y));80<Date.now()-g&&(e.parent.updateControls(),e.parent.update(),g=Date.now())}var g=0,f,e=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",b);this.mouseCatcher.addEventListener("mousedown",b);this.mouseCatcher.addEventListener("mouseover",function(a){e.over=!0});
this.mouseCatcher.addEventListener("mouseout",function(a){e.over=!1;e.click=!1})};a.GraphicControl=u;return a}(descartesJS||{});
descartesJS=function(a,h){var e,f,q,p,c,k,n,b,g,d;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var r=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,u,y,m,l,w,x,z,A,F,J,C,G,E,B,L,I,M,O,H,P,D,N,K,R,Q,W,V,U,T,S=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};S.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,d=a.length;c<d;c++)switch(m=
a[c][0],l=a[c][1],y=h[m],y){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[y]=parseInt(l);break;case "about":case "config":case "init":case "clear":b[y]="true"===h[l];break;default:console.warn("Propiedad de botones no identificada: <"+m+"> valor: <"+l+">")}return b};S.prototype.parseSpace=function(b){w={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(m=b[c][0],l=b[c][1],y=h[m],a.DEBUG.paramName=m,a.DEBUG.objectName="Space",y){case "type":if("R2"===l||
"R3"===l)l=h[l];w[y]=l;break;case "id":a.DEBUG.idName=l;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":w[y]=l;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":w[y]="true"===h[l];break;case "bg_display":case "render":w[y]=h[l];break;case "border_color":case "net":case "net10":case "axes":case "text":w[y]=""!=l?"false"===h[l]?"":new a.Color(l,this.parent.evaluator):"";break;case "O.x":w.OxExpr=
l;break;case "O.y":w.OyExpr=l;break;case "image":w.imageSrc=l;break;case "x":u=l;"%"===u[u.length-1]?(w.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=l;w.xExpr=this.parser.parse(u);break;case "y":u=l;"%"===u[u.length-1]?(w.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=l;w.yExpr=this.parser.parse(u);break;case "width":u=l.trim();w.wModExpr=u;"%"===u[u.length-1]?(w.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(l),u!=l&&(u=this.parent.container.width,w._w_=l.trim()));w.w=u;break;case "height":u=l.trim();w.hModExpr=u;"%"===u[u.length-1]?(w.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(l),u!=l&&(u=this.parent.container.height,w._h_=l.trim()));w.h=u;break;case "drawif":""!=l&&(w.drawif=this.parser.parse(l));break;case "scale":u=parseFloat(l);isNaN(u)&&(u=48);w.scale=u;break;case "background":w.background=new a.Color(l,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
m+"> valor: <"+l+">")}return new a["Space"+w.type](this.parent,w)};S.prototype.parseControl=function(b){x={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(m=b[c][0],l=b[c][1],y=h[m],a.DEBUG.paramName=m,a.DEBUG.objectName="Control",y){case "type":u=h[l.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");x.type=v(u);break;case "gui":u=h[l];"textfield"===u&&(u="TextField");x[y]=v(u);break;case "id":a.DEBUG.idName=l;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "info":x[y]=
l;break;case "region":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":x[y]=h[l];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":x[y]="true"===h[l];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":x[y]=new a.Color(l,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
l&&(x[y]=this.parser.parse(l));break;case "constraint":x.constraintExpr=l;break;case "image":x.imageSrc=l;break;case "image_dec":x.image_dec_src=l;break;case "image_inc":x.image_inc_src=l;break;case "space":x.spaceID=l;break;case "expresion":x.expresion=this.parser.parse(l.replace(")(",","));break;case "borderColor":x[y]="false"===h[l]?"":l;break;case "bold":"false"!=h[l]&&(x.bold="bold");break;case "italics":"false"!=h[l]&&(x.italics="italic");break;case "underlined":"false"!=h[l]&&(x.underlined=
!0);break;case "value":var g=l.replace(/&squot;/g,"'");g.match(/^\|/)&&(g="'"+g.substring(1),g.match(/\|$/)&&(g=g.substring(0,g.length-1)+"'"));x.valueExpr=this.parser.parse(g);x.valueExprString=g;break;case "incr":0!=l&&(x.incr=this.parser.parse(l));break;case "exponentialif":x.exponentialif=parseFloat(l);break;case "text":x.rawText=l;g=this.parseText(l);for(var e=0,f=g.length;e<f;e++)g[e]=this.parser.parse(g[e],!1);x.text=g;break;default:e=m.indexOf("."),g=h[m.substring(0,e)],e=h[m.substring(e+
1)],"parameter"===g&&"font"===e?x.parameterFont=l:"Explanation"===g&&"font"===e?x.ExplanationFont=l:"tooltip"===g&&"font"===e?x.tooltipFont=l:console.warn("Propiedad de control no identificada: <"+m+"> valor: <"+l+">")}return new a["Numeric"===x.type?x.gui:x.type](this.parent,x)};S.prototype.parseGraphic=function(b,c,d,g){z={rotateExp:g,parameter:"t"};b=this.split(b);g=0;for(var e=b.length;g<e;g++)if(m=b[g][0],l=b[g][1],y=h[m],a.DEBUG.paramName=m,a.DEBUG.objectName="Graphic",""!=l)switch(y){case "type":a.DEBUG.idName=
l;z[y]=v(h[l]);break;case "align":case "anchor":case "lineDash":z[y]=h[l];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":z[y]="true"===h[l];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":z[y]="false"===h[l]?"":new a.Color(l,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":z[y]=
l;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":""!==l&&(z[y]=this.parser.parse(l));break;case "font_size":l=l.trim();l.match(/^\[.*\]?/)&&(l=l.substring(1,l.length-1));""!==l&&(z[y]=this.parser.parse(l));break;case "space":z.spaceID=l;break;case "expresion":""!==l&&("Macro"!==z.type?(z.expresion=this.parser.parse(l),z.expresionString=l):z.expresion=l);break;case "text":z.text=
l;break;case "file":var f=l.replace(/&squot;/g,"'");"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));f.match(r)&&(f="'"+f+"'");z.file=this.parser.parse(f);break;case "border":""!=l&&"false"!=h[l]&&(z.border=new a.Color(l,this.parent.evaluator));break;default:if(void 0!=z.family&&m.substring(0,z.family.length+1)===z.family+".")switch(h[m.substring(z.family.length+1)]){case "interval":""!=l&&(z.family_interval=this.parser.parse(l));break;case "steps":""!=l&&(z.family_steps=
this.parser.parse(l))}else if(void 0!=z.parameter&&m.match(z.parameter+"."))switch(z.parameter!==m.substring(0,m.indexOf(z.parameter)+z.parameter.length)&&(z.parameter=m.substring(0,m.indexOf(z.parameter)+z.parameter.length)),h[m.substring(z.parameter.length+1)]){case "interval":""!=l&&(z.parameter_interval=this.parser.parse(l));break;case "steps":""!=l&&(z.parameter_steps=this.parser.parse(l))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+m+"> valor: <"+l+">")}c&&(z.abs_coord=
c);d&&(z.background=d);return new a[z.type](this.parent,z)};S.prototype.parse3DGraphic=function(b,c,d,g){z={rotateExp:g,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(m=b[c][0],l=b[c][1],y=h[m],a.DEBUG.paramName=m,a.DEBUG.objectName="Graphic3D",y){case "type":a.DEBUG.idName=l;u=h[l];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":z.subType=
u,u="OtherGeometry"}z[y]=v(u);break;case "model":case "align":case "anchor":case "lineDash":z[y]=h[l];break;case "shadowColor":case "fill":z[y]="false"===h[l]?"":new a.Color(l,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":z[y]="true"===h[l];break;case "edges":"false"===h[l]?z[y]="":("true"===h[l]&&(l="808080"),z[y]=new a.Color(l,this.parent.evaluator));break;case "border":""!=l&&"false"!=h[l]&&(z.border=new a.Color(l,this.parent.evaluator));
break;case "color":case "backcolor":z[y]=new a.Color(l,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":""!=l&&(z[y]=this.parser.parse(l));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":z[y]=
l;break;case "space":z.spaceID=l;break;case "expresion":"Macro"!=z.type&&"Curve"!=z.type&&"Surface"!=z.type?(z.expresion=this.parser.parse(l),z.expresionString=l):z.expresion=l.replace(/\\n/g,";");break;case "text":z.text=l;break;case "file":g=l.replace(/&squot;/g,"'");"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=g.substring(1,g.length-1));g.match(/./)&&(g="'"+g+"'");z.file=this.parser.parse(g);break;default:void 0!==z.family&&m.substring(0,z.family.length+1)===z.family+"."?"interval"===h[m.substring(z.family.length+
1)]?""!=l&&(z.family_interval=this.parser.parse(l)):""!=l&&(z.family_steps=this.parser.parse(l)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+m+"> valor: <"+l+">")}return new a[z.type+"3D"](this.parent,z)};S.prototype.parseAuxiliar=function(b){A={};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(m=b[c][0],l=b[c][1],y=h[m],a.DEBUG.paramName=m,a.DEBUG.objectName="Auxiliar",y){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=l;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[y]=l.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[y]="true"===h[l];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[y]=this.parser.parse(l);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[y]=
h[l];break;default:var g=m.indexOf("."),e=h[m.substring(0,g)];g=h[m.substring(g+1)];"parameter"===e&&"font"===g?A.parameterFont=l:console.warn("Propiedad del auxiliar no identificada: <"+m+"> valor: <"+l+">")}A.sequence?A.type="sequence":A.constant?A.type="constant":A.algorithm&&A.evaluate?A.type="algorithm":A.array&&!A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="vector":A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="matrix":A.event&&")"!=A.id.charAt(A.id.length-1)?A.type="event":"library"===
A.type?A.type="library":")"===A.id.charAt(A.id.length-1)?A.type="function":A.type="variable";a.DEBUG.typeName=A.type;switch(A.type){case "sequence":new a.Function(this.parent,A);break;case "constant":b=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":b=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,A));break;case "library":new a.Library(this.parent,A);break;case "variable":new a.Variable(this.parent,A);break;default:new a.Function(this.parent,A)}};S.prototype.parseAction=function(b){F=b.action;J=b.parent;C=b.parameter;return F?new (a[v(F)])(J,C):{execute:function(){}}};S.prototype.parseAnimation=function(b){var c={};
b=this.split(b);for(var d=0,g=b.length;d<g;d++)switch(m=b[d][0],l=b[d][1],y=h[m],y){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[y]=l.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[y]="true"===h[l];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+m+">  <"+l+">")}return new a.Animation(this.parent,c)};S.prototype.parsePleca=function(h,r){h=this.split(h);f=e="";q=0;p="#536891";c="white";k=
"left";n="";b="SansSerif,BOLD,20";g="SansSerif,PLAIN,18";d=void 0;for(var u=0,v=h.length;u<v;u++)switch(m=h[u][0],l=h[u][1],m){case "title":e=l;break;case "subtitle":f=l;break;case "subtitlines":q=l;break;case "bgcolor":""!=l&&(p=(new a.Color(l,this.parent.evaluator)).getColor());break;case "fgcolor":""!=l&&(c=(new a.Color(l,this.parent.evaluator)).getColor());break;case "align":""!=l&&(k=l);break;case "titleimage":n=l;break;case "titlefont":b=""!=l?a.convertFont(l):a.convertFont(b);break;case "subtitlefont":g=
""!=l?a.convertFont(l):a.convertFont(g);break;default:console.warn("Propiedad de la pleca no identificada: <"+m+">  <"+l+">")}if(""===e&&""===f)return a.newHTML("div");O=g.substring(0,g.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=n&&(H=this.parent.getImage(n),P=H.height);d=a.newHTML("div",{id:"descartesPleca"});P?(d.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+r+"px;height:"+P+"px;background-color:"+p+";color:"+c+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
H.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),d.appendChild(H)):d.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+r+"px;background:"+p+";color:"+c+";padding:12px 15px 12px 15px;margin:0;z-index:100;");D=a.newHTML("div",{style:"padding:0;margin:0;font:"+b+";overflow:hidden;white-space:nowrap;"});D.innerHTML=e;N=a.newHTML("div");if(1===parseInt(q)){V=0;K=a.newHTML("div");K.innerHTML=f;document.body.appendChild(K);Q=O;do Q-=
V,K.setAttribute("style","padding:0;margin:0;font:"+g+";font-size:"+Q+"px;width:"+(r-30)+"px;line-height:"+Q+"px;"),R=K.offsetHeight,W=R/Q,V=1;while(1<W&&8<Q);document.body.removeChild(K);N.setAttribute("style","padding:0;margin:0;font:"+g+";font-size:"+Q+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else N.setAttribute("style","padding:0;margin:0;font:"+g+";line-height:1em;");N.innerHTML=f;d.appendChild(D);d.appendChild(N);d.imageHeight=P;return d};S.prototype.split=function(a){if("string"!==
typeof a)return[];G=[];a=(a||"").replace(/\\'/g,"\u2019");E=B=I=0;for(L=M=!1;E<a.length;)" "!==a.charAt(E)||L||E++," "===a.charAt(E)||L||(L=!0,I=E),"="!==a.charAt(E)||"'"!==a.charAt(E+1)||M||(M=!0,G[B]=[a.substring(I,E)],I=E+2,E+=2),M&&"'"===a.charAt(E)&&(L=M=!1,G[B].push(a.substring(I,E)),B++),"="!==a.charAt(E)||"'"===a.charAt(E+1)||M||(G[B]=[a.substring(I,E)],I=E+1,E++,U=a.substring(E).indexOf("="),-1===U?T=U=a.length:(U+=E,T=a.substring(E,U).lastIndexOf(" "),T=-1===T?a.length:T+E),G[B].push(a.substring(I,
T)),B++,L=!1,E=T),E++;return G};S.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=S;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||k(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=k(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function e(a,b){y=[];y.type="matrix";y.rows=a;y.cols=b;l=0;for(w=b;l<w;l++)y[l]=Array(a).fill(0);return y}function f(a,b){r=a.rows;u=a.cols;y=e(r,u);var c;for(l=0;l<r;l++)for(m=0;m<u;m++){for(w=c=0;w<u;w++)c+=a[w][l]*b[m][w];y[m][l]=c}return y}function q(a,b,c){for(var d=e(c.length-1,c.length-1),g=0,f=d.length;g<
f;g++)for(var l=0;l<f;l++)d[g][l]=g<a?l<b?c[g][l]:c[g][l+1]:g<b?c[g+1][l]:c[g+1][l+1];return d}function p(a){if(1<a.cols){for(var b=0,c=1,d=0,g=a.cols;d<g;d++)b+=c*a[0][d]*p(q(0,d,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var c={},k=Math.floor,n,b,g,d,v,r,u,y,m,l,w,x=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};x.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};x.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
x.prototype.replaceLastChild=function(a){g=this.childs.length-1;b=this.childs[g];b.parent=null;this.childs[g]=a;a.parent=this;return a};x.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,c=this.childs.length;b<c;b++)if(this.childs[b].contains(a))return!0;return!1};x.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new x("compOperator","=="),v.addChild(this),v.addChild(new x("number","0")),d=this.getRoot(),d.setAllEvalFun(),
d):this};x.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};x.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var b;this.evaluate=function(a,
c){b=a.variables[this.value];if("object"===typeof b&&void 0==b.length)return b.evaluate(a);void 0==b&&(c||a.matrices[this.value]?b=a.matrices[this.value]:a.vectors[this.value]&&(b=a.vectors[this.value]));return void 0!==b?b:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var d;this.evaluate=function(a){try{return d=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==d?d:0}catch(M){return 0}}}else if("identifier"===this.type&&
"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return d=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),this.childs[0].childs[1].evaluate(a)),void 0!==d?d:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var g,v,w;this.evaluate=function(a){g=[];for(var b=0,d=this.childs[0].childs.length;b<d;b++)g[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){n=0<g.length?g[0]:0;if("number"==
typeof n)return"NaN";n.match(",")&&parseFloat(n.replace(",","."))==n.replace(",",".")&&(n=n.replace(",","."));if(void 0==c[n]){v=n.match(/:=/g)?!0:!1;if(n.match(";")){var e=!1,f=[],l=0;b=0;for(d=n.length;b<d;b++){var h=n.charAt(b);"'"===h&&(e=!e);e||";"!==h||(f.push(n.substring(l,b)),l=b+1)}f.push(n.substring(l));n="("+f.join(")(")+")"}c[n]=a.parser.parse(n,v)}w=a.eval(c[n]);return void 0!=w?w:NaN}return a.functions[this.value].apply(a,g)}}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;r=c.rows;u=c.cols;y=e(r,u);for(l=0;l<r;l++)for(m=0;m<u;m++)y[m][l]=c[m][l]+b[m][l];return y}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==
b.type||"matrix"!==a.type)return b-a;r=b.rows;u=b.cols;y=e(r,u);for(l=0;l<r;l++)for(m=0;m<u;m++)y[m][l]=b[m][l]-a[m][l];return y}:"*"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a: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=e(a.length,a.length),d=p(a);if(0===d)a=
0;else{d=1/d;if(1<a.length)for(var g=0,l=a.length;g<l;g++){var h=d;for(var k=0;k<l;k++)c[k][g]=h*p(q(g,k,a)),h=-h;d=-d}else c[0][0]=d;a=c}b=0===a?e(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-k(b/a)*a}:"^"===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?h(b,a):1/h(b,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)===this.childs[1].evaluate(a))}:
"!="===this.value&&(this.evaluate=function(a){return+(this.childs[0].evaluate(a)!==this.childs[1].evaluate(a))});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<
this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&
"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);else for(var d=0;d<b;d++){var g=[];for(var e=0,f=this.childs[d].childs.length;e<f;e++)g.push(this.childs[d].childs[e].evaluate(a));c[d]=g}return c};else if("assign"===this.type){var x,E=this.childs[0],B=this.childs[1],L=E.childs[0]?E.childs[0].childs:null;this.evaluate=1===E.childs.length&&"square_bracket"===E.childs[0].type&&1===L.length?function(a){x=B.evaluate(a);a.setVector(E.value,L[0].evaluate(a),x);return x}:1===E.childs.length&&"square_bracket"===
E.childs[0].type&&2===L.length?function(a){x=B.evaluate(a);a.setMatrix(E.value,L[0].evaluate(a),L[1].evaluate(a),x);return x}:function(a){x=B.evaluate(a);return x.type?a.matrices[E.value]=x:"object"!==typeof a.variables[E.value]?a.variables[E.value]=x:0}}};a.Node=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b=/^\s+/,g=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,d=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,r=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,y=/^[\?:]/,m=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,l=/^\[|^\]/,w=/^\(|^\)/,x=/^,/,z=/^;/,A=/\|/g,F=/\|\*/g,J=/\*\|/g,C,G=/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/,
E=function(){};E.prototype.tokenize=function(C){function B(a,b,d){e.push({type:a,value:b});c=c.slice(d);q+=d;n=a}if(h=C){var G=C.indexOf("//");0<=G&&":"!==C[G-1]&&(C=C.substring(0,G));C=C.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});C=C.replace(/&sup(.+);/g,"^ $1 ");C=C.replace(/&squot;/g,"'");C.match(/=\|\*/g)&&(C=C.replace(F,"'").replace(J,"'"));C.match(/=\|/g)&&(C=C.replace(A,"'"));G=C.trim();"|"==G.charAt(0)&&"|"==G.charAt(G.length-1)&&
(C=G.replace(A,"'"))}e=[];f=!1;q=0;c=C;for(n="";C&&q<C.length;)if(f=q,"'"==c[0]){for(k=1;"'"!=c[k];)if(k<c.length)k++;else{console.info(">Error, unknown symbol: ["+c+"], in the string \u300a"+h+"\u300b");return}p=c.substring(1,k);B("string",p,p.length+2)}else if(p=c.match(b))c=c.slice(p[0].length),q+=p[0].length;else if(p=c.match(m))p[0]=p[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),B("operator",p[0],p[0].length);else if(p=c.match(g))"number"===n&&
e.push({type:"operator",value:"*"}),B("identifier",p[0],p[0].length);else if(p=c.match(d))B("number",p[0],p[0].length);else if(p=c.match(v))G=p[0],"#"==G&&(G="!="),B("compOperator",G,p[0].length);else if(p=c.match(r))G=p[0],"||"==G?G="|":"&&"==G?G="&":"~"==G&&(G="!"),B("boolOperator",G,p[0].length);else if((p=c.match(u))&&!c.match(/^==/))B("assign",p[0],p[0].length);else if(p=c.match(y))B("conditional",p[0],p[0].length);else if(p=c.match(l))B("square_bracket",p[0],p[0].length);else if(p=c.match(w))"("==
p&&"number"===n&&e.push({type:"operator",value:"*"}),B("parentheses",p[0],p[0].length);else if(p=c.match(x))B("separator",p[0],p[0].length);else if(178===c.charCodeAt(0))e.push({type:"operator",value:"^"}),B("number",2,1);else if(179===c.charCodeAt(0))e.push({type:"operator",value:"^"}),B("number",3,1);else if(p=c.match(z))B("final_of_expression",p[0],p[0].length);else if(f==q){a.DEBUG.setError(a.DEBUG.EXPRESSION,h);return}return e};E.prototype.flatTokens=function(a,b){a=a||[];b=b||"";C="";for(var c=
0,d=a.length;c<d;c++)C="string"==a[c].type?C+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(G)?C+a[c].value:C+b+a[c].value;return C};a.Tokenizer=E;return a}(descartesJS||{});
descartesJS=function(a){function h(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 e(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-ceil-round-min-max-_Trace_-_Print_-_Num_-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var f=Date.now(),q,p,c,k,n,b,g,d,v,r,u,y,m=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()};m.prototype.setDefinition=function(a,b){this.definitions[a]=b};m.prototype.getDefinition=function(a){return this.definitions[a]};m.prototype.setVariable=function(a,b){this.variables[a]=b};m.prototype.getVariable=function(a,
b){b&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};m.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};m.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};m.prototype.setMatrix=function(a,b,c,d){this.matrices[a][b][c]=d};m.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};m.prototype.setFunction=
function(a,b){this.functions[a]=b};m.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};m.prototype.parse=function(e,f){(c=this.tokenizer.tokenize(e))||(c=[]);k=null;f=!f||!1;q=d=g=b=0;for(p=c.length;q<p;q++){v=c[q];r=v.value;u=v.type;if("identifier"===u)if(q+1<p&&"parentheses"===c[q+1].type&&"("===c[q+1].value)this.getFunction(r);else if(q+1<p&&"square_bracket"===c[q+1].type&&"["===c[q+1].value)c[q+3]&&"square_bracket"===
c[q+3].type&&"]"===c[q+3].value?this.getVector(r):this.getMatrix(r);else{var l=r.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);l&&(this.variables[(l[1]||l[2]||l[3]||l[4]||l[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(r,!0)}"assign"===u&&f&&":="!=r&&(u="compOperator",r="==");if("assign"===u)if(n=new a.Node(u,r),null!=k)if("identifier"===k.type)k.parent&&k.parent.replaceLastChild(n),n.addChild(k),k=n,f=!0;else if("square_bracket"===k.type)n.addChild(k.parent),
k=n,f=!0;else{n.type="compOperator";n.value="==";for(f=!0;k.parent&&h(k.parent.value)>=h(n.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(n);n.addChild(k);k=n}else{console.info("Error1: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===r||"square_bracket"===u&&"["===r)if(n=new a.Node(u,r),"("===r&&b++,"["===r&&g++,null===k)"("===r&&(new a.Node("(expr)","(expr)")).addChild(n),"["===r&&(new a.Node("[expr]","[expr]")).addChild(n),
k=n;else if("operator"===k.type||"boolOperator"===k.type||"compOperator"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(n),k=n;else if("sign"===k.type)k.addChild(n),k=n;else if("parentheses"===k.type&&"("===k.value)k.addChild(n),k=n;else if("square_bracket"===k.type&&"["===k.value)k.addChild(n),k=n;else if("parentheses"===k.type&&"()"===k.value)k.parent.addChild(n),k=n;else if("square_bracket"===k.type&&"[]"===k.value)k.parent.addChild(n),k=n;else if("identifier"===k.type)k.addChild(n),
k=n;else{console.info("Error2: en la expresi\u00f3n \u300a "+e+" \u300b, en el token ["+q+"] {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&")"===r)if(b--,null===k)console.info("Error3: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;k&&k.parent&&("("!=k.value||"("==k.value&&"parentheses"!=k.type);)k=k.parent;if(k&&"("===k.value)k.value="()";else break}else if("square_bracket"===u&&"]"===r)if(g--,null===k)console.info("Error5: en la expresi\u00f3n \u300a "+
e+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;k&&k.parent&&("["!=k.value||"["==k.value&&"square_bracket"!=k.type);)k=k.parent;if(k&&"["===k.value)k.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(n=new a.Node(u,r),null===k)k=n;else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"parentheses"===k.type&&"("===k.value||"square_bracket"===
k.type&&"["===k.value||"sign"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(n),k=n;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,e);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(n=new a.Node(u,r),null===k)if("-"===r||"+"===r)n.type="sign",n.value="sign"+r,k=n;else if("!"===r)k=n;else{console.info("Error8: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===
k.type||"assign"===k.type||"conditional"===k.type||"square_bracket"===k.type&&"["===k.value&&("-"===r||"+"===r||"!"===r)||"parentheses"===k.type&&"("===k.value&&("-"===r||"+"===r||"!"===r)){if("-"===r||"+"===r)n.type="sign",n.value="sign"+r;k.addChild(n);k=n}else if("number"===k.type||"parentheses"===k.type&&"()"===k.value||"square_bracket"===k.type&&"[]"===k.value||"string"===k.type||"identifier"===k.type||"conditional"===k.type||"assign"===k.type){for(;k.parent&&h(k.parent.value)>=h(n.value);)k=
k.parent;k.parent&&k.parent.replaceLastChild(n);n.addChild(k);k=n}else{console.info("Error9: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("conditional"===u)if(n=new a.Node(u,r),null!=k)if("?"===n.value){for(d++;k.parent&&h(k.parent.value)>h(n.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(n);n.addChild(k);k=n}else{for(d--;k&&k.parent&&("?"!=k.value||"?"==k.value&&"conditional"!=k.type);)k=k.parent;if(k&&"?"===k.value)k.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+
e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("separator"===u)if(null!=k)for(;k.parent&&"("!=k.value&&"["!=k.value;)k=k.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}0<
b&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,e);0>b&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,e);0<g&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,e);0>g&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,e);0!=d&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,e);(y=k?k.getRoot():null)&&y.setAllEvalFun();return y};m.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,g){return a.esCorrecto(c,d,b.evaluator,
g)};b.functions.escorrecto=function(c,d,g){return a.escorrecto(c,d,b.evaluator,g)};window.parent!==window&&(b.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},b.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},"*");return 0},b.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});b.functions.toFixed=b.functions._NumToStr_=b.functions._NumACadena_=function(a,
b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0))};b.functions.charAt=b.functions._charAt_=b.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};b.functions.substring=b.functions._substring_=b.functions._subcadena_=function(a,b,c){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);c=isNaN(parseInt(c))?0:parseInt(c);return 0<=b&&0<=c?a.substring(b,c):0>b&&0<=c?a.substring(c):0>c&&0<=b?a.substring(b):""};b.functions.strLength=
b.functions._length_=b.functions._longitud_=function(a){return(a||"").toString().length};b.functions.indexOf=b.functions._indexOf_=b.functions["_\u00edndiceDe_"]=function(a,b){return(a||"").toString().indexOf((b||"").toString())};b.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};b.functions.replace=b.functions._replace_=b.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var d=a.indexOf(b);0<=d;)a=
a.substring(0,d)+c+a.substring(d+b.length),d=a.indexOf(b,d+c.length);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};b.functions.trim=function(a){return(a||"").toString().trim()};b.functions._Load_=function(b){var c="";b&&(c=(c=document.getElementById(b))&&"descartes/archivo"==c.type?c.text:a.openExternalFile(b));return c||""};b.functions._GetValues_=function(a,c){return b.functions._ExecBlock_(b.functions._Load_(a).replace(/&brvbar;/g,
String.fromCharCode("166")),c)};b.functions._GetMatrix_=function(a,c){return b.functions._StrToMatrix_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._MatrixToStr_=function(c){var d=b.matrices[c];if(d){for(var g="<"+c+">\\n",e=b.getVariable(c+".columnas_usadas")||d.cols||0,f=b.getVariable(c+".filas_usadas")||d.rows||0,h,k=0;k<e;k++){for(var l=0;l<f;l++)h=d[k][l],void 0!==h&&("string"==typeof h?h="'"+h+"'":"number"==typeof h&&(h=a.removeNeedlessDecimals(h.toFixed(6))),
g+=h+(l<f-1?" \u00a6 ":""));g=g.replace(/(\u00A6 )$/g,"")+"\\n"}return g+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var d=[],g=!1,f=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,k=a.length;h<k;h++)a[h].match("<"+c+">")?(f=!0,g=a[h].trim().split("<"+c+">"),2==g.length&&""!=g[1]&&d.push(g[1].split(String.fromCharCode("166")).map(e)),g=!0):(a[h].match("</"+c+">")&&(g=a[h].trim().split("</"+c+">"),2==g.length&&""!=g[0]&&d.push(g[0].split(String.fromCharCode("166")).map(e)),
g=!1,h=a.length),g&&d.push(a[h].split(String.fromCharCode("166")).map(e)));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",g=b.getVariable(a+
".long_usada")||c._size_||0,e,f=0;f<g;f++)e=c[f],void 0!==e?("number"==typeof e&&(e=parseFloat(e)),d+=e+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var d=[],g=!1,f=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,k=a.length;h<k;h++)a[h].match("<"+c+">")?g=f=!0:(a[h].match("</"+c+">")&&(g=!1,h=a.length),g&&d.push(e(a[h])));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=[],g=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var e=0,f=a.length;e<f;e++)a[e].match("<"+c+">")?(g=a[e].trim().split("<"+c+">"),2==g.length&&""!=g[1]&&(d=d.concat(g[1].split(String.fromCharCode("166")))),g=!0):a[e].match("</"+c+">")?(g=a[e].trim().split("</"+c+">"),2==g.length&&""!=g[0]&&(d=d.concat(g[0].split(String.fromCharCode("166")))),g=!1):g&&(d=d.concat(a[e].split(String.fromCharCode("166"))));
e=0;for(f=d.length;e<f;e++)g=d[e].split("="),g[0]=g[0].trim(),2==g.length&&""!=g[0]&&(isNaN(parseFloat(g[1]))?b.setVariable(g[0],g[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(g[0],parseFloat(g[1])))}return 0};var c=a.newHTML("a",{target:"_blank"}),d,g=null;a.newBlobContent=null;b.functions._Save_=function(e,h){b.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(f=Date.now(),document.body.appendChild(c),g=h.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,
"\\"),d=new Blob(["\ufeff",g],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(d)),c.setAttribute("download",e),g!=a.newBlobContent&&(c.click(),a.newBlobContent=g),document.body.removeChild(c));return 0};var h,k,n=a.newHTML("input",{type:"file"});n.addEventListener("change",function(c){h=c.target.files;k=new FileReader;k.onload=function(c){a.addExternalFileContent(h[0].name,c.target.result);b.setVariable("DJS.fileName",h[0].name);b.setVariable("DJS.fileContent",
c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());n.value=""};0<h.length&&k.readAsText(h[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,g){return a.getTextWidth(b,a.convertFont(c+","+d+","+g))};b.functions.R=b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/
255};b.functions.G=b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};b.functions.B=b.functions._Azul_=b.functions._Blue_=function(b){return(new a.Color(b)).b/255};b.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=function(e){this.parent=e;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};e.prototype.setDefinition=function(a,e){this.definitions[a]=e};e.prototype.getDefinition=function(a){return this.definitions[a]};e.prototype.setVariable=function(a,e){this.variables[a]=e};e.prototype.getVariable=
function(a){return this.variables[a]};e.prototype.setVector=function(a,e,p){e=0>e?0:h(e);this.vectors[a][e]=p};e.prototype.getVector=function(a,e){e=0>e?0:h(e);return this.vectors[a][e]};e.prototype.setMatrix=function(a,e,p,c){e=0>e?0:h(e);p=0>p?0:h(p);void 0==this.matrices[a][e]&&(this.matrices[a][e]=[]);this.matrices[a][e][p]=c};e.prototype.getMatrix=function(a,e,p){e=0>e?0:h(e);p=0>p?0:h(p);return this.matrices[a][e][p]};e.prototype.setFunction=function(a,e){this.functions[a]=e};e.prototype.getFunction=
function(a){return this.functions[a]};e.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new e;a.Evaluator=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g,d,v,r,u,y,m=function(b,c){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==c;this.textStr=(c||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;c.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=c,this.textNodes=(new a.RTFParser(b.evaluator)).parse(c.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};m.prototype.drawText=function(b,d,g,k,n){h=this.evaluator.eval(this.decimals);e=this.evaluator.eval(this.parent.width);
f=this.evaluator.eval(this.parent.font_size);q=d.getColor?d.getColor():d;p=this.textToString(this.text,h,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=p.indexOf("[")&&(p=this.textToString(this.parseSimpleText(p),h,this.fixed));if(this.oldTextStr!==p||this.oldWidth!==e||this.oldSize!==f||this.oldColor!==q||this.oldPosX!==g||this.oldPoxY!==k)c=new a.TextStyle({size:f,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:q,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(p,this.evaluator,c),this.textNodes.update(g,k,h,this.fixed,this.align,this.anchor,q,e);n||this.textNodes.draw(b);this.oldTextStr=p;this.oldWidth=
e;this.oldSize=f;this.oldColor=q;this.oldPosX=g;this.oldPoxY=k};m.prototype.drawRTF=function(a,b,c,d,g){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));g||this.textNodes.draw(a)};m.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");k=[];n="'";g=b=0;d=-1;for(u=a.length;b<u;)v=a.charAt(b),r=a.charAt(b-1),"["===v&&"\\"===r?(k.push(a.substring(g,b-1)+"["),g=b+1):"]"===v&&"\\"===r?(k.push(a.substring(g,b-1)+"]"),g=b+1):"["===v&&-1===d?(k.push(a.substring(g,b)),g=b,d++):"["===v?d++:"]"===v&&0===d?(k.push(this.evaluator.parser.parse(a.substring(g,b+1))),g=b+1,d--):("]"==a.charAt(b)&&(d=0>d?d:d-1),n+=a.charAt(b)),b++;k.push(a.substring(g,b));return k};m.prototype.textToString=function(b,c,d){n="";if("rtfNode"!==
b.type)for(var g=0,e=b.length;g<e;g++)"string"===typeof b[g]?n+=b[g]:(y=this.evaluator.eval(b[g])[0][0],""!==y&&("string"===typeof y?n+=y:Infinity===y?n+="Infinity":-Infinity===y?n+="-Infinity":isNaN(y)||"NaN"===y?n+="NaN":(y=parseFloat(y),y=d?y.toFixed(c):a.removeNeedlessDecimals(y.toFixed(c)),n+=y.toString().replace(".",this.decimal_symbol))));return n};a.TextObject=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(){};e.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var e=[],f=null,c=0,k=a.length;a.charAt(0);var n=!1,b=!1,g=0;h="";for(var d=0;d<k;d++){var v=a.charAt(d);var r=a.charAt(d+1);"\\"===v&&"$"===r&&(b=!0);"{"===v?g++:"}"===v&&(g--,b&&0===g&&(b=!1));b?"_"===v?"{"===r?h+="\\subindex":(h+="\\subindex{"+r+"}",d++):"^"===v?"{"===r?h+="\\superindex":(h+="\\superindex{"+r+"}",d++):h+=v:h+=v}a=h;r=a.charAt(0);for(k=a.length;c<
k;)v=r,r=a.charAt(c+1),n&&("{"===v||"["===v||"\\"===v||" "===v?(n=!1," "===v&&(f={type:"ignore"},e.push(f))):f.value+=v),n||"\\"!==v?n||"{"!==v&&"["!==v?n||"}"!==v&&"]"!==v?n||(f&&"text"===f.type?f.value+=v:f&&"ignore"===f.type?(e.pop(),f=e[e.length-1]):(f={type:"text",value:v},e.push(f))):(f={type:"close",value:v},e.push(f)):(f={type:"open",value:v},e.push(f)):(n=!0,f={type:"command",value:""},e.push(f)),c++;return e};a.DescarTeXTokenizer=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(){this.tokenizer=new a.DescarTeXTokenizer};h.prototype.parse=function(e,f,h){e=this.tokenizer.tokenize(e);var p=new a.TextNode("","textBlock",h,null),c=new a.TextNode("","textLineBlock",h.clone(),null);p.addChild(c);for(var k=[],n=void 0,b=h,g=[h],d,v,r,u,q=!1,m=0,l=e.length;m<l;m++)if("text"===e[m].type)if("color_parameter"===n)v=new a.Color(e[m].value,f);else if("text_size_parameter"===n)r=parseFloat(e[m].value);else if("textLineBlock"===
c.nodeType){d=e[m].value.split(" ");for(var w=0,x=d.length;w<x;w++)""!==d[w]&&c.addChild(new a.TextNode(d[w],"text",b.clone(),null)),w+1<x&&c.addChild(new a.TextNode(" ","space",b.clone(),null))}else c.addChild(new a.TextNode(e[m].value,"text",b.clone(),null));else"command"===e[m].type&&"curlyBracketOpen"===e[m].value?c.addChild(new a.TextNode("{","text",b.clone(),null)):"command"===e[m].type&&"curlyBracketClose"===e[m].value?c.addChild(new a.TextNode("}","text",b.clone(),null)):"command"===e[m].type&&
"squareBracketOpen"===e[m].value?c.addChild(new a.TextNode("[","text",b.clone(),null)):"command"===e[m].type&&"squareBracketClose"===e[m].value?c.addChild(new a.TextNode("]","text",b.clone(),null)):"command"===e[m].type&&"newline"===e[m].value?(0===c.children.length&&c.addChild(new a.TextNode("","text",b.clone(),null)),c=new a.TextNode("","textLineBlock",h.clone(),null),p.addChild(c)):"command"===e[m].type&&"b"===e[m].value?(n="bold",k.push(n)):"command"===e[m].type&&"i"===e[m].value?(n="italic",
k.push(n)):"command"===e[m].type&&"o"===e[m].value?(n="overline",k.push(n)):"command"===e[m].type&&"u"===e[m].value?(n="underline",k.push(n)):"command"===e[m].type&&"color"===e[m].value?(n="color",k.push(n)):"command"===e[m].type&&"ts"===e[m].value?(n="text_size",k.push(n)):"command"===e[m].type&&"sansserif"===e[m].value.toLowerCase()?(n="sansserif",k.push(n)):"command"===e[m].type&&"serif"===e[m].value.toLowerCase()?(n="serif",k.push(n)):"command"===e[m].type&&"monospace"===e[m].value.toLowerCase()?
(n="monospace",k.push(n)):"command"===e[m].type&&"c"===e[m].value?(n="center",k.push(n)):"command"===e[m].type&&"l"===e[m].value?(n="left",k.push(n)):"command"===e[m].type&&"r"===e[m].value?(n="right",k.push(n)):"command"===e[m].type&&"j"===e[m].value?(n="justify",k.push(n)):"command"===e[m].type&&"$"===e[m].value?(n="formula",k.push(n),q=!0):"command"===e[m].type&&"sum"===e[m].value?(n="sum",k.push(n)):"command"===e[m].type&&"prod"===e[m].value?(n="prod",k.push(n)):"command"===e[m].type&&"int"===
e[m].value?(n="integral",k.push(n)):"command"===e[m].type&&"lim"===e[m].value?(n="limit",k.push(n)):"command"===e[m].type&&"sqrt"===e[m].value?(n="radical",k.push(n)):"command"===e[m].type&&"subindex"===e[m].value?(n="subIndex",k.push(n)):"command"===e[m].type&&"superindex"===e[m].value?(n="superIndex",k.push(n)):"command"===e[m].type&&"frac"===e[m].value?(n="numerator",k.push(n)):"open"===e[m].type&&"{"===e[m].value&&void 0!==n?"bold"===n||"italic"===n||"overline"===n||"underline"===n?(b=b.clone(),
b[n]=!0,g.push(b)):"sansserif"===n?(b=b.clone(),b.family="sansserif",g.push(b)):"serif"===n?(b=b.clone(),b.family="serif",g.push(b)):"monospace"===n?(b=b.clone(),b.family="monospaced",g.push(b)):"text_size"===n?n="text_size_parameter":"text_size_text"===n?(b=b.clone(),b.size=r,g.push(b)):"color"===n?n="color_parameter":"color_text"===n?(b=b.clone(),b.color=v,g.push(b)):"center"===n||"left"===n||"right"===n||"justify"===n?(b=b.clone(),b.align=n,g.push(b),c=new a.TextNode("","textLineBlock",b.clone(),
null),p.addChild(c)):"formula"===n?(b=b.clone(),b.italic=!0,g.push(b),u=new a.TextNode("","formula",b.clone(),null),c.addChild(u),c=u):"subIndex"===n||"superIndex"===n?q?(b=b.clone(),g.push(b),u=new a.TextNode("",n,b.clone(),null),c.addChild(u),c=u):c.addChild(new a.TextNode("subIndex"===n?"_":"^","text",b.clone(),null)):"radical"===n?q&&(u=new a.TextNode("","radical",b.clone(),null),c.addChild(u),c=u,b=b.clone(),g.push(b),u=new a.TextNode("","index",b.clone(),null),c.addChild(u),c=u,n="index"):"index"===
n?q&&(g.pop(),b=g[g.length-1],u=new a.TextNode("","radicand",b.clone(),null),c.addChild(u),c=u,n="radicand"):"sum"===n||"integral"===n||"limit"===n||"prod"===n?q&&(u=new a.TextNode("",n,b.clone(),null),c.addChild(u),c=u,b=b.clone(),g.push(b),u=new a.TextNode("","from",b.clone(),null),c.addChild(u),c=u,n="from",k[k.length-1]=n):"from"===n?q&&(u=new a.TextNode("","to",b.clone(),null),c.addChild(u),c=u,n="to",k[k.length-1]=n):"to"===n?q&&(g.pop(),b=g[g.length-1],u=new a.TextNode("","what",b.clone(),
null),c.addChild(u),c=u,n="what",k[k.length-1]=n):"numerator"===n?q&&(u=new a.TextNode("","fraction",b.clone(),null),c.addChild(u),c=u,b=b.clone(),g.push(b),u=new a.TextNode("","numerator",b.clone(),null),c.addChild(u),c=u,n="numerator"):"denominator"===n&&(u=new a.TextNode("",n,b.clone(),null),c.addChild(u),c=u):"close"===e[m].type&&"}"===e[m].value&&void 0!==n&&("bold"===n||"italic"===n||"overline"===n||"underline"===n||"color_text"===n||"color"===n||"text_size_text"===n||"text_size"===n||"sansserif"===
n||"serif"===n||"monospace"===n?(g.pop(),b=g[g.length-1],k.pop(),n=k[k.length-1]):"color_parameter"===n?n="color_text":"text_size_parameter"===n?n="text_size_text":"center"===n||"left"===n||"right"===n||"justify"===n?(g.pop(),b=g[g.length-1],k.pop(),n=k[k.length-1],e[m+1]&&"command"===e[m+1].type&&"newline"===e[m+1].value?c=p:(c=new a.TextNode("","textLineBlock",b.clone(),null),p.addChild(c))):"formula"===c.nodeType?(q=!1,g.pop(),b=g[g.length-1],k.pop(),n=k[k.length-1],c=c.parent):"subIndex"===c.nodeType||
"superIndex"===c.nodeType?q&&(g.pop(),b=g[g.length-1],k.pop(),n=k[k.length-1],c=c.parent):"index"===c.nodeType?c=c.parent:"radicand"===c.nodeType?(k.pop(),n=k[k.length-1],c=c.parent.parent):"from"===c.nodeType?c=c.parent:"to"===c.nodeType?c=c.parent:"what"===c.nodeType?(k.pop(),n=k[k.length-1],c=c.parent.parent):"numerator"===c.nodeType?(n="denominator",c=c.parent):"denominator"===c.nodeType&&(g.pop(),b=g[g.length-1],k.pop(),n=k[k.length-1],c=c.parent.parent));var z,A,F=null,J=[];p.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)z=a.children[b],A=a.children[b+1],"text"===z.nodeType&&"text"===A.nodeType&&z.style.equals(A.style)?(null===F&&(F=z,u=z.clone(),F.changeNodeType("word"),F.value="___"+u.value,F.addChild(u)),u=A.clone(),F.addChild(u),J.push(A),F.value+=u.value):F=null});J.forEach(function(a){a.parent.removeChild(a)});p.normalize();p.adjustFontSize();return p};a.DescarTeXParser=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};e.prototype.clone=function(){return new e(Object.assign({},this))};e.prototype.set=function(a){Object.assign(this,a)};e.prototype.equals=function(a){var e=!0,f;for(f in this)this.hasOwnProperty(f)&&(e=e&&this[f]===a[f]);return e};e.prototype.toString=function(e){/arial|sansserif/i.test(this.family)?
h=a.sansserif_font:/times|serif/i.test(this.family)?h=e?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(h=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+h).trim()};a.TextStyle=e;return a}(descartesJS||{});
descartesJS=function(a){function h(a,c){for(var b=0,g=0;g<c;g++)b+=a[g];return b}function e(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((n[a].ascent+25)*c/n[a].unitsPerEm);b.descent=Math.ceil(Math.abs((n[a].descent-25)*c/n[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var f=!1,q="#000000",p=2,c=!1;(new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z")).svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";(new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z")).svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";(new Path2D("m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z")).svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
(new Path2D("m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z")).svgData=
"m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z";
var k=function(b,c,d,e){this.type="rtfNode";this.evaluator=e;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=b;this.style=d;this.changeNodeType(c);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};k.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;
break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=
this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};k.prototype.clone=function(){for(var a=new k(this.value,this.nodeType,this.style.clone()),c=0,d=this.children.length;c<d;c++)a.addChild(this.children[c].clone());return a};k.prototype.toStr=function(){for(var a=this.value,c=0,d=this.children.length;c<d;c++)a+=" "+this.children[c].toStr();return a};k.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var c=0,d=this.children.length;c<d;c++)a+=this.children[c].stringify()+(c==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};k.prototype.addChild=function(a,c){c&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};k.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};k.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};k.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};k.prototype.nextSibling=function(){if(this.parent)for(var a=null,c=0,d=this.parent.children.length;c<d;c++){if(a)return this.parent.children[c];this.parent.children[c]===this&&(a=!0)}return null};k.prototype.prevSibling=function(){if(this.parent)for(var a=0,c=this.parent.children.length-1;a<c;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};k.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,e=this.children.length;c<e;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};k.prototype.insertBefore=function(a,c){a=this.children.indexOf(a);-1!==a&&(c.parent=this,this.children.splice(a,0,c))};k.prototype.insertAfter=function(a,c){a=this.children.indexOf(a);-1!==a&&(c.parent=this,this.children.splice(a+1,0,c))};k.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),c=0,d=a.length;c<d;c++)0===a[c].children.length&&a[c].addChild(new k("","text",a[c].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);c=0;for(d=a.length;c<d;c++){var e=a[c];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,
new k("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&e.parent.insertAfter(e,new k("","text",e.parent.style))}return this};k.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),c=0,d=a.length;c<d;c++)""===a[c].value&&a[c].parent&&a[c].parent.removeChild(a[c])};k.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,e=this.children.length;c<e;c++)"text"===this.children[c].nodeType&&
a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=
b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};k.prototype.propagateStyle=function(a,c){this.style[a]=c;this.styleString=this.style.toString();for(var b=0,g=this.children.length;b<g;b++)this.children[b].propagateStyle(a,c)};k.prototype.update=function(a,g,d,e,f,h,k,n){p=d;c=e;q=k;this.metrics.w=this.metrics.h=0;k=g;if(20<=n)for(d=0;d<this.children.length;d++)this.children[d].breakLines(n);d=0;for(e=this.children.length;d<e;d++){var b=this.children[d];
b.updateLine();b.metrics.offsetX=a;b.metrics.y=g;g+=parseInt(b.metrics.ascent+.5);b.metrics.offsetY=g;f=parseInt(b.metrics.descent+.5)+parseInt(1.5+.05*b.style.size);g+=f;this.metrics.h+=b.metrics.h;this.metrics.w=Math.max(this.metrics.w,b.metrics.w)}g=k;h=h||"";h.match("right")?a-=this.metrics.w:h.match("_center")&&(a-=this.metrics.w/2);h.match("bottom")?g-=this.metrics.h:h.match("center_")&&(g-=this.metrics.h/2);h=this.children;d=0;for(e=h.length;d<e;d++)"left"===h[d].style.align?h[d].metrics.offsetX=
a:"right"===h[d].style.align?h[d].metrics.offsetX=a+this.metrics.w-h[d].metrics.w:"center"===h[d].style.align?h[d].metrics.offsetX=a+(this.metrics.w-h[d].metrics.w)/2:"justify"===h[d].style.align&&20<=n&&(f=d<e-1?h[d+1].value:null,h[d].metrics.offsetX=a,"wrap"===f&&h[d].justifyAux(n)),h[d].metrics.y=g,g+=parseInt(h[d].metrics.ascent+.5),h[d].metrics.offsetY=g,f=parseInt(h[d].metrics.descent+.5)+parseInt(1.5+.05*h[d].style.size),g+=f};k.prototype.breakLines=function(b){for(var c,d=0,e=!1,f=[],h=0,
n=this.children.length;h<n;h++)c=this.children[h],e?f.push(c):("text"===c.nodeType||"space"===c.nodeType?(a.ctx.font=c.style.toString(),c.metrics.w=a.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),d+=c.metrics.w,d>b&&"space"!==c.nodeType&&0<h&&(e=!0,f.push(c)));if(0<f.length)for(b=new k("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),h=0,n=f.length;h<n;h++)f[h].parent&&f[h].parent.removeChild(f[h]),b.addChild(f[h])};
k.prototype.updateLine=function(b){var c=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var d=this.metrics.descent=0,f=this.children,h,k=0,n=f.length;k<n;k++){h=f[k];if("text"===h.nodeType){a.ctx.font=h.style.toString();var m=""!==h.value?h.value:a.in_editor?"\u200a":"";h.metrics=e(a.ctx.font);h.metrics.w=a.ctx.measureText(m).width;h.metrics.offsetX=d;Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===h.nodeType?(a.ctx.font=h.style.toString(),h.metrics=e(a.ctx.font),h.metrics.w=k===n-1?0:b?b:a.ctx.measureText(" ").width,h.metrics.offsetX=d,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===h.nodeType&&(h.updateLine(),h.metrics.offsetX_aux=d,Object.defineProperties(h.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===h.nodeType&&(a.ctx.font=h.styleString,m=""!==h.value?h.value:a.in_editor?"\u200a":"",h.metrics=e(a.ctx.font),h.metrics.w=a.ctx.measureText(m).width,h.metrics.offsetX=d,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),h.clickCatcher||(h.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+h.metrics.w+"px;height:"+
h.metrics.h+"px;cursor:pointer;"}),h.clickCatcher.rtfNode=h,h.clickCatcher.action=new a.OpenURL(this.evaluator.parent,h.URL),h.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===h.nodeType&&(h.componentNumCtrl=this.evaluator.parent.getControlByCId(h.value),a.ctx.font=h.styleString,h.metrics=e(a.ctx.font),h.metrics.w=h.componentNumCtrl.w,h.metrics.h=h.componentNumCtrl.h,h.metrics.offsetX=d,Object.defineProperties(h.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===h.nodeType?(h.componentSpace=this.evaluator.parent.getSpaceByCId(h.value),a.ctx.font=h.styleString,h.metrics=e(a.ctx.font),h.metrics.w=h.componentSpace.w,h.metrics.h=h.componentSpace.h,h.metrics.offsetX=d,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===h.nodeType&&(h.updateFormula(),
h.metrics.marginX=h.metrics.marginY=h.metrics.paddingX=h.metrics.paddingY=0,h.metrics.offsetX_aux=d,Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),h.metrics.w+=2*h.metrics.paddingX,h.metrics.ascent+=h.metrics.paddingY,h.metrics.descent+=h.metrics.paddingY,h.metrics.h+=2*h.metrics.paddingY,d+=2*h.metrics.marginX);
this.metrics.w+=h.metrics.w+2*h.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,h.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,h.metrics.descent);d+=h.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};k.prototype.updateFormula=function(){var b=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var g=this.children,d,f=0,k={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}},n=0,q=g.length;n<q;n++){d=g[n];if("text"===d.nodeType){a.ctx.font=d.style.toString(!0);var m=""!==d.value?d.value:a.in_editor?"\u200a":"";d.metrics=e(a.ctx.font);d.metrics.w=a.ctx.measureText(m).width;d.metrics.offsetX=f;Object.defineProperties(d.metrics,{x:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}});f+=b.metrics.marginX}else if("dynamicText"===d.nodeType){m=void 0===
d.decimals?p:d.evaluator.eval(d.decimals);var l=void 0===d.fixed?c:d.fixed,w=d.evaluator.eval(d.value);parseFloat(w).toString()===w.toString()&&(w=l?parseFloat(w).toFixed(m):a.removeNeedlessDecimals(parseFloat(w).toFixed(m)),w=(""+w).replace(".",d.decimal_symbol));d.evalValue=w;a.ctx.font=d.style.toString(!0);d.metrics=e(a.ctx.font);d.metrics.marginX=0;d.metrics.paddingX=0;d.metrics.w=a.ctx.measureText(w).width+2*d.metrics.paddingX;d.metrics.offsetX_aux=f;Object.defineProperties(d.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return b.metrics.offsetY}}});f+=2*d.metrics.marginX}if("superIndex"===d.nodeType)m=d,m.updateFormula(),m.metrics.marginX=0,m.metrics.paddingX=0,m.metrics.paddingY=0,m.metrics.offsetX_aux=f,m.metrics.prevChild=k,Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+
b.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return b.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),m.metrics.w+=2*m.metrics.paddingX,m.metrics.ascent+=m.metrics.paddingY,m.metrics.descent+=m.metrics.paddingY,m.metrics.h+=2*m.metrics.paddingY,m.metrics.tmp_ascent=m.metrics.h+(m.metrics.prevChild.metrics.ascent-m.metrics.prevChild.metrics.descent)/2,f+=2*m.metrics.marginX;else if("subIndex"===d.nodeType)m=d,m.updateFormula(),
m.metrics.marginX=0,m.metrics.paddingX=0,m.metrics.paddingY=0,m.metrics.offsetX_aux=f,m.metrics.prevChild=k,Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),m.metrics.w+=m.metrics.paddingX,m.metrics.ascent+=m.metrics.paddingY,
m.metrics.descent+=m.metrics.paddingY,m.metrics.h+=2*m.metrics.paddingY,this.metrics.descent=m.metrics.ascent+(m.metrics.prevChild.metrics.descent-m.metrics.prevChild.metrics.ascent)/2+m.metrics.descent,f+=m.metrics.marginX;else if("fraction"===d.nodeType){l=d;l.updateFormula();m=l.children;w=m[0];m=m[1];l.metrics.marginX=parseInt(.5+.075*this.style.size);l.metrics.paddingX=0;l.metrics.paddingY=0;var x=Math.max(w.metrics.w,m.metrics.w)+2*l.metrics.paddingX;l.metrics.prevChild=k;l.metrics.offsetX_aux=
f;var z=parseInt(-k.metrics.descent+4*k.metrics.h/9);Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+z}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY-z}}});Object.defineProperties(w.metrics,{parent:{value:l},maxWidth:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(m.metrics,{parent:{value:l},maxWidth:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});l.metrics.w=
x;l.metrics.ascent=w.metrics.h+z+2*l.metrics.paddingY;l.metrics.descent=m.metrics.h-z+2*l.metrics.paddingY;l.metrics.h=w.metrics.h+m.metrics.h+4*l.metrics.paddingY;f+=2*l.metrics.marginX}else if("radical"===d.nodeType){k=d;k.updateFormula();m=k.children;l=m[0];var A=m[1];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=f;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});m=k.style.size;k.radicalSign={w:m,scaleX:m/722,scaleY:A.metrics.h/1E3};w=parseInt(l.metrics.w-2*k.radicalSign.w/3);Object.defineProperties(k.radicalSign,{parent:{value:k},displaceIndex:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return b.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(l.metrics,{parent:{value:k},displaceIndex:{value:w},fontSize:{value:m},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return b.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:k},
displaceIndex:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return b.metrics.offsetY}}});w=l.metrics.w<2*k.radicalSign.w/3?k.radicalSign.w:parseInt(l.metrics.w+k.radicalSign.w/3);k.metrics.w=w+2*k.metrics.paddingX+A.metrics.w;k.metrics.ascent=Math.max(A.metrics.ascent,l.metrics.h+2*m/5)+
k.metrics.paddingY;k.metrics.descent=A.metrics.descent+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;f+=2*k.metrics.marginX}else if("sum"===d.nodeType){l=d;l.updateFormula();m=l.children;w=m[0];x=m[1];var F=m[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=f;Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();var J=e(a.ctx.font);k=parseInt(1.2*J.h);m=parseInt(.5+780*k/1E3);l.sigmaSign={w:m,h:k,scale:k/1E3};var C=Math.max(x.metrics.w,w.metrics.w,l.sigmaSign.w);l.sigmaSign.parent=l;Object.defineProperties(l.sigmaSign,{sumWidth:{value:C},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}});m=J.descent-x.metrics.descent-(k+J.h)/2-l.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:l},sumWidth:{value:C},newBaselineTo:{value:m},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineTo}}});
k=w.metrics.ascent+J.descent+(k-J.h)/2+l.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:l},sumWidth:{value:C},newBaselineFrom:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(F.metrics,{parent:{value:l},sumWidth:{value:C},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return b.metrics.offsetY}}});l.metrics.w=C+F.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(F.metrics.ascent,-m+x.metrics.ascent)+l.metrics.paddingY;l.metrics.descent=Math.max(F.metrics.descent,k+w.metrics.descent)+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;
f+=2*l.metrics.marginX}else if("integral"===d.nodeType){l=d;l.updateFormula();m=l.children;w=m[0];x=m[1];F=m[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=f;Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();J=e(a.ctx.font);C=parseInt(1.2*J.h);var G=parseInt(10.5+529*C/1E3);l.sign={w:G,h:C,scale:C/1E3};l.sign.parent=l;Object.defineProperties(l.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}});m=J.descent-(C+J.h)/2-x.metrics.descent+C/3;Object.defineProperties(x.metrics,{parent:{value:l},integralWidth:{value:G},
newBaselineTo:{value:m},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineTo}}});k=J.descent+w.metrics.ascent/2;Object.defineProperties(w.metrics,{parent:{value:l},integralWidth:{value:G},newBaselineFrom:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineFrom}}});G=Math.max(parseInt(3*G/5)+x.metrics.w,parseInt(2*G/5+w.metrics.w))+l.metrics.paddingX;Object.defineProperties(F.metrics,{parent:{value:l},whatDisplace:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return b.metrics.offsetY}}});l.metrics.w=G+F.metrics.w+2*l.metrics.paddingX;l.metrics.ascent=Math.max(F.metrics.ascent,-m+x.metrics.ascent)+l.metrics.paddingY;l.metrics.descent=Math.max(F.metrics.descent,k+w.metrics.descent,C-l.metrics.ascent)+l.metrics.paddingY;l.metrics.h=Math.max(l.metrics.ascent+l.metrics.descent,C);f+=2*l.metrics.marginX}else if("prod"===d.nodeType)l=d,l.updateFormula(),m=l.children,w=m[0],x=m[1],F=m[2],l.metrics.marginX=parseInt(1.5+
.075*this.style.size),l.metrics.paddingX=parseInt(1.5+.075*this.style.size),l.metrics.paddingY=parseInt(1.5+.05*this.style.size),l.metrics.offsetX_aux=f,Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),a.ctx.font=d.style.toString(),J=e(a.ctx.font),k=parseInt(1.2*J.h),m=parseInt(.5+
876*k/1E3),l.piSign={w:m,h:k,scale:k/1E3},C=Math.max(x.metrics.w,w.metrics.w,l.piSign.w),l.piSign.parent=l,Object.defineProperties(l.piSign,{prodWidth:{value:C},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}}),m=J.descent-x.metrics.descent-(k+J.h)/2-l.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:l},prodWidth:{value:C},newBaselineTo:{value:m},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineTo}}}),k=w.metrics.ascent+J.descent+(k-J.h)/2+l.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:l},prodWidth:{value:C},newBaselineFrom:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(F.metrics,{parent:{value:l},prodWidth:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return b.metrics.offsetY}}}),
l.metrics.w=C+F.metrics.w+3*l.metrics.paddingX,l.metrics.ascent=Math.max(F.metrics.ascent,-m+x.metrics.ascent)+l.metrics.paddingY,l.metrics.descent=Math.max(F.metrics.descent,k+w.metrics.descent)+l.metrics.paddingY,l.metrics.h=l.metrics.ascent+l.metrics.descent,f+=2*l.metrics.marginX;else if("limit"===d.nodeType){k=d;k.updateFormula();m=k.children;var E=m[0];l=m[1];m=m[2];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=
parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=f;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();J=e(a.ctx.font);w=parseInt(.5+a.ctx.measureText("l\u00edm").width);x=parseInt(.5+a.ctx.measureText("\u2192").width);F=Math.max(w,E.metrics.w+x+l.metrics.w);
k.limitText={parent:k};Object.defineProperties(k.limitText,{limitWidth:{value:F},limitTextWidth:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});w=J.descent+Math.max(E.metrics.ascent,l.metrics.ascent,2*J.ascent/3)+k.metrics.paddingY;k.limitArrow={parent:k};Object.defineProperties(k.limitArrow,{newBaseline:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+E.metrics.w}},y:{get:function(){return b.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(E.metrics,{parent:{value:k},newBaseline:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(l.metrics,{parent:{value:k},arrowWidth:{value:x},newBaseline:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+E.metrics.w+this.arrowWidth}},offsetY:{get:function(){return b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(m.metrics,{parent:{value:k},limitWidth:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return b.metrics.offsetY}}});
k.metrics.w=F+m.metrics.w+3*k.metrics.paddingX;k.metrics.ascent=Math.max(m.metrics.ascent,J.ascent)+k.metrics.paddingY;x=0;m=Math.max(E.metrics.descent,l.metrics.descent,m.metrics.descent);if(0!=E.metrics.h||0!=l.metrics.h)x=w,m=Math.max(E.metrics.descent,l.metrics.descent,m-x);k.metrics.descent=x+m+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;f+=2*k.metrics.marginX}else if("matrix"===d.nodeType){w=d;w.updateFormula();m=w.children;x=w.rows;F=w.columns;w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=parseInt(5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=f;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();J=e(a.ctx.font);C=[];G=[];k=0;for(var B=x*F;k<B;k++){var L=
parseInt(k/F);var I=k%F;C[L]=Math.max(C[L]||0,m[k].metrics.h);G[I]=Math.max(G[I]||0,m[k].metrics.w)}var M=(1+F)*w.metrics.paddingX;for(k=0;k<F;k++)M+=G[k];var O=(1+x)*w.metrics.paddingY;for(k=0;k<x;k++)O+=C[k];l=J.descent-J.h/2;k=0;for(B=x*F;k<B;k++)L=parseInt(k/F),I=k%F,m[k].metrics.offsetX_aux=h(G,I)+(G[I]-m[k].metrics.w)/2+I*w.metrics.paddingX,m[k].metrics.offsetY_aux=h(C,L)+(C[L]-m[k].metrics.h)/2+(1+L)*w.metrics.paddingY,Object.defineProperties(m[k].metrics,{parent:{value:w},matrixH:{value:O},
dispY:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.w=M;w.metrics.ascent=O/2-l;w.metrics.descent=O/2+l;w.metrics.h=w.metrics.ascent+w.metrics.descent;f+=2*w.metrics.marginX}else if("defparts"===d.nodeType){w=d;w.updateFormula();m=d.children;
x=d.parts;w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=f;Object.defineProperties(w.metrics,{parent:{value:b},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=
d.style.toString();J=e(a.ctx.font);F=0;C=w.metrics.paddingY;l=J.descent-J.h/2;for(k=0;k<x;k++)m[k].metrics.offsetY_aux=C,F=Math.max(F,m[k].metrics.w),C+=m[k].metrics.h+w.metrics.paddingY,Object.defineProperties(m[k].metrics,{parent:{value:w},dispY:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return b.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.defpartsH=C;w.metrics.w=F+4*w.metrics.paddingX;w.metrics.ascent=C/2-l;w.metrics.descent=C/2+l;w.metrics.h=w.metrics.ascent+w.metrics.descent;f+=2*w.metrics.marginX}else if("numerator"===d.nodeType||"denominator"===d.nodeType||"index"===d.nodeType||"radicand"===d.nodeType||"from"===d.nodeType||"to"===d.nodeType||"what"===d.nodeType||"element"===d.nodeType)d.updateFormula(),d.metrics.paddingX=parseInt(1.5+.075*this.style.size),d.metrics.paddingY=
parseInt(1.5+.05*this.style.size),d.metrics.ascent+=d.metrics.paddingY,d.metrics.descent+=d.metrics.paddingY,d.metrics.h=d.metrics.ascent+d.metrics.descent,1==d.children.length&&"text"==d.children[0].nodeType&&""==d.children[0].value?(d.metrics.w=0,a.in_editor||(d.metrics.ascent=d.metrics.descent=d.metrics.h=0)):d.metrics.w+=2*d.metrics.paddingX;k=d;this.metrics.ascent=Math.max(this.metrics.ascent,d.metrics.tmp_ascent||d.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,d.metrics.descent);
this.metrics.w+=d.metrics.w+2*d.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;f+=d.metrics.w}};k.prototype.justifyAux=function(a){for(var b=0,c=0,e=0,f=this.children.length;e<f-1;e++)"space"===this.children[e].nodeType?b++:c+=this.children[e].metrics.w;this.updateLine((a-c)/b)};k.prototype.drawTextBlock=function(a){a.fillStyle=q;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.shadowColor="transparent"};k.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)f=!1,this.children[b].draw(a)};k.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString(f);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 e=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=
e}a.fillText(this.value,b,c)}};k.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};k.prototype.drawSpace=function(a){};k.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString(f);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+parseInt(1+this.style.size/
25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,c);this.drawBorder(a,"blue")};k.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,
a.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(f);a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};k.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)f=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};k.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};k.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.save();a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,
this.radicalSign.scaleY);this.drawRadicalSign(a);a.restore();a.beginPath();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.sigmaSign.x,this.sigmaSign.y);a.scale(this.sigmaSign.scale,
this.sigmaSign.scale);if(this.style.border){var b=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineWidth=parseInt(a.lineWidth/this.sigmaSign.scale);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeStyle=b}this.drawSigmaSign(a);a.restore();b=0;for(var c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.sign.x,this.sign.y);a.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.piSign.x,this.piSign.y);
a.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&a.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};k.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-
this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?
(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};k.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/
2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+
this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};k.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&
this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};k.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};k.prototype.drawRadicalSign=function(a){a.beginPath();
a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.stroke();a.fill()};k.prototype.drawSigmaSign=function(a){a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,
65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.stroke();a.fill()};k.prototype.drawIntegralSign=function(a){a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,
1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.stroke();a.fill()};k.prototype.drawProdSign=function(a){a.beginPath();a.moveTo(876.3561,999.59384);a.lineTo(876.3561,972.20771);a.lineTo(858.75073,972.20771);a.bezierCurveTo(794.19771,
972.20771,761.92121,931.12852,761.92121,847.99206);a.lineTo(761.92121,144.75542);a.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);a.lineTo(876.3561,1.7633057E-4);a.lineTo(1.184082E-5,1.7633057E-4);a.lineTo(1.184082E-5,27.386304);a.lineTo(16.627304,27.386304);a.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);a.lineTo(115.41298,865.59743);a.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);a.lineTo(1.184082E-5,972.20771);
a.lineTo(1.184082E-5,999.59384);a.lineTo(359.93198,999.59384);a.lineTo(359.93198,972.20771);a.lineTo(329.61162,972.20771);a.bezierCurveTo(265.0586,972.20771,243.54093,932.10659,243.54093,841.14553);a.lineTo(243.54093,64.553192);a.lineTo(633.79325,64.553192);a.lineTo(633.79325,841.14553);a.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);a.lineTo(516.42413,972.20771);a.lineTo(516.42413,999.59384);a.closePath();a.stroke();a.fill()};k.prototype.drawBorderSpecial=function(a,
c){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=c;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};k.prototype.toRTF=function(){var a=[],c=[],d="";this.mergeTextNodes();for(var e=0,f=this.children.length;e<f;e++){var h=this.children[e];"textLineBlock"===h.nodeType&&(d+=h.toRTFAux(a,c)+(1<f&&e<f-1?"\\par":""))}h="{\\fonttbl";e=0;for(f=a.length;e<f;e++)h+="\\f"+e+"\\fcharset0 "+a[e]+";";
a="";if(0<c.length){a="{\\colortbl";e=0;for(f=c.length;e<f;e++)a+=c[e];a+="}"}return"{\\rtf1\\uc0"+(h+"}")+a+d+"}"};k.prototype.toRTFAux=function(a,c){for(var b,e,g,f=null,h="",k,n,p,x,z,A=0,F=this.children.length;A<F;A++)k=n="",b=this.children[A],p=this.addToFontTable(b.style.family,a),x=b.style.size,z=this.addToColorTable(b.style.color,c),null===z&&0<c.length&&(z=this.addToColorTable(q,c)),z!==f&&(k+="\\cf"+z,f=z),p!==e&&(k+="\\f"+p,e=p),x!==g&&(k+="\\fs"+2*x,g=x),b.style.italic&&(k+="\\i",n="\\i0"+
n),b.style.bold&&(k+="\\b",n="\\b0"+n),b.style.underline&&(k+="\\ul",n="\\ulnone"+n),b.style.overline&&(k+="\\ol",n="\\olnone"+n),"text"===b.nodeType?(b.value=b.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),b=""!==k?k+" "+b.value+n:""!==h&&"}"!==h.charAt(h.length-1)?" "+b.value:b.value,h+=b):"formula"===b.nodeType?h+="{\\*\\mjaformula"+b.formulaToRTF(e,g,f,a,c)+"}":"componentSpace"===b.nodeType?h+="{\\*\\component\\Space "+b.value+"}":"componentNumCtrl"===b.nodeType&&
(h+="{\\*\\component\\NumCtrl "+b.value+"}");return h};k.prototype.formulaToRTF=function(a,c,d,e,f){for(var b,g="",h,k,n,p,r=0,v=this.children.length;r<v;r++)h=k="",b=this.children[r],n=this.addToFontTable(b.style.family,e),p=this.addToColorTable(b.style.color,f),null===p&&0<f.length&&(p=this.addToColorTable(q,f)),n!==a&&(h+="\\f"+n,a=n),p!==d&&(h+="\\cf"+p,"text"!==b.nodeType||"text"===b.nodeType&&""!==b.value)&&(d=p),b.style.italic&&(h+="\\i",k="\\i0"+k),b.style.bold&&(h+="\\b",k="\\b0"+k),b.style.underline&&
(h+="\\ul",k="\\ulnone"+k),b.style.overline&&(h+="\\ol",k="\\olnone"+k),"text"===b.nodeType&&""!==b.value?(b.value=b.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==h?h+" "+b.value+k:"}"!==g.charAt(g.length-1)?" "+b.value:b.value,g+=tmpRTF):"dynamicText"===b.nodeType?(b.value=""===b.value?" ":b.value,g+=h+"{\\expr "+b.value+"\\decimals "+(b.decimals||2)+"\\fixed"+(b.fixed?1:0)+"}"+k):"fraction"===b.nodeType||"radical"===b.nodeType||"index"===b.nodeType||
"radicand"===b.nodeType||"sum"===b.nodeType||"integral"===b.nodeType||"prod"===b.nodeType||"limit"===b.nodeType||"from"===b.nodeType||"to"===b.nodeType||"what"===b.nodeType||"element"===b.nodeType?g+="{\\"+b.nodeType+b.formulaToRTF(a,c,d,e,f)+"}":"numerator"===b.nodeType?g+="{\\num"+b.formulaToRTF(a,c,d,e,f)+"}":"denominator"===b.nodeType?g+="{\\den"+b.formulaToRTF(a,c,d,e,f)+"}":"superIndex"===b.nodeType?g+="{\\supix"+b.formulaToRTF(a,c,d,e,f)+"}":"subIndex"===b.nodeType?g+="{\\subix"+b.formulaToRTF(a,
c,d,e,f)+"}":"matrix"===b.nodeType?g+="{\\matrix\\rows "+(b.rows||2)+"\\columns "+(b.columns||2)+b.formulaToRTF(a,c,d,e,f)+"}":"defparts"===b.nodeType&&(g+="{\\defparts\\parts "+(b.parts||2)+b.formulaToRTF(a,c,d,e,f)+"}");return g};k.prototype.addToFontTable=function(a,c){var b;a.match(/times/i)?b="Times New Roman":a.match(/courier/i)?b="Courier New":a.match(/arial/i)&&(b="Arial");a=c.indexOf(b);-1===a&&(a=c.length,c.push(b));return a};k.prototype.addToColorTable=function(a,c){if(a){a="\\red"+parseInt(a.substring(1,
3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var b=c.indexOf(a);-1===b&&(b=c.length,c.push(a));return b}return null};k.prototype.mergeTextNodes=function(){for(var a=[],c=null,d=0,e=this.children.length;d<e;d++)"text"===this.children[d].nodeType?null!==c&&"text"===c.nodeType&&c.style.equals(this.children[d].style)&&(this.children[d].value=c.value+this.children[d].value,a.push(c)):this.children[d].mergeTextNodes(),c=this.children[d];d=0;for(e=a.length;d<
e;d++)this.removeChild(a[d])};var n={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=String.fromCharCode,e,f,q,p,c,k,n,b,g,d,v,r=function(){};r.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[];e=[];f="";p=q=0;k=a.charAt(0);n=!1;for(b="text";q<a.length;)c=k,k=a.charAt(q+1),n?"\\"===k||"{"===k||"}"===
k||" "===k||";"===k?(n=!1,f+=c," "===k?(q++,k=a.charAt(q+1),v=!0):v=!1,(g=f.match(/^'([0-9a-f]{2})/))?(d="","text"===b&&(d=e.pop().value),f=d+=h(parseInt(g[1],16))+f.substring(3)):(g=f.match(/^u[0-9]+/))?(d="","text"===b&&(d=e.pop().value),f=d+=h(g[0].substring(1))):("{"===f||"}"===f||"\\"==c?(e.push({type:"text",value:f+(v?" ":"")}),b="text"):(e.push({type:"controlWord",value:f}),b="controlWord"),f="")):"{"==c||"}"==c||"\\"==c?(n=!1,e.push({type:"text",value:c}),b="text"):f+=c:"\\"===c?(n=!0,""!==
f&&(e.push({type:"text",value:f}),b="text",f="")):"{"===c?(p++,""!==f&&(e.push({type:"text",value:f}),f=""),e.push({type:"openBlock",value:p}),b="openBlock"):"}"===c?(""!==f&&(e.push({type:"text",value:f}),f=""),e.push({type:"closeBlock",value:p}),b="closeBlock",p--):f+=c,q++;""!==f&&e.push({type:"text",value:f});return e};a.RTFTokenizer=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,e,f,q,p,c,k,n,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G,E,B,L,I,M,O,H,P=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};P.prototype.parse=function(D){e=this.tokenizer.tokenize(D);f={};p=2;if("openBlock"===e[0].type&&"fonttbl"===e[1].value){for(q=e[0].value;"closeBlock"!==e[p].type&&e[p].value!==q;)f[e[p].value]=e[p+2].value.substring(0,e[p+2].value.length-1),p+=3;p++}c={};k=0;if("openBlock"===e[p].type&&"colortbl"===e[p+1].value){q=
e[p++].value;for(p++;"closeBlock"!==e[p].type&&e[p].value!==q;)n=parseInt(e[p++].value.substring(3)).toString(16),b=parseInt(e[p++].value.substring(5)).toString(16),g=parseInt(e[p++].value.substring(4)).toString(16),";"===e[p].value&&p++,c[k++]="#"+(2>n.length?"0"+n:n)+(2>b.length?"0"+b:b)+(2>g.length?"0"+g:g);p++}y=u=r=null;M=I=L=F=A=z=x=w=l=m=!1;J=[new a.TextStyle];C=J[0];E=G=-1;B=[];d=O=new a.TextNode("","textBlock",C,this.evaluator);v=new a.TextNode("","textLineBlock",C,this.evaluator);d.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;D=p;for(var N=e.length;D<N;D++){if("controlWord"==e[D].type)if(f[e[D].value])C.set({family:f[e[D].value]});else if(e[D].value.match(/^fs(\d+)/))C.set({size:parseInt(e[D].value.match(/^fs(\d+)/)[1]/2)});else if("b"==e[D].value)C.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==e[D].value)C.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==e[D].value)C.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==e[D].value)C.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==e[D].value)C.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==e[D].value)C.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==e[D].value)C.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==e[D].value)C.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(e[D].value.match(/^cf(\d+)/))C.set({color:c[parseInt(e[D].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=C.color);else if("par"==e[D].value){d=new a.TextNode("","textLineBlock",C.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(d);v=d}else if("mjaformula"==e[D].value)O.hasFormula=!0,E=G,m=!0,d=new a.TextNode("","formula",C.clone(),this.evaluator),v.addChild(d),v=d,B[B.length-1]=d;else if("fraction"==e[D].value||"radicand"==e[D].value||"radical"==e[D].value||"what"==e[D].value||"sum"==e[D].value||"integral"==
e[D].value||"limit"==e[D].value){var K=B[B.length-2].style.clone();d=new a.TextNode("",e[D].value,K,this.evaluator);B[B.length-2].addChild(d);B[B.length-1]=d}else"index"==e[D].value?(K=B[B.length-2].style.clone(),K.size=h(parseInt(K.size-.5*K.size),8),d=new a.TextNode("",e[D].value,K,this.evaluator),B[B.length-2].addChild(d),B[B.length-1]=d):"to"==e[D].value||"from"==e[D].value?(K=B[B.length-2].style.clone(),K.size=h(parseInt(K.size-.2*K.size),8),d=new a.TextNode("",e[D].value,K,this.evaluator),B[B.length-
2].addChild(d),B[B.length-1]=d):"num"==e[D].value||"den"==e[D].value?(K=B[B.length-2].style.clone(),K.size=h(Math.round(K.size-.1*K.size),8),"num"==e[D].value?d=new a.TextNode("","numerator",K,this.evaluator):"den"==e[D].value&&(d=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(d),B[B.length-1]=d):"subix"==e[D].value||"supix"==e[D].value?(K=B[B.length-2].style.clone(),K.size=h(Math.floor(K.size-.33*K.size),8),"subix"==e[D].value?d=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==e[D].value&&(d=new a.TextNode("","superIndex",K,this.evaluator)),d.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(d),B[B.length-1]=d):"defparts"==e[D].value||"matrix"==e[D].value||"element"==e[D].value?(K=B[B.length-2].style.clone(),d=new a.TextNode("",e[D].value,K,this.evaluator),B[B.length-2].addChild(d),B[B.length-1]=d,"defparts"==e[D].value?y=d:"matrix"==e[D].value&&(u=d,u.matrix_type=0)):"parts"==e[D].value?F=!0:"type"==e[D].value?x=!0:"rows"==e[D].value?z=!0:"columns"==
e[D].value?A=!0:"expr"==e[D].value?(O.stableWidth=!1,l=!0):"decimals"==e[D].value?w=!0:"fixed1"==e[D].value?r.fixed=!0:"fixed0"==e[D].value?r.fixed=!1:"component"!=e[D].value&&("NumCtrl"==e[D].value?L=!0:"Space"==e[D].value?I=!0:"hyperlink"==e[D].value&&(M=!0));if("text"==e[D].type)if(F)y.parts=parseInt(e[D].value),F=!1;else if(x)u.matrix_type=parseInt(e[D].value),x=!1;else if(z)u.rows=parseInt(e[D].value),z=!1;else if(A)u.columns=parseInt(e[D].value),A=!1;else if(w)r.decimals=this.evaluator.parser.parse(e[D].value+
""),w=!1;else if(M){H=e[D].value.split("|")[0];K=C.clone();d=new a.TextNode(H,"hyperlink",K,this.evaluator);d.URL=e[D].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(d);M=!1}else if(L)d=new a.TextNode(e[D].value,"componentNumCtrl",C.clone(),this.evaluator),v.addChild(d),L=!1;else if(I)d=new a.TextNode(e[D].value,"componentSpace",C.clone(),this.evaluator),v.addChild(d),I=!1;else if(l)K=B[B.length-2].style.clone(),H=this.evaluator.parser.parse(e[D].value),
d=new a.TextNode(H,"dynamicText",K,this.evaluator),B[B.length-2].addChild(d),r=B[B.length-1]=d,l=!1;else if(l||m)!l&&m&&(H=e[D].value,d=new a.TextNode(H,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(d));else{H=e[D].value;d=new a.TextNode(H,"text",C.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(d)}else if("openBlock"==e[D].type)G=e[D].value,C=C.clone(),J.push(C),B.push(null);else if("closeBlock"==
e[D].type)e[D].value==E&&(E=-1,m=!1,v=v.parent),J.pop(),C=J[J.length-1],B.pop();else if("("==e[D].type||")"==e[D].type)K=B[B.length-1].style.clone(),K.italic="",d=new a.TextNode(e[D].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(d);else if("+"==e[D].type||"-"==e[D].type||"*"==e[D].type||"="==e[D].type)d=new a.TextNode(e[D].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(d)}return O.normalize()};a.RTFParser=P;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k,n,b,g,d,v=function(b,c){this.parent=b;e=this.evaluator=this.parent.evaluator;f=e.parser;this.id="";this.type="2D";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("ffffff");this.net=2!=b.version?new a.Color("c0c0c0"):"";this.net10=2!=b.version?new a.Color("808080"):"";this.axes=2!=b.version?new a.Color("808080"):"";this.text=new a.Color("ffafaf");this.numbers=!1;this.y_axis=this.x_axis=2!=b.version?"":" ";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||
0;this.displaceRegionWest=b.displaceRegionWest||0;Object.assign(this,c);this.initSpace()};v.prototype.initSpace=function(){h=this.parent;e=this.evaluator;q=this.id;this.resizable||(this.displaceRegionNorth=h.displaceRegionNorth||0,this.displaceRegionSouth=h.displaceRegionSouth||0,this.displaceRegionEast=h.displaceRegionEast||0,this.displaceRegionWest=h.displaceRegionWest||0,n=parseInt(h.container.width),k=parseInt(h.container.height),void 0!=this.wExpr&&(this.w=parseInt(n-this.displaceRegionWest-
this.displaceRegionEast)*parseFloat(this.wExpr)/100),void 0!=this.hExpr&&(this.h=parseInt(k-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.hExpr)/100),void 0!=this.xPercentExpr&&(this.xExpr=e.parser.parse((parseInt(n-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.xPercentExpr)/100).toString())),void 0!=this.yPercentExpr&&(this.yExpr=e.parser.parse((parseInt(k-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.yPercentExpr)/100).toString())),this.x=
e.eval(this.xExpr)+this.displaceRegionWest,this.y=e.eval(this.yExpr)+this.plecaHeight+this.displaceRegionNorth,this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px"),0<=this.y?(p=k-this.y,this.h>p&&(this.h=p)):(p=this.h+this.y,this.h=p>=k?k:p),0<=this.x?(c=n-this.x,this.w>c&&(this.w=c)):(c=this.w+this.x,this.w=c>=n?n:c));""==this.imageSrc&&/vacio.gif$/i.test(this.imageSrc.trim())||(this.image=h.getImage(this.imageSrc));this.OxExpr&&(g=this.OxExpr,"%"===g[g.length-
1]?this.Ox=this.w*parseFloat(g)/100:(b=parseFloat(g),b!=g&&(b=0),this.Ox=b));this.OyExpr&&(d=this.OyExpr,"%"===d[d.length-1]?this.Oy=this.h*parseFloat(d)/100:(b=parseFloat(d),b!=d&&(b=0),this.Oy=b));""!==this.id&&2!==h.version?(e.setVariable(q+"._w",this.w),e.setVariable(q+"._h",this.h),e.setVariable(q+".escala",this.scale),e.setVariable(q+".Ox",this.Ox),e.setVariable(q+".Oy",this.Oy),e.setVariable(q+".mouse_x",0),e.setVariable(q+".mouse_y",0),e.setVariable(q+".mouse_pressed",0),e.setVariable(q+".mouse_clicked",
0),e.setVariable(q+".clic_izquierdo",0)):(b=e.getVariable("_w"),void 0===b&&(b=this.w),e.setVariable("_w",b),b=e.getVariable("_h"),void 0===b&&(b=this.h),e.setVariable("_h",b),b=e.getVariable("escala"),void 0===b&&(b=this.scale),e.setVariable("escala",b),b=e.getVariable("Ox"),void 0===b&&(b=this.Ox),e.setVariable("Ox",b),b=e.getVariable("Oy"),void 0===b&&(b=this.Oy),e.setVariable("Oy",b),e.setVariable("mouse_x",0),e.setVariable("mouse_y",0),e.setVariable("mouse_pressed",0),e.setVariable("mouse_clicked",
0),e.setVariable("clic_izquierdo",0),2==h.version&&""===this.x_axis&&""===this.y_axis&&(this.axes=""));this.w_2=this.w/2;this.h_2=this.h/2};v.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,
0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(e){h=this;h.parent=e;h.width=228;h.vSpace=25;h.container=a.newHTML("div",{style:"box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:"+(h.width+27)+"px;height:460px;"});h.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(h.width+27)+"px;height:"+h.vSpace+
"px;line-height:"+h.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});h.movable.innerHTML="Descartes";h.container.appendChild(h.movable);h.ctrs=[]};e.prototype.init=function(){function e(c){h.newPos=a.getCursorPosition(c,document.body);h.container.style.left=h.initialPosition.x+(h.newPos.x-h.oldPos.x)*a.cssScale+"px";h.container.style.top=h.initialPosition.y+(h.newPos.y-h.oldPos.y)*a.cssScale+"px"}function q(a){a.preventDefault();document.body.removeEventListener("mousemove",
e);document.body.removeEventListener("mouseup",q)}h=this;document.body.appendChild(this.container);for(var p=h.parent.evaluator.parser,c=0,k=h.ctrs.length;c<k;c++)h.ctrs[c].expresion=p.parse("(0,"+(h.vSpace+23+35*c)+","+h.width+",35)"),h.ctrs[c].update();h.numCtr=k;c=new a.Button(h.parent,{region:"external",name:"english"==h.language?"about":"cr\u00e9ditos",font_size:p.parse("15"),expresion:p.parse("(0,"+h.vSpace+","+h.width/2+",25)")});c.actionExec={execute:a.showAbout};c.update();(new a.Button(h.parent,
{region:"external",name:"config",font_size:p.parse("15"),action:"config",expresion:p.parse("("+h.width/2+","+h.vSpace+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"init":"inicio",font_size:p.parse("15"),action:"init",expresion:p.parse("(0,"+(h.vSpace+23+35*k)+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"clear":"limpiar",font_size:p.parse("15"),action:"clear",expresion:p.parse("("+h.width/
2+","+(h.vSpace+23+35*k)+","+h.width/2+",25)")})).update();p=new a.Button(h.parent,{region:"external",name:"english"==h.language?"close":"cerrar",font_size:p.parse("15"),expresion:p.parse("("+h.width/4+","+(h.vSpace+46+35*k)+","+h.width/2+",25)")});p.update();p.btn.addEventListener("click",function(a){h.hide()});h.setPositionAndSize();h.movable.addEventListener("mousedown",function(c){c.preventDefault();h.oldPos=a.getCursorPosition(c,document.body);h.initialPosition={x:h.container.offsetLeft,y:h.container.offsetTop};
document.body.addEventListener("mousemove",e);document.body.addEventListener("mouseup",q)});h.hide()};e.prototype.addCtr=function(a){this.ctrs.push(a)};e.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};e.prototype.hide=function(){this.container.style.display="none"};e.prototype.setPositionAndSize=function(){h=this;var a=h.vSpace+46+35*h.numCtr+25+10;h.container.style.left=Math.max(parseInt(window.innerWidth-h.width)/2,0)+"px";h.container.style.top="5px";h.container.style.height=
window.innerHeight<h.vSpace+75?h.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.round,f=2*Math.PI,q=a.convertFont("Serif,BOLD+ITALIC,16"),p=a.convertFont("Monospaced,PLAIN,12"),c,k,n,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G,E,B,L,I,M,O,H,P,D,N,K,R,Q=function(b,d){c=d=a.Space.call(this,b,d)||this;c.ratio=b.ratio;c.border_width=c.border_width||0;c.border_color=c.border_color||new a.Color("000000",b.evaluator);c.border_radius=c.border_radius||0;c.canvas=a.newHTML("canvas",{id:c.id+"_canvas",class:"DescartesSpace2DCanvas",
width:c.w*c.ratio});c.backCanvas=a.newHTML("canvas",{id:c.id+"_background",width:c.w*c.ratio});c.canvas.style=c.backCanvas.style=(0<c.border_width?"border:"+c.border_width+"px solid "+c.border_color.getColor()+";":"")+(c.border_radius?"border-radius:"+c.border_radius+"px;":"");c.canvas.style.zIndex=c.zIndex;c.canvas.style.width=c.backCanvas.style.width=c.w+"px";c.canvas.style.height=c.backCanvas.style.height=c.h+"px";c.ctx=c.canvas.getContext("2d");c.backCtx=c.backCanvas.getContext("2d");c.ctx.imageSmoothingEnabled=
c.backCtx.imageSmoothingEnabled=!1;c.graphicControlContainer=a.newHTML("div",{id:c.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+c.zIndex+";"});c.numericalControlContainer=a.newHTML("div",{id:c.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+c.zIndex+";"});c.container=a.newHTML("div",{id:c.id,class:"DescartesSpace2DContainer",style:"z-index:"+c.zIndex+";"});c.parent.arquimedes&&"#f0f8fa"===c.background.getColor()&&(c.container.style.boxShadow="0 0 5px 0 #b8c4c8");
c.container.appendChild(c.backCanvas);c.container.appendChild(c.canvas);c.container.appendChild(c.graphicControlContainer);c.container.appendChild(c.numericalControlContainer);b.container.insertBefore(c.container,b.loader);var e=c.id+".image";c.parent.images[e]=c.canvas;c.parent.images[e].ready=1;c.parent.images[e].complete=c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);e=c.id+".back";c.parent.images[e]=c.backCanvas;c.parent.images[e].ready=1;c.parent.images[e].complete=c.parent.images[e].canvas=
!0;c.evaluator.setVariable(e,e);e=""!==c.id&&2!==b.version?c.id+".":"";c.OxStr=e+"Ox";c.OyStr=e+"Oy";c.scaleStr=e+"escala";c.wStr=e+"_w";c.hStr=e+"_h";c.mxStr=e+"mouse_x";c.myStr=e+"mouse_y";c.mpressedStr=e+"mouse_pressed";c.mclickedStr=e+"mouse_clicked";c.mclickIzqStr=e+"clic_izquierdo";c.click=0;c.resizable&&(c.wModExpr=b.evaluator.parser.parse(c.wModExpr),c.hModExpr=b.evaluator.parser.parse(c.hModExpr));"descartesJS_stage"!==c.id?c.addEvents():c.canvas.oncontextmenu=function(a){return!1};return d};
$jscomp.inherits(Q,a.Space);Q.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")};Q.prototype.update=function(a){c=this;k=c.evaluator;n=c.parent;if(c.resizable){if(D=c.evaluator.eval(c.wModExpr),N=c.evaluator.eval(c.hModExpr),c.old_w!=D||c.old_h!=N)c.w=D,c.h=N,
c.w_2=c.w/2,c.h_2=c.h/2,k.setVariable(c.wStr,c.w),k.setVariable(c.hStr,c.h),c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=c.backCanvas.height=c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px",a=!0}else k.setVariable(c.wStr,c.w),k.setVariable(c.hStr,c.h);c.drawIfValue=0<k.eval(c.drawif);if(c.drawIfValue){g=c.x!==k.eval(c.xExpr)+c.displaceRegionWest;d=c.y!==k.eval(c.yExpr)+n.plecaHeight+
c.displaceRegionNorth;c.spaceChange=a||g||d||c.drawBefore!==c.drawIfValue||c.Ox!==k.getVariable(c.OxStr)||c.Oy!==k.getVariable(c.OyStr)||c.scale!==k.getVariable(c.scaleStr)||c.backColor!==c.background.getColor();c.x=g?k.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=d?k.eval(c.yExpr)+n.plecaHeight+c.displaceRegionNorth:c.y;c.Ox=k.getVariable(c.OxStr);c.Oy=k.getVariable(c.OyStr);c.scale=k.getVariable(c.scaleStr);c.drawBefore=c.drawIfValue;c.scale=Math.max(1E-6,Math.min(1E6,c.scale));k.setVariable(c.scaleStr,
c.scale);if(g||d)c.container.style.left=c.x+"px",c.container.style.top=c.y+"px";c.container.style.display="block";c.drawTrace=!c.spaceChange&&(!c.fixed&&!c.click||c.fixed);c.spaceChange&&(c.backCtx.setTransform(c.ratio,0,0,c.ratio,0,0),c.drawBackground());c.ctx.setTransform(c.ratio,0,0,c.ratio,0,0);c.draw()}else c.container.style.display="none"};Q.prototype.drawBackground=function(){c=this;k=c.evaluator;b=c.backCtx;b.clearRect(0,0,c.backCanvas.width,c.backCanvas.height);b.fillStyle=c.backColor=c.background.getColor();
b.fillRect(0,0,c.backCanvas.width,c.backCanvas.height);c.image&&""!=c.image.src&&c.image.ready&&c.image.complete&&("topleft"===c.bg_display?b.drawImage(c.image,0,0):"stretch"===c.bg_display?b.drawImage(c.image,0,0,c.w,c.h):"patch"===c.bg_display?(b.fillStyle=b.createPattern(c.image,"repeat"),b.fillRect(0,0,c.w,c.h)):"imgcenter"===c.bg_display&&b.drawImage(c.image,(c.w-c.image.width)/2,(c.h-c.image.height)/2));r=c.scale;u=0;for(y=0>c.w+c.h?0:c.w+c.h;r>y;)r/=10,u++;for(;r<y/10;)r*=10;b.lineWidth=1;
""!==c.net&&(b.strokeStyle=c.net.getColor(),c.drawMarks(b,r/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,r,-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,h(c.h/2+c.Oy)+.5),b.lineTo(c.w,h(c.h/2+c.Oy)+.5));"no"==c.y_axis||""===c.y_axis&&2===c.parent.version||(b.moveTo(h(c.w/
2+c.Ox)+.5,0),b.lineTo(h(c.w/2+c.Ox)+.5,c.h));b.lineWidth=1.2;b.stroke();b.lineWidth=1;c.drawMarks(b,r,4,a);c.drawMarks(b,r/2,2,a);c.drawMarks(b,r/10,1,a)}if(""!==c.x_axis||""!==c.y_axis)b.fillStyle=""!==c.axes?c.axes.getColor():"#000",b.font=q,b.textAlign="right",b.textBaseline="alphabetic","no"!=c.x_axis&&b.fillText(c.x_axis,h(c.w)-2,h(c.h/2+c.Oy)+12),"no"!=c.y_axis&&b.fillText(c.y_axis,h(c.w/2+c.Ox)-2,12);c.numbers&&""!=c.axes&&(b.fillStyle=c.axes.getColor(),b.font=q,b.textAlign="start",b.textBaseline=
"bottom",r>(c.w+c.h)/2?c.drawNumbers(b,r/5,r<=c.scale?u+1:u):r>(c.w+c.h)/4?c.drawNumbers(b,r/2,r<=c.scale?u+1:u):c.drawNumbers(b,r,u));a=0;for(var d=this.backGraphics.length;a<d;a++)this.backGraphics[a].draw()};Q.prototype.draw=function(){c=this;b=c.ctx;b.clearRect(0,0,c.canvas.width,c.canvas.height);for(var a=0,d=c.graphics.length;a<d;a++)v=c.graphics[a],""!==v.trace&&c.drawTrace&&v.drawTrace(),v.draw();a=0;for(d=c.graphicsCtr.length;a<d;a++)c.graphicsCtr[a].draw();""!=c.text&&c.click&&"L"===c.whichBtn&&
(b.save(),b.strokeStyle=b.fillStyle=c.text.getColor(),b.lineWidth=1,b.font=p,b.textAlign="center",b.textBaseline="alphabetic",E=1>=c.scale?c.mouse_x.toFixed(0):c.mouse_x.toFixed(c.scale.toString().length),B=1>=c.scale?c.mouse_y.toFixed(0):c.mouse_y.toFixed(c.scale.toString().length),L="("+E+","+B+")",I=h(b.measureText(L).width/2),M=c.getAbsoluteX(c.mouse_x),O=c.getAbsoluteY(c.mouse_y),H=h(M),P=h(O-10),H+I>c.w?H=c.w-I:0>H-I&&(H=I),P+1>c.h?P=c.h:0>P-14&&(P=15),b.fillText(L,H,P),b.beginPath(),b.arc(M,
O,2.5,0,f,!0),b.stroke(),b.restore())};Q.prototype.drawMarks=function(a,b,c,d){m=this.w;l=this.h;C=F=0;J=m;G=l;z=h(m/2+this.Ox);A=h(l/2+this.Oy);0<=c&&(F=z-c,J=z+c,C=A-c,G=A+c);a.beginPath();if(!d||d&&!d.match("x"))for(c=-e(z/b);(w=z+e(c*b))<m;c++)a.moveTo(w+.5,C+.5),a.lineTo(w+.5,G+.5);if(!d||d&&!d.match("y"))for(c=-e(A/b);(x=A+e(c*b))<l;c++)a.moveTo(F+.5,x+.5),a.lineTo(J+.5,x+.5);a.stroke()};Q.prototype.drawNumbers=function(a,b,c){m=this.w;l=this.h;z=h(m/2+this.Ox);A=h(l/2+this.Oy);for(c=-e(z/b);(w=
z+e(c*b))<m;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),w+1,A-2);for(c=-e(A/b);(x=A+e(c*b))<l;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),z+5,x+5)};Q.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.click=0,f.evaluator.setVariable(f.mpressedStr,0),f.evaluator.setVariable(f.mclickedStr,1),f.evaluator.setVariable(f.mclickIzqStr,
1),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),f.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);"R"===f.whichBtn&&(window.removeEventListener("mousemove",e),f.posZoom==f.posZoomNew&&a.showConfig&&(f.parent.externalSpace.show(),
f.posZoom=!1,f.posZoomNew=!0));window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c);f.parent.deactivateGraphicControls();f.parent.update()}function d(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.evaluator.setVariable(f.mclickedStr,0);f.evaluator.setVariable(f.mclickIzqStr,0);f.parent.update()}function e(b){b.preventDefault();
f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function g(b){b.preventDefault();b.stopPropagation();f.fixed||(f.posNext=a.getCursorPosition(b,f.container),K=f.posAnte.x-f.posNext.x,R=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-K),f.evaluator.setVariable(f.OyStr,f.Oy-R));d(b)}var f=this;f.posZoom=f.posZoomNew=null;f.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&
this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.parent.clearClick(),f.click=1,f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),f.parent.deactivateGraphicControls(),d(a),window.addEventListener("touchmove",g),window.addEventListener("touchend",
b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",d);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();f.parent.clearClick();f.click=1;f.parent.deactivateGraphicControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=
f.scale,window.addEventListener("mousemove",e))):"L"===f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),d(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,
1);window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c)})};a.Space2D=Q;return a}(descartesJS||{});
descartesJS=function(a){var h,e,f;function q(b,c){H=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));P=a.add3D(b,a.scalarProduct3D(H,-2));D=a.norm3D(P);return 0!==D?a.scalarProduct3D(P,1/D):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var p=Math.floor,c=Math.max,k=Math.cos,n=Math.sin,b,g,d,v,r,u,y,m,l,w,x,z,A,F,J,C,G=[],E,B,L,I,M,O,H,P,D,N,K,R=function(b,c){d=c=a.Space.call(this,b,c)||this;d.border_width=d.border_width||0;d.border_color=d.border_color||new a.Color("000000",b.evaluator);d.border_radius=
d.border_radius||0;d.backCanvas=a.newHTML("canvas",{id:d.id+"_background",width:d.w+"px",height:d.h+"px"});d.canvas=a.newHTML("canvas",{id:d.id+"_canvas",width:d.w+"px",height:d.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+d.zIndex+";"});d.ctx=d.canvas.getContext("2d");d.ctx.imageSmoothingEnabled=!1;d.canvas.style=d.backCanvas.style=(0<d.border_width?"border:"+d.border_width+"px solid "+d.border_color.getColor()+";":"")+(d.border_radius?"border-radius:"+d.border_radius+"px;":"");var e=
d.id+".image";d.parent.images[e]=d.canvas;d.parent.images[e].ready=1;d.parent.images[e].complete=!0;d.parent.images[e].canvas=!0;d.evaluator.setVariable(e,e);d.graphicControlContainer=a.newHTML("div",{id:d.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+d.zIndex+";"});d.numericalControlContainer=a.newHTML("div",{id:d.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+d.zIndex+";"});d.container=a.newHTML("div",{id:d.id,class:"DescartesSpace3DContainer",
style:"z-index:"+d.zIndex+";"});d.container.appendChild(d.backCanvas);d.container.appendChild(d.canvas);d.container.appendChild(d.graphicControlContainer);d.container.appendChild(d.numericalControlContainer);b.container.insertBefore(d.container,b.loader);d.eye={x:0,y:0,z:0};d.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];e=0;for(var f=d.lights.length;e<f;e++)d.lights[e]=a.normalize3D(d.lights[e]);d.light3={x:0,y:0,z:0};d.intensity=[.4,.5,.3,0];d.userIntensity=0;d.dim=
1;d.tmpIntensity=[];d.OxStr=d.id+".Ox";d.OyStr=d.id+".Oy";d.scaleStr=d.id+".escala";d.wStr=d.id+"._w";d.hStr=d.id+"._h";d.obsStr=d.id+".observador";d.ojoXStr=d.id+".Ojo.x";d.ojoYStr=d.id+".Ojo.y";d.ojoZStr=d.id+".Ojo.z";d.rotZStr=d.id+".rot.z";d.rotYStr=d.id+".rot.y";d.userIDimStr=d.id+".userIlum.dim";d.userIIStr=d.id+".userIlum.I";d.userIxStr=d.id+".userIlum.x";d.userIyStr=d.id+".userIlum.y";d.userIzStr=d.id+".userIlum.z";d.evaluator.setVariable(d.rotZStr,0);d.evaluator.setVariable(d.rotYStr,0);
d.evaluator.setVariable(d.userIDimStr,d.dim);d.evaluator.setVariable(d.userIIStr,d.userIntensity);d.evaluator.setVariable(d.userIxStr,0);d.evaluator.setVariable(d.userIyStr,0);d.evaluator.setVariable(d.userIzStr,0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},d);d.evaluator.setFunction(d.id+"._X3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(d);return K.projVert[0].x});d.evaluator.setFunction(d.id+"._Y3D2D_",function(a,b,c){K.vertices[0].x=
a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(d);return K.projVert[0].y});d.resizable&&(d.wModExpr=b.evaluator.parser.parse(d.wModExpr),d.hModExpr=b.evaluator.parser.parse(d.hModExpr));d.ratio=1;d.addEvents();return c};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){d=this;d.initSpace();d.canvas&&(d.canvas.width=d.backCanvas.width=d.w,d.canvas.height=d.backCanvas.height=d.h,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px");
d.w_2=d.w/2;d.h_2=d.h/2;d.w_plus_h=d.w+d.h;d.oldMouse={x:0,y:0};d.S={x:d.h/1080*-20.6*(40/d.scale),y:0,z:0};d.Ojo={x:3*d.w_2,y:0,z:0};d.evaluator.setVariable(d.ojoXStr,d.Ojo.x);d.evaluator.setVariable(d.ojoYStr,d.Ojo.y);d.evaluator.setVariable(d.ojoZStr,d.Ojo.z)};R.prototype.update=function(a){d=this;b=d.evaluator;g=d.parent;b.setVariable(d.wStr,d.w);b.setVariable(d.hStr,d.h);d.drawIfValue=0<b.eval(d.drawif);if(d.drawIfValue){d.resizable&&(wModExpr=d.evaluator.eval(d.wModExpr),hModExpr=d.evaluator.eval(d.hModExpr),
d.old_w!=wModExpr||d.old_h!=hModExpr)&&(d.w=wModExpr,d.h=hModExpr,d.w_2=d.w/2,d.h_2=d.h/2,b.setVariable(d.wStr,d.w),b.setVariable(d.hStr,d.h),d.old_w=d.w,d.old_h=d.h,d.canvas.width=d.backCanvas.width=d.w*d.ratio,d.canvas.height=d.backCanvas.height=d.h*d.ratio,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px",a=!0,d.S={x:d.h/1080*-20.6*(40/d.scale),y:0,z:0},d.Ojo={x:3*d.w_2,y:0,z:0},d.evaluator.setVariable(d.ojoXStr,d.Ojo.x),d.evaluator.setVariable(d.ojoYStr,
d.Ojo.y),d.evaluator.setVariable(d.ojoZStr,d.Ojo.z));u=d.x!==b.eval(d.xExpr)+d.displaceRegionWest;y=d.y!==b.eval(d.yExpr)+g.plecaHeight+d.displaceRegionNorth;d.spaceChange=a||u||y||d.drawBefore!==d.drawIfValue||d.Ox!==b.getVariable(d.OxStr)||d.Oy!==b.getVariable(d.OyStr)||d.Ojo.x!==b.getVariable(d.ojoXStr)||d.Ojo.y!==b.getVariable(d.ojoYStr)||d.Ojo.z!==b.getVariable(d.ojoZStr)||d.scale!==b.getVariable(d.scaleStr);d.x=u?b.eval(d.xExpr)+d.displaceRegionWest:d.x;d.y=y?b.eval(d.yExpr)+g.plecaHeight+d.displaceRegionNorth:
d.y;d.Ojo.x=b.getVariable(d.ojoXStr);d.Ojo.y=b.getVariable(d.ojoYStr);d.Ojo.z=b.getVariable(d.ojoZStr);d.Ox=b.getVariable(d.OxStr);d.Oy=b.getVariable(d.OyStr);d.scale=b.getVariable(d.scaleStr);d.drawBefore=d.drawIfValue;if(a||void 0==d.observer){a=0;for(var e=d.parent.controls.length;a<e;a++)d.parent.controls[a].id===d.obsStr&&(N=!0);d.observer=N?b.getVariable(d.obsStr)||2.5*d.w_plus_h:2.5*d.w_plus_h;d.observer=c(d.observer,.25*d.w_plus_h);b.setVariable(d.obsStr,d.observer)}1E-6>d.scale?(d.scale=
1E-6,b.setVariable(d.scaleStr,1E-6)):1E6<d.scale&&(d.scale=1E6,b.setVariable(d.scaleStr,1E6));if(u||y)d.container.style.left=d.x+"px",d.container.style.top=d.y+"px";d.container.style.display="block";d.dim=b.getVariable(d.userIDimStr);d.userIntensity=b.getVariable(d.userIIStr);d.light3={x:parseInt(b.getVariable(d.userIxStr)),y:parseInt(b.getVariable(d.userIyStr)),z:parseInt(b.getVariable(d.userIzStr))};d.updateCamera();d.draw()}else d.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=
a.scalarProduct3D(this.Ojo,1/this.scale)};R.prototype.rotateVertex=function(b){w=a.degToRad(d.evaluator.getVariable(d.rotZStr));x=k(w);z=n(w);h=b.x*x-b.y*z;e=b.x*z+b.y*x;f=b.z;w=a.degToRad(d.evaluator.getVariable(d.rotYStr));x=k(w);z=n(w);return{x:f*z+h*x,y:e,z:f*x-h*z}};R.prototype.project=function(a){d=this;this.evaluator.getVariable("URL.oldProj");var b=d.eye.x/(a.x-d.eye.x);return{x:d.getAbsoluteX(b*(d.eye.y-a.y)),y:d.getAbsoluteY(b*(d.eye.z-a.z)),z:d.eye.x-a.x}};R.prototype.computeColor=function(b,
c,d){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));I=a.subtract3D(this.eye,c.average);M=a.norm3D(I);O=a.scalarProduct3D(I,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);C=a.norm3D(this.lights[3]);for(var e=0,f=this.intensity.length-1;e<f;e++)G[e]=this.intensity[e]*this.dim;G[3]=this.userIntensity*this.userIntensity/C||0;E=d?this.dim/2:this.dim/4;B=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);e=0;for(f=this.lights.length;e<f;e++)d?(B=Math.max(0,
a.dotProduct3D(q(this.lights[e],L),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[e],L)),E+=G[e]*B;E=Math.min(E,1);A=p(b.r*E);F=p(b.g*E);J=p(b.b*E);return"rgba("+A+","+F+","+J+","+b.a+")"};R.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,
0,0):"stretch"===this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=
this.graphics[a];for(var c=a+1;c<b;c++)r=this.graphics[c],v.splitFace(r),r.splitFace(v);this.primitives=this.primitives.concat(v.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)r=this.graphics[c],r.split&&v.splitFace(r);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===
this.render)this.drawPainter(this.primitives);else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var b=a.length,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,n;;){k=g;for(c=0;c<b;c++)if(!a[c].drawn){n=!0;for(var l=0;l<b;l++)if(l!=c&&!a[l].drawn&&a[c].inFrontOf(d,a[l],h)){n=!1;break}n&&(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)};R.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);window.removeEventListener("touchmove",
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()}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){m=(g.getAbsoluteX(g.oldMouse.x)-g.getAbsoluteX(g.mouse_x))/4;l=(-g.getAbsoluteY(g.oldMouse.y)+g.getAbsoluteY(g.mouse_y))/4;if(m!==g.disp.x||l!==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)-m,g.beta=a.radToDeg(g.beta)-l,g.evaluator.setVariable(g.rotZStr,g.alpha),g.evaluator.setVariable(g.rotYStr,-g.beta),g.disp.x=m,g.disp.y=l,g.oldMouse.x=g.getRelativeX(g.posAnte.x),
g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(b);b.preventDefault()}}var g=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();g.click=1;g.evaluator.setVariable(g.id+".mouse_pressed",1);g.parent.deactivateGraphicControls();g.posAnte=a.getCursorPosition(c,g.container);g.oldMouse.x=g.getRelativeX(g.posAnte.x);g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(c);window.addEventListener("touchmove",f);window.addEventListener("touchend",
b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();g.click=1;g.parent.deactivateGraphicControls();g.whichBtn=a.whichBtn(b);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posObserver=a.getCursorPosition(b,g.container).x,g.posObserverNew=g.posObserver,g.posZoom=a.getCursorPosition(b,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,g.tempObserver=g.observer,window.addEventListener("mousemove",e))):"L"==g.whichBtn&&(g.evaluator.setVariable(g.id+
".mouse_pressed",1),g.posAnte=a.getCursorPosition(b,g.container),g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y),d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,f,q,p,c,k=function(c,b){var e=a.Space.call(this,c,b)||this;h=e.parent.evaluator;void 0!=e._w_&&(c=h.parser.parse(e._w_),e._w_="number"!=c.type?c:void 0);void 0!=e._h_&&(c=h.parser.parse(e._h_),e._h_="number"!=c.type?c:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";e.file.match(/^\[/)&&e.file.match(/\]$/)?e.file=h.parser.parse(e.file.substring(1,e.file.length-1)):e.file.match(/^'/)&&e.file.match(/'$/)?
e.file=h.parser.parse(e.file):e.file=h.parser.parse("'"+e.file+"'");e.oldFile=h.eval(e.file);e.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=a.newHTML("div",{id:e.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+
e.zIndex+";background-repeat:no-repeat;background-position:center;"});e.container.appendChild(e.MyIFrame);e.imageSrc&&(e.container.style.backgroundImage="url("+e.imageSrc+")");e.parent.container.insertBefore(e.container,e.parent.loader);e.MyIFrame.onload=function(b){var c=this;e.evaluator.setFunction(e.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
e.evaluator.setFunction(e.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var d=a.cacheFiles[b];else d=(d=document.getElementById(b))&&"descartes/embed"===d.type?d.textContent:a.openExternalFile(b),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",a.cacheFiles[b]=d;c.contentWindow.postMessage({type:"change_config",filename:b,content:d},
"*")}return 0});e.ImReady=!e.isFirefox;e.isFirefox||(e.container.style.visibility="visible",e.container.style.opacity="1",e.container.style.zIndex=e.zIndex,e.container.style.display=e.drawIfValue?"block":"none");e.MyIFrame.style.visibility="visible";e.container.style.backgroundImage=""};e.update=e.iframeUpdate;e.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(k,a.Space);k.prototype.init=function(){p=this;p.initSpace();p.MyIFrame&&Object.assign(p.MyIFrame.style,{width:p.w+"px",
height:p.h+"px"})};k.prototype.iframeUpdate=function(a){h=this.evaluator;this.drawIfValue=0<h.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);e=this.x!==h.eval(this.xExpr)+this.displaceRegionWest;f=this.y!==h.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=e?h.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=f?h.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=h.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=a+"px",this.w=a));void 0!=this._h_&&(a=h.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(e||f)this.container.style.left=this.x+"px",this.container.style.top=
this.y+"px";q=h.eval(this.file);q!==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=q,this.MyIFrame.contentWindow.location.replace(q));c=h.getVariable(this.id+
"._scroll");1==c?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==c?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};a.SpaceHTMLIFrame=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=1,e=function(e){this.children=e.children;this.lessonParser=e.lessonParser;this.images=e.images;this.images.length=e.images.length;this.audios=e.audios;this.audios.length=e.audios.length;this.descartesApp=e;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});e.imgLoader?(e.loader.style.backgroundColor="rgba(0,0,0,0)",this.imgLoader.setAttribute("style","background-image:url("+
e.imgLoader+");background-size:contain;")):(h=e.width<e.height?e.width/1144:e.height/1092,h=2.5<h?2.5:h,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*h+"px;"),this.progress.setAttribute("style","visibility:visible; left:"+(e.width-726*h)/2+"px; top:"+(33.5*e.height/100+940*h/2)+"px; width:"+726*h+"px; height:"+14*h+"px;"));e.loader.appendChild(this.imgLoader);e.loader.appendChild(this.progress);e.firstRun=!1;this.initPreloader()};
e.prototype.initPreloader=function(){var e=this,h=e.children,p=e.images,c=e.audios,k=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,n=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;p["lib/DescartesCCLicense.png"]=a.getCCLImg();p["lib/DescartesCCLicense.png"].ready=1;var b,g;var d=0;for(b=h.length;d<b;d++)if("rtf"!==h[d].name){if(h[d].value.match(/'macro'|'makro'/g)){var v="";var r=e.lessonParser.split(h[d].value);var u=0;for(g=r.length;u<g;u++)"expresion"===babel[r[u][0]]&&(v=r[u][1]);if(v)var y=(y=document.getElementById(v))&&
"descartes/macro"==y.type?y.text:a.openExternalFile(v);if(y&&(r=y.match(k)))for(v=0,g=r.length;v<g;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(p[u]=new Image,p[u].addEventListener("load",function(){this.ready=1}),p[u].addEventListener("error",function(){this.errorload=1}),p[u].src=u)}if(r=h[d].value.match(k))for(v=0,g=r.length;v<g;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(p[u]=new Image,p[u].addEventListener("load",function(){this.ready=
1}),p[u].addEventListener("error",function(){this.errorload=1}),p[u].src=u);if(r=h[d].value.match(n))for(v=0,u=r.length;v<u;v++)e.initAudio(r[v])}for(var m in p)p.hasOwnProperty(m)&&e.images.length++;for(m in c)c.hasOwnProperty(m)&&e.audios.length++;var l=e.images.length+e.audios.length;0<l&&e.progress.setAttribute("max",l);var w,x=function(){w=0;for(var b in p)p.hasOwnProperty(b)&&(p[b].ready||p[b].errorload)&&w++;for(b in c)c.hasOwnProperty(b)&&(c[b].ready||c[b].errorload)&&w++;e.progress.setAttribute("value",
w);w!=l?e.timer=a.setTimeout(x,1):e.descartesApp.initBuildApp()};x()};e.prototype.initAudio=function(e){var f=this.audios;f[e]=new Audio(e);f[e].filename=e;var h=function(){this.ready=1},c=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo '"+e+"' no puede ser reproducido"),this.errorload=1):(f[e]=new Audio(this.filename.replace("mp3","ogg")),f[e].filename=this.filename.replace("mp3",
"ogg"),f[e].addEventListener("canplaythrough",h),f[e].addEventListener("load",h),f[e].addEventListener("error",c),f[e].load())};f[e].addEventListener("canplaythrough",h);f[e].addEventListener("load",h);f[e].addEventListener("error",c);a.hasTouchSupport?(f[e].load(),f[e].play(),a.setTimeout(function(){f[e].pause()},20),f[e].ready=1):f[e].load()};a.DescartesLoader=e;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var b="[",c=0,d=a.length;c<d;c++)Array.isArray(a[c])?b+=h(a[c]):(f=a[c]||0,"string"==typeof f&&(f="'"+f+"'"),b+=f),c<d-1&&(b+=",");return b+"]"}function e(){q=window.innerWidth/this.width;p=window.innerHeight/this.height;a.cssScale=c=Math.min(q,p);this.container.style.transformOrigin="0 0";q<p?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+c+")"):(this.container.style.left="50%",this.container.style.transform=
"translate3d(0px, 0px, 0px) scale("+c+") translate(-50%, 0)")}if(a.loadLib)return a;var f,q,p,c,k=function(c){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=c;this.parentC=c.parentNode;this.width=parseFloat(c.getAttribute("width"));this.height=parseFloat(c.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=c.getElementsByTagName("param");a.ccLicense=!0;for(var b=
0,e=this.children.length;b<e;b++)"CreativeCommonsLicense"===this.children[b].name&&(a.ccLicense="no"!==this.children[b].value);this.code=c.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.init()};k.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.getURLParameters();this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);this.licenseA=
a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var c=this.children,b,g=0,d=0,f=a.ccLicense?90:0,h=0,k=c.length;h<k;h++)b=c[h],"rtf_height"==b.name&&(g=parseInt(b.value)+120||this.height),"Buttons"==babel[b.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value),d=this.buttonsConfig.height),"image_loader"==b.name&&(this.imgLoader=b.value),"expand"==b.name&&(this.expand=b.value),"docBase"==b.name&&(this.docBase=b.value,b=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(b));"cover"==this.expand&&
(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,g&&(this.height=g+d+f));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),
textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=
this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.parentNode.style.width="100vw",this.container.parentNode.style.height="100vh",this.scaleToFit=e,this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",
new a.DescartesLoader(this)):this.initBuildApp()};k.prototype.initBuildApp=function(){a.showConfig=!0;for(var c=this.children,b,e=this.lessonParser,d=[],f=[],h=[],k=[],p=[],m=[],l=0,q=c.length;l<q;l++)if(b=c[l],"editable"==babel[b.name])a.showConfig="false"==babel[b.value]?!1:!0;else if("language"==babel[b.name])this.language=b.value;else if("pleca"==b.name)b=e.parsePleca(b.value,this.width),this.container.insertBefore(b,this.loader),this.plecaHeight=b.imageHeight?b.imageHeight:b.offsetHeight;else if("Buttons"==
babel[b.name])this.buttonsConfig=e.parseButtonsConfig(b.value);else if("decimal_symbol"==babel[b.name])this.decimal_symbol=b.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[b.name])this.version=parseInt(b.value);else if("language"==babel[b.name])this.language=b.value;else if("rtf"==b.name){var x=(this.width-780)/2,z=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+
b.value.replace(/'/g,"&squot;")+"'");k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+x+","+(z-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&k.push("space='descartesJS_stage' type='image' expresion='["+(x+15)+","+z+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==b.name.charAt(0)?(b.value.match(/'HTMLIFrame'/)&&this.nIframes++,d.push(b.value)):/^C_/.test(b.name)?f.push(b.value):/^A_/.test(b.name)?h.push(b.value):/^G_/.test(b.name)?
(b.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),k.push(b.value)):/^S_/.test(b.name)?p.push(b.value):"Animation"==babel[b.name]&&m.push(b.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_stage' fondo='"+(a.TextController?"ffffffff":"blanco")+"' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+
this.width+"' alto='"+this.height+"'"),this.stage.container.appendChild(this.stage.stageSpace.container),this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));l=0;for(q=d.length;l<q;l++)c=e.parseSpace(d[l]),this.arquimedes&&this.stage.container.appendChild(c.container),this.spaces.push(c),this.zIndex++;l=0;for(q=k.length;l<q;l++)if(a.DEBUG.elemIndex=l,d=e.parseGraphic(k[l]))this.editableRegionVisible=this.editableRegionVisible||d.visible,d.space.addGraph(d);l=0;
for(q=p.length;l<q;l++)(d=e.parse3DGraphic(p[l]))&&d.space.addGraph(d,!0);l=0;for(q=f.length;l<q;l++)this.controls.push(e.parseControl(f[l]));l=0;for(q=h.length;l<q;l++)e.parseAuxiliar(h[l]);l=0;for(q=m.length;l<q;l++)this.animation=e.parseAnimation(m[l]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();l=0;for(q=this.controls.length;l<q;l++)this.controls[l].init();this.updateControls();this.updateSpaces(!0);var A=this;this.nIframes?a.setTimeout(function(){A.finishInit()},200*
this.nIframes):this.finishInit()};k.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",
value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var c=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(c)}catch(b){console.warn("CustomEvents not supported in this browser")}this.readyApp=!0};k.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var c=parseInt(this.width)+
30,b=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-c)/2,(parseInt(screen.height)-b)/2);window.resizeTo(c,b);a.onResize()};k.prototype.configRegions=function(){var c=this.evaluator.parser,b=this.buttonsConfig||{},e=this.container,d="15",f=100,h=100,k=100,p=100;2==this.version&&(d="14",f=63,h=50,k=44,p=53);var m=0,l=0,q=0,x=0,z=0,A=this.northSpace.controls,F=this.southSpace.controls,J=this.eastSpace.controls,C=this.westSpace.controls;if(0<b.rowsNorth||0<A.length||b.about||b.config){0>=
b.rowsNorth?(m=b.height,b.rowsNorth=1):m=b.height*b.rowsNorth;var G=this.northSpace.container;G.id="descartesJS_north";G.setAttribute("style","width:"+e.width+"px;height:"+m+"px;left:0;top:"+this.plecaHeight+"px;");e.insertBefore(G,this.loader);G=e.width;var E=0;b.about?(E=f,G-=E):f=0;b.config&&(G-=h);var B=Math.ceil(A.length/b.rowsNorth),L=G/B;var I=0;for(var M=A.length;I<M;I++)A[I].expresion=c.parse("("+(E+I%B*L)+","+b.height*Math.floor(I/B)+","+L+","+b.height+")"),A[I].drawif=c.parse("1"),A[I].init();
b.about&&(I=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:c.parse(d),expresion:c.parse("(0, 0, "+f+", "+m+")")}),I.actionExec={execute:a.showAbout},I.update());b.config&&(new a.Button(this,{region:"north",name:"config",font_size:c.parse(d),action:"config",expresion:c.parse("("+(G+f)+", 0, "+h+", "+m+")")})).update()}if(0<b.rowsSouth||0<F.length||b.init||b.clear){0>=b.rowsSouth?(l=b.height,b.rowsSouth=1):l=b.height*b.rowsSouth;f=e.width;E=0;b.init?
(E=k,f-=E):k=0;b.clear&&(f-=p);G=this.southSpace.container;G.id="descartesJS_south";G.setAttribute("style","width:"+e.width+"px;height:"+l+"px;left:0;bottom:0;");e.insertBefore(G,this.loader);B=Math.ceil(F.length/b.rowsSouth);L=f/B;I=0;for(M=F.length;I<M;I++)F[I].expresion=c.parse("("+(E+I%B*L)+","+b.height*Math.floor(I/B)+","+L+","+b.height+")"),F[I].drawif=c.parse("1"),F[I].init();b.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:c.parse(d),action:"init",
expresion:c.parse("(0, 0, "+k+", "+l+")")})).update();b.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:c.parse(d),action:"clear",expresion:c.parse("("+(f+k)+", 0, "+p+", "+l+")")})).update()}if(0<J.length)for(I=e.height-m-l,x=b.widthEast,G=this.eastSpace.container,G.id="descartesJS_east",G.setAttribute("style","width:"+x+"px;height:"+I+"px;right:0;top:"+m+"px;"),e.insertBefore(G,this.loader),I=0,M=J.length;I<M;I++)J[I].expresion=c.parse("(0,"+b.height*
I+","+x+","+b.height+")"),J[I].drawif=c.parse("1"),J[I].init();if(0<C.length)for(I=e.height-m-l,z=b.widthWest,G=this.westSpace.container,G.id="descartesJS_west",G.setAttribute("style","width: "+z+"px;height:"+I+"px;left:0;top:"+m+"px;"),e.insertBefore(G,this.loader),I=0,M=C.length;I<M;I++)C[I].expresion=c.parse("(0,"+b.height*I+","+z+","+b.height+")"),C[I].drawif=c.parse("1"),C[I].init();if(this.editableRegionVisible)for(q=b.height,G=this.editableRegion.container,G.id="descartesJS_editableRegion",
G.setAttribute("style","position:absolute;width:"+e.width+"px;height:"+q+"px;left:0;top:"+(e.height-l-b.height)+"px;"),e.insertBefore(G,this.loader),c=this.editableRegion.textFields,e=e.width/c.length,b=a.getFieldFontSize(q),I=0,M=c.length;I<M;I++)"div"==c[I].type?(G.appendChild(c[I].container),c[I].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+q+"px;position:absolute;left:"+I*e+"px;top:0;"),C=c[I].container.firstChild,C.setAttribute("style","font-family:"+
a.sansserif_font+";font-size:"+b+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+q+"px;text-align:center;line-height:"+q+"px;"),J=C.offsetWidth,C.style.width=J+"px",C.firstChild.textContent=C.firstChild.textContent.substring(3,C.firstChild.textContent.length-3),c[I].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+b+"px;width:"+(e-J)+"px;height:"+q+"px;position:absolute;left:"+J+"px;top:0;border:2px groove white;")):(G.appendChild(c[I]),
c[I].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+b+"px;width:"+e+"px;height:"+q+"px;position:absolute;left:"+I*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=m;this.displaceRegionSouth=l+(q||0);this.displaceRegionEast=x;this.displaceRegionWest=z;I=0;for(M=this.spaces.length;I<M;I++)this.spaces[I].init()};k.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};k.prototype.clearClick=
function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};k.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var c=0,b=this.controls.length;c<b;c++)this.controls[c].buttonClick=!1};k.prototype.deactivateGraphicControls=function(){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};k.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};k.prototype.updateEvents=
function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};k.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};k.prototype.updateSpaces=function(a){for(var b=0,c=this.spaces.length;b<c;b++)this.spaces[b].update(a)};k.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};k.prototype.play=function(){this.animation.play()};
k.prototype.stop=function(){this.animation.stop()};k.prototype.reinitAnimation=function(){this.animation.reinit()};k.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&this.audios[a].pause&&(this.audios[a].pause(),this.audios[a].currentTime=0)};k.prototype.getImage=function(a){var b=this.images;return a?(b[a]||(b[a]=new Image,b[a].addEventListener("load",function(){this.ready=1}),b[a].addEventListener("error",function(){this.ready=0;this.errorload=
1}),b[a].src=a),b[a]):new Image};k.prototype.getAudio=function(c){var b=this.audios;if(c){if(!b[c]){c.lastIndexOf(".");b[c]=new Audio(c);var e=function(a){this.ready=1};b[c].addEventListener("canplaythrough",e);var d=function(a){this.canPlayType("audio/"+c.substring(c.length-3))||"mp3"!=c.substring(c.length-3)?(console.warn("El archivo '"+c+"' no puede ser reproducido"),this.errorload=1):(b[c]=new Audio(c.replace("mp3","ogg")),b[c].addEventListener("canplaythrough",e),b[c].addEventListener("load",
e),b[c].addEventListener("error",d),b[c].load())};b[c].addEventListener("error",d);b[c].play();a.setTimeout(function(){b[c].pause()},15)}return b[c]}return new Audio};k.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};k.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.controls.length;d<e;d++)if(c=this.controls[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};k.prototype.getSpaceById=
function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.spaces.length;d<e;d++)if(c=this.spaces[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b){a=decodeURIComponent(a.substring(b+1)).split("&");for(var c=0,d=a.length;c<d;c++)b=a[c].split("="),2==b.length&&(+b[1]==+b[1]&&(b[1]=parseFloat(b[1])),this.evaluator.setVariable("URL."+b[0],b[1]))}};k.prototype.getState=function(){var a="",b=this.evaluator.variables,
c;for(c in b)if(b.hasOwnProperty(c)){var d=b[c];"string"==typeof d&&(d="'"+d+"'");void 0!=d&&"rnd"!=c&&"\u03c0"!=c&&"pi"!=c&&"e"!=c&&"Infinity"!=c&&"-Infinity"!=c&&"object"!=typeof d&&(a=""!=a?a+"\n"+c+"="+d:c+"="+d)}d=this.evaluator.vectors;for(var e in d)d.hasOwnProperty(e)&&(a+="\n"+e+"="+h(d[e]));e=this.evaluator.matrices;for(var f in e)e.hasOwnProperty(f)&&(a+="\n"+f+"="+h(e[f]));return a};k.prototype.setState=function(a,b){a=a.split("\n");for(var c,d,e=0,f=a.length;e<f;e++)c=a[e].split("="),
2<=c.length&&(d=eval(c[1]),-1!=c[1].indexOf("[[")?(this.evaluator.matrices[c[0]]=d,this.evaluator.matrices[c[0]].rows=d.length,this.evaluator.matrices[c[0]].cols=d[0].length):-1!=c[1].indexOf("[")?(this.evaluator.vectors[c[0]]=d,this.evaluator.variables[c[0]+".long"]=d.length):this.evaluator.variables[c[0]]=d);b||this.update()};k.prototype.getEvaluation=function(){for(var a=correct=0,b="",c=0,d=this.controls.length;c<d;c++)"textfield"==this.controls[c].gui&&this.controls[c].evaluate&&(a++,correct+=
this.controls[c].ok,this.controls[c].value=""==this.controls[c].value?"''":this.controls[c].value,b+=" \\n "+this.controls[c].id+"="+this.controls[c].value+"|"+this.controls[c].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};k.prototype.showSolution=function(){for(var a=this.controls,b=0,c=a.length;b<c;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};k.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<
b;a++)this.evaluator.eval(this.saveState[a]);this.update()};k.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);a.backCanvas&&(a.backCanvas=a.backCtx=null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&delete this.images[a]};a.DescartesApp=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(h,e){h="Error: "+h+" en\u300a "+e+" \u300b";var f="";switch(a.DEBUG.objectName){case "Auxiliar":e="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);h+=e+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+f+".";break;case "Graphic":h+="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(h)}};return a}(descartesJS||{});
descartesJS=function(a){function h(){e().forEach(function(c){a.apps.push(new a.DescartesApp(c));c.className="DescartesJS"})}function e(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(a.getAttribute("code"))})}function f(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function q(c){c=a.newHTML("div");var e='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbol DJS_sansserif DJS_serif DJS_monospace DJS_math".split(" ").forEach(function(a){e+='<div style="font-family:'+a+';"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>'});c.innerHTML=e+"</div>";document.body.appendChild(c);a.getFeatures();a.hasCanvas?(window.scrollTo(0,10),f(),h(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";c.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var c=document.getElementById("StyleDescartesApps");c&&c.remove();c=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});c.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(c)})();a.onResize=
function(c){0<a.apps.length&&a.apps[0].scaleToFit()};var p=Object.create(null);a.onMessage=function(c){if(0<a.apps.length){var e=c.data;if(e)if("set"===e.type)"string"==typeof e.value||"number"==typeof e.value?a.apps[0].evaluator.setVariable(e.name,e.value):e.value&&void 0!=e.value.rows?a.apps[0].evaluator.matrices[e.name]=e.value:a.apps[0].evaluator.vectors[e.name]=e.value;else if("update"===e.type)a.apps[0].update();else if("exec"===e.type)(c=a.apps[0].evaluator.getFunction(e.name))&&c.apply(a.apps[0].evaluator,
e.value.toString().split(","));else if("isResizeNeeded"===e.type)c.source.postMessage({type:"doResize"},"*");else if("doResize"===e.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===e.type){p[e.filename]?c=p[e.filename]:(c=a.newHTML("div"),c.innerHTML=e.content,c=c.getElementsByTagName("param"),p[e.filename]=c);var f=document.querySelector("base");f||(f=a.newHTML("base"),document.body.appendChild(f));f.setAttribute("href",e.filename);a.apps[0].children=c;a.apps[0].init()}}};void 0==
a.loadLib&&(a.loadLib=!0,window.addEventListener("load",q),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(c){window.addEventListener(c,function(c){a.onResize(c)})}),document.fonts.ready.then(function(){setTimeout(function(){a.apps.forEach(function(a){a.updateControls();a.updateSpaces(!0)})},500)}));return a}(descartesJS||{});
