/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2019-05-29
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var f=0;return function(){return f<a.length?{done:!1,value:a[f++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var f="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return f?f.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var f,d=[];!(f=a.next()).done;)d.push(f.value);return d};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var f=function(){};f.prototype=a;return new f};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},f={};try{return f.__proto__=a,f.a}catch(d){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,f){a.__proto__=f;if(a.__proto__!==f)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,f){a.prototype=$jscomp.objectCreate(f.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var d=$jscomp.setPrototypeOf;d(a,f)}else for(d in f)if("prototype"!=d)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(f,d);e&&Object.defineProperty(a,d,e)}else a[d]=f[d];a.superClass_=f.prototype};
$jscomp.checkStringArgs=function(a,f,d){if(null==a)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");return a+""};$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,f,d){a!=Array.prototype&&a!=Object.prototype&&(a[f]=d.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,f,d,e){if(f){d=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var q=a[e];q in d||(d[q]={});d=d[q]}a=a[a.length-1];e=d[a];f=f(e);f!=e&&null!=f&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:f})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var d=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var e="";a;)if(a&1&&(e+=d),a>>>=1)d+=d;return e}},"es6","es3");$jscomp.owns=function(a,f){return Object.prototype.hasOwnProperty.call(a,f)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,f){for(var d=1;d<arguments.length;d++){var e=arguments[d];if(e)for(var q in e)$jscomp.owns(e,q)&&(a[q]=e[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,d,e){var f=this.length||0;0>d&&(d=Math.max(0,f+d));if(null==e||e>f)e=f;e=Number(e);0>e&&(e=Math.max(0,f+e));for(d=Number(d||0);d<e;d++)this[d]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,f,d){a instanceof String&&(a=String(a));for(var e=a.length,q=0;q<e;q++){var m=a[q];if(f.call(d,m,q,a))return{i:q,v:m}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var d=[],e=0;e<this.length;e++){var f=this[e];Array.isArray(f)&&0<a?(f=Array.prototype.flat.call(f,a-1),d.push.apply(d,f)):d.push(f)}return d}},"es9","es5");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="expand";a.fit=a.escalar="fit";a.code="code";a.doc="doc";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+
a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+
a.extraIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbola,DJS_extra,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbola,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbola,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";
a.convertFont=function(e){if(""==e)return"";f=e.split(",");d="";d+=a.getFontStyle(f[1])+" ";d+=f[2]+"px ";return d+=a.getFontName(f[0].split(" ")[0])};a.getFontName=function(d){d=d.toLowerCase();e=a.monospace_font;if("serif"===d||"times new roman"===d||"timesroman"===d||"times"===d)e=a.serif_font;else if("sansserif"===d||"arial"===d||"helvetica"===d)e=a.sansserif_font;return e};a.getFontStyle=function(a){return q[a.toLowerCase()]||""};a.getTextWidth=function(d,b){a.ctx.font=b;return Math.round(a.ctx.measureText(d).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 f(){var a,c,b,d,k,n,e;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(h){h=h||0;h=0>h?0:parseInt(h);a=this.toString();-1!==a.indexOf("e")&&(d=a.split("e"),n="-"===d[0][0]?"-":"",k="-"===n?parseFloat(d[0].substring(1)).oToFixed(11):parseFloat(d[0]).oToFixed(11),e=parseInt(d[1]),c=k.indexOf("."),k=k.replace(".",""),0>c+e?(c=0>c?1:c,a=n+"0."+"0".repeat(Math.abs(c+e))+k):a=n+k+"0".repeat(e-k.length+1));c=a.indexOf(".");-1===c?0<h&&
(a+="."+"0".repeat(h)):(b=a.length-c-1,a=b>=h?11>=h?parseFloat(a).oToFixed(h):a.substring(0,c+h+1):a+"0".repeat(h-b));return a}}if(a.loadLib)return a;var d=2*Math.PI,e=360/d,q=d/360,m=Math.floor,b,l,k,g;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*e};a.degToRad=function(a){return a*q};a.drawLine=function(a,c,b,d,k,n,e){a.lineWidth=e||1;a.strokeStyle=n||"black";g=a.lineWidth%2*.5;a.beginPath();a.moveTo(m(c)+g,m(b)+g);a.lineTo(m(d)+g,m(k)+g);a.stroke()};a.getColor=function(a,c){if("string"===
typeof c)return c;b=a.eval(c);return"rgba("+m(255*b[0][0])+","+m(255*b[0][1])+","+m(255*b[0][2])+","+(1-b[0][3])+")"};a.getFeatures=function(){var c=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(c);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);c=a.newHTML("canvas");a.hasCanvas=c.getContext&&c.getContext("2d");a.hasCanvas&&(c.width=c.height=1,
a.ctx=a.hasCanvas,a._ratio=1.5);f()};var p,c;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(p=a.indexOf("."),-1!==p)){c=a.substring(p);if(0==parseFloat(c))return a.substring(0,p);for(var b=c.length-1;0<b;b--)if("0"!==c.charAt(b))return a.substring(0,p+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(){for(var a,c="background-image: linear-gradient(0deg, ",
b=0;100>b;b++)a=m(100-b-35),c+="rgba(0,0,0,"+a*a*192/1E4/255+") "+b+"%, ";return c+"rgba(0,0,0,0.1) 100%);"};a.getCursorPosition=function(c,b){l=c.touches?c.touches[0]:c;k=b.getBoundingClientRect();return{x:(l.pageX-window.pageXOffset-k.left)/a.cssScale,y:(l.pageY-window.pageYOffset-k.top)/a.cssScale}};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var c=!1,b,d=[],k=0,n=0,e=a.length;n<e;n++)b=a.charAt(n),"'"===b&&(c=!c),c||";"!==b&&"\n"!==b||(d.push(a.substring(k,n).replace(/\n/g,"\\n")),
k=n+1);d.push(a.substring(k).replace(/\n/g,"\\n"));return d};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(c){var b=a.newHTML("textarea");b.innerHTML=c;return b.value};a.newHTML=function(a,c){a=document.createElement(a);for(var b in c)a.setAttribute(b,c[b]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||
window.mozCancelAnimationFrame;a.setInterval=function(a,c){function b(){Date.now()-h>=c&&(a.call(),h=Date.now());d.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setInterval(a,c);var h=Date.now(),d={};d.value=requestAnimationFrame(b);return d};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,c){function b(){Date.now()-h>=c?a.call():d.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setTimeout(a,
c);var h=Date.now(),d={};d.value=requestAnimationFrame(b);return d};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var c="<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&&(c+="<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>");c+="</body> </html>";var b=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
b.document.write(c);b.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(f){if(a.cacheFiles[f])return a.cacheFiles[f];var d=null,e=new XMLHttpRequest;e.open("GET",f,!1);try{e.send(null),d=200===e.status||304===e.status?e.responseText:e.responseText||"",d=404===e.status?"":d,d.match(String.fromCharCode(65533))&&(e.open("GET",f,!1),e.overrideMimeType("text/plain;charset=ISO-8859-1"),e.send(null),d=e.responseText)}catch(q){d=null}return d};a.addExternalFileContent=function(f,
d){a.cacheFiles[f]=d};return a}(descartesJS||{});
descartesJS=function(a){function f(a){x=a.indexOf("--radial--");-1!=x&&(a=a.substring(0,x));m=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};m[0]==m[m.length-1]&&"'"==m[0]&&(a.ignoreCaps=!0,m=m.substring(1,m.length-1),"`"==m[0]&&"\u00b4"==m[m.length-1]&&(a.ignoreAccents=!0,m=m.substring(1,m.length-1)));"`"==m[0]&&"\u00b4"==m[m.length-1]&&(a.ignoreAccents=!0,m=m.substring(1,m.length-1),m[0]==m[m.length-1]&&"'"==m[0]&&(a.ignoreCaps=!0,m=m.substring(1,m.length-1)));"*"===m.charAt(0)&&"*"!==
m.charAt(m.length-1)?m=m.substring(1)+"$":"*"!==m.charAt(0)&&"*"===m.charAt(m.length-1)?m="^"+m.substring(0,m.length-1):"*"!==m.charAt(0)&&"*"!==m.charAt(m.length-1)?m="^"+m+"$":"*"===m.charAt(0)&&"*"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1));a.regExp=m.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,c){m=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=m.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),expr:c.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:c.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function e(a,b,d){b=parseFloat(b);g=a.expr[0];p=a.expr[1];c=d.eval(g.expr);r=d.eval(p.expr);h="("==g.type||"["==g.type;v=")"==p.type||"]"==p.type;return h&&b>c&&v&&b<=r?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 m,b,l,k,g,p,c,r,h,v,x;a.buildRegularExpressionsPatterns=function(a,c){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 h=0,n=a.length;h<n;h++){b=a[h].split("&");l=[];for(var k=0,e=b.length;k<e;k++)m=b[k],-1===m.indexOf(",")||"("!==
m.charAt(0)&&"["!==m.charAt(0)||")"!==m.charAt(m.length-1)&&"]"!==m.charAt(m.length-1)?l.push(f(m)):l.push(d(m,c));a[h]=l}return a};a.escorrecto=function(c,h,d,g){d=d||a.externalEvaluator;g=g||a.buildRegularExpressionsPatterns(c,d);h=q(h);c=0;for(var n=g.length;c<n;c++){b=g[c];k=!0;for(var l=0,f=b.length;l<f;l++)k=b[l].regExp?k&&!!h.match(new RegExp(q(b[l].regExp),"i")):k&&e(b[l],h,d);if(k)return 1}return 0};a.esCorrecto=function(c,h,d,g){d=d||a.externalEvaluator;g=g||a.buildRegularExpressionsPatterns(c,
d);c=0;for(var n=g.length;c<n;c++){b=g[c];k=!0;for(var l=0,f=b.length;l<f;l++)(m=b[l].regExp)?(b[l].ignoreAccents&&(h=q(h),m=q(m)),b[l].ignoreCaps&&(h=h.toLowerCase(),m=q(m).toLowerCase()),k=k&&!!h.match(m)):k=k=k&&e(b[l],h,d);if(k)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){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 fill="#'+(void 0===a?"24c":a)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a){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="m19.5 5-7.5 12-7.5-12z" fill="#'+(void 0===a?"d00018":a)+'"/></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'/></svg>")};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d,e,q,m,b,l,k,g,p,c,r,h,v,x,u=function(c,b){this.r=this.g=this.b=0;this.a=1;this.evaluator=b;this.getColor=this.getColorStr;if(c){if(babel[c]&&("net"===babel[c]&&(c="rojo"),c=babel[c],this.r=a.toHex(c.substring(1,3)),this.g=a.toHex(c.substring(3,5)),this.b=a.toHex(c.substring(5,7)),this.colorStr=c),6===c.length&&(this.r=a.toHex(c.substring(0,2)),this.g=a.toHex(c.substring(2,4)),this.b=a.toHex(c.substring(4,6)),this.colorStr="#"+c),8===
c.length&&(this.r=a.toHex(c.substring(2,4)),this.g=a.toHex(c.substring(4,6)),this.b=a.toHex(c.substring(6,8)),this.a=1-a.toHex(c.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===c[0]){e=[];q=this.splitComa(c.substring(1,c.length-1));c=0;for(b=q.length;c<b;c++)l=q[c],m=parseInt(l,16),l!==m.toString(16)&&l!=="0"+m.toString(16)?("["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substring(1,l.length-1)),e.push(this.evaluator.parser.parse(l))):e.push(this.evaluator.parser.parse((m/
255).toString()));this.rExpr=e[0];this.gExpr=e[1];this.bExpr=e[2];this.aExpr=e[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};u.prototype.splitComa=function(a){b=[];for(var h=p=g=k=0,d=a.length;h<d;h++)c=a.charAt(h),"("===c?k++:")"===c?k--:"["===c?g++:"]"===c?g--:","===c&&0===k&&0===g&&(b.push(a.substring(p,h)),p=h+1);b.push(a.substring(p));return b};u.prototype.getColorStr=function(){return this.colorStr};u.prototype.getColorExp=function(){d=
this.evaluator;this.r=f(255*d.eval(this.rExpr));this.g=f(255*d.eval(this.gExpr));this.b=f(255*d.eval(this.bExpr));this.a=1-d.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};u.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(",");r=parseInt(a[0]).toString(16);h=parseInt(a[1]).toString(16);v=parseInt(a[2]).toString(16);x=(255-
parseInt(255*parseFloat(a[3]))).toString(16);1===r.length&&(r="0"+r);1===h.length&&(h="0"+h);1===v.length&&(v="0"+v);1===x.length&&(x="0"+x);return new u(x+r+h+v)};a.Color=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=document.head,d=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});f.appendChild(d);d=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||f.appendChild(d);d=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});f.appendChild(d);d=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});f.appendChild(d);
d=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});f.appendChild(d);(f=document.getElementById("StyleDescartesApps2"))&&f.remove();f=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(f,document.head.firstChild);f.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-apearance:none;apearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after,.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:white;border: 1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after,.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:white;}\n.DescartesCheckbox{position:absolute;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{background-color:lightgray;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;background-color:#e0e4e8;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;}\n.DJS_Up{background-image:url('"+
a.getSvgArrowUp()+"')}\n.DJS_Up[active=false]{background-image:url('"+a.getSvgArrowUp("8888aa")+"')}\n.DJS_Down{background-image:url('"+a.getSvgArrowDown()+"')}\n.DJS_Down[active=false]{background-image:url('"+a.getSvgArrowDown("aa8888")+"')}\n.DJS_Gradient{position:absolute;"+a.createGradient()+"}\n"+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.sin,d=Math.floor,e=Math.random,q=Math.round,m=Math.abs,b=String.fromCharCode,l,k,g,p,c,r,h,v,x,u,n=function(a){this.key=(void 0===a?0:a).toString()};n.prototype.getKey=function(a){l=[];for(var c=0;256>c;c++)l[c]=b(this.alfanum(d(m(7.5*(f(1*c-a)+f(1.4*c+a)+f(.6*c-a)+f(2.2*c+a))))));return l.join("")};n.prototype.encode=function(a){k=d(31*e());this.key=this.getKey(k);return b(this.alfanum(k))+this.encripta(a)};n.prototype.decode=function(a){k=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(k);return this.desencripta(a.substring(1))};n.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};n.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;r=Array(3*a.length);for(var c=0,b=a.length;c<b;c++)x=256*d(a[c]+128)+q(255*e())+65536*q(255*e()),u=d((x<<this.shift(c))/256),r[3*c]=this.alfanum(u%32),r[3*c+1]=this.alfanum(u/32%32),r[3*c+2]=this.alfanum(u/1024%32);return r};n.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};n.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;h=Array(a.length/3);for(var c=0,b=h.length;c<b;c++)u=this.numalfa(a[3*c])+32*this.numalfa(a[3*c+1])+1024*this.numalfa(a[3*c+2]),x=d(256*u>>this.shift(c)),v=d(x/256)%256-128,0>v&&(v+=256),h[c]=v;return h};n.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};n.prototype.numalfa=function(a){return a-(58>a?48:87)};n.prototype.stringToBytes=
function(a){p=[];for(var c=0,b=a.length;c<b;c++)p.push(a.charCodeAt(c));return p};n.prototype.bytesToString=function(a){for(var c=0,h=a.length;c<h;c++)a[c]=b(a[c]);return a.join("")};n.prototype.shift=function(a){g=this.key.charCodeAt(a%this.key.length);p=this.numalfa(g);c=d(p/2%8);0==c&&(c=4);return c};n.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){this.parent=d;var f=d.evaluator,m=f.parser;d=new a.Auxiliary(d);var b=this;b.delay=e.delay?m.parse(e.delay):m.parse("60");b.loop=e.loop?e.loop:!1;b.auto=void 0==e.auto?!0:e.auto;b.controls=e.controls;b.init=d.splitInstructions(m,e.init);b.doExpr=d.splitInstructions(m,e.doExpr);e.whileExpr&&(b.whileExpr=m.parse(e.whileExpr));var l,k=b.doExpr.length;b.animExec=function(){for(l=0;l<k;l++)f.eval(b.doExpr[l]);b.parent.update();b.playing&&
(0<f.eval(b.whileExpr)||b.loop)?b.timer=a.setTimeout(b.animExec,f.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};f.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))))};f.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};f.prototype.reinit=function(){for(var a=0,e=this.init.length;a<
e;a++)this.parent.evaluator.eval(this.init[a])};a.Animation=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(a,e){this.parent=a;this.evaluator=this.parent.evaluator};f.prototype.execute=function(){};a.Action=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){d=a.Action.call(this,d,e)||this;d.parameter=(e||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return d};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){alert(this.parameter)};a.Message=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){d=a.Action.call(this,d,e)||this;var f=d.evaluator,m=f.parser;e=a.splitSeparator((e||"").replace(/&squot;/g,"'"));for(var b=[],l,k=0,g=e.length;k<g;k++)(l=m.parse(e[k],!0))&&b.push(l);g=b.length;d.execute=function(){for(k=0;k<g;k++)f.eval(b[k])};return d};$jscomp.inherits(f,a.Action);a.Calculate=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){var f=a.Action.call(this,d,e)||this;f.parser=d.evaluator.parser;f.evaluator=d.evaluator;f.parameter=e;f.target="_blank";return f};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){var d=this.parameter;d.match(/^\[.*\]?/)&&(d=this.evaluator.eval(this.parser.parse(d.substring(1,d.length-1))));var e=d.indexOf("target");-1!=e&&(this.target=d.substring(e),this.target=this.target.substring(this.target.indexOf("=")+1),d=d.substring(0,
e-1));if("javascript"==d.substring(0,10)){d=new a.SimpleText(parent,d.substring(11).replace(/&squot;/g,"'"));try{eval(d.toString())}catch(q){}}else"http"!=d.substring(0,4)&&(e=window.__dirname||window.location.href,d=e.substring(0,e.lastIndexOf("/")+1)+d),window.open(d,this.target)};a.OpenURL=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){var f=a.Action.call(this,d,e)||this;f.parser=d.evaluator.parser;f.evaluator=d.evaluator;f.parameter=e.trim();f.target="_blank";return f};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var e=a.indexOf("target");-1!=e&&(this.target=a.substring(e),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
e-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(q){}}else"http"!=a.substring(0,4)&&(e=window.__dirname||window.location.href,a=e.substring(0,e.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+", top="+(window.screen.height-this.parent.height)/2+"location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=f;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){return a.Action.call(this,d,e)||this};$jscomp.inherits(f,a.Action);f.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=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){return a.Action.call(this,d,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.init()};a.Init=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){return a.Action.call(this,d,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.clear()};a.Clear=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){return a.Action.call(this,d,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.play()};a.Animate=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){return a.Action.call(this,d,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,d=function(d,q){d=a.Action.call(this,d,q)||this;q=q||"";q.match(f)?d.filenameExpr=d.evaluator.parser.parse("'"+q.match(f)+"'"):(q.match(/^\[.*\]?/)&&(q=q.substring(1,q.length-1)),d.filenameExpr=d.evaluator.parser.parse(q));return d};$jscomp.inherits(d,a.Action);d.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e=function(a,d){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,d)};e.prototype.firstRun=function(){};e.prototype.update=function(){};e.prototype.splitInstructions=function(e,m){d=[];m=m?a.splitSeparator(m):[""];for(var b=0,l=m.length;b<l;b++)a.DEBUG.lineCount=b,(f=e.parse(m[b],!0))&&d.push(f);return d};e.prototype.getPrivateVariables=function(a,e){d=[];e=e?e.split(/;|,/):
[""];for(var b=0,l=e.length;b<l;b++)(f=a.parse(e[b],!0))&&d.push(f);b=0;for(l=d.length;b<l;b++)d[b]="asign"===d[b].type?d[b].childs[0].value:"identifier"===d[b].type?d[b].value:"";return d};e.prototype.parseExpressions=function(d){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(d,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(d,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(d,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
d.parse(this.whileExpr)};a.Auxiliary=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){d=a.Auxiliary.call(this,d,e)||this;e=d.evaluator.parser;d.expresionString=d.expresion;d.expresion=e.parse(d.expresionString);d.expresion&&e.setVariable(d.id,d.expresion);d.editable&&(d.registerTextField(),d.parent.editableRegionVisible=!0);return d};$jscomp.inherits(f,a.Auxiliary);f.prototype.registerTextField=function(){var d=a.newHTML("div"),e=a.newHTML("label");e.appendChild(document.createTextNode("___"+this.id+"=___"));var f=a.newHTML("input");
f.value=this.expresionString;f.disabled=!this.editable;d.appendChild(e);d.appendChild(f);var m=this,b=m.evaluator.parser;f.onkeydown=function(a){13==a.keyCode&&(m.expresion=b.parse(this.value),b.setVariable(m.id,m.expresion),m.parent.update())};this.parent.editableRegion.textFields.push({container:d,type:"div"})};a.Variable=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){d=a.Auxiliary.call(this,d,e)||this;d.expresion=d.evaluator.parser.parse(d.expresion);d.update();return d};$jscomp.inherits(f,a.Auxiliary);f.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m=function(b,e){e=a.Auxiliary.call(this,b,e)||this;f=b.evaluator;d=f.parser;e.size=e.size||d.parse("3");e.expresion=e.expresion.split(";");e.parseFile=d.parse(e.file);e.update();return e};$jscomp.inherits(m,a.Auxiliary);m.prototype.update=function(){var b=this.expresion;f=this.evaluator;d=f.parser;this.oldFile=this.file;if(e=f.eval(this.parseFile))this.file=e;if(this.file){q=(vectorElement=document.getElementById(this.file))&&"descartes/vectorFile"==
vectorElement.type?vectorElement.text:a.openExternalFile(this.file);if(null!=q){q=q.replace(/\r/g,"").split("\n");for(var l=[],k=0,g=q.length;k<g;k++)""!=q[k]&&l.push(q[k]);q=l}null==q||1==q.length&&""==q[0]?(q=[],this.size=d.parse("0")):(b=q,this.size=null);null===this.size&&(this.size=d.parse(b.length+""))}var p;l=[];k=0;for(g=b.length;k<g;k++)(p=d.parse(b[k],!0))&&"asign"!=p.type&&(p=d.parse(this.id+"["+k+"]="+b[k],!0)),l.push(p);b=Array(f.eval(this.size)).fill(0);b._size_=b.length;f.vectors[this.id]=
b;f.setVariable(this.id+".long",b._size_);k=0;for(g=l.length;k<g;k++)f.eval(l[k])};a.Vector=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b=function(b,k){k=a.Auxiliary.call(this,b,k)||this;f=b.evaluator;d=f.parser;k.rows=k.rows||d.parse("3");k.columns=k.columns||d.parse("3");k.expresion=k.splitInstructions(d,k.expresion);e=f.eval(k.rows);q=f.eval(k.columns);m=[];m.type="matrix";b=0;for(var g=q;b<g;b++)m[b]=Array(e).fill(0);f.matrices[k.id]=m;k.update();return k};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){f=this.evaluator;e=f.eval(this.rows);q=f.eval(this.columns);
f.setVariable(this.id+".filas",e);f.setVariable(this.id+".columnas",q);m=f.matrices[this.id];m.rows=e;m.cols=q;for(var a=0,b=this.expresion.length;a<b;a++)f.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){var f=a.Auxiliary.call(this,d,e)||this;var m=f.evaluator;d=m.parser;e=f.id.indexOf("(");f.name=f.id.substring(0,e);f.params=f.id.substring(e+1,f.id.indexOf(")"));f.domain=f.range?d.parse(f.range):d.parse("1");f.params=""===f.params?[]:f.params.split(",");f.numberOfParams=f.params.length;f.algorithm||(f.init="",f.doExpr="",f.whileExpr="");f.parseExpressions(d);f.expresion=d.parse(f.expresion);f.functionExec=function(){f.iterations=0;
if(f.numberOfParams<=arguments.length){for(var b=[],d=0,k=f.privateVars.length;d<k;d++)b.push(m.getVariable(f.privateVars[d])),m.setVariable(f.privateVars[d],0);var e=[];d=0;for(k=f.params.length;d<k;d++)e[d]=m.getVariable(f.params[d]),m.setVariable(f.params[d],arguments[d]);d=0;for(k=f.init.length;d<k;d++)m.eval(f.init[d]);do{d=0;for(k=f.doExpr.length;d<k;d++)m.eval(f.doExpr[d]);if(1E5<++f.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
f.name+" >>"),0}while(0<m.eval(f.whileExpr));var p=m.eval(f.expresion);a.rangeOK=m.eval(f.domain);d=0;for(k=f.params.length;d<k;d++)m.setVariable(f.params[d],e[d]);d=0;for(k=f.privateVars.length;d<k;d++)m.setVariable(f.privateVars[d],b[d]);return p}return 0};m.setFunction(f.name,f.functionExec);return f};$jscomp.inherits(f,a.Auxiliary);a.Function=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){var f=a.Auxiliary.call(this,d,e)||this;var m=f.evaluator;f.parseExpressions(m.parser);f.algorithmExec=function(){for(var a=f.iterations=0,d=f.init.length;a<d;a++)m.eval(f.init[a]);do{a=0;for(d=f.doExpr.length;a<d;a++)m.eval(f.doExpr[a]);if(1E5<++f.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+f.name+" >>"),0}while(0<m.eval(f.whileExpr))};return f};$jscomp.inherits(f,a.Auxiliary);
f.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){d=a.Auxiliary.call(this,d,e)||this;e=d.evaluator;delete d.evaluate;d.condition=e.parser.parse(d.condition);d.lastEvaluation=!1;d.action=d.parent.lessonParser.parseAction(d);"onlyOnce"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==d.execution&&(d.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEvaluation?
(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return d};$jscomp.inherits(f,a.Auxiliary);f.prototype.update=function(){this.eventExec()};a.Event=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,e){var f=a.Auxiliary.call(this,d,e)||this;if(e=e.file){var m=document.getElementById(e);response=m&&"descartes/library"===m.type?m.text:a.openExternalFile(e)}if(response)for(response=a.convertHTMLEntities(response).replace(/\r/g,"").split("\n"),e=0,m=response.length;e<m;e++)""!==response[e].trim()&&d.lessonParser.parseAuxiliar(response[e]);return f};$jscomp.inherits(f,a.Auxiliary);a.Library=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=d.parse("1");this.abs_coord=c.type&&"text"===c.type?!0:!1;this.color=new a.Color("blue");2!==this.parent.version&&(this.color=new a.Color("20303a"),this.parent.arquimedes&&(this.color=new a.Color("black")));this.trace="";this.expresion=d.parse("(0,0)");this.family="";this.family_interval=d.parse("[0,1]");
this.family_steps=d.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=d.parse("2");Object.assign(this,c);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?
parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&
(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};g.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(c){return c.id===a.spaceID})||this.parent.spaces[0]};g.prototype.getFamilyValues=function(){f=this.evaluator;d=f.eval(this.family_interval);this.familyInf=d[0][0];this.familySup=d[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.drawFamilyAux=function(a,
c,b){f=this.evaluator;this.getFamilyValues();e=f.getVariable(this.family);if(0<=this.fSteps)for(var d=0,k=this.fSteps;d<=k;d++)f.setVariable(this.family,this.familyInf+d*this.family_sep),0<f.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,b));f.setVariable("_Text_H_",0);f.setVariable(this.family,e)};g.prototype.draw=function(a,c){""!==this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,c))};g.prototype.drawTrace=
function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,c))};g.prototype.rotate=function(a,c,b){l=Math.cos(b);k=Math.sin(b);return{x:a*l-c*k,y:a*k+c*l}};g.prototype.dashStyle=function(){b=this.ctx;"dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([b.lineWidth,b.lineWidth])):"dash"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,3*b.lineWidth])):"dash_dot"===this.lineDash?(b.lineCap="butt",
b.setLineDash([4*b.lineWidth,2*b.lineWidth,b.lineWidth,2*b.lineWidth])):b.setLineDash([])};g.prototype.drawText=function(a,c,b,d,k,e,g,n,l,w,y){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=a.strokeStyle=k.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:b,y:d},c.update(a,b,d,l,w,g,y,k.getColor());else for("simpleText"===c.type&&(c=c.toString(l,w).split("\\n")),f=this.evaluator,a.fillStyle=k.getColor(),a.font=e,a.textAlign=g,a.textBaseline=n,m=1.2*this.fontSize||0,k=0,e=c.length;k<e;k++)q=
c[k],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(q,b,d+m*k)),a.fillText(q,b,d+m*k)};a.Graphic=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k=function(a,d){this.text=d=d.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";f="'";q=e=0;for(m=-1;e<d.length;)b=d.charAt(e),l=d.charAt(e-1),"["===b&&"\\"===l?(this.textElements.push(d.substring(q,e-1)+"["),this.textElementsMacros.push("'"+d.substring(q,e-1)+"['"),q=e+1):"]"===b&&"\\"===l?(this.textElements.push(d.substring(q,
e-1)+"]"),this.textElementsMacros.push("'"+d.substring(q,e-1)+"]'"),q=e+1):"["===b&&-1===m?(this.textElements.push(d.substring(q,e)),this.textElementsMacros.push("'"+d.substring(q,e)+"'"),q=e,m++):"["===b?m++:"]"===b&&0===m?(this.textElements.push(this.evaluator.parser.parse(d.substring(q,e+1))),this.textElementsMacros.push("["+d.substring(q,e+1)+"]"),q=e+1,m--):("]"==d.charAt(e)&&(m=0>m?m:m-1),f+=d.charAt(e)),e++;this.textElements.push(d.substring(q,e));this.textElementsMacros.push("'"+d.substring(q,
e)+"'")};k.prototype.toString=function(b,k){f="";for(var c=0,e=this.textElements.length;c<e;c++)"string"===typeof this.textElements[c]?f+=this.textElements[c]:(d=this.evaluator.eval(this.textElements[c])[0][0],""!==d&&("string"===typeof d?f+=d:Infinity==d?f+="Infinity":-Infinity==d?f+="-Infinity":isNaN(d)||"NaN"==d?f+="NaN":(d=parseFloat(d),d=k?d.toFixed(b):a.removeNeedlessDecimals(d.toFixed(b)),f+=d.toString().replace(".",this.parent.decimal_symbol))));return f};a.SimpleText=k;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H,A,I,D,M,N,O,F,E,K,L=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fillP=b.fillP||"";b.fillM=b.fillM||"";b.parseExpression();b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();r=new a.R2;h=new a.R2;v=new a.R2;n=new a.R2;x=new a.R2;b.cInd=0;return b};$jscomp.inherits(L,a.Graphic);L.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var c=this.expresion.childs[0],b=this.expresion.childs[1];"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"x"!=c.value||b.contains("x")?"identifier"!=b.type||"x"!=b.value||c.contains("x")||(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};L.prototype.update=function(){};L.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};L.prototype.drawFamilyAux=function(a,c,b){d=this.evaluator;this.getFamilyValues();tempParam=d.getVariable(this.family);if(0<=this.fSteps)for(var h=0,n=this.fSteps;h<=n;h++)d.setVariable(this.family,this.familyInf+h*this.family_sep),this.update(),
this.drawAux(a,c,b);d.setVariable(this.family,tempParam)};L.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};L.prototype.drawAux=function(P,R,Q){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;d=this.evaluator;e=d.parser;q=this.space;m=d.eval(this.width);P.strokeStyle=this.color.getColor();P.lineWidth=m;b=e.getVariable("x");l=e.getVariable("y");k=q.w+24;g=q.h+24;p=k/9;3>p&&(p=3);c=g/7;3>c&&(c=3);0==this.cInd?(f=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;r.set(0,0);h.set(0,0);v.set(0,0);E=.25;K=8;this.abs_coord||(E/=q.scale,K/=q.scale);P.beginPath();for(I=parseInt(c/2);I<g;I+=c)for(A=parseInt(p/2);A<k;A+=p){if(this.abs_coord){n.set(A,I);u=this.newt.findZero(n,E);if(null==u)continue;d.setVariable("x",u.x);d.setVariable("y",u.y);x.set(u.x,u.y)}else{n.set(q.getRelativeX(A),q.getRelativeY(I));u=this.newt.findZero(n,E);if(null==u)continue;d.setVariable("x",u.x);d.setVariable("y",u.y);x.set(q.getAbsoluteX(u.x),q.getAbsoluteY(u.y))}z=x.ix();w=x.iy();
if(-12<=z&&z<k+24&&-12<=w&&w<g+24){if(f[z+12+(w+12)*q.w]===this.cInd)continue;f[z+12+(w+12)*q.w]=this.cInd}a.rangeOK&&(P.moveTo(z,w),P.lineTo(z,w));r.x=u.x;r.y=u.y;h.x=u.x;h.y=u.y;y=this.newt.getUnitNormal();if(0!=y.x||0!=y.y)for(y.rotL90(),v.x=y.x,v.y=y.y,C=B=0,J=!1;2>C;)if(J&&(v.x=-y.x,v.y=-y.y,u.x=r.x,u.y=r.y,h.x=u.x,h.y=u.y,this.abs_coord?x.set(u.x,u.y):x.set(q.getAbsoluteX(u.x),q.getAbsoluteY(u.y)),z=x.ix(),w=x.iy(),J=!1,B=0),u.x+=K*v.x,u.y+=K*v.y,u=this.newt.findZero(u,E),null!=u){d.setVariable("x",
u.x);d.setVariable("y",u.y);v.x=u.x-h.x;v.y=u.y-h.y;v.normalize();if(0==v.x&&0==v.y)break;h.x=u.x;h.y=u.y;this.abs_coord?x.set(u.x,u.y):x.set(q.getAbsoluteX(u.x),q.getAbsoluteY(u.y));G=parseInt(x.ix());H=parseInt(x.iy());if(G!=z||H!=w)if(D=z,M=w,z=G,w=H,-12<=z&&z<k+24&&-12<=w&&w<g+24){B=0;N=f[z+12+(w+12)*q.w];f[z+12+(w+12)*q.w]=this.cInd;for(R=1;8>R;R++)O=D+Math.round((z-D)*R/8),F=M+Math.round((w-M)*R/8),0<=O&&O<k&&0<=F&&F<g&&(f[O+12+(F+12)*q.w]=this.cInd);a.rangeOK&&(P.moveTo(D,M),P.lineTo(z,w));
if(N===this.cInd)break}else J=!0,C++;else 4<++B&&(J=!0,C++)}}P.stroke()}};L.prototype.X=function(a,c,b){b||(c=this.space.w/2+this.space.Ox+this.space.scale*c);c<-a&&(c=-a);c>this.space.w+a&&(c=this.space.w+a);return c};L.prototype.Y=function(a,c,b){b||(c=this.space.h/2+this.space.Oy-this.space.scale*c);c<-a&&(c=-a);c>this.space.h+a&&(c=this.space.h+a);return c};L.prototype.XX=function(a,c,b){return Math.round(this.X(a,c,b))};L.prototype.YY=function(a,c,b){return Math.round(this.Y(a,c,b))};L.prototype.extrapolate=
function(c,b,d,h,n,k){for(var e=this.evaluator.getVariable(b),g=k/2,f=0,l,r,p,x,m,v;1E-15<Math.abs(g);){l=this.evaluator.getVariable(b);r=this.evaluator.getVariable(b)+g;this.evaluator.setVariable(b,r);p=!0;try{x=n,n=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(d,n),0<this.evaluator.eval(c)?(m=new a.R2(Math.min(x,n),Math.max(x,n)),v=0,v=0<k?this.Singularity(Math.abs(g),b,h,l,x,r,n,m):this.Singularity(Math.abs(g),b,h,r,n,l,x,m),0<v&&(p=!1)):p=!1}catch(Z){p=!1}p?f+=g:this.evaluator.setVariable(b,
l);g/=2}this.evaluator.setVariable(b,e);return new a.R2(f/Math.abs(k),n)};L.prototype.extrapolateOnSingularity=function(c,b,d,h,n,k){h=this.evaluator.getVariable(b);for(var e=k/2,g=0,f=n,l;1E-15<Math.abs(e);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)+e);l=!0;if(0<this.evaluator.eval(c))try{f=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(d,f),0>=this.evaluator.eval(c)&&(l=!1)}catch(X){l=!1}else l=!1;l?g+=e:this.evaluator.setVariable(b,this.evaluator.getVariable(b)-e);
e/=2}if(0==g)for(e=k/2,g=k,f=n;1E-15<Math.abs(e);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)-e);l=!0;if(0<this.evaluator.eval(c))try{f=this.evaluator.eval(this.funExpr)}catch(X){l=!1}else l=!1;l?g+=-e:this.evaluator.setVariable(b,this.evaluator.getVariable(b)+e);e/=2}this.evaluator.setVariable(b,h);return new a.R2(g/Math.abs(k),f)};L.prototype.Singularity=function(a,c,b,d,h,n,k,e){if(isNaN(k)||isNaN(h)||isNaN(e.y)||isNaN(e.x)||d>=n)return 2;var g=this.evaluator.getVariable(c),f=0;
try{if(1E-15>Math.abs(n-d)||1E-12>Math.abs(n-d)&&Math.abs(k-h)>Math.abs(a))return this.evaluator.setVariable(c,g),1;var l=(d+n)/2;this.evaluator.setVariable(c,l);var r=NaN;try{r=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(r))return 5;if(Math.abs(k-h)>a){this.evaluator.setVariable(c,d-1E-12);var p=this.evaluator.eval(this.funExpr);p=(h-p)/1E-12;this.evaluator.setVariable(c,n+1E-12);var x=(this.evaluator.eval(this.funExpr)-k)/1E-12;if((10>Math.abs(x)||10>Math.abs(p))&&(0<=x&&0<=p||
0>=x&&0>=p)&&4*Math.abs(x)<Math.abs((k-h)/(n-d)))return this.evaluator.setVariable(c,g),2}if(isNaN(e.x)||isNaN(e.y)||isNaN(r))return 2;if(!(e.x<=r&&r<=e.y)){this.evaluator.setVariable(c,l);e.x=Math.min(h,r);e.y=Math.max(h,r);var m=this.Singularity(a/2,c,b,d,h,l,r,e);this.evaluator.setVariable(c,n);e.x=Math.min(k,r);e.y=Math.max(k,r);var v=this.Singularity(a/2,c,b,l,r,n,k,e);f=Math.max(m,v)}}catch(Y){f=1}this.evaluator.setVariable(c,g);return f};L.prototype.drawAuxFun=function(c,d,h){b=this.evaluator.parser.getVariable("x");
l=this.evaluator.parser.getVariable("y");a.rangeOK=1;d="x";var n="y";this.of_y&&(d="y",n="x");var k=this.drawif,e=this.evaluator.eval(this.width),g=!1,f=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?f.ix():f.iy(),p=0,x=0,m=0,v=0,u=1/this.space.scale;f=u*(this.of_y?-this.space.h+f.y:-f.x);var w=0;this.abs_coord&&(f=0,u=1);for(var z,q,C,y,B,A,G,Q,M,I=this.of_y?this.space.h+2:this.space.w+2;m<=I;){z=!0;q=0;this.evaluator.setVariable(d,f);try{C=this.evaluator.eval(this.funExpr),
isNaN(C)||(this.evaluator.setVariable(n,C),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(g?(y=Math.min(w,C),B=Math.max(w,C),A=new a.R2(y,B),q=this.Singularity(u,d,0,f-u,w,f,C,A),0===q?(w<=C?(w=A.x,C=A.y):(C=A.x,w=A.y),G=parseInt(this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord)),p=this.abs_coord?Math.round(C):parseInt(this.of_y?this.XX(e,C,this.abs_coord):this.YY(e,C,this.abs_coord)),this.fillM&&p>r&&(c.lineWidth=1,c.strokeStyle=this.fillM.getColor(),c.beginPath(),this.of_y?(c.moveTo(r+
1,this.space.h-m+.5),c.lineTo(p,this.space.h-m+.5)):(c.moveTo(m+.5,r+1),c.lineTo(m+.5,p)),c.stroke()),this.fillP&&p<r&&(c.lineWidth=1,c.strokeStyle=this.fillP.getColor(),c.beginPath(),this.of_y?(c.moveTo(r-1,this.space.h-m+.5),c.lineTo(p,this.space.h-m+.5)):(c.moveTo(m+.5,r-1),c.lineTo(m+.5,p)),c.stroke()),c.lineWidth=e,c.strokeStyle=h.getColor(),c.beginPath(),this.of_y?(c.moveTo(G+.5,this.space.h-v),c.lineTo(p+.5,this.space.h-m)):(c.moveTo(v+.5,G),c.lineTo(m+.5,p)),c.stroke()):1===q?(this.evaluator.setVariable(d,
f-u),Q=this.extrapolate(k,d,n,0,w,u),p=this.of_y?this.XX(e,Q.y,this.abs_coord):this.YY(e,Q.y,this.abs_coord),c.lineWidth=e,c.strokeStyle=h.getColor(),c.beginPath(),this.of_y?(c.moveTo(x+.5,this.space.h-v),c.lineTo(p+.5,this.space.h-v+Math.round(Q.x))):(c.moveTo(v+.5,x),c.lineTo(v+Math.round(Q.x)+.5,p)),this.evaluator.setVariable(d,f),M=this.extrapolate(k,d,n,0,C,-u),x=this.of_y?this.XX(e,M.y,this.abs_coord):this.YY(e,M.y,this.abs_coord),p=this.of_y?this.XX(e,C,this.abs_coord):this.YY(e,C,this.abs_coord),
c.lineWidth=e,c.strokeStyle=h.getColor(),c.beginPath(),this.of_y?(c.moveTo(x+.5,this.space.h-m),c.lineTo(p+.5,this.space.h-m)):(c.moveTo(m+.5,x),c.lineTo(m+.5,p)),c.stroke()):2===q&&(p=this.of_y?this.XX(e,C,this.abs_coord):this.YY(e,C,this.abs_coord),c.lineWidth=e,c.strokeStyle=h.getColor(),c.beginPath(),this.of_y?(c.moveTo(x+.5,this.space.h-m),c.lineTo(p+.5,this.space.h-m)):(c.moveTo(m+.5,x),c.lineTo(m+.5,p)))):(M=this.extrapolateOnSingularity(k,d,n,0,C,-u),x=this.of_y?this.XX(e,M.y,this.abs_coord):
this.YY(e,M.y,this.abs_coord),p=this.of_y?this.XX(e,C,this.abs_coord):this.YY(e,C,this.abs_coord),c.lineWidth=e,c.strokeStyle=h.getColor(),c.beginPath(),this.of_y?(c.moveTo(x,this.space.h-(m+Math.round(M.x))+.5),c.lineTo(p,this.space.h-m+.5)):(c.moveTo(m+Math.round(M.x),x),c.lineTo(m,p)),c.stroke()),w=C):z=!1)}catch(aa){z=!1}g&&!z&&(this.evaluator.setVariable(d,f-u),this.evaluator.setVariable(n,w),Q=this.extrapolate(k,d,n,0,w,u),p=parseInt(this.of_y?this.XX(e,Q.y,this.abs_coord):this.YY(e,Q.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(c.lineWidth=e,c.strokeStyle=h.getColor(),c.beginPath(),this.of_y?(c.moveTo(x,this.space.h-(v+Math.round(Q.x))+.5),c.lineTo(p,this.space.h-(v+Math.round(Q.x))+.5)):(c.moveTo(v+Math.round(Q.x)+.5,x),c.lineTo(v+Math.round(Q.x)+.5,p)),c.stroke()),this.evaluator.setVariable(d,f));g=z;f+=u;x=p;v=m++}this.evaluator.parser.setVariable("x",b);this.evaluator.parser.setVariable("y",l)};L.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;
c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parseExpression(),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Equation=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d,e,q,m,b,l,k,g,p=function(c,b){b=a.Graphic.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(p,a.Graphic);
p.prototype.update=function(){d=this.evaluator;e=d.eval(this.parameter_interval);this.paraInf=e[0][0];this.paraSup=e[0][1];this.pSteps=d.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};p.prototype.drawAux=function(c,e,h){d=this.evaluator;q=this.space;m=f(d.eval(this.width));
c.lineWidth=0<m?m:1E-6;c.lineCap=c.lineJoin="round";c.strokeStyle=h.getColor();b=d.getVariable(this.parameter);c.beginPath();d.setVariable(this.parameter,this.paraInf);l=d.eval(this.expresion);this.exprX=f(this.abs_coord?l[0][0]:q.getAbsoluteX(l[0][0]));this.exprY=f(this.abs_coord?l[0][1]:q.getAbsoluteY(l[0][1]));this.rotateExp&&(k=a.degToRad(d.eval(this.rotateExp)),g=this.rotate(l[0][0],l[0][1],k),this.exprX=f(this.abs_coord?g.x:q.getAbsoluteX(g.x)),this.exprY=f(this.abs_coord?g.y:q.getAbsoluteY(g.y)));
c.moveTo(this.exprX+.5,this.exprY+.5);for(h=1;h<=this.pSteps;h++)d.setVariable(this.parameter,this.paraInf+h*this.paraSep),l=d.eval(this.expresion),this.rotateExp&&(g=this.rotate(l[0][0],l[0][1],k),l[0][0]=g.x,l[0][1]=g.y),this.exprX=f(this.abs_coord?l[0][0]:q.getAbsoluteX(l[0][0])),this.exprY=f(this.abs_coord?l[0][1]:q.getAbsoluteY(l[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&c.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(c.fillStyle=
e.getColor(),c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);d.setVariable(this.parameter,b)};p.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;c.oncontextmenu=function(){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Curve=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,d=Math.round,e,q,m,b,l,k,g,p,c,r,h=function(c,b){b=a.Graphic.call(this,c,b)||this;b.size=b.size||c.evaluator.parser.parse("2");b.range=b.range||c.evaluator.parser.parse("[1, 100]");b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){e=this.evaluator;m=e.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.rotateExp&&
(b=this.rotate(m[0][0],m[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);g=e.eval(this.range);this.rangeInf=g[0][0];this.rangeMax=g[0][1]};h.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};h.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};h.prototype.drawAux=function(b,h){e=this.evaluator;q=this.space;c=p=Math.ceil(e.eval(this.size)-.4);b.fillStyle=h.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(r=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=r);h=e.getVariable("n");for(var g=this.rangeInf,n=this.rangeMax;g<=n;g++)e.setVariable("n",g),m=e.eval(this.expresion),this.exprX=m[0][0],this.exprY=m[0][1],l=d(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX)),k=d(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(l,k,p,0,f,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,e.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,l+c,k-c,this.color,this.font,"start","alphabetic",e.eval(this.decimals),this.fixed,!0));e.setVariable("n",h)};h.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};
a.Sequence=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,d=Math.round,e,q,m,b,l,k,g=function(b,c){c=a.Graphic.call(this,b,c)||this;c.size=c.size||b.evaluator.parser.parse("2");c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(g,a.Graphic);g.prototype.update=function(){e=this.evaluator;m=e.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.rotateExp&&(b=this.rotate(m[0][0],m[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};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,c){q=this.space;a.fillStyle=c.getColor();l=d(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX));k=d(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY));a.beginPath();a.arc(l,k,d(this.evaluator.eval(this.size)),0,f,!0);a.fill();this.text.hasContent&&this.text.draw(a,c,l,k)};a.Point=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d=2*Math.PI,e,q,m,b,l,k,g,p,c,r,h,v,x,u=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(u,a.Graphic);u.prototype.update=function(){e=this.evaluator;m=e.eval(this.expresion);this.endPoints=[];for(var c=0,d=m.length;c<d;c++)this.endPoints[c]={x:m[c][0],y:m[c][1]};if(this.rotateExp)for(b=
a.degToRad(e.eval(this.rotateExp)),c=0,d=this.endPoints.length;c<d;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,b)};u.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};u.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};u.prototype.drawAux=function(a,b,m){e=this.evaluator;q=this.space;l=f(e.eval(this.width));a.lineWidth=0<l?l:1E-6;p=e.eval(this.size);0>p&&(p=0);a.fillStyle=b.getColor();a.strokeStyle=
m.getColor();a.lineCap="round";c=0==a.lineWidth%2?0:.5;this.abs_coord?(r=f(this.endPoints[0].x),h=f(this.endPoints[0].y),v=f(this.endPoints[1].x),x=f(this.endPoints[1].y)):(r=f(q.getAbsoluteX(this.endPoints[0].x)),h=f(q.getAbsoluteY(this.endPoints[0].y)),v=f(q.getAbsoluteX(this.endPoints[1].x)),x=f(q.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(r+c,h+c);a.lineTo(v+c,x+c);this.dashStyle();a.stroke();0<p&&(a.beginPath(),a.arc(r,h,p,0,d,!0),a.arc(v,x,p,0,d,!0),a.fill());a.setLineDash([]);
this.text.hasContent&&(k=parseInt((r+v)/2)-3,g=parseInt((h+x)/2)+3,this.text.draw(a,m,k,g))};a.Segment=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=Math.round,e,q,m,b,l,k,g,p,c,r,h,v,x,u,n,z=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("5");b.size=b.size||c.evaluator.parser.parse("2");b.spear=b.spear||c.evaluator.parser.parse("8");b.arrow=b.arrow||new a.Color("ee0022");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(z,a.Graphic);z.prototype.update=function(){e=this.evaluator;q=e.eval(this.expresion);this.endPoints=[];for(var c=
0,b=q.length;c<b;c++)this.endPoints[c]={x:q[c][0],y:q[c][1]};if(this.rotateExp)for(m=a.degToRad(e.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,m)};z.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};z.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};z.prototype.drawAux=function(m,q,z){e=this.evaluator;b=this.space;g=e.eval(this.width);
0>g&&(g=0);p=Math.ceil(g/2);c=b.scale;this.vect=new a.Vector2D(this.endPoints[1].x-this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);r=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);m.fillStyle=q.getColor();m.strokeStyle=z.getColor();m.lineWidth=2;this.abs_coord?(h=d(this.endPoints[0].x),v=d(this.endPoints[0].y),x=d(this.endPoints[1].x),u=d(this.endPoints[1].y)):(h=d(b.getAbsoluteX(this.endPoints[0].x)),v=d(b.getAbsoluteY(this.endPoints[0].y)),x=d(b.getAbsoluteX(this.endPoints[1].x)),
u=d(b.getAbsoluteY(this.endPoints[1].y)));n=e.eval(this.spear);0>n&&(n=0);m.save();m.translate(h,v,r);this.abs_coord?m.rotate(this.angle*(0<=this.vect.y?1:-1)):(r*=c,m.rotate(this.angle*(0<=this.vect.y?-1:1)));m.beginPath();m.moveTo(-p,f(-p));m.lineTo(f(r-n-g),f(-p));m.lineTo(f(r-2*n),f(-n-p));m.lineTo(f(r),0);m.lineTo(f(r-2*n),f(n+p));m.lineTo(f(r-n-g),f(p));m.lineTo(-p,f(p));m.closePath();m.stroke();m.fill();m.restore();this.text.hasContent&&(l=parseInt((h+x)/2)-3,k=parseInt((v+u)/2)+3,this.text.draw(m,
z,l,k))};a.Arrow=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d,e,q,m,b,l,k,g,p=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.endPoints=[];return b};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){d=this.evaluator;q=d.eval(this.expresion);for(var c=0,b=q.length;c<b;c++)this.endPoints[c]={x:q[c][0],y:q[c][1]};if(this.rotateExp)for(m=a.degToRad(d.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=
this.rotate(this.endPoints[c].x,this.endPoints[c].y,m)};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};p.prototype.drawAux=function(a,r,h){d=this.evaluator;e=this.space;b=f(d.eval(this.width));a.lineWidth=0<b?b:1E-6;a.strokeStyle=h.getColor();a.lineCap=a.lineJoin="round";l=0<b?.5:0;k=f(this.abs_coord?this.endPoints[0].x:e.getAbsoluteX(this.endPoints[0].x));g=f(this.abs_coord?
this.endPoints[0].y:e.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(k+l,g+l);h=1;for(var c=this.endPoints.length;h<c;h++)k=f(this.abs_coord?this.endPoints[h].x:e.getAbsoluteX(this.endPoints[h].x)),g=f(this.abs_coord?this.endPoints[h].y:e.getAbsoluteY(this.endPoints[h].y)),a.lineTo(k+l,g+l);this.fill&&(a.fillStyle=r.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d=Math.min,e=Math.max,q=Math.abs,m,b,l,k,g,p,c,r,h,v,x,u,n=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.border_radius=b.border_radius||c.evaluator.parser.parse("0");b.endPoints=[];return b};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){m=this.evaluator;p=m.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.w=150;this.h=100;this.rotateExp&&(l=
this.rotate(p[0][0],p[0][1],a.degToRad(m.eval(this.rotateExp))),this.exprX=l.x,this.exprY=l.y);4<=p[0].length&&(this.w=p[0][2],this.h=p[0][3]);p[1]&&2==p[1].length&&(this.w=p[1][0],this.h=p[1][1]);this.w=e(0,this.w);this.h=e(0,this.h)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};n.prototype.drawAux=function(a,n,l,p){m=this.evaluator;b=this.space;k=f(m.eval(this.width));
a.lineWidth=0<k?k:1E-6;a.strokeStyle=l.getColor();a.lineCap="round";a.lineJoin="miter";g=0<k?.5:0;c=f(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+g;r=f(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+g;h=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;x=d(e(0,m.eval(this.border_radius)),.5*q(h),.5*q(v));u=this.abs_coord?1:-1;a.beginPath();0!==x?(a.moveTo(c+x,r),a.lineTo(c+h-x,r),a.quadraticCurveTo(c+h,r,c+h,r+u*x),a.lineTo(c+h,r+v-u*x),a.quadraticCurveTo(c+
h,r+v,c+h-x,r+v),a.lineTo(c+x,r+v),a.quadraticCurveTo(c,r+v,c,r+v-u*x),a.lineTo(c,r+u*x),a.quadraticCurveTo(c,r,c+x,r),a.lineTo(c+x,r)):(a.moveTo(c,r),a.lineTo(c+h,r),a.lineTo(c+h,r+v),a.lineTo(c,r+v),a.lineTo(c,r));this.fill&&(a.fillStyle=n.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d=Math.min,e=Math.max,q=Math.acos,m=Math.sqrt,b=Math.PI,l=b/2,k=2*b,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H,A,I,D,M,N=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.center=b.center||c.evaluator.parser.parse("(0,0)");b.radius=b.radius||c.evaluator.parser.parse("1");b.init=b.init||"0";b.end=b.end||"90";b.init.match(/^_\(/)&&(b.initFlag=!0,b.init=b.init.substring(1));b.end.match(/^_\(/)&&
(b.endFlag=!0,b.end=b.end.substring(1));b.initExpr=c.evaluator.parser.parse(b.init);b.endExpr=c.evaluator.parser.parse(b.end);b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(N,a.Graphic);N.prototype.update=function(){g=this.evaluator;p=g.eval(this.center);this.exprX=p[0][0];this.exprY=p[0][1];c=0;this.rotateExp&&(c=a.degToRad(g.eval(this.rotateExp)),r=Math.cos(c),h=Math.sin(c),v=this.exprX*r-this.exprY*h,x=this.exprX*h+this.exprY*r,this.exprX=v,this.exprY=x);var f=g.eval(this.initExpr),
A=g.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(u=f[0][0],n=f[0][1],z=A[0][0],w=A[0][1],this.vectors?this.abs_coord&&(n=-n,w=-w):this.abs_coord?(u-=this.exprX,n=-n+this.exprY,z-=this.exprX,w=-w+this.exprY):(u-=this.exprX,n-=this.exprY,z-=this.exprX,w-=this.exprY),y=0==u?0>n?3*l:l:q(1*u/m(u*u+n*n)),B=0==z?0>w?3*l:l:q(1*z/m(z*z+w*w)),y+=c,B+=c,0<u&&0<n&&this.abs_coord&&(y=k-y),0<u&&0>n&&!this.abs_coord&&(y=k-y),0>u&&0>n&&!this.abs_coord&&
(y=k-y),0>u&&0<n&&this.abs_coord&&(y=k-y),0<z&&0<w&&this.abs_coord&&(B=k-B),0<z&&0>w&&!this.abs_coord&&(B=k-B),0>z&&0>w&&!this.abs_coord&&(B=k-B),0>z&&0<w&&this.abs_coord&&(B=k-B),this.initFlag?(C=y,y=B,B=C):(C=d(y,B),J=e(y,B),y=C,B=J,B-y>b&&this.abs_coord&&(y=J,B=C),B-y<=b&&!this.abs_coord&&(y=J,B=C)),this.iniAng=y,this.endAng=B,this.drawPoints=!0):(this.iniAng=a.degToRad(f)+c,this.endAng=a.degToRad(A)+c,this.drawAngle=!0)};N.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,
this.color)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(a,c,b){g=this.evaluator;G=this.space;I=g.eval(this.radius);0>I&&(I=0);M=f(g.eval(this.width));a.lineWidth=0<M?M:1E-6;a.lineCap="round";a.strokeStyle=b.getColor();this.drawAngle?(this.abs_coord?(H=f(this.exprX),A=f(this.exprY)):(H=f(G.getAbsoluteX(this.exprX)),A=f(G.getAbsoluteY(this.exprY)),I*=G.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>
this.endAng&&(D=this.iniAng,this.iniAng=this.endAng,this.endAng=D)):this.drawPoints&&(this.abs_coord?(H=f(this.exprX),A=f(this.exprY)):(H=f(G.getAbsoluteX(this.exprX)),A=f(G.getAbsoluteY(this.exprY)),I*=G.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=c.getColor(),a.beginPath(),a.moveTo(H,A),a.arc(H,A,I,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(H,A,I,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,
this.color,H,A)};a.Arc=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("0");d.align||(d.align="left");d.anchor||(d.anchor="top_left");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){f=this.evaluator;d=f.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(e=this.rotate(d[0][0],d[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=e.x,this.exprY=
e.y)};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};b.prototype.drawAux=function(a,b){this.abs_coord?(q=parseInt(this.exprX),m=parseInt(this.exprY)):(q=parseInt(this.space.getAbsoluteX(this.exprX)),m=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,q,m)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d,e,q,m,b,l,k,g,p,c,r,h,v=function(c,b){b=a.Graphic.call(this,c,b)||this;b.file=b.file||"";b.inirot=b.inirot||c.evaluator.parser.parse("0");b.img=new Image;b.scaleX=b.scaleY=1;b.ratio=c.ratio;b.update();return b};$jscomp.inherits(v,a.Graphic);v.prototype.update=function(){d=this.evaluator;e=d.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(q=this.rotate(e[0][0],e[0][1],a.degToRad(d.eval(this.rotateExp))),this.exprX=
q.x,this.exprY=q.y);4<=e[0].length&&(this.centered=!0,this.scaleX=e[0][2],this.scaleY=e[0][3]);e[1]&&2==e[1].length&&(this.centered=!0,this.scaleX=e[1][0],this.scaleY=e[1][1]);0==this.scaleX&&(this.scaleX=1E-5);0==this.scaleY&&(this.scaleY=1E-5);var c=this;if((m=d.eval(this.file))||""==m)this.img=this.parent.getImage(m),this.img.addEventListener("load",function(a){c.space.update(!0)})};v.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};v.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};
v.prototype.drawAux=function(e){d=this.evaluator;b=this.space;this.img&&this.img.ready&&this.img.complete&&(r=this.img.width,h=this.img.height,this.img.canvas&&(r=f(r/this.ratio),h=f(h/this.ratio)),l=this.centered?0:f(r/2),k=this.centered?0:f(h/2),g=f(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX)),p=f(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY)),c=a.degToRad(-d.eval(this.inirot)),e.save(),e.translate(g+l,p+k),e.rotate(c),this.opacity&&(e.globalAlpha=d.eval(this.opacity)),e.scale(this.scaleX,
this.scaleY),e.drawImage(this.img,-r/2,-h/2,r,h),e.restore())};a.Image=v;return a}(descartesJS||{});
descartesJS=function(a){function f(a,b,d){k=4*(b+d*a.width);return{r:a.data[k],g:a.data[k+1],b:a.data[k+2],a:a.data[k+3]}}if(a.loadLib)return a;var d,e,q,m,b,l,k,g,p=function(c,b){return a.Graphic.call(this,c,b)||this};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){d=this.evaluator.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1]};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};p.prototype.drawAux=function(a,d){d.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(e=parseInt(this.exprX),q=parseInt(this.exprY)):(e=parseInt(this.space.getAbsoluteX(this.exprX)),q=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>e||0>q||e>=this.space.w||q>=this.space.h)){m=[[e,q]];l=f(imageData,e,q);for(g=0;0<m.length;){g++;b=m.pop();e=b[0];q=b[1];var c=f(imageData,e,q);if(l.r===c.r&&l.g===c.g&&l.b===c.b&&l.a===c.a){c=imageData;var r=
d;k=4*(e+q*c.width);c.data[k+0]=r.r;c.data[k+1]=r.g;c.data[k+2]=r.b;c.data[k+3]=255*r.a;0<e&&m.push([e-1,q]);e<imageData.width-1&&m.push([e+1,q]);m.push([e,q-1]);m.push([e,q+1])}if(g>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=p;return a}(descartesJS||{});
descartesJS=function(a,f){if(a.loadLib)return a;var d=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,q,m=function(b,l){var k=a.Graphic.call(this,b,l)||this;k.hasExpresion=k.hasExpresion||!1;k.inirot=k.inirot||b.evaluator.parser.parse("0");k.inipos=k.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(k,l);k.hasExpresion=void 0!==k.expresion;k.graphics=[];b=b.lessonParser;var g=new a.Tokenizer;if(!k.hasExpresion)return k;
"'"!==k.expresion.charAt(0)&&(k.expresion="'"+k.expresion+"'");k.expresion=k.evaluator.parser.parse(k.expresion);l=k.evaluator.eval(k.expresion);if(l)var p=(p=document.getElementById(l))&&"descartes/macro"==p.type?p.text:a.openExternalFile(l);if(p){var c=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");p=[];l=0;for(var r=c.length;l<r;l++)if(c[l].trim()){var h=c[l].indexOf("=");if(-1!==h){h=b.split(c[l]);for(var m=0,x=h.length;m<x;m++)if(h[m]&&1<h.length&&("id"===f[h[m][0]]||"type"===f[h[m][0]])){p.push(h);
break}}}m=function(c,b){b=g.tokenize(b.replace(/&squot;/g,"'"));for(var d=0,h=b.length;d<h;d++)"identifier"!=b[d].type||a.reservedIds.match("-"+b[d].value+"-")||(b[d].value=k.name+"."+b[d].value);return(c.match(/^\\expr/)?"\\expr ":"\\decimals ")+g.flatTokens(b)};l=0;for(r=p.length;l<r;l++){var u=(x=p[l]||[],x[0])&&"id"===x[0][0];c=0;for(h=x.length;c<h;c++){var n=x[c][0].indexOf(".");-1===n||u?n=f[x[c][0]]:(n=f[x[c][0].substring(n+1)],x[c][0]=k.name+"."+x[c][0]);if(!("font"===n||"font_family"===n||
("fill"===n||"color"===n||"border"===n||"arrow"===n)&&"("!==x[c][1].charAt(0)||"file"===n&&x[c][1].match(e)||"id"!==n&&void 0!==f[x[c][1]])||"radius"===n)if("text"==n)if(x[c][1].match(/\{\\rtf1/))n=x[c][1],n=n.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,m),n=n.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,m),x[c][1]=n;else{var q=b.parseText(x[c][1]).textElementsMacros;for(var w=0,y=q.length;w<y;w++){n=g.tokenize(q[w].replace(/&squot;/g,"'"));for(var B=
0,C=n.length;B<C;B++)"identifier"!==n[B].type||a.reservedIds.match("-"+n[B].value+"-")||(n[B].value=k.name+"."+n[B].value);n=g.flatTokens(n).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");q[w]=n.substring(1,n.length-1)}x[c][1]=q.join("")}else{q=x[c][1].replace(/&squot;/g,"'").split(";");w=0;for(y=q.length;w<y;w++){n=g.tokenize(q[w].replace(/\\n/g,";"));B=0;for(C=n.length;B<C;B++)"identifier"!==n[B].type||a.reservedIds.match("-"+n[B].value+"-")||(n[B].value=k.name+"."+n[B].value);
q[w]=g.flatTokens(n)}x[c][1]=q.join(";")}}}l=0;for(r=p.length;l<r;l++)if(p[l][0]){m="";x=!1;c=0;for(h=p[l].length;c<h;c++)"type"===f[p[l][c][0]]&&d.match("-"+f[p[l][c][1]]+"-")&&(x=!0),m=m+p[l][c][0]+"='"+p[l][c][1]+"' ";p[l]=m+(x?" space='"+k.spaceID+"'":"");x?k.graphics.push(b.parseGraphic(p[l],k.abs_coord,k.background,k.inirot)):b.parseAuxiliar(p[l])}}return k};$jscomp.inherits(m,a.Graphic);m.prototype.update=function(){q=this.evaluator.eval(this.inipos);this.iniPosX=q[0][0];this.iniPosY=q[0][1]};
m.prototype.drawAux=function(a){for(var b=0,d=this.graphics.length;b<d;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=m;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var f=Math.sqrt,d=Math.sin,e=Math.cos,q=Math.abs,m,b,l,k,g,p,c,r,h,v,x,u,n,z,w,y=function(a,c,b,d){this.x=a||0;this.y=c||0;this.z=b||0;this.w=d||0;this.adjustDec()};y.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var B=function(a,c,b,d,h,e,n,k,g,f,l,r,p,m,x,u){this.a00=a||0;this.a01=c||0;this.a02=b||0;this.a03=d||0;this.a10=h||0;this.a11=e||0;this.a12=n||0;this.a13=k||0;
this.a20=g||0;this.a21=f||0;this.a22=l||0;this.a23=r||0;this.a30=p||0;this.a31=m||0;this.a32=x||0;this.a33=u||0};B.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};B.prototype.multiplyVector4=function(a){return new y(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};B.prototype.translate=function(a){return new B(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)};B.prototype.rotateX=function(a){b=d(a);l=e(a);r=this.a10;h=this.a11;v=this.a12;
x=this.a13;u=this.a20;n=this.a21;z=this.a22;w=this.a23;return new B(this.a00,this.a01,this.a02,this.a03,r*l+u*b,h*l+n*b,v*l+z*b,x*l+w*b,r*-b+u*l,h*-b+n*l,v*-b+z*l,x*-b+w*l,this.a30,this.a31,this.a32,this.a33)};B.prototype.rotateY=function(a){b=d(a);l=e(a);k=this.a00;g=this.a01;p=this.a02;c=this.a03;u=this.a20;n=this.a21;z=this.a22;w=this.a23;return new B(k*l+u*-b,g*l+n*-b,p*l+z*-b,c*l+w*-b,this.a10,this.a11,this.a12,this.a13,k*b+u*l,g*b+n*l,p*b+z*l,c*b+w*l,this.a30,this.a31,this.a32,this.a33)};B.prototype.rotateZ=
function(a){b=d(a);l=e(a);k=this.a00;g=this.a01;p=this.a02;c=this.a03;r=this.a10;h=this.a11;v=this.a12;x=this.a13;return new B(k*l+r*b,g*l+h*b,p*l+v*b,c*l+x*b,k*-b+r*l,g*-b+h*l,p*-b+v*l,c*-b+x*l,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return f(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(c){m=a.norm3D(c);if(0===m)return{x:0,y:0,z:0};if(1===m)return{x:c.x,y:c.y,z:c.z};m=1/m;return{x:c.x*m,y:c.y*m,z:c.z*m}};a.dotProduct3D=function(a,c){return a.x*
c.x+a.y*c.y+a.z*c.z};a.crossProduct3D=function(a,c){return{x:a.y*c.z-a.z*c.y,y:a.z*c.x-a.x*c.z,z:a.x*c.y-a.y*c.x}};a.scalarProduct3D=function(a,c){return{x:a.x*c,y:a.y*c,z:a.z*c}};a.subtract3D=function(a,c){return{x:a.x-c.x,y:a.y-c.y,z:a.z-c.z}};a.add3D=function(a,c){return{x:a.x+c.x,y:a.y+c.y,z:a.z+c.z}};a.equals3DEpsilon=function(a,c,b){return q(a.x-c.x)<=b&&q(a.y-c.y)<=b&&q(a.z-c.z)<=b};a.Vector4D=y;a.Matrix4x4=B;return a}(descartesJS||{});
descartesJS=function(a){function f(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function d(a,c){a.textNode=null;a.lineCap=l;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);h=1;for(v=this.projVert.length;h<v;h++)a.lineTo(this.projVert[h].x,this.projVert[h].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=c.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function e(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";c=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,c)}function q(a){a.textNode=null;a.lineCap=l;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function m(c,b,d){return a.normalize3D(a.crossProduct3D(a.subtract3D(c,
b),a.subtract3D(c,d)))}if(a.loadLib)return a;var b=2*Math.PI,l=lineJoin="round",k,g,p,c,r,h,v,x,u,n,z,w,y,B=function(a,c){Object.assign(this,a);this.space=c;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=f:"face"===this.type?(this.normal=m(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=d):"text"===this.type?this.draw=e:"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]})};B.prototype.computeDepth=function(c){this.space=c;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};h=0;for(v=this.vertices.length;h<v;h++)this.spaceVertices[h]=c.rotateVertex(this.vertices[h]),this.average.x+=this.spaceVertices[h].x,this.average.y+=this.spaceVertices[h].y,this.average.z+=this.spaceVertices[h].z;this.average=a.scalarProduct3D(this.average,
1/v);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=m(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));h=0;for(v=this.vertices.length;h<v;h++)this.newSpaceVert[h]=this.spaceVertices[h],this.projVert[h]=this.newProjVert[h]=c.project(this.spaceVertices[h]);2<this.vertices.length&&(this.direction=m(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;h=0;for(v=this.vertices.length;h<v;h++)x=a.norm3D(a.subtract3D(this.spaceVertices[h],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,x),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,x);h=0;for(v=this.vertices.length;h<v;h++)this.minx>this.projVert[h].x&&(this.minx=this.projVert[h].x),this.maxx<this.projVert[h].x&&(this.maxx=this.projVert[h].x),this.miny>this.projVert[h].y&&(this.miny=this.projVert[h].y),
this.maxy<this.projVert[h].y&&(this.maxy=this.projVert[h].y)};B.prototype.removeDoubles=function(){if("edge"!==this.type){r=[];h=0;for(v=this.vertices.length;h<v;h++)(1E-8<Math.abs(this.vertices[h].x-this.vertices[(h+1)%v].x)||1E-8<Math.abs(this.vertices[h].y-this.vertices[(h+1)%v].y)||1E-8<Math.abs(this.vertices[h].z-this.vertices[(h+1)%v].z)||1E-8<Math.abs(this.vertices[h].w-this.vertices[(h+1)%v].w))&&r.push(this.vertices[h]);0===r.length&&r.push(this.vertices[0]);this.vertices=r}};B.prototype.drawText=
function(c,b,d,h,e,n,f,l,r,m,x){k=this.evaluator;c.textNode=b;n=k.eval(this.offset_dist);f=-a.degToRad(k.eval(this.offset_angle));d+=n*Math.cos(f);h+=n*Math.sin(f);c.textNode.pos={x:d,y:h};b.hasContent&&(b.draw(c,e,d,h,!0),p=this.fromPoint?b.textNodes.metrics.w/2:0,g=this.fromPoint?b.textNodes.metrics.h/2:0,b.draw(c,e,d-p,h-g))};B.prototype.splitFace=function(c){if(this.intersects(c)){var b=i2=null,d=ix2=0,h,e;var n=this.vertices;var k=c.vertices;var g=0;for(e=k.length;g<e;g++){var f=this.intersection(k[g],
k[(g+1)%e]);if(null!==f)if(null===b){if(b=f,d=g,2===k.length){i2=b;break}}else if(!a.equals3DEpsilon(f,b,1E-8)){i2=f;ix2=g;break}}if(null!==b&&null!==i2){g=this.isInterior(b)||this.isInterior(i2);var l=h=null;if(!g&&3<=k.length)for(e=0,n=n.length;e<n;e++)if(f=c.intersection(this.vertices[e],this.vertices[(e+1)%n]),null!==f)if(null===h)h=f;else if(!a.equals3DEpsilon(f,h,1E-8)){l=f;break}if(g||null!==h&&null!==l&&c.isInterior(h)&&c.isInterior(l)){l=!0;n=f=null;if(2===k.length)a.equals3DEpsilon(b,k[0],
1E-8)||a.equals3DEpsilon(b,k[1],1E-8)?l=!1:(f=[],f[0]=k[0],f[1]=b,n=[],n[0]=b,n[1]=k[1]);else for(f=[],n=[],g=e=h=0;g<k.length;g++)g<d?f[h++]=k[g]:g==d?(f[h++]=k[g],f[h++]=b,n[e++]=b):g<ix2?n[e++]=k[g]:g==ix2?(n[e++]=k[g],n[e++]=i2,f[h++]=i2):f[h++]=k[g];if(l){b=[];b[0]=new B({vertices:f,type:"face",frontColor:c.frontColor,backColor:c.backColor,edges:c.edges,model:c.model},this.space);b[0].removeDoubles();b[0].normal=c.normal;b[1]=new B({vertices:n,type:"face",frontColor:c.frontColor,backColor:c.backColor,
edges:c.edges,model:c.model},this.space);b[1].removeDoubles();b[1].normal=c.normal;if(2<b[0].vertices.length)return 2<b[1].vertices.length?b:[b[0]];if(2<b[1].vertices.length)return[b[1]]}}}}return[c]};B.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};B.prototype.intersectsPlane=function(c){var b=this.vertices;var d=c.vertices;if(0<b.length){var h=a.dotProduct3D(d[0],c.normal);var e=a.dotProduct3D(b[0],c.normal);if(1E-8>Math.abs(h-e))return!0;for(var n=1,k=
b.length;n<k;n++)if(d=a.dotProduct3D(b[n],c.normal),1E-8>Math.abs(h-d)||d>h&&e<h||d<h&&e>h)return!0}return!1};B.prototype.intersection=function(c,b){var d=this.vertices;if(0<d.length){b=a.subtract3D(b,c);var h=a.dotProduct3D(b,this.normal);if(0!==h&&(d=a.dotProduct3D(a.subtract3D(d[0],c),this.normal)/h,-1E-8<d&&1.00000001>d))return a.add3D(c,a.scalarProduct3D(b,d))}return null};B.prototype.isInterior=function(c){var b=this.vertices;if(0<b.length)for(var d=0,h=a.subtract3D(b[0],c),e=0,n=b.length;e<
n;e++){var k=a.subtract3D(b[(e+1)%n],c),g=a.dotProduct3D(a.crossProduct3D(h,k),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(h,k))break}else{if(0>d&&0<g||0<d&&0>g)return!1;h=k;d=g}}return!0};B.prototype.inFrontOf=function(a,c,b){if(this.minDistanceToEye>=c.maxDistanceToEye||this.maxx<=c.minx||this.minx>=c.maxx||this.maxy<=c.miny||this.miny>=c.maxy)return!1;for(w=0;3>w;w++)if(u=null,u=0===w?this.intersections(c):1===w?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=u&&0<u.length){for(y=
0;y<u.length;y++)a.push(u[y]);h=0;for(v=u.length;h<v;h++){n=u[h];z=this.space.rayFromEye(n.x,n.y);try{t=this.distanceToEyeAlong(z)-c.distanceToEyeAlong(z);if(t<=-b)return!0;if(t>=b)return!1}catch(H){}}}return!1};B.prototype.intersections=function(c){for(var b=[],d,h,e,n=new a.R2,k=this.newSpaceVert,g=c.newSpaceVert,f=this.newProjVert,l=c.newProjVert,r=0,p=k.length;r<p;r++){c=k[r];d=k[(r+1)%p];for(var m=0,x=g.length;m<x;m++)h=g[m],e=g[(m+1)%x],c!=h&&c!=e&&d!=h&&d!=e&&(h=n.intersection(f[r],f[(r+1)%
p],l[m],l[(m+1)%x]),null!=h&&b.push(h))}return b};B.prototype.distanceToEyeAlong=function(c){c=a.dotProduct3D(this.normal,c);if(1E-6<Math.abs(c))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/c;throw new Exception("Face is invisible");};B.prototype.verticesContainedIn=function(a){for(var c=[],b=this.newSpaceVert,d=this.newProjVert,h=0,e=b.length;h<e;h++)!a.isVertex(b[h])&&a.appearsToContain(d[h])&&c.push(d[h]);return c};B.prototype.appearsToContain=function(a){for(var c=
0,b,d=this.newProjVert,h=0,e=this.newSpaceVert.length;h<e;h++){b=(d[h].x-a.x)*(d[(h+1)%e].y-a.y)-(d[(h+1)%e].x-a.x)*(d[h].y-a.y);if(0!=c)if(1E-8>Math.abs(b)){if(1E-8<Math.abs(d[h].x-d[(h+1)%e].x))return Math.min(d[h].x,d[(h+1)%e].x)<=a.x+1E-8&&a.x<=Math.max(d[h].x,d[(h+1)%e].x)+1E-8;if(1E-8<Math.abs(d[h].y-d[(h+1)%e].y))return Math.min(d[h].y,d[(h+1)%e].y)<=a.y+1E-8&&a.y<=Math.max(d[h].y,d[(h+1)%e].y)+1E-8}else if(0<c&&0>b||0>c&&0<b)return!1;c=b}return!0};B.prototype.isVertex=function(c){for(var b=
this.newSpaceVert,d=0,h=b.length;d<h;d++)if(a.equals3DEpsilon(c,b[d],1E-8))return!0;return!1};a.Primitive3D=B;return a}(descartesJS||{});
descartesJS=function(a){function f(a){for(var c=[],b=0,d,e=a.length,k=a.length-1;-1<k;k--)d=a.charAt(k),0==b?"="==d&&(b=1):1==b?" "!=d&&(b="<"===d||">"===d?0:2):2==b&&" "==d&&(c.unshift(a.substring(k+1,e)),e=k,b=0);c.unshift(a.substring(0,e));return c}if(a.loadLib)return a;var d={x:0,y:0,z:0},e,q,m,b,l,k=a.degToRad,g,p=function(c,b){this.parent=c;this.evaluator=c.evaluator;var d=c.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=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,b);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=c.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=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};p.prototype.getSpace=function(){for(var a=this.parent.spaces,b,d=0,
e=a.length;d<e;d++)if(b=a[d],b.id==this.spaceID)return b;return a[0]};p.prototype.getFamilyValues=function(){e=this.evaluator;q=e.eval(this.family_interval);this.familyInf=q[0][0];this.familySup=q[0][1];this.fSteps=Math.round(e.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};p.prototype.buildFamilyPrimitives=function(){e=this.evaluator;this.getFamilyValues();m=e.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)e.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,e.eval(this.drawif)&&this.buildPrimitives();e.setVariable(this.family,m)};p.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};p.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(k(b[0][0])),this.inirotM=
this.inirotM.rotateX(k(b[0][1])),this.inirotM=this.inirotM.rotateZ(k(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(k(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(k(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(k(b[0][2])));b=this.evaluator.eval(this.inipos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(d);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(k(b[0][0])),this.endrotM=this.endrotM.rotateX(k(b[0][1])),this.endrotM=this.endrotM.rotateZ(k(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(k(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(k(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(k(b[0][2])));b=this.evaluator.eval(this.endpos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(d)};p.prototype.transformVertex=function(a){this.inirotEuler?l=
this.inirotM.multiplyVector4(a):(l=this.inirotM_X.multiplyVector4(a),l=this.inirotM_Y.multiplyVector4(l),l=this.inirotM_Z.multiplyVector4(l));l=this.iniposM.multiplyVector4(l);this.endrotEuler?l=this.endrotM.multiplyVector4(l):(l=this.endrotM_X.multiplyVector4(l),l=this.endrotM_Y.multiplyVector4(l),l=this.endrotM_Z.multiplyVector4(l));l=this.endposM.multiplyVector4(l);this.macroChildren&&(l=this.applyMacroTransform(l));l.adjustDec();return l};p.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
l=this.macro_inirotM.multiplyVector4(a):(l=this.macro_inirotM_X.multiplyVector4(a),l=this.macro_inirotM_Y.multiplyVector4(l),l=this.macro_inirotM_Z.multiplyVector4(l));l=this.macro_iniposM.multiplyVector4(l);this.macro_endrotEuler?l=this.macro_endrotM.multiplyVector4(l):(l=this.macro_endrotM_X.multiplyVector4(l),l=this.macro_endrotM_Y.multiplyVector4(l),l=this.macro_endrotM_Z.multiplyVector4(l));return l=this.macro_endposM.multiplyVector4(l)};p.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],d=0,e=a.length;d<e;d++)""!==a[d].trim()&&(b=b.concat(f(a[d])));d=0;for(e=b.length;d<e;d++)b[d]=this.evaluator.parser.parse(b[d],!0);return b};p.prototype.splitFace=function(a){for(var c=0,b=this.primitives.length;c<b;c++)if(g=[],"face"===this.primitives[c].type){for(var d=0,e=a.primitives.length;d<e;d++)"face"===a.primitives[d].type?g=g.concat(this.primitives[c].splitFace(a.primitives[d])):g.push(a.primitives[d]);a.primitives=g}};a.Graphic3D=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();d=f.eval(this.expresion);e=d[0][0];q=d[0][1];m=d[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,q,m,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:f.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||f.parser.parse("10"),this.offset_angle=this.offset_angle||f.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,q,m,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:f.eval(this.decimals),fixed:this.fixed,evaluator:f,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();l=k.getVariable("u");k.setVariable("u",this.Nu);g=k.eval(this.expresion);f=g[0][0];d=g[0][1];e=g[0][2];q=g[1][0];m=g[1][1];b=g[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,
d,e,1)),this.transformVertex(new a.Vector4D(q,m,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));k.setVariable("u",l)};a.Segment3D=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p,c,r,h,v,x=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.expresion=b.parseExpression();return b};$jscomp.inherits(x,a.Graphic3D);x.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();q=f.getVariable("x");m=f.getVariable("y");b=f.getVariable("z");
d=f.getVariable("u");e=f.getVariable("v");f.setVariable("u",0);f.setVariable("v",0);l=parseInt(f.eval(this.Nu));k=parseInt(f.eval(this.Nv));g=[];for(c=0;c<=l;c++)for(f.setVariable("u",c/l),r=0;r<=k;r++){f.setVariable("v",r/k);h=0;for(v=this.expresion.length;h<v;h++)f.eval(this.expresion[h]);g.push(this.transformVertex(new a.Vector4D(f.getVariable("x"),f.getVariable("y"),f.getVariable("z"),1)))}var x=this.color.getColor(),n=this.backcolor.getColor(),z=this.edges?this.edges.getColor():"";for(c=0;c<
l;c++)for(r=0;r<k;r++)p=[],p.push(g[r+c*k+c]),p.push(g[r+1+c*k+c]),p.push(g[r+2+(c+1)*k+c]),p.push(g[r+1+(c+1)*k+c]),this.primitives.push(new a.Primitive3D({vertices:p,type:"face",frontColor:x,backColor:n,edges:z,model:this.model},this.space));f.setVariable("x",q);f.setVariable("y",m);f.setVariable("z",b);f.setVariable("u",d);f.setVariable("v",e)};a.Surface3D=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,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(){l=this.evaluator;this.updateMVMatrix();k=l.eval(this.expresion);for(var g=this.color.getColor(),c=0,r=k.length-1;c<r;c++)f=k[c][0],d=k[c][1],e=k[c][2],q=k[c+1][0],m=k[c+1][1],b=k[c+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,
d,e,1)),this.transformVertex(new a.Vector4D(q,m,b,1))],type:"edge",frontColor:g,lineWidth:l.eval(this.width)},this.space))};a.Polygon3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.expresion=d.parseExpression();return d};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){l=this.evaluator;this.updateMVMatrix();q=l.getVariable("x");m=l.getVariable("y");b=l.getVariable("z");e=l.getVariable("u");l.setVariable("u",0);d=l.eval(this.Nu);f=[];for(var k=0;k<=d;k++){l.setVariable("u",k/d);for(var p=0,c=
this.expresion.length;p<c;p++)l.eval(this.expresion[p]);f.push(this.transformVertex(new a.Vector4D(l.getVariable("x"),l.getVariable("y"),l.getVariable("z"),1)))}k=0;for(p=f.length-1;k<p;k++)this.primitives.push(new a.Primitive3D({vertices:[f[k],f[k+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:l.eval(this.width)},this.space));this.fill&&2<f.length&&this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));l.setVariable("x",q);l.setVariable("y",b);l.setVariable("z",m);l.setVariable("u",e)};a.Curve3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p,c,r=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){p=this.evaluator;this.updateMVMatrix();c=p.eval(this.expresion);f=c[0][0];d=c[0][1];e=c[0][2];q=c[1][0];m=c[1][1];b=c[1][2];l=c[2][0];k=c[2][1];g=c[2][2];var h=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,d,e,1)),this.transformVertex(new a.Vector4D(l,
k,g,1)),this.transformVertex(new a.Vector4D(q,m,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:h,model:this.model},this.space))};a.Triangle3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q=function(d,b){return a.Graphic3D.call(this,d,b)||this};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){d=this.evaluator;this.updateMVMatrix();e=d.eval(this.expresion);f=[];for(var m=e.length-1;0<=m;m--)f.push(this.transformVertex(new a.Vector4D(e[m][0],e[m][1],e[m][2],1)));m=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:m,model:this.model},this.space))};a.Face3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("2");d.length=d.length||b.evaluator.parser.parse("2");return d};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();f=b.eval(this.Nu);d=[this.transformVertex(new a.Vector4D(0,0,0,1))];e=b.eval(this.width)/2;q=b.eval(this.length)/2;m=2*Math.PI/f;for(var k=0;k<f;k++)d.push(this.transformVertex(new a.Vector4D(e*
Math.cos(m*k),q*Math.sin(m*k),0,1)));var g=this.color.getColor(),l=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";for(k=0;k<f;k++)this.primitives.push(new a.Primitive3D({vertices:[d[0],k+2<=f?d[k+2]:d[1],d[k+1]],type:"face",frontColor:g,backColor:l,edges:c,model:this.model},this.space))};a.Polireg3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){f=this.evaluator;d=f.eval(this.expresion);e=d[0][0];q=d[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(e,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:f.eval(this.decimals),fixed:this.fixed,displace:0,
isText:!0,evaluator:f,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=m;return a}(descartesJS||{});
descartesJS=function(a,f){if(a.loadLib)return a;var d=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,q,m,b=0,l=function(k,g){var l=a.Graphic.call(this,k,g)||this;l.expresion=l.expresion||void 0;l.inirot=l.inirot||"(0,0,0)";l.inirotEuler=l.inirotEuler||!1;l.inipos=l.inipos||k.evaluator.parser.parse("(0,0,0)");l.endrot=l.endrot||
"(0,0,0)";l.endrotEuler=l.endrotEuler||!1;l.endpos=l.endpos||k.evaluator.parser.parse("(0,0,0)");l.name=l.name||"_descartes_empty_name_"+b++;Object.assign(l,g);l.inirot.match("Euler")&&(l.inirot=l.inirot.replace("Euler",""),l.inirotEuler=!0);l.endrot.match("Euler")&&(l.endrot=l.endrot.replace("Euler",""),l.endrotEuler=!0);l.inirot=l.evaluator.parser.parse(l.inirot);l.endrot=l.evaluator.parser.parse(l.endrot);l.inirotM=new a.Matrix4x4;l.inirotM_X=new a.Matrix4x4;l.inirotM_Y=new a.Matrix4x4;l.inirotM_Z=
new a.Matrix4x4;l.iniposM=new a.Matrix4x4;l.endrotM=new a.Matrix4x4;l.endrotM_X=new a.Matrix4x4;l.endrotM_Y=new a.Matrix4x4;l.endrotM_Z=new a.Matrix4x4;l.endposM=new a.Matrix4x4;l.graphics=[];k=k.lessonParser;var c=new a.Tokenizer;if(void 0==l.expresion)return l;"'"!==l.expresion.charAt(0)&&(l.expresion="'"+l.expresion+"'");l.expresion=l.evaluator.parser.parse(l.expresion);g=l.evaluator.eval(l.expresion);if(g)var r=(r=document.getElementById(g))&&"descartes/macro"==r.type?r.text:a.openExternalFile(g);
if(r){var h=a.convertHTMLEntities(r).replace(/\r/g,"").split("\n");r=[];g=0;for(var m=h.length;g<m;g++){var x=h[g].indexOf("=");if(-1!==x){x=k.split(h[g]);for(var u=0,n=x.length;u<n;u++)if(x[u]&&1<x.length&&("id"===f[x[u][0]]||"type"===f[x[u][0]])){r.push(x);break}}}g=0;for(m=r.length;g<m;g++){n=(u=r[g]||[],u[0])&&"id"===u[0][0];var q=!1;h=0;for(x=u.length;h<x;h++){var w=u[h][0].indexOf(".");-1===w||n?w=f[u[h][0]]:(w=f[u[h][0].substring(w+1)],u[h][0]=l.name+"."+u[h][0]);"type"===w&&"surface"===f[u[h][1]]&&
(q=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==u[h][1].charAt(0)||"file"===w&&u[h][1].match(e)||"id"!==w&&void 0!==f[u[h][1]]||q&&"expresion"===w)||"width"===w||"height"===w||"length"===w)if("text"==w)if(u[h][1].match(/\{\\rtf1/)){w=u[h][1];var y=l;var B=function(b,d){d=c.tokenize(d.replace(/&squot;/g,"'"));for(var h=0,e=d.length;h<e;h++)"identifier"!=d[h].type||a.reservedIds.match("-"+d[h].value+"-")||(d[h].value=y.name+"."+d[h].value);return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+c.flatTokens(d)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,B);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,B);u[h][1]=w}else{B=k.parseText(u[h][1]).textElementsMacros;for(var C=0,J=B.length;C<J;C++){w=c.tokenize(B[C].replace(/&squot;/g,"'"));for(var G=0,H=w.length;G<H;G++)"identifier"!==w[G].type||a.reservedIds.match("-"+w[G].value+"-")||(w[G].value=l.name+"."+w[G].value);w=c.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,
"[").replace(/\)\+'/g,"]");B[C]=w.substring(1,w.length-1)}u[h][1]=B.join("")}else{B=u[h][1].replace(/&squot;/g,"'").split(";");C=0;for(J=B.length;C<J;C++){w=c.tokenize(B[C].replace(/\\n/g,";"));G=0;for(H=w.length;G<H;G++)"identifier"!==w[G].type||a.reservedIds.match("-"+w[G].value+"-")||(w[G].value=l.name+"."+w[G].value);B[C]=c.flatTokens(w)}u[h][1]=B.join(";")}}}g=0;for(m=r.length;g<m;g++)if(r[g][0]){u="";n=!1;h=0;for(x=r[g].length;h<x;h++)"type"===f[r[g][h][0]]&&d.match("-"+f[r[g][h][1]]+"-")&&
(n=!0),u=u+r[g][h][0]+"='"+r[g][h][1]+"' ";r[g]=u+(n?" space='"+l.spaceID+"'":"");n?l.graphics.push(k.parse3DGraphic(r[g],l.abs_coord,l.background,l.inirot)):k.parseAuxiliar(r[g])}}g=0;for(m=l.graphics.length;g<m;g++)l.graphics[g].macroChildren=!0;return l};$jscomp.inherits(l,a.Graphic);l.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var b=0,d=this.fSteps;b<=d;b++)evaluator.setVariable(this.family,
this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};l.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};l.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var b=
this.graphics.length;a<b;a++)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 d=a+1;d<b;d++)m=this.graphics[d],(m.split||this.split)&&q.splitFace(m);this.primitives=this.primitives.concat(q.primitives||[])}};l.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=
this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);tmpExpr=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),
this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.endpos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};
l.prototype.drawAux=function(a){};a.Macro3D=l;return a}(descartesJS||{},babel);
descartesJS=function(a){function f(a,c,b,h,e){d.call(this,a/u,a/u,a/u,h,e)}function d(a,c,b,d,h){a/=2;c/=2;b/=2;this.changeGeometry(a,c,b,d,h)||(this.vertices=[new n(a,b,c,1),new n(a,-b,c,1),new n(a,b,-c,1),new n(a,-b,-c,1),new n(-a,b,c,1),new n(-a,-b,c,1),new n(-a,b,-c,1),new n(-a,-b,-c,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,c,b,d,h))}function e(a,c,b,d,h){a/=2;if(!this.changeGeometry(a,c,b,d,h)){var e=2*Math.PI/3,k=2*a*Math.sqrt(2)/3,f=-a/
3,g=k*Math.cos(e)+0*Math.sin(e);e=-k*Math.sin(e)+0*Math.cos(e);this.vertices=[new n(0,0,a,1),new n(g,e,f,1),new n(g,-e,f,1),new n(k,0,f,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,c,b,d,h)}}function q(a,c,b,d,h){a/=2;this.changeGeometry(a,c,b,d,h)||(this.vertices=[new n(0,0,a,1),new n(a,0,0,1),new n(-a,0,0,1),new n(0,a,0,1),new n(0,-a,0,1),new n(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,c,b,d,h))}function m(c,
b,d,h,e){c/=Math.PI;if(!this.changeGeometry(c,b,d,h,e)){I=c/1.6180339887;D=1.6180339887*c;this.vertices=[new n(c,c,c,1),new n(c,c,-c,1),new n(c,-c,c,1),new n(c,-c,-c,1),new n(-c,c,c,1),new n(-c,c,-c,1),new n(-c,-c,c,1),new n(-c,-c,-c,1),new n(0,I,D,1),new n(0,I,-D,1),new n(0,-I,D,1),new n(0,-I,-D,1),new n(I,D,0,1),new n(I,-D,0,1),new n(-I,D,0,1),new n(-I,-D,0,1),new n(D,0,I,1),new n(D,0,-I,1),new n(-D,0,I,1),new n(-D,0,-I,1)];M=(new a.Matrix4x4).setIdentity().rotateY(-v/6);F=0;for(E=this.vertices.length;F<
E;F++)this.vertices[F]=M.multiplyVector4(this.vertices[F]);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(c,b,d,h,e)}}function b(c,b,d,h,e){c/=3.8;if(!this.changeGeometry(c,b,d,h,e)){D=1.6180339887*c;this.vertices=[new n(0,c,D,1),new n(0,c,-D,1),new n(0,-c,D,1),new n(0,-c,-D,1),new n(c,D,0,1),new n(c,-D,0,1),new n(-c,D,0,1),new n(-c,-D,0,1),
new n(D,0,c,1),new n(D,0,-c,1),new n(-D,0,c,1),new n(-D,0,-c,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]];M=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);F=0;for(E=this.vertices.length;F<E;F++)this.vertices[F]=M.multiplyVector4(this.vertices[F]);this.updateValues(c,b,d,h,e)}}function l(a,c,b,d,e){a/=2;this.isSphere?b=c=a:(c/=2,b/=2);if(!this.changeGeometry(a,
c,b,d,e)){this.vertices=[new n(0,0,c,1)];for(F=1;F<d;F++)for(G=F*v/d,K=0;K<e;K++)J=K*x/e,y=a*r(G)*h(J),B=b*r(G)*r(J),C=c*h(G),this.vertices.push(new n(y,B,C,1));this.vertices.push(new n(0,0,-c,1));this.faces=[];for(F=0;F<e;F++)this.faces.push([0,(F+1)%e+1,F%e+1]);for(F=1;F<d-1;F++)for(K=0;K<e;K++)this.faces.push([K+1+(F-1)*e,(K+1)%e+1+(F-1)*e,(K+1)%e+1+F*e,K+1+F*e]);for(F=0;F<e;F++)this.faces.push([this.vertices.length-1,this.vertices.length-1-e+F,this.vertices.length-1-e+(F+1)%e]);this.updateValues(a,
c,b,d,e)}}function k(a,c,b,d,e){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,d,e)){this.vertices=[];for(F=0;F<e;F++)for(K=0;K<d;K++)y=a*(e-F)/e*h(K*x/d),B=b*(e-F)/e*r(K*x/d),C=c-2*F*c/e,this.vertices.push(new n(y,B,C,1));this.vertices.push(new n(0,0,-c,1));this.faces=[];for(F=0;F<e-1;F++)for(K=0;K<d;K++)this.faces.push([K+F*d,(K+1)%d+F*d,(K+1)%d+(F+1)*d,K+(F+1)*d]);for(F=0;F<d;F++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+F,this.vertices.length-1-d+(F+1)%d]);this.updateValues(a,
c,b,d,e)}}function g(a,c,b,d,e){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,d,e)){this.vertices=[];for(F=0;F<e+1;F++)for(K=0;K<d;K++)y=a*h(K*x/d),B=b*r(K*x/d),C=c-2*F*c/e,this.vertices.push(new n(y,B,C,1));this.faces=[];for(F=0;F<e;F++)for(K=0;K<d;K++)this.faces.push([K+F*d,(K+1)%d+F*d,(K+1)%d+(F+1)*d,K+(F+1)*d]);this.updateValues(a,c,b,d,e)}}function p(a,c,b,d,e){a/=2;c/=2;b/=2;H=z.eval(this.R);A=z.eval(this.r);if(!this.changeGeometry(a,c,b,d,e)){this.vertices=[];for(F=0;F<e+1;F++)for(K=0;K<d;K++)y=
-(H+A*r(x*K/d))*r(x*F/e),B=(H+A*r(x*K/d))*h(x*F/e),C=A*h(x*K/d),this.vertices.push(new n(y,B,C,1));this.faces=[];for(F=0;F<e;F++)for(K=0;K<d;K++)this.faces.push([K+F*d,K+(F+1)*d,(K+1)%d+(F+1)*d,(K+1)%d+F*d]);this.updateValues(a,c,b,d,e)}}function c(){this.vertices=[];this.faces=[];F=0;for(E=this.fileData.length;F<E;F++)N=this.fileData[F],N.match(/^V\(/)?(O=N.substring(2,N.length-1).split(",").map(parseFloats),this.vertices.push(new n(O[0]||0,O[1]||0,O[2]||0,1))):N.match(/^F\(/)&&(O=N.substring(2,
N.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var r=Math.sin,h=Math.cos,v=Math.PI,x=2*v,u=Math.sqrt(3),n,z,w,y,B,C,J,G,H,A,I,D,M,N,O,F,E,K,L,P=function(h,r){r=a.Graphic3D.call(this,h,r)||this;r.width=r.width||h.evaluator.parser.parse("2");r.height=r.height||h.evaluator.parser.parse("2");r.length=r.length||h.evaluator.parser.parse("2");r.R=r.R||h.evaluator.parser.parse("2");r.r=r.r||h.evaluator.parser.parse("1");n=a.Vector4D;switch(r.subType){case "cube":r.buildGeometry=
f;break;case "box":r.buildGeometry=d;break;case "tetrahedron":r.buildGeometry=e;break;case "octahedron":r.buildGeometry=q;break;case "sphere":r.isSphere=!0;case "ellipsoid":r.buildGeometry=l;break;case "dodecahedron":r.buildGeometry=m;break;case "icosahedron":r.buildGeometry=b;break;case "cone":r.buildGeometry=k;break;case "cylinder":r.buildGeometry=g;break;case "torus":r.buildGeometry=p;break;case "mesh":r.fileData=a.openExternalFile(r.evaluator.eval(r.file)).split(/\r/),r.buildGeometry=c}return r};
$jscomp.inherits(P,a.Graphic3D);P.prototype.buildPrimitives=function(){z=this.evaluator;this.updateMVMatrix();this.buildGeometry(z.eval(this.width),z.eval(this.height),z.eval(this.length),z.eval(this.Nu),z.eval(this.Nv));var c=this.color.getColor(),b=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";F=0;for(E=this.faces.length;F<E;F++){w=[];K=0;for(L=this.faces[F].length;K<L;K++)w.push(this.transformVertex(this.vertices[this.faces[F][K]]));this.primitives.push(new a.Primitive3D({vertices:w,
type:"face",frontColor:c,backColor:b,edges:d,model:this.model},this.space))}};P.prototype.changeGeometry=function(a,c,b,d,h){return this.oldWidth===a&&this.oldHeight===c&&this.oldLength===b&&this.oldNu===d&&this.oldNv===h};P.prototype.updateValues=function(a,c,b,d,h){this.oldWidth=a;this.oldHeight=c;this.oldLength=b;this.oldNv=h;this.oldNu=d};a.OtherGeometry3D=P;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,d=Math.min,e=Math.PI,q=Math.cos,m=Math.sin,b=Math.abs,l=Math.round,k,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H,A=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c};A.prototype.set=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c;return this};A.prototype.copy=function(){return new A(this.x,this.y)};A.prototype.ix=function(){return l(f(d(this.x,32E3),-32E3))};A.prototype.iy=function(){return l(f(d(this.y,32E3),-32E3))};A.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};A.prototype.norm2=function(){return this.x*this.x+this.y*this.y};A.prototype.norm=function(){return Math.sqrt(this.norm2())};A.prototype.distance=function(a){g=this.copy();g.sub(a);return g.norm()};A.prototype.dot=function(a){return this.x*a.x+this.y*a.y};A.prototype.det=function(a){return this.x*a.y-this.y*a.x};A.prototype.mul=function(a){this.x*=a;this.y*=a};A.prototype.div=function(a){this.x/=a;this.y/=a};A.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};A.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};A.prototype.normalize=function(){k=this.norm();0!=k&&this.div(k)};A.prototype.rotR90=function(){k=this.x;this.x=this.y;this.y=-k};A.prototype.rotL90=function(){k=this.x;this.x=-this.y;this.y=k};A.prototype.rot=function(a){p=this.copy();h=q(a);v=m(a);this.x=p.x*h-p.y*v;this.y=p.x*v+p.y*h};A.prototype.rot2=function(a){this.rot(a*e/180)};A.prototype.intersection=function(a,h,e,k){x=h.x-a.x;u=e.x-k.x;n=e.x-a.x;z=h.y-a.y;w=e.y-k.y;y=e.y-a.y;H=x*
w-u*z;return 1E-6<b(H)?(c=(n*w-y*u)/H,r=(-n*z+y*x)/H,0<=c&&1>=c&&0<=r&&1>=r?new A(a.x+x*c,a.y+z*c):null):(h.x-e.x)*y!=(h.y-e.y)*n?null:a.x!=h.x?(B=d(a.x,h.x),C=f(a.x,h.x),B<=e.x&&e.x<=C?e:B<=k.x&&k.x<=C?k:null):e.x!=k.x?(J=d(e.x,k.x),G=f(e.x,k.x),J<=a.x&&a.x<=G?a:J<=h.x&&h.x<=G?h:null):a.y!=h.y?(B=d(a.y,h.y),C=f(a.y,h.y),B<=e.y&&e.y<=C?e:B<=k.y&&k.y<=C?k:null):e.y!=k.y?(J=d(e.y,k.y),G=f(e.y,k.y),J<=a.y&&a.y<=G?a:J<=h.y&&h.y<=G?h:null):a.x==e.x&&a.y==e.y?a:null};a.R2=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p=function(c,d){this.evaluator=c;this.constraint=d;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];b=
new a.R2(0,0);m=new a.R2(0,0);g=new a.R2(0,0)};p.prototype.getUnitNormal=function(){this.normal.normalize();return g.set(this.normal.x,this.normal.y)};p.prototype.gradient=function(a){f=this.evaluator;b.x=0;b.y=0;l=f.getVariable("x");k=f.getVariable("y");f.setVariable("x",a.x);f.setVariable("y",a.y);this.f0=f.eval(this.constraint);f.setVariable("x",f.getVariable("x")+1E-6);d=f.eval(this.constraint);b.x=(d-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;f.setVariable("x",f.getVariable("x")-1E-6);f.setVariable("y",
f.getVariable("y")+1E-6);d=f.eval(this.constraint);b.y=(d-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;f.setVariable("x",l);f.setVariable("y",k);return b};p.prototype.findZero=function(a,b,d){f=this.evaluator;m.x=a.x;m.y=a.y;l=f.getVariable("x");k=f.getVariable("y");f.setVariable("x",a.x);f.setVariable("y",a.y);this.f0=f.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return m;f.setVariable("x",l);f.setVariable("y",k);for(var c=0;16>c;c++)if(e=m.x,q=m.y,this.normal=
this.gradient(m),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),m.x=e+this.normal.x,m.y=q+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=m.x-a.x,this.normal.y=m.y-a.y),m;return d?m:null};a.R2Newton=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(a,e){this.x=a;this.y=e};f.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};f.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};f.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};f.AXIS_X=new f(1,0);f.AXIS_Y=new f(0,1);a.Vector2D=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=Math.round,e,q,m,b,l,k,g,p,c,r,h,v,x,u=function(c,b){this.parent=c;this.evaluator=c.evaluator;var h=this.parser=c.evaluator.parser;this.id="GraphicControl"!==b.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==b.type?100:350;this.h="Video"!==b.type?23:120;"GraphicControl"!==b.type&&"Audio"!==b.type&&"Video"!==b.type?"TextArea"!==b.type?this.expresion=h.parse("(0,0,100,23)"):(this.expresion=h.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=h.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"!==b.type?"f0f8ff":"cc0022");this.font_size=4>this.parent.version?-1:h.parse("12");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=
h.parse("1");this.activeif=h.parse("1");this.valueExpr=h.parse("0");this.decimals=h.parse("2");this.min=h.parse("-Infinity");this.max=h.parse("Infinity");this.incr=h.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,b);"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;b=this.evaluator.eval(this.expresion);
this.x=d(b[0][0]);this.y=d(b[0][1]);4==b[0].length&&(this.w=d(b[0][2]),this.h=d(b[0][3]));this.actionExec=c.lessonParser.parseAction(this)};u.prototype.init=function(){};u.prototype.update=function(){};u.prototype.draw=function(){};u.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var c=0,b=a.length;c<b;c++){var d=a[c];if(d.id===this.spaceID)return d.addCtr(this),this.zIndex=d.zIndex,this.space=d,d.numericalControlContainer}else{if("external"===this.region)return this.parent.externalSpace.addCtr(this),
this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numericalControlContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);
this.zIndex=a[0].zIndex;return a[0].numericalControlContainer};u.prototype.addControlContainer=function(a){var c=this.getContainer();c.childNodes[0]?c.insertBefore(a,c.childNodes[0]):c.appendChild(a)};u.prototype.updatePositionAndSize=function(){m=b=l=k=!1;g=this.evaluator.eval(this.expresion);p=d(g[0][0]);m=d(this.x)!==p;this.x=p;p=d(g[0][1]);b=d(this.y)!==p;this.y=p;4===g[0].length&&(p=d(g[0][2]),l=d(this.w)!==p,this.w=p,p=d(g[0][3]),k=d(this.h)!==p,this.h=p);if(l||k||m||b)this.init(!0),this.draw()};
u.prototype.formatOutputValue=function(a){x=this.parent;c=a+"";r=this.evaluator.eval(this.decimals);h=c.indexOf(".");-1!=h&&(v=c.substring(h+1),v.length>r&&(c=parseFloat(c).toFixed(r)));this.fixed&&(2!==x.version||2===x.version&&!this.exponentialif)&&(c=parseFloat(a).toFixed(r));this.exponentialif&&0!=parseFloat(c)&&(c=this.fixed&&2!==x.version?parseFloat(c).toExponential(r):parseFloat(c).toExponential(),c=c.toUpperCase().replace("+",""));return c.replace(".",x.decimal_symbol)};u.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()};u.prototype.createGradient=function(a,c){this.linearGradient=this.ctx.createLinearGradient(0,0,0,c);e=c*c;for(a=0;a<c;a++)q=f(a-35*c/100),this.linearGradient.addColorStop(a/c,"rgba(0,0,0,"+q*q*192/e/255+")")};a.Control=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=Math.abs,e=/[\w\.\-//]*(\.gif)/gi,q,m,b,l,k,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H,A,I,D,M,N,O,F,E,K,L=function(c,b){var d=a.Control.call(this,c,b)||this;d.imageSrc=b.imageSrc||"";d.image=b.image||new Image;d.imageOver=b.imageOver||new Image;d.imageDown=b.imageDown||new Image;d.flat=b.flat||!1;d.borderColor=b.borderColor||!1;d.text_align=b.text_align||"center_center";d.image_align=b.image_align||"center_center";d.font_family=a.getFontName(b.font_family||
"arial");d.ratio=c.ratio;-1===d.font_size&&(d.fontSizeNotSet=!0);d.borderColor&&(d.borderColor=new a.Color(d.borderColor));d.text_align=d.text_align.split("_");d.image_align=d.image_align.split("_");d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name+"'");d.classContainer=d.cssClass?" "+d.cssClass+" ":"";if(d.imageSrc.trim().match("^_STYLE_")){d.customStyle=!0;d.btnStyle=[];d.conStyle=[];d.conStyle.textBorder=3;c=d.imageSrc.trim().substring(8).split("|");
for(var h,e=0,k=c.length;e<k;e++)b=c[e],h=b.match(/rgb/g),b.match("class=")?d.classContainer=" "+b.substring(6):b.match("border=")?(d.btnStyle.push({type:"border-style",value:"solid"}),d.btnStyle.push({type:"border-width",value:b.substring(7).trim()+"px"})):b.match("borderRadius=")?(d.btnStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"}),d.conStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"})):b.match("borderColor=")?d.btnStyle.push({type:"border-color",value:(h?
"":"#")+b.substring(12).trim()}):b.match("overColor=")?d.conStyle.overColor=(h?"":"#")+b.substring(10).trim():b.match("downColor=")?d.conStyle.downColor=(h?"":"#")+b.substring(10).trim():b.match("font=")?d.conStyle.font=b.substring(5).trim().toLowerCase():b.match("inactiveColor=")?d.conStyle.inactiveColor=(h?"":"#")+b.substring(14).trim():b.match("inactiveColorBorder=")?d.conStyle.inactiveColorBorder=(h?"":"#")+b.substring(20).trim():b.match("shadowTextBlur=")?d.conStyle.shadowTextBlur=parseFloat(b.substring(15).trim()):
b.match("shadowTextOffsetX=")?d.conStyle.shadowTextOffsetX=parseFloat(b.substring(18).trim()):b.match("shadowTextOffsetY=")?d.conStyle.shadowTextOffsetY=parseFloat(b.substring(18).trim()):b.match("shadowTextColor=")?d.conStyle.shadowTextColor=(h?"":"#")+b.substring(16).trim():b.match("shadowBoxBlur=")?d.conStyle.shadowBoxBlur=parseFloat(b.substring(14).trim()):b.match("shadowBoxOffsetX=")?d.conStyle.shadowBoxOffsetX=parseFloat(b.substring(17).trim()):b.match("shadowBoxOffsetY=")?d.conStyle.shadowBoxOffsetY=
parseFloat(b.substring(17).trim()):b.match("shadowBoxColor=")?d.conStyle.shadowBoxColor=(h?"":"#")+b.substring(15).trim():b.match("shadowInsetBoxBlur=")?d.conStyle.shadowInsetBoxBlur=parseFloat(b.substring(19).trim()):b.match("shadowInsetBoxOffsetX=")?d.conStyle.shadowInsetBoxOffsetX=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxOffsetY=")?d.conStyle.shadowInsetBoxOffsetY=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxColor=")?d.conStyle.shadowInsetBoxColor=(h?"":"#")+b.substring(20).trim():
b.match("textBorder=")&&(d.conStyle.textBorder=parseFloat(b.substring(11).trim()));d.imageSrc="vacio.gif"}d.imageSrc.match("_COLORES_")&&(c=d.imageSrc.split("_"),d.colorInt=new a.Color(c[2]),d.color=new a.Color(c[3]),d.font_size=d.parser.parse(c[5]),d.imageSrc="");d.imageSrc.match(/^\[.*\]?/)?d.imageSrc=d.parser.parse(d.imageSrc.substring(1,d.imageSrc.length-1)):d.imageSrc=d.parser.parse("'"+d.imageSrc+"'");c=d.evaluator.eval(d.imageSrc).toString().trim();if(""!=c)if(b=c.substr(0,c.lastIndexOf(".")),
h=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))d.imageSrc=d.parser.parse("'vacio.gif'"),d.image.ready=1,3===d.parent.version&&(d.name=d.parser.parse("")),d.emptyImage={ready:!0},d.parser.parse("'vacio.gif'");else if(d.image=d.parent.getImage(c),b)try{d.imageOver=d.parent.getImage(b+"_over"+h),d.imageDown=d.parent.getImage(b+"_down"+h)}catch(T){}d.container=a.newHTML("div",{class:"DescartesButtonContainer"+d.classContainer,id:d.id,style:"width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+
d.y+"px;z-index:"+d.zIndex+";"});d.btn=a.newHTML("canvas",{width:d.w*d.ratio,height:d.h*d.ratio,style:"position:absolute;left:0;top:0;width:"+d.w+"px;height:"+d.h+"px;"});d.ctx=d.btn.getContext("2d");d.ctx.imageSmoothingEnabled=!1;d.container.appendChild(d.btn);d.addControlContainer(d.container);d.addEvents();d.init();return d};$jscomp.inherits(L,a.Control);L.prototype.init=function(c){q=this.evaluator;w=this.container;m=this.btn;b=this.ctx;l=q.eval(this.expresion);this.x=l[0][0];this.y=l[0][1];4==
l[0].length&&(this.w=parseInt(l[0][2]),this.h=parseInt(l[0][3]));m.width=this.w*this.ratio;m.height=this.h*this.ratio;m.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+this.h+"px;box-sizing:border-box;");w.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var d=0,h=this.btnStyle.length;d<h;d++)m.style[this.btnStyle[d].type]=this.btnStyle[d].value;if(this.conStyle){d=
0;for(h=this.conStyle.length;d<h;d++)w.style[this.conStyle[d].type]=this.conStyle[d].value;if(this.conStyle.shadowBoxColor){d=this.conStyle.shadowBoxOffsetX||0;h=this.conStyle.shadowBoxOffsetY||2;var e=this.conStyle.shadowBoxBlur||2;w.style.boxShadow=d+"px "+h+"px "+e+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(d=this.conStyle.shadowInsetBoxOffsetX||0,h=this.conStyle.shadowInsetBoxOffsetY||-2,e=this.conStyle.shadowInsetBoxBlur||1,m.style.boxShadow=d+"px "+h+"px "+e+
"px 1px "+this.conStyle.shadowInsetBoxColor+" inset");this.conStyle.shadowTextColor&&(b.shadowBlur=this.conStyle.shadowTextBlur||1,b.shadowOffsetX=this.conStyle.shadowTextOffsetX||0,b.shadowOffsetY=this.conStyle.shadowTextOffsetY||2,b.shadowColor=this.conStyle.shadowTextColor)}this.fontSizeNotSet&&(this.font_size=q.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=q.eval(this.font_size);this.createGradient(this.w,this.h);w.style.display=0<q.eval(this.drawif)?"block":"none";b.textAlign=
"center";b.textBaseline="middle";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.customStyle&&("serif"==this.conStyle.font?b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family:"monospace"==this.conStyle.font&&(b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+a.monospace_font));this.draw(c)};L.prototype.update=function(){q=this.evaluator;w=this.container;m=this.btn;this.activeIfValue=0<q.eval(this.activeif);
this.drawIfValue=0<q.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(w.style.display="block",this.draw(),w.style.cursor=m.style.cursor=this.activeIfValue?"pointer":"not-allowed",this.updatePositionAndSize()):(w.style.display="none",this.buttonClick=!1)};L.prototype.draw=function(d){w=this.container;q=this.evaluator;m=this.btn;b=this.ctx;g=q.eval(this.name);p=this.evaluator.eval(this.imageSrc).toString().trim();if(!d&&(y=this.over===this.oldOver,B=this.buttonClick===this.oldButtonClick,
C=this.activeIfValue===this.oldActiveIfValue,J=this.drawIfValue===this.oldDrawIfValue,G=g===this.oldName,H=p===this.oldImageSrc,A=this.colorInt.getColor()===this.oldBackColor,I=this.color.getColor()===this.oldTextColor,D=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=g,this.oldImageSrc=p,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),
this.oldImageReady=this.image.ready,y&&B&&C&&J&&G&&H&&A&&I&&D))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);k=this.fs_evaluated;w.setAttribute("data-name",g);p?(c="vacio.gif"===p?this.emptyImage:this.parent.getImage(p),M=p.substr(0,p.lastIndexOf(".")),N=p.substr(p.lastIndexOf(".")),O=M+"_over"+N,F=M+"_down"+N,E="vacio.gif"===p?this.emptyImage:this.parent.getImage(O),K="vacio.gif"===p?this.emptyImage:this.parent.getImage(F)):K=E=c=this.emptyImage;b.clearRect(0,0,this.w,this.h);r=h=
0;this.buttonClick&&(r=h=1);"center"==this.text_align[1]?n=f(this.w/2+r)-.5:"left"==this.text_align[1]?(v=b.measureText(g).width,n=v/2+5+r):"right"==this.text_align[1]&&(v=b.measureText(g).width,n=this.w-v/2+r-5);"center"==this.text_align[0]?z=f(this.h/2+h)-.5:"top"==this.text_align[0]?z=k/2+h+4:"bottom"==this.text_align[0]&&(z=this.h-k/2+h-3);c&&("center"==this.image_align[1]?x=parseInt((this.w-c.width)/2)+r:"left"==this.image_align[1]?x=r:"right"==this.image_align[1]&&(x=this.w-c.width+r),"center"==
this.image_align[0]?u=parseInt((this.h-c.height)/2)+h:"top"==this.image_align[0]?u=h:"bottom"==this.image_align[0]&&(u=this.h-c.height+h));if(c&&c.ready)if(c!==this.emptyImage&&c.complete)if(p.match(e))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+p+"')",this.btn.style.backgroundPosition=x+"px "+u+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])w.style.backgroundColor=this.colorInt.getColor();b.drawImage(c,x,u)}else this.emptyImage&&this.customStyle&&
(w.style.backgroundColor=this.colorInt.getColor());else w.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(E!==this.emptyImage&&this.over&&E.ready&&E.complete?O.match(e)?(this.btn.style.backgroundImage="url('"+O+"')",this.btn.style.backgroundPosition=
x+"px "+u+"px"):b.drawImage(E,x,u):this.customStyle&&this.conStyle.overColor&&this.over&&(w.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?K!==this.emptyImage&&this.buttonClick&&K.ready&&K.complete?F.match(e)?(this.btn.style.backgroundImage="url('"+F+"')",this.btn.style.backgroundPosition=x+"px "+u+"px"):b.drawImage(K,x,u):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(w.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!c&&(b.fillStyle="rgba(0,0,0,0.09)",
b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(b.lineWidth=this.conStyle.textBorder,b.strokeStyle=this.conStyle.shadowTextColor,b.strokeText(g,n,z));this.borderColor&&(b.lineWidth=parseInt(k/6),b.strokeStyle=this.borderColor.getColor(),b.strokeText(g,n,z));b.fillText(g,n,z);this.underlined&&(v=b.measureText(g).width,b.strokeStyle=this.color.getColor(),b.lineWidth=f(k/10)||2,b.lineCap="round",b.beginPath(),
b.moveTo(n-v/2+r,z+f(k/2)+f(k/5)-1.5),b.lineTo(n+v/2+r,z+f(k/2)+f(k/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?w.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=x;this._image_pos_y=u};L.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(d(this.colorInt.r-this.color.r)+d(this.colorInt.g-this.color.g)+d(this.colorInt.b-
this.color.b))/255)};L.prototype.buttonPressed=function(){this.updateAndExecAction()};L.prototype.addEvents=function(){function c(b,d,k){a.clearTimeout(e);h.buttonClick&&h.drawIfValue&&h.activeIfValue&&(d.call(h),b=k?b:100,e=a.setTimeout(function(){c(b,d,!1)},b))}function b(b){this.focus();b.preventDefault();b.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();h.whichBtn=a.whichBtn(b);"L"==h.whichBtn&&h.activeIfValue&&(h.buttonClick=!0,h.draw(),"calculate"==h.action&&
(h.evaluator.setVariable(h.id,h.evaluator.eval(h.valueExpr)),c(1E3,h.buttonPressed,!0)),h.btn.removeEventListener("touchend",d),h.btn.addEventListener("touchend",d),h.btn.removeEventListener("mouseup",d),h.btn.addEventListener("mouseup",d))}function d(c){a.newBlobContent=null;this.focus();c.preventDefault();c.stopPropagation();if(h.activeIfValue||h.buttonClick)h.buttonClick=!1,h.draw(),"calculate"!=h.action&&(h.evaluator.setVariable(h.id,h.evaluator.eval(h.valueExpr)),h.buttonPressed()),h.btn.removeEventListener("touchend",
d),h.btn.removeEventListener("mouseup",d);h.parent.update()}var h=this,e;h.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",b);this.btn.addEventListener("mousedown",b);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();h.over=!0;h.draw()});this.btn.addEventListener("mouseout",function(c){a.newBlobContent=null;c.preventDefault();c.stopPropagation();h.over=!1;h.buttonClick=!1;h.draw()});document.addEventListener("visibilitychange",
function(c){a.newBlobContent=null;h.buttonClick=!1})};a.Button=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p,c,r=function(b,d){b=a.Control.call(this,b,d)||this;b.tabindex=++b.parent.tabindex;"_._"==b.name&&(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+"'");b.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:b.id});b.grad=a.newHTML("div",{class:"DJS_Gradient"});b.divUp=a.newHTML("div",{class:"DJS_Up"});b.divDown=a.newHTML("div",{class:"DJS_Down"});
b.field=a.newHTML("input",{type:"text",id:b.id+"_spinner",class:"DescartesSpinnerField",tabindex:b.tabindex});b.label=a.newHTML("label",{class:"DescartesSpinnerLabel"});b.container.appendChild(b.label);b.container.appendChild(b.field);b.container.appendChild(b.grad);b.container.appendChild(b.divUp);b.container.appendChild(b.divDown);b.addControlContainer(b.container);c=b.evaluator.parser.parse("1");b.originalIncr=b.incr;if(0>b.evaluator.eval(b.decimals)||0===b.evaluator.eval(b.incr))d=b.evaluator.eval(b.incr),
0<d?(b.incr=b.evaluator.parser.parse(parseInt(d).toString()),b.originalIncr=b.incr):b.incr=c;b.addEvents();b.init();return b};$jscomp.inherits(r,a.Control);r.prototype.init=function(){f=this.evaluator;var c=f.eval(this.name).toString();this.label.innerHTML=c;this.value=this.validateValue(f.eval(this.valueExpr));var b=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var d=2!==this.parent.version?"__":"_____",e=a.getTextWidth(b+"_",this.fieldFontSize+
"px "+a.sansserif_font),k=2+parseInt(this.h/2),g=parseInt(this.w/2-k/2);d=a.getTextWidth(c+d,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(g=this.w-k,e=0);g<d&&(g=d);""==c&&(g=0);this.w-g-k<e&&(g=this.w-k-e);0>g&&(g=0);c=this.w-(g+k);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.grad.setAttribute("style","left:0;top:0;left:"+g+"px;width:"+k+"px;height:"+this.h+"px;background-color:#f0f8ff");
d="width:"+k+"px;left:"+g+"px;";this.divUp.setAttribute("style",d+";height:"+(this.h/2+1)+"px;top:0;");this.divDown.setAttribute("style",d+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;");this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+(k+g)+"px;");this.field.value=b;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+g+"px;height:"+
this.h+"px;line-height:"+this.h+"px;");f.setVariable(this.id,this.value)};r.prototype.update=function(){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();0>f.eval(this.decimals)?(d=f.eval(this.incr),0<d?this.originalIncr=this.incr=f.parser.parse(parseInt(d).toString()):this.incr=c):this.incr=0!==f.eval(this.originalIncr)?this.originalIncr:c;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.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.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(e=this.field.value,q=this.value,this.value=this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==q&&this.field.value!=e&&(this.value=this.validateValue(e),
this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value))};r.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?"rgba(0,0,0,"+24/255+")":"";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=this.down?"rgba(0,0,0,"+24/255+")":""};r.prototype.validateValue=
function(a){f=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,".");m=a==parseFloat(a)?parseFloat(a):parseFloat(f.eval(f.parser.parse(a)));isNaN(m)&&(m=0);k=f.eval(this.min);g=f.eval(this.max);""===k&&(k=-Infinity);""===g&&(g=Infinity);m=Math.min(Math.max(m,k),g);this.discrete&&(b=f.eval(this.incr),m=0==b?0:b*Math.round(m/b));l=f.eval(this.decimals);0>=l&&(l=0);return m=parseFloat(parseFloat(m).toFixed(l))};
r.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};r.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};r.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())};r.prototype.addEvents=function(){function c(b,d,h){a.clearTimeout(l);if(f.up||
f.down)d.call(f),b=h?b:10,l=a.setTimeout(function(){c(b,d)},b)}function b(b){b.preventDefault();f.whichBtn=a.whichBtn(b);"L"==f.whichBtn&&f.activeIfValue&&(f.up=!0,c(g,f.increase,!0))}function d(b){b.preventDefault();f.whichBtn=a.whichBtn(b);"L"==f.whichBtn&&f.activeIfValue&&(f.down=!0,c(g,f.decrease,!0))}function e(c){f.up=!1;a.clearTimeout(l);f.updateStyle()}function k(c){f.down=!1;a.clearTimeout(l);f.updateStyle()}p=a.hasTouchSupport;var f=this,g=p?500:200,l;f.divUp.oncontextmenu=f.divDown.oncontextmenu=
f.field.oncontextmenu=f.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&&f.changeValue(f.field.value)});this.divUp.addEventListener("touchstart",b);this.divUp.addEventListener("mousedown",b);this.divDown.addEventListener("touchstart",d);this.divDown.addEventListener("mousedown",d);this.divUp.addEventListener("mouseout",function(c){f.up=
!1;a.clearTimeout(l);c.preventDefault();f.updateStyle()});this.divDown.addEventListener("mouseout",function(c){f.down=!1;a.clearTimeout(l);c.preventDefault();f.updateStyle()});this.divUp.addEventListener("touchend",e);window.addEventListener("touchend",e);this.divUp.addEventListener("mouseup",e);window.addEventListener("mouseup",e);this.divDown.addEventListener("touchend",k);window.addEventListener("touchend",k);this.divDown.addEventListener("mouseup",k);window.addEventListener("mouseup",k);document.addEventListener("visibilitychange",
function(c){f.up=!1;f.down=!1;a.clearTimeout(l);f.updateStyle()});f.field.addEventListener("click",function(a){this.select();this.focus()})};a.Spinner=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e=function(e,f){d=e=a.Control.call(this,e,f)||this;d.typeCtr="checkbox";d.pressed=f.pressed||!1;d.radio_group=(f.radio_group||"").trim();""!==d.radio_group&&(d.typeCtr="radio");d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name.trim()+"'");d.tabindex=++d.parent.tabindex;d.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer"});d.checkbox=a.newHTML("input",{type:d.typeCtr,
id:d.id+d.typeCtr,class:"DescartesCheckbox",tabindex:d.tabindex});""!==d.radio_group&&d.checkbox.setAttribute("name",d.radio_group);d.checkbox.internalID=e.id;d.label=a.newHTML("label",{class:"DescartesCheckboxLabel"});d.dummyLabel=a.newHTML("label",{"for":d.id+d.typeCtr});d.value=d.evaluator.eval(d.valueExpr);d.containerControl.appendChild(d.label);d.containerControl.appendChild(d.checkbox);d.containerControl.appendChild(d.dummyLabel);d.addControlContainer(d.containerControl);d.addEvents();d.init();
return e};$jscomp.inherits(e,a.Control);e.prototype.init=function(e){d=this;f=d.evaluator;d.label.innerHTML=f.eval(d.name).toString();d.labelFontSize=a.getFieldFontSize(d.h);e=Math.max(d.w-d.h,0);d.containerControl.setAttribute("style","width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";");d.dummyLabel.setAttribute("style","position:absolute;width:"+d.h+"px;height:"+d.h+"px;left:"+e+"px;");d.checkbox.setAttribute("style","width:"+d.h+"px;height:"+d.h+"px;left:"+e+"px;");
d.checkbox.checked=0!=d.value;d.label.setAttribute("style","font-size:"+d.labelFontSize+"px;width:"+e+"px;height:"+d.h+"px;line-height:"+d.h+"px;");d.evaluator.setVariable(d.id,d.value);d.update()};e.prototype.update=function(){d=this;f=d.evaluator;d.label.innerHTML=f.eval(d.name).toString();d.activeIfValue=0<f.eval(d.activeif);d.drawIfValue=0<f.eval(d.drawif);d.checkbox.disabled=!d.activeIfValue;d.containerControl.style.display=d.drawIfValue?"block":"none";if(!d.parent.animation.playing||document.activeElement!=
d.checkbox){var a=0!==f.getVariable(d.id)?1:0;""===d.radio_group?d.pressed?(d.value=d.checkbox.checked?1:0,d.pressed=!1):(d.value=a,d.checkbox.checked=0!==d.value):(d.value=d.checkbox.checked?1:0,d.pressed&&(f.setVariable(d.radio_group,d.id),d.pressed=!1));f.setVariable(d.id,d.value)}d.updatePositionAndSize()};e.prototype.addEvents=function(){d=this;d.checkbox.oncontextmenu=d.label.oncontextmenu=d.dummyLabel.oncontextmenu=function(){return!1};d.label.addEventListener("touchstart",a.preventDefault);
d.label.addEventListener("mousedown",a.preventDefault);d.dummyLabel.addEventListener("touchstart",a.preventDefault);d.dummyLabel.addEventListener("mousedown",a.preventDefault);d.checkbox.addEventListener("click",function(a){d.pressed=!0;d.updateAndExecAction()})};a.Checkbox=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l=function(b,d){b=a.Control.call(this,b,d)||this;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");b.answer&&(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?(d=b.answerPattern.indexOf("|"),b.firstAnswer=-1==d?b.answerPattern:b.answerPattern.substring(0,d)):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()});""==name.trim()&&(name="");b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer"});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("label",{class:"DescartesTextFieldLabel"});b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.addControlContainer(b.containerControl);
b.addEvents();b.init();return b};$jscomp.inherits(l,a.Control);l.prototype.init=function(b){f=this.evaluator;var d=f.eval(this.name).toString();this.label.innerHTML=d;b||(this.value=this.validateValue(f.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var e=a.getTextWidth(b+"_",this.fieldFontSize+"px "+a.sansserif_font),c=parseInt(this.w/2),k=a.getTextWidth(d,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(c=this.w,e=0);c<k&&(c=k);
""==d&&(c=0);this.w-c<e&&(c=this.w-e);0>c&&(c=0);d=this.w-c;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+c+"px;");this.field.value=b;this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;line-height:"+this.h+"px;");this.evaluate&&(this.ok=this.evaluateAnswer());
this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};l.prototype.update=function(){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(d=this.field.value,
e=this.value,this.value=this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===e&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value));this.updatePositionAndSize()};l.prototype.validateValue=function(a){if(""===a||"''"==a)return"";f=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");q=a==parseFloat(a)?parseFloat(a):parseFloat(f.eval(f.parser.parse(a)));
isNaN(q)&&(q=0);m=f.eval(this.min);b=f.eval(this.max);""===m&&(m=-Infinity);""===b&&(b=Infinity);q<m&&(q=m);q>b&&(q=b);this.discrete&&(a=f.eval(this.incr),q=0===a?0:a*Math.round(q/a));return q=parseFloat(parseFloat(q).toFixed(f.eval(this.decimals)))};l.prototype.formatOutputValue=function(b){return""===b?"":a.Control.prototype.formatOutputValue.call(this,b)};l.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),
this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};l.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};l.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};l.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=b.label.oncontextmenu=
function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){b.evaluator.eval(b.drawIf)&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()})};a.TextField=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.abs,d,e,q,m,b,l,k,g,p,c,r=function(c,b){function h(c){f.options=c.split(",");f.menuOptions=[];f.strValue=[];c=0;for(var b=f.options.length;c<b;c++){var h=f.customSplit(f.options[c]);1==h.length?(f.menuOptions.push(h[0]),f.strValue.push(c.toString())):2==h.length&&(f.menuOptions.push(h[0]),""==h[1]?f.strValue.push(c.toString()):f.strValue.push(h[1]))}c=0;for(b=f.menuOptions.length;c<b;c++)f.menuOptions[c].match(/^\[/)&&f.menuOptions[c].match(/\]$/)?
f.menuOptions[c]=d.parse(f.menuOptions[c].substring(1,f.menuOptions[c].length-1)):f.menuOptions[c]=d.parse("'"+f.menuOptions[c]+"'");c=0;for(b=f.strValue.length;c<b;c++)f.strValue[c].match(/^\[/)&&f.strValue[c].match(/\]$/)?f.strValue[c]=d.parse(f.strValue[c].substring(1,f.strValue[c].length-1)):f.strValue[c]=d.parse(f.strValue[c]);for(;f.select.firstChild;)f.select.remove();c=0;for(b=f.menuOptions.length;c<b;c++)h=a.newHTML("option"),h.innerHTML=e.eval(f.menuOptions[c]),f.select.appendChild(h);return 0}
c=a.Control.call(this,c,b)||this;c.options=b.options||"";d=c.parser;e=c.evaluator;c.ok=0;c.tabindex=++c.parent.tabindex;c.answer&&(c.answer.match("krypto_")&&(c.answer=(new a.Krypto).decode(c.answer.substring(7))),c.answer=parseInt(c.answer.split(",")[0].replace("[",""))||0);c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");var f=c;c.evaluator.setFunction(c.id+".setOptions",h);c.containerControl=a.newHTML("div",{class:"DescartesMenuContainer"});
c.label=a.newHTML("label",{class:"DescartesMenuLabel"});c.select=a.newHTML("select",{id:c.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:c.tabindex});c.field=a.newHTML("input",{type:"text",id:c.id+"_menuField",class:"DescartesMenuField",tabindex:c.tabindex});h(c.options);c.containerControl.appendChild(c.label);c.containerControl.appendChild(c.select);c.visible&&c.containerControl.appendChild(c.field);c.addControlContainer(c.containerControl);c.addEvents();c.init();return c};$jscomp.inherits(r,
a.Control);r.prototype.init=function(c){e=this.evaluator;var b=e.eval(this.name).toString();this.label.innerHTML=b;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var d=0,h=0;this.value=c?this.value:e.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var f=0,g=this.menuOptions.length;f<g;f++)c=a.getTextWidth(e.eval(this.menuOptions[f]).toString(),this.fieldFontSize+"px "+a.sansserif_font),c>d&&(d=c,h=f);d+=25;c=a.getTextWidth(this.formatOutputValue(e.eval(this.strValue[h])),
this.fieldFontSize+"px "+a.sansserif_font)+7;h=a.getTextWidth(b,this.fieldFontSize+"px "+a.sansserif_font)+10;""==b&&(h=0);this.visible||(c=0);for(b=this.w-c-h;b<d&&0<h;)h--,b++;for(;b<d&&0<c;)c--,b++;for(;h+b+c+1<this.w;)b++,c++;d=h;f=d+b;c=this.w-f;g=this.formatOutputValue(e.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+
this.fieldFontSize+"px;width:"+h+"px;height:"+this.h+"px;line-height:"+this.h+"px;");this.field.value=g;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+f+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.select.selectedIndex=this.indexValue;e.setVariable(this.id,parseFloat(g.replace(this.parent.decimal_symbol,".")));this.update()};r.prototype.update=
function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){this.label.innerHTML=e.eval(this.name).toString();for(var a=0,c=this.menuOptions.length;a<c;a++)this.select.options[a].innerHTML=
e.eval(this.menuOptions[a]);this.value=e.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);e.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize()};r.prototype.customSplit=function(a){l=!1;k="";g=0;for(p=-1;g<a.length;){c=a.charAt(g);if("["===c&&-1===p){if(l||""!=k)k+="\u00a6";
p++}else"["===c?p++:"]"===c&&0===p?(l=!0,p--):"]"==a.charAt(g)&&(p=0>p?p:p-1);k+=a.charAt(g);g++}return k.split("\u00a6")};r.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));q=-1;m=Infinity;for(var c=0,d=this.strValue.length;c<d;c++)b=f(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=m&&(m=b,q=c);return q};r.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};r.prototype.addEvents=
function(){var c=this;c.select.oncontextmenu=c.label.oncontextmenu=c.field.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);this.select.addEventListener("change",function(a){c.value=c.evaluator.eval(c.strValue[this.selectedIndex]);c.field.value=c.formatOutputValue(c.value);c.evaluator.setVariable(c.id,c.field.value);c.changeValue();a.preventDefault()});this.field.addEventListener("keydown",function(a){13==
a.keyCode&&(c.indexValue=c.getIndex(c.field.value),c.value=c.evaluator.eval(c.strValue[c.indexValue]),c.field.value=c.formatOutputValue(c.indexValue),c.select.selectedIndex=c.indexValue,c.changeValue())});c.field.addEventListener("click",function(a){this.focus()})};a.Menu=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d,e,q,m,b,l,k,g,p,c,r,h,v,x,u,n,z,w,y=function(c,b){c=a.Control.call(this,c,b)||this;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});
c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("label",{class:"DescartesScrollbarLabel"});c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.addControlContainer(c.container);c.addEvents();c.init();return c};
$jscomp.inherits(y,a.Control);y.prototype.init=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.value=this.validateValue(d.eval(this.valueExpr));q=this.formatOutputValue(this.value);m=this.evaluator.eval(this.expresion);this.x=m[0][0];this.y=m[0][1];4==m[0].length&&(this.w=m[0][2],this.h=m[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(q);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,
this.value)};y.prototype.initScroll=function(c){e=this;d=e.evaluator;w=d.eval(e.name).toString();e.label.innerHTML=w;var b="v"===e.orientation?parseInt(19+5*(e.h-100)/100):e.h;e.fieldFontSize="v"===e.orientation?b-parseInt(e.h/20)-1:2!==e.parent.version?a.getFieldFontSize(b):10;c=a.getTextWidth(c+"_",e.fieldFontSize+"px "+a.sansserif_font);var h=e.parent.getSpaceById(e.spaceID).h;e.labelHeight=""==w?0:b;e.fieldHeight=""==e.visible?0:b;if("v"===e.orientation)e.canvasWidth=e.w,e.canvasHeight=e.h-e.labelHeight-
e.fieldHeight,18<=e.canvasHeight+e.y-h&&(e.canvasHeight=h),b=e.fieldHeight,c=b+e.canvasHeight,e.canvasX=0,e.canvasY=e.fieldHeight,e.labelWidth=e.w,e.labelY=c,e.upWidth=e.downW=e.w,e.upHeight=e.downH=15,e.upX=0,e.upY=e.fieldHeight,e.downX=0,e.downY=c-e.downH,e.fieldWidth=e.w,e.fieldX=0,e.scrollHandlerW=e.w,e.scrollHandlerH=parseInt((e.canvasHeight-e.upHeight-e.downH-e.labelHeight-e.fieldHeight)/10),e.scrollHandlerH=15>e.scrollHandlerH?15:e.scrollHandlerH,e.limInf=c-e.downH-e.scrollHandlerH,e.limSup=
b+e.downH;else{b=a.getTextWidth(w,e.fieldFontSize+"px "+a.sansserif_font)+10;e.labelWidth=b;e.fieldWidth=c;""==w&&(e.labelWidth=0);e.visible||(e.fieldWidth=0);for(c=e.w-e.fieldWidth-e.labelWidth;58>c&&0<e.labelWidth;)e.labelWidth--,c++;for(;58>c&&0<e.fieldWidth;)e.fieldWidth--,c++;b=e.labelWidth;h=b+c;e.fieldWidth=e.w-h;e.canvasWidth=c;e.canvasHeight=e.h;e.canvasX=e.labelWidth;e.canvasY=0;e.fieldX=e.canvasWidth+e.labelWidth;e.labelHeight=e.h;e.labelY=0;e.upWidth=e.downW=15;e.upHeight=e.downH=e.h;
e.upX=h-e.downW;e.upY=0;e.downX=e.labelWidth;e.downY=0;e.scrollHandlerW=parseInt((e.canvasWidth-e.upWidth-e.downW)/10);e.scrollHandlerW=15>e.scrollHandlerW?15:e.scrollHandlerW;e.scrollHandlerH=e.h;e.limInf=b+e.downW;e.limSup=b+e.canvasWidth-e.downW-e.scrollHandlerW}e.container.setAttribute("style","width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+";");e.canvas.setAttribute("width",e.w+"px");e.canvas.setAttribute("height",e.h+"px");e.canvas.setAttribute("style","position:absolute;left:0;top:0;");
e.ctx=e.canvas.getContext("2d");e.ctx.imageSmoothingEnabled=!1;e.divUp.setAttribute("style","width:"+e.upWidth+"px;height:"+e.upHeight+"px;left:"+e.upX+"px;top:"+e.upY+"px;");e.divDown.setAttribute("style","width:"+e.downW+"px;height:"+e.downH+"px;left:"+e.downX+"px;top:"+e.downY+"px;");e.scrollHandler.setAttribute("style","width:"+e.scrollHandlerW+"px;height:"+e.scrollHandlerH+"px;left:"+("v"===e.orientation?0:e.limInf)+"px;top:"+("v"===e.orientation?e.limInf:0)+"px;");e.field.setAttribute("style",
"font-size:"+e.fieldFontSize+"px;width:"+e.fieldWidth+"px;height:"+e.fieldHeight+"px;left:"+e.fieldX+"px;top:0;");0===e.fieldHeight&&(e.field.style.display="none");e.label.setAttribute("style","font-size:"+e.fieldFontSize+"px;width:"+e.labelWidth+"px;height:"+e.labelHeight+"px;line-height:"+e.labelHeight+"px;left:0;top:"+e.labelY+"px;")};y.prototype.update=function(){d=this.evaluator;this.label.innerHTML=d.eval(this.name).toString();0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-
d.eval(this.min))/100;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(d.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);
d.setVariable(this.id,this.value)};y.prototype.draw=function(){e=this;b=e.ctx;k=f(this.w);l=f(this.h);b.fillStyle="#e0e4e8";b.fillRect(0,0,k,l);b.strokeStyle="#7a8a99";b.fillStyle="#ccdcec";e.down&&b.fillRect(e.downX+.5,e.downY+.5,e.downW,e.downH-1);b.strokeRect(e.downX+.5,e.downY+.5,e.downW,e.downH-1);e.up&&b.fillRect(e.upX+.5,e.upY-.5,e.upWidth,e.upHeight+1);b.strokeRect(e.upX+.5,e.upY-.5,e.upWidth,e.upHeight+1);g=4;b.fillStyle="black";b.beginPath();"h"===e.orientation?(b.moveTo(e.downX+g,e.downH/
2),b.lineTo(e.downX+e.downW-g,g),b.lineTo(e.downX+e.downW-g,e.downH-g),b.moveTo(e.upX+e.upWidth-g,e.downH/2),b.lineTo(e.upX+g,g),b.lineTo(e.upX+g,e.downH-g),b.fill(),e.activeIfValue&&(p=f(e.pos),b.fillStyle="#ccdcec",b.fillRect(p+.5,0,f(e.scrollHandlerW),l),b.strokeStyle="#6382bf",b.strokeRect(p+.5,0,f(e.scrollHandlerW),l),c=f(e.scrollHandlerW/2),b.beginPath(),b.moveTo(p+c+.5-2,3),b.lineTo(p+c+.5-2,l-3),b.moveTo(p+c+.5,3),b.lineTo(p+c+.5,l-3),b.moveTo(p+c+.5+2,3),b.lineTo(p+c+.5+2,l-3),b.stroke())):
(b.moveTo(e.downX+e.downW/2,e.downY+e.downH-g),b.lineTo(e.downX+g,e.downY+g),b.lineTo(e.downX+e.downW-g,e.downY+g),b.moveTo(e.upX+e.upWidth/2,e.upY+g),b.lineTo(e.upX+g,e.upY+e.upHeight-g),b.lineTo(e.upX+e.upWidth-g,e.upY+e.upHeight-g),b.fill(),e.activeIfValue&&(p=f(e.pos),b.fillStyle="#ccdcec",b.fillRect(0,p+.5,k,f(e.scrollHandlerH)),b.strokeStyle="#6382bf",b.strokeRect(0,p+.5,k,f(e.scrollHandlerH)),c=f(e.scrollHandlerH/2),b.beginPath(),b.moveTo(3,p+c+.5-2),b.lineTo(k-3,p+c+.5-2),b.moveTo(3,p+c+.5),
b.lineTo(k-3,p+c+.5),b.moveTo(3,p+c+.5+2),b.lineTo(k-3,p+c+.5+2),b.stroke()));b.strokeRect(.5,.5,k-1,l-1);e.activeIfValue||(b.fillStyle="rgba(240,240,240,"+160/255+")",b.fillRect(0,0,k,l.h))};y.prototype.validateValue=function(a){d=this.evaluator;r=a.toString();r=parseFloat(r.replace(this.parent.decimal_symbol,"."));isNaN(r)&&(r=0);this.minimo=d.eval(this.min);r<this.minimo&&(this.value=null,r=this.minimo);this.maximo=d.eval(this.max);r>this.maximo&&(this.value=null,r=this.maximo);h=this.incr;r=0!=
h?r*h/h:0;this.fixed&&(r=parseFloat(parseFloat(r).toFixed(d.eval(this.decimals))));return r};y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};y.prototype.increase10=function(){g=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+g):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+
g)};y.prototype.decrease10=function(){g=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-g):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-g)};y.prototype.changeValue=function(a){this.activeIfValue&&(v=this.validateValue(a),v!=this.value&&(this.value=v,this.field.value=this.formatOutputValue(v),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,
this.value),this.updateAndExecAction()))};y.prototype.changeValueForScrollMovement=function(){d=this.evaluator;x=this.limInf;u=this.limSup;n=d.eval(this.min);z=d.eval(this.max);h=this.incr;v=f((this.pos-x)*(z-n)/(u-x)/h)*h+n;v!=this.value&&(this.value=v,this.field.value=this.formatOutputValue(v),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};y.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;x=this.limInf;u=this.limSup;
n=d.eval(this.min);z=d.eval(this.max);h=this.incr;this.pos=(this.value-n)*(u-x)/(z-n)+x;this.scrollHandler.style["h"==this.orientation?"left":"top"]=this.pos+"px"};y.prototype.addEvents=function(){function c(b,d,e,h){a.clearTimeout(x);(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-h)&&(d.call(p),b=e?b:30,x=a.setTimeout(function(){c(b,d,!1,h)},b))}function b(b){b.preventDefault();p.whichBtn=a.whichBtn(b);"L"==p.whichBtn&&p.activeIfValue&&(p.clickPos=a.getCursorPosition(b,p.container),p.canvasClick=
!0,"h"==p.orientation?p.clickPos.x<p.prePos?c(350,p.decrease10,!0,p.minimo):c(350,p.increase10,!0,p.maximo):p.clickPos.y<p.prePos?c(350,p.increase10,!0,p.maximo):c(350,p.decrease10,!0,p.minimo))}function d(c){p.canvasClick=!1;a.clearTimeout(x)}function e(c){1==p.canvasClick&&(p.clickPos=a.getCursorPosition(c,p.container),c.preventDefault())}function h(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",h,!1);window.removeEventListener("mousemove",g,!1);a.preventDefault()}function f(a){p.scrollClick=
!1;p.prePos=p.pos;window.removeEventListener("touchend",f,!1);window.removeEventListener("touchmove",g,!1);a.preventDefault()}function g(c){var b=a.getCursorPosition(c,p.container);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-b.x),p.pos<p.limInf&&(p.pos=p.limInf),p.pos>p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.scrollHandlerW+"px;height:"+p.h+"px;left:"+p.pos+"px;top:0;")):(p.pos=p.prePos-(p.initPos.y-b.y),p.pos>p.limInf&&(p.pos=p.limInf),p.pos<p.limSup&&(p.pos=
p.limSup),p.scrollHandler.setAttribute("style","width:"+p.w+"px;height:"+p.scrollHandlerH+"px;left:0;top:"+p.pos+"px;"));p.changeValueForScrollMovement();c.preventDefault()}function k(b){b.preventDefault();p.whichBtn=a.whichBtn(b);"L"==p.whichBtn&&p.activeIfValue&&(p.up=!0,c(350,p.increase,!0,p.maximo))}function n(b){b.preventDefault();p.whichBtn=a.whichBtn(b);"L"==p.whichBtn&&p.activeIfValue&&(p.down=!0,c(350,p.decrease,!0,p.minimo))}function l(c){p.down=!1;a.clearTimeout(x);c.preventDefault()}function r(c){p.up=
!1;a.clearTimeout(x);p.draw()}function m(c){p.down=!1;a.clearTimeout(x);p.draw()}var p=this,x;p.canvas.oncontextmenu=p.divUp.oncontextmenu=p.divDown.oncontextmenu=p.label.oncontextmenu=p.field.oncontextmenu=p.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});this.canvas.addEventListener("touchstart",b);this.canvas.addEventListener("mousedown",b);this.divDown.addEventListener("mouseout",l);window.addEventListener("touchend",
d);window.addEventListener("mouseup",d);this.canvas.addEventListener("touchmove",e);this.canvas.addEventListener("mousemove",e);this.scrollHandler.addEventListener("touchstart",function(c){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(c,p.container),window.addEventListener("touchend",f),window.addEventListener("touchmove",g),c.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(c){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(c,p.container),
window.addEventListener("mouseup",h),window.addEventListener("mousemove",g),c.preventDefault())});this.divUp.addEventListener("touchstart",k);this.divUp.addEventListener("mousedown",k);this.divDown.addEventListener("touchstart",n);this.divDown.addEventListener("mousedown",n);this.divUp.addEventListener("mouseout",function(c){p.up=!1;a.clearTimeout(x);c.preventDefault()});this.divDown.addEventListener("mouseout",l);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);window.addEventListener("touchend",
m);window.addEventListener("mouseup",m)};a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e=function(d,e){var b=a.Control.call(this,d,e)||this;b.controls=e.controls||!0;b.file=e.file||"";b.oldDrawIf=0;d=b.evaluator.eval(b.expresion);4==d[0].length?(b.w=d[0][2],b.h=d[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(l){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(l){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(l){}return 0});
b.evaluator.setFunction(b.id+".currentTime",function(a){try{b.audio.currentTime=parseFloat(a)}catch(k){}return 0});b.audio.addEventListener("timeupdate",function(a){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime)});return b};$jscomp.inherits(e,a.Control);e.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};e.prototype.update=function(){f=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=f.eval(this.file),this.oldFile!==
this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(d=0<f.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",d!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Audio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e=function(d,e){var b=a.Control.call(this,d,e)||this;b.controls=e.controls||!0;b.file=e.file||"";b.oldDrawIf=0;f=b.evaluator;d=f.eval(b.expresion);4==d[0].length?(b.w=d[0][2],b.h=d[0][3]):(b.w=null,b.h=null);d=b.file;e=d.lastIndexOf(".");-1!=e&&(d=b.file.substring(0,e));b.video=a.newHTML("video",{poster:d+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(e=a.newHTML("source",{src:d+".mp4",type:"video/mp4"}),b.video.appendChild(e));b.video.canPlayType("video/ogg")&&(e=a.newHTML("source",{src:d+".ogg",type:"video/ogg"}),b.video.appendChild(e),e=a.newHTML("source",{src:d+".ogv",type:"video/ogg"}),b.video.appendChild(e));b.video.canPlayType("video/webm")&&
(e=a.newHTML("source",{src:d+".webm",type:"video/webm"}),b.video.appendChild(e));b.addControlContainer(b.video);f.setFunction(b.id+".play",function(){try{b.video.play()}catch(l){}return 0});f.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(l){}return 0});f.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(l){}return 0});f.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(k){}return 0});b.video.addEventListener("timeupdate",
function(a){f.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(e,a.Control);e.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};e.prototype.update=function(){f=this.evaluator;(d=0<f.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",d!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Video=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q=function(d,b){var e=a.Control.call(this,d,b)||this;e.font_family=b.font_family||"Monospaced";e.style=b.style||",PLAIN,";e.font_size=b.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 f=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();f&&"simpleText"!==f.type&&(e.answer=e.text.hasFormula?"":f.toHTML());e.evaluator.setVariable(e.id,e.text);var g,p,c;e.evaluator.setFunction(e.id+".insertAtCursor",function(a){(g=window.getSelection())&&g.getRangeAt&&g.rangeCount&&(c=document.createTextNode(a),p=g.getRangeAt(0),p.deleteContents(),p.insertNode(c),p.setStart(c,c.length),
p.setEnd(c,c.length),g.removeAllRanges(),g.addRange(p),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(){d=this.answer?28:4;f=this.evaluator;var e=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var b=
"padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-d)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",b);this.textArea.innerHTML=e;this.textAreaAnswer.setAttribute("style",b+"display:"+(this.showAnswer?"block":"none")+";");this.textAreaAnswer.innerHTML="<span>"+this.answer+"</span>";this.showButton.setAttribute("style","width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:"+
(this.answer?"block":"none")+";");this.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+a.sansserif_font+';">S</span>';this.activeCover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;");this.update()};q.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);f.getVariable(this.id)!==this.oldValue&&(this.textArea.innerText=
(f.getVariable(this.id)||"").replace(/\\n/g,"\n"));e=this.textArea.innerText||"";e="\n"===e.charAt(e.length-1)?e.substring(0,e.length-1):e;e=e.replace(/\n/g,"\\n").replace(/\s/g," ");f.setVariable(this.id,e);this.oldFieldValue=e;this.oldValue=f.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 b=
this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();b.showAnswer=!b.showAnswer;b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});this.textArea.addEventListener("paste",function(a){a.preventDefault();
document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain"))});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 f=2*Math.PI,d,e,q,m,b,l,k,g,p,c,r,h,v=function(b,d){var h=a.Control.call(this,b,d)||this;e=b.evaluator.parser;h.spaceID=d.spaceID||"";h.text=d.text||"";h.size=d.size||e.parse("4");h.font=d.font||"Monospaced,PLAIN,12";h.image=new Image;h.image.onload=function(){this.ready=1};h.imageSrc=d.imageSrc||"";h.font=a.convertFont(h.font);if(h.constraintExpr){h.constraint=e.parse(h.constraintExpr);"(expr)"==h.constraint.type&&(h.constraint=e.parse(h.constraintExpr.substring(1,
h.constraintExpr.length-1)));if("compOperator"==h.constraint.type){d=h.constraint.childs[0];var f=h.constraint.childs[1];"identifier"!=d.type||"y"!=d.value||f.contains("y")?"identifier"!=d.type||"x"!=d.value||f.contains("x")?h.newt=new a.R2Newton(h.evaluator,h.constraint):(h.constVar="y",h.noConstVar="x",h.evalConst=h.evalConstXoY,h.constraint=f):(h.constVar="x",h.noConstVar="y",h.evalConst=h.evalConstXoY,h.constraint=f)}else h.constraint=null;c=new a.R2(0,0)}h.container=h.getContainer();h.mouseCatcher=
a.newHTML("div",{class:"DescartesGraphicControl",id:h.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:rgba(0,0,0,0);z-index:"+h.zIndex+";"});h.ctx=h.space.ctx;h.container.appendChild(h.mouseCatcher);h.addEvents();h.xStr=h.id+".x";h.yStr=h.id+".y";h.activoStr=h.id+".activo";h.activeStr=h.id+".active";""!==h.space.id&&2!==b.version?(h.mxStr=h.space.id+".mouse_x",h.myStr=h.space.id+".mouse_y",h.mclickedStr=h.space.id+".mouse_clicked",h.mclicizquierdoStr=h.space.id+".clic_izquierdo"):
(h.mxStr="mouse_x",h.myStr="mouse_y",h.mclickedStr="mouse_clicked",h.mclicizquierdoStr="clic_izquierdo");h.init();return h};$jscomp.inherits(v,a.Control);v.prototype.init=function(){d=this.evaluator;r=a.hasTouchSupport;var c=d.eval(this.expresion);this.x=c[0][0];this.y=c[0][1];d.setVariable(this.xStr,this.x);d.setVariable(this.yStr,this.y);""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*d.eval(this.size),this.height=2*d.eval(this.size),this._w=r&&48>this.width?48:
this.width,this._h=r&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.imageSrc),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=
parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";d.setVariable(this.activoStr,0);d.setVariable(this.activeStr,0);this.setImage=!1;this.update()};v.prototype.update=function(){d=this.evaluator;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.x=d.getVariable(this.xStr);this.y=d.getVariable(this.yStr);q=this.space.getAbsoluteX(this.x);m=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(m-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};v.prototype.draw=function(){d=this.evaluator;this.drawIfValue&&(g=this.ctx,p=this.space.backgroundCtx,q=parseInt(this.space.getAbsoluteX(this.x))+.5,m=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(q,m),this.image.ready?(b=this.image.width/2,l=this.image.height/2,this.image.complete&&!this.setImage&&g.drawImage(this.image,parseInt(q-b),parseInt(m-
l)),this.trace&&(p.save(),p.translate(q,m),p.scale(parseInt(b),parseInt(l)),p.beginPath(),p.arc(0,0,1,0,f),p.restore(),p.lineWidth=1,p.strokeStyle=this.trace.getColor(),p.stroke())):(b=parseInt(this.width/2),g.beginPath(),g.arc(q,m,b,0,f),g.fillStyle=this.colorInt.getColor(),g.fill(),g.lineWidth=1,g.strokeStyle=this.color.getColor(),g.stroke(),this.active&&(g.strokeStyle=this.colorInt.borderColor(),g.beginPath(),g.arc(q,m,b-2,0,f),g.stroke()),this.trace&&(p.strokeStyle=this.trace.getColor(),p.beginPath(),
p.arc(q,m,b,0,f),p.stroke())))};v.prototype.evalConst=function(){c.set(this.x,this.y);k=this.newt.findZero(c,1/this.space.scale,!0);this.x=k.x;this.y=k.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};v.prototype.evalConstXoY=function(){d=this.evaluator;h=d.getVariable(this.constVar);d.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=d.eval(this.constraint);d.setVariable(this.xStr,this.x);d.setVariable(this.yStr,this.y);d.setVariable(this.constVar,
h)};v.prototype.drawText=function(a,c){g=this.ctx;d=this.evaluator;"simpleText"==this.text.type?(g.fillStyle=this.color.getColor(),g.font=this.font,g.textBaseline="alphabetic",g.fillText(this.text.toString(d.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(c-1-this.height/2))):(g.fillStyle=this.color.getColor(),g.strokeStyle=this.color.getColor(),g.textBaseline="alphabetic",this.text.draw(g,parseInt(a+1+this.width/2),parseInt(c-1-this.height/2),this.decimals,this.fixed,"start",
!0,this.color.getColor()))};v.prototype.getContainer=function(){for(var a=this.parent.spaces,c,b=0,d=a.length;b<d;b++)if(c=a[b],c.id==this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};v.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,
0)};v.prototype.addEvents=function(){function c(c){document.body.focus();c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.parent.deactivateGraphicControls(),h.click=h.active=!0,h.evaluator.setVariable(h.activoStr,1),h.evaluator.setVariable(h.activeStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclicizquierdoStr,0),h.posAnte=a.getCursorPosition(c,h.container),h.prePos={x:h.space.getAbsoluteX(h.x),y:h.space.getAbsoluteY(h.y)},h.evaluator.setVariable(h.mxStr,
h.space.getRelativeX(h.posAnte.x)),h.evaluator.setVariable(h.myStr,h.space.getRelativeY(h.posAnte.y)),h.parent.update(),window.addEventListener("touchend",b),window.addEventListener("touchmove",d),window.addEventListener("mouseup",b),window.addEventListener("mousemove",d))}function b(c){document.body.focus();c.preventDefault();c.stopPropagation();h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclicizquierdoStr,1);if(h.activeIfValue||h.active)h.click=!1,window.removeEventListener("mouseup",
b),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",b),window.removeEventListener("touchmove",d),f=a.getCursorPosition(c,h.container),h.posX=h.prePos.x-(h.posAnte.x-f.x),h.posY=h.prePos.y-(h.posAnte.y-f.y),h.evaluator.setVariable(h.xStr,h.space.getRelativeX(h.posX)),h.evaluator.setVariable(h.yStr,h.space.getRelativeY(h.posY)),h.evaluator.setVariable(h.mxStr,h.space.getRelativeX(f.x)),h.evaluator.setVariable(h.myStr,h.space.getRelativeY(f.y)),h.parent.updateControls(),
h.parent.update(),h.mouseCatcher.style.left=h.space.getAbsoluteX(h.x)-h._w/2+"px",h.mouseCatcher.style.top=h.space.getAbsoluteY(h.y)-h._h/2+"px";h.parent.deactivateGraphicControls();h.parent.update()}function d(c){c.preventDefault();h.evaluator.setVariable(h.mclickedStr,0);h.evaluator.setVariable(h.mclicizquierdoStr,0);f=a.getCursorPosition(c,h.container);h.posX=h.prePos.x-(h.posAnte.x-f.x);h.posY=h.prePos.y-(h.posAnte.y-f.y);h.evaluator.setVariable(h.xStr,h.space.getRelativeX(h.posX));h.evaluator.setVariable(h.yStr,
h.space.getRelativeY(h.posY));h.evaluator.setVariable(h.mxStr,h.space.getRelativeX(f.x));h.evaluator.setVariable(h.myStr,h.space.getRelativeY(f.y));80<Date.now()-e&&(h.parent.updateControls(),h.parent.update(),e=Date.now())}var e=0,h=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",c);this.mouseCatcher.addEventListener("mousedown",c);this.mouseCatcher.addEventListener("mouseover",function(a){h.over=!0});this.mouseCatcher.addEventListener("mouseout",
function(a){h.over=!1;h.click=!1});var f};a.GraphicControl=v;return a}(descartesJS||{});
descartesJS=function(a,f){var d,e,q,m,b,l,k,g,p,c;function r(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var h=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,v,x,u,n,z,w,y,B,C,J,G,H,A,I,D,M,N,O,F,E,K,L,P,R,Q,W,V,U,T,S=function(c){this.parent=c;this.parser=c.evaluator.parser;this.RTFparser=new a.RTFParser(c.evaluator)};S.prototype.parseButtonsConfig=function(a){var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var b=0,d=a.length;b<d;b++)switch(u=
a[b][0],n=a[b][1],x=f[u],x){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[x]=parseInt(n);break;case "about":case "config":case "init":case "clear":c[x]="true"===f[n];break;default:console.warn("Propiedad de botones no identificada: <"+u+"> valor: <"+n+">")}return c};S.prototype.parseSpace=function(c){z={};c=this.split(c);for(var b=0,d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=f[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Space",x){case "type":if("R2"===n||
"R3"===n)n=f[n];z[x]=n;break;case "id":a.DEBUG.idName=n;case "x_axis":case "y_axis":case "cID":case "file":case "info":z[x]=n;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":z[x]="true"===f[n];break;case "bg_display":case "render":z[x]=f[n];break;case "net":case "net10":case "axes":case "text":z[x]=""!=n?"false"===f[n]?"":new a.Color(n,this.parent.evaluator):"";break;case "O.x":z.OxExpr=n;break;case "O.y":z.OyExpr=n;break;case "image":z.imageSrc=
n;break;case "x":v=n;"%"===v[v.length-1]?(z.xPercentExpr=v.trim(),v=(this.parent.container.width*parseFloat(v)/100).toString()):v=n;z.xExpr=this.parser.parse(v);break;case "y":v=n;"%"===v[v.length-1]?(z.yPercentExpr=v.trim(),v=(this.parent.container.height*parseFloat(v)/100).toString()):v=n;z.yExpr=this.parser.parse(v);break;case "width":v=n.trim();z.wModExpr=v;"%"===v[v.length-1]?(z.wExpr=v,v=this.parent.container.width*parseFloat(v)/100):(v=parseFloat(n),v!=n&&(v=this.parent.container.width,z._w_=
n.trim()));z.w=v;break;case "height":v=n.trim();z.hModExpr=v;"%"===v[v.length-1]?(z.hExpr=v,v=this.parent.container.height*parseFloat(v)/100):(v=parseFloat(n),v!=n&&(v=this.parent.container.height,z._h_=n.trim()));z.h=v;break;case "drawif":""!=n&&(z.drawif=this.parser.parse(n));break;case "scale":v=parseFloat(n);isNaN(v)&&(v=48);z.scale=v;break;case "background":z.background=new a.Color(n,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+u+"> valor: <"+n+
">")}return new a["Space"+z.type](this.parent,z)};S.prototype.parseControl=function(c){w={type:"Numeric",gui:"Spinner"};c=this.split(c);for(var b=0,d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=f[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Control",x){case "type":v=f[n.trim()];"graphic"===v?v="GraphicControl":"text"===v&&(v="TextArea");w.type=r(v);break;case "gui":v=f[n];"textfield"===v&&(v="TextField");w[x]=r(v);break;case "id":a.DEBUG.idName=n;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "info":w[x]=
n;break;case "region":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":w[x]=f[n];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":w[x]="true"===f[n];break;case "color":case "colorInt":case "trace":w[x]=new a.Color(n,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==n&&(w[x]=this.parser.parse(n));break;
case "constraint":w.constraintExpr=n;break;case "image":w.imageSrc=n;break;case "space":w.spaceID=n;break;case "expresion":w.expresion=this.parser.parse(n.replace(")(",","));break;case "borderColor":w[x]="false"===f[n]?"":n;break;case "bold":"false"!=f[n]&&(w.bold="bold");break;case "italics":"false"!=f[n]&&(w.italics="italic");break;case "underlined":"false"!=f[n]&&(w.underlined=!0);break;case "value":var h=n.replace(/&squot;/g,"'");h.match(/^\|/)&&(h="'"+h.substring(1),h.match(/\|$/)&&(h=h.substring(0,
h.length-1)+"'"));w.valueExpr=this.parser.parse(h);w.valueExprString=h;break;case "incr":0!=n&&(w.incr=this.parser.parse(n));break;case "exponentialif":w.exponentialif=parseFloat(n);break;case "text":w.rawText=n;h=this.parseText(n);for(var e=0,g=h.length;e<g;e++)h[e]=this.parser.parse(h[e],!1);w.text=h;break;default:e=u.indexOf("."),h=f[u.substring(0,e)],e=f[u.substring(e+1)],"parameter"===h&&"font"===e?w.parameterFont=n:"Explanation"===h&&"font"===e?w.ExplanationFont=n:"tooltip"===h&&"font"===e?
w.tooltipFont=n:console.warn("Propiedad de control no identificada: <"+u+"> valor: <"+n+">")}return new a["Numeric"===w.type?w.gui:w.type](this.parent,w)};S.prototype.parseGraphic=function(c,b,d,e){y={rotateExp:e,parameter:"t"};c=this.split(c);e=0;for(var g=c.length;e<g;e++)if(u=c[e][0],n=c[e][1],x=f[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Graphic",""!=n)switch(x){case "type":a.DEBUG.idName=n;y[x]=r(f[n]);break;case "align":case "anchor":case "lineDash":y[x]=f[n];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":y[x]=
"true"===f[n];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":y[x]="false"===f[n]?"":new a.Color(n,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":y[x]=n;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":""!==n&&(y[x]=this.parser.parse(n));break;case "font_size":n=
n.trim();n.match(/^\[.*\]?/)&&(n=n.substring(1,n.length-1));""!==n&&(y[x]=this.parser.parse(n));break;case "space":y.spaceID=n;break;case "expresion":""!==n&&("Macro"!==y.type?(y.expresion=this.parser.parse(n),y.expresionString=n):y.expresion=n);break;case "text":y.text=n;break;case "file":var k=n.replace(/&squot;/g,"'");"["===k.charAt(0)&&"]"===k.charAt(k.length-1)&&(k=k.substring(1,k.length-1));k.match(h)&&(k="'"+k+"'");y.file=this.parser.parse(k);break;case "border":""!=n&&"false"!=f[n]&&(y.border=
new a.Color(n,this.parent.evaluator));break;default:if(void 0!=y.family&&u.substring(0,y.family.length+1)===y.family+".")switch(f[u.substring(y.family.length+1)]){case "interval":""!=n&&(y.family_interval=this.parser.parse(n));break;case "steps":""!=n&&(y.family_steps=this.parser.parse(n))}else if(void 0!=y.parameter&&u.match(y.parameter+"."))switch(y.parameter!==u.substring(0,u.indexOf(y.parameter)+y.parameter.length)&&(y.parameter=u.substring(0,u.indexOf(y.parameter)+y.parameter.length)),f[u.substring(y.parameter.length+
1)]){case "interval":""!=n&&(y.parameter_interval=this.parser.parse(n));break;case "steps":""!=n&&(y.parameter_steps=this.parser.parse(n))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+u+"> valor: <"+n+">")}b&&(y.abs_coord=b);d&&(y.background=d);return new a[y.type](this.parent,y)};S.prototype.parse3DGraphic=function(c,b,d,h){y={rotateExp:h,parameter:"t"};c=this.split(c);b=0;for(d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=f[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Graphic3D",
x){case "type":a.DEBUG.idName=n;v=f[n];switch(v){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":y.subType=v,v="OtherGeometry"}y[x]=r(v);break;case "model":case "lineDash":y[x]=f[n];break;case "fill":y[x]="false"===f[n]?"":new a.Color(n,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":y[x]="true"===
f[n];break;case "edges":"false"===f[n]?y[x]="":("true"===f[n]&&(n="808080"),y[x]=new a.Color(n,this.parent.evaluator));break;case "color":case "backcolor":y[x]=new a.Color(n,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":""!=n&&(y[x]=this.parser.parse(n));break;case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":y[x]=
n;break;case "space":y.spaceID=n;break;case "expresion":"Macro"!=y.type&&"Curve"!=y.type&&"Surface"!=y.type?(y.expresion=this.parser.parse(n),y.expresionString=n):y.expresion=n.replace(/\\n/g,";");break;case "text":y.text=n;break;case "file":h=n.replace(/&squot;/g,"'");"["===h.charAt(0)&&"]"===h.charAt(h.length-1)&&(h=h.substring(1,h.length-1));h.match(/./)&&(h="'"+h+"'");y.file=this.parser.parse(h);break;default:void 0!==y.family&&u.substring(0,y.family.length+1)===y.family+"."?"interval"===f[u.substring(y.family.length+
1)]?""!=n&&(y.family_interval=this.parser.parse(n)):""!=n&&(y.family_steps=this.parser.parse(n)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+u+"> valor: <"+n+">")}return new a[y.type+"3D"](this.parent,y)};S.prototype.parseAuxiliar=function(c){B={};c=this.split(c);for(var b=0,d=c.length;b<d;b++)c[b][1]=c[b][1].replace(/&squot;/g,"'");b=0;for(d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=f[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Auxiliar",x){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=n;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":B[x]=n.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":B[x]="true"===f[n];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":B[x]=this.parser.parse(n);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":B[x]=
f[n];break;default:var h=u.indexOf("."),e=f[u.substring(0,h)];h=f[u.substring(h+1)];"parameter"===e&&"font"===h?B.parameterFont=n:console.warn("Propiedad del auxiliar no identificada: <"+u+"> valor: <"+n+">")}B.sequence?B.type="sequence":B.constant?B.type="constant":B.algorithm&&B.evaluate?B.type="algorithm":B.array&&!B.matrix&&")"!=B.id.charAt(B.id.length-1)?B.type="vector":B.matrix&&")"!=B.id.charAt(B.id.length-1)?B.type="matrix":B.event&&")"!=B.id.charAt(B.id.length-1)?B.type="event":"library"===
B.type?B.type="library":")"===B.id.charAt(B.id.length-1)?B.type="function":B.type="variable";a.DEBUG.typeName=B.type;switch(B.type){case "sequence":new a.Function(this.parent,B);break;case "constant":c=new a.Constant(this.parent,B);B.evaluate&&"always"===B.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,B));break;case "vector":c=new a.Vector(this.parent,B);B.evaluate&&"always"===B.evaluate&&this.parent.auxiliaries.push(c);break;
case "matrix":c=new a.Matrix(this.parent,B);B.evaluate&&"always"===B.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new a.Event(this.parent,B));break;case "library":new a.Library(this.parent,B);break;case "variable":new a.Variable(this.parent,B);break;default:new a.Function(this.parent,B)}};S.prototype.parseAction=function(c){C=c.action;J=c.parent;G=c.parameter;return C?new (a[r(C)])(J,G):{execute:function(){}}};S.prototype.parseAnimation=function(c){var b={};
c=this.split(c);for(var d=0,h=c.length;d<h;d++)switch(u=c[d][0],n=c[d][1],x=f[u],x){case "id":case "delay":case "init":case "doExpr":case "whileExpr":b[x]=n.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":b[x]="true"===f[n];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+u+">  <"+n+">")}return new a.Animation(this.parent,b)};S.prototype.parsePleca=function(h,f){h=this.split(h);e=d="";q=0;m="#536891";b="white";l=
"left";k="";g="SansSerif,BOLD,20";p="SansSerif,PLAIN,18";c=void 0;for(var r=0,x=h.length;r<x;r++)switch(u=h[r][0],n=h[r][1],u){case "title":d=n;break;case "subtitle":e=n;break;case "subtitlines":q=n;break;case "bgcolor":""!=n&&(m=(new a.Color(n,this.parent.evaluator)).getColor());break;case "fgcolor":""!=n&&(b=(new a.Color(n,this.parent.evaluator)).getColor());break;case "align":""!=n&&(l=n);break;case "titleimage":k=n;break;case "titlefont":g=""!=n?a.convertFont(n):a.convertFont(g);break;case "subtitlefont":p=
""!=n?a.convertFont(n):a.convertFont(p);break;default:console.warn("Propiedad de la pleca no identificada: <"+u+">  <"+n+">")}if(""===d&&""===e)return a.newHTML("div");O=p.substring(0,p.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=k&&(F=this.parent.getImage(k),E=F.height);c=a.newHTML("div",{id:"descartesPleca"});E?(c.setAttribute("style","position:absolute;left:0;top:0;text-align:"+l+";width:"+f+"px;height:"+E+"px;background-color:"+m+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
F.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),c.appendChild(F)):c.setAttribute("style","position:absolute;left:0;top:0;text-align:"+l+";width:"+f+"px;background:"+m+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");K=a.newHTML("div",{style:"padding:0;margin:0;font:"+g+";overflow:hidden;white-space:nowrap;"});K.innerHTML=d;L=a.newHTML("div");if(1===parseInt(q)){V=0;P=a.newHTML("div");P.innerHTML=e;document.body.appendChild(P);Q=O;do Q-=
V,P.setAttribute("style","padding:0;margin:0;font:"+p+";font-size:"+Q+"px;width:"+(f-30)+"px;line-height:"+Q+"px;"),R=P.offsetHeight,W=R/Q,V=1;while(1<W&&8<Q);document.body.removeChild(P);L.setAttribute("style","padding:0;margin:0;font:"+p+";font-size:"+Q+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else L.setAttribute("style","padding:0;margin:0;font:"+p+";line-height:1em;");L.innerHTML=e;c.appendChild(K);c.appendChild(L);c.imageHeight=E;return c};S.prototype.split=function(a){if("string"!==
typeof a)return[];H=[];a=(a||"").replace(/\\'/g,"\u2019");A=I=M=0;for(D=N=!1;A<a.length;)" "!==a.charAt(A)||D||A++," "===a.charAt(A)||D||(D=!0,M=A),"="!==a.charAt(A)||"'"!==a.charAt(A+1)||N||(N=!0,H[I]=[a.substring(M,A)],M=A+2,A+=2),N&&"'"===a.charAt(A)&&(D=N=!1,H[I].push(a.substring(M,A)),I++),"="!==a.charAt(A)||"'"===a.charAt(A+1)||N||(H[I]=[a.substring(M,A)],M=A+1,A++,U=a.substring(A).indexOf("="),-1===U?T=U=a.length:(U+=A,T=a.substring(A,U).lastIndexOf(" "),T=-1===T?a.length:T+A),H[I].push(a.substring(M,
T)),I++,D=!1,A=T),A++;return H};S.prototype.parseText=function(c){c=c||"";return c.match(/^\{\\rtf1/)?this.RTFparser.parse(c.substring(10)):new a.SimpleText(this.parent,c)};a.LessonParser=S;return a}(descartesJS||{},babel);
descartesJS=function(a){function f(a,c){if(0==c)return 1;if(0>c)return NaN;if(0<=a||l(c)===c)return Math.pow(a,c);if(0>a){var b=1/c,d=l(b);if(d===b&&1===d%2)return-Math.pow(-a,c)}return NaN}function d(a,c){x=[];x.type="matrix";x.rows=a;x.cols=c;n=0;for(z=c;n<z;n++)x[n]=Array(a).fill(0);return x}function e(a,c){h=a.rows;v=a.cols;x=d(h,v);var b;for(n=0;n<h;n++)for(u=0;u<v;u++){for(z=b=0;z<v;z++)b+=a[z][n]*c[u][z];x[u][n]=b}return x}function q(a,c,b){for(var h=d(b.length-1,b.length-1),e=0,f=h.length;e<
f;e++)for(var g=0;g<f;g++)h[e][g]=e<a?g<c?b[e][g]:b[e][g+1]:e<c?b[e+1][g]:b[e+1][g+1];return h}function m(a){if(1<a.cols){for(var c=0,b=1,d=0,h=a.cols;d<h;d++)c+=b*a[0][d]*m(q(0,d,a)),b=-b;return c}return a[0][0]}if(a.loadLib)return a;var b={},l=Math.floor,k,g,p,c,r,h,v,x,u,n,z,w=function(a,c){this.sep="";this.type=a;this.value=c;this.parent=null;this.childs=[]};w.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};w.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
w.prototype.replaceLastChild=function(a){p=this.childs.length-1;g=this.childs[p];g.parent=null;this.childs[p]=a;a.parent=this;return a};w.prototype.contains=function(a){if(this.value===a)return!0;for(var c=0,b=this.childs.length;c<b;c++)if(this.childs[c].contains(a))return!0;return!1};w.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",r=new w("compOperator","=="),r.addChild(this),r.addChild(new w("number","0")),c=this.getRoot(),c.setAllEvalFun(),
c):this};w.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,c=this.childs.length;a<c;a++)this.childs[a].setAllEvalFun()};w.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var c;this.evaluate=function(a,
b){c=a.variables[this.value];if("object"===typeof c&&void 0==c.length)return c.evaluate(a);void 0==c&&(b||a.matrices[this.value]?c=a.matrices[this.value]:a.vectors[this.value]&&(c=a.vectors[this.value]));return void 0!==c?c:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var g;this.evaluate=function(a){try{return g=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==g?g:0}catch(N){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 g=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),this.childs[0].childs[1].evaluate(a)),void 0!==g?g:0}catch(N){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var r,p,w;this.evaluate=function(a){r=[];for(var c=0,d=this.childs[0].childs.length;c<d;c++)r[c]=this.childs[0].childs[c].evaluate(a);if("_Eval_"===this.value){k=0<r.length?r[0]:0;if("number"==
typeof k)return"NaN";k.match(",")&&parseFloat(k.replace(",","."))==k.replace(",",".")&&(k=k.replace(",","."));if(void 0==b[k]){p=k.match(/:=/g)?!0:!1;if(k.match(";")){var h=!1,e=[],f=0;c=0;for(d=k.length;c<d;c++){var g=k.charAt(c);"'"===g&&(h=!h);h||";"!==g||(e.push(k.substring(f,c)),f=c+1)}e.push(k.substring(f));k="("+e.join(")(")+")"}b[k]=a.parser.parse(k,p)}w=a.eval(b[k]);return void 0!=w?w:NaN}return a.functions[this.value].apply(a,r)}}else if("operator"===this.type)"+"===this.value?this.evaluate=
function(c){var b=this.childs[0].evaluate(c,!0);c=this.childs[1].evaluate(c,!0);if("matrix"!==b.type||"matrix"!==c.type)return"number"==typeof b&&"string"==typeof c?b=a.removeNeedlessDecimals(b.toString()):"string"==typeof b&&"number"==typeof c&&(c=a.removeNeedlessDecimals(c.toString())),b+c;h=b.rows;v=b.cols;x=d(h,v);for(n=0;n<h;n++)for(u=0;u<v;u++)x[u][n]=b[u][n]+c[u][n];return x}:"-"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==
c.type||"matrix"!==a.type)return c-a;h=c.rows;v=c.cols;x=d(h,v);for(n=0;n<h;n++)for(u=0;u<v;u++)x[u][n]=c[u][n]-a[u][n];return x}:"*"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==c.type||"matrix"!==a.type?c*a:e(c,a)}:"/"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==c.type||"matrix"!==a.type)return c/a;var b=d(a.length,a.length),h=m(a);if(0===h)a=
0;else{h=1/h;if(1<a.length)for(var f=0,g=a.length;f<g;f++){var k=h;for(var n=0;n<g;n++)b[n][f]=k*m(q(f,n,a)),k=-k;h=-h}else b[0][0]=h;a=b}c=0===a?d(c.rows,c.cols):e(c,a);return c}:"%"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return c-l(c/a)*a}:"^"===this.value&&(this.evaluate=function(a){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?f(c,a):1/f(c,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)===this.childs[1].evaluate(a))}:
"!="===this.value&&(this.evaluate=function(a){return+(this.childs[0].evaluate(a)!==this.childs[1].evaluate(a))});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<
this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2].evaluate(a)};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,c){return this.childs[0].evaluate(a,c)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var c=this.childs.length,b=[];if(1===c&&1===this.childs[0].childs.length&&"(expr)"===this.type)b=
this.childs[0].childs[0].evaluate(a);else for(var d=0;d<c;d++){var h=[];for(var e=0,f=this.childs[d].childs.length;e<f;e++)h.push(this.childs[d].childs[e].evaluate(a));b[d]=h}return b};else if("asign"===this.type){var z,A=this.childs[0],I=this.childs[1],D=A.childs[0]?A.childs[0].childs:null;this.evaluate=1===A.childs.length&&"square_bracket"===A.childs[0].type&&1===D.length?function(a){z=I.evaluate(a);a.setVector(A.value,D[0].evaluate(a),z);return z}:1===A.childs.length&&"square_bracket"===A.childs[0].type&&
2===D.length?function(a){z=I.evaluate(a);a.setMatrix(A.value,D[0].evaluate(a),D[1].evaluate(a),z);return z}:function(a){z=I.evaluate(a);return z.type?a.matrices[A.value]=z:"object"!==typeof a.variables[A.value]?a.variables[A.value]=z:0}}};a.Node=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g=/^\s+/,p=/^[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]*)*/,c=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,r=/^==|^!=|^<=|^<|^>=|^>|^#/,h=/^!|^~|^&&|^&|^\|\||^\|/,v=/^=|^:=/,x=/^[\?:]/,u=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,n=/^\[|^\]/,z=/^\(|^\)/,w=/^,/,y=/^;/,B=/\|/g,C=/\|\*/g,J=/\*\|/g,G,H=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
A=function(){};A.prototype.tokenize=function(A){function G(a,c,h){d.push({type:a,value:c});b=b.slice(h);q+=h;k=a}if(f=A){var H=A.indexOf("//");0<=H&&":"!==A[H-1]&&(A=A.substring(0,H));A=A.replace(/\\u(\S+) /g,function(a,c){return 39!==parseInt(c,16)?String.fromCharCode(parseInt(c,16)):a});A=A.replace(/&sup(.+);/g,"^ $1 ");A=A.replace(/&squot;/g,"'");A.match(/=\|\*/g)&&(A=A.replace(C,"'").replace(J,"'"));A.match(/=\|/g)&&(A=A.replace(B,"'"));H=A.trim();"|"==H.charAt(0)&&"|"==H.charAt(H.length-1)&&
(A=H.replace(B,"'"))}d=[];e=!1;q=0;b=A;for(k="";A&&q<A.length;)if(e=q,"'"==b[0]){for(l=1;"'"!=b[l];)if(l<b.length)l++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+f+"\u300b");return}m=b.substring(1,l);G("string",m,m.length+2)}else if(m=b.match(g))b=b.slice(m[0].length),q+=m[0].length;else if(m=b.match(u))m[0]=m[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),G("operator",m[0],m[0].length);else if(m=b.match(p))"number"===k&&
d.push({type:"operator",value:"*"}),G("identifier",m[0],m[0].length);else if(m=b.match(c))G("number",m[0],m[0].length);else if(m=b.match(r))H=m[0],"#"==H&&(H="!="),G("compOperator",H,m[0].length);else if(m=b.match(h))H=m[0],"||"==H?H="|":"&&"==H?H="&":"~"==H&&(H="!"),G("boolOperator",H,m[0].length);else if((m=b.match(v))&&!b.match(/^==/))G("asign",m[0],m[0].length);else if(m=b.match(x))G("conditional",m[0],m[0].length);else if(m=b.match(n))G("square_bracket",m[0],m[0].length);else if(m=b.match(z))"("==
m&&"number"===k&&d.push({type:"operator",value:"*"}),G("parentheses",m[0],m[0].length);else if(m=b.match(w))G("separator",m[0],m[0].length);else if(178===b.charCodeAt(0))d.push({type:"operator",value:"^"}),G("number",2,1);else if(179===b.charCodeAt(0))d.push({type:"operator",value:"^"}),G("number",3,1);else if(m=b.match(y))G("final_of_expression",m[0],m[0].length);else if(e==q){a.DEBUG.setError(a.DEBUG.EXPRESSION,f);return}return d};A.prototype.flatTokens=function(a,c){a=a||[];c=c||"";G="";for(var b=
0,d=a.length;b<d;b++)G="string"==a[b].type?G+"&squot;"+a[b].value+"&squot;":"identifier"!=a[b].type||a[b].value.match(H)?G+a[b].value:G+c+a[b].value;return G};a.Tokenizer=A;return a}(descartesJS||{});
descartesJS=function(a){function f(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function d(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-ceil-round-min-max-_Trace_-_Print_-_Num_-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var e=Date.now(),q,m,b,l,k,g,p,c,r,h,v,x,u=function(c){this.evaluator=c;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};u.prototype.setDefinition=function(a,c){this.definitions[a]=c};u.prototype.getDefinition=function(a){return this.definitions[a]};u.prototype.setVariable=function(a,c){this.variables[a]=c};u.prototype.getVariable=function(a,
c){c&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};u.prototype.setVector=function(a,c,b){this.vectors[a][c]=b};u.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};u.prototype.setMatrix=function(a,c,b,d){this.matrices[a][c][b]=d};u.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};u.prototype.setFunction=
function(a,c){this.functions[a]=c};u.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};u.prototype.parse=function(d,e){(b=this.tokenizer.tokenize(d))||(b=[]);l=null;e=!e||!1;q=c=p=g=0;for(m=b.length;q<m;q++){r=b[q];h=r.value;v=r.type;if("identifier"===v)if(q+1<m&&"parentheses"===b[q+1].type&&"("===b[q+1].value)this.getFunction(h);else if(q+1<m&&"square_bracket"===b[q+1].type&&"["===b[q+1].value)b[q+3]&&"square_bracket"===
b[q+3].type&&"]"===b[q+3].value?this.getVector(h):this.getMatrix(h);else{var n=h.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);n&&(this.variables[(n[1]||n[2]||n[3]||n[4]||n[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(h,!0)}"asign"===v&&e&&":="!=h&&(v="compOperator",h="==");if("asign"===v)if(k=new a.Node(v,h),null!=l)if("identifier"===l.type)l.parent&&l.parent.replaceLastChild(k),k.addChild(l),l=k,e=!0;else if("square_bracket"===l.type)k.addChild(l.parent),
l=k,e=!0;else{k.type="compOperator";k.value="==";for(e=!0;l.parent&&f(l.parent.value)>=f(k.value);)l=l.parent;l.parent&&l.parent.replaceLastChild(k);k.addChild(l);l=k}else{console.info("Error1: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}else if("parentheses"===v&&"("===h||"square_bracket"===v&&"["===h)if(k=new a.Node(v,h),"("===h&&g++,"["===h&&p++,null===l)"("===h&&(new a.Node("(expr)","(expr)")).addChild(k),"["===h&&(new a.Node("[expr]","[expr]")).addChild(k),
l=k;else if("operator"===l.type||"boolOperator"===l.type||"compOperator"===l.type||"conditional"===l.type||"asign"===l.type)l.addChild(k),l=k;else if("sign"===l.type)l.addChild(k),l=k;else if("parentheses"===l.type&&"("===l.value)l.addChild(k),l=k;else if("square_bracket"===l.type&&"["===l.value)l.addChild(k),l=k;else if("parentheses"===l.type&&"()"===l.value)l.parent.addChild(k),l=k;else if("square_bracket"===l.type&&"[]"===l.value)l.parent.addChild(k),l=k;else if("identifier"===l.type)l.addChild(k),
l=k;else{console.info("Error2: en la expresi\u00f3n \u300a "+d+" \u300b, en el token ["+q+"] {valor: "+h+", tipo: "+v+"}");break}else if("parentheses"===v&&")"===h)if(g--,null===l)console.info("Error3: en la expresi\u00f3n \u300a "+d+" \u300b, en el token (valor:"+h+", tipo:"+v);else{for(;l&&l.parent&&("("!=l.value||"("==l.value&&"parentheses"!=l.type);)l=l.parent;if(l&&"("===l.value)l.value="()";else break}else if("square_bracket"===v&&"]"===h)if(p--,null===l)console.info("Error5: en la expresi\u00f3n \u300a "+
d+" \u300b, en el token (valor:"+h+", tipo:"+v);else{for(;l&&l.parent&&("["!=l.value||"["==l.value&&"square_bracket"!=l.type);)l=l.parent;if(l&&"["===l.value)l.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}}else if("number"===v||"string"===v||"identifier"===v)if(k=new a.Node(v,h),null===l)l=k;else if("operator"===l.type||"compOperator"===l.type||"boolOperator"===l.type||"parentheses"===l.type&&"("===l.value||"square_bracket"===
l.type&&"["===l.value||"sign"===l.type||"conditional"===l.type||"asign"===l.type)l.addChild(k),l=k;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,d);break}else if("operator"===v||"compOperator"===v||"boolOperator"===v)if(k=new a.Node(v,h),null===l)if("-"===h||"+"===h)k.type="sign",k.value="sign"+h,l=k;else if("!"===h)l=k;else{console.info("Error8: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}else if("operator"===l.type||"compOperator"===l.type||"boolOperator"===
l.type||"asign"===l.type||"conditional"===l.type||"square_bracket"===l.type&&"["===l.value&&("-"===h||"+"===h||"!"===h)||"parentheses"===l.type&&"("===l.value&&("-"===h||"+"===h||"!"===h)){if("-"===h||"+"===h)k.type="sign",k.value="sign"+h;l.addChild(k);l=k}else if("number"===l.type||"parentheses"===l.type&&"()"===l.value||"square_bracket"===l.type&&"[]"===l.value||"string"===l.type||"identifier"===l.type||"conditional"===l.type||"asign"===l.type){for(;l.parent&&f(l.parent.value)>=f(k.value);)l=l.parent;
l.parent&&l.parent.replaceLastChild(k);k.addChild(l);l=k}else{console.info("Error9: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}else if("conditional"===v)if(k=new a.Node(v,h),null!=l)if("?"===k.value){for(c++;l.parent&&f(l.parent.value)>f(k.value);)l=l.parent;l.parent&&l.parent.replaceLastChild(k);k.addChild(l);l=k}else{for(c--;l&&l.parent&&("?"!=l.value||"?"==l.value&&"conditional"!=l.type);)l=l.parent;if(l&&"?"===l.value)l.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+
d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}else if("separator"===v)if(null!=l)for(;l.parent&&"("!=l.value&&"["!=l.value;)l=l.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+h+", tipo: "+v+"}");break}}0<
g&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,d);0>g&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,d);0<p&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,d);0>p&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,d);0!=c&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,d);(x=l?l.getRoot():null)&&x.setAllEvalFun();return x};u.prototype.registerDefaultValues=function(){var c=this;c.variables.rnd=Math.random;c.variables.pi=c.variables["\u03c0"]=a.returnValue(Math.PI);c.variables.e=a.returnValue(Math.E);c.variables.Infinity=
Infinity;c.variables["-Infinity"]=-Infinity;c.variables.isTouch=c.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;Object.defineProperties(c.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});c.functions.sqr=function(a){return a*a};c.functions.sqrt=c.functions["ra\u00edz"]=Math.sqrt;c.functions.exp=Math.exp;
c.functions.log=Math.log;c.functions.log10=function(a){return Math.log(a)/Math.log(10)};c.functions.abs=Math.abs;c.functions.ent=Math.floor;c.functions.sgn=function(a){return 0<a?1:0>a?-1:0};c.functions.ind=function(a){return a?1:0};c.functions.sin=c.functions.sen=Math.sin;c.functions.cos=Math.cos;c.functions.tan=Math.tan;c.functions.cot=function(a){return 1/Math.tan(a)};c.functions.sec=function(a){return 1/Math.cos(a)};c.functions.csc=function(a){return 1/Math.sin(a)};c.functions.sinh=c.functions.senh=
function(a){return(Math.exp(a)-Math.exp(-a))/2};c.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};c.functions.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};c.functions.coth=function(a){return 1/c.functions.tanh(a)};c.functions.sech=function(a){return 1/c.functions.cosh(a)};c.functions.csch=function(a){return 1/c.functions.sinh(a)};c.functions.asin=c.functions.asen=Math.asin;c.functions.acos=Math.acos;c.functions.atan=Math.atan;c.functions.atan2=Math.atan2;
c.functions.floor=Math.floor;c.functions.ceil=Math.ceil;c.functions.round=Math.round;c.functions.min=Math.min;c.functions.max=Math.max;c.functions._Trace_=c.functions._Print_=function(){console.info.apply(console,arguments);return 0};c.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};c.functions._Stop_Audios_=function(){c.evaluator.parent.stopAudios()};c.functions.esCorrecto=function(b,d,h){return a.esCorrecto(b,d,c.evaluator,
h)};c.functions.escorrecto=function(b,d,h){return a.escorrecto(b,d,c.evaluator,h)};window.parent!==window&&(c.functions["parent.set"]=function(a,c){window.parent.postMessage({type:"set",name:a,value:c},"*");return 0},c.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},"*");return 0},c.functions["parent.exec"]=function(a,c){window.parent.postMessage({type:"exec",name:a,value:c},"*");return 0});c.functions.toFixed=c.functions._NumToStr_=c.functions._NumACadena_=function(a,
c){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(c||0))};c.functions.charAt=c.functions._charAt_=c.functions._letraEn_=function(a,c){a=(a||"").toString();c=isNaN(parseInt(c))?0:parseInt(c);return a.charAt(c)};c.functions.substring=c.functions._substring_=c.functions._subcadena_=function(a,c,b){a=(a||"").toString();c=isNaN(parseInt(c))?0:parseInt(c);b=isNaN(parseInt(b))?0:parseInt(b);return 0<=c&&0<=b?a.substring(c,b):0>c&&0<=b?a.substring(b):0>b&&0<=c?a.substring(c):""};c.functions.strLength=
c.functions._length_=c.functions._longitud_=function(a){return(a||"").toString().length};c.functions.indexOf=c.functions._indexOf_=c.functions["_\u00edndiceDe_"]=function(a,c){return(a||"").toString().indexOf((c||"").toString())};c.functions.lastIndexOf=function(a,c){return(a||"").toString().lastIndexOf((c||"").toString())};c.functions.replace=c.functions._replace_=c.functions._reemplazar_=function(a,c,b){a=(a||"").toString();c=(c||"").toString();b=(b||"").toString();for(var d=a.indexOf(c);0<=d;)a=
a.substring(0,d)+b+a.substring(d+c.length),d=a.indexOf(c);return a};c.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};c.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};c.functions._Load_=function(c){var b="";c&&(b=(b=document.getElementById(c))&&"descartes/archivo"==b.type?b.text:a.openExternalFile(c));return b||""};c.functions._GetValues_=function(a,b){return c.functions._ExecBlock_(c.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),
b)};c.functions._GetMatrix_=function(a,b){return c.functions._StrToMatrix_(c.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),b)};c.functions._MatrixToStr_=function(b){var d=c.matrices[b];if(d){for(var h="<"+b+">\\n",e=c.getVariable(b+".columnas_usadas")||d.cols||0,f=c.getVariable(b+".filas_usadas")||d.rows||0,g,k=0;k<e;k++){for(var l=0;l<f;l++)g=d[k][l],void 0!==g&&("string"==typeof g?g="'"+g+"'":"number"==typeof g&&(g=a.removeNeedlessDecimals(g.toFixed(6))),h+=g+(l<f-1?" \u00a6 ":
""));h=h.replace(/(\u00A6 )$/g,"")+"\\n"}return h+"</"+b+">"}return""};c.functions._StrToMatrix_=function(a,b){var h=[],e=!1,f=!1;h.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,k=a.length;g<k;g++)a[g].match("<"+b+">")?(f=!0,e=a[g].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&h.push(e[1].split(String.fromCharCode("166")).map(d)),e=!0):(a[g].match("</"+b+">")&&(e=a[g].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&h.push(e[0].split(String.fromCharCode("166")).map(d)),
e=!1,g=a.length),e&&h.push(a[g].split(String.fromCharCode("166")).map(d)));c.matrices[b]=h;c.matrices[b].rows=h&&h[0]&&h[0].length?h[0].length:0;c.matrices[b].cols=h&&h.length?h.length:0;c.setVariable(b+".filas",c.matrices[b].rows);c.setVariable(b+".columnas",c.matrices[b].cols)}return f?"OK":"ERROR"};c.functions._GetVector_=function(a,b){return c.functions._StrToVector_(c.functions._Load_(a),b)};c.functions._VectorToStr_=function(a){var b=c.vectors[a];if(b){for(var d="<"+a+">\\n",h=c.getVariable(a+
".long_usada")||b._size_||0,e,f=0;f<h;f++)e=b[f],void 0!==e?("number"==typeof e&&(e=parseFloat(e)),d+=e+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};c.functions._StrToVector_=function(a,b){var h=[],e=!1,f=!1;h.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,k=a.length;g<k;g++)a[g].match("<"+b+">")?e=f=!0:(a[g].match("</"+b+">")&&(e=!1,g=a.length),e&&h.push(d(a[g])));h._size_=h.length;c.vectors[b]=h;c.setVariable(b+".long",h.length);c.setVariable(b+".long_usada",h.length)}return f?
"OK":"ERROR"};c.functions._ExecStr_=function(a){return c.functions._ExecBlock_(a,"")};c.functions._ExecBlock_=function(a,b){var d=[],h=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var e=0,f=a.length;e<f;e++)a[e].match("<"+b+">")?(h=a[e].trim().split("<"+b+">"),2==h.length&&""!=h[1]&&(d=d.concat(h[1].split(String.fromCharCode("166")))),h=!0):a[e].match("</"+b+">")?(h=a[e].trim().split("</"+b+">"),2==h.length&&""!=h[0]&&(d=d.concat(h[0].split(String.fromCharCode("166")))),h=!1):h&&(d=d.concat(a[e].split(String.fromCharCode("166"))));
e=0;for(f=d.length;e<f;e++)h=d[e].split("="),h[0]=h[0].trim(),2==h.length&&""!=h[0]&&(isNaN(parseFloat(h[1]))?c.setVariable(h[0],h[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):c.setVariable(h[0],parseFloat(h[1])))}return 0};var b=a.newHTML("a",{target:"_blank"}),h,f=null;a.newBlobContent=null;c.functions._Save_=function(d,g){c.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(e=Date.now(),document.body.appendChild(b),f=g.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,
"\\"),h=new Blob(["\ufeff",f],{type:"text/plain;charset=utf-8"}),b.setAttribute("href",window.URL.createObjectURL(h)),b.setAttribute("download",d),f!=a.newBlobContent&&(b.click(),a.newBlobContent=f),document.body.removeChild(b));return 0};var g,k,l=a.newHTML("input",{type:"file"});l.addEventListener("change",function(b){g=b.target.files;k=new FileReader;k.onload=function(b){a.addExternalFileContent(g[0].name,b.target.result);c.setVariable("DJS.fileName",g[0].name);c.setVariable("DJS.fileContent",
b.target.result);c.getFunction(c._callback)&&(c.getFunction(c._callback).apply(c.evaluator,[]),c.evaluator.parent.update());l.value=""};0<g.length&&k.readAsText(g[0])});c.functions._Open_=function(a){c.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(c._callback=a,l.click(),e=Date.now());return 0};c.functions._AnchoDeCadena_=c.functions._strWidth_=function(c,b,d,h){return a.getTextWidth(c,a.convertFont(b+","+d+","+h))};c.functions._Rojo_=c.functions._Red_=function(c){return(new a.Color(c)).r/
255};c.functions._Verde_=c.functions._Green_=function(c){return(new a.Color(c)).g/255};c.functions._Azul_=c.functions._Blue_=function(c){return(new a.Color(c)).b/255};c.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=function(d){this.parent=d;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,d){this.definitions[a]=d};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,d){this.variables[a]=d};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(a,d,m){d=0>d?0:f(d);this.vectors[a][d]=m};d.prototype.getVector=function(a,d){d=0>d?0:f(d);return this.vectors[a][d]};d.prototype.setMatrix=function(a,d,m,b){d=0>d?0:f(d);m=0>m?0:f(m);void 0==this.matrices[a][d]&&(this.matrices[a][d]=[]);this.matrices[a][d][m]=b};d.prototype.getMatrix=function(a,d,m){d=0>d?0:f(d);m=0>m?0:f(m);return this.matrices[a][d][m]};d.prototype.setFunction=function(a,d){this.functions[a]=d};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new d;a.Evaluator=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p,c,r,h,v,x,u=function(c,b){this.parent=c;this.evaluator=c.evaluator;this.decimals=c.decimals;this.fixed=c.fixed;this.align=c.align||"left";this.anchor=c.anchor||"a_top_left";this.decimal_symbol=c.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==b;this.textStr=(b||"").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;b.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=b,this.textNodes=(new a.RTFParser(c.evaluator)).parse(b.substring(10))):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null))};u.prototype.draw=function(a,c,b,d,h){this["rtfNode"===this.type?"drawRTF":"drawText"](a,c,b,d,h)};u.prototype.drawText=function(c,h,g,k,l){f=
this.evaluator.eval(this.decimals);d=this.evaluator.eval(this.parent.width);e=this.evaluator.eval(this.parent.font_size);q=h.getColor?h.getColor():h;m=this.textToString(this.text,f,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=m.indexOf("[")&&(m=this.textToString(this.parseSimpleText(m),f,this.fixed));if(this.oldTextStr!==m||this.oldWidth!==d||this.oldSize!==e||this.oldColor!==
q||this.oldPosX!==g||this.oldPoxY!==k)b=new a.TextStyle({size:e,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}),this.textNodes=this.descarTeXParser.parse(m,this.evaluator,b),this.textNodes.update(g,k,f,this.fixed,this.align,this.anchor,q,d);l||this.textNodes.draw(c);this.oldTextStr=m;this.oldWidth=d;this.oldSize=e;this.oldColor=q;this.oldPosX=g;this.oldPoxY=k};u.prototype.drawRTF=function(a,c,b,d,
h){c=c.getColor?c.getColor():c;a.fillStyle=a.strokeStyle=c;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(b,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,c,this.evaluator.eval(this.parent.width));h||this.textNodes.draw(a)};u.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");l=[];k="'";p=g=0;c=-1;for(v=a.length;g<v;)r=a.charAt(g),h=a.charAt(g-
1),"["===r&&"\\"===h?(l.push(a.substring(p,g-1)+"["),p=g+1):"]"===r&&"\\"===h?(l.push(a.substring(p,g-1)+"]"),p=g+1):"["===r&&-1===c?(l.push(a.substring(p,g)),p=g,c++):"["===r?c++:"]"===r&&0===c?(l.push(this.evaluator.parser.parse(a.substring(p,g+1))),p=g+1,c--):("]"==a.charAt(g)&&(c=0>c?c:c-1),k+=a.charAt(g)),g++;l.push(a.substring(p,g));return l};u.prototype.textToString=function(c,b,d){k="";if("rtfNode"!==c.type)for(var h=0,e=c.length;h<e;h++)"string"===typeof c[h]?k+=c[h]:(x=this.evaluator.eval(c[h])[0][0],
""!==x&&("string"===typeof x?k+=x:Infinity===x?k+="Infinity":-Infinity===x?k+="-Infinity":isNaN(x)||"NaN"===x?k+="NaN":(x=parseFloat(x),x=d?x.toFixed(b):a.removeNeedlessDecimals(x.toFixed(b)),k+=x.toString().replace(".",this.decimal_symbol))));return k};a.TextObject=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d=function(){};d.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var d=[],e=null,b=0,l=a.length;a.charAt(0);var k=!1,g=!1,p=0;f="";for(var c=0;c<l;c++){var r=a.charAt(c);var h=a.charAt(c+1);"\\"===r&&"$"===h&&(g=!0);"{"===r?p++:"}"===r&&(p--,g&&0===p&&(g=!1));g?"_"===r?"{"===h?f+="\\subindex":(f+="\\subindex{"+h+"}",c++):"^"===r?"{"===h?f+="\\superindex":(f+="\\superindex{"+h+"}",c++):f+=r:f+=r}a=f;h=a.charAt(0);for(l=a.length;b<
l;)r=h,h=a.charAt(b+1),k&&("{"===r||"["===r||"\\"===r||" "===r?(k=!1," "===r&&(e={type:"ignore"},d.push(e))):e.value+=r),k||"\\"!==r?k||"{"!==r&&"["!==r?k||"}"!==r&&"]"!==r?k||(e&&"text"===e.type?e.value+=r:e&&"ignore"===e.type?(d.pop(),e=d[d.length-1]):(e={type:"text",value:r},d.push(e))):(e={type:"close",value:r},d.push(e)):(e={type:"open",value:r},d.push(e)):(k=!0,e={type:"command",value:""},d.push(e)),b++;return d};a.DescarTeXTokenizer=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(){this.tokenizer=new a.DescarTeXTokenizer};f.prototype.parse=function(d,e,f){d=this.tokenizer.tokenize(d);var m=new a.TextNode("","textBlock",f,null),b=new a.TextNode("","textLineBlock",f.clone(),null);m.addChild(b);for(var l=[],k=void 0,g=f,p=[f],c,r,h,v,x=!1,u=0,n=d.length;u<n;u++)if("text"===d[u].type)if("color_parameter"===k)r=new a.Color(d[u].value,e);else if("text_size_parameter"===k)h=parseFloat(d[u].value);else if("textLineBlock"===
b.nodeType){c=d[u].value.split(" ");for(var q=0,w=c.length;q<w;q++)""!==c[q]&&b.addChild(new a.TextNode(c[q],"text",g.clone(),null)),q+1<w&&b.addChild(new a.TextNode(" ","space",g.clone(),null))}else b.addChild(new a.TextNode(d[u].value,"text",g.clone(),null));else if("command"===d[u].type&&"curlyBracketOpen"===d[u].value)b.addChild(new a.TextNode("{","text",g.clone(),null));else if("command"===d[u].type&&"curlyBracketClose"===d[u].value)b.addChild(new a.TextNode("}","text",g.clone(),null));else if("command"===
d[u].type&&"squareBracketOpen"===d[u].value)b.addChild(new a.TextNode("[","text",g.clone(),null));else if("command"===d[u].type&&"squareBracketClose"===d[u].value)b.addChild(new a.TextNode("]","text",g.clone(),null));else if("command"===d[u].type&&"newline"===d[u].value)0===b.children.length&&b.addChild(new a.TextNode("","text",g.clone(),null)),b=new a.TextNode("","textLineBlock",f.clone(),null),m.addChild(b);else if("command"===d[u].type&&"b"===d[u].value)k="bold",l.push(k);else if("command"===d[u].type&&
"i"===d[u].value)k="italic",l.push(k);else if("command"===d[u].type&&"color"===d[u].value)k="color",l.push(k);else if("command"===d[u].type&&"ts"===d[u].value)k="text_size",l.push(k);else if("command"===d[u].type&&"sansserif"===d[u].value.toLowerCase())k="sansserif",l.push(k);else if("command"===d[u].type&&"serif"===d[u].value.toLowerCase())k="serif",l.push(k);else if("command"===d[u].type&&"monospace"===d[u].value.toLowerCase())k="monospace",l.push(k);else if("command"===d[u].type&&"c"===d[u].value)k=
"center",l.push(k);else if("command"===d[u].type&&"l"===d[u].value)k="left",l.push(k);else if("command"===d[u].type&&"r"===d[u].value)k="right",l.push(k);else if("command"===d[u].type&&"j"===d[u].value)k="justify",l.push(k);else if("command"===d[u].type&&"$"===d[u].value)k="formula",l.push(k),x=!0;else if("command"===d[u].type&&"sum"===d[u].value)k="sum",l.push(k);else if("command"===d[u].type&&"int"===d[u].value)k="integral",l.push(k);else if("command"===d[u].type&&"lim"===d[u].value)k="limit",l.push(k);
else if("command"===d[u].type&&"sqrt"===d[u].value)k="radical",l.push(k);else if("command"===d[u].type&&"subindex"===d[u].value)k="subIndex",l.push(k);else if("command"===d[u].type&&"superindex"===d[u].value)k="superIndex",l.push(k);else if("command"===d[u].type&&"frac"===d[u].value)k="numerator",l.push(k);else if("open"===d[u].type&&"{"===d[u].value&&void 0!==k)"bold"===k||"italic"===k?(g=g.clone(),g[k]=!0,p.push(g)):"sansserif"===k?(g=g.clone(),g.family="sansserif",p.push(g)):"serif"===k?(g=g.clone(),
g.family="serif",p.push(g)):"monospace"===k?(g=g.clone(),g.family="monospaced",p.push(g)):"text_size"===k?k="text_size_parameter":"text_size_text"===k?(g=g.clone(),g.size=h,p.push(g)):"color"===k?k="color_parameter":"color_text"===k?(g=g.clone(),g.color=r,p.push(g)):"center"===k||"left"===k||"right"===k||"justify"===k?(g=g.clone(),g.align=k,p.push(g),b=new a.TextNode("","textLineBlock",g.clone(),null),m.addChild(b)):"formula"===k?(g=g.clone(),g.italic=!0,p.push(g),v=new a.TextNode("","formula",g.clone(),
null),b.addChild(v),b=v):"subIndex"===k||"superIndex"===k?x?(g=g.clone(),p.push(g),v=new a.TextNode("",k,g.clone(),null),b.addChild(v),b=v):b.addChild(new a.TextNode("subIndex"===k?"_":"^","text",g.clone(),null)):"radical"===k?x&&(v=new a.TextNode("","radical",g.clone(),null),b.addChild(v),b=v,g=g.clone(),p.push(g),v=new a.TextNode("","index",g.clone(),null),b.addChild(v),b=v,k="index"):"index"===k?x&&(p.pop(),g=p[p.length-1],v=new a.TextNode("","radicand",g.clone(),null),b.addChild(v),b=v,k="radicand"):
"sum"===k||"integral"===k||"limit"===k?x&&(v=new a.TextNode("",k,g.clone(),null),b.addChild(v),b=v,g=g.clone(),p.push(g),v=new a.TextNode("","from",g.clone(),null),b.addChild(v),b=v,k="from"):"from"===k?x&&(v=new a.TextNode("","to",g.clone(),null),b.addChild(v),b=v,k="to"):"to"===k?x&&(p.pop(),g=p[p.length-1],v=new a.TextNode("","what",g.clone(),null),b.addChild(v),b=v,k="what"):"numerator"===k?x&&(v=new a.TextNode("","fraction",g.clone(),null),b.addChild(v),b=v,g=g.clone(),p.push(g),v=new a.TextNode("",
"numerator",g.clone(),null),b.addChild(v),b=v,k="numerator"):"denominator"===k&&(v=new a.TextNode("",k,g.clone(),null),b.addChild(v),b=v);else if("close"===d[u].type&&"}"===d[u].value&&void 0!==k){if("bold"===k||"italic"===k||"color_text"===k||"color"===k||"text_size_text"===k||"text_size"===k||"sansserif"===k||"serif"===k||"monospace"===k)p.pop(),g=p[p.length-1],l.pop(),k=l[l.length-1];else if("color_parameter"===k){k="color_text";continue}else if("text_size_parameter"===k){k="text_size_text";continue}else if("center"===
k||"left"===k||"right"===k||"justify"===k)p.pop(),g=p[p.length-1],l.pop(),k=l[l.length-1],d[u+1]&&"command"===d[u+1].type&&"newline"===d[u+1].value?b=m:(b=new a.TextNode("","textLineBlock",g.clone(),null),m.addChild(b));"formula"===b.nodeType?(x=!1,p.pop(),g=p[p.length-1],l.pop(),k=l[l.length-1],b=b.parent):"subIndex"===b.nodeType||"superIndex"===b.nodeType?x&&(p.pop(),g=p[p.length-1],l.pop(),k=l[l.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(l.pop(),k=l[l.length-
1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(l.pop(),k=l[l.length-1],b=b.parent.parent):"numerator"===b.nodeType?(k="denominator",b=b.parent):"denominator"===b.nodeType&&(p.pop(),g=p[p.length-1],l.pop(),k=l[l.length-1],b=b.parent.parent)}var y,B,C=null,J=[];m.children.forEach(function(a){for(var c=0,b=a.children.length;c<b-1;c++)y=a.children[c],B=a.children[c+1],"text"===y.nodeType&&"text"===B.nodeType&&y.style.equals(B.style)?(null===C&&(C=
y,v=y.clone(),C.changeNodeType("word"),C.value="___"+v.value,C.addChild(v)),v=B.clone(),C.addChild(v),J.push(B),C.value+=v.value):C=null});J.forEach(function(a){a.parent.removeChild(a)});m.normalize();m.adjustFontSize();return m};a.DescarTeXParser=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d=[a.sansserif_font,a.serif_font,a.monospace_font],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 d=!0,b;for(b in this)this.hasOwnProperty(b)&&(d=d&&this[b]===a[b]);return d};
e.prototype.toString=function(){/arial|sansserif/i.test(this.family)?f=d[0]:/times|serif/i.test(this.family)?f=d[1]:/courier|monospaced/i.test(this.family)&&(f=d[2]);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+f).trim()};a.TextStyle=e;return a}(descartesJS||{});
descartesJS=function(a){function f(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function d(a){var c={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 c;var b=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";c.ascent=Math.ceil((p[a].ascent+25)*b/p[a].unitsPerEm);c.descent=Math.ceil(Math.abs((p[a].descent-25)*b/p[a].unitsPerEm));c.h=c.ascent+c.descent;return c}if(a.loadLib)return a;
var e="#000000",q=2,m=!1,b=new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z");b.svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";var l=new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z");l.svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";var k=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");k.svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
var g=function(a,b,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=a;this.style=d;this.changeNodeType(b);this.drawBorder=function(){}};g.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;break;case "formula":this.draw=
this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=this.drawIntegral;break;case "sum":this.draw=
this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;
break;case "componentSpace":this.draw=this.drawComponentSpace}};g.prototype.clone=function(){for(var a=new g(this.value,this.nodeType,this.style.clone()),b=0,d=this.children.length;b<d;b++)a.addChild(this.children[b].clone());return a};g.prototype.toStr=function(){for(var a=this.value,b=0,d=this.children.length;b<d;b++)a+=" "+this.children[b].toStr();return a};g.prototype.stringify=function(){var a="{"+('"NT":"'+this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,d=this.children.length;b<
d;b++)a+=this.children[b].stringify()+(b==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};g.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};g.prototype.removeChild=function(a){var c=this.children.indexOf(a);-1!==c&&(a.parent=null,this.children.splice(c,1))};g.prototype.getFirstTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[0];return a};g.prototype.getLastTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[a.children.length-1];return a};g.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,d=this.parent.children.length;b<d;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};g.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];return null};g.prototype.queryAll=function(a){var c=[];"string"===typeof a&&
(a=new RegExp(a));for(var b=0,d=this.children.length;b<d;b++)c=c.concat(this.children[b].queryAll(a));this.nodeType.match(a)&&c.push(this);return c};g.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};g.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};g.prototype.normalize=function(){for(var a=this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),
b=0,d=a.length;b<d;b++)0===a[b].children.length&&a[b].addChild(new g("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(d=a.length;b<d;b++){var e=a[b];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,new g("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&
e.parent.insertAfter(e,new g("","text",e.parent.style))}return this};g.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,d=a.length;b<d;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};g.prototype.adjustFontSize=function(a){var c=this.style.size;"formula"===this.nodeType&&(a=!0);for(var b=0,d=this.children.length;b<d;b++)"text"===this.children[b].nodeType&&a?(this.children[b].style.size=c,this.children[b].styleString=this.children[b].style.toString()):"index"===
this.children[b].nodeType?(this.children[b].style.size=Math.max(parseInt(c-.5*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):"to"===this.children[b].nodeType||"from"===this.children[b].nodeType?(this.children[b].style.size=Math.max(parseInt(c-.2*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):"numerator"===this.children[b].nodeType||"denominator"===this.children[b].nodeType?(this.children[b].style.size=
Math.max(parseInt(c-.1*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):"subIndex"===this.children[b].nodeType||"superIndex"===this.children[b].nodeType?(this.children[b].style.size=Math.max(parseInt(c-.33*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):(a&&(this.children[b].style.size=c,this.children[b].styleString=this.children[b].style.toString()),this.children[b].adjustFontSize(a))};
g.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};g.prototype.update=function(a,b,d,f,g,k,l,p){q=d;m=f;e=l;this.metrics.w=this.metrics.h=0;l=b;if(20<=p)for(d=0;d<this.children.length;d++)this.children[d].breakLines(p);d=0;for(f=this.children.length;d<f;d++){var c=this.children[d];c.updateLine();c.metrics.offsetX=a;c.metrics.y=b;b+=parseInt(c.metrics.ascent+.5);c.metrics.offsetY=
b;g=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);b+=g;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}b=l;k=k||"";k.match("right")?a-=this.metrics.w:k.match("_center")&&(a-=this.metrics.w/2);k.match("bottom")?b-=this.metrics.h:k.match("center_")&&(b-=this.metrics.h/2);k=this.children;d=0;for(f=k.length;d<f;d++)"left"===k[d].style.align?k[d].metrics.offsetX=a:"right"===k[d].style.align?k[d].metrics.offsetX=a+this.metrics.w-k[d].metrics.w:"center"===
k[d].style.align?k[d].metrics.offsetX=a+(this.metrics.w-k[d].metrics.w)/2:"justify"===k[d].style.align&&20<=p&&(g=d<f-1?k[d+1].value:null,k[d].metrics.offsetX=a,"wrap"===g&&k[d].justifyAux(p)),k[d].metrics.y=b,b+=parseInt(k[d].metrics.ascent+.5),k[d].metrics.offsetY=b,g=parseInt(k[d].metrics.descent+.5)+parseInt(1.5+.05*k[d].style.size),b+=g};g.prototype.breakLines=function(c){for(var b,d=0,e=!1,f=[],k=0,l=this.children.length;k<l;k++)b=this.children[k],e?f.push(b):("text"===b.nodeType||"space"===
b.nodeType?(a.ctx.font=b.style.toString(),b.metrics.w=a.ctx.measureText(b.value).width):"word"===b.nodeType?b.updateLine():"formula"===b.nodeType&&b.updateFormula(),d+=b.metrics.w,d>c&&"space"!==b.nodeType&&0<k&&(e=!0,f.push(b)));if(0<f.length)for(c=new g("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),k=0,l=f.length;k<l;k++)f[k].parent&&f[k].parent.removeChild(f[k]),c.addChild(f[k])};g.prototype.updateLine=function(c){var b=this;if("textLineBlock"===this.nodeType||
"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var e=this.metrics.descent=0,f=this.children,g,k=0,l=f.length;k<l;k++){g=f[k];if("text"===g.nodeType){a.ctx.font=g.style.toString();var p=""!==g.value?g.value:"\u200a";g.metrics=d(a.ctx.font);g.metrics.w=a.ctx.measureText(p).width;g.metrics.offsetX=e;Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===g.nodeType?(a.ctx.font=
g.style.toString(),g.metrics=d(a.ctx.font),g.metrics.w=k===l-1?0:c?c:a.ctx.measureText(" ").width,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===g.nodeType&&(g.updateLine(),g.metrics.offsetX_aux=e,Object.defineProperties(g.metrics,{offsetX:{get:function(){return b.metrics.offsetX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===
g.nodeType&&(a.ctx.font=g.styleString,p=""!==g.value?g.value:"\u200a",g.metrics=d(a.ctx.font),g.metrics.w=a.ctx.measureText(p).width,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),g.clickCatcher||(g.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+g.metrics.w+"px;height:"+g.metrics.h+"px;cursor:pointer;"}),g.clickCatcher.rtfNode=g,g.clickCatcher.action=new a.OpenURL(this.evaluator.parent,
g.URL),g.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===g.nodeType&&(g.componentNumCtrl=this.evaluator.parent.getControlByCId(g.value),a.ctx.font=g.styleString,g.metrics=d(a.ctx.font),g.metrics.w=g.componentNumCtrl.w,g.metrics.h=g.componentNumCtrl.h,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));
"componentSpace"===g.nodeType?(g.componentSpace=this.evaluator.parent.getSpaceByCId(g.value),a.ctx.font=g.styleString,g.metrics=d(a.ctx.font),g.metrics.w=g.componentSpace.w,g.metrics.h=g.componentSpace.h,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===g.nodeType&&(g.updateFormula(),g.metrics.offsetX_aux=e,Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),g.metrics.w+=2*g.metrics.paddingX,g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h+=2*g.metrics.paddingY,e+=2*g.metrics.marginX);this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,
g.metrics.descent);e+=g.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};g.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var b=this.children,e,g=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}},l=0,p=b.length;l<p;l++){e=b[l];if("text"===e.nodeType){a.ctx.font=e.style.toString();var z=""!==e.value?e.value:
"\u200a";e.metrics=d(a.ctx.font);e.metrics.w=a.ctx.measureText(z).width;e.metrics.offsetX=g;Object.defineProperties(e.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});g+=c.metrics.marginX}else if("dynamicText"===e.nodeType){z=void 0===e.decimals?q:e.evaluator.eval(e.decimals);var w=void 0===e.fixed?m:e.fixed,y=e.evaluator.eval(e.value);parseFloat(y).toString()===y.toString()&&(y=w?parseFloat(y).toFixed(z):a.removeNeedlessDecimals(parseFloat(y).toFixed(z)),
y=(""+y).replace(".",e.decimal_symbol));e.evalValue=y;a.ctx.font=e.style.toString();e.metrics=d(a.ctx.font);e.metrics.marginX=parseInt(1.5+.075*this.style.size);e.metrics.paddingX=parseInt(1.5+.075*this.style.size);e.metrics.w=a.ctx.measureText(y).width+2*e.metrics.paddingX;e.metrics.offsetX_aux=g;Object.defineProperties(e.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+this.marginX}},
offsetY:{get:function(){return c.metrics.offsetY}}});g+=2*e.metrics.marginX}if("superIndex"===e.nodeType)z=e,z.updateFormula(),z.metrics.marginX=0*parseInt(1.5+.075*this.style.size),z.metrics.paddingX=0*parseInt(1.5+.075*this.style.size),z.metrics.paddingY=parseInt(1.5+.05*this.style.size),z.metrics.offsetX_aux=g,z.metrics.prevChild=k,Object.defineProperties(z.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY-this.descent+this.prevChild.metrics.descent-parseInt(2*this.prevChild.metrics.h/7)}}}),z.metrics.w+=2*z.metrics.paddingX,z.metrics.ascent+=z.metrics.paddingY,z.metrics.descent+=z.metrics.paddingY,z.metrics.h+=2*z.metrics.paddingY,this.metrics.ascent=z.metrics.descent-z.metrics.prevChild.metrics.descent+parseInt(2*z.metrics.prevChild.metrics.h/7)+z.metrics.ascent,g+=2*z.metrics.marginX;else if("subIndex"===
e.nodeType){var B=e;B.updateFormula();B.metrics.marginX=parseInt(1.5+.09375*this.style.size);B.metrics.paddingX=0*parseInt(1.5+.01875*this.style.size);B.metrics.paddingY=parseInt(1.5+.05*this.style.size);B.metrics.offsetX_aux=g;B.metrics.prevChild=k;Object.defineProperties(B.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+0*this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+
this.ascent+B.metrics.prevChild.metrics.descent-parseInt(4*B.metrics.prevChild.metrics.h/7)}}});B.metrics.w+=B.metrics.paddingX;B.metrics.ascent+=B.metrics.paddingY;B.metrics.descent+=B.metrics.paddingY;B.metrics.h+=2*B.metrics.paddingY;this.metrics.descent=B.metrics.ascent+B.metrics.prevChild.metrics.descent-parseInt(4*B.metrics.prevChild.metrics.h/7)+B.metrics.descent;g+=B.metrics.marginX}else if("fraction"===e.nodeType){w=e;w.updateFormula();z=w.children;y=z[0];z=z[1];w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=0*parseInt(1.5+.075*this.style.size);w.metrics.paddingY=0*parseInt(1.5+.05*this.style.size);var C=Math.max(y.metrics.w,z.metrics.w)+2*w.metrics.paddingX;w.metrics.prevChild=k;w.metrics.offsetX_aux=g;var J=parseInt(-k.metrics.descent+4*k.metrics.h/9);Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+J}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY-J}}});Object.defineProperties(y.metrics,{parent:{value:w},maxWidth:{value:C},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(z.metrics,{parent:{value:w},maxWidth:{value:C},x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});w.metrics.w=C;w.metrics.ascent=y.metrics.h+J+2*w.metrics.paddingY;w.metrics.descent=z.metrics.h-J+2*w.metrics.paddingY;w.metrics.h=y.metrics.h+z.metrics.h+4*w.metrics.paddingY;g+=2*w.metrics.marginX}else if("radical"===e.nodeType){k=e;k.updateFormula();z=k.children;
w=z[0];var G=z[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=g;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});z=k.style.size;k.radicalSign={w:z,
scaleX:z/722,scaleY:G.metrics.h/1E3};y=parseInt(w.metrics.w-2*k.radicalSign.w/3);Object.defineProperties(k.radicalSign,{parent:{value:k},displaceIndex:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},y:{get:function(){return c.metrics.offsetY-G.metrics.ascent}}});Object.defineProperties(w.metrics,{parent:{value:k},displaceIndex:{value:y},fontSize:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(G.metrics,{parent:{value:k},displaceIndex:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,
0)}},offsetY:{get:function(){return c.metrics.offsetY}}});y=w.metrics.w<2*k.radicalSign.w/3?k.radicalSign.w:parseInt(w.metrics.w+k.radicalSign.w/3);k.metrics.w=y+2*k.metrics.paddingX+G.metrics.w;k.metrics.ascent=Math.max(G.metrics.ascent,w.metrics.h+2*z/5)+k.metrics.paddingY;k.metrics.descent=G.metrics.descent+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;g+=2*k.metrics.marginX}else if("sum"===e.nodeType){w=e;w.updateFormula();z=w.children;y=z[0];C=z[1];var H=z[2];w.metrics.marginX=
parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=g;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=e.style.toString();var A=d(a.ctx.font);k=parseInt(1.2*A.h);
z=parseInt(.5+780*k/1E3);w.sigmaSign={w:z,h:k,scale:k/1E3};var I=Math.max(C.metrics.w,y.metrics.w,w.sigmaSign.w);w.sigmaSign.parent=w;Object.defineProperties(w.sigmaSign,{sumWidth:{value:I},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+A.descent-(this.h+A.h)/2}}});z=A.descent-C.metrics.descent-(k+A.h)/2-w.metrics.paddingY;Object.defineProperties(C.metrics,{parent:{value:w},sumWidth:{value:I},
newBaselineTo:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});k=y.metrics.ascent+A.descent+(k-A.h)/2+w.metrics.paddingY;Object.defineProperties(y.metrics,{parent:{value:w},sumWidth:{value:I},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 c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(H.metrics,{parent:{value:w},sumWidth:{value:I},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
w.metrics.w=I+H.metrics.w+3*w.metrics.paddingX;w.metrics.ascent=Math.max(H.metrics.ascent,-z+C.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(H.metrics.descent,k+y.metrics.descent)+w.metrics.paddingY;w.metrics.h=w.metrics.ascent+w.metrics.descent;g+=2*w.metrics.marginX}else if("integral"===e.nodeType){w=e;w.updateFormula();z=w.children;y=z[0];C=z[1];H=z[2];w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+
.05*this.style.size);w.metrics.offsetX_aux=g;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=e.style.toString();A=d(a.ctx.font);I=parseInt(1.2*A.h);var D=parseInt(10.5+529*I/1E3);w.sign={w:D,h:I,scale:I/1E3};w.sign.parent=w;Object.defineProperties(w.sign,{x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+A.descent-(this.h+A.h)/2}}});z=A.descent-(I+A.h)/2-C.metrics.descent+I/3;Object.defineProperties(C.metrics,{parent:{value:w},integralWidth:{value:D},newBaselineTo:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
k=A.descent+y.metrics.ascent/2;Object.defineProperties(y.metrics,{parent:{value:w},integralWidth:{value:D},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 c.metrics.offsetY+this.newBaselineFrom}}});D=Math.max(parseInt(4*D/5)+C.metrics.w,parseInt(2*D/5+y.metrics.w))+w.metrics.paddingX;Object.defineProperties(H.metrics,
{parent:{value:w},whatDisplace:{value:D},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});w.metrics.w=D+H.metrics.w+2*w.metrics.paddingX;w.metrics.ascent=Math.max(H.metrics.ascent,-z+C.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(H.metrics.descent,k+y.metrics.descent,I-w.metrics.ascent)+w.metrics.paddingY;
w.metrics.h=Math.max(w.metrics.ascent+w.metrics.descent,I);g+=2*w.metrics.marginX}else if("limit"===e.nodeType){k=e;k.updateFormula();z=k.children;var M=z[0];w=z[1];z=z[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=g;Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=e.style.toString();A=d(a.ctx.font);C=parseInt(.5+a.ctx.measureText("l\u00edm").width);y=parseInt(.5+a.ctx.measureText("\u2192").width);limitWidth=Math.max(C,M.metrics.w+y+w.metrics.w);k.limitText={parent:k};Object.defineProperties(k.limitText,{limitWidth:{value:limitWidth},limitTextWidth:{value:C},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-
this.limitTextWidth)/2}}});C=A.descent+Math.max(M.metrics.ascent,w.metrics.ascent,2*A.ascent/3)+k.metrics.paddingY;k.limitArrow={parent:k};Object.defineProperties(k.limitArrow,{newBaseline:{value:C},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+M.metrics.w}},y:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(M.metrics,{parent:{value:k},newBaseline:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(w.metrics,{parent:{value:k},arrowWidth:{value:y},newBaseline:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+M.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(z.metrics,{parent:{value:k},limitWidth:{value:limitWidth},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});k.metrics.w=limitWidth+z.metrics.w+3*k.metrics.paddingX;k.metrics.ascent=Math.max(z.metrics.ascent,A.ascent)+k.metrics.paddingY;k.metrics.descent=C+Math.max(M.metrics.descent,
w.metrics.descent)+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;g+=2*k.metrics.marginX}else if("matrix"===e.nodeType){y=e;y.updateFormula();z=y.children;C=y.rows;H=y.columns;y.metrics.marginX=parseInt(1.5+.075*this.style.size);y.metrics.paddingX=parseInt(1.5+.075*this.style.size);y.metrics.paddingY=parseInt(1.5+.05*this.style.size);y.metrics.offsetX_aux=g;Object.defineProperties(y.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=e.style.toString();A=d(a.ctx.font);I=[];D=[];k=0;for(var N=C*H;k<N;k++){var O=parseInt(k/H);var F=k%H;I[O]=Math.max(I[O]||0,z[k].metrics.h);D[F]=Math.max(D[F]||0,z[k].metrics.w)}var E=(1+H)*y.metrics.paddingX;for(k=0;k<H;k++)E+=D[k];var K=(1+C)*y.metrics.paddingY;for(k=0;k<C;k++)K+=I[k];w=A.descent-A.h/2;k=0;for(N=C*H;k<N;k++)O=parseInt(k/H),F=k%H,z[k].metrics.offsetX_aux=f(D,F)+(D[F]-
z[k].metrics.w)/2+F*y.metrics.paddingX,z[k].metrics.offsetY_aux=f(I,O)+(I[O]-z[k].metrics.h)/2+(1+O)*y.metrics.paddingY,Object.defineProperties(z[k].metrics,{parent:{value:y},matrixH:{value:K},dispY:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});
y.metrics.w=E;y.metrics.ascent=K/2-w;y.metrics.descent=K/2+w;y.metrics.h=y.metrics.ascent+y.metrics.descent;g+=2*y.metrics.marginX}else if("defparts"===e.nodeType){y=e;y.updateFormula();z=e.children;C=e.parts;y.metrics.marginX=parseInt(1.5+.075*this.style.size);y.metrics.paddingX=parseInt(1.5+.075*this.style.size);y.metrics.paddingY=parseInt(1.5+.05*this.style.size);y.metrics.offsetX_aux=g;Object.defineProperties(y.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=e.style.toString();A=d(a.ctx.font);H=0;I=y.metrics.paddingY;w=A.descent-A.h/2;for(k=0;k<C;k++)z[k].metrics.offsetY_aux=I,H=Math.max(H,z[k].metrics.w),I+=z[k].metrics.h+y.metrics.paddingY,Object.defineProperties(z[k].metrics,{parent:{value:y},dispY:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});y.metrics.defpartsH=I;y.metrics.w=H+4*y.metrics.paddingX;y.metrics.ascent=I/2-w;y.metrics.descent=I/2+w;y.metrics.h=y.metrics.ascent+y.metrics.descent;g+=2*y.metrics.marginX}else if("numerator"===e.nodeType||"denominator"===e.nodeType||"index"===e.nodeType||"radicand"===e.nodeType||"from"===
e.nodeType||"to"===e.nodeType||"what"===e.nodeType||"element"===e.nodeType)e.updateFormula(),e.metrics.paddingX=parseInt(1.5+.075*this.style.size),e.metrics.paddingY=parseInt(1.5+.05*this.style.size),e.metrics.w+=2*e.metrics.paddingX,e.metrics.ascent+=e.metrics.paddingY,e.metrics.descent+=e.metrics.paddingY,e.metrics.h=e.metrics.ascent+e.metrics.descent;k=e;this.metrics.ascent=Math.max(this.metrics.ascent,e.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,e.metrics.descent);this.metrics.w+=
e.metrics.w+2*e.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;g+=e.metrics.w}};g.prototype.justifyAux=function(a){for(var c=0,b=0,d=0,e=this.children.length;d<e-1;d++)"space"===this.children[d].nodeType?c++:b+=this.children[d].metrics.w;this.updateLine((a-b)/c)};g.prototype.drawTextBlock=function(a){a.fillStyle=e;for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};g.prototype.drawTextLineBlock=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};
g.prototype.drawText=function(a){if(""!==this.value){var c=this.metrics.x,b=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:e;a.font=this.style.toString();a.beginPath();this.style.overline&&(a.rect(c,b-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(c,b+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());
if(this.style.border){var d=a.strokeStyle;a.lineWidth=1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,c,b);a.strokeStyle=d}a.fillText(this.value,c,b)}};g.prototype.drawWord=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};g.prototype.drawSpace=function(a){};g.prototype.drawDynamicText=function(a){var c=this.metrics.x+this.metrics.paddingX,b=this.metrics.y;a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:e;a.font=this.style.toString();a.beginPath();this.style.overline&&(a.rect(c,b-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(c,b+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,c,b);this.drawBorder(a,"blue")};g.prototype.drawHyperlink=function(a){var c=this.metrics.x,b=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=c+"px";this.clickCatcher.style.top=b-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(c,b-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString();a.beginPath();
a.rect(c,b+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,c,b)};g.prototype.drawFormula=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:e;a.beginPath();var c=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-
parseInt(c/2),this.metrics.w,c);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};g.prototype.drawNumDen=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSuperIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSubIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,
"blue")};g.prototype.drawRadical=function(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:e;c.translate(this.radicalSign.x,this.radicalSign.y);c.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);a.isMsEdge?this.drawRadicalSign(c):c.fill(b);c.restore();c.beginPath();c.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var d=0,h=this.children.length;d<
h;d++)this.children[d].draw(c);this.drawBorder(c,"blue")};g.prototype.drawSum=function(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:e;c.translate(this.sigmaSign.x,this.sigmaSign.y);c.scale(this.sigmaSign.scale,this.sigmaSign.scale);a.isMsEdge?this.drawSigmaSign(c):c.fill(l);c.restore();for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};g.prototype.drawIntegral=function(c){c.save();
c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:e;c.translate(this.sign.x,this.sign.y);c.scale(this.sign.scale,this.sign.scale);a.isMsEdge?this.drawIntegralSign(c):c.fill(k);c.restore();for(var b=0,d=this.children.length;b<d;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};g.prototype.drawLimit=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?
this.style.color.getColor():this.style.color:e;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};g.prototype.drawMatrix=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].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:e;a.beginPath();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);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawDefparts=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);b=parseInt(1.5+this.style.size/25);c=b/2;a.lineWidth=b;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:e;a.beginPath();
b=3*this.metrics.marginX;var d=b/2;a.moveTo(this.metrics.x+c+b,this.metrics.y+c-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent,this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent,this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h/
2,this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2,this.metrics.x+c,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2,this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2,this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+c+d,this.metrics.y+c-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+c+d,this.metrics.y-c-this.metrics.ascent+this.metrics.h,this.metrics.x+c+d,this.metrics.y-c-this.metrics.ascent+this.metrics.h,this.metrics.x+c+b,this.metrics.y-c-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawGenericBlock=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+
this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};g.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&
this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};g.prototype.drawRadicalSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();
a.fill();a.stroke()};g.prototype.drawSigmaSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.fill();a.stroke()};g.prototype.drawIntegralSign=
function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,
41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.fill();a.stroke()};g.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};g.prototype.toRTF=function(){var a=[],b=[],d=
"";this.mergeTextNodes();for(var e=0,g=this.children.length;e<g;e++){var f=this.children[e];"textLineBlock"===f.nodeType&&(d+=f.toRTFAux(a,b)+(1<g&&e<g-1?"\\par":""))}f="{\\fonttbl";e=0;for(g=a.length;e<g;e++)f+="\\f"+e+"\\fcharset0 "+a[e]+";";a="";if(0<b.length){a="{\\colortbl";e=0;for(g=b.length;e<g;e++)a+=b[e];a+="}"}return"{\\rtf1\\uc0"+(f+"}")+a+d+"}"};g.prototype.toRTFAux=function(a,b){for(var c,d,g,f=null,k="",l,p,m,r,q,J=0,G=this.children.length;J<G;J++)l=p="",c=this.children[J],m=this.addToFontTable(c.style.family,
a),r=c.style.size,q=this.addToColorTable(c.style.color,b),null===q&&0<b.length&&(q=this.addToColorTable(e,b)),q!==f&&(l+="\\cf"+q,f=q),m!==d&&(l+="\\f"+m,d=m),r!==g&&(l+="\\fs"+2*r,g=r),c.style.italic&&(l+="\\i",p="\\i0"+p),c.style.bold&&(l+="\\b",p="\\b0"+p),c.style.underline&&(l+="\\ul",p="\\ulnone"+p),c.style.overline&&(l+="\\ol",p="\\olnone"+p),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==l?l+" "+c.value+p:""!==k&&
"}"!==k.charAt(k.length-1)?" "+c.value:c.value,k+=c):"formula"===c.nodeType?k+="{\\*\\mjaformula"+c.formulaToRTF(d,g,f,a,b)+"}":"componentSpace"===c.nodeType?k+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(k+="{\\*\\component\\NumCtrl "+c.value+"}");return k};g.prototype.formulaToRTF=function(a,b,d,g,f){for(var c,k="",h,l,p,m,r=0,q=this.children.length;r<q;r++)h=l="",c=this.children[r],p=this.addToFontTable(c.style.family,g),m=this.addToColorTable(c.style.color,f),null===
m&&0<f.length&&(m=this.addToColorTable(e,f)),p!==a&&(h+="\\f"+p,a=p),m!==d&&(h+="\\cf"+m,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(d=m),c.style.italic&&(h+="\\i",l="\\i0"+l),c.style.bold&&(h+="\\b",l="\\b0"+l),c.style.underline&&(h+="\\ul",l="\\ulnone"+l),c.style.overline&&(h+="\\ol",l="\\olnone"+l),"text"===c.nodeType&&""!==c.value?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==h?h+" "+c.value+l:"}"!==k.charAt(k.length-
1)?" "+c.value:c.value,k+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,k+=h+"{\\expr "+c.value+"\\decimals "+(c.decimals||2)+"\\fixed"+(c.fixed?1:0)+"}"+l):"fraction"===c.nodeType||"radical"===c.nodeType||"index"===c.nodeType||"radicand"===c.nodeType||"sum"===c.nodeType||"integral"===c.nodeType||"limit"===c.nodeType||"from"===c.nodeType||"to"===c.nodeType||"what"===c.nodeType||"element"===c.nodeType?k+="{\\"+c.nodeType+c.formulaToRTF(a,b,d,g,f)+"}":"numerator"===c.nodeType?
k+="{\\num"+c.formulaToRTF(a,b,d,g,f)+"}":"denominator"===c.nodeType?k+="{\\den"+c.formulaToRTF(a,b,d,g,f)+"}":"superIndex"===c.nodeType?k+="{\\supix"+c.formulaToRTF(a,b,d,g,f)+"}":"subIndex"===c.nodeType?k+="{\\subix"+c.formulaToRTF(a,b,d,g,f)+"}":"matrix"===c.nodeType?k+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,d,g,f)+"}":"defparts"===c.nodeType&&(k+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,d,g,f)+"}");return k};g.prototype.addToFontTable=function(a,
b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};g.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};g.prototype.mergeTextNodes=function(){for(var a=[],b=null,d=0,e=this.children.length;d<e;d++)"text"===
this.children[d].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[d].style)&&(this.children[d].value=b.value+this.children[d].value,a.push(b)):this.children[d].mergeTextNodes(),b=this.children[d];d=0;for(e=a.length;d<e;d++)this.removeChild(a[d])};var p={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,
xHeight:1082,unitsPerEm:2048}};a.TextNode=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=String.fromCharCode,d,e,q,m,b,l,k,g,p,c,r,h=function(){};h.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];e="";m=q=0;l=a.charAt(0);k=!1;for(g="text";q<a.length;)b=l,l=a.charAt(q+1),k?"\\"===l||"{"===l||"}"===
l||" "===l||";"===l?(k=!1,e+=b," "===l?(q++,l=a.charAt(q+1),r=!0):r=!1,(p=e.match(/^'([0-9a-f]{2})/))?(c="","text"===g&&(c=d.pop().value),e=c+=f(parseInt(p[1],16))+e.substring(3)):(p=e.match(/^u[0-9]+/))?(c="","text"===g&&(c=d.pop().value),e=c+=f(p[0].substring(1))):("{"===e||"}"===e||"\\"==b?(d.push({type:"text",value:e+(r?" ":"")}),g="text"):(d.push({type:"controlWord",value:e}),g="controlWord"),e="")):"{"==b||"}"==b||"\\"==b?(k=!1,d.push({type:"text",value:b}),g="text"):e+=b:"\\"===b?(k=!0,""!==
e&&(d.push({type:"text",value:e}),g="text",e="")):"{"===b?(m++,""!==e&&(d.push({type:"text",value:e}),e=""),d.push({type:"openBlock",value:m}),g="openBlock"):"}"===b?(""!==e&&(d.push({type:"text",value:e}),e=""),d.push({type:"closeBlock",value:m}),g="closeBlock",m--):e+=b,q++;""!==e&&d.push({type:"text",value:e});return d};a.RTFTokenizer=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,d,e,q,m,b,l,k,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H,A,I,D,M,N,O,F=function(c){this.evaluator=c;this.tokenizer=new a.RTFTokenizer};F.prototype.parse=function(E){d=this.tokenizer.tokenize(E);e={};m=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(q=d[0].value;"closeBlock"!==d[m].type&&d[m].value!==q;)e[d[m].value]=d[m+2].value.substring(0,d[m+2].value.length-1),m+=3;m++}b={};l=0;if("openBlock"===d[m].type&&"colortbl"===d[m+1].value){q=
d[m++].value;for(m++;"closeBlock"!==d[m].type&&d[m].value!==q;)k=parseInt(d[m++].value.substring(3)).toString(16),g=parseInt(d[m++].value.substring(5)).toString(16),p=parseInt(d[m++].value.substring(4)).toString(16),";"===d[m].value&&m++,b[l++]="#"+(2>k.length?"0"+k:k)+(2>g.length?"0"+g:g)+(2>p.length?"0"+p:p);m++}x=v=h=null;M=D=I=B=y=w=z=n=u=!1;C=[new a.TextStyle];J=C[0];H=G=-1;A=[];c=N=new a.TextNode("","textBlock",J,this.evaluator);r=new a.TextNode("","textLineBlock",J,this.evaluator);c.addChild(r);
N.stableWidth=!0;N.hasFormula=!1;E=m;for(var F=d.length;E<F;E++){if("controlWord"==d[E].type)if(e[d[E].value])J.set({family:e[d[E].value]});else if(d[E].value.match(/^fs(\d+)/))J.set({size:parseInt(d[E].value.match(/^fs(\d+)/)[1]/2)});else if("b"==d[E].value)J.set({bold:!0}),0<A.length&&A[A.length-1].style.set({bold:!0});else if("b0"==d[E].value)J.set({bold:!1}),0<A.length&&A[A.length-1].style.set({bold:!1});else if("i"==d[E].value)J.set({italic:!0}),0<A.length&&A[A.length-1].style.set({italic:!0});
else if("i0"==d[E].value)J.set({italic:!1}),0<A.length&&A[A.length-1].style.set({italic:!1});else if("ul"==d[E].value)J.set({underline:!0}),0<A.length&&A[A.length-1].style.set({underline:!0});else if("ulnone"==d[E].value)J.set({underline:!1}),0<A.length&&A[A.length-1].style.set({underline:!1});else if("ol"==d[E].value)J.set({overline:!0}),0<A.length&&A[A.length-1].style.set({overline:!0});else if("olnone"==d[E].value)J.set({overline:!1}),0<A.length&&A[A.length-1].style.set({overline:!1});else if(d[E].value.match(/^cf(\d+)/))J.set({color:b[parseInt(d[E].value.substring(2))]}),
0<A.length&&(A[A.length-1].style.color=J.color);else if("par"==d[E].value){c=new a.TextNode("","textLineBlock",J.clone(),this.evaluator);if("textBlock"!=r.nodeType)for(r=r.parent;"textBlock"!=r.nodeType;)r=r.parent;r.addChild(c);r=c}else if("mjaformula"==d[E].value)N.hasFormula=!0,H=G,u=!0,c=new a.TextNode("","formula",J.clone(),this.evaluator),r.addChild(c),r=c,A[A.length-1]=c;else if("fraction"==d[E].value||"radicand"==d[E].value||"radical"==d[E].value||"what"==d[E].value||"sum"==d[E].value||"integral"==
d[E].value||"limit"==d[E].value){var L=A[A.length-2].style.clone();c=new a.TextNode("",d[E].value,L,this.evaluator);A[A.length-2].addChild(c);A[A.length-1]=c}else"index"==d[E].value?(L=A[A.length-2].style.clone(),L.size=f(parseInt(L.size-.5*L.size),8),c=new a.TextNode("",d[E].value,L,this.evaluator),A[A.length-2].addChild(c),A[A.length-1]=c):"to"==d[E].value||"from"==d[E].value?(L=A[A.length-2].style.clone(),L.size=f(parseInt(L.size-.2*L.size),8),c=new a.TextNode("",d[E].value,L,this.evaluator),A[A.length-
2].addChild(c),A[A.length-1]=c):"num"==d[E].value||"den"==d[E].value?(L=A[A.length-2].style.clone(),L.size=f(Math.round(L.size-.1*L.size),8),"num"==d[E].value?c=new a.TextNode("","numerator",L,this.evaluator):"den"==d[E].value&&(c=new a.TextNode("","denominator",L,this.evaluator)),A[A.length-2].addChild(c),A[A.length-1]=c):"subix"==d[E].value||"supix"==d[E].value?(L=A[A.length-2].style.clone(),L.size=f(Math.floor(L.size-.33*L.size),8),"subix"==d[E].value?c=new a.TextNode("","subIndex",L,this.evaluator):
"supix"==d[E].value&&(c=new a.TextNode("","superIndex",L,this.evaluator)),c.originalStyle=A[A.length-2].style.clone(),A[A.length-2].addChild(c),A[A.length-1]=c):"defparts"==d[E].value||"matrix"==d[E].value||"element"==d[E].value?(L=A[A.length-2].style.clone(),c=new a.TextNode("",d[E].value,L,this.evaluator),A[A.length-2].addChild(c),A[A.length-1]=c,"defparts"==d[E].value?x=c:"matrix"==d[E].value&&(v=c)):"parts"==d[E].value?B=!0:"rows"==d[E].value?w=!0:"columns"==d[E].value?y=!0:"expr"==d[E].value?
(N.stableWidth=!1,n=!0):"decimals"==d[E].value?z=!0:"fixed1"==d[E].value?h.fixed=!0:"fixed0"==d[E].value?h.fixed=!1:"component"!=d[E].value&&("NumCtrl"==d[E].value?I=!0:"Space"==d[E].value?D=!0:"hyperlink"==d[E].value&&(M=!0));if("text"==d[E].type)if(B)x.parts=parseInt(d[E].value),B=!1;else if(w)v.rows=parseInt(d[E].value),w=!1;else if(y)v.columns=parseInt(d[E].value),y=!1;else if(z)h.decimals=this.evaluator.parser.parse(d[E].value+""),z=!1;else if(M){O=d[E].value.split("|")[0];L=J.clone();c=new a.TextNode(O,
"hyperlink",L,this.evaluator);c.URL=d[E].value.split("|")[1];if("textLineBlock"!=r.nodeType)for(r=r.parent;"textLineBlock"!=r.nodeType;)r=r.parent;r.addChild(c);M=!1}else if(I)c=new a.TextNode(d[E].value,"componentNumCtrl",J.clone(),this.evaluator),r.addChild(c),I=!1;else if(D)c=new a.TextNode(d[E].value,"componentSpace",J.clone(),this.evaluator),r.addChild(c),D=!1;else if(n)L=A[A.length-2].style.clone(),O=this.evaluator.parser.parse(d[E].value),c=new a.TextNode(O,"dynamicText",L,this.evaluator),
A[A.length-2].addChild(c),h=A[A.length-1]=c,n=!1;else if(n||u)!n&&u&&(O=d[E].value,c=new a.TextNode(O,"text",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(c));else{O=d[E].value;c=new a.TextNode(O,"text",J.clone(),this.evaluator);if("textLineBlock"!=r.nodeType)for(r=r.parent;"textLineBlock"!=r.nodeType;)r=r.parent;r.addChild(c)}else if("openBlock"==d[E].type)G=d[E].value,J=J.clone(),C.push(J),A.push(null);else if("closeBlock"==d[E].type)d[E].value==H&&(H=-1,u=!1,r=r.parent),C.pop(),
J=C[C.length-1],A.pop();else if("("==d[E].type||")"==d[E].type)L=A[A.length-1].style.clone(),L.italic="",c=new a.TextNode(d[E].type,"mathSymbol",L,this.evaluator),A[A.length-1].addChild(c);else if("+"==d[E].type||"-"==d[E].type||"*"==d[E].type||"="==d[E].type)c=new a.TextNode(d[E].type,"mathSymbol",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(c)}return N.normalize()};a.RTFParser=F;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l,k,g,p,c,r=function(c,b){this.parent=c;d=this.evaluator=this.parent.evaluator;e=d.parser;this.id="";this.type="2D";this.xExpr=e.parse("0");this.yExpr=e.parse("0");this.w=parseInt(c.container.width);this.h=parseInt(c.container.height);this.drawif=e.parse("1");this.fixed=2===c.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!=c.version?new a.Color("c0c0c0"):"";this.net10=2!=c.version?new a.Color("808080"):"";this.axes=2!=c.version?new a.Color("808080"):"";this.text=new a.Color("ffafaf");this.numbers=!1;this.y_axis=this.x_axis=2!=c.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=c.zIndex;this.plecaHeight=c.plecaHeight||0;this.displaceRegionNorth=c.displaceRegionNorth||
0;this.displaceRegionWest=c.displaceRegionWest||0;Object.assign(this,b);this.initSpace()};r.prototype.initSpace=function(){f=this.parent;d=this.evaluator;q=this.id;this.resizable||(this.displaceRegionNorth=f.displaceRegionNorth||0,this.displaceRegionSouth=f.displaceRegionSouth||0,this.displaceRegionEast=f.displaceRegionEast||0,this.displaceRegionWest=f.displaceRegionWest||0,k=parseInt(f.container.width),l=parseInt(f.container.height),void 0!=this.wExpr&&(this.w=parseInt(k-this.displaceRegionWest-
this.displaceRegionEast)*parseFloat(this.wExpr)/100),void 0!=this.hExpr&&(this.h=parseInt(l-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.hExpr)/100),void 0!=this.xPercentExpr&&(this.xExpr=d.parser.parse((parseInt(k-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.xPercentExpr)/100).toString())),void 0!=this.yPercentExpr&&(this.yExpr=d.parser.parse((parseInt(l-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.yPercentExpr)/100).toString())),this.x=
d.eval(this.xExpr)+this.displaceRegionWest,this.y=d.eval(this.yExpr)+this.plecaHeight+this.displaceRegionNorth,this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px"),0<=this.y?(m=l-this.y,this.h>m&&(this.h=m)):(m=this.h+this.y,this.h=m>=l?l:m),0<=this.x?(b=k-this.x,this.w>b&&(this.w=b)):(b=this.w+this.x,this.w=b>=k?k:b));""==this.imageSrc&&/vacio.gif$/i.test(this.imageSrc.trim())||(this.image=f.getImage(this.imageSrc));this.OxExpr&&(p=this.OxExpr,"%"===p[p.length-
1]?this.Ox=this.w*parseFloat(p)/100:(g=parseFloat(p),g!=p&&(g=0),this.Ox=g));this.OyExpr&&(c=this.OyExpr,"%"===c[c.length-1]?this.Oy=this.h*parseFloat(c)/100:(g=parseFloat(c),g!=c&&(g=0),this.Oy=g));""!==this.id&&2!==f.version?(d.setVariable(q+"._w",this.w),d.setVariable(q+"._h",this.h),d.setVariable(q+".escala",this.scale),d.setVariable(q+".Ox",this.Ox),d.setVariable(q+".Oy",this.Oy),d.setVariable(q+".mouse_x",0),d.setVariable(q+".mouse_y",0),d.setVariable(q+".mouse_pressed",0),d.setVariable(q+".mouse_clicked",
0),d.setVariable(q+".clic_izquierdo",0)):(g=d.getVariable("_w"),void 0===g&&(g=this.w),d.setVariable("_w",g),g=d.getVariable("_h"),void 0===g&&(g=this.h),d.setVariable("_h",g),g=d.getVariable("escala"),void 0===g&&(g=this.scale),d.setVariable("escala",g),g=d.getVariable("Ox"),void 0===g&&(g=this.Ox),d.setVariable("Ox",g),g=d.getVariable("Oy"),void 0===g&&(g=this.Oy),d.setVariable("Oy",g),d.setVariable("mouse_x",0),d.setVariable("mouse_y",0),d.setVariable("mouse_pressed",0),d.setVariable("mouse_clicked",
0),d.setVariable("clic_izquierdo",0),2==f.version&&""===this.x_axis&&""===this.y_axis&&(this.axes=""));this.w_2=this.w/2;this.h_2=this.h/2};r.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};r.prototype.addGraph=function(a,c){"2D"===this.type&&c||"3D"===this.type&&!c||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};r.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,
0)};r.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};r.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};r.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};r.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d=function(d){f=this;f.parent=d;f.width=228;f.vSpace=25;f.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:"+(f.width+27)+"px;height:460px;"});f.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(f.width+27)+"px;height:"+f.vSpace+
"px;line-height:"+f.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});f.movable.innerHTML="Descartes";f.container.appendChild(f.movable);f.ctrs=[]};d.prototype.init=function(){function d(b){f.newPos=a.getCursorPosition(b,document.body);f.container.style.left=f.initialPosition.x+(f.newPos.x-f.oldPos.x)*a.cssScale+"px";f.container.style.top=f.initialPosition.y+(f.newPos.y-f.oldPos.y)*a.cssScale+"px"}function q(a){a.preventDefault();document.body.removeEventListener("mousemove",
d);document.body.removeEventListener("mouseup",q)}f=this;document.body.appendChild(this.container);for(var m=f.parent.evaluator.parser,b=0,l=f.ctrs.length;b<l;b++)f.ctrs[b].expresion=m.parse("(0,"+(f.vSpace+23+35*b)+","+f.width+",35)"),f.ctrs[b].update();f.numCtr=l;b=new a.Button(f.parent,{region:"external",name:"english"==f.language?"about":"cr\u00e9ditos",font_size:m.parse("15"),expresion:m.parse("(0,"+f.vSpace+","+f.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(f.parent,
{region:"external",name:"config",font_size:m.parse("15"),action:"config",expresion:m.parse("("+f.width/2+","+f.vSpace+","+f.width/2+",25)")})).update();(new a.Button(f.parent,{region:"external",name:"english"==f.language?"init":"inicio",font_size:m.parse("15"),action:"init",expresion:m.parse("(0,"+(f.vSpace+23+35*l)+","+f.width/2+",25)")})).update();(new a.Button(f.parent,{region:"external",name:"english"==f.language?"clear":"limpiar",font_size:m.parse("15"),action:"clear",expresion:m.parse("("+f.width/
2+","+(f.vSpace+23+35*l)+","+f.width/2+",25)")})).update();m=new a.Button(f.parent,{region:"external",name:"english"==f.language?"close":"cerrar",font_size:m.parse("15"),expresion:m.parse("("+f.width/4+","+(f.vSpace+46+35*l)+","+f.width/2+",25)")});m.update();m.btn.addEventListener("click",function(a){f.hide()});f.setPositionAndSize();f.movable.addEventListener("mousedown",function(b){b.preventDefault();f.oldPos=a.getCursorPosition(b,document.body);f.initialPosition={x:f.container.offsetLeft,y:f.container.offsetTop};
document.body.addEventListener("mousemove",d);document.body.addEventListener("mouseup",q)});f.hide()};d.prototype.addCtr=function(a){this.ctrs.push(a)};d.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};d.prototype.hide=function(){this.container.style.display="none"};d.prototype.setPositionAndSize=function(){f=this;var a=f.vSpace+46+35*f.numCtr+25+10;f.container.style.left=Math.max(parseInt(window.innerWidth-f.width)/2,0)+"px";f.container.style.top="5px";f.container.style.height=
window.innerHeight<f.vSpace+75?f.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=Math.round,e=2*Math.PI,q=a.convertFont("SansSerif,PLAIN,12"),m=a.convertFont("Monospaced,PLAIN,12"),b,l,k,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H,A,I,D,M,N,O,F,E,K,L,P,R,Q=function(c,d){b=d=a.Space.call(this,c,d)||this;b.ratio=c.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio});b.canvas.style.zIndex=b.zIndex;b.canvas.style.width=
b.backCanvas.style.width=b.w+"px";b.canvas.style.height=b.backCanvas.style.height=b.h+"px";b.ctx=b.canvas.getContext("2d");b.backCtx=b.backCanvas.getContext("2d");b.ctx.imageSmoothingEnabled=b.backCtx.imageSmoothingEnabled=!1;b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.numericalControlContainer=a.newHTML("div",{id:b.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.container=
a.newHTML("div",{id:b.id,class:"DescartesSpace2DContainer",style:"left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";"});b.parent.arquimedes&&"#f0f8fa"===b.background.getColor()&&(b.container.style.boxShadow="0 0 5px 0 #b8c4c8");b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numericalControlContainer);c.container.insertBefore(b.container,c.loader);var e=b.id+".image";b.parent.images[e]=b.canvas;b.parent.images[e].ready=
1;b.parent.images[e].complete=b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=b.id+".back";b.parent.images[e]=b.backCanvas;b.parent.images[e].ready=1;b.parent.images[e].complete=b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=""!==b.id&&2!==c.version?b.id+".":"";b.OxStr=e+"Ox";b.OyStr=e+"Oy";b.scaleStr=e+"escala";b.wStr=e+"_w";b.hStr=e+"_h";b.mxStr=e+"mouse_x";b.myStr=e+"mouse_y";b.mpressedStr=e+"mouse_pressed";b.mclickedStr=e+"mouse_clicked";b.mclickIzqStr=e+"clic_izquierdo";
b.click=0;b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};return d};$jscomp.inherits(Q,a.Space);Q.prototype.init=function(){b=this;this.initSpace();b.canvas&&(b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=
b.backCanvas.style.height=b.h+"px")};Q.prototype.update=function(a){b=this;l=b.evaluator;k=b.parent;if(b.resizable){if(K=b.evaluator.eval(b.wModExpr),L=b.evaluator.eval(b.hModExpr),b.old_w!=K||b.old_h!=L)b.w=K,b.h=L,b.w_2=b.w/2,b.h_2=b.h/2,l.setVariable(b.wStr,b.w),l.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=
b.h+"px",a=!0}else l.setVariable(b.wStr,b.w),l.setVariable(b.hStr,b.h);b.drawIfValue=0<l.eval(b.drawif);if(b.drawIfValue){p=b.x!==l.eval(b.xExpr)+b.displaceRegionWest;c=b.y!==l.eval(b.yExpr)+k.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||p||c||b.drawBefore!==b.drawIfValue||b.Ox!==l.getVariable(b.OxStr)||b.Oy!==l.getVariable(b.OyStr)||b.scale!==l.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=p?l.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=c?l.eval(b.yExpr)+k.plecaHeight+b.displaceRegionNorth:
b.y;b.Ox=l.getVariable(b.OxStr);b.Oy=l.getVariable(b.OyStr);b.scale=l.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));l.setVariable(b.scaleStr,b.scale);if(p||c)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.drawTrace=!b.spaceChange&&(!b.fixed&&!b.click||b.fixed);b.spaceChange&&(b.backCtx.setTransform(b.ratio,0,0,b.ratio,0,0),b.drawBackground());b.ctx.setTransform(b.ratio,0,0,b.ratio,0,0);b.draw()}else b.container.style.display=
"none"};Q.prototype.drawBackground=function(){b=this;l=b.evaluator;g=b.backCtx;g.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);g.fillStyle=b.backColor=b.background.getColor();g.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===b.bg_display?g.drawImage(b.image,0,0):"stretch"===b.bg_display?g.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(g.fillStyle=g.createPattern(b.image,"repeat"),g.fillRect(0,0,b.w,b.h)):
"imgcenter"===b.bg_display&&g.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));h=b.scale;v=0;for(x=0>b.w+b.h?0:b.w+b.h;h>x;)h/=10,v++;for(;h<x/10;)h*=10;g.lineWidth=1;""!==b.net&&(g.strokeStyle=b.net.getColor(),b.drawMarks(g,h/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&""!==b.net&&""!==b.net10)g.strokeStyle=b.net10.getColor(),b.drawMarks(g,h,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");g.strokeStyle=b.axes.getColor();g.beginPath();
"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(g.moveTo(0,f(b.h/2+b.Oy)+.5),g.lineTo(b.w,f(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(g.moveTo(f(b.w/2+b.Ox)+.5,0),g.lineTo(f(b.w/2+b.Ox)+.5,b.h));g.lineWidth=1.2;g.stroke();g.lineWidth=1;b.drawMarks(g,h,4,a);b.drawMarks(g,h/2,2,a);b.drawMarks(g,h/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)g.fillStyle=""!==b.axes?b.axes.getColor():"#000",g.font=q,g.textAlign="right",g.textBaseline="alphabetic","no"!=b.x_axis&&g.fillText(b.x_axis,
f(b.w)-2,f(b.h/2+b.Oy)+12),"no"!=b.y_axis&&g.fillText(b.y_axis,f(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(g.fillStyle=b.axes.getColor(),g.font=q,g.textAlign="start",g.textBaseline="bottom",h>(b.w+b.h)/2?b.drawNumbers(g,h/5,h<=b.scale?v+1:v):h>(b.w+b.h)/4?b.drawNumbers(g,h/2,h<=b.scale?v+1:v):b.drawNumbers(g,h,v));a=0;for(var c=this.backGraphics.length;a<c;a++)this.backGraphics[a].draw()};Q.prototype.draw=function(){b=this;g=b.ctx;g.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,c=b.graphics.length;a<
c;a++)r=b.graphics[a],""!==r.trace&&b.drawTrace&&r.drawTrace(),r.draw();a=0;for(c=b.graphicsCtr.length;a<c;a++)b.graphicsCtr[a].draw();""!=b.text&&b.click&&"L"===b.whichBtn&&(g.save(),g.strokeStyle=g.fillStyle=b.text.getColor(),g.lineWidth=1,g.font=m,g.textAlign="center",g.textBaseline="alphabetic",A=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(b.scale.toString().length),I=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(b.scale.toString().length),D="("+A+","+I+")",M=f(g.measureText(D).width/
2),N=b.getAbsoluteX(b.mouse_x),O=b.getAbsoluteY(b.mouse_y),F=f(N),E=f(O-10),F+M>b.w?F=b.w-M:0>F-M&&(F=M),E+1>b.h?E=b.h:0>E-14&&(E=15),g.fillText(D,F,E),g.beginPath(),g.arc(N,O,2.5,0,e,!0),g.stroke(),g.restore())};Q.prototype.drawMarks=function(a,c,b,e){u=this.w;n=this.h;G=C=0;J=u;H=n;y=f(u/2+this.Ox);B=f(n/2+this.Oy);0<=b&&(C=y-b,J=y+b,G=B-b,H=B+b);a.beginPath();if(!e||e&&!e.match("x"))for(b=-d(y/c);(z=y+d(b*c))<u;b++)a.moveTo(z+.5,G+.5),a.lineTo(z+.5,H+.5);if(!e||e&&!e.match("y"))for(b=-d(B/c);(w=
B+d(b*c))<n;b++)a.moveTo(C+.5,w+.5),a.lineTo(J+.5,w+.5);a.stroke()};Q.prototype.drawNumbers=function(a,c,b){u=this.w;n=this.h;y=f(u/2+this.Ox);B=f(n/2+this.Oy);for(b=-d(y/c);(z=y+d(b*c))<u;b++)a.fillText(parseFloat((b*c/this.scale).toFixed(4)),z+1,B-2);for(b=-d(B/c);(w=B+d(b*c))<n;b++)0!==parseFloat(-b*c/this.scale)&&a.fillText(parseFloat((-b*c/this.scale).toFixed(4)),y+5,w+5)};Q.prototype.addEvents=function(){function c(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",c),a.stopPropagation(),a.preventDefault(),f.parent.update()}function b(c){document.activeElement.blur();window.focus();c.stopPropagation();c.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",b);f.parent.deactivateGraphicControls();f.parent.update()}function d(c){f.posAnte=a.getCursorPosition(c,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(c){c.preventDefault();f.posZoomNew=a.getCursorPosition(c,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function g(c){c.preventDefault();c.stopPropagation();f.fixed||(f.posNext=a.getCursorPosition(c,f.container),P=f.posAnte.x-f.posNext.x,R=f.posAnte.y-f.posNext.y,
f.evaluator.setVariable(f.OxStr,f.Ox-P),f.evaluator.setVariable(f.OyStr,f.Oy-R));d(c)}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",c),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",d);this.canvas.addEventListener("mousedown",function(c){window.focus();document.activeElement.blur();c.stopPropagation();c.preventDefault();f.parent.clearClick();f.click=1;f.parent.deactivateGraphicControls();
f.whichBtn=a.whichBtn(c);"R"===f.whichBtn?(window.addEventListener("mouseup",b),f.posZoom=a.getCursorPosition(c,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(c),window.addEventListener("mousemove",g),window.addEventListener("mouseup",b))});document.addEventListener("visibilitychange",function(a){b(a)})};
a.Space2D=Q;return a}(descartesJS||{});
descartesJS=function(a){var f,d,e;function q(c,b){F=a.subtract3D(c,a.scalarProduct3D(b,a.dotProduct3D(c,b)));E=a.add3D(c,a.scalarProduct3D(F,-2));K=a.norm3D(E);return 0!==K?a.scalarProduct3D(E,1/K):a.scalarProduct3D(c,-1)}if(a.loadLib)return a;var m=Math.floor,b=Math.max,l=Math.cos,k=Math.sin,g,p,c,r,h,v,x,u,n,z,w,y,B,C,J,G,H=[],A,I,D,M,N,O,F,E,K,L,P,R=function(b,d){c=d=a.Space.call(this,b,d)||this;c.backCanvas=a.newHTML("canvas",{id:c.id+"_background",width:c.w+"px",height:c.h+"px"});c.canvas=a.newHTML("canvas",
{id:c.id+"_canvas",width:c.w+"px",height:c.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+c.zIndex+";"});c.ctx=c.canvas.getContext("2d");c.ctx.imageSmoothingEnabled=!1;var e=c.id+".image";c.parent.images[e]=c.canvas;c.parent.images[e].ready=1;c.parent.images[e].complete=!0;c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);c.graphicControlContainer=a.newHTML("div",{id:c.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+c.zIndex+";"});c.numericalControlContainer=
a.newHTML("div",{id:c.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+c.zIndex+";"});c.container=a.newHTML("div",{id:c.id,class:"DescartesSpace3DContainer",style:"left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"});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);c.eye={x:0,y:0,z:0};c.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=c.lights.length;e<f;e++)c.lights[e]=a.normalize3D(c.lights[e]);c.light3={x:0,y:0,z:0};c.intensity=[.4,.5,.3,0];c.userIntensity=0;c.dim=1;c.tmpIntensity=[];c.OxStr=c.id+".Ox";c.OyStr=c.id+".Oy";c.scaleStr=c.id+".escala";c.wStr=c.id+"._w";c.hStr=c.id+"._h";c.obsStr=c.id+".observador";c.ojoXStr=c.id+".Ojo.x";c.ojoYStr=c.id+".Ojo.y";c.ojoZStr=c.id+".Ojo.z";c.rotZStr=c.id+".rot.z";c.rotYStr=c.id+".rot.y";c.userIDimStr=c.id+".userIlum.dim";
c.userIIStr=c.id+".userIlum.I";c.userIxStr=c.id+".userIlum.x";c.userIyStr=c.id+".userIlum.y";c.userIzStr=c.id+".userIlum.z";c.evaluator.setVariable(c.rotZStr,0);c.evaluator.setVariable(c.rotYStr,0);c.evaluator.setVariable(c.userIDimStr,c.dim);c.evaluator.setVariable(c.userIIStr,c.userIntensity);c.evaluator.setVariable(c.userIxStr,0);c.evaluator.setVariable(c.userIyStr,0);c.evaluator.setVariable(c.userIzStr,0);P=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},c);c.evaluator.setFunction(c.id+
"._X3D2D_",function(a,b,d){P.vertices[0].x=a;P.vertices[0].y=b;P.vertices[0].z=d;P.computeDepth(c);return P.projVert[0].x});c.evaluator.setFunction(c.id+"._Y3D2D_",function(a,b,d){P.vertices[0].x=a;P.vertices[0].y=b;P.vertices[0].z=d;P.computeDepth(c);return P.projVert[0].y});c.resizable&&(c.wModExpr=b.evaluator.parser.parse(c.wModExpr),c.hModExpr=b.evaluator.parser.parse(c.hModExpr));c.ratio=1;c.addEvents();return d};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){c=this;c.initSpace();c.canvas&&
(c.canvas.width=c.backCanvas.width=c.w,c.canvas.height=c.backCanvas.height=c.h,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px");c.w_2=c.w/2;c.h_2=c.h/2;c.w_plus_h=c.w+c.h;c.oldMouse={x:0,y:0};c.S={x:c.h/1080*-20.6*(40/c.scale),y:0,z:0};c.Ojo={x:3*c.w_2,y:0,z:0};c.evaluator.setVariable(c.ojoXStr,c.Ojo.x);c.evaluator.setVariable(c.ojoYStr,c.Ojo.y);c.evaluator.setVariable(c.ojoZStr,c.Ojo.z)};R.prototype.update=function(a){c=this;g=c.evaluator;
p=c.parent;g.setVariable(c.wStr,c.w);g.setVariable(c.hStr,c.h);c.drawIfValue=0<g.eval(c.drawif);if(c.drawIfValue){c.resizable&&(wModExpr=c.evaluator.eval(c.wModExpr),hModExpr=c.evaluator.eval(c.hModExpr),c.old_w!=wModExpr||c.old_h!=hModExpr)&&(c.w=wModExpr,c.h=hModExpr,c.w_2=c.w/2,c.h_2=c.h/2,g.setVariable(c.wStr,c.w),g.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,c.S={x:c.h/1080*-20.6*(40/c.scale),y:0,z:0},c.Ojo={x:3*c.w_2,y:0,z:0},c.evaluator.setVariable(c.ojoXStr,c.Ojo.x),c.evaluator.setVariable(c.ojoYStr,c.Ojo.y),c.evaluator.setVariable(c.ojoZStr,c.Ojo.z));v=c.x!==g.eval(c.xExpr)+c.displaceRegionWest;x=c.y!==g.eval(c.yExpr)+p.plecaHeight+c.displaceRegionNorth;c.spaceChange=a||v||x||c.drawBefore!==c.drawIfValue||c.Ox!==g.getVariable(c.OxStr)||c.Oy!==g.getVariable(c.OyStr)||c.Ojo.x!==
g.getVariable(c.ojoXStr)||c.Ojo.y!==g.getVariable(c.ojoYStr)||c.Ojo.z!==g.getVariable(c.ojoZStr)||c.scale!==g.getVariable(c.scaleStr);c.x=v?g.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=x?g.eval(c.yExpr)+p.plecaHeight+c.displaceRegionNorth:c.y;c.Ojo.x=g.getVariable(c.ojoXStr);c.Ojo.y=g.getVariable(c.ojoYStr);c.Ojo.z=g.getVariable(c.ojoZStr);c.Ox=g.getVariable(c.OxStr);c.Oy=g.getVariable(c.OyStr);c.scale=g.getVariable(c.scaleStr);c.drawBefore=c.drawIfValue;if(a||void 0==c.observer){a=0;for(var d=c.parent.controls.length;a<
d;a++)c.parent.controls[a].id===c.obsStr&&(L=!0);c.observer=L?g.getVariable(c.obsStr)||2.5*c.w_plus_h:2.5*c.w_plus_h;c.observer=b(c.observer,.25*c.w_plus_h);g.setVariable(c.obsStr,c.observer)}1E-6>c.scale?(c.scale=1E-6,g.setVariable(c.scaleStr,1E-6)):1E6<c.scale&&(c.scale=1E6,g.setVariable(c.scaleStr,1E6));if(v||x)c.container.style.left=c.x+"px",c.container.style.top=c.y+"px";c.container.style.display="block";c.dim=g.getVariable(c.userIDimStr);c.userIntensity=g.getVariable(c.userIIStr);c.light3={x:parseInt(g.getVariable(c.userIxStr)),
y:parseInt(g.getVariable(c.userIyStr)),z:parseInt(g.getVariable(c.userIzStr))};c.updateCamera();c.draw()}else c.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};R.prototype.rotateVertex=function(b){z=a.degToRad(c.evaluator.getVariable(c.rotZStr));w=l(z);y=k(z);f=b.x*w-b.y*y;d=b.x*y+b.y*w;e=b.z;z=a.degToRad(c.evaluator.getVariable(c.rotYStr));w=l(z);y=k(z);return{x:e*y+f*w,y:d,z:e*w-f*y}};R.prototype.project=function(a){c=this;this.evaluator.getVariable("URL.oldProj");
var b=c.eye.x/(a.x-c.eye.x);return{x:c.getAbsoluteX(b*(c.eye.y-a.y)),y:c.getAbsoluteY(b*(c.eye.z-a.z)),z:c.eye.x-a.x}};R.prototype.computeColor=function(c,b,d){c.match("rgba")?c=a.RGBAToHexColor(c):c.match("#")&&(c=new a.Color(c.substring(1)));M=a.subtract3D(this.eye,b.average);N=a.norm3D(M);O=a.scalarProduct3D(M,1/N);this.lights[3]=a.subtract3D(this.light3,b.average);G=a.norm3D(this.lights[3]);for(var e=0,f=this.intensity.length-1;e<f;e++)H[e]=this.intensity[e]*this.dim;H[3]=this.userIntensity*this.userIntensity/
G||0;A=d?this.dim/2:this.dim/4;I=0;D=0>b.direction?b.normal:a.scalarProduct3D(b.normal,-1);e=0;for(f=this.lights.length;e<f;e++)d?(I=Math.max(0,a.dotProduct3D(q(this.lights[e],D),O)),I*=I*I):I=Math.max(0,a.dotProduct3D(this.lights[e],D)),A+=H[e]*I;A=Math.min(A,1);B=m(c.r*A);C=m(c.g*A);J=m(c.b*A);return"rgba("+B+","+C+","+J+","+c.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,c=this.graphics.length;a<c;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,c=this.graphics.length;a<c;a++){r=this.graphics[a];for(var b=a+1;b<c;b++)h=this.graphics[b],r.splitFace(h),h.splitFace(r);this.primitives=this.primitives.concat(r.primitives||[])}else for(a=0,c=this.graphics.length;a<c;a++){r=this.graphics[a];if(r.split)for(b=a+1;b<c;b++)h=this.graphics[b],h.split&&r.splitFace(h);this.primitives=this.primitives.concat(r.primitives||[])}}a=0;for(c=this.primitives.length;a<
c;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,c){return c.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(a=0,c=this.primitives.length;a<c;a++)this.primitives[a].draw(this.ctx,this);a=0;for(c=this.graphicsCtr.length;a<c;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var c=a.length,b=0;b<c;b++)a[b].drawn=!1,a[b].draw(this.ctx,this);for(var d=[],e=[],f=0,g=a.length,k=.001,h,l;;){h=g;for(b=0;b<
c;b++)if(!a[b].drawn){l=!0;for(var p=0;p<c;p++)if(p!=b&&!a[p].drawn&&a[b].inFrontOf(d,a[p],k)){l=!1;break}l&&(g--,e[f++]=a[b],a[b].drawn=!0)}if(0==g)break;else if(g==h){if(k*=10,.1<k){for(b=0;b<c;b++)a[b].drawn||(e[f++]=a[b],a[b].drawn=!0);break}}else k=.001}for(b=0;b<c;b++)e[b].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,c){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-c)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function c(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",c,!1);a.preventDefault();g.parent.update()}function b(c){document.body.focus();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);c.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",b,!1);g.parent.update()}function d(c){g.posAnte=a.getCursorPosition(c,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(c){c.preventDefault();g.posZoomNew=a.getCursorPosition(c,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.posObserverNew=
a.getCursorPosition(c,g.container).x;g.evaluator.setVariable(g.obsStr,g.tempObserver-2.5*(g.posObserver-g.posObserverNew));g.parent.update()}function f(c){if(!g.fixed&&g.click){u=(g.getAbsoluteX(g.oldMouse.x)-g.getAbsoluteX(g.mouse_x))/4;n=(-g.getAbsoluteY(g.oldMouse.y)+g.getAbsoluteY(g.mouse_y))/4;if(u!==g.disp.x||n!==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)-u,g.beta=a.radToDeg(g.beta)-n,g.evaluator.setVariable(g.rotZStr,
g.alpha),g.evaluator.setVariable(g.rotYStr,-g.beta),g.disp.x=u,g.disp.y=n,g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(c);c.preventDefault()}}var g=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(b){window.focus();document.activeElement.blur();g.click=1;g.evaluator.setVariable(g.id+".mouse_pressed",1);g.parent.deactivateGraphicControls();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("touchmove",f);window.addEventListener("touchend",c);b.preventDefault()});this.canvas.addEventListener("mousedown",function(c){document.body.focus();g.click=1;g.parent.deactivateGraphicControls();g.whichBtn=a.whichBtn(c);"R"===g.whichBtn?(window.addEventListener("mouseup",b),g.posObserver=a.getCursorPosition(c,g.container).x,g.posObserverNew=g.posObserver,g.posZoom=a.getCursorPosition(c,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(c,g.container),g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y),d(c),window.addEventListener("mousemove",f),window.addEventListener("mouseup",b));c.preventDefault()});this.disp={x:0,y:0}};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,e,q,m,b,l=function(b,d){var e=a.Space.call(this,b,d)||this;f=e.parent.evaluator;void 0!=e._w_&&(b=f.parser.parse(e._w_),e._w_="number"!=b.type?b:void 0);void 0!=e._h_&&(b=f.parser.parse(e._h_),e._h_="number"!=b.type?b: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=f.parser.parse(e.file.substring(1,e.file.length-1)):e.file.match(/^'/)&&e.file.match(/'$/)?
e.file=f.parser.parse(e.file):e.file=f.parser.parse("'"+e.file+"'");e.oldFile=f.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(c){var b=this;e.evaluator.setFunction(e.id+".set",function(a,c){b.contentWindow.postMessage({type:"set",name:a,value:c},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){b.contentWindow.postMessage({type:"update"},"*");return 0});
e.evaluator.setFunction(e.id+".exec",function(a,c){b.contentWindow.postMessage({type:"exec",name:a,value:c},"*");return 0});e.evaluator.setFunction(e.id+".changeConf",function(c){if(c){if(a.cacheFiles[c])var d=a.cacheFiles[c];else d=(d=document.getElementById(c))&&"descartes/embed"===d.type?d.textContent:a.openExternalFile(c),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",a.cacheFiles[c]=d;b.contentWindow.postMessage({type:"change_config",filename:c,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(l,a.Space);l.prototype.init=function(){m=this;m.initSpace();m.MyIFrame&&Object.assign(m.MyIFrame.style,{width:m.w+"px",
height:m.h+"px"})};l.prototype.iframeUpdate=function(a){f=this.evaluator;this.drawIfValue=0<f.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);d=this.x!==f.eval(this.xExpr)+this.displaceRegionWest;e=this.y!==f.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=d?f.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=e?f.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=f.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=a+"px",this.w=a));void 0!=this._h_&&(a=f.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(d||e)this.container.style.left=this.x+"px",this.container.style.top=
this.y+"px";q=f.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));b=f.getVariable(this.id+
"._scroll");1==b?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==b?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};a.SpaceHTMLIFrame=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=1,d=function(d){this.children=d.children;this.lessonParser=d.lessonParser;this.images=d.images;this.images.length=d.images.length;this.audios=d.audios;this.audios.length=d.audios.length;this.descartesApp=d;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});d.imgLoader?(d.loader.style.backgroundColor="rgba(0,0,0,0)",this.imgLoader.setAttribute("style","background-image:url("+
d.imgLoader+");background-size:contain;")):(f=d.width<d.height?d.width/1144:d.height/1092,f=2.5<f?2.5:f,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*f+"px;"),this.progress.setAttribute("style","visibility:visible; left:"+(d.width-726*f)/2+"px; top:"+(33.5*d.height/100+940*f/2)+"px; width:"+726*f+"px; height:"+14*f+"px;"));d.loader.appendChild(this.imgLoader);d.loader.appendChild(this.progress);d.firstRun=!1;this.initPreloader()};
d.prototype.initPreloader=function(){var d=this,f=d.children,m=d.images,b=d.audios,l=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,k=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;m["lib/DescartesCCLicense.png"]=a.getCCLImg();m["lib/DescartesCCLicense.png"].addEventListener("load",function(){this.ready=1});m["lib/DescartesCCLicense.png"].addEventListener("error",function(){this.errorload=1});var g,p;var c=0;for(g=f.length;c<g;c++)if("rtf"!==f[c].name){if(f[c].value.match(/'macro'|'makro'/g)){var r="";var h=
d.lessonParser.split(f[c].value);var v=0;for(p=h.length;v<p;v++)"expresion"===babel[h[v][0]]&&(r=h[v][1]);if(r)var x=(x=document.getElementById(r))&&"descartes/macro"==x.type?x.text:a.openExternalFile(r);if(x&&(h=x.match(l)))for(r=0,p=h.length;r<p;r++)v=h[r],v.toLowerCase().match(/vacio.gif$/)||""==v.substring(0,v.length-4)||(m[v]=new Image,m[v].addEventListener("load",function(){this.ready=1}),m[v].addEventListener("error",function(){this.errorload=1}),m[v].src=v)}if(h=f[c].value.match(l))for(r=
0,p=h.length;r<p;r++)v=h[r],v.toLowerCase().match(/vacio.gif$/)||""==v.substring(0,v.length-4)||(m[v]=new Image,m[v].addEventListener("load",function(){this.ready=1}),m[v].addEventListener("error",function(){this.errorload=1}),m[v].src=v);if(h=f[c].value.match(k))for(r=0,v=h.length;r<v;r++)d.initAudio(h[r])}for(var u in m)m.hasOwnProperty(u)&&d.images.length++;for(u in b)b.hasOwnProperty(u)&&d.audios.length++;var n=d.images.length+d.audios.length;0<n&&d.progress.setAttribute("max",n);var z,w=function(){z=
0;for(var c in m)m.hasOwnProperty(c)&&(m[c].ready||m[c].errorload)&&z++;for(c in b)b.hasOwnProperty(c)&&(b[c].ready||b[c].errorload)&&z++;d.progress.setAttribute("value",z);z!=n?d.timer=a.setTimeout(w,1):d.descartesApp.initBuildApp()};w()};d.prototype.initAudio=function(d){var e=this.audios;e[d]=new Audio(d);e[d].filename=d;var f=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?
(console.warn("El archivo '"+d+"' no puede ser reproducido"),this.errorload=1):(e[d]=new Audio(this.filename.replace("mp3","ogg")),e[d].filename=this.filename.replace("mp3","ogg"),e[d].addEventListener("canplaythrough",f),e[d].addEventListener("load",f),e[d].addEventListener("error",b),e[d].load())};e[d].addEventListener("canplaythrough",f);e[d].addEventListener("load",f);e[d].addEventListener("error",b);a.hasTouchSupport?(e[d].load(),e[d].play(),a.setTimeout(function(){e[d].pause()},20),e[d].ready=
1):e[d].load()};a.DescartesLoader=d;return a}(descartesJS||{});
descartesJS=function(a){function f(a){for(var b="[",d=0,c=a.length;d<c;d++)Array.isArray(a[d])?b+=f(a[d]):(e=a[d]||0,"string"==typeof e&&(e="'"+e+"'"),b+=e),d<c-1&&(b+=",");return b+"]"}function d(){q=window.innerWidth/this.width;m=window.innerHeight/this.height;a.cssScale=b=Math.min(q,m);this.container.style.transformOrigin="0 0";q<m?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+b+")"):(this.container.style.left="50%",this.container.style.transform=
"translate3d(0px, 0px, 0px) scale("+b+") translate(-50%, 0)")}if(a.loadLib)return a;var e,q,m,b,l=function(b){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=b;this.parentC=b.parentNode;this.width=parseFloat(b.getAttribute("width"));this.height=parseFloat(b.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=b.getElementsByTagName("param");a.ccLicense=!0;for(var d=
0,e=this.children.length;d<e;d++)"CreativeCommonsLicense"===this.children[d].name&&(a.ccLicense="no"!==this.children[d].value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.getURLParameters();this.init()};l.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);this.licenseA=
a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var b=this.children,e,f=0,c=0,l=a.ccLicense?90:0,h=0,m=b.length;h<m;h++)e=b[h],"rtf_height"==e.name&&(f=parseInt(e.value)+120||this.height),"Buttons"==babel[e.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(e.value),c=this.buttonsConfig.height),"image_loader"==e.name&&(this.imgLoader=e.value),"expand"==e.name&&(this.expand=e.value),"docBase"==e.name&&(this.docBase=e.value,e=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(e));"cover"==this.expand&&
(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,f&&(this.height=f+c+l));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),
textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=
this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.parentNode.style.width="100vw",this.container.parentNode.style.height="100vh",this.scaleToFit=d,this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",
new a.DescartesLoader(this)):this.initBuildApp()};l.prototype.initBuildApp=function(){a.showConfig=!0;for(var b=this.children,d,e=this.lessonParser,c=[],f=[],h=[],l=[],m=[],q=[],n=0,z=b.length;n<z;n++)if(d=b[n],"editable"==babel[d.name])a.showConfig="false"==babel[d.value]?!1:!0;else if("language"==babel[d.name])this.language=d.value;else if("pleca"==d.name)d=e.parsePleca(d.value,this.width),this.container.insertBefore(d,this.loader),this.plecaHeight=d.imageHeight?d.imageHeight:d.offsetHeight;else if("Buttons"==
babel[d.name])this.buttonsConfig=e.parseButtonsConfig(d.value);else if("decimal_symbol"==babel[d.name])this.decimal_symbol=d.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[d.name])this.version=parseInt(d.value);else if("language"==babel[d.name])this.language=d.value;else if("rtf"==d.name){var w=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;l.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+
d.value.replace(/'/g,"&squot;")+"'");l.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+w+","+(y-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&l.push("space='descartesJS_stage' type='image' expresion='["+(w+15)+","+y+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==d.name.charAt(0)?(d.value.match(/'HTMLIFrame'/)&&this.nIframes++,c.push(d.value)):/^C_/.test(d.name)?f.push(d.value):/^A_/.test(d.name)?h.push(d.value):/^G_/.test(d.name)?
(d.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),l.push(d.value)):/^S_/.test(d.name)?m.push(d.value):"Animation"==babel[d.name]&&q.push(d.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));n=0;for(z=c.length;n<z;n++)b=e.parseSpace(c[n]),this.arquimedes&&this.stage.container.appendChild(b.container),this.spaces.push(b),this.zIndex++;n=0;for(z=l.length;n<z;n++)if(a.DEBUG.elemIndex=n,c=e.parseGraphic(l[n]))this.editableRegionVisible=this.editableRegionVisible||c.visible,c.space.addGraph(c);n=0;
for(z=m.length;n<z;n++)(c=e.parse3DGraphic(m[n]))&&c.space.addGraph(c,!0);n=0;for(z=f.length;n<z;n++)this.controls.push(e.parseControl(f[n]));n=0;for(z=h.length;n<z;n++)e.parseAuxiliar(h[n]);n=0;for(z=q.length;n<z;n++)this.animation=e.parseAnimation(q[n]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();n=0;for(z=this.controls.length;n<z;n++)this.controls[n].init();this.updateControls();this.updateSpaces(!0);var B=this;this.nIframes?a.setTimeout(function(){B.finishInit()},200*
this.nIframes):this.finishInit()};l.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",
value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(g){console.warn("CustomEvents not supported in this browser")}this.readyApp=!0};l.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var b=parseInt(this.width)+
30,d=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-d)/2);window.resizeTo(b,d);a.onResize()};l.prototype.configRegions=function(){var b=this.evaluator.parser,d=this.buttonsConfig||{},e=this.container,c="15",f=100,h=100,l=100,m=100;2==this.version&&(c="14",f=63,h=50,l=44,m=53);var q=0,n=0,z=0,w=0,y=this.northSpace.controls,B=this.southSpace.controls,C=this.eastSpace.controls,J=this.westSpace.controls;if(0<d.rowsNorth||0<y.length||d.about||d.config){0>=
d.rowsNorth?(q=d.height,d.rowsNorth=1):q=d.height*d.rowsNorth;var G=this.northSpace.container;G.id="descartesJS_north";G.setAttribute("style","width:"+e.width+"px;height:"+q+"px;left:0;top:"+this.plecaHeight+"px;");e.insertBefore(G,this.loader);G=e.width;var H=0;d.about?(H=f,G-=H):f=0;d.config&&(G-=h);var A=Math.ceil(y.length/d.rowsNorth),I=G/A;var D=0;for(var M=y.length;D<M;D++)y[D].expresion=b.parse("("+(H+D%A*I)+","+d.height*Math.floor(D/A)+","+I+","+d.height+")"),y[D].drawif=b.parse("1"),y[D].init();
d.about&&(D=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(c),expresion:b.parse("(0, 0, "+f+", "+q+")")}),D.actionExec={execute:a.showAbout},D.update());d.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(c),action:"config",expresion:b.parse("("+(G+f)+", 0, "+h+", "+q+")")})).update()}if(0<d.rowsSouth||0<B.length||d.init||d.clear){0>=d.rowsSouth?(n=d.height,d.rowsSouth=1):n=d.height*d.rowsSouth;f=e.width;H=0;d.init?
(H=l,f-=H):l=0;d.clear&&(f-=m);G=this.southSpace.container;G.id="descartesJS_south";G.setAttribute("style","width:"+e.width+"px;height:"+n+"px;left:0;bottom:0;");e.insertBefore(G,this.loader);A=Math.ceil(B.length/d.rowsSouth);I=f/A;D=0;for(M=B.length;D<M;D++)B[D].expresion=b.parse("("+(H+D%A*I)+","+d.height*Math.floor(D/A)+","+I+","+d.height+")"),B[D].drawif=b.parse("1"),B[D].init();d.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(c),action:"init",
expresion:b.parse("(0, 0, "+l+", "+n+")")})).update();d.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(c),action:"clear",expresion:b.parse("("+(f+l)+", 0, "+m+", "+n+")")})).update()}if(0<C.length)for(D=e.height-q-n,z=d.widthEast,G=this.eastSpace.container,G.id="descartesJS_east",G.setAttribute("style","width:"+z+"px;height:"+D+"px;right:0;top:"+q+"px;"),e.insertBefore(G,this.loader),D=0,M=C.length;D<M;D++)C[D].expresion=b.parse("(0,"+d.height*
D+","+z+","+d.height+")"),C[D].drawif=b.parse("1"),C[D].init();if(0<J.length)for(D=e.height-q-n,w=d.widthWest,G=this.westSpace.container,G.id="descartesJS_west",G.setAttribute("style","width: "+w+"px;height:"+D+"px;left:0;top:"+q+"px;"),e.insertBefore(G,this.loader),D=0,M=J.length;D<M;D++)J[D].expresion=b.parse("(0,"+d.height*D+","+w+","+d.height+")"),J[D].drawif=b.parse("1"),J[D].init();if(this.editableRegionVisible)for(b=d.height,G=this.editableRegion.container,G.id="descartesJS_editableRegion",
G.setAttribute("style","width:"+e.width+"px;height:"+b+"px;left:0;top:"+(e.height-n-d.height)+"px;"),e.insertBefore(G,this.loader),d=this.editableRegion.textFields,e=e.width/d.length,J=a.getFieldFontSize(b),D=0,M=d.length;D<M;D++)"div"==d[D].type?(G.appendChild(d[D].container),d[D].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+b+"px;position:absolute;left:"+D*e+"px;top:0;"),C=d[D].container.firstChild,C.setAttribute("style","font-family:"+a.sansserif_font+
";font-size:"+J+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+b+"px;text-align:center;line-height:"+b+"px;"),c=C.offsetWidth,C.style.width=c+"px",C.firstChild.textContent=C.firstChild.textContent.substring(3,C.firstChild.textContent.length-3),d[D].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+J+"px;width:"+(e-c)+"px;height:"+b+"px;position:absolute;left:"+c+"px;top:0;border:2px groove white;")):(G.appendChild(d[D]),d[D].setAttribute("style",
"font-family:"+a.monospace_font+";font-size:"+J+"px;width:"+e+"px;height:"+b+"px;position:absolute;left:"+D*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=q;this.displaceRegionSouth=n;this.displaceRegionEast=z;this.displaceRegionWest=w;D=0;for(M=this.spaces.length;D<M;D++)this.spaces[D].init()};l.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};l.prototype.clearClick=function(){for(var a=0,b=
this.spaces.length;a<b;a++)this.spaces[a].clearClick()};l.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var b=0,d=this.controls.length;b<d;b++)this.controls[b].buttonClick=!1};l.prototype.deactivateGraphicControls=function(){for(var a,b=0,d=this.controls.length;b<d;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};l.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};l.prototype.updateEvents=function(){for(var a=
0,b=this.events.length;a<b;a++)this.events[a].update()};l.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};l.prototype.updateSpaces=function(a){for(var b=0,d=this.spaces.length;b<d;b++)this.spaces[b].update(a)};l.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};l.prototype.play=function(){this.animation.play()};l.prototype.stop=function(){this.animation.stop()};
l.prototype.reinitAnimation=function(){this.animation.reinit()};l.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&this.audios[a].pause&&(this.audios[a].pause(),this.audios[a].currentTime=0)};l.prototype.getImage=function(a){var b=this.images;return a?(b[a]||(b[a]=new Image,b[a].addEventListener("load",function(){this.ready=1}),b[a].addEventListener("error",function(){this.ready=0;this.errorload=1}),b[a].src=a),b[a]):new Image};l.prototype.getAudio=
function(b){var d=this.audios;if(b){if(!d[b]){b.lastIndexOf(".");d[b]=new Audio(b);var e=function(a){this.ready=1};d[b].addEventListener("canplaythrough",e);var c=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(d[b]=new Audio(b.replace("mp3","ogg")),d[b].addEventListener("canplaythrough",e),d[b].addEventListener("load",e),d[b].addEventListener("error",c),d[b].load())};d[b].addEventListener("error",
c);d[b].play();a.setTimeout(function(){d[b].pause()},15)}return d[b]}return new Audio};l.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};l.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var d,c=0,e=this.controls.length;c<e;c++)if(d=this.controls[c],d[b]==a)return d;return{update:function(){},w:0,h:0}};l.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};l.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var d,c=0,e=this.spaces.length;c<e;c++)if(d=
this.spaces[c],d[b]==a)return d;return{update:function(){},w:0,h:0}};l.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b){a=decodeURIComponent(a.substring(b+1)).split("&");for(var d=0,c=a.length;d<c;d++)b=a[d].split("="),2==b.length&&(+b[1]==+b[1]&&(b[1]=parseFloat(b[1])),this.evaluator.setVariable("URL."+b[0],b[1]))}};l.prototype.getState=function(){var a="",b=this.evaluator.variables,d;for(d in b)if(b.hasOwnProperty(d)){var c=b[d];"string"==typeof c&&(c=
"'"+c+"'");void 0!=c&&"rnd"!=d&&"\u03c0"!=d&&"pi"!=d&&"e"!=d&&"Infinity"!=d&&"-Infinity"!=d&&"object"!=typeof c&&(a=""!=a?a+"\n"+d+"="+c:d+"="+c)}c=this.evaluator.vectors;for(var e in c)c.hasOwnProperty(e)&&(a+="\n"+e+"="+f(c[e]));e=this.evaluator.matrices;for(var h in e)e.hasOwnProperty(h)&&(a+="\n"+h+"="+f(e[h]));return a};l.prototype.setState=function(a,b){a=a.split("\n");for(var d,c,e=0,f=a.length;e<f;e++)d=a[e].split("="),2<=d.length&&(c=eval(d[1]),-1!=d[1].indexOf("[[")?(this.evaluator.matrices[d[0]]=
c,this.evaluator.matrices[d[0]].rows=c.length,this.evaluator.matrices[d[0]].cols=c[0].length):-1!=d[1].indexOf("[")?(this.evaluator.vectors[d[0]]=c,this.evaluator.variables[d[0]+".long"]=c.length):this.evaluator.variables[d[0]]=c);b||this.update()};l.prototype.getEvaluation=function(){for(var a=correct=0,b="",d=0,c=this.controls.length;d<c;d++)"textfield"==this.controls[d].gui&&this.controls[d].evaluate&&(a++,correct+=this.controls[d].ok,this.controls[d].value=""==this.controls[d].value?"''":this.controls[d].value,
b+=" \\n "+this.controls[d].id+"="+this.controls[d].value+"|"+this.controls[d].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};l.prototype.showSolution=function(){for(var a=this.controls,b=0,d=a.length;b<d;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};l.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<b;a++)this.evaluator.eval(this.saveState[a]);this.update()};l.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=
a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);a.backCanvas&&(a.backCanvas=a.backCtx=null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&delete this.images[a]};a.DescartesApp=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(f,d){f="Error: "+f+" en\u300a "+d+" \u300b";var e="";switch(a.DEBUG.objectName){case "Auxiliar":d="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])e=" en la l\u00ednea "+(a.DEBUG.lineCount+1);f+=d+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+e+".";break;case "Graphic":f+="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(f)}};return a}(descartesJS||{});
descartesJS=function(a){function f(){d().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function d(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(a.getAttribute("code"))})}function e(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function q(b){b=a.newHTML("div");var d='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbola DJS_extra DJS_sansserif DJS_serif DJS_monospace".split(" ").forEach(function(a){d+='<div style="font-family:'+a+';"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>'});b.innerHTML=d+"</div>";document.body.appendChild(b);a.getFeatures();a.hasCanvas?(window.scrollTo(0,10),e(),f(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";b.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();a.onResize=
function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var m=Object.create(null);a.onMessage=function(b){if(0<a.apps.length){var d=b.data;if(d)if("set"===d.type)"string"==typeof d.value||"number"==typeof d.value?a.apps[0].evaluator.setVariable(d.name,d.value):d.value&&void 0!=d.value.rows?a.apps[0].evaluator.matrices[d.name]=d.value:a.apps[0].evaluator.vectors[d.name]=d.value;else if("update"===d.type)a.apps[0].update();else if("exec"===d.type)(b=a.apps[0].evaluator.getFunction(d.name))&&b.apply(a.apps[0].evaluator,
d.value.toString().split(","));else if("isResizeNeeded"===d.type)b.source.postMessage({type:"doResize"},"*");else if("doResize"===d.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===d.type){m[d.filename]?b=m[d.filename]:(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),m[d.filename]=b);var e=document.querySelector("base");e||(e=a.newHTML("base"),document.body.appendChild(e));e.setAttribute("href",d.filename);a.apps[0].children=b;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(b){window.addEventListener(b,function(b){a.onResize(b)})}),document.fonts.ready.then(function(){setTimeout(function(){a.apps.forEach(function(a){a.updateControls();a.updateSpaces(!0)})},500)}));return a}(descartesJS||{});
