/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2022-09-20
*/
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 g=Object.getOwnPropertyDescriptor(f,d);g&&Object.defineProperty(a,d,g)}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,g){if(f){d=$jscomp.global;a=a.split(".");for(g=0;g<a.length-1;g++){var q=a[g];q in d||(d[q]={});d=d[q]}a=a[a.length-1];g=d[a];f=f(g);f!=g&&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 g="";a;)if(a&1&&(g+=d),a>>>=1)d+=d;return g}},"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 g=arguments[d];if(g)for(var q in g)$jscomp.owns(g,q)&&(a[q]=g[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,g){var f=this.length||0;0>d&&(d=Math.max(0,f+d));if(null==g||g>f)g=f;g=Number(g);0>g&&(g=Math.max(0,f+g));for(d=Number(d||0);d<g;d++)this[d]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,f,d){a instanceof String&&(a=String(a));for(var g=a.length,q=0;q<g;q++){var p=a[q];if(f.call(d,p,q,a))return{i:q,v:p}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,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=[],g=0;g<this.length;g++){var f=this[g];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="cover";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";a.shadowBlur="shadowBlur";
a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.keyboard="keyboard";a.kblayout="kblayout";a.kbexp="kbexp";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return"@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(g){if(""==g)return"";f=g.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();g=a.monospace_font;if("serif"===d||"times new roman"===d||"timesroman"===d||"times"===d)g=a.serif_font;else if("sansserif"===d||"arial"===d||"helvetica"===d)g=a.sansserif_font;return g};
a.getFontStyle=function(a){return q[a.toLowerCase()]||""};a.getTextWidth=function(g,b){a.ctx.font=b;return Math.round(a.ctx.measureText(g).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,e,h,k,g;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(d){d=d||0;d=0>d?0:parseInt(d);a=this.toString();-1!==a.indexOf("e")&&(e=a.split("e"),k="-"===e[0][0]?"-":"",h="-"===k?parseFloat(e[0].substring(1)).oToFixed(11):parseFloat(e[0]).oToFixed(11),g=parseInt(e[1]),c=h.indexOf("."),h=h.replace(".",""),0>c+g?(c=0>c?1:c,a=k+"0."+"0".repeat(Math.abs(c+g))+h):a=k+h+"0".repeat(g-h.length+1));c=a.indexOf(".");-1===c?0<d&&
(a+="."+"0".repeat(d)):(b=a.length-c-1,a=b>=d?11>=d?parseFloat(a).oToFixed(d):a.substring(0,c+d+1):a+"0".repeat(d-b));return a}}if(a.loadLib)return a;var d=2*Math.PI,g=360/d,q=d/360,p=Math.floor,b,m,l,c;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*g};a.degToRad=function(a){return a*q};a.drawLine=function(a,b,e,h,d,k,g){a.lineWidth=g||1;a.strokeStyle=k||"black";c=a.lineWidth%2*.5;a.beginPath();a.moveTo(p(b)+c,p(e)+c);a.lineTo(p(h)+c,p(d)+c);a.stroke()};a.getColor=function(a,c){if("string"===
typeof c)return c;b=a.eval(c);return"rgba("+p(255*b[0][0])+","+p(255*b[0][1])+","+p(255*b[0][2])+","+(1-b[0][3])+")"};a.getFeatures=function(){var 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=2);f()};var h,e;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(h=a.indexOf("."),-1!==h)){e=a.substring(h);if(0==parseFloat(e))return a.substring(0,h);for(var c=e.length-1;0<c;c--)if("0"!==e.charAt(c))return a.substring(0,h+c+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,c,b){a=void 0===a?0:a;c=void 0===
c?100:c;b="linear-gradient("+(void 0===b?0:b)+"deg,";for(var e=2*a,h=a;h<c;h++)a=p(100-h-35),b+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*h-e)+"%, ";return b+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(c,b){m=c.touches?c.touches[0]:c;l=b.getBoundingClientRect();return m?{x:(m.pageX-window.pageXOffset-l.left)/a.cssScale,y:(m.pageY-window.pageYOffset-l.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var c=!1,b,e=[],h=0,k=0,d=a.length;k<d;k++)b=a.charAt(k),"'"===
b&&(c=!c),c||";"!==b&&"\n"!==b||(e.push(a.substring(h,k).replace(/\n/g,"\\n")),h=k+1);e.push(a.substring(h).replace(/\n/g,"\\n"));return e};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()-e>=c&&(a.call(),e=Date.now());h.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setInterval(a,c);var e=Date.now(),h={};h.value=requestAnimationFrame(b);return h};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,c){function b(){Date.now()-
e>=c?a.call():h.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setTimeout(a,c);var e=Date.now(),h={};h.value=requestAnimationFrame(b);return h};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,g=new XMLHttpRequest;g.open("GET",f,!1);try{g.send(null),d=200===g.status||304===g.status?g.responseText:g.responseText||"",d=404===g.status?"":d,d.match(String.fromCharCode(65533))&&(g.open("GET",f,!1),g.overrideMimeType("text/plain;charset=ISO-8859-1"),g.send(null),d=g.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){y=a.indexOf("--radial--");-1!=y&&(a=a.substring(0,y));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");p=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1),"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1)));"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1),p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,
p.length-1)));"*"===p.charAt(0)&&"*"!==p.charAt(p.length-1)?p=p.substring(1)+"$":"*"!==p.charAt(0)&&"*"===p.charAt(p.length-1)?p="^"+p.substring(0,p.length-1):"*"!==p.charAt(0)&&"*"!==p.charAt(p.length-1)?p="^"+p+"$":"*"===p.charAt(0)&&"*"===p.charAt(p.length-1)&&(p=p.substring(1,p.length-1));a.regExp=p.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,c){p=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=p.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),
expr: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 g(a,k,b){k=parseFloat(k);c=a.expr[0];h=a.expr[1];e=b.eval(c.expr);v=b.eval(h.expr);r="("==c.type||"["==c.type;u=")"==h.type||"]"==h.type;return r&&k>e&&u&&k<=v?1:0}function q(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,
"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var p,b,m,l,c,h,e,v,r,u,y;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 k=0,e=a.length;k<e;k++){b=a[k].split("&");m=[];for(var h=0,g=b.length;h<
g;h++)p=b[h],-1===p.indexOf(",")||"("!==p.charAt(0)&&"["!==p.charAt(0)||")"!==p.charAt(p.length-1)&&"]"!==p.charAt(p.length-1)?m.push(f(p)):m.push(d(p,c));a[k]=m}return a};a.escorrecto=function(c,k,e,h){e=e||a.externalEvaluator;h=h||a.buildRegularExpressionsPatterns(c,e);k=q(k);c=0;for(var d=h.length;c<d;c++){b=h[c];l=!0;for(var m=0,r=b.length;m<r;m++)l=b[m].regExp?l&&!!k.match(new RegExp(q(b[m].regExp),"i")):l&&g(b[m],k,e);if(l)return 1}return 0};a.esCorrecto=function(c,k,e,h){e=e||a.externalEvaluator;
h=h||a.buildRegularExpressionsPatterns(c,e);k+="";c=0;for(var d=h.length;c<d;c++){b=h[c];l=!0;for(var m=0,r=b.length;m<r;m++)(p=b[m].regExp)?(b[m].ignoreAccents&&(k=q(k),p=q(p)),b[m].ignoreCaps&&(k=k.toLowerCase(),p=q(p).toLowerCase()),l=l&&!!k.match(p)):l=l=l&&g(b[m],k,e);if(l)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===d?"24c":d)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+
(void 0===d?"d00018":d)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,d=Math.floor,g,q,p,b,m,l,c,h,e,v,r,u,y,n,k,w,x,z,A=function(c,k){this.r=this.g=this.b=0;this.a=1;this.evaluator=k;this.getColor=this.getColorStr;if(!c)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(c.match(/^GradL/)){c=this.splitComa(c.substring(6,c.length-1));this.x1=this.evaluator.parser.parse(c[0]);this.y1=this.evaluator.parser.parse(c[1]);this.x2=this.evaluator.parser.parse(c[2]);
this.y2=this.evaluator.parser.parse(c[3]);this.stops=[];for(var e=4;e<c.length;e++)""!=c[e]&&(k=c[e].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(k[1]),color:"#"+k[2]}));this.getColor=this.getLinearGradient}else if(c.match(/^Pattern/))this.img_src=c.substring(8,c.length-1),this.img_src.match(f)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else 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;else if(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;else if(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+")";else if("("===c[0]){q=[];p=this.splitComa(c.substring(1,
c.length-1));c=0;for(k=p.length;c<k;c++)l=p[c],b=parseInt(l,16),l!==b.toString(16)&&l!=="0"+b.toString(16)?("["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substring(1,l.length-1)),q.push(this.evaluator.parser.parse(l))):q.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=q[0];this.gExpr=q[1];this.bExpr=q[2];this.aExpr=q[3];this.getColor=this.getColorExp}};A.prototype.splitComa=function(a){m=[];for(var k=e=h=c=0,b=a.length;k<b;k++)v=a.charAt(k),"("===v?c++:")"===v?c--:"["===v?h++:
"]"===v?h--:","===v&&0===c&&0===h&&(m.push(a.substring(e,k)),e=k+1);m.push(a.substring(e));return m};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){g=this.evaluator;this.r=d(255*g.eval(this.rExpr));this.g=d(255*g.eval(this.gExpr));this.b=d(255*g.eval(this.bExpr));this.a=1-g.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){w=a.ctx.createLinearGradient(this.evaluator.eval(this.x1),this.evaluator.eval(this.y1),
this.evaluator.eval(this.x2),this.evaluator.eval(this.y2));for(var c=0;c<this.stops.length;c++)k=this.evaluator.eval(this.stops[c].percentage),k=0>k?0:1<k?1:k,w.addColorStop(k,this.stops[c].color);return w};A.prototype.getPattern=function(){z=this.evaluator.parent;if(x=z.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(x,"repeat")}catch(G){}return"ff00ff"};A.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);u=parseInt(a[1]).toString(16);y=parseInt(a[2]).toString(16);n=(255-parseInt(255*parseFloat(a[3]))).toString(16);1===r.length&&(r="0"+r);1===u.length&&(u="0"+u);1===y.length&&(y="0"+y);1===n.length&&(n="0"+n);return new A(n+r+u+y)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d){var g=this;this.parent=d;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("input",{type:"text",class:"DescartesKeyboardDisplay",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=a.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);
this.aditionalKeys=a.newHTML("div",{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.aditionalKeys);this.display.addEventListener("keydown",function(a){g.keypressed=!0;if(27===a.keyCode)g.close();else if(13===a.keyCode)g.onEnter()});this.key_pressed=!1;var f;this.delete_pressed=!1;var p;this.keyContainer.addEventListener("pointerdown",function(a){if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==
a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id){a.target.onpointerleave=function(){clearTimeout(f)};var b=a.target.textContent.trim().toLowerCase();f=setTimeout(function(){g.key_pressed=!0;g.showAditionalKeys(b)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(p)},p=setInterval(function(){g.delete_pressed=!0;g.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=g.keyContainer&&a.target!=g.container)if(a.preventDefault(),
a.stopPropagation(),"k_left"==a.target.id)g.display.selectionStart=g.display.selectionEnd=Math.max(0,g.display.selectionStart-1);else if("k_right"==a.target.id)g.display.selectionStart=g.display.selectionEnd=Math.min(g.display.value.length,g.display.selectionStart+1);else if("k_delete"==a.target.id)g.delete_pressed||g.delete(),clearTimeout(p),g.delete_pressed=!1;else if("k_\u221a"==a.target.id)g.insert("\u221a(");else if("k_space"==a.target.id)g.insert(" ");else if("k_esc"==a.target.id)g.close();
else if("k_shift"==a.target.id){a=g.keyContainer.querySelectorAll("div");var b=g.aditionalKeys.querySelectorAll("div");g.shift=!g.shift;g.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),b.forEach(function(a){a.textContent=a.textContent.toUpperCase()})):(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toLowerCase());"k_point_comma"==a.getAttribute("id")&&
(a.textContent=".")}),b.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)g["setLayout_"+g.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)g["setLayout_"+g.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)g.display.value="";else if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id)clearTimeout(f),g.key_pressed||
(g.insert(a.target.textContent.trim()),g.aditionalKeys.style.display="none"),g.key_pressed=!1;else if("k_return"==a.target.id)g.onEnter();else a=a.target.textContent.trim(),g.insert(a),g.aditionalKeys.style.display="none";g.display.focus()});this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var b=!1;this.aditionalKeys.addEventListener("pointerdown",function(a){b=!0});this.aditionalKeys.addEventListener("pointerup",function(a){b&&(a.target!=g.keyContainer&&
a.target!=g.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),g.insert(a)),g.key_pressed=!1,g.aditionalKeys.style.display="none");b=!1;g.display.focus()})};f.prototype.insert=function(a){this.display.setRangeText(a);this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd};f.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};
f.prototype.addKey=function(a,g,f){return"<div "+(g?"id='"+g+"'":"")+" "+(f?"style='"+f+"'":"")+">"+a+"</div>"};f.prototype.addKeys=function(a){var d=this,f="";a.forEach(function(a){f="object"===typeof a?f+d.addKey(a.val,a.id,a.style):f+d.addKey(a)});return f};f.prototype.showAditionalKeys=function(a){var g=[];"."==a?g=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?g=["-","\u00d7","\u00f7","^"]:"a"==a?g=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?g=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?g=["\u00ed",
"\u00ec","\u00ef","\u00ee"]:"o"==a?g=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(g=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.aditionalKeys.innerHTML=this.addKeys(g);this.shift&&(this.aditionalKeys.innerHTML=this.aditionalKeys.innerHTML.toUpperCase());this.aditionalKeys.style.display="flex";this.aditionalKeys.style.left=this.keyContainer.style.left;this.aditionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"};f.prototype.setLayout_14x1=function(){this.keyContainer.innerHTML=this.addKeys([1,
2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_delete"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};f.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_delete"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};f.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",
{val:"\u232b",id:"k_delete"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};f.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,{val:"\u232b",id:"k_delete"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="185px"};f.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,
9,"\u00b2",{val:"\u232b",id:"k_delete"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"};f.prototype.setLayout_11x3=function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_delete"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",
id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1};f.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_delete"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",
id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"};f.prototype.setLayout_10x4_alfa=function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_delete",
style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};f.prototype.setLayout_10x4_num=function(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_delete"},{val:"ABC",
id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};f.prototype.setLayout=function(a){this.layout_mode=a;"14x1"==a?this.setLayout_14x1():"7x2"==a?this.setLayout_7x2():"10x2"==a?this.setLayout_10x2():"4x4"==a?this.setLayout_4x4():"5x4"==a?this.setLayout_5x4():"11x3"==a?this.setLayout_11x3():"11x4"==a?this.setLayout_11x4():"10x4_alfa"==
a?this.setLayout_10x4_alfa():"10x4_num"==a?this.setLayout_10x4_num():this.setLayout_14x1()};f.prototype.show=function(a,g,f,p,b,m,l){this.ctr=a;this.var_id=b;this.onlyText=l;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(m);this.setLayout(g);this.keyContainer.style.left=f+"px";this.keyContainer.style.top=p+"px"};f.prototype.close=function(){this.container.style.display="none"};f.prototype.setDisplay=function(d){if("custom"==
d.type){var g=d.x;var f=d.y;var p=d.w;var b=d.h;var m=d.fs}else f=this.container.getBoundingClientRect(),b=d.getBoundingClientRect(),g=b.left/a.cssScale-f.left/a.cssScale,f=b.top/a.cssScale-f.top/a.cssScale,p=b.width/a.cssScale,b=b.height/a.cssScale,m=d.style.fontSize;this.display.setAttribute("style","left:"+g+"px;top:"+f+"px;width:"+p+"px;height:"+b+"px;font-size:"+m+";line-height:"+b+"px;");this.display.value=d.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=
this.display.value.length};f.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var g=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{g&&(a=this.parent.evaluator.eval(g))}catch(q){a=0}}this.ctr?this.ctr.changeValue(a,!0):this.parent.evaluator.setVariable(this.var_id,a);this.parent.update();this.close()};a.Keyboard=f;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-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.TextfieldCover{position:absolute;overflow:hidden;background-color:transparent;cursor:pointer;}\ninput[type=text]{-webkit-appearance:none;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100)+", url('"+a.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+a.createGradient(50,100,90)+", url('"+a.getSvgArrowUp(!0)+"');}\n.DJS_Up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+a.createGradient(0,50)+", url('"+a.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100,-90)+", url('"+a.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DescartesKeyboardContainer{position:absolute;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);z-index:1000;}\n.DescartesKeysContainer{display:flex;flex-direction:row;flex-wrap:wrap;background-color:#c0c0c0;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 8px 0 rgba(0,0,0,0.75);box-sizing: content-box;}\n.DescartesKeysContainer > div{margin:5px 0 0 5px;display:inline-block;min-width:40px;min-height:40px;max-height:40px;line-height:35px;background-color:#ebeff3;font-family:"+
a.math_font+";font-size:18px;font-weight:bold;color:black;cursor:pointer;text-align:center;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 1px 2px 0 rgba(0,0,0,0.25);transform-origin:center;user-select:none;}\n.DescartesKeysContainer > div:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active{transform:scale(0.95);}\n.DescartesKeyboardDisplay{font-family:"+a.sansserif_font+";padding:0 2px;border:solid #666 1px;text-align:left;background-color:white;position:absolute;overflow:hidden;outline:2px solid black;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(a.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.sin,d=Math.floor,g=Math.random,q=Math.round,p=Math.abs,b=String.fromCharCode,m,l,c,h,e,v,r,u,y,n,k=function(a){this.key=(void 0===a?0:a).toString()};k.prototype.getKey=function(a){m=[];for(var c=0;256>c;c++)m[c]=b(this.alfanum(d(p(7.5*(f(1*c-a)+f(1.4*c+a)+f(.6*c-a)+f(2.2*c+a))))));return m.join("")};k.prototype.encode=function(a){l=d(31*g());this.key=this.getKey(l);return b(this.alfanum(l))+this.encripta(a)};k.prototype.decode=function(a){l=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(l);return this.desencripta(a.substring(1))};k.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};k.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var c=0,k=a.length;c<k;c++)y=256*d(a[c]+128)+q(255*g())+65536*q(255*g()),n=d((y<<this.shift(c))/256),v[3*c]=this.alfanum(n%32),v[3*c+1]=this.alfanum(n/32%32),v[3*c+2]=this.alfanum(n/1024%32);return v};k.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};k.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;r=Array(a.length/3);for(var c=0,k=r.length;c<k;c++)n=this.numalfa(a[3*c])+32*this.numalfa(a[3*c+1])+1024*this.numalfa(a[3*c+2]),y=d(256*n>>this.shift(c)),u=d(y/256)%256-128,0>u&&(u+=256),r[c]=u;return r};k.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};k.prototype.numalfa=function(a){return a-(58>a?48:87)};k.prototype.stringToBytes=
function(a){h=[];for(var c=0,k=a.length;c<k;c++)h.push(a.charCodeAt(c));return h};k.prototype.bytesToString=function(a){for(var c=0,k=a.length;c<k;c++)a[c]=b(a[c]);return a.join("")};k.prototype.shift=function(a){c=this.key.charCodeAt(a%this.key.length);h=this.numalfa(c);e=d(h/2%8);0==e&&(e=4);return e};k.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,g){this.parent=d;var f=d.evaluator,p=f.parser;d=new a.Auxiliary(d);var b=this;b.delay=g.delay?p.parse(g.delay):p.parse("60");b.loop=g.loop?g.loop:!1;b.auto=void 0==g.auto?!0:g.auto;b.controls=g.controls;b.init=d.splitInstructions(p,g.init);b.doExpr=d.splitInstructions(p,g.doExpr);g.whileExpr&&(b.whileExpr=p.parse(g.whileExpr));var m,l=b.doExpr.length;b.animExec=function(){for(m=0;m<l;m++)f.eval(b.doExpr[m]);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,g=this.init.length;a<
g;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,g){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,g){d=a.Action.call(this,d,g)||this;d.parameter=(g||"").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,g){d=a.Action.call(this,d,g)||this;var f=d.evaluator,p=f.parser;g=a.splitSeparator((g||"").replace(/&squot;/g,"'"));for(var b=[],m,l=0,c=g.length;l<c;l++)(m=p.parse(g[l],!0))&&b.push(m);c=b.length;d.execute=function(){for(l=0;l<c;l++)f.eval(b[l])};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,g){var f=a.Action.call(this,d,g)||this;f.parser=d.evaluator.parser;f.evaluator=d.evaluator;f.parameter=g;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 g=d.indexOf("target");-1!=g&&(this.target=d.substring(g),this.target=this.target.substring(this.target.indexOf("=")+1),d=d.substring(0,
g-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)&&(g=window.__dirname||window.location.href,d=g.substring(0,g.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,g){var f=a.Action.call(this,d,g)||this;f.parser=d.evaluator.parser;f.evaluator=d.evaluator;f.parameter=g.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 g=a.indexOf("target");-1!=g&&(this.target=a.substring(g),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
g-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)&&(g=window.__dirname||window.location.href,a=g.substring(0,g.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,g){return a.Action.call(this,d,g)||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,g){return a.Action.call(this,d,g)||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,g){return a.Action.call(this,d,g)||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,g){return a.Action.call(this,d,g)||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,g){return a.Action.call(this,d,g)||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(g,d){g=a.Action.call(this,g,d)||this;d=d||"";d.match(f)?g.filenameExpr=g.evaluator.parser.parse("'"+d.match(f)+"'"):(d.match(/^\[.*\]?/)&&(d=d.substring(1,d.length-1)),g.filenameExpr=g.evaluator.parser.parse(d));return g};$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,g=function(a,g){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,g)};g.prototype.firstRun=function(){};g.prototype.update=function(){};g.prototype.splitInstructions=function(g,p){d=[];p=p?a.splitSeparator(p):[""];for(var b=0,m=p.length;b<m;b++)a.DEBUG.lineCount=b,(f=g.parse(p[b],!0))&&d.push(f);return d};g.prototype.getPrivateVariables=function(a,g){d=[];g=g?g.split(/;|,/):
[""];for(var b=0,m=g.length;b<m;b++)(f=a.parse(g[b],!0))&&d.push(f);b=0;for(m=d.length;b<m;b++)d[b]="assign"===d[b].type?d[b].childs[0].value:"identifier"===d[b].type?d[b].value:"";return d};g.prototype.parseExpressions=function(g){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(g,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(g,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(g,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
g.parse(this.whileExpr)};a.Auxiliary=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,g){d=a.Auxiliary.call(this,d,g)||this;g=d.evaluator.parser;d.expresionString=d.expresion;d.expresion=g.parse(d.expresionString);d.expresion&&g.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"),g=a.newHTML("label");g.appendChild(document.createTextNode("___"+this.id+"=___"));var f=a.newHTML("input");
f.value=this.expresionString;f.disabled=!this.editable;d.appendChild(g);d.appendChild(f);var p=this,b=p.evaluator.parser;f.onkeydown=function(a){13==a.keyCode&&(p.expresion=b.parse(this.value),b.setVariable(p.id,p.expresion),p.parent.update())};this.parent.editableRegion.textFields.push({container:d,type:"div"})};a.Variable=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(d,g){d=a.Auxiliary.call(this,d,g)||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,g,q,p=function(b,g){g=a.Auxiliary.call(this,b,g)||this;f=b.evaluator;d=f.parser;g.size=g.size||d.parse("3");g.expresion=g.expresion.split(";");g.parseFile=d.parse(g.file);g.update();return g};$jscomp.inherits(p,a.Auxiliary);p.prototype.update=function(){var b=this.expresion,m;f=this.evaluator;d=f.parser;this.oldFile=this.file;if(g=f.eval(this.parseFile))this.file=g;if(this.file){q=(m=document.getElementById(this.file))&&"descartes/vectorFile"==
m.type?m.text:a.openExternalFile(this.file);if(null!=q){q=q.replace(/\r/g,"").split("\n");m=[];for(var l=0,c=q.length;l<c;l++)""!=q[l]&&m.push(q[l]);q=m}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 h;m=[];l=0;for(c=b.length;l<c;l++)(h=d.parse(b[l],!0))&&"assign"!=h.type&&(h=d.parse(this.id+"["+l+"]="+b[l],!0)),m.push(h);b=parseInt(Math.abs(f.eval(this.size)));b=Array(b).fill(0);b._size_=b.length;f.vectors[this.id]=
b;f.setVariable(this.id+".long",b._size_);l=0;for(c=m.length;l<c;l++)f.eval(m[l])};a.Vector=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b=function(b,l){l=a.Auxiliary.call(this,b,l)||this;f=b.evaluator;d=f.parser;l.rows=l.rows||d.parse("3");l.columns=l.columns||d.parse("3");l.expresion=l.splitInstructions(d,l.expresion);g=f.eval(l.rows);q=f.eval(l.columns);p=[];p.type="matrix";b=0;for(var c=q;b<c;b++)p[b]=Array(g).fill(0);f.matrices[l.id]=p;l.update();return l};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){f=this.evaluator;g=f.eval(this.rows);q=f.eval(this.columns);
f.setVariable(this.id+".filas",g);f.setVariable(this.id+".columnas",q);p=f.matrices[this.id];p.rows=g;p.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,g){var f=a.Auxiliary.call(this,d,g)||this;var p=f.evaluator;d=p.parser;g=f.id.indexOf("(");f.name=f.id.substring(0,g);f.params=f.id.substring(g+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=[],g=0,d=f.privateVars.length;g<d;g++)b.push(p.getVariable(f.privateVars[g])),p.setVariable(f.privateVars[g],0);var c=[];g=0;for(d=f.params.length;g<d;g++)c[g]=p.getVariable(f.params[g]),p.setVariable(f.params[g],arguments[g]);g=0;for(d=f.init.length;g<d;g++)p.eval(f.init[g]);do{g=0;for(d=f.doExpr.length;g<d;g++)p.eval(f.doExpr[g]);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<p.eval(f.whileExpr));var h=p.eval(f.expresion);a.rangeOK=p.eval(f.domain);g=0;for(d=f.params.length;g<d;g++)p.setVariable(f.params[g],c[g]);g=0;for(d=f.privateVars.length;g<d;g++)p.setVariable(f.privateVars[g],b[g]);return h}return 0};p.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,g){var f=a.Auxiliary.call(this,d,g)||this;var p=f.evaluator;f.parseExpressions(p.parser);f.algorithmExec=function(){for(var a=f.iterations=0,g=f.init.length;a<g;a++)p.eval(f.init[a]);do{a=0;for(g=f.doExpr.length;a<g;a++)p.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<p.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,g){d=a.Auxiliary.call(this,d,g)||this;g=d.evaluator;delete d.evaluate;d.condition=g.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,g){var f=a.Auxiliary.call(this,d,g)||this;if(g=g.file){var p=document.getElementById(g);p=p&&"descartes/library"===p.type?p.text:a.openExternalFile(g)}if(p){p=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");g=0;for(var b=p.length;g<b;g++)""!==p[g].trim()&&d.lessonParser.parseAuxiliar(p[g])}return f};$jscomp.inherits(f,a.Auxiliary);a.Library=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c=function(c,b){this.parent=c;this.evaluator=c.evaluator;var e=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=e.parse("1");this.abs_coord=b&&b.type&&"text"===b.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=e.parse("(0,0)");this.family="";this.family_interval=e.parse("[0,1]");this.family_steps=e.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=e.parse("2");Object.assign(this,b);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=c.evaluator.parser.parse(this.fontSize.toString()))};c.prototype.getSpace=
function(){var a=this;return this.parent.spaces.find(function(c){return c.id===a.spaceID})||this.parent.spaces[0]};c.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};c.prototype.drawFamilyAux=function(a,c,b){f=this.evaluator;this.getFamilyValues();g=f.getVariable(this.family);if(0<=this.fSteps)for(var e=
0,h=this.fSteps;e<=h;e++)f.setVariable(this.family,this.familyInf+e*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,g)};c.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));this.ctx.setLineDash([])};c.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))};c.prototype.rotate=function(a,c,b){m=Math.cos(b);l=Math.sin(b);return{x:a*m-c*l,y:a*l+c*m}};c.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([])};c.prototype.drawText=
function(a,c,b,g,d,l,m,k,w,x,z){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=a.strokeStyle=d.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:b,y:g},c.update(a,b,g,w,x,m,z,d.getColor());else for("simpleText"===c.type&&(c=c.toString(w,x).split("\\n")),f=this.evaluator,a.fillStyle=d.getColor(),a.font=l,a.textAlign=m,a.textBaseline=k,p=1.2*this.fontSize||0,d=0,l=c.length;d<l;d++)q=c[d],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(q,
b,g+p*d)),a.fillText(q,b,g+p*d)};a.Graphic=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l=function(a,h){this.text=h=h.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";f="'";q=g=0;for(p=-1;g<h.length;)b=h.charAt(g),m=h.charAt(g-1),"["===b&&"\\"===m?(this.textElements.push(h.substring(q,g-1)+"["),this.textElementsMacros.push("'"+h.substring(q,g-1)+"['"),q=g+1):"]"===b&&"\\"===m?(this.textElements.push(h.substring(q,
g-1)+"]"),this.textElementsMacros.push("'"+h.substring(q,g-1)+"]'"),q=g+1):"["===b&&-1===p?(this.textElements.push(h.substring(q,g)),this.textElementsMacros.push("'"+h.substring(q,g)+"'"),q=g,p++):"["===b?p++:"]"===b&&0===p?(this.textElements.push(this.evaluator.parser.parse(h.substring(q,g+1))),this.textElementsMacros.push("["+h.substring(q,g+1)+"]"),q=g+1,p--):("]"==h.charAt(g)&&(p=0>p?p:p-1),f+=h.charAt(g)),g++;this.textElements.push(h.substring(q,g));this.textElementsMacros.push("'"+h.substring(q,
g)+"'")};l.prototype.toString=function(c,b){f="";for(var e=0,h=this.textElements.length;e<h;e++)"string"===typeof this.textElements[e]?f+=this.textElements[e]:(d=this.evaluator.eval(this.textElements[e])[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=b?d.toFixed(c):a.removeNeedlessDecimals(d.toFixed(c)),f+=d.toString().replace(".",this.parent.decimal_symbol))));return f};a.SimpleText=l;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F,D,B,L,I,M,O,H,P,C,N=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();v=new a.R2;r=new a.R2;u=new a.R2;k=new a.R2;y=new a.R2;b.cInd=0;return b};$jscomp.inherits(N,a.Graphic);N.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)};N.prototype.update=function(){};N.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};N.prototype.drawFamilyAux=function(a,c,b){d=this.evaluator;this.getFamilyValues();tempParam=d.getVariable(this.family);if(0<=this.fSteps)for(var k=0,e=this.fSteps;k<=e;k++)d.setVariable(this.family,this.familyInf+k*this.family_sep),this.update(),
this.drawAux(a,c,b);d.setVariable(this.family,tempParam)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(K,Q,R){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;d=this.evaluator;g=d.parser;q=this.space;p=d.eval(this.width);K.strokeStyle=this.color.getColor();K.lineWidth=p;b=g.getVariable("x");m=g.getVariable("y");l=q.w+24;c=q.h+24;h=l/9;3>h&&(h=3);e=c/7;3>e&&(e=3);0==this.cInd?(f=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;v.set(0,0);r.set(0,0);u.set(0,0);P=.25;C=8;this.abs_coord||(P/=q.scale,C/=q.scale);K.beginPath();for(B=parseInt(e/2);B<c;B+=e)for(D=parseInt(h/2);D<l;D+=h){if(this.abs_coord){k.set(D,B);n=this.newt.findZero(k,P);if(null==n)continue;d.setVariable("x",n.x);d.setVariable("y",n.y);y.set(n.x,n.y)}else{k.set(q.getRelativeX(D),q.getRelativeY(B));n=this.newt.findZero(k,P);if(null==n)continue;d.setVariable("x",n.x);d.setVariable("y",n.y);y.set(q.getAbsoluteX(n.x),q.getAbsoluteY(n.y))}w=y.ix();x=y.iy();
if(-12<=w&&w<l+24&&-12<=x&&x<c+24){if(f[w+12+(x+12)*q.w]===this.cInd)continue;f[w+12+(x+12)*q.w]=this.cInd}a.rangeOK&&(K.moveTo(w,x),K.lineTo(w,x));v.x=n.x;v.y=n.y;r.x=n.x;r.y=n.y;z=this.newt.getUnitNormal();if(0!=z.x||0!=z.y)for(z.rotL90(),u.x=z.x,u.y=z.y,G=A=0,J=!1;2>G;)if(J&&(u.x=-z.x,u.y=-z.y,n.x=v.x,n.y=v.y,r.x=n.x,r.y=n.y,this.abs_coord?y.set(n.x,n.y):y.set(q.getAbsoluteX(n.x),q.getAbsoluteY(n.y)),w=y.ix(),x=y.iy(),J=!1,A=0),n.x+=C*u.x,n.y+=C*u.y,n=this.newt.findZero(n,P),null!=n){d.setVariable("x",
n.x);d.setVariable("y",n.y);u.x=n.x-r.x;u.y=n.y-r.y;u.normalize();if(0==u.x&&0==u.y)break;r.x=n.x;r.y=n.y;this.abs_coord?y.set(n.x,n.y):y.set(q.getAbsoluteX(n.x),q.getAbsoluteY(n.y));E=parseInt(y.ix());F=parseInt(y.iy());if(E!=w||F!=x)if(L=w,I=x,w=E,x=F,-12<=w&&w<l+24&&-12<=x&&x<c+24){A=0;M=f[w+12+(x+12)*q.w];f[w+12+(x+12)*q.w]=this.cInd;for(Q=1;8>Q;Q++)O=L+Math.round((w-L)*Q/8),H=I+Math.round((x-I)*Q/8),0<=O&&O<l&&0<=H&&H<c&&(f[O+12+(H+12)*q.w]=this.cInd);a.rangeOK&&(K.moveTo(L,I),K.lineTo(w,x));
if(M===this.cInd)break}else J=!0,G++;else 4<++A&&(J=!0,G++)}}K.stroke()}};N.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};N.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};N.prototype.XX=function(a,c,b){return Math.round(this.X(a,c,b))};N.prototype.YY=function(a,c,b){return Math.round(this.Y(a,c,b))};N.prototype.extrapolate=
function(c,b,k,e,h,g){for(var d=this.evaluator.getVariable(b),f=g/2,l=0,m,r,u,n,p,v;1E-15<Math.abs(f);){m=this.evaluator.getVariable(b);r=this.evaluator.getVariable(b)+f;this.evaluator.setVariable(b,r);u=!0;try{n=h,h=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(k,h),0<this.evaluator.eval(c)?(p=new a.R2(Math.min(n,h),Math.max(n,h)),v=0,v=0<g?this.Singularity(Math.abs(f),b,e,m,n,r,h,p):this.Singularity(Math.abs(f),b,e,r,h,m,n,p),0<v&&(u=!1)):u=!1}catch(aa){u=!1}u?l+=f:this.evaluator.setVariable(b,
m);f/=2}this.evaluator.setVariable(b,d);return new a.R2(l/Math.abs(g),h)};N.prototype.extrapolateOnSingularity=function(c,b,k,e,h,g){e=this.evaluator.getVariable(b);for(var d=g/2,f=0,l=h,m;1E-15<Math.abs(d);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)+d);m=!0;if(0<this.evaluator.eval(c))try{l=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(k,l),0>=this.evaluator.eval(c)&&(m=!1)}catch(X){m=!1}else m=!1;m?f+=d:this.evaluator.setVariable(b,this.evaluator.getVariable(b)-d);
d/=2}if(0==f)for(d=g/2,f=g,l=h;1E-15<Math.abs(d);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)-d);m=!0;if(0<this.evaluator.eval(c))try{l=this.evaluator.eval(this.funExpr)}catch(X){m=!1}else m=!1;m?f+=-d:this.evaluator.setVariable(b,this.evaluator.getVariable(b)+d);d/=2}this.evaluator.setVariable(b,e);return new a.R2(f/Math.abs(g),l)};N.prototype.Singularity=function(a,c,b,k,e,h,g,d){if(isNaN(g)||isNaN(e)||isNaN(d.y)||isNaN(d.x)||k>=h)return 2;var f=this.evaluator.getVariable(c),l=0;
try{if(1E-15>Math.abs(h-k)||1E-12>Math.abs(h-k)&&Math.abs(g-e)>Math.abs(a))return this.evaluator.setVariable(c,f),1;var m=(k+h)/2;this.evaluator.setVariable(c,m);var r=NaN;try{r=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(r))return 5;if(Math.abs(g-e)>a){this.evaluator.setVariable(c,k-1E-12);var u=this.evaluator.eval(this.funExpr);u=(e-u)/1E-12;this.evaluator.setVariable(c,h+1E-12);var n=(this.evaluator.eval(this.funExpr)-g)/1E-12;if((10>Math.abs(n)||10>Math.abs(u))&&(0<=n&&0<=u||
0>=n&&0>=u)&&4*Math.abs(n)<Math.abs((g-e)/(h-k)))return this.evaluator.setVariable(c,f),2}if(isNaN(d.x)||isNaN(d.y)||isNaN(r))return 2;if(!(d.x<=r&&r<=d.y)){this.evaluator.setVariable(c,m);d.x=Math.min(e,r);d.y=Math.max(e,r);var p=this.Singularity(a/2,c,b,k,e,m,r,d);this.evaluator.setVariable(c,h);d.x=Math.min(g,r);d.y=Math.max(g,r);var v=this.Singularity(a/2,c,b,m,r,h,g,d);l=Math.max(p,v)}}catch(Y){l=1}this.evaluator.setVariable(c,f);return l};N.prototype.drawAuxFun=function(c,k,e){b=this.evaluator.parser.getVariable("x");
m=this.evaluator.parser.getVariable("y");a.rangeOK=1;k="x";var h="y";this.of_y&&(k="y",h="x");var g=this.drawif,d=this.evaluator.eval(this.width),f=!1,l=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?l.ix():l.iy(),u=0,n=0,p=0,v=0,q=1/this.space.scale;l=q*(this.of_y?-this.space.h+l.y:-l.x);var w=0;this.abs_coord&&(l=0,q=1);for(var G,z,y,A,x,B,I,F,D,E=this.of_y?this.space.h+2:this.space.w+2;p<=E;){G=!0;z=0;this.evaluator.setVariable(k,l);try{y=this.evaluator.eval(this.funExpr),
isNaN(y)||(this.evaluator.setVariable(h,y),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(f?(A=Math.min(w,y),x=Math.max(w,y),B=new a.R2(A,x),z=this.Singularity(q,k,0,l-q,w,l,y,B),0===z?(w<=y?(w=B.x,y=B.y):(y=B.x,w=B.y),I=parseInt(this.of_y?this.XX(d,w,this.abs_coord):this.YY(d,w,this.abs_coord)),u=this.abs_coord?Math.round(y):parseInt(this.of_y?this.XX(d,y,this.abs_coord):this.YY(d,y,this.abs_coord)),this.fillM&&u>r&&(c.lineWidth=1,c.strokeStyle=this.fillM.getColor(),c.beginPath(),this.of_y?(c.moveTo(r+
1,this.space.h-p+.5),c.lineTo(u,this.space.h-p+.5)):(c.moveTo(p+.5,r+1),c.lineTo(p+.5,u)),c.stroke()),this.fillP&&u<r&&(c.lineWidth=1,c.strokeStyle=this.fillP.getColor(),c.beginPath(),this.of_y?(c.moveTo(r-1,this.space.h-p+.5),c.lineTo(u,this.space.h-p+.5)):(c.moveTo(p+.5,r-1),c.lineTo(p+.5,u)),c.stroke()),c.lineWidth=d,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(I+.5,this.space.h-v),c.lineTo(u+.5,this.space.h-p)):(c.moveTo(v+.5,I),c.lineTo(p+.5,u)),c.stroke()):1===z?(this.evaluator.setVariable(k,
l-q),F=this.extrapolate(g,k,h,0,w,q),u=this.of_y?this.XX(d,F.y,this.abs_coord):this.YY(d,F.y,this.abs_coord),c.lineWidth=d,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(n+.5,this.space.h-v),c.lineTo(u+.5,this.space.h-v+Math.round(F.x))):(c.moveTo(v+.5,n),c.lineTo(v+Math.round(F.x)+.5,u)),this.evaluator.setVariable(k,l),D=this.extrapolate(g,k,h,0,y,-q),n=this.of_y?this.XX(d,D.y,this.abs_coord):this.YY(d,D.y,this.abs_coord),u=this.of_y?this.XX(d,y,this.abs_coord):this.YY(d,y,this.abs_coord),
c.lineWidth=d,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(n+.5,this.space.h-p),c.lineTo(u+.5,this.space.h-p)):(c.moveTo(p+.5,n),c.lineTo(p+.5,u)),c.stroke()):2===z&&(u=this.of_y?this.XX(d,y,this.abs_coord):this.YY(d,y,this.abs_coord),c.lineWidth=d,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(n+.5,this.space.h-p),c.lineTo(u+.5,this.space.h-p)):(c.moveTo(p+.5,n),c.lineTo(p+.5,u)))):(D=this.extrapolateOnSingularity(g,k,h,0,y,-q),n=this.of_y?this.XX(d,D.y,this.abs_coord):
this.YY(d,D.y,this.abs_coord),u=this.of_y?this.XX(d,y,this.abs_coord):this.YY(d,y,this.abs_coord),c.lineWidth=d,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(n,this.space.h-(p+Math.round(D.x))+.5),c.lineTo(u,this.space.h-p+.5)):(c.moveTo(p+Math.round(D.x),n),c.lineTo(p,u)),c.stroke()),w=y):G=!1)}catch(ba){G=!1}f&&!G&&(this.evaluator.setVariable(k,l-q),this.evaluator.setVariable(h,w),F=this.extrapolate(g,k,h,0,w,q),u=parseInt(this.of_y?this.XX(d,F.y,this.abs_coord):this.YY(d,F.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(c.lineWidth=d,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(n,this.space.h-(v+Math.round(F.x))+.5),c.lineTo(u,this.space.h-(v+Math.round(F.x))+.5)):(c.moveTo(v+Math.round(F.x)+.5,n),c.lineTo(v+Math.round(F.x)+.5,u)),c.stroke()),this.evaluator.setVariable(k,l));f=G;l+=q;n=u;v=p++}this.evaluator.parser.setVariable("x",b);this.evaluator.parser.setVariable("y",m)};N.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=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d,g,q,p,b,m,l,c=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(c,a.Graphic);c.prototype.update=
function(){d=this.evaluator;g=d.eval(this.parameter_interval);this.paraInf=g[0][0];this.paraSup=g[0][1];this.pSteps=d.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};c.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};c.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};c.prototype.drawAux=function(c,e,g){d=this.evaluator;q=this.space;c.lineWidth=Math.max(1E-6,f(d.eval(this.width)));
c.lineCap=c.lineJoin="round";c.strokeStyle=g.getColor();p=d.getVariable(this.parameter);c.beginPath();d.setVariable(this.parameter,this.paraInf);b=d.eval(this.expresion);this.exprX=f(this.abs_coord?b[0][0]:q.getAbsoluteX(b[0][0]));this.exprY=f(this.abs_coord?b[0][1]:q.getAbsoluteY(b[0][1]));this.rotateExp&&(m=a.degToRad(d.eval(this.rotateExp)),l=this.rotate(b[0][0],b[0][1],m),this.exprX=f(this.abs_coord?l.x:q.getAbsoluteX(l.x)),this.exprY=f(this.abs_coord?l.y:q.getAbsoluteY(l.y)));c.moveTo(this.exprX+
.5,this.exprY+.5);for(g=1;g<=this.pSteps;g++)d.setVariable(this.parameter,this.paraInf+g*this.paraSep),b=d.eval(this.expresion),this.rotateExp&&(l=this.rotate(b[0][0],b[0][1],m),b[0][0]=l.x,b[0][1]=l.y),this.exprX=f(this.abs_coord?b[0][0]:q.getAbsoluteX(b[0][0])),this.exprY=f(this.abs_coord?b[0][1]:q.getAbsoluteY(b[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,p)};c.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=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,d=Math.round,g,q,p,b,m,l,c,h,e,v,r=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(r,a.Graphic);r.prototype.update=function(){g=this.evaluator;p=g.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&
(b=this.rotate(p[0][0],p[0][1],a.degToRad(g.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);c=g.eval(this.range);this.rangeInf=c[0][0];this.rangeMax=c[0][1]};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(c,b){g=this.evaluator;q=this.space;e=h=Math.ceil(g.eval(this.size)-.4);c.fillStyle=b.getColor();c.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);b=g.getVariable("n");for(var r=this.rangeInf,k=this.rangeMax;r<=k;r++)g.setVariable("n",r),p=g.eval(this.expresion),this.exprX=p[0][0],this.exprY=p[0][1],m=d(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX)),l=d(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY)),c.beginPath(),c.arc(m,l,h,0,f,!0),c.fill();c.fill();this.text!=[""]&&(this.fontSize=Math.max(5,g.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,c,this.text,m+e,l-e,this.color,this.font,"start","alphabetic",g.eval(this.decimals),this.fixed,!0));g.setVariable("n",b)};r.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=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,d=Math.round,g,q,p,b,m,l,c,h=function(c,b){b=a.Graphic.call(this,c,b)||this;b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){g=this.evaluator;p=g.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&(b=this.rotate(p[0][0],p[0][1],a.degToRad(g.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};h.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};h.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};h.prototype.drawAux=function(a,b){q=this.space;a.fillStyle=b.getColor();m=d(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX));l=d(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY));c=d(this.evaluator.eval(this.size));0<c&&(a.beginPath(),a.arc(m,l,c,0,f),a.fill());this.text.hasContent&&this.text.draw(a,b,m,l)};a.Point=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d=2*Math.PI,g,q,p,b,m,l,c,h,e,v,r=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(r,a.Graphic);r.prototype.update=function(){g=this.evaluator;p=g.eval(this.expresion);this.endPoints=[];for(var c=0,e=p.length;c<e;c++)this.endPoints[c]={x:p[c][0],y:p[c][1]};if(this.rotateExp)for(b=a.degToRad(g.eval(this.rotateExp)),
c=0,e=this.endPoints.length;c<e;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,b)};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(a,b,r){g=this.evaluator;q=this.space;a.lineWidth=Math.max(1E-6,f(g.eval(this.width)));m=g.eval(this.size);a.fillStyle=b.getColor();a.strokeStyle=r.getColor();a.lineCap="round";l=
0==a.lineWidth%2?0:.5;this.abs_coord?(c=f(this.endPoints[0].x),h=f(this.endPoints[0].y),e=f(this.endPoints[1].x),v=f(this.endPoints[1].y)):(c=f(q.getAbsoluteX(this.endPoints[0].x)),h=f(q.getAbsoluteY(this.endPoints[0].y)),e=f(q.getAbsoluteX(this.endPoints[1].x)),v=f(q.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(c+l,h+l);a.lineTo(e+l,v+l);this.dashStyle();a.stroke();0<m&&(a.beginPath(),a.arc(c,h,m,0,d),a.arc(e,v,m,0,d),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
r,parseInt((c+e)/2)-3,parseInt((h+v)/2)+3)};a.Segment=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=Math.round,g,q,p,b,m,l,c,h,e,v,r,u,y,n=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);b.endPoints=[];b.vect=new a.Vector2D(0,0);return b};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){g=this.evaluator;q=g.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(p=a.degToRad(g.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,p)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};n.prototype.drawAux=function(a,n,p){g=this.evaluator;b=this.space;m=Math.max(0,
g.eval(this.width));l=Math.ceil(m/2);c=b.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;h=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=n.getColor();a.strokeStyle=p.getColor();a.lineWidth=2;this.abs_coord?(e=d(this.endPoints[0].x),v=d(this.endPoints[0].y),r=d(this.endPoints[1].x),u=d(this.endPoints[1].y)):(e=d(b.getAbsoluteX(this.endPoints[0].x)),v=d(b.getAbsoluteY(this.endPoints[0].y)),r=d(b.getAbsoluteX(this.endPoints[1].x)),
u=d(b.getAbsoluteY(this.endPoints[1].y)));y=Math.max(0,g.eval(this.spear));a.save();a.translate(e,v);this.abs_coord?a.rotate(this.angle):(h*=c,a.rotate(-this.angle));a.beginPath();a.moveTo(-l,f(-l));a.lineTo(f(h-y-m),f(-l));a.lineTo(f(h-2*y),f(-y-l));a.lineTo(f(h),0);a.lineTo(f(h-2*y),f(y+l));a.lineTo(f(h-y-m),f(l));a.lineTo(-l,f(l));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,p,parseInt((e+r)/2)-3,parseInt((v+u)/2)+3)};a.Arrow=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d,g,q,p,b,m,l=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(l,a.Graphic);l.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(p=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,p)};l.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};l.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};l.prototype.drawAux=function(a,h,e){d=this.evaluator;g=this.space;a.lineWidth=Math.max(1E-6,f(d.eval(this.width)));a.strokeStyle=e.getColor();a.lineCap=a.lineJoin="round";b=f(this.abs_coord?this.endPoints[0].x:g.getAbsoluteX(this.endPoints[0].x));m=f(this.abs_coord?this.endPoints[0].y:g.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(b+0,m+0);e=1;for(var c=this.endPoints.length;e<c;e++)b=f(this.abs_coord?this.endPoints[e].x:g.getAbsoluteX(this.endPoints[e].x)),m=f(this.abs_coord?this.endPoints[e].y:g.getAbsoluteY(this.endPoints[e].y)),a.lineTo(b+0,m+0);this.fill&&(a.fillStyle=h.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d=Math.min,g=Math.max,q=Math.abs,p,b,m,l,c,h,e,v,r,u,y=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(y,a.Graphic);y.prototype.update=function(){p=this.evaluator;l=p.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.w=150;this.h=100;this.rotateExp&&(m=this.rotate(l[0][0],
l[0][1],a.degToRad(p.eval(this.rotateExp))),this.exprX=m.x,this.exprY=m.y);4<=l[0].length&&(this.w=l[0][2],this.h=l[0][3]);l[1]&&2==l[1].length&&(this.w=l[1][0],this.h=l[1][1]);this.w=g(0,this.w);this.h=g(0,this.h)};y.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};y.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};y.prototype.drawAux=function(a,k,l,m){p=this.evaluator;b=this.space;a.lineWidth=Math.max(1E-6,f(p.eval(this.width)));
a.strokeStyle=l.getColor();a.lineCap="round";a.lineJoin="miter";c=f(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+0;h=f(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+0;e=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;r=d(g(0,p.eval(this.border_radius)),.5*q(e),.5*q(v));u=this.abs_coord?1:-1;a.beginPath();0!==r?(a.moveTo(c+r,h),a.lineTo(c+e-r,h),a.quadraticCurveTo(c+e,h,c+e,h+u*r),a.lineTo(c+e,h+v-u*r),a.quadraticCurveTo(c+e,h+v,c+e-r,h+v),a.lineTo(c+r,
h+v),a.quadraticCurveTo(c,h+v,c,h+v-u*r),a.lineTo(c,h+u*r),a.quadraticCurveTo(c,h,c+r,h),a.lineTo(c+r,h)):(a.moveTo(c,h),a.lineTo(c+e,h),a.lineTo(c+e,h+v),a.lineTo(c,h+v),a.lineTo(c,h));this.fill&&(a.fillStyle=k.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d=Math.min,g=Math.max,q=Math.acos,p=Math.sqrt,b=Math.PI,m=b/2,l=2*b,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F,D,B,L,I=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(I,a.Graphic);I.prototype.update=function(){c=this.evaluator;h=c.eval(this.center);this.exprX=h[0][0];this.exprY=h[0][1];e=0;this.rotateExp&&(e=a.degToRad(c.eval(this.rotateExp)),v=Math.cos(e),r=Math.sin(e),u=this.exprX*v-this.exprY*r,y=this.exprX*r+this.exprY*v,this.exprX=u,this.exprY=y);var f=c.eval(this.initExpr),
B=c.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(n=f[0][0],k=f[0][1],w=B[0][0],x=B[0][1],this.vectors?this.abs_coord&&(k=-k,x=-x):(n-=this.exprX,k=-k+this.exprY,w-=this.exprX,x=-x+this.exprY,this.abs_coord||(k=-k,x=-x)),z=0==n?0>k?3*m:m:q(1*n/p(n*n+k*k)),A=0==w?0>x?3*m:m:q(1*w/p(w*w+x*x)),z+=e,A+=e,0<n&&0<k&&this.abs_coord&&(z=l-z),0<n&&0>k&&!this.abs_coord&&(z=l-z),0>n&&0>k&&!this.abs_coord&&(z=l-z),0>n&&0<k&&this.abs_coord&&
(z=l-z),0<w&&0<x&&this.abs_coord&&(A=l-A),0<w&&0>x&&!this.abs_coord&&(A=l-A),0>w&&0>x&&!this.abs_coord&&(A=l-A),0>w&&0<x&&this.abs_coord&&(A=l-A),this.initFlag?(G=z,z=A,A=G):(G=d(z,A),J=g(z,A),z=G,A=J,A-z>b&&this.abs_coord&&(z=J,A=G),A-z<=b&&!this.abs_coord&&(z=J,A=G)),this.iniAng=z,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(f)+e,this.endAng=a.degToRad(B)+e,this.drawAngle=!0)};I.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};I.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};I.prototype.drawAux=function(a,b,k){c=this.evaluator;E=this.space;B=Math.max(0,c.eval(this.radius));a.lineWidth=Math.max(1E-6,f(c.eval(this.width)));a.lineCap="round";a.strokeStyle=k.getColor();this.abs_coord?(F=f(this.exprX),D=f(this.exprY)):(F=f(E.getAbsoluteX(this.exprX)),D=f(E.getAbsoluteY(this.exprY)),B*=E.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(L=this.iniAng,this.iniAng=
this.endAng,this.endAng=L);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(F,D),a.arc(F,D,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(F,D,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,F,D)};a.Arc=I;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b=function(b,g){g=a.Graphic.call(this,b,g)||this;g.width=g.width||b.evaluator.parser.parse("0");g.align||(g.align="left");g.anchor||(g.anchor="top_left");g.shadowColor=g.shadowColor?g.shadowColor.getColor():"transparent";g.text=new a.TextObject(g,g.text);return g};$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&&(g=this.rotate(d[0][0],
d[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=g.x,this.exprY=g.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),p=parseInt(this.exprY)):(q=parseInt(this.space.getAbsoluteX(this.exprX)),p=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,q,p)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,d,g,q,p,b,m,l,c,h,e,v,r=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;c=b.expresion.getChildren();b.x_e=c[0];b.y_e=c[1];2<c.length&&(b.centered=!0,b.s_x_e=c[2],b.s_y_e=3<c.length?c[3]:c[2]);b.evaluator.eval(b.clip)&&(b.clip=b.clip.getChildren());b.update();return b};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){d=
this.evaluator;var c=d.eval(this.x_e),b=d.eval(this.y_e);this.exprX=c;this.exprY=b;this.rotateExp&&(g=this.rotate(c,b,a.degToRad(d.eval(this.rotateExp))),this.exprX=g.x,this.exprY=g.y);this.centered&&(this.scaleX=d.eval(this.s_x_e),this.scaleY=d.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));var e=this;if((q=d.eval(this.file))||""==q)this.img=this.parent.getImage(q),this.img.addEventListener("load",function(a){e.space.update(!0)})};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};
r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};r.prototype.drawAux=function(g){d=this.evaluator;p=this.space;this.img&&this.img.ready&&this.img.complete&&(this.clip?(e=d.eval(this.clip[2]),v=d.eval(this.clip[3])):(e=this.img.width,v=this.img.height),this.img.canvas&&(e=f(e/this.ratio),v=f(v/this.ratio)),b=this.centered?0:f(e/2),m=this.centered?0:f(v/2),l=f(this.abs_coord?this.exprX:p.getAbsoluteX(this.exprX)),c=f(this.abs_coord?this.exprY:p.getAbsoluteY(this.exprY)),h=
a.degToRad(-d.eval(this.inirot)),g.save(),g.translate(l+b,c+m),g.rotate(h),this.opacity&&(g.globalAlpha=d.eval(this.opacity)),g.scale(this.scaleX,this.scaleY),this.clip?g.drawImage(this.img,d.eval(this.clip[0]),d.eval(this.clip[1]),e,v,-e/2,-v/2,e,v):g.drawImage(this.img,-e/2,-v/2,e,v),g.restore())};a.Image=r;return a}(descartesJS||{});
descartesJS=function(a){function f(a,c,b){l=4*(c+b*a.width);return{r:a.data[l],g:a.data[l+1],b:a.data[l+2],a:a.data[l+3]}}if(a.loadLib)return a;var d,g,q,p,b,m,l,c,h=function(c,b){return a.Graphic.call(this,c,b)||this};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){d=this.evaluator.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1]};h.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};h.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};h.prototype.drawAux=function(a,h){h.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(g=parseInt(this.exprX),q=parseInt(this.exprY)):(g=parseInt(this.space.getAbsoluteX(this.exprX)),q=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>g||0>q||g>=this.space.w||q>=this.space.h)){p=[[g,q]];m=f(imageData,g,q);for(c=0;0<p.length;){c++;b=p.pop();g=b[0];q=b[1];var e=f(imageData,g,q);if(m.r===e.r&&m.g===e.g&&m.b===e.b&&m.a===e.a){e=imageData;var d=
h;l=4*(g+q*e.width);e.data[l+0]=d.r;e.data[l+1]=d.g;e.data[l+2]=d.b;e.data[l+3]=255*d.a;0<g&&p.push([g-1,q]);g<imageData.width-1&&p.push([g+1,q]);p.push([g,q-1]);p.push([g,q+1])}if(c>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=h;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-"),g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,p=function(b,m){var l=a.Graphic.call(this,b,m)||this;l.hasExpresion=l.hasExpresion||!1;l.inirot=l.inirot||b.evaluator.parser.parse("0");l.inipos=l.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(l,m);l.hasExpresion=void 0!==l.expresion;l.graphics=[];b=b.lessonParser;var c=new a.Tokenizer;
if(!l.hasExpresion)return l;"'"!==l.expresion.charAt(0)&&(l.expresion="'"+l.expresion+"'");l.expresion=l.evaluator.parser.parse(l.expresion);m=l.evaluator.eval(l.expresion);if(m)var h=(h=document.getElementById(m))&&"descartes/macro"==h.type?h.text:a.openExternalFile(m);if(h){var e=a.convertHTMLEntities(h).replace(/\r/g,"").split("\n");h=[];m=0;for(var p=e.length;m<p;m++)if(e[m].trim()){var r=e[m].indexOf("=");if(-1!==r){r=b.split(e[m]);for(var u=0,q=r.length;u<q;u++)if(r[u]&&1<r.length&&("id"===
f[r[u][0]]||"type"===f[r[u][0]])){h.push(r);break}}}u=function(b,k){k=c.tokenize(k.replace(/&squot;/g,"'"));for(var e=0,h=k.length;e<h;e++)if("identifier"==k[e].type&&!a.reservedIds.match("-"+k[e].value+"-")||"R"===k[e].value||"G"===k[e].value||"B"===k[e].value)k[e].value=l.name+"."+k[e].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+c.flatTokens(k)};m=0;for(p=h.length;m<p;m++){var n=(q=h[m]||[],q[0])&&"id"===q[0][0];e=0;for(r=q.length;e<r;e++){var k=q[e][0].indexOf(".");-1===k||n?k=f[q[e][0]]:
(k=f[q[e][0].substring(k+1)],q[e][0]=l.name+"."+q[e][0]);if(!("font"===k||"font_family"===k||("fill"===k||"color"===k||"border"===k||"arrow"===k)&&"("!==q[e][1].charAt(0)||"file"===k&&q[e][1].match(g)||"id"!==k&&void 0!==f[q[e][1]])||"radius"===k)if("text"==k)if(q[e][1].match(/\{\\rtf1/))k=q[e][1],k=k.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),k=k.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),q[e][1]=k;else{var w=b.parseText(q[e][1]).textElementsMacros;
for(var x=0,z=w.length;x<z;x++){k=c.tokenize(w[x].replace(/&squot;/g,"'"));for(var A=0,G=k.length;A<G;A++)if("identifier"===k[A].type&&!a.reservedIds.match("-"+k[A].value+"-")||"R"===k[A].value||"G"===k[A].value||"B"===k[A].value)k[A].value=l.name+"."+k[A].value;k=c.flatTokens(k).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");w[x]=k.substring(1,k.length-1)}q[e][1]=w.join("")}else{w=q[e][1].replace(/&squot;/g,"'").split(";");x=0;for(z=w.length;x<z;x++){k=c.tokenize(w[x].replace(/\\n/g,
";"));A=0;for(G=k.length;A<G;A++)if("identifier"===k[A].type&&!a.reservedIds.match("-"+k[A].value+"-")||"R"===k[A].value||"G"===k[A].value||"B"===k[A].value)k[A].value=l.name+"."+k[A].value;w[x]=c.flatTokens(k)}q[e][1]=w.join(";")}}}m=0;for(p=h.length;m<p;m++)if(h[m][0]){u="";q=!1;e=0;for(r=h[m].length;e<r;e++)"type"===f[h[m][e][0]]&&d.match("-"+f[h[m][e][1]]+"-")&&(q=!0),u=u+h[m][e][0]+"='"+h[m][e][1]+"' ";h[m]=u+(q?" space='"+l.spaceID+"'":"");q?l.graphics.push(b.parseGraphic(h[m],l.abs_coord,l.background,
l.inirot)):b.parseAuxiliar(h[m])}}return l};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){q=this.evaluator.eval(this.inipos);this.iniPosX=q[0][0];this.iniPosY=q[0][1]};p.prototype.drawAux=function(a){for(var b=0,g=this.graphics.length;b<g;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=p;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var f=Math.sqrt,d=Math.sin,g=Math.cos,q=Math.abs,p,b,m,l,c,h,e,v,r,u,y,n,k,w,x,z=function(a,c,b,k){this.x=a||0;this.y=c||0;this.z=b||0;this.w=k||0;this.adjustDec()};z.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,c,b,k,e,h,g,d,f,l,m,r,p,n,u,v){this.a00=a||0;this.a01=c||0;this.a02=b||0;this.a03=k||0;this.a10=e||0;this.a11=h||0;this.a12=g||0;this.a13=d||0;
this.a20=f||0;this.a21=l||0;this.a22=m||0;this.a23=r||0;this.a30=p||0;this.a31=n||0;this.a32=u||0;this.a33=v||0};A.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};A.prototype.multiplyVector4=function(a){return new z(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};A.prototype.translate=function(a){return new A(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};A.prototype.rotateX=function(a){b=d(a);m=g(a);v=this.a10;r=this.a11;u=this.a12;
y=this.a13;n=this.a20;k=this.a21;w=this.a22;x=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,v*m+n*b,r*m+k*b,u*m+w*b,y*m+x*b,v*-b+n*m,r*-b+k*m,u*-b+w*m,y*-b+x*m,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){b=d(a);m=g(a);l=this.a00;c=this.a01;h=this.a02;e=this.a03;n=this.a20;k=this.a21;w=this.a22;x=this.a23;return new A(l*m+n*-b,c*m+k*-b,h*m+w*-b,e*m+x*-b,this.a10,this.a11,this.a12,this.a13,l*b+n*m,c*b+k*m,h*b+w*m,e*b+x*m,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){b=d(a);m=g(a);l=this.a00;c=this.a01;h=this.a02;e=this.a03;v=this.a10;r=this.a11;u=this.a12;y=this.a13;return new A(l*m+v*b,c*m+r*b,h*m+u*b,e*m+y*b,l*-b+v*m,c*-b+r*m,h*-b+u*m,e*-b+y*m,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){p=a.norm3D(c);if(0===p)return{x:0,y:0,z:0};if(1===p)return{x:c.x,y:c.y,z:c.z};p=1/p;return{x:c.x*p,y:c.y*p,z:c.z*p}};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=z;a.Matrix4x4=A;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=m;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);r=1;for(u=this.projVert.length;r<u;r++)a.lineTo(this.projVert[r].x,this.projVert[r].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=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 g(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";e=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,e)}function q(a){a.textNode=null;a.lineCap=m;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function p(c,b,k){return a.normalize3D(a.crossProduct3D(a.subtract3D(c,
b),a.subtract3D(c,k)))}if(a.loadLib)return a;var b=2*Math.PI,m=lineJoin="round",l,c,h,e,v,r,u,y,n,k,w,x,z,A=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=p(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=d):"text"===this.type?this.draw=g:"edge"===this.type&&(this.draw=q);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};A.prototype.computeDepth=function(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};r=0;for(u=this.vertices.length;r<u;r++)this.spaceVertices[r]=c.rotateVertex(this.vertices[r]),this.average.x+=this.spaceVertices[r].x,this.average.y+=this.spaceVertices[r].y,this.average.z+=this.spaceVertices[r].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=p(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));r=0;for(u=this.vertices.length;r<u;r++)this.newSpaceVert[r]=this.spaceVertices[r],this.projVert[r]=this.newProjVert[r]=c.project(this.spaceVertices[r]);2<this.vertices.length&&(this.direction=p(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;r=0;for(u=this.vertices.length;r<u;r++)y=a.norm3D(a.subtract3D(this.spaceVertices[r],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,y),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,y);r=0;for(u=this.vertices.length;r<u;r++)this.minx>this.projVert[r].x&&(this.minx=this.projVert[r].x),this.maxx<this.projVert[r].x&&(this.maxx=this.projVert[r].x),this.miny>this.projVert[r].y&&(this.miny=this.projVert[r].y),
this.maxy<this.projVert[r].y&&(this.maxy=this.projVert[r].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];r=0;for(u=this.vertices.length;r<u;r++)(1E-8<Math.abs(this.vertices[r].x-this.vertices[(r+1)%u].x)||1E-8<Math.abs(this.vertices[r].y-this.vertices[(r+1)%u].y)||1E-8<Math.abs(this.vertices[r].z-this.vertices[(r+1)%u].z)||1E-8<Math.abs(this.vertices[r].w-this.vertices[(r+1)%u].w))&&v.push(this.vertices[r]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};A.prototype.drawText=
function(b,k,e,g,d,f,m,r,p,n,u){l=this.evaluator;b.textNode=k;f=l.eval(this.offset_dist);m=-a.degToRad(l.eval(this.offset_angle));e+=f*Math.cos(m);g+=f*Math.sin(m);b.textNode.pos={x:e,y:g};k.hasContent&&(k.draw(b,d,e,g,!0),h=this.fromPoint?k.textNodes.metrics.w/2:0,c=this.fromPoint?k.textNodes.metrics.h/2:0,k.draw(b,d,e-h,g-c))};A.prototype.splitFace=function(c){if(this.intersects(c)){var b=i2=null,k=ix2=0,e,h;var g=this.vertices;var d=c.vertices;var f=0;for(h=d.length;f<h;f++){var l=this.intersection(d[f],
d[(f+1)%h]);if(null!==l)if(null===b){if(b=l,k=f,2===d.length){i2=b;break}}else if(!a.equals3DEpsilon(l,b,1E-8)){i2=l;ix2=f;break}}if(null!==b&&null!==i2){f=this.isInterior(b)||this.isInterior(i2);var m=e=null;if(!f&&3<=d.length)for(h=0,g=g.length;h<g;h++)if(l=c.intersection(this.vertices[h],this.vertices[(h+1)%g]),null!==l)if(null===e)e=l;else if(!a.equals3DEpsilon(l,e,1E-8)){m=l;break}if(f||null!==e&&null!==m&&c.isInterior(e)&&c.isInterior(m)){m=!0;g=l=null;if(2===d.length)a.equals3DEpsilon(b,d[0],
1E-8)||a.equals3DEpsilon(b,d[1],1E-8)?m=!1:(l=[],l[0]=d[0],l[1]=b,g=[],g[0]=b,g[1]=d[1]);else for(l=[],g=[],f=h=e=0;f<d.length;f++)f<k?l[e++]=d[f]:f==k?(l[e++]=d[f],l[e++]=b,g[h++]=b):f<ix2?g[h++]=d[f]:f==ix2?(g[h++]=d[f],g[h++]=i2,l[e++]=i2):l[e++]=d[f];if(m){b=[];b[0]=new A({vertices:l,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 A({vertices:g,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]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(c){var b=this.vertices;var k=c.vertices;if(0<b.length){var e=a.dotProduct3D(k[0],c.normal);var h=a.dotProduct3D(b[0],c.normal);if(1E-8>Math.abs(e-h))return!0;for(var g=1,d=
b.length;g<d;g++)if(k=a.dotProduct3D(b[g],c.normal),1E-8>Math.abs(e-k)||k>e&&h<e||k<e&&h>e)return!0}return!1};A.prototype.intersection=function(c,b){var k=this.vertices;if(0<k.length){b=a.subtract3D(b,c);var e=a.dotProduct3D(b,this.normal);if(0!==e&&(k=a.dotProduct3D(a.subtract3D(k[0],c),this.normal)/e,-1E-8<k&&1.00000001>k))return a.add3D(c,a.scalarProduct3D(b,k))}return null};A.prototype.isInterior=function(c){var b=this.vertices;if(0<b.length)for(var k=0,e=a.subtract3D(b[0],c),h=0,g=b.length;h<
g;h++){var d=a.subtract3D(b[(h+1)%g],c),f=a.dotProduct3D(a.crossProduct3D(e,d),this.normal);if(1E-8>Math.abs(f)){if(0>a.dotProduct3D(e,d))break}else{if(0>k&&0<f||0<k&&0>f)return!1;e=d;k=f}}return!0};A.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(x=0;3>x;x++)if(n=null,n=0===x?this.intersections(c):1===x?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=n&&0<n.length){for(z=
0;z<n.length;z++)a.push(n[z]);r=0;for(u=n.length;r<u;r++){k=n[r];w=this.space.rayFromEye(k.x,k.y);try{t=this.distanceToEyeAlong(w)-c.distanceToEyeAlong(w);if(t<=-b)return!0;if(t>=b)return!1}catch(F){}}}return!1};A.prototype.intersections=function(c){for(var b=[],k,e,h,g=new a.R2,d=this.newSpaceVert,f=c.newSpaceVert,l=this.newProjVert,m=c.newProjVert,r=0,p=d.length;r<p;r++){c=d[r];k=d[(r+1)%p];for(var n=0,u=f.length;n<u;n++)e=f[n],h=f[(n+1)%u],c!=e&&c!=h&&k!=e&&k!=h&&(e=g.intersection(l[r],l[(r+1)%
p],m[n],m[(n+1)%u]),null!=e&&b.push(e))}return b};A.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");};A.prototype.verticesContainedIn=function(a){for(var c=[],b=this.newSpaceVert,k=this.newProjVert,e=0,h=b.length;e<h;e++)!a.isVertex(b[e])&&a.appearsToContain(k[e])&&c.push(k[e]);return c};A.prototype.appearsToContain=function(a){for(var c=
0,b,k=this.newProjVert,e=0,h=this.newSpaceVert.length;e<h;e++){b=(k[e].x-a.x)*(k[(e+1)%h].y-a.y)-(k[(e+1)%h].x-a.x)*(k[e].y-a.y);if(0!=c)if(1E-8>Math.abs(b)){if(1E-8<Math.abs(k[e].x-k[(e+1)%h].x))return Math.min(k[e].x,k[(e+1)%h].x)<=a.x+1E-8&&a.x<=Math.max(k[e].x,k[(e+1)%h].x)+1E-8;if(1E-8<Math.abs(k[e].y-k[(e+1)%h].y))return Math.min(k[e].y,k[(e+1)%h].y)<=a.y+1E-8&&a.y<=Math.max(k[e].y,k[(e+1)%h].y)+1E-8}else if(0<c&&0>b||0>c&&0<b)return!1;c=b}return!0};A.prototype.isVertex=function(c){for(var b=
this.newSpaceVert,k=0,e=b.length;k<e;k++)if(a.equals3DEpsilon(c,b[k],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function f(a){for(var c=[],b=0,e,h=a.length,g=a.length-1;-1<g;g--)e=a.charAt(g),0==b?"="==e&&(b=1):1==b?" "!=e&&(b="<"===e||">"===e?0:2):2==b&&" "==e&&(c.unshift(a.substring(g+1,h)),h=g,b=0);c.unshift(a.substring(0,h));return c}if(a.loadLib)return a;var d={x:0,y:0,z:0},g,q,p,b,m,l=a.degToRad,c,h=function(c,b){this.parent=c;this.evaluator=c.evaluator;var e=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=e.parse("1");this.abs_coord=!1;this.family="";this.family_interval=e.parse("[0,1]");this.family_steps=e.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=e.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=e.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=e.parse("(0,0,0)");this.model="color";Object.assign(this,b);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=e.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=e.parse(this.inirot);this.endrot=e.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};h.prototype.getSpace=function(){for(var a=this.parent.spaces,c,b=0,
h=a.length;b<h;b++)if(c=a[b],c.id==this.spaceID)return c;return a[0]};h.prototype.getFamilyValues=function(){g=this.evaluator;q=g.eval(this.family_interval);this.familyInf=q[0][0];this.familySup=q[0][1];this.fSteps=Math.round(g.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};h.prototype.buildFamilyPrimitives=function(){g=this.evaluator;this.getFamilyValues();p=g.getVariable(this.family);if(0<=this.fSteps)for(var a=0,c=this.fSteps;a<=c;a++)g.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,g.eval(this.drawif)&&this.buildPrimitives();g.setVariable(this.family,p)};h.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};h.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(l(b[0][0])),this.inirotM=
this.inirotM.rotateX(l(b[0][1])),this.inirotM=this.inirotM.rotateZ(l(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(l(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(l(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(l(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(l(b[0][0])),this.endrotM=this.endrotM.rotateX(l(b[0][1])),this.endrotM=this.endrotM.rotateZ(l(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(l(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(l(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(l(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)};h.prototype.transformVertex=function(a){this.inirotEuler?m=
this.inirotM.multiplyVector4(a):(m=this.inirotM_X.multiplyVector4(a),m=this.inirotM_Y.multiplyVector4(m),m=this.inirotM_Z.multiplyVector4(m));m=this.iniposM.multiplyVector4(m);this.endrotEuler?m=this.endrotM.multiplyVector4(m):(m=this.endrotM_X.multiplyVector4(m),m=this.endrotM_Y.multiplyVector4(m),m=this.endrotM_Z.multiplyVector4(m));m=this.endposM.multiplyVector4(m);this.macroChildren&&(m=this.applyMacroTransform(m));m.adjustDec();return m};h.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
m=this.macro_inirotM.multiplyVector4(a):(m=this.macro_inirotM_X.multiplyVector4(a),m=this.macro_inirotM_Y.multiplyVector4(m),m=this.macro_inirotM_Z.multiplyVector4(m));m=this.macro_iniposM.multiplyVector4(m);this.macro_endrotEuler?m=this.macro_endrotM.multiplyVector4(m):(m=this.macro_endrotM_X.multiplyVector4(m),m=this.macro_endrotM_Y.multiplyVector4(m),m=this.macro_endrotM_Z.multiplyVector4(m));return m=this.macro_endposM.multiplyVector4(m)};h.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
c=[],b=0,h=a.length;b<h;b++)""!==a[b].trim()&&(c=c.concat(f(a[b])));b=0;for(h=c.length;b<h;b++)c[b]=this.evaluator.parser.parse(c[b],!0);return c};h.prototype.splitFace=function(a){for(var b=0,e=this.primitives.length;b<e;b++)if(c=[],"face"===this.primitives[b].type){for(var h=0,g=a.primitives.length;h<g;h++)"face"===a.primitives[h].type?c=c.concat(this.primitives[b].splitFace(a.primitives[h])):c.push(a.primitives[h]);a.primitives=c}};a.Graphic3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b=function(b,g){return a.Graphic3D.call(this,b,g)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();d=f.eval(this.expresion);g=d[0][0];q=d[0][1];p=d[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,q,p,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(g,q,p,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals: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,g,q,p,b,m,l,c,h=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(h,a.Graphic3D);h.prototype.buildPrimitives=function(){l=this.evaluator;this.updateMVMatrix();m=l.getVariable("u");l.setVariable("u",this.Nu);c=l.eval(this.expresion);f=c[0][0];d=c[0][1];g=c[0][2];q=c[1][0];p=c[1][1];b=c[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,
d,g,1)),this.transformVertex(new a.Vector4D(q,p,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:l.eval(this.width)},this.space));l.setVariable("u",m)};a.Segment3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h,e,v,r,u,y=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(y,a.Graphic3D);y.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();q=f.getVariable("x");p=f.getVariable("y");b=f.getVariable("z");
d=f.getVariable("u");g=f.getVariable("v");f.setVariable("u",0);f.setVariable("v",0);m=parseInt(f.eval(this.Nu));l=parseInt(f.eval(this.Nv));c=[];for(e=0;e<=m;e++)for(f.setVariable("u",e/m),v=0;v<=l;v++){f.setVariable("v",v/l);r=0;for(u=this.expresion.length;r<u;r++)f.eval(this.expresion[r]);c.push(this.transformVertex(new a.Vector4D(f.getVariable("x"),f.getVariable("y"),f.getVariable("z"),1)))}var n=this.color.getColor(),k=this.backcolor.getColor(),w=this.edges?this.edges.getColor():"";for(e=0;e<
m;e++)for(v=0;v<l;v++)h=[],h.push(c[v+e*l+e]),h.push(c[v+1+e*l+e]),h.push(c[v+2+(e+1)*l+e]),h.push(c[v+1+(e+1)*l+e]),this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:n,backColor:k,edges:w,model:this.model},this.space));f.setVariable("x",q);f.setVariable("y",p);f.setVariable("z",b);f.setVariable("u",d);f.setVariable("v",g)};a.Surface3D=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(c,a.Graphic3D);c.prototype.buildPrimitives=function(){m=this.evaluator;this.updateMVMatrix();l=m.eval(this.expresion);for(var c=this.color.getColor(),e=0,v=l.length-1;e<v;e++)f=l[e][0],d=l[e][1],g=l[e][2],q=l[e+1][0],p=l[e+1][1],b=l[e+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,
d,g,1)),this.transformVertex(new a.Vector4D(q,p,b,1))],type:"edge",frontColor:c,lineWidth:m.eval(this.width)},this.space))};a.Polygon3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.expresion=b.parseExpression();return b};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){m=this.evaluator;this.updateMVMatrix();q=m.getVariable("x");p=m.getVariable("y");b=m.getVariable("z");g=m.getVariable("u");m.setVariable("u",0);d=m.eval(this.Nu);f=[];for(var c=0;c<=d;c++){m.setVariable("u",c/d);for(var h=0,e=
this.expresion.length;h<e;h++)m.eval(this.expresion[h]);f.push(this.transformVertex(new a.Vector4D(m.getVariable("x"),m.getVariable("y"),m.getVariable("z"),1)))}c=0;for(h=f.length-1;c<h;c++)this.primitives.push(new a.Primitive3D({vertices:[f[c],f[c+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:m.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));m.setVariable("x",q);m.setVariable("y",b);m.setVariable("z",p);m.setVariable("u",g)};a.Curve3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h,e,v=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();e=h.eval(this.expresion);f=e[0][0];d=e[0][1];g=e[0][2];q=e[1][0];p=e[1][1];b=e[1][2];m=e[2][0];l=e[2][1];c=e[2][2];var r=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,d,g,1)),this.transformVertex(new a.Vector4D(m,
l,c,1)),this.transformVertex(new a.Vector4D(q,p,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:r,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q=function(g,b){return a.Graphic3D.call(this,g,b)||this};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){d=this.evaluator;this.updateMVMatrix();g=d.eval(this.expresion);f=[];for(var p=g.length-1;0<=p;p--)f.push(this.transformVertex(new a.Vector4D(g[p][0],g[p][1],g[p][2],1)));p=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:p,model:this.model},this.space))};a.Face3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("2");c.length=c.length||b.evaluator.parser.parse("2");return c};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();f=b.eval(this.Nu);d=[this.transformVertex(new a.Vector4D(0,0,0,1))];g=b.eval(this.width)/2;q=b.eval(this.length)/2;p=2*Math.PI/f;for(var l=0;l<f;l++)d.push(this.transformVertex(new a.Vector4D(g*
Math.cos(p*l),q*Math.sin(p*l),0,1)));var c=this.color.getColor(),h=this.backcolor.getColor(),e=this.edges?this.edges.getColor():"";for(l=0;l<f;l++)this.primitives.push(new a.Primitive3D({vertices:[d[0],l+2<=f?d[l+2]:d[1],d[l+1]],type:"face",frontColor:c,backColor:h,edges:e,model:this.model},this.space))};a.Polireg3D=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p=function(b,g){b=a.Graphic3D.call(this,b,g)||this;b.shadowColor=b.shadowColor?b.shadowColor.getColor():"transparent";return b};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){f=this.evaluator;d=f.eval(this.expresion);g=d[0][0];q=d[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(g,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=p;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-"),g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,p,b=0,m=function(l,c){var h=a.Graphic.call(this,l,c)||this;h.expresion=h.expresion||void 0;h.inirot=h.inirot||"(0,0,0)";h.inirotEuler=h.inirotEuler||!1;h.inipos=h.inipos||l.evaluator.parser.parse("(0,0,0)");h.endrot=
h.endrot||"(0,0,0)";h.endrotEuler=h.endrotEuler||!1;h.endpos=h.endpos||l.evaluator.parser.parse("(0,0,0)");h.name=h.name||"_descartes_empty_name_"+b++;Object.assign(h,c);h.inirot.match("Euler")&&(h.inirot=h.inirot.replace("Euler",""),h.inirotEuler=!0);h.endrot.match("Euler")&&(h.endrot=h.endrot.replace("Euler",""),h.endrotEuler=!0);h.inirot=h.evaluator.parser.parse(h.inirot);h.endrot=h.evaluator.parser.parse(h.endrot);h.inirotM=new a.Matrix4x4;h.inirotM_X=new a.Matrix4x4;h.inirotM_Y=new a.Matrix4x4;
h.inirotM_Z=new a.Matrix4x4;h.iniposM=new a.Matrix4x4;h.endrotM=new a.Matrix4x4;h.endrotM_X=new a.Matrix4x4;h.endrotM_Y=new a.Matrix4x4;h.endrotM_Z=new a.Matrix4x4;h.endposM=new a.Matrix4x4;h.graphics=[];l=l.lessonParser;var e=new a.Tokenizer;if(void 0==h.expresion)return h;"'"!==h.expresion.charAt(0)&&(h.expresion="'"+h.expresion+"'");h.expresion=h.evaluator.parser.parse(h.expresion);c=h.evaluator.eval(h.expresion);if(c)var m=(m=document.getElementById(c))&&"descartes/macro"==m.type?m.text:a.openExternalFile(c);
if(m){var r=a.convertHTMLEntities(m).replace(/\r/g,"").split("\n");m=[];c=0;for(var p=r.length;c<p;c++){var q=r[c].indexOf("=");if(-1!==q){q=l.split(r[c]);for(var n=0,k=q.length;n<k;n++)if(q[n]&&1<q.length&&("id"===f[q[n][0]]||"type"===f[q[n][0]])){m.push(q);break}}}c=0;for(p=m.length;c<p;c++){k=(n=m[c]||[],n[0])&&"id"===n[0][0];var w=!1;r=0;for(q=n.length;r<q;r++){var x=n[r][0].indexOf(".");-1===x||k?x=f[n[r][0]]:(x=f[n[r][0].substring(x+1)],n[r][0]=h.name+"."+n[r][0]);"type"===x&&"surface"===f[n[r][1]]&&
(w=!0);if(!("font"===x||"font_family"===x||("fill"===x||"color"===x||"backcolor"===x||"arrow"===x)&&"("!==n[r][1].charAt(0)||"file"===x&&n[r][1].match(g)||"id"!==x&&void 0!==f[n[r][1]]||w&&"expresion"===x)||"width"===x||"height"===x||"length"===x)if("text"==x)if(n[r][1].match(/\{\\rtf1/)){x=n[r][1];var z=h;var A=function(c,b){b=e.tokenize(b.replace(/&squot;/g,"'"));for(var k=0,h=b.length;k<h;k++)if("identifier"==b[k].type&&!a.reservedIds.match("-"+b[k].value+"-")||"R"===b[k].value||"G"===b[k].value||
"B"===b[k].value)b[k].value=z.name+"."+b[k].value;return(c.match(/^\\expr/)?"\\expr ":"\\decimals ")+e.flatTokens(b)};x=x.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,A);x=x.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,A);n[r][1]=x}else{A=l.parseText(n[r][1]).textElementsMacros;for(var G=0,J=A.length;G<J;G++){x=e.tokenize(A[G].replace(/&squot;/g,"'"));for(var E=0,F=x.length;E<F;E++)if("identifier"===x[E].type&&!a.reservedIds.match("-"+x[E].value+
"-")||"R"===x[E].value||"G"===x[E].value||"B"===x[E].value)x[E].value=h.name+"."+x[E].value;x=e.flatTokens(x).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");A[G]=x.substring(1,x.length-1)}n[r][1]=A.join("")}else{A=n[r][1].replace(/&squot;/g,"'").split(";");G=0;for(J=A.length;G<J;G++){x=e.tokenize(A[G].replace(/\\n/g,";"));E=0;for(F=x.length;E<F;E++)if("identifier"===x[E].type&&!a.reservedIds.match("-"+x[E].value+"-")||"R"===x[E].value||"G"===x[E].value||"B"===x[E].value)x[E].value=
h.name+"."+x[E].value;A[G]=e.flatTokens(x)}n[r][1]=A.join(";")}}}c=0;for(p=m.length;c<p;c++)if(m[c][0]){n="";k=!1;r=0;for(q=m[c].length;r<q;r++)"type"===f[m[c][r][0]]&&d.match("-"+f[m[c][r][1]]+"-")&&(k=!0),n=n+m[c][r][0]+"='"+m[c][r][1]+"' ";m[c]=n+(k?" space='"+h.spaceID+"'":"");k?h.graphics.push(l.parse3DGraphic(m[c],h.abs_coord,h.background,h.inirot)):l.parseAuxiliar(m[c])}}c=0;for(p=h.graphics.length;c<p;c++)h.graphics[c].macroChildren=!0;return h};$jscomp.inherits(m,a.Graphic);m.prototype.buildFamilyPrimitives=
function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var c=0,b=this.fSteps;c<=b;c++)evaluator.setVariable(this.family,this.familyInf+c*this.family_sep),this.familyValue=this.familyInf+c*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};m.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};
m.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var c=this.graphics.length;a<c;a++)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(c=this.graphics.length;a<c;a++){q=this.graphics[a];if(q.split||this.split)for(var b=a+1;b<c;b++)p=this.graphics[b],(p.split||this.split)&&q.splitFace(p);this.primitives=this.primitives.concat(q.primitives||[])}};m.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)};m.prototype.drawAux=function(a){};a.Macro3D=m;return a}(descartesJS||{},babel);
descartesJS=function(a){function f(a,c,b,k,e){d.call(this,a/n,a/n,a/n,k,e)}function d(a,c,b,e,h){a/=2;c/=2;b/=2;this.changeGeometry(a,c,b,e,h)||(this.vertices=[new k(a,b,c,1),new k(a,-b,c,1),new k(a,b,-c,1),new k(a,-b,-c,1),new k(-a,b,c,1),new k(-a,-b,c,1),new k(-a,b,-c,1),new k(-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,e,h))}function g(a,c,b,e,h){a/=2;if(!this.changeGeometry(a,c,b,e,h)){var g=2*Math.PI/3,d=2*a*Math.sqrt(2)/3,f=-a/
3,m=d*Math.cos(g)+0*Math.sin(g);g=-d*Math.sin(g)+0*Math.cos(g);this.vertices=[new k(0,0,a,1),new k(m,g,f,1),new k(m,-g,f,1),new k(d,0,f,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,c,b,e,h)}}function q(a,c,b,e,h){a/=2;this.changeGeometry(a,c,b,e,h)||(this.vertices=[new k(0,0,a,1),new k(a,0,0,1),new k(-a,0,0,1),new k(0,a,0,1),new k(0,-a,0,1),new k(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,e,h))}function p(c,
b,e,h,g){c/=Math.PI;if(!this.changeGeometry(c,b,e,h,g)){B=c/1.6180339887;L=1.6180339887*c;this.vertices=[new k(c,c,c,1),new k(c,c,-c,1),new k(c,-c,c,1),new k(c,-c,-c,1),new k(-c,c,c,1),new k(-c,c,-c,1),new k(-c,-c,c,1),new k(-c,-c,-c,1),new k(0,B,L,1),new k(0,B,-L,1),new k(0,-B,L,1),new k(0,-B,-L,1),new k(B,L,0,1),new k(B,-L,0,1),new k(-B,L,0,1),new k(-B,-L,0,1),new k(L,0,B,1),new k(L,0,-B,1),new k(-L,0,B,1),new k(-L,0,-B,1)];I=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(P=this.vertices.length;H<
P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(c,b,e,h,g)}}function b(c,b,e,h,g){c/=3.8;if(!this.changeGeometry(c,b,e,h,g)){L=1.6180339887*c;this.vertices=[new k(0,c,L,1),new k(0,c,-L,1),new k(0,-c,L,1),new k(0,-c,-L,1),new k(c,L,0,1),new k(c,-L,0,1),new k(-c,L,0,1),new k(-c,-L,0,1),
new k(L,0,c,1),new k(L,0,-c,1),new k(-L,0,c,1),new k(-L,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]];I=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);H=0;for(P=this.vertices.length;H<P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.updateValues(c,b,e,h,g)}}function m(a,c,b,e,h){a/=2;this.isSphere?b=c=a:(c/=2,b/=2);if(!this.changeGeometry(a,
c,b,e,h)){this.vertices=[new k(0,0,c,1)];for(H=1;H<e;H++)for(E=H*u/e,C=0;C<h;C++)J=C*y/h,z=a*v(E)*r(J),A=b*v(E)*v(J),G=c*r(E),this.vertices.push(new k(z,A,G,1));this.vertices.push(new k(0,0,-c,1));this.faces=[];for(H=0;H<h;H++)this.faces.push([0,(H+1)%h+1,H%h+1]);for(H=1;H<e-1;H++)for(C=0;C<h;C++)this.faces.push([C+1+(H-1)*h,(C+1)%h+1+(H-1)*h,(C+1)%h+1+H*h,C+1+H*h]);for(H=0;H<h;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-h+H,this.vertices.length-1-h+(H+1)%h]);this.updateValues(a,
c,b,e,h)}}function l(a,c,b,e,h){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,e,h)){this.vertices=[];for(H=0;H<h;H++)for(C=0;C<e;C++)z=a*(h-H)/h*r(C*y/e),A=b*(h-H)/h*v(C*y/e),G=c-2*H*c/h,this.vertices.push(new k(z,A,G,1));this.vertices.push(new k(0,0,-c,1));this.faces=[];for(H=0;H<h-1;H++)for(C=0;C<e;C++)this.faces.push([C+H*e,(C+1)%e+H*e,(C+1)%e+(H+1)*e,C+(H+1)*e]);for(H=0;H<e;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-e+H,this.vertices.length-1-e+(H+1)%e]);this.updateValues(a,
c,b,e,h)}}function c(a,c,b,e,h){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,e,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<e;C++)z=a*r(C*y/e),A=b*v(C*y/e),G=c-2*H*c/h,this.vertices.push(new k(z,A,G,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<e;C++)this.faces.push([C+H*e,(C+1)%e+H*e,(C+1)%e+(H+1)*e,C+(H+1)*e]);this.updateValues(a,c,b,e,h)}}function h(a,c,b,e,h){a/=2;c/=2;b/=2;F=w.eval(this.R);D=w.eval(this.r);if(!this.changeGeometry(a,c,b,e,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<e;C++)z=
-(F+D*v(y*C/e))*v(y*H/h),A=(F+D*v(y*C/e))*r(y*H/h),G=D*r(y*C/e),this.vertices.push(new k(z,A,G,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<e;C++)this.faces.push([C+H*e,C+(H+1)*e,(C+1)%e+(H+1)*e,(C+1)%e+H*e]);this.updateValues(a,c,b,e,h)}}function e(){this.vertices=[];this.faces=[];H=0;for(P=this.fileData.length;H<P;H++)M=this.fileData[H],M.match(/^V\(/)?(O=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new k(O[0]||0,O[1]||0,O[2]||0,1))):M.match(/^F\(/)&&(O=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var v=Math.sin,r=Math.cos,u=Math.PI,y=2*u,n=Math.sqrt(3),k,w,x,z,A,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K=function(r,n){n=a.Graphic3D.call(this,r,n)||this;n.width=n.width||r.evaluator.parser.parse("2");n.height=n.height||r.evaluator.parser.parse("2");n.length=n.length||r.evaluator.parser.parse("2");n.R=n.R||r.evaluator.parser.parse("2");n.r=n.r||r.evaluator.parser.parse("1");k=a.Vector4D;switch(n.subType){case "cube":n.buildGeometry=
f;break;case "box":n.buildGeometry=d;break;case "tetrahedron":n.buildGeometry=g;break;case "octahedron":n.buildGeometry=q;break;case "sphere":n.isSphere=!0;case "ellipsoid":n.buildGeometry=m;break;case "dodecahedron":n.buildGeometry=p;break;case "icosahedron":n.buildGeometry=b;break;case "cone":n.buildGeometry=l;break;case "cylinder":n.buildGeometry=c;break;case "torus":n.buildGeometry=h;break;case "mesh":n.fileData=a.openExternalFile(n.evaluator.eval(n.file)).split(/\r/),n.buildGeometry=e}return n};
$jscomp.inherits(K,a.Graphic3D);K.prototype.buildPrimitives=function(){w=this.evaluator;this.updateMVMatrix();this.buildGeometry(w.eval(this.width),w.eval(this.height),w.eval(this.length),w.eval(this.Nu),w.eval(this.Nv));var c=this.color.getColor(),b=this.backcolor.getColor(),e=this.edges?this.edges.getColor():"";H=0;for(P=this.faces.length;H<P;H++){x=[];C=0;for(N=this.faces[H].length;C<N;C++)x.push(this.transformVertex(this.vertices[this.faces[H][C]]));this.primitives.push(new a.Primitive3D({vertices:x,
type:"face",frontColor:c,backColor:b,edges:e,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,c,b,e,k){return this.oldWidth===a&&this.oldHeight===c&&this.oldLength===b&&this.oldNu===e&&this.oldNv===k};K.prototype.updateValues=function(a,c,b,e,k){this.oldWidth=a;this.oldHeight=c;this.oldLength=b;this.oldNv=k;this.oldNu=e};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,d=Math.min,g=Math.PI,q=Math.cos,p=Math.sin,b=Math.abs,m=Math.round,l,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F,D=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c};D.prototype.set=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c;return this};D.prototype.copy=function(){return new D(this.x,this.y)};D.prototype.ix=function(){return m(f(d(this.x,32E3),-32E3))};D.prototype.iy=function(){return m(f(d(this.y,32E3),-32E3))};D.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};D.prototype.norm2=function(){return this.x*this.x+this.y*this.y};D.prototype.norm=function(){return Math.sqrt(this.norm2())};D.prototype.distance=function(a){c=this.copy();c.sub(a);return c.norm()};D.prototype.dot=function(a){return this.x*a.x+this.y*a.y};D.prototype.det=function(a){return this.x*a.y-this.y*a.x};D.prototype.mul=function(a){this.x*=a;this.y*=a};D.prototype.div=function(a){this.x/=a;this.y/=a};D.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};D.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};D.prototype.normalize=function(){l=this.norm();0!=l&&this.div(l)};D.prototype.rotR90=function(){l=this.x;this.x=this.y;this.y=-l};D.prototype.rotL90=function(){l=this.x;this.x=-this.y;this.y=l};D.prototype.rot=function(a){h=this.copy();r=q(a);u=p(a);this.x=h.x*r-h.y*u;this.y=h.x*u+h.y*r};D.prototype.rot2=function(a){this.rot(a*g/180)};D.prototype.intersection=function(a,c,h,g){y=c.x-a.x;n=h.x-g.x;k=h.x-a.x;w=c.y-a.y;x=h.y-g.y;z=h.y-a.y;F=y*
x-n*w;return 1E-6<b(F)?(e=(k*x-z*n)/F,v=(-k*w+z*y)/F,0<=e&&1>=e&&0<=v&&1>=v?new D(a.x+y*e,a.y+w*e):null):(c.x-h.x)*z!=(c.y-h.y)*k?null:a.x!=c.x?(A=d(a.x,c.x),G=f(a.x,c.x),A<=h.x&&h.x<=G?h:A<=g.x&&g.x<=G?g:null):h.x!=g.x?(J=d(h.x,g.x),E=f(h.x,g.x),J<=a.x&&a.x<=E?a:J<=c.x&&c.x<=E?c:null):a.y!=c.y?(A=d(a.y,c.y),G=f(a.y,c.y),A<=h.y&&h.y<=G?h:A<=g.y&&g.y<=G?g:null):h.y!=g.y?(J=d(h.y,g.y),E=f(h.y,g.y),J<=a.y&&a.y<=E?a:J<=c.y&&c.y<=E?c:null):a.x==h.x&&a.y==h.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h=function(e,h){this.evaluator=e;this.constraint=h;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];b=
new a.R2(0,0);p=new a.R2(0,0);c=new a.R2(0,0)};h.prototype.getUnitNormal=function(){this.normal.normalize();return c.set(this.normal.x,this.normal.y)};h.prototype.gradient=function(a){f=this.evaluator;b.x=0;b.y=0;m=f.getVariable("x");l=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",m);f.setVariable("y",l);return b};h.prototype.findZero=function(a,c,b){f=this.evaluator;p.x=a.x;p.y=a.y;m=f.getVariable("x");l=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 p;f.setVariable("x",m);f.setVariable("y",l);for(var e=0;16>e;e++)if(g=p.x,q=p.y,this.normal=
this.gradient(p),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),p.x=g+this.normal.x,p.y=q+this.normal.y,this.normal.norm()<c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=p.x-a.x,this.normal.y=p.y-a.y),p;return b?p:null};a.R2Newton=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(a,g){this.x=a;this.y=g};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,g,q,p,b,m,l,c,h,e,v,r,u,y,n=function(c,b){this.parent=c;this.evaluator=c.evaluator;var e=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;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==b.type&&"Audio"!==b.type&&"Video"!==b.type?"TextArea"!==b.type?this.expresion=e.parse("(0,0,100,23)"):
(this.expresion=e.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=e.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("Scrollbar"==b.gui?"e0e4e8":"222222");this.colorInt="cc0022";"Scrollbar"==b.gui?this.colorInt="182C61":"GraphicControl"!==b.type&&(this.colorInt="f0f8ff");this.colorInt=new a.Color(this.colorInt);this.font_size=e.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=
this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=e.parse("1");this.activeif=e.parse("1");this.valueExpr=e.parse("0");this.decimals=e.parse("2");this.min=e.parse("-Infinity");this.max=e.parse("Infinity");this.incr=e.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)};n.prototype.init=function(){};n.prototype.update=function(){};n.prototype.draw=function(){};n.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var c=0,b=a.length;c<b;c++){var e=a[c];if(e.id===this.spaceID)return e.addCtr(this),
this.zIndex=e.zIndex,this.space=e,e.numericalControlContainer}else{if("external"===this.region)return this.parent.externalSpace.addCtr(this),this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numericalControlContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+
"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);this.zIndex=a[0].zIndex;return a[0].numericalControlContainer};n.prototype.addControlContainer=function(a){var c=this.getContainer();c.childNodes[0]?c.insertBefore(a,c.childNodes[0]):c.appendChild(a)};n.prototype.updatePositionAndSize=function(){p=b=m=l=!1;c=this.evaluator.eval(this.expresion);h=d(c[0][0]);p=d(this.x)!==h;this.x=h;h=d(c[0][1]);b=d(this.y)!==h;this.y=h;4===c[0].length&&(h=d(c[0][2]),m=d(this.w)!==
h,this.w=h,h=d(c[0][3]),l=d(this.h)!==h,this.h=h);if(m||l||p||b)this.init(!0,!0),this.draw()};n.prototype.formatOutputValue=function(a){y=this.parent;e=a+"";v=this.evaluator.eval(this.decimals);r=e.indexOf(".");-1!=r&&(u=e.substring(r+1),u.length>v&&(e=parseFloat(e).toFixed(v)));this.fixed&&(2!==y.version||2===y.version&&!this.exponentialif)&&(e=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(e)&&(e=this.fixed&&2!==y.version?parseFloat(e).toExponential(v):parseFloat(e).toExponential(),
e=e.toUpperCase().replace("+",""));return e.replace(".",y.decimal_symbol)};n.prototype.updateAndExecAction=function(){this.parent.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()};n.prototype.createGradient=function(a,c){this.linearGradient=this.ctx.createLinearGradient(0,0,0,c);g=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/g/255+")")};a.Control=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=Math.abs,g=/[\w\.\-//]*(\.gif)/gi,q,p,b,m,l,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q=function(c,b){var e=a.Control.call(this,c,b)||this;e.imageSrc=b.imageSrc||"";e.image=b.image||new Image;e.imageOver=b.imageOver||new Image;e.imageDown=b.imageDown||new Image;e.flat=b.flat||!1;e.borderColor=b.borderColor||!1;e.text_align=b.text_align||"center_center";e.image_align=b.image_align||"center_center";e.font_family=a.getFontName(b.font_family||
"arial");e.ratio=c.ratio;-1===e.font_size&&(e.fontSizeNotSet=!0);e.borderColor&&(e.borderColor=new a.Color(e.borderColor));e.text_align=e.text_align.split("_");e.image_align=e.image_align.split("_");e.old_name=e.name;e.name.match(/^\[.*\]?/)?e.name=e.parser.parse(e.name.substring(1,e.name.length-1)):e.name=e.parser.parse("'"+e.name+"'");e.classContainer=e.cssClass?" "+e.cssClass+" ":"";e.extra_style=e.imageSrc.trim().match("^_STYLE_")?e.imageSrc.trim().substring(8):e.extra_style||"";e.imageSrc.trim().match("^_STYLE_")&&
(e.imageSrc="vacio.gif");if(e.extra_style){e.customStyle=!0;e.btnStyle=[];e.conStyle=[];e.conStyle.textBorder=3;c=e.extra_style.split("|");for(var k,h=0,g=c.length;h<g;h++)b=c[h],k=b.match(/rgb/g),b.match("class=")?e.classContainer=" "+b.substring(6):b.match("border=")?(e.btnStyle.push({type:"border-style",value:"solid"}),e.btnStyle.push({type:"border-width",value:b.substring(7).trim()+"px"})):b.match("borderRadius=")?(e.btnStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"}),e.conStyle.push({type:"border-radius",
value:b.substring(13).trim()+"px"})):b.match("borderColor=")?e.btnStyle.push({type:"border-color",value:(k?"":"#")+b.substring(12).trim()}):b.match("overColor=")?e.conStyle.overColor=(k?"":"#")+b.substring(10).trim():b.match("downColor=")?e.conStyle.downColor=(k?"":"#")+b.substring(10).trim():b.match("font=")?e.conStyle.font=b.substring(5).trim().toLowerCase():b.match("inactiveColor=")?e.conStyle.inactiveColor=(k?"":"#")+b.substring(14).trim():b.match("inactiveColorBorder=")?e.conStyle.inactiveColorBorder=
(k?"":"#")+b.substring(20).trim():b.match("shadowTextBlur=")?e.conStyle.shadowTextBlur=parseFloat(b.substring(15).trim()):b.match("shadowTextOffsetX=")?e.conStyle.shadowTextOffsetX=parseFloat(b.substring(18).trim()):b.match("shadowTextOffsetY=")?e.conStyle.shadowTextOffsetY=parseFloat(b.substring(18).trim()):b.match("shadowTextColor=")?e.conStyle.shadowTextColor=(k?"":"#")+b.substring(16).trim():b.match("shadowBoxBlur=")?e.conStyle.shadowBoxBlur=parseFloat(b.substring(14).trim()):b.match("shadowBoxOffsetX=")?
e.conStyle.shadowBoxOffsetX=parseFloat(b.substring(17).trim()):b.match("shadowBoxOffsetY=")?e.conStyle.shadowBoxOffsetY=parseFloat(b.substring(17).trim()):b.match("shadowBoxColor=")?e.conStyle.shadowBoxColor=(k?"":"#")+b.substring(15).trim():b.match("shadowInsetBoxBlur=")?e.conStyle.shadowInsetBoxBlur=parseFloat(b.substring(19).trim()):b.match("shadowInsetBoxOffsetX=")?e.conStyle.shadowInsetBoxOffsetX=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxOffsetY=")?e.conStyle.shadowInsetBoxOffsetY=
parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxColor=")?e.conStyle.shadowInsetBoxColor=(k?"":"#")+b.substring(20).trim():b.match("textBorder=")?e.conStyle.textBorder=parseFloat(b.substring(11).trim()):b.match("flat=")&&(e.flat=1==parseInt(b.substring(5).trim()))}e.imageSrc.match("_COLORES_")&&(c=e.imageSrc.split("_"),e.colorInt=new a.Color(c[2]),e.color=new a.Color(c[3]),e.font_size=e.parser.parse(c[5]),e.imageSrc="");e.imageSrc.match(/^\[.*\]?/)?e.imageSrc=e.parser.parse(e.imageSrc.substring(1,
e.imageSrc.length-1)):e.imageSrc=e.parser.parse("'"+e.imageSrc+"'");c=e.evaluator.eval(e.imageSrc).toString().trim();if(""!=c)if(b=c.substr(0,c.lastIndexOf(".")),k=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))e.imageSrc=e.parser.parse("'vacio.gif'"),e.image.ready=1,3===e.parent.version&&(e.name=e.parser.parse("")),e.emptyImage={ready:!0},e.parser.parse("'vacio.gif'");else if(e.image=e.parent.getImage(c),b)try{e.imageOver=e.parent.getImage(b+"_over"+k),e.imageDown=e.parent.getImage(b+"_down"+
k)}catch(Z){}e.container=a.newHTML("div",{class:"DescartesButtonContainer"+e.classContainer,id:e.id,style:"width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+";"});e.btn=a.newHTML("canvas",{width:e.w*e.ratio,height:e.h*e.ratio,style:"position:absolute;left:0;top:0;width:"+e.w+"px;height:"+e.h+"px;"});e.ctx=e.btn.getContext("2d");e.ctx.imageSmoothingEnabled=!1;e.tooltip&&(e.btn.title=e.tooltip);e.container.appendChild(e.btn);e.addControlContainer(e.container);e.addEvents();
e.init();return e};$jscomp.inherits(Q,a.Control);Q.prototype.init=function(c){q=this.evaluator;z=this.container;p=this.btn;b=this.ctx;m=q.eval(this.expresion);this.x=m[0][0];this.y=m[0][1];4==m[0].length&&(this.w=parseInt(m[0][2]),this.h=parseInt(m[0][3]));p.width=this.w*this.ratio;p.height=this.h*this.ratio;p.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+this.h+"px;box-sizing:border-box;");z.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+
"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var e=0,k=this.btnStyle.length;e<k;e++)p.style[this.btnStyle[e].type]=this.btnStyle[e].value;if(this.conStyle){e=0;for(k=this.conStyle.length;e<k;e++)z.style[this.conStyle[e].type]=this.conStyle[e].value;if(this.conStyle.shadowBoxColor){e=this.conStyle.shadowBoxOffsetX||0;k=this.conStyle.shadowBoxOffsetY||2;var h=this.conStyle.shadowBoxBlur||2;z.style.boxShadow=e+"px "+k+"px "+h+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&
(e=this.conStyle.shadowInsetBoxOffsetX||0,k=this.conStyle.shadowInsetBoxOffsetY||-2,h=this.conStyle.shadowInsetBoxBlur||1,p.style.boxShadow=e+"px "+k+"px "+h+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.fontSizeNotSet&&(this.font_size=q.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=q.eval(this.font_size);this.createGradient(this.w,this.h);z.style.display=0<q.eval(this.drawif)?"block":"none";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+
this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&
this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(c)};Q.prototype.update=function(){q=this.evaluator;z=this.container;p=this.btn;this.activeIfValue=0<q.eval(this.activeif);this.drawIfValue=0<q.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?
(z.style.display="block",this.draw(),z.style.cursor=p.style.cursor=this.activeIfValue?"pointer":"not-allowed",z.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(z.style.display="none",this.buttonClick=!1)};Q.prototype.draw=function(d){z=this.container;q=this.evaluator;p=this.btn;b=this.ctx;c=q.eval(this.name);this.text_object.draw(a.ctx,"#000000",0,0);c=this.text_object.textNodes.toStr();h=this.evaluator.eval(this.imageSrc).toString().trim();if(!d&&(A=this.over===this.oldOver,
G=this.buttonClick===this.oldButtonClick,J=this.activeIfValue===this.oldActiveIfValue,E=this.drawIfValue===this.oldDrawIfValue,F=c===this.oldName,D=h===this.oldImageSrc,B=this.colorInt.getColor()===this.oldBackColor,L=this.color.getColor()===this.oldTextColor,I=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=c,this.oldImageSrc=h,this.oldBackColor=this.colorInt.getColor(),
this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,A&&G&&J&&E&&F&&D&&B&&L&&I))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);l=this.fs_evaluated;z.setAttribute("data-name",c);h?(e="vacio.gif"===h?this.emptyImage:this.parent.getImage(h),M=h.substr(0,h.lastIndexOf(".")),O=h.substr(h.lastIndexOf(".")),H=M+"_over"+O,P=M+"_down"+O,C="vacio.gif"===h?this.emptyImage:this.parent.getImage(H),N="vacio.gif"===h?this.emptyImage:this.parent.getImage(P)):N=C=e=this.emptyImage;
b.clearRect(0,0,this.w,this.h);v=r=0;this.buttonClick&&(v=r=1);this.text_object.draw(b,this.color.getColor(),0,0,!0);u=this.text_object.textNodes.metrics.w;y=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?w=f(this.w/2+v)-.5:"left"==this.text_align[1]?w=u/2+5+v:"right"==this.text_align[1]&&(w=this.w-u/2+v-5);"center"==this.text_align[0]?x=f(this.h/2+r)-.5:"top"==this.text_align[0]?x=y/2+r+4:"bottom"==this.text_align[0]&&(x=this.h-y/2+r-3);e&&("center"==this.image_align[1]?n=parseInt((this.w-
e.width)/2)+v:"left"==this.image_align[1]?n=v:"right"==this.image_align[1]&&(n=this.w-e.width+v),"center"==this.image_align[0]?k=parseInt((this.h-e.height)/2)+r:"top"==this.image_align[0]?k=r:"bottom"==this.image_align[0]&&(k=this.h-e.height+r));if(e&&e.ready)if(e!==this.emptyImage&&e.complete)if(h.match(g))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+h+"')",this.btn.style.backgroundPosition=n+"px "+k+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])K=
this.colorInt.getColor(),!K||"CanvasGradient"!==K.constructor.name&&"CanvasPattern"!==K.constructor.name?z.style.backgroundColor=K:(b.fillStyle=K,b.fillRect(0,0,this.w,this.h));b.drawImage(e,n,k)}else this.emptyImage&&this.customStyle&&(K=this.colorInt.getColor(),!K||"CanvasGradient"!==K.constructor.name&&"CanvasPattern"!==K.constructor.name?z.style.backgroundColor=K:(b.fillStyle=K,b.fillRect(0,0,this.w,this.h)));else K=this.colorInt.getColor(),!K||"CanvasGradient"!==K.constructor.name&&"CanvasPattern"!==
K.constructor.name?(z.style.backgroundColor=K,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))):(b.fillStyle=K,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(C!==this.emptyImage&&this.over&&C.ready&&C.complete?H.match(g)?(this.btn.style.backgroundImage="url('"+H+"')",this.btn.style.backgroundPosition=
n+"px "+k+"px"):b.drawImage(C,n,k):this.customStyle&&this.conStyle.overColor&&this.over&&(z.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?N!==this.emptyImage&&this.buttonClick&&N.ready&&N.complete?P.match(g)?(this.btn.style.backgroundImage="url('"+P+"')",this.btn.style.backgroundPosition=n+"px "+k+"px"):b.drawImage(N,n,k):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(z.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!e&&(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);this.borderColor&&(b.lineWidth=parseInt(l/6),b.strokeStyle=this.borderColor.getColor());this.text_object.draw(b,this.color.getColor(),w,x);this.underlined&&(b.strokeStyle=this.color.getColor(),b.lineWidth=f(l/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(w-u/2+v,x+f(l/2)+f(l/
5)-1.5),b.lineTo(w+u/2+v,x+f(l/2)+f(l/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?z.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=n;this._image_pos_y=k};Q.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)};Q.prototype.buttonPressed=
function(){this.updateAndExecAction()};Q.prototype.addEvents=function(){function c(b,e,g){a.clearTimeout(h);k.buttonClick&&k.drawIfValue&&k.activeIfValue&&(e.call(k),b=g?b:100,h=a.setTimeout(function(){c(b,e,!1)},b))}function b(b){this.focus();b.preventDefault();b.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();k.whichBtn=a.whichBtn(b);"L"==k.whichBtn&&k.activeIfValue&&(k.buttonClick=!0,k.draw(),"calculate"==k.action&&(k.evaluator.setVariable(k.id,k.evaluator.eval(k.valueExpr)),
c(1E3,k.buttonPressed,!0)),k.btn.removeEventListener("touchend",e),k.btn.addEventListener("touchend",e),k.btn.removeEventListener("mouseup",e),k.btn.addEventListener("mouseup",e))}function e(c){a.newBlobContent=null;this.focus();c.preventDefault();c.stopPropagation();if(k.activeIfValue||k.buttonClick)k.buttonClick=!1,k.draw(),"calculate"!=k.action&&(k.evaluator.setVariable(k.id,k.evaluator.eval(k.valueExpr)),k.buttonPressed()),k.btn.removeEventListener("touchend",e),k.btn.removeEventListener("mouseup",
e);k.parent.update()}var k=this,h;k.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();k.over=!0;k.draw()});this.btn.addEventListener("mouseout",function(c){a.newBlobContent=null;c.preventDefault();c.stopPropagation();k.over=!1;k.buttonClick=!1;k.draw()});document.addEventListener("visibilitychange",function(c){a.newBlobContent=
null;k.buttonClick=!1})};a.Button=Q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h,e,v,r,u,y=function(c,b){b=a.Control.call(this,c,b)||this;b.flat=b.image_dec_src&&b.image_inc_src;b.btn_pos=b.btn_pos||"v_left";b.horizontal="h_left"===b.btn_pos||"h_right"===b.btn_pos||"h_left_right"===b.btn_pos;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.tabindex=++b.parent.tabindex;b.name_str=b.name;b.initial_value=0;try{b.initial_value=
b.evaluator.eval(b.parser.parse(b.valueExprString))}catch(w){console.log(w)}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.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("canvas",{class:"DescartesSpinnerLabel"});
b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.container.appendChild(b.label);b.container.appendChild(b.field);b.container.appendChild(b.divUp);b.container.appendChild(b.divDown);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.visible&&b.container.appendChild(b.cover);b.addControlContainer(b.container);e=b.evaluator.parser.parse("1");b.originalIncr=b.incr;if(0>b.evaluator.eval(b.decimals)||0===b.evaluator.eval(b.incr))c=b.evaluator.eval(b.incr),0<c?(b.incr=b.evaluator.parser.parse(parseInt(c).toString()),
b.originalIncr=b.incr):b.incr=e;b.image_dec_src&&(b.image_dec_src.match(/^\[.*\]?/)?b.image_dec_src=b.parser.parse(b.image_dec_src.substring(1,b.image_dec_src.length-1)):b.image_dec_src=b.parser.parse("'"+b.image_dec_src+"'"),b.old_image_dec_src=b.evaluator.eval(b.image_dec_src).toString().trim(),b.image_dec=b.parent.getImage(b.old_image_dec_src));b.image_inc_src&&(b.image_inc_src.match(/^\[.*\]?/)?b.image_inc_src=b.parser.parse(b.image_inc_src.substring(1,b.image_inc_src.length-1)):b.image_inc_src=
b.parser.parse("'"+b.image_inc_src+"'"),b.old_image_inc_src=b.evaluator.eval(b.image_inc_src).toString().trim(),b.image_inc=b.parent.getImage(b.old_image_inc_src));b.addEvents();b.init();return b};$jscomp.inherits(y,a.Control);y.prototype.init=function(c,b){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();var e=this.label.textContent;b||(this.value=this.validateValue(f.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var h=2!==this.parent.version?"__":"_____",k=a.getTextWidth(b+
"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){c=parseInt(this.h);var g=parseInt(this.w/2-c);h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(g=this.w-2*c,k=0);g<h&&(g=h);""==e&&(g=0);this.w-g-c<k&&(g=this.w-c-k);0>g&&(g=0);e=this.w-(g+2*c);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;");this.divUp.setAttribute("style","width:"+
c+"px;height:"+c+"px;"+("h_left"===this.btn_pos?"left:"+(g+c):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+c+"px;height:"+c+"px;left:"+(g+("h_right"===this.btn_pos?e:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;left:"+(c+g+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;");
this.cover.setAttribute("style","width:"+e+"px;height:"+this.h+"px;left:"+(c+g+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;")}else c=2+parseInt(this.h/2),g=parseInt(this.w/2-c/2),h=a.getTextWidth(e+h,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(g=this.w-c,k=0),g<h&&(g=h),""==e&&(g=0),this.w-g-c<k&&(g=this.w-c-k),0>g&&(g=0),e=this.w-(g+c),this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+
this.zIndex+";background-color:transparent;"),h="width:"+c+"px;left:"+(g+("v_right"===this.btn_pos?e:0))+"px;",this.divUp.setAttribute("style",h+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",h+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;"+(this.flat?"border-width:0;":"")),this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?
c:0)+g)+"px;"),this.cover.setAttribute("style","width:"+e+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?c:0)+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;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=g*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&
this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);f.setVariable(this.id,this.value)};y.prototype.update=function(){f=this.evaluator;0>f.eval(this.decimals)?(d=f.eval(this.incr),0<d?this.originalIncr=this.incr=f.parser.parse(parseInt(d).toString()):
this.incr=e):this.incr=0!==f.eval(this.originalIncr)?this.originalIncr:e;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.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==v&&(this.divDown.style["background-image"]="url("+v+")",this.old_image_dec_src=v));this.image_inc&&(r=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==r&&(this.divUp.style["background-image"]="url("+r+")",this.image_inc_src=r));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(g=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!=g&&(this.value=this.validateValue(g),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(u=this.label_color.getColor())||"CanvasGradient"!==u.constructor.name&&"CanvasPattern"!==u.constructor.name||(this.label_ctx.fillStyle=u,this.label_ctx.fillRect(0,
0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};y.prototype.updateStyle=
function(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=
this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"};y.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,".");p=a==parseFloat(a)?parseFloat(a):parseFloat(f.eval(f.parser.parse(a)));isNaN(p)&&(p=0);
l=f.eval(this.min);c=f.eval(this.max);""===l&&(l=-Infinity);""===c&&(c=Infinity);p=Math.min(Math.max(p,l),c);this.discrete&&(b=f.eval(this.incr),p=0==b?0:this.initial_value+b*Math.round((p-this.initial_value)/b));m=f.eval(this.decimals);0>=m&&(m=0);return p=parseFloat(parseFloat(p).toFixed(m))};y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};
y.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())};y.prototype.addEvents=function(){function c(b,e,h){a.clearTimeout(l);if(f.up||f.down)e.call(f),b=h?b:10,l=a.setTimeout(function(){c(b,e)},b)}function b(b){b.preventDefault();f.whichBtn=a.whichBtn(b);"L"==f.whichBtn&&f.activeIfValue&&(f.up=!0,c(m,f.increase,!0))}function e(b){b.preventDefault();
f.whichBtn=a.whichBtn(b);"L"==f.whichBtn&&f.activeIfValue&&(f.down=!0,c(m,f.decrease,!0))}function g(c){f.up=!1;a.clearTimeout(l);f.updateStyle()}function d(c){f.down=!1;a.clearTimeout(l);f.updateStyle()}h=a.hasTouchSupport;var f=this,m=h?500:200,l;f.divUp.oncontextmenu=f.divDown.oncontextmenu=f.field.oncontextmenu=f.label.oncontextmenu=f.cover.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",e);this.divDown.addEventListener("mousedown",e);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",
g);window.addEventListener("touchend",g);this.divUp.addEventListener("mouseup",g);window.addEventListener("mouseup",g);this.divDown.addEventListener("touchend",d);window.addEventListener("touchend",d);this.divDown.addEventListener("mouseup",d);window.addEventListener("mouseup",d);document.addEventListener("visibilitychange",function(c){f.up=!1;f.down=!1;a.clearTimeout(l);f.updateStyle()});this.field.addEventListener("blur",function(a){f.drawIfValue&&f.changeValue(f.field.value,!0)});f.field.addEventListener("click",
function(a){this.focus()});f.cover.addEventListener("click",function(a){a=f.evaluator.eval(f.kbexp);f.activeIfValue&&f.parent.keyboard.show(f,f.kblayout,a[0][0]||0,a[0][1]||0,f.id,f.field,f.onlyText)})};a.Spinner=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g=function(g,d){var b=a.Control.call(this,g,d)||this;b.label_color=b.label_color||new a.Color("e0e4e8",g.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",g.evaluator);b.typeCtr="checkbox";b.pressed=d.pressed||!1;b.radio_group=(d.radio_group||"").trim();""!==b.radio_group&&(b.typeCtr="radio");b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+
"'");b.tabindex=++b.parent.tabindex;b.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:b.id});b.checkbox=a.newHTML("input",{type:b.typeCtr,id:b.id+b.typeCtr,class:"DescartesCheckbox",tabindex:b.tabindex});""!==b.radio_group&&b.checkbox.setAttribute("name",b.radio_group);b.checkbox.internalID=b.id;b.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=g.ratio;b.dummyLabel=a.newHTML("label",{"for":b.id+b.typeCtr});b.value=b.evaluator.eval(b.valueExpr);
b.evaluator.setVariable(b.id,b.value);b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.checkbox);b.containerControl.appendChild(b.dummyLabel);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(g,a.Control);g.prototype.init=function(g){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();this.labelFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):a.getFieldFontSize(this.h);g=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");"right"==this.position?(this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+g+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+g+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";")):(this.dummyLabel.setAttribute("style",
"position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";left:"+this.h+"px"));this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.width=g*this.ratio;this.label.height=
this.h*this.ratio;this.update()};g.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==f.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),f.setVariable(this.id,this.value);else{this.value=f.getVariable(this.id);f.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var g=-1;if(this.pressed){for(var b=a.length-1;0<=b;b--)f.setVariable(a[b].internalID,0),a[b].checked=!1;f.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;f.setVariable(this.radio_group,this.id);this.pressed=0}else{for(b=a.length-1;0<=b;b--)g=0!=f.getVariable(a[b].internalID)?b:g,f.setVariable(a[b].internalID,
0),a[b].checked=!1;0<=g&&(f.setVariable(a[g].internalID,1),a[g].checked=!0,f.setVariable(this.radio_group,a[g].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(d=this.label_color.getColor())||"CanvasGradient"!==d.constructor.name&&"CanvasPattern"!==d.constructor.name||
(this.label_ctx.fillStyle=d,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,
0,0,1,0,0)};g.prototype.addEvents=function(){var g=this;g.checkbox.oncontextmenu=g.label.oncontextmenu=g.dummyLabel.oncontextmenu=function(){return!1};g.label.addEventListener("touchstart",a.preventDefault);g.label.addEventListener("mousedown",a.preventDefault);g.dummyLabel.addEventListener("mousedown",a.preventDefault);g.checkbox.addEventListener("click",function(a){g.pressed=!0;g.updateAndExecAction()})};a.Checkbox=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l=function(c,b){b=a.Control.call(this,c,b)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+"'");void 0===b.valueExprString&&(b.valueExprString=b.onlyText?"0":"");b.emptyString=!1;b.ok=0;b.tabindex=++b.parent.tabindex;
b.regExpDecimalSymbol=new RegExp("\\"+b.parent.decimal_symbol,"g");if(b.answer)if(b.answer.match("krypto_")&&(b.answer=(new a.Krypto).decode(b.answer.substring(7))),b.answerPattern=b.answer,b.answer=a.buildRegularExpressionsPatterns(b.answer,b.evaluator),b.onlyText){var e=b.answerPattern.indexOf("|");b.firstAnswer=-1==e?b.answerPattern:b.answerPattern.substring(0,e)}else b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(",")));b.onlyText&&(b.valueExprString.match(/^'/)&&
b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:b.id});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.containerControl.appendChild(b.cover);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(l,a.Control);l.prototype.init=function(c){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();var b=this.label.textContent;c||
(this.value=this.validateValue(f.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},
this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var e=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),g=parseInt(this.w/2),d=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(g=this.w,e=0);g<d&&(g=d);""==b&&(g=0);this.w-g<e&&(g=this.w-e);0>g&&(g=0);b=this.w-g;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.field.setAttribute("style",
"font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+g+"px;");this.field.value=c;this.cover.setAttribute("style",";width:"+b+"px;height:"+this.h+"px;left:"+g+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=g*this.ratio;this.label.height=this.h*this.ratio;this.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.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,g=this.value,this.value=
this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===g&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(m=this.label_color.getColor())||
"CanvasGradient"!==m.constructor.name&&"CanvasPattern"!==m.constructor.name||(this.label_ctx.fillStyle=m,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};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);p=f.eval(this.min);b=f.eval(this.max);""===p&&(p=-Infinity);""===b&&(b=Infinity);q<p&&(q=p);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(c){return""===c?"":a.Control.prototype.formatOutputValue.call(this,c)};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 c=this;c.field.oncontextmenu=c.label.oncontextmenu=c.cover.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){c.drawIfValue&&
c.changeValue(c.field.value,!0)});this.field.addEventListener("keydown",function(a){c.activeIfValue&&13==a.keyCode&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(a){this.focus()});c.cover.addEventListener("click",function(a){a=c.evaluator.eval(c.kbexp);c.activeIfValue&&c.parent.keyboard.show(c,c.kblayout,a[0][0]||0,a[0][1]||0,c.id,c.field,c.onlyText)})};a.TextField=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.abs,d,g,q,p,b,m,l,c,h,e,v,r=function(c,b){function e(c){h.options=c.split(",");h.menuOptions=[];h.strValue=[];c=0;for(var b=h.options.length;c<b;c++){var e=h.customSplit(h.options[c]);1==e.length?(h.menuOptions.push(e[0]),h.strValue.push(c.toString())):2==e.length&&(h.menuOptions.push(e[0]),""==e[1]?h.strValue.push(c.toString()):h.strValue.push(e[1]))}c=0;for(b=h.menuOptions.length;c<b;c++)h.menuOptions[c].match(/^\[/)&&h.menuOptions[c].match(/\]$/)?
h.menuOptions[c]=d.parse(h.menuOptions[c].substring(1,h.menuOptions[c].length-1)):h.menuOptions[c]=d.parse("'"+h.menuOptions[c]+"'");c=0;for(b=h.strValue.length;c<b;c++)h.strValue[c].match(/^\[/)&&h.strValue[c].match(/\]$/)?h.strValue[c]=d.parse(h.strValue[c].substring(1,h.strValue[c].length-1)):h.strValue[c]=d.parse(h.strValue[c]);h.select.innerHTML="";c=0;for(b=h.menuOptions.length;c<b;c++)e=a.newHTML("option"),e.innerHTML=g.eval(h.menuOptions[c]),h.select.appendChild(e);return 0}var k=a.Control.call(this,
c,b)||this;k.label_color=k.label_color||new a.Color("e0e4e8",c.evaluator);k.label_text_color=k.label_text_color||new a.Color("000000",c.evaluator);k.options=b.options||"";d=k.parser;g=k.evaluator;k.ok=0;k.tabindex=++k.parent.tabindex;k.answer&&(k.answer.match("krypto_")&&(k.answer=(new a.Krypto).decode(k.answer.substring(7))),k.answer=parseInt(k.answer.split(",")[0].replace("[",""))||0);k.name_str=k.name;k.name.match(/^\[.*\]?/)?k.name=k.parser.parse(k.name.substring(1,k.name.length-1)):k.name=k.parser.parse("'"+
k.name+"'");var h=k;k.evaluator.setFunction(k.id+".setOptions",e);k.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:k.id});k.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});k.label_ctx=k.label.getContext("2d");k.ratio=c.ratio;k.select=a.newHTML("select",{id:k.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:k.tabindex});k.field=a.newHTML("input",{type:"text",id:k.id+"_menuField",class:"DescartesMenuField",tabindex:k.tabindex});e(k.options);k.containerControl.appendChild(k.label);
k.containerControl.appendChild(k.select);k.visible&&k.containerControl.appendChild(k.field);k.cover=a.newHTML("div",{class:"TextfieldCover"});k.keyboard&&k.visible&&k.containerControl.appendChild(k.cover);k.addControlContainer(k.containerControl);k.addEvents();k.init();return k};$jscomp.inherits(r,a.Control);r.prototype.init=function(c){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var b=this.label.textContent;this.fieldFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var e=0,h=0;this.value=c?this.value:g.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var d=0,f=this.menuOptions.length;d<f;d++)c=a.getTextWidth(g.eval(this.menuOptions[d]).toString(),this.fieldFontSize+"px "+a.sansserif_font),c>e&&(e=c,h=d);e+=25;c=a.getTextWidth(this.formatOutputValue(g.eval(this.strValue[h])),this.fieldFontSize+"px "+a.sansserif_font)+7;h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==b&&(h=0);this.visible||(c=0);for(b=this.w-c-h;b<e&&0<h;)h--,b++;for(;b<e&&0<c;)c--,b++;for(;h+b+c+1<this.w;)b++,
c++;e=h;d=e+b;c=this.w-d;f=this.formatOutputValue(g.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+h+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=h*this.ratio;this.label.height=
this.h*this.ratio;this.field.value=f;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+d+"px;");this.cover.setAttribute("style","width:"+c+"px;height:"+this.h+"px;left:"+d+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+e+"px;");this.select.selectedIndex=this.indexValue;g.setVariable(this.id,parseFloat(f.replace(this.parent.decimal_symbol,".")));this.update()};
r.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,c=this.menuOptions.length;a<c;a++)this.select.options[a].innerHTML=g.eval(this.menuOptions[a]);
this.value=g.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);g.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,
0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",
this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};r.prototype.customSplit=function(a){m=!1;l="";c=0;for(h=-1;c<a.length;){e=a.charAt(c);if("["===e&&-1===h){if(m||""!=l)l+="\u00a6";h++}else"["===e?h++:"]"===e&&0===h?(m=!0,h--):"]"==a.charAt(c)&&(h=0>h?h:h-1);l+=a.charAt(c);c++}return l.split("\u00a6")};r.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,
"."));q=-1;p=Infinity;for(var c=0,e=this.strValue.length;c<e;c++)b=f(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=p&&(p=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=c.cover.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())});
this.field.addEventListener("blur",function(a){c.drawIfValue&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(a){this.focus()});c.cover.addEventListener("click",function(a){a=c.evaluator.eval(c.kbexp);c.activeIfValue&&c.parent.keyboard.show(c,c.kblayout,a[0][0]||0,a[0][1]||0,c.id,c.field,c.onlyText)})};a.Menu=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d,g,q,p,b,m,l,c,h,e,v,r,u,y,n,k,w,x,z=function(c,b){b=a.Control.call(this,c,b)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name+"'");b.orientation=b.w>=b.h?"h":"v";b.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:b.id});b.canvas=a.newHTML("canvas");b.divUp=a.newHTML("div",{class:"DescartesCatcher up"});b.divDown=a.newHTML("div",{class:"DescartesCatcher down"});b.field=a.newHTML("input",{type:"text",id:b.id+"scrollbar",class:"DescartesScrollbarField"});b.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});b.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.container.appendChild(b.canvas);b.container.appendChild(b.label);b.container.appendChild(b.divUp);
b.container.appendChild(b.divDown);b.container.appendChild(b.field);b.container.appendChild(b.scrollHandler);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.visible&&b.container.appendChild(b.cover);b.addControlContainer(b.container);b.addEvents();b.init();return b};$jscomp.inherits(z,a.Control);z.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);p=this.evaluator.eval(this.expresion);this.x=p[0][0];this.y=p[0][1];4==p[0].length&&(this.w=p[0][2],this.h=p[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(q);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};z.prototype.initScroll=function(c){g=this;d=g.evaluator;g.label.innerHTML=d.eval(g.name).toString();w=this.label.textContent;var b="v"===g.orientation?parseInt(19+5*(g.h-100)/100):g.h;g.fieldFontSize=
0<d.eval(g.font_size)?d.eval(g.font_size):"v"===g.orientation?b-parseInt(g.h/20)-1:a.getFieldFontSize(b);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},g.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);c=a.getTextWidth(c+"_",g.fieldFontSize+"px "+a.sansserif_font);var e=g.parent.getSpaceById(g.spaceID).h;g.labelHeight=""==w?0:b;g.fieldHeight=""==g.visible?0:b;if("v"===g.orientation)g.canvasWidth=g.w,g.canvasHeight=g.h-g.labelHeight-g.fieldHeight,18<=g.canvasHeight+g.y-e&&(g.canvasHeight=e),b=g.fieldHeight,c=b+g.canvasHeight,g.canvasX=0,g.canvasY=g.fieldHeight,g.labelWidth=g.w,g.labelY=c,g.upWidth=g.downW=g.w,g.upHeight=g.downH=g.w,g.upX=0,g.upY=g.fieldHeight,g.downX=0,g.downY=c-g.downH,
g.fieldWidth=g.w,g.fieldX=0,g.scrollHandlerW=g.w,g.scrollHandlerH=parseInt((g.canvasHeight-g.upHeight-g.downH-g.labelHeight-g.fieldHeight)/10),g.scrollHandlerH=g.canvasHeight-g.upHeight-g.downH-g.labelHeight-g.fieldHeight>2*g.w?g.w:g.scrollHandlerH,g.scrollHandlerH=15>g.scrollHandlerH?15:g.scrollHandlerH,g.limInf=c-g.downH-g.scrollHandlerH,g.limSup=b+g.downH;else{b=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);g.labelWidth=b;g.fieldWidth=c;""==w&&(g.labelWidth=0);g.visible||(g.fieldWidth=
0);for(c=g.w-g.fieldWidth-g.labelWidth;58>c&&0<g.labelWidth;)g.labelWidth--,c++;for(;58>c&&0<g.fieldWidth;)g.fieldWidth--,c++;b=g.labelWidth;e=b+c;g.fieldWidth=g.w-e;g.canvasWidth=c;g.canvasHeight=g.h;g.canvasX=g.labelWidth;g.canvasY=0;g.fieldX=g.canvasWidth+g.labelWidth;g.labelHeight=g.h;g.labelY=0;g.upWidth=g.downW=g.h;g.upHeight=g.downH=g.h;g.upX=e-g.downW;g.upY=0;g.downX=g.labelWidth;g.downY=0;g.scrollHandlerW=parseInt((g.canvasWidth-g.upWidth-g.downW)/10);g.scrollHandlerW=g.canvasWidth-g.upWidth-
g.downW>2*g.h?g.h:g.scrollHandlerW;g.scrollHandlerW=15>g.scrollHandlerW?15:g.scrollHandlerW;g.scrollHandlerH=g.h;g.limInf=b+g.downW;g.limSup=b+g.canvasWidth-g.downW-g.scrollHandlerW}g.container.setAttribute("style","width:"+g.w+"px;height:"+g.h+"px;left:"+g.x+"px;top:"+g.y+"px;z-index:"+g.zIndex+";");g.canvas.setAttribute("width",g.w+"px");g.canvas.setAttribute("height",g.h+"px");g.canvas.setAttribute("style","position:absolute;left:0;top:0;");g.ctx=g.canvas.getContext("2d");g.ctx.imageSmoothingEnabled=
!1;g.divUp.setAttribute("style","width:"+g.upWidth+"px;height:"+g.upHeight+"px;left:"+g.upX+"px;top:"+g.upY+"px;");g.divDown.setAttribute("style","width:"+g.downW+"px;height:"+g.downH+"px;left:"+g.downX+"px;top:"+g.downY+"px;");g.scrollHandler.setAttribute("style","width:"+g.scrollHandlerW+"px;height:"+g.scrollHandlerH+"px;left:"+("v"===g.orientation?0:g.limInf)+"px;top:"+("v"===g.orientation?g.limInf:0)+"px;");g.field.setAttribute("style","font-size:"+g.fieldFontSize+"px;width:"+g.fieldWidth+"px;height:"+
g.fieldHeight+"px;left:"+g.fieldX+"px;top:0;");g.cover.setAttribute("style","width:"+g.fieldWidth+"px;height:"+g.fieldHeight+"px;left:"+g.fieldX+"px;top:0;");0===g.fieldHeight&&(g.field.style.display="none");g.label.setAttribute("style","font-size:"+g.fieldFontSize+"px;width:"+g.labelWidth+"px;height:"+g.labelHeight+"px;line-height:"+g.labelHeight+"px;left:0;top:"+g.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=g.labelWidth*
this.ratio;this.label.height=g.labelHeight*this.ratio};z.prototype.update=function(){d=this.evaluator;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);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(x=this.label_color.getColor())||"CanvasGradient"!==x.constructor.name&&"CanvasPattern"!==
x.constructor.name||(this.label_ctx.fillStyle=x,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/
this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};z.prototype.draw=function(){g=this;b=g.ctx;l=f(this.w);m=f(this.h);b.fillStyle=this.color.getColor();b.fillRect(0,0,l,m);b.fillStyle="black";b.beginPath();"h"===g.orientation?(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(parseInt(g.labelWidth)+.5,.5,l-1-parseInt(g.labelWidth),m-1),b.lineWidth=Math.ceil(12*g.upWidth/100)||1,b.strokeStyle=g.colorInt.getColor(),b.moveTo(g.downX+62.215*g.upWidth/100,20*g.downH/100),b.lineTo(g.downX+
32.449*g.upWidth/100,g.downH/2),b.lineTo(g.downX+62.215*g.upWidth/100,80*g.downH/100),b.moveTo(g.upX+32.449*g.upWidth/100,20*g.downH/100),b.lineTo(g.upX+62.215*g.upWidth/100,g.downH/2),b.lineTo(g.upX+32.449*g.upWidth/100,80*g.downH/100),b.stroke(),h=f(g.pos),c=Math.ceil(m/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(h+.5,c,f(g.scrollHandlerW),m-2*c)):(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(.5,.5,l-1,m-parseInt(g.labelHeight)-.5),b.lineWidth=Math.ceil(12*g.upWidth/100)||
1,b.strokeStyle=g.colorInt.getColor(),b.moveTo(20*g.upWidth/100,g.h-g.labelHeight-70*g.downH/100),b.lineTo(50*g.upWidth/100,g.h-g.labelHeight-40.237*g.downH/100),b.lineTo(80*g.upWidth/100,g.h-g.labelHeight-70*g.downH/100),b.moveTo(20*g.upWidth/100,70*g.downH/100),b.lineTo(50*g.upWidth/100,40.237*g.downH/100),b.lineTo(80*g.upWidth/100,70*g.downH/100),b.stroke(),h=f(g.pos),c=Math.ceil(l/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(c,h+.5,l-2*c,f(g.scrollHandlerH)));g.activeIfValue||(b.fillStyle=
"rgba(255,255,255,0.5)",b.fillRect(0,0,b.canvas.width,b.canvas.height))};z.prototype.validateValue=function(a){d=this.evaluator;e=a.toString();e=parseFloat(e.replace(this.parent.decimal_symbol,"."));isNaN(e)&&(e=0);this.minimo=d.eval(this.min);e<this.minimo&&(this.value=null,e=this.minimo);this.maximo=d.eval(this.max);e>this.maximo&&(this.value=null,e=this.maximo);v=this.incr;e=0!=v?e*v/v:0;this.fixed&&(e=parseFloat(parseFloat(e).toFixed(d.eval(this.decimals))));return e};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+
this.incr)};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};z.prototype.increase10=function(){c=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+c):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+c)};z.prototype.decrease10=function(){c=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<
this.prePos&&this.changeValue(parseFloat(this.value)-c):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-c)};z.prototype.changeValue=function(a){this.activeIfValue&&(r=this.validateValue(a),r!=this.value&&(this.value=r,this.field.value=this.formatOutputValue(r),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};z.prototype.changeValueForScrollMovement=function(){d=this.evaluator;u=this.limInf;y=
this.limSup;n=d.eval(this.min);k=d.eval(this.max);v=this.incr;r=f((this.pos-u)*(k-n)/(y-u)/v)*v+n;r!=this.value&&(this.value=r,this.field.value=this.formatOutputValue(r),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};z.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;u=this.limInf;y=this.limSup;n=d.eval(this.min);k=d.eval(this.max);v=this.incr;this.pos=(this.value-n)*(y-u)/(k-n)+u;this.scrollHandler.style["h"==this.orientation?
"left":"top"]=this.pos+"px"};z.prototype.addEvents=function(){function c(b,e,h,k){a.clearTimeout(u);(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-k)&&(e.call(n),b=h?b:30,u=a.setTimeout(function(){c(b,e,!1,k)},b))}function b(b){b.preventDefault();n.whichBtn=a.whichBtn(b);"L"==n.whichBtn&&n.activeIfValue&&(n.clickPos=a.getCursorPosition(b,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?c(350,n.decrease10,!0,n.minimo):c(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?
c(350,n.increase10,!0,n.maximo):c(350,n.decrease10,!0,n.minimo))}function e(c){n.canvasClick=!1;a.clearTimeout(u)}function h(c){1==n.canvasClick&&(n.clickPos=a.getCursorPosition(c,n.container),c.preventDefault())}function k(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",k,!1);window.removeEventListener("mousemove",d,!1);a.preventDefault()}function g(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",g,!1);window.removeEventListener("touchmove",d,!1);
a.preventDefault()}function d(c){var b=a.getCursorPosition(c,n.container);"h"==n.orientation?(n.pos=n.prePos-(n.initPos.x-b.x),n.pos<n.limInf&&(n.pos=n.limInf),n.pos>n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.scrollHandlerW+"px;height:"+n.h+"px;left:"+n.pos+"px;top:0;")):(n.pos=n.prePos-(n.initPos.y-b.y),n.pos>n.limInf&&(n.pos=n.limInf),n.pos<n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.w+"px;height:"+n.scrollHandlerH+"px;left:0;top:"+
n.pos+"px;"));n.changeValueForScrollMovement();c.preventDefault()}function f(b){b.preventDefault();n.whichBtn=a.whichBtn(b);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,c(350,n.increase,!0,n.maximo))}function m(b){b.preventDefault();n.whichBtn=a.whichBtn(b);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,c(350,n.decrease,!0,n.minimo))}function l(c){n.down=!1;a.clearTimeout(u);c.preventDefault()}function r(c){n.up=!1;a.clearTimeout(u);n.draw()}function p(c){n.down=!1;a.clearTimeout(u);n.draw()}var n=this,
u;n.canvas.oncontextmenu=n.divUp.oncontextmenu=n.divDown.oncontextmenu=n.label.oncontextmenu=n.field.oncontextmenu=n.scrollHandler.oncontextmenu=n.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});this.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.field.value,!0)});this.canvas.addEventListener("touchstart",b);this.canvas.addEventListener("mousedown",b);this.divDown.addEventListener("mouseout",
l);window.addEventListener("touchend",e);window.addEventListener("mouseup",e);this.canvas.addEventListener("touchmove",h);this.canvas.addEventListener("mousemove",h);this.scrollHandler.addEventListener("touchstart",function(c){n.activeIfValue&&(n.scrollClick=!0,n.initPos=a.getCursorPosition(c,n.container),window.addEventListener("touchend",g),window.addEventListener("touchmove",d),c.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(c){n.activeIfValue&&(n.scrollClick=!0,
n.initPos=a.getCursorPosition(c,n.container),window.addEventListener("mouseup",k),window.addEventListener("mousemove",d),c.preventDefault())});this.divUp.addEventListener("touchstart",f);this.divUp.addEventListener("mousedown",f);this.divDown.addEventListener("touchstart",m);this.divDown.addEventListener("mousedown",m);this.divUp.addEventListener("mouseout",function(c){n.up=!1;a.clearTimeout(u);c.preventDefault()});this.divDown.addEventListener("mouseout",l);window.addEventListener("touchend",r);
window.addEventListener("mouseup",r);window.addEventListener("touchend",p);window.addEventListener("mouseup",p);n.cover.addEventListener("click",function(a){a=n.evaluator.eval(n.kbexp);n.activeIfValue&&n.parent.keyboard.show(n,n.kblayout,a[0][0]||0,a[0][1]||0,n.id,n.field,n.onlyText)})};a.Scrollbar=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g=function(g,d){var b=a.Control.call(this,g,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;g=b.evaluator.eval(b.expresion);4==g[0].length?(b.w=g[0][2],b.h=g[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(m){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(m){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(m){}return 0});
b.evaluator.setFunction(b.id+".currentTime",function(a){try{b.audio.currentTime=parseFloat(a)}catch(l){}return 0});b.audio.addEventListener("timeupdate",function(a){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime);b.evaluator.setVariable(b.id+".playing",b.audio.paused?0:1);b.evaluator.setVariable(b.id+".duration",b.audio.duration)});return b};$jscomp.inherits(g,a.Control);g.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};
g.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=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g=function(g,d){var b=a.Control.call(this,g,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;f=b.evaluator;g=f.eval(b.expresion);4==g[0].length?(b.w=g[0][2],b.h=g[0][3]):(b.w=null,b.h=null);g=b.file;d=g.lastIndexOf(".");-1!=d&&(g=b.file.substring(0,d));b.video=a.newHTML("video",{poster:g+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(d=a.newHTML("source",{src:g+".mp4",type:"video/mp4"}),b.video.appendChild(d));b.video.canPlayType("video/ogg")&&(d=a.newHTML("source",{src:g+".ogg",type:"video/ogg"}),b.video.appendChild(d),d=a.newHTML("source",{src:g+".ogv",type:"video/ogg"}),b.video.appendChild(d));b.video.canPlayType("video/webm")&&
(d=a.newHTML("source",{src:g+".webm",type:"video/webm"}),b.video.appendChild(d));b.addControlContainer(b.video);f.setFunction(b.id+".play",function(){try{b.video.play()}catch(m){}return 0});f.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(m){}return 0});f.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(m){}return 0});f.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(l){}return 0});b.video.addEventListener("timeupdate",
function(a){f.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(g,a.Control);g.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};g.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=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q=function(g,b){var d=a.Control.call(this,g,b)||this;d.font_family=b.font_family||"Monospaced";d.style=b.style||",PLAIN,";d.font_size=b.font_size||12;typeof("number"!==d.font_size)&&(d.font_size=d.evaluator.eval(d.font_size));d.font=d.font_family+d.style+d.font_size;d.region="interior";d.tabindex=++d.parent.tabindex;if(d.answer){d.answer.match("krypto_")&&(d.answer=(new a.Krypto).decode(d.answer.substring(7)));var f=d.parent.lessonParser.parseText(d.answer)}d.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:d.id,spellcheck:"false"});d.textArea=a.newHTML("div",{class:"DescartesTextAreaContainer",contenteditable:"true"});d.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});d.showButton=a.newHTML("div",{class:"DJS_Gradient"});d.activeCover=a.newHTML("div");d.containerControl.appendChild(d.textArea);d.containerControl.appendChild(d.textAreaAnswer);d.containerControl.appendChild(d.showButton);d.containerControl.appendChild(d.activeCover);
d.addControlContainer(d.containerControl);d.showAnswer=!1;d.text=void 0==d.text||"simpleText"==d.text.type?d.rawText||"":d.text.hasFormula?d.rawText:d.text.toHTML();f&&"simpleText"!==f.type&&(d.answer=d.text.hasFormula?"":f.toHTML());d.evaluator.setVariable(d.id,d.text);var c,h,e;d.evaluator.setFunction(d.id+".insertAtCursor",function(a){(c=window.getSelection())&&c.getRangeAt&&c.rangeCount&&(e=document.createTextNode(a),h=c.getRangeAt(0),h.deleteContents(),h.insertNode(e),h.setStart(e,e.length),
h.setEnd(e,e.length),c.removeAllRanges(),c.addRange(h),d.textArea.focus());return 0});d.evaluator.setFunction(d.id+".update",function(){d.update()});d.addEvents();d.init();return d};$jscomp.inherits(q,a.Control);q.prototype.init=function(){d=this.answer?28:4;f=this.evaluator;var g=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=g;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"));g=this.textArea.innerText||"";g="\n"===g.charAt(g.length-1)?g.substring(0,g.length-1):g;g=g.replace(/\n/g,"\\n").replace(/\s/g," ");f.setVariable(this.id,g);this.oldFieldValue=g;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").replace(/\n/g,"<br>"))});this.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()})};a.TextArea=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,d,g,q,p,b,m,l,c,h,e,v,r,u=function(c,b){var h=a.Control.call(this,c,b)||this;g=c.evaluator.parser;h.spaceID=b.spaceID||"";h.text=b.text||"";h.size=b.size||g.parse("4");h.font=b.font||"Serif,PLAIN,12";h.image=new Image;h.image.onload=function(){this.ready=1};h.imageSrc=b.imageSrc||"";h.imageSrc.match(/^\[.*\]?/)?h.imageSrc=h.parser.parse(h.imageSrc.substring(1,h.imageSrc.length-1)):h.imageSrc=h.parser.parse("'"+h.imageSrc+"'");h.font=a.convertFont(h.font);
if(h.constraintExpr){h.constraint=g.parse(h.constraintExpr);"(expr)"==h.constraint.type&&(h.constraint=g.parse(h.constraintExpr.substring(1,h.constraintExpr.length-1)));if("compOperator"==h.constraint.type){b=h.constraint.childs[0];var d=h.constraint.childs[1];"identifier"!=b.type||"y"!=b.value||d.contains("y")?"identifier"!=b.type||"x"!=b.value||d.contains("x")?h.newt=new a.R2Newton(h.evaluator,h.constraint):(h.constVar="y",h.noConstVar="x",h.evalConst=h.evalConstXoY,h.constraint=d):(h.constVar=
"x",h.noConstVar="y",h.evalConst=h.evalConstXoY,h.constraint=d)}else h.constraint=null;e=new a.R2(0,0)}h.container=h.getContainer();h.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:h.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+h.zIndex+";"});h.ctx=h.space.ctx;h.container.appendChild(h.mouseCatcher);h.addEvents();h.xStr=h.id+".x";h.yStr=h.id+".y";h.activoStr=h.id+".activo";h.activeStr=h.id+".active";""!==h.space.id&&2!==c.version?(h.mxStr=
h.space.id+".mouse_x",h.myStr=h.space.id+".mouse_y",h.mclickedStr=h.space.id+".mouse_clicked",h.mclicizquierdoStr=h.space.id+".clic_izquierdo"):(h.mxStr="mouse_x",h.myStr="mouse_y",h.mclickedStr="mouse_clicked",h.mclicizquierdoStr="clic_izquierdo");h.init();return h};$jscomp.inherits(u,a.Control);u.prototype.init=function(c){d=this.evaluator;v=a.hasTouchSupport;c||(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.img_src_eval=
d.eval(this.imageSrc).toString().trim();""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*d.eval(this.size),this.height=2*d.eval(this.size),this._w=v&&48>this.width?48:this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,
32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";d.setVariable(this.activoStr,0);d.setVariable(this.activeStr,0);this.setImage=!1;this.update()};u.prototype.update=function(){d=this.evaluator;d.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);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);p=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(q-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(p-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){d=this.evaluator;this.drawIfValue&&(c=this.ctx,h=this.space.backgroundCtx,
q=parseInt(this.space.getAbsoluteX(this.x))+.5,p=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(q,p),this.image.ready?(b=this.image.width/2,m=this.image.height/2,this.image.complete&&!this.setImage&&c.drawImage(this.image,parseInt(q-b),parseInt(p-m)),this.trace&&(h.save(),h.translate(q,p),h.scale(parseInt(b),parseInt(m)),h.beginPath(),h.arc(0,0,1,0,f),h.restore(),h.lineWidth=1,h.strokeStyle=this.trace.getColor(),h.stroke())):(b=parseInt(this.width/2),c.beginPath(),c.arc(q,
p,b,0,f),c.fillStyle=this.colorInt.getColor(),c.fill(),c.lineWidth=1,c.strokeStyle=this.color.getColor(),c.stroke(),this.active&&(c.strokeStyle=this.colorInt.borderColor(),c.beginPath(),c.arc(q,p,b-2,0,f),c.stroke()),this.trace&&(h.strokeStyle=this.trace.getColor(),h.beginPath(),h.arc(q,p,b,0,f),h.stroke())))};u.prototype.evalConst=function(){e.set(this.x,this.y);l=this.newt.findZero(e,1/this.space.scale,!0);this.x=l.x;this.y=l.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,
this.y)};u.prototype.evalConstXoY=function(){d=this.evaluator;r=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,r)};u.prototype.drawText=function(a,b){c=this.ctx;d=this.evaluator;"simpleText"==this.text.type?(c.fillStyle=this.color.getColor(),c.font=this.font,c.textBaseline="alphabetic",c.fillText(this.text.toString(d.eval(this.decimals),
this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))):(c.fillStyle=this.color.getColor(),c.strokeStyle=this.color.getColor(),c.textBaseline="alphabetic",this.text.draw(c,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};u.prototype.getContainer=function(){for(var a=this.parent.spaces,c,b=0,e=a.length;b<e;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};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,0)};u.prototype.addEvents=function(){function c(c){document.body.focus();c.preventDefault();d.whichBtn=a.whichBtn(c);"L"==d.whichBtn&&d.activeIfValue&&(d.parent.deactivateGraphicControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,
1),d.evaluator.setVariable(d.activeStr,1),d.evaluator.setVariable(d.mclickedStr,0),d.evaluator.setVariable(d.mclicizquierdoStr,0),d.posAnte=a.getCursorPosition(c,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("touchend",b),window.addEventListener("touchmove",e),window.addEventListener("mouseup",
b),window.addEventListener("mousemove",e))}function b(c){document.body.focus();c.preventDefault();c.stopPropagation();d.evaluator.setVariable(d.mclickedStr,1);d.evaluator.setVariable(d.mclicizquierdoStr,1);if(d.activeIfValue||d.active)d.click=!1,window.removeEventListener("mouseup",b),window.removeEventListener("mousemove",e),window.removeEventListener("touchend",b),window.removeEventListener("touchmove",e),g=a.getCursorPosition(c,d.container)||g,d.posX=d.prePos.x-(d.posAnte.x-g.x),d.posY=d.prePos.y-
(d.posAnte.y-g.y),d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX)),d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY)),d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(g.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(g.y)),d.parent.updateControls(),d.parent.update(),d.mouseCatcher.style.left=d.space.getAbsoluteX(d.x)-d._w/2+"px",d.mouseCatcher.style.top=d.space.getAbsoluteY(d.y)-d._h/2+"px";c=d.evaluator.getVariable(d.activeStr);d.parent.deactivateGraphicControls();
d.parent.updateControls();d.evaluator.setVariable(d.activoStr,c);d.evaluator.setVariable(d.activeStr,c);d.parent.update()}function e(c){c.preventDefault();d.evaluator.setVariable(d.mclickedStr,0);d.evaluator.setVariable(d.mclicizquierdoStr,0);g=a.getCursorPosition(c,d.container);d.posX=d.prePos.x-(d.posAnte.x-g.x);d.posY=d.prePos.y-(d.posAnte.y-g.y);d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX));d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY));d.evaluator.setVariable(d.mxStr,
d.space.getRelativeX(g.x));d.evaluator.setVariable(d.myStr,d.space.getRelativeY(g.y));80<Date.now()-h&&(d.parent.updateControls(),d.parent.update(),h=Date.now())}var h=0,g,d=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){d.over=!0});this.mouseCatcher.addEventListener("mouseout",function(a){d.over=
!1;d.click=!1})};a.GraphicControl=u;return a}(descartesJS||{});
descartesJS=function(a,f){var d,g,q,p,b,m,l,c,h,e;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var r=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,u,y,n,k,w,x,z,A,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q,R,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,e=a.length;b<
e;b++)switch(n=a[b][0],k=a[b][1],y=f[n],y){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[y]=parseInt(k);break;case "about":case "config":case "init":case "clear":c[y]="true"===f[k];break;default:console.warn("Propiedad de botones no identificada: <"+n+"> valor: <"+k+">")}return c};S.prototype.parseSpace=function(c){w={};c=this.split(c);for(var b=0,e=c.length;b<e;b++)switch(n=c[b][0],k=c[b][1],y=f[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Space",y){case "type":if("R2"===
k||"R3"===k)k=f[k];w[y]=k;break;case "id":a.DEBUG.idName=k;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":w[y]=k;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":w[y]="true"===f[k];break;case "bg_display":case "render":w[y]=f[k];break;case "border_color":case "net":case "net10":case "axes":case "text":w[y]=""!=k?"false"===f[k]?"":new a.Color(k,this.parent.evaluator):"";break;case "O.x":w.OxExpr=
k;break;case "O.y":w.OyExpr=k;break;case "image":w.imageSrc=k;break;case "x":u=k;"%"===u[u.length-1]?(w.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=k;w.xExpr=this.parser.parse(u);break;case "y":u=k;"%"===u[u.length-1]?(w.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=k;w.yExpr=this.parser.parse(u);break;case "width":u=k.trim();w.wModExpr=u;"%"===u[u.length-1]?(w.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(k),u!=k&&(u=this.parent.container.width,w._w_=k.trim()));w.w=u;break;case "height":u=k.trim();w.hModExpr=u;"%"===u[u.length-1]?(w.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(k),u!=k&&(u=this.parent.container.height,w._h_=k.trim()));w.h=u;break;case "drawif":""!=k&&(w.drawif=this.parser.parse(k));break;case "scale":u=parseFloat(k);isNaN(u)&&(u=48);w.scale=u;break;case "background":w.background=new a.Color(k,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
n+"> valor: <"+k+">")}return new a["Space"+w.type](this.parent,w)};S.prototype.parseControl=function(c){x={type:"Numeric",gui:"Spinner"};c=this.split(c);for(var b=0,e=c.length;b<e;b++)switch(n=c[b][0],k=c[b][1],y=f[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Control",y){case "type":u=f[k.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");x.type=v(u);break;case "gui":u=f[k];"textfield"===u&&(u="TextField");x[y]=v(u);break;case "id":a.DEBUG.idName=k;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":case "info":x[y]=
k;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":x[y]=f[k];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":x[y]="true"===f[k];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":x[y]=new a.Color(k,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
k&&(x[y]=this.parser.parse(k));break;case "constraint":x.constraintExpr=k;break;case "image":x.imageSrc=k;break;case "image_dec":x.image_dec_src=k;break;case "image_inc":x.image_inc_src=k;break;case "space":x.spaceID=k;break;case "expresion":x.expresion=this.parser.parse(k.replace(")(",","));case "kbexp":x.kbexp=this.parser.parse(k.replace(")(",","));break;case "borderColor":x[y]="false"===f[k]?"":k;break;case "bold":"false"!=f[k]&&(x.bold="bold");break;case "italics":"false"!=f[k]&&(x.italics="italic");
break;case "underlined":"false"!=f[k]&&(x.underlined=!0);break;case "value":var h=k.replace(/&squot;/g,"'");h.match(/^\|/)&&(h="'"+h.substring(1),h.match(/\|$/)&&(h=h.substring(0,h.length-1)+"'"));x.valueExpr=this.parser.parse(h);x.valueExprString=h;break;case "incr":0!=k&&(x.incr=this.parser.parse(k));break;case "exponentialif":x.exponentialif=parseFloat(k);break;case "text":x.rawText=k;h=this.parseText(k);for(var g=0,d=h.length;g<d;g++)h[g]=this.parser.parse(h[g],!1);x.text=h;break;default:g=n.indexOf("."),
h=f[n.substring(0,g)],g=f[n.substring(g+1)],"parameter"===h&&"font"===g?x.parameterFont=k:"Explanation"===h&&"font"===g?x.ExplanationFont=k:"tooltip"===h&&"font"===g?x.tooltipFont=k:console.warn("Propiedad de control no identificada: <"+n+"> valor: <"+k+">")}return new a["Numeric"===x.type?x.gui:x.type](this.parent,x)};S.prototype.parseGraphic=function(c,b,e,h){z={rotateExp:h,parameter:"t"};c=this.split(c);h=0;for(var g=c.length;h<g;h++)if(n=c[h][0],k=c[h][1],y=f[n],a.DEBUG.paramName=n,a.DEBUG.objectName=
"Graphic",""!=k)switch(y){case "type":a.DEBUG.idName=k;z[y]=v(f[k]);break;case "align":case "anchor":case "lineDash":z[y]=f[k];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":z[y]="true"===f[k];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":z[y]="false"===f[k]?"":new a.Color(k,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":z[y]=
k;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==k&&(z[y]=this.parser.parse(k));break;case "font_size":k=k.trim();k.match(/^\[.*\]?/)&&(k=k.substring(1,k.length-1));""!==k&&(z[y]=this.parser.parse(k));break;case "space":z.spaceID=k;break;case "expresion":""!==k&&("Macro"!==z.type?(z.expresion=this.parser.parse(k),z.expresionString=k):z.expresion=k);break;
case "text":z.text=k;break;case "file":var d=k.replace(/&squot;/g,"'");"["===d.charAt(0)&&"]"===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));d.match(r)&&(d="'"+d+"'");z.file=this.parser.parse(d);break;case "border":""!=k&&"false"!=f[k]&&(z.border=new a.Color(k,this.parent.evaluator));break;default:if(void 0!=z.family&&n.substring(0,z.family.length+1)===z.family+".")switch(f[n.substring(z.family.length+1)]){case "interval":""!=k&&(z.family_interval=this.parser.parse(k));break;case "steps":""!=
k&&(z.family_steps=this.parser.parse(k))}else if(void 0!=z.parameter&&n.match(z.parameter+"."))switch(z.parameter!==n.substring(0,n.indexOf(z.parameter)+z.parameter.length)&&(z.parameter=n.substring(0,n.indexOf(z.parameter)+z.parameter.length)),f[n.substring(z.parameter.length+1)]){case "interval":""!=k&&(z.parameter_interval=this.parser.parse(k));break;case "steps":""!=k&&(z.parameter_steps=this.parser.parse(k))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+n+"> valor: <"+k+">")}b&&
(z.abs_coord=b);e&&(z.background=e);return new a[z.type](this.parent,z)};S.prototype.parse3DGraphic=function(c,b,e,h){z={rotateExp:h,parameter:"t"};c=this.split(c);b=0;for(e=c.length;b<e;b++)switch(n=c[b][0],k=c[b][1],y=f[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Graphic3D",y){case "type":a.DEBUG.idName=k;u=f[k];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":z.subType=
u,u="OtherGeometry"}z[y]=v(u);break;case "model":case "align":case "anchor":case "lineDash":z[y]=f[k];break;case "shadowColor":case "fill":z[y]="false"===f[k]?"":new a.Color(k,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":z[y]="true"===f[k];break;case "edges":"false"===f[k]?z[y]="":("true"===f[k]&&(k="808080"),z[y]=new a.Color(k,this.parent.evaluator));break;case "border":""!=k&&"false"!=f[k]&&(z.border=new a.Color(k,this.parent.evaluator));
break;case "color":case "backcolor":z[y]=new a.Color(k,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":""!=k&&(z[y]=this.parser.parse(k));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":z[y]=
k;break;case "space":z.spaceID=k;break;case "expresion":"Macro"!=z.type&&"Curve"!=z.type&&"Surface"!=z.type?(z.expresion=this.parser.parse(k),z.expresionString=k):z.expresion=k.replace(/\\n/g,";");break;case "text":z.text=k;break;case "file":h=k.replace(/&squot;/g,"'");"["===h.charAt(0)&&"]"===h.charAt(h.length-1)&&(h=h.substring(1,h.length-1));h.match(/./)&&(h="'"+h+"'");z.file=this.parser.parse(h);break;default:void 0!==z.family&&n.substring(0,z.family.length+1)===z.family+"."?"interval"===f[n.substring(z.family.length+
1)]?""!=k&&(z.family_interval=this.parser.parse(k)):""!=k&&(z.family_steps=this.parser.parse(k)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+n+"> valor: <"+k+">")}return new a[z.type+"3D"](this.parent,z)};S.prototype.parseAuxiliar=function(c){A={};c=this.split(c);for(var b=0,e=c.length;b<e;b++)c[b][1]=c[b][1].replace(/&squot;/g,"'");b=0;for(e=c.length;b<e;b++)switch(n=c[b][0],k=c[b][1],y=f[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Auxiliar",y){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=k;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[y]=k.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[y]="true"===f[k];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[y]=this.parser.parse(k);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[y]=
f[k];break;default:var h=n.indexOf("."),g=f[n.substring(0,h)];h=f[n.substring(h+1)];"parameter"===g&&"font"===h?A.parameterFont=k:console.warn("Propiedad del auxiliar no identificada: <"+n+"> valor: <"+k+">")}A.sequence?A.type="sequence":A.constant?A.type="constant":A.algorithm&&A.evaluate?A.type="algorithm":A.array&&!A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="vector":A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="matrix":A.event&&")"!=A.id.charAt(A.id.length-1)?A.type="event":"library"===
A.type?A.type="library":")"===A.id.charAt(A.id.length-1)?A.type="function":A.type="variable";a.DEBUG.typeName=A.type;switch(A.type){case "sequence":new a.Function(this.parent,A);break;case "constant":c=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":c=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(c);break;
case "matrix":c=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new a.Event(this.parent,A));break;case "library":new a.Library(this.parent,A);break;case "variable":new a.Variable(this.parent,A);break;default:new a.Function(this.parent,A)}};S.prototype.parseAction=function(c){G=c.action;J=c.parent;E=c.parameter;return G?new (a[v(G)])(J,E):{execute:function(){}}};S.prototype.parseAnimation=function(c){var b={};
c=this.split(c);for(var e=0,h=c.length;e<h;e++)switch(n=c[e][0],k=c[e][1],y=f[n],y){case "id":case "delay":case "init":case "doExpr":case "whileExpr":b[y]=k.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":b[y]="true"===f[k];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+n+">  <"+k+">")}return new a.Animation(this.parent,b)};S.prototype.parsePleca=function(f,r){f=this.split(f);g=d="";q=0;p="#536891";b="white";m=
"left";l="";c="SansSerif,BOLD,20";h="SansSerif,PLAIN,18";e=void 0;for(var u=0,v=f.length;u<v;u++)switch(n=f[u][0],k=f[u][1],n){case "title":d=k;break;case "subtitle":g=k;break;case "subtitlines":q=k;break;case "bgcolor":""!=k&&(p=(new a.Color(k,this.parent.evaluator)).getColor());break;case "fgcolor":""!=k&&(b=(new a.Color(k,this.parent.evaluator)).getColor());break;case "align":""!=k&&(m=k);break;case "titleimage":l=k;break;case "titlefont":c=""!=k?a.convertFont(k):a.convertFont(c);break;case "subtitlefont":h=
""!=k?a.convertFont(k):a.convertFont(h);break;default:console.warn("Propiedad de la pleca no identificada: <"+n+">  <"+k+">")}if(""===d&&""===g)return a.newHTML("div");O=h.substring(0,h.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=l&&(H=this.parent.getImage(l),P=H.height);e=a.newHTML("div",{id:"descartesPleca"});P?(e.setAttribute("style","position:absolute;left:0;top:0;text-align:"+m+";width:"+r+"px;height:"+P+"px;background-color:"+p+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
H.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),e.appendChild(H)):e.setAttribute("style","position:absolute;left:0;top:0;text-align:"+m+";width:"+r+"px;background:"+p+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+c+";overflow:hidden;white-space:nowrap;"});C.innerHTML=d;N=a.newHTML("div");if(1===parseInt(q)){V=0;K=a.newHTML("div");K.innerHTML=g;document.body.appendChild(K);R=O;do R-=
V,K.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+R+"px;width:"+(r-30)+"px;line-height:"+R+"px;"),Q=K.offsetHeight,W=Q/R,V=1;while(1<W&&8<R);document.body.removeChild(K);N.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+R+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else N.setAttribute("style","padding:0;margin:0;font:"+h+";line-height:1em;");N.innerHTML=g;e.appendChild(C);e.appendChild(N);e.imageHeight=P;return e};S.prototype.split=function(a){if("string"!==
typeof a)return[];F=[];a=(a||"").replace(/\\'/g,"\u2019");D=B=I=0;for(L=M=!1;D<a.length;)" "!==a.charAt(D)||L||D++," "===a.charAt(D)||L||(L=!0,I=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,F[B]=[a.substring(I,D)],I=D+2,D+=2),M&&"'"===a.charAt(D)&&(L=M=!1,F[B].push(a.substring(I,D)),B++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||M||(F[B]=[a.substring(I,D)],I=D+1,D++,U=a.substring(D).indexOf("="),-1===U?T=U=a.length:(U+=D,T=a.substring(D,U).lastIndexOf(" "),T=-1===T?a.length:T+D),F[B].push(a.substring(I,
T)),B++,L=!1,D=T),D++;return F};S.prototype.parseText=function(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||m(c)===c)return Math.pow(a,c);if(0>a){var b=1/c,e=m(b);if(e===b&&1===e%2)return-Math.pow(-a,c)}return NaN}function d(a,c){y=[];y.type="matrix";y.rows=a;y.cols=c;k=0;for(w=c;k<w;k++)y[k]=Array(a).fill(0);return y}function g(a,c){r=a.rows;u=a.cols;y=d(r,u);var b;for(k=0;k<r;k++)for(n=0;n<u;n++){for(w=b=0;w<u;w++)b+=a[w][k]*c[n][w];y[n][k]=b}return y}function q(a,c,b){for(var e=d(b.length-1,b.length-1),h=0,g=e.length;h<
g;h++)for(var k=0;k<g;k++)e[h][k]=h<a?k<c?b[h][k]:b[h][k+1]:h<c?b[h+1][k]:b[h+1][k+1];return e}function p(a){if(1<a.cols){for(var c=0,b=1,e=0,h=a.cols;e<h;e++)c+=b*a[0][e]*p(q(0,e,a)),b=-b;return c}return a[0][0]}if(a.loadLib)return a;var b={},m=Math.floor,l,c,h,e,v,r,u,y,n,k,w,x=function(a,c){this.sep="";this.type=a;this.value=c;this.parent=null;this.childs=[]};x.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};x.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
x.prototype.replaceLastChild=function(a){h=this.childs.length-1;c=this.childs[h];c.parent=null;this.childs[h]=a;a.parent=this;return a};x.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};x.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new x("compOperator","=="),v.addChild(this),v.addChild(new x("number","0")),e=this.getRoot(),e.setAllEvalFun(),
e):this};x.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=0,c=this.childs.length;a<c;a++)if("square_bracket"===this.childs[a].type||"parentheses"===this.childs[a].type)this.childArray=this.childArray.concat(this.childs[a].childs);return this.childArray}return null};x.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,c=this.childs.length;a<c;a++)this.childs[a].setAllEvalFun()};x.prototype.setEvalFun=
function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var 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 e;this.evaluate=function(a){try{return e=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==e?e:0}catch(M){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return e=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==e?e:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var h,v,w;this.evaluate=function(a){h=[];for(var c=0,e=this.childs[0].childs.length;c<e;c++)h[c]=this.childs[0].childs[c].evaluate(a);if("_Eval_"===this.value){l=0<h.length?h[0]:0;if("number"==typeof l)return"NaN";l.match(",")&&parseFloat(l.replace(",","."))==l.replace(",",".")&&(l=l.replace(",","."));if(void 0==b[l]){v=l.match(/:=/g)?!0:!1;if(l.match(";")){var g=
!1,d=[],k=0;c=0;for(e=l.length;c<e;c++){var f=l.charAt(c);"'"===f&&(g=!g);g||";"!==f||(d.push(l.substring(k,c)),k=c+1)}d.push(l.substring(k));l="("+d.join(")(")+")"}b[l]=a.parser.parse(l,v)}w=a.eval(b[l]);return void 0!=w?w:NaN}return a.functions[this.value].apply(a,h)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(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;r=b.rows;u=b.cols;y=d(r,u);for(k=0;k<r;k++)for(n=0;n<u;n++)y[n][k]=b[n][k]+c[n][k];return y}:"-"===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;r=c.rows;u=c.cols;y=d(r,u);for(k=0;k<r;k++)for(n=0;n<u;n++)y[n][k]=c[n][k]-a[n][k];return y}:"*"===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:g(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),e=p(a);if(0===e)a=0;else{e=1/e;if(1<a.length)for(var h=0,k=a.length;h<k;h++){var f=e;for(var l=0;l<k;l++)b[l][h]=f*p(q(h,l,a)),f=-f;e=-e}else b[0][0]=e;a=b}c=0===a?d(c.rows,c.cols):g(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-m(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){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof c&&"number"==typeof a?+(1E-8>Math.abs(c-a)):+(c===a)}:"!="===this.value&&(this.evaluate=function(a){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof c&&
"number"==typeof a?+!(1E-8>Math.abs(c-a)):+(c!==a)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):
this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,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 e=0;e<c;e++){var h=[];for(var g=0,d=this.childs[e].childs.length;g<d;g++)h.push(this.childs[e].childs[g].evaluate(a));b[e]=h}return b};else if("assign"===this.type){var x,D=this.childs[0],B=this.childs[1],L=D.childs[0]?D.childs[0].childs:null;this.evaluate=1===D.childs.length&&"square_bracket"===D.childs[0].type&&1===L.length?function(a){x=B.evaluate(a);a.setVector(D.value,L[0].evaluate(a),x);return x}:1===D.childs.length&&"square_bracket"===D.childs[0].type&&2===L.length?function(a){x=
B.evaluate(a);a.setMatrix(D.value,L[0].evaluate(a),L[1].evaluate(a),x);return x}:function(a){x=B.evaluate(a);return x.type?a.matrices[D.value]=x:"object"!==typeof a.variables[D.value]?a.variables[D.value]=x:0}}};a.Node=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c=/^\s+/,h=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,e=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,r=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,y=/^[\?:]/,n=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,k=/^\[|^\]/,w=/^\(|^\)/,x=/^,/,z=/^;/,A=/\|/g,G=/\|\*/g,J=/\*\|/g,E,F=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
D=function(){};D.prototype.tokenize=function(F){function B(a,c,e){d.push({type:a,value:c});b=b.slice(e);q+=e;l=a}if(f=F){var D=F.indexOf("//");0<=D&&":"!==F[D-1]&&(F=F.substring(0,D));F=F.replace(/\\u(\S+) /g,function(a,c){return 39!==parseInt(c,16)?String.fromCharCode(parseInt(c,16)):a});F=F.replace(/&sup(.+);/g,"^ $1 ");F=F.replace(/&squot;/g,"'");F.match(/=\|\*/g)&&(F=F.replace(G,"'").replace(J,"'"));F.match(/=\|/g)&&(F=F.replace(A,"'"));D=F.trim();"|"==D.charAt(0)&&"|"==D.charAt(D.length-1)&&
(F=D.replace(A,"'"))}d=[];g=!1;q=0;b=F;for(l="";F&&q<F.length;)if(g=q,"'"==b[0]){for(m=1;"'"!=b[m];)if(m<b.length)m++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+f+"\u300b");return}p=b.substring(1,m);B("string",p,p.length+2)}else if(p=b.match(c))b=b.slice(p[0].length),q+=p[0].length;else if(p=b.match(n))p[0]=p[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),B("operator",p[0],p[0].length);else if(p=b.match(h))"number"===l&&
d.push({type:"operator",value:"*"}),B("identifier",p[0],p[0].length);else if(p=b.match(e))B("number",p[0],p[0].length);else if(p=b.match(v))D=p[0],"#"==D&&(D="!="),B("compOperator",D,p[0].length);else if(p=b.match(r))D=p[0],"||"==D?D="|":"&&"==D?D="&":"~"==D&&(D="!"),B("boolOperator",D,p[0].length);else if((p=b.match(u))&&!b.match(/^==/))B("assign",p[0],p[0].length);else if(p=b.match(y))B("conditional",p[0],p[0].length);else if(p=b.match(k))B("square_bracket",p[0],p[0].length);else if(p=b.match(w))"("==
p&&"number"===l&&d.push({type:"operator",value:"*"}),B("parentheses",p[0],p[0].length);else if(p=b.match(x))B("separator",p[0],p[0].length);else if(178===b.charCodeAt(0))d.push({type:"operator",value:"^"}),B("number",2,1);else if(179===b.charCodeAt(0))d.push({type:"operator",value:"^"}),B("number",3,1);else if(p=b.match(z))B("final_of_expression",p[0],p[0].length);else if(g==q){a.DEBUG.setError(a.DEBUG.EXPRESSION,f);return}return d};D.prototype.flatTokens=function(a,c){a=a||[];c=c||"";E="";for(var b=
0,e=a.length;b<e;b++)E="string"==a[b].type?E+"&squot;"+a[b].value+"&squot;":"identifier"!=a[b].type||a[b].value.match(F)?E+a[b].value:E+c+a[b].value;return E};a.Tokenizer=D;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-device-dispositivo-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-ceil-round-min-max-_Trace_-_Print_-_Num_-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var g=Date.now(),q,p,b,m,l,c,h,e,v,r,u,y,n=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()};n.prototype.setDefinition=function(a,c){this.definitions[a]=c};n.prototype.getDefinition=function(a){return this.definitions[a]};n.prototype.setVariable=function(a,c){this.variables[a]=c};n.prototype.getVariable=function(a,
c){return this.variables[a]};n.prototype.setVector=function(a,c,b){this.vectors[a][c]=b};n.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};n.prototype.setMatrix=function(a,c,b,e){this.matrices[a][c][b]=e};n.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};n.prototype.setFunction=function(a,c){this.functions[a]=c};n.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||
(this.functions[a]=function(){return 0});return this.functions[a]};n.prototype.parse=function(g,d){(b=this.tokenizer.tokenize(g))||(b=[]);m=null;d=!d||!1;q=e=h=c=0;for(p=b.length;q<p;q++){v=b[q];r=v.value;u=v.type;if("identifier"===u)if(q+1<p&&"parentheses"===b[q+1].type&&"("===b[q+1].value)this.getFunction(r);else if(q+1<p&&"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(r):this.getMatrix(r);else{var k=r.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);
k&&(this.variables[(k[1]||k[2]||k[3]||k[4]||k[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(r,!0)}"assign"===u&&d&&":="!=r&&(u="compOperator",r="==");if("assign"===u)if(l=new a.Node(u,r),null!=m)if("identifier"===m.type)m.parent&&m.parent.replaceLastChild(l),l.addChild(m),m=l,d=!0;else if("square_bracket"===m.type)l.addChild(m.parent),m=l,d=!0;else{l.type="compOperator";l.value="==";for(d=!0;m.parent&&f(m.parent.value)>=f(l.value);)m=m.parent;m.parent&&m.parent.replaceLastChild(l);l.addChild(m);
m=l}else{console.info("Error1: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===r||"square_bracket"===u&&"["===r)if(l=new a.Node(u,r),"("===r&&c++,"["===r&&h++,null===m)"("===r&&(new a.Node("(expr)","(expr)")).addChild(l),"["===r&&(new a.Node("[expr]","[expr]")).addChild(l),m=l;else if("operator"===m.type||"boolOperator"===m.type||"compOperator"===m.type||"conditional"===m.type||"assign"===m.type)m.addChild(l),m=l;else if("sign"===
m.type)m.addChild(l),m=l;else if("parentheses"===m.type&&"("===m.value)m.addChild(l),m=l;else if("square_bracket"===m.type&&"["===m.value)m.addChild(l),m=l;else if("parentheses"===m.type&&"()"===m.value)m.parent.addChild(l),m=l;else if("square_bracket"===m.type&&"[]"===m.value)m.parent.addChild(l),m=l;else if("identifier"===m.type)m.addChild(l),m=l;else{console.info("Error2: en la expresi\u00f3n \u300a "+g+" \u300b, en el token ["+q+"] {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&
")"===r)if(c--,null===m)console.info("Error3: en la expresi\u00f3n \u300a "+g+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;m&&m.parent&&("("!=m.value||"("==m.value&&"parentheses"!=m.type);)m=m.parent;if(m&&"("===m.value)m.value="()";else break}else if("square_bracket"===u&&"]"===r)if(h--,null===m)console.info("Error5: en la expresi\u00f3n \u300a "+g+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;m&&m.parent&&("["!=m.value||"["==m.value&&"square_bracket"!=m.type);)m=m.parent;if(m&&
"["===m.value)m.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(l=new a.Node(u,r),null===m)m=l;else if("operator"===m.type||"compOperator"===m.type||"boolOperator"===m.type||"parentheses"===m.type&&"("===m.value||"square_bracket"===m.type&&"["===m.value||"sign"===m.type||"conditional"===m.type||"assign"===m.type)m.addChild(l),m=l;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
g);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(l=new a.Node(u,r),null===m)if("-"===r||"+"===r)l.type="sign",l.value="sign"+r,m=l;else if("!"===r)m=l;else{console.info("Error8: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("operator"===m.type||"compOperator"===m.type||"boolOperator"===m.type||"assign"===m.type||"conditional"===m.type||"square_bracket"===m.type&&"["===m.value&&("-"===r||"+"===r||"!"===r)||"parentheses"===
m.type&&"("===m.value&&("-"===r||"+"===r||"!"===r)){if("-"===r||"+"===r)l.type="sign",l.value="sign"+r;m.addChild(l);m=l}else if("number"===m.type||"parentheses"===m.type&&"()"===m.value||"square_bracket"===m.type&&"[]"===m.value||"string"===m.type||"identifier"===m.type||"conditional"===m.type||"assign"===m.type){for(;m.parent&&f(m.parent.value)>=f(l.value);)m=m.parent;m.parent&&m.parent.replaceLastChild(l);l.addChild(m);m=l}else{console.info("Error9: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+
r+", tipo: "+u+"}");break}else if("conditional"===u)if(l=new a.Node(u,r),null!=m)if("?"===l.value){for(e++;m.parent&&f(m.parent.value)>f(l.value);)m=m.parent;m.parent&&m.parent.replaceLastChild(l);l.addChild(m);m=l}else{for(e--;m&&m.parent&&("?"!=m.value||"?"==m.value&&"conditional"!=m.type);)m=m.parent;if(m&&"?"===m.value)m.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("separator"===u)if(null!=m)for(;m.parent&&"("!=m.value&&"["!=m.value;)m=m.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+g+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}0<c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,g);0>c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,g);0<h&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
g);0>h&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,g);0!=e&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,g);(y=m?m.getRoot():null)&&y.setAllEvalFun();return y};n.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;c.variables.device=c.variables.dispositivo=
function(){var a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"mobile":"desktop"}();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,e,h){return a.esCorrecto(b,e,c.evaluator,h)};c.functions.escorrecto=function(b,e,h){return a.escorrecto(b,e,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 e=a.indexOf(c);0<=e;)a=a.substring(0,e)+b+a.substring(e+c.length),e=a.indexOf(c,e+b.length);return a};c.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};c.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};c.functions.trim=function(a){return(a||"").toString().trim()};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 e=c.matrices[b];if(e){for(var h="<"+b+">\\n",g=c.getVariable(b+".columnas_usadas")||e.cols||0,d=c.getVariable(b+".filas_usadas")||e.rows||0,f,k=0;k<g;k++){for(var l=
0;l<d;l++)f=e[k][l],void 0!==f&&("string"==typeof f?f="'"+f+"'":"number"==typeof f&&(f=a.removeNeedlessDecimals(f.toFixed(6))),h+=f+(l<d-1?" \u00a6 ":""));h=h.replace(/(\u00A6 )$/g,"")+"\\n"}return h+"</"+b+">"}return""};c.functions._StrToMatrix_=function(a,b){var e=[],h=!1,g=!1;e.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,k=a.length;f<k;f++)a[f].match("<"+b+">")?(g=!0,h=a[f].trim().split("<"+b+">"),2==h.length&&""!=h[1]&&e.push(h[1].split(String.fromCharCode("166")).map(d)),
h=!0):(a[f].match("</"+b+">")&&(h=a[f].trim().split("</"+b+">"),2==h.length&&""!=h[0]&&e.push(h[0].split(String.fromCharCode("166")).map(d)),h=!1,f=a.length),h&&e.push(a[f].split(String.fromCharCode("166")).map(d)));c.matrices[b]=e;c.matrices[b].rows=e&&e[0]&&e[0].length?e[0].length:0;c.matrices[b].cols=e&&e.length?e.length:0;c.setVariable(b+".filas",c.matrices[b].rows);c.setVariable(b+".columnas",c.matrices[b].cols)}return g?"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 e="<"+a+">\\n",h=c.getVariable(a+".long_usada")||b._size_||0,g,d=0;d<h;d++)g=b[d],void 0!==g?("number"==typeof g&&(g=parseFloat(g)),e+=g+"\\n"):e+="0\\n";return e+"</"+a+">"}return""};c.functions._StrToVector_=function(a,b){var e=[],h=!1,g=!1;e.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,k=a.length;f<k;f++)a[f].match("<"+b+">")?h=g=!0:(a[f].match("</"+b+">")&&(h=!1,f=a.length),h&&e.push(d(a[f])));
e._size_=e.length;c.vectors[b]=e;c.setVariable(b+".long",e.length);c.setVariable(b+".long_usada",e.length)}return g?"OK":"ERROR"};c.functions._ExecStr_=function(a){return c.functions._ExecBlock_(a,"")};c.functions._ExecBlock_=function(a,b){var e=[],h=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,d=a.length;g<d;g++)a[g].match("<"+b+">")?(h=a[g].trim().split("<"+b+">"),2==h.length&&""!=h[1]&&(e=e.concat(h[1].split(String.fromCharCode("166")))),h=!0):a[g].match("</"+b+">")?(h=a[g].trim().split("</"+
b+">"),2==h.length&&""!=h[0]&&(e=e.concat(h[0].split(String.fromCharCode("166")))),h=!1):h&&(e=e.concat(a[g].split(String.fromCharCode("166"))));g=0;for(d=e.length;g<d;g++)h=e[g].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"}),e,h=null;a.newBlobContent=null;c.functions._Save_=function(d,f){c.evaluator.parent.removeButtonClick();
1500<Date.now()-g&&(g=Date.now(),document.body.appendChild(b),h=f.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),e=new Blob(["\ufeff",h],{type:"text/plain;charset=utf-8"}),b.setAttribute("href",window.URL.createObjectURL(e)),b.setAttribute("download",d),h!=a.newBlobContent&&(b.click(),a.newBlobContent=h),document.body.removeChild(b));return 0};var f=a.newHTML("a",{target:"_blank"});c.functions._SaveSpace_=function(b,e){c.evaluator.parent.removeButtonClick();1500<
Date.now()-g&&(g=Date.now(),document.body.appendChild(f),h=e,f.setAttribute("href",h),f.setAttribute("download",b),h!=a.newBlobContent&&(f.click(),a.newBlobContent=h),document.body.removeChild(f));return 0};var l,r,m=a.newHTML("input",{type:"file"});m.addEventListener("change",function(b){l=b.target.files;r=new FileReader;r.onload=function(b){a.addExternalFileContent(l[0].name,b.target.result);c.setVariable("DJS.fileName",l[0].name);c.setVariable("DJS.fileContent",b.target.result);c.getFunction(c._callback)&&
(c.getFunction(c._callback).apply(c.evaluator,[]),c.evaluator.parent.update());m.value=""};0<l.length&&r.readAsText(l[0])});c.functions._Open_=function(a){c.evaluator.parent.removeButtonClick();1500<Date.now()-g&&(c._callback=a,m.click(),g=Date.now());return 0};c.functions._AnchoDeCadena_=c.functions._strWidth_=function(c,b,e,h){return a.getTextWidth(c,a.convertFont(b+","+e+","+h))};c.functions.R=c.functions._Rojo_=c.functions._Red_=function(c){return(new a.Color(c)).r/255};c.functions.G=c.functions._Verde_=
c.functions._Green_=function(c){return(new a.Color(c)).g/255};c.functions.B=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=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,d=function(g){this.parent=g;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,d){this.definitions[a]=d};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,d){this.variables[a]=d};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(a,d,p){d=0>d?0:f(d);this.vectors[a][d]=p};d.prototype.getVector=function(a,d){d=0>d?0:f(d);return this.vectors[a][d]};d.prototype.setMatrix=function(a,d,p,b){d=0>d?0:f(d);p=0>p?0:f(p);void 0==this.matrices[a][d]&&(this.matrices[a][d]=[]);this.matrices[a][d][p]=b};d.prototype.getMatrix=function(a,d,p){d=0>d?0:f(d);p=0>p?0:f(p);return this.matrices[a][d][p]};d.prototype.setFunction=function(a,d){this.functions[a]=d};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new d;a.Evaluator=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h,e,v,r,u,y,n=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.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};n.prototype.drawText=function(c,e,h,l,r){f=this.evaluator.eval(this.decimals);d=this.evaluator.eval(this.parent.width);
g=this.evaluator.eval(this.parent.font_size);q=e.getColor?e.getColor():e;p=this.textToString(this.text,f,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=p.indexOf("[")&&(p=this.textToString(this.parseSimpleText(p),f,this.fixed));if(this.oldTextStr!==p||this.oldWidth!==d||this.oldSize!==g||this.oldColor!==q||this.oldPosX!==h||this.oldPoxY!==l)b=new a.TextStyle({size:g,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:q,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(p,this.evaluator,b),this.textNodes.update(h,l,f,this.fixed,this.align,this.anchor,q,d);r||this.textNodes.draw(c);this.oldTextStr=p;this.oldWidth=
d;this.oldSize=g;this.oldColor=q;this.oldPosX=h;this.oldPoxY=l};n.prototype.drawRTF=function(a,c,b,e,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,e,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,c,this.evaluator.eval(this.parent.width));h||this.textNodes.draw(a)};n.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");m=[];l="'";h=c=0;e=-1;for(u=a.length;c<u;)v=a.charAt(c),r=a.charAt(c-1),"["===v&&"\\"===r?(m.push(a.substring(h,c-1)+"["),h=c+1):"]"===v&&"\\"===r?(m.push(a.substring(h,c-1)+"]"),h=c+1):"["===v&&-1===e?(m.push(a.substring(h,c)),h=c,e++):"["===v?e++:"]"===v&&0===e?(m.push(this.evaluator.parser.parse(a.substring(h,c+1))),h=c+1,e--):("]"==a.charAt(c)&&(e=0>e?e:e-1),l+=a.charAt(c)),c++;m.push(a.substring(h,c));return m};n.prototype.textToString=function(c,b,e){l="";if("rtfNode"!==
c.type)for(var h=0,d=c.length;h<d;h++)"string"===typeof c[h]?l+=c[h]:(y=this.evaluator.eval(c[h])[0][0],""!==y&&("string"===typeof y?l+=y:Infinity===y?l+="Infinity":-Infinity===y?l+="-Infinity":isNaN(y)||"NaN"===y?l+="NaN":(y=parseFloat(y),y=e?y.toFixed(b):a.removeNeedlessDecimals(y.toFixed(b)),l+=y.toString().replace(".",this.decimal_symbol))));return l};a.TextObject=n;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=[],g=null,b=0,m=a.length;a.charAt(0);var l=!1,c=!1,h=0;f="";for(var e=0;e<m;e++){var v=a.charAt(e);var r=a.charAt(e+1);"\\"===v&&"$"===r&&(c=!0);"{"===v?h++:"}"===v&&(h--,c&&0===h&&(c=!1));c?"_"===v?"{"===r?f+="\\subindex":(f+="\\subindex{"+r+"}",e++):"^"===v?"{"===r?f+="\\superindex":(f+="\\superindex{"+r+"}",e++):f+=v:f+=v}a=f;r=a.charAt(0);for(m=a.length;b<
m;)v=r,r=a.charAt(b+1),l&&("{"===v||"["===v||"\\"===v||" "===v?(l=!1," "===v&&(g={type:"ignore"},d.push(g))):g.value+=v),l||"\\"!==v?l||"{"!==v&&"["!==v?l||"}"!==v&&"]"!==v?l||(g&&"text"===g.type?g.value+=v:g&&"ignore"===g.type?(d.pop(),g=d[d.length-1]):(g={type:"text",value:v},d.push(g))):(g={type:"close",value:v},d.push(g)):(g={type:"open",value:v},d.push(g)):(l=!0,g={type:"command",value:""},d.push(g)),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,g,f){d=this.tokenizer.tokenize(d);var p=new a.TextNode("","textBlock",f,null),b=new a.TextNode("","textLineBlock",f.clone(),null);p.addChild(b);for(var m=[],l=void 0,c=f,h=[f],e,v,r,u,q=!1,n=0,k=d.length;n<k;n++)if("text"===d[n].type)if("color_parameter"===l)v=new a.Color(d[n].value,g);else if("text_size_parameter"===l)r=parseFloat(d[n].value);else if("textLineBlock"===
b.nodeType){e=d[n].value.split(" ");for(var w=0,x=e.length;w<x;w++)""!==e[w]&&b.addChild(new a.TextNode(e[w],"text",c.clone(),null)),w+1<x&&b.addChild(new a.TextNode(" ","space",c.clone(),null))}else b.addChild(new a.TextNode(d[n].value,"text",c.clone(),null));else"command"===d[n].type&&"curlyBracketOpen"===d[n].value?b.addChild(new a.TextNode("{","text",c.clone(),null)):"command"===d[n].type&&"curlyBracketClose"===d[n].value?b.addChild(new a.TextNode("}","text",c.clone(),null)):"command"===d[n].type&&
"squareBracketOpen"===d[n].value?b.addChild(new a.TextNode("[","text",c.clone(),null)):"command"===d[n].type&&"squareBracketClose"===d[n].value?b.addChild(new a.TextNode("]","text",c.clone(),null)):"command"===d[n].type&&"newline"===d[n].value?(0===b.children.length&&b.addChild(new a.TextNode("","text",c.clone(),null)),b=new a.TextNode("","textLineBlock",f.clone(),null),p.addChild(b)):"command"===d[n].type&&"b"===d[n].value?(l="bold",m.push(l)):"command"===d[n].type&&"i"===d[n].value?(l="italic",
m.push(l)):"command"===d[n].type&&"o"===d[n].value?(l="overline",m.push(l)):"command"===d[n].type&&"u"===d[n].value?(l="underline",m.push(l)):"command"===d[n].type&&"color"===d[n].value?(l="color",m.push(l)):"command"===d[n].type&&"ts"===d[n].value?(l="text_size",m.push(l)):"command"===d[n].type&&"sansserif"===d[n].value.toLowerCase()?(l="sansserif",m.push(l)):"command"===d[n].type&&"serif"===d[n].value.toLowerCase()?(l="serif",m.push(l)):"command"===d[n].type&&"monospace"===d[n].value.toLowerCase()?
(l="monospace",m.push(l)):"command"===d[n].type&&"c"===d[n].value?(l="center",m.push(l)):"command"===d[n].type&&"l"===d[n].value?(l="left",m.push(l)):"command"===d[n].type&&"r"===d[n].value?(l="right",m.push(l)):"command"===d[n].type&&"j"===d[n].value?(l="justify",m.push(l)):"command"===d[n].type&&"$"===d[n].value?(l="formula",m.push(l),q=!0):"command"===d[n].type&&"sum"===d[n].value?(l="sum",m.push(l)):"command"===d[n].type&&"prod"===d[n].value?(l="prod",m.push(l)):"command"===d[n].type&&"int"===
d[n].value?(l="integral",m.push(l)):"command"===d[n].type&&"lim"===d[n].value?(l="limit",m.push(l)):"command"===d[n].type&&"sqrt"===d[n].value?(l="radical",m.push(l)):"command"===d[n].type&&"subindex"===d[n].value?(l="subIndex",m.push(l)):"command"===d[n].type&&"superindex"===d[n].value?(l="superIndex",m.push(l)):"command"===d[n].type&&"frac"===d[n].value?(l="numerator",m.push(l)):"open"===d[n].type&&"{"===d[n].value&&void 0!==l?"bold"===l||"italic"===l||"overline"===l||"underline"===l?(c=c.clone(),
c[l]=!0,h.push(c)):"sansserif"===l?(c=c.clone(),c.family="sansserif",h.push(c)):"serif"===l?(c=c.clone(),c.family="serif",h.push(c)):"monospace"===l?(c=c.clone(),c.family="monospaced",h.push(c)):"text_size"===l?l="text_size_parameter":"text_size_text"===l?(c=c.clone(),c.size=r,h.push(c)):"color"===l?l="color_parameter":"color_text"===l?(c=c.clone(),c.color=v,h.push(c)):"center"===l||"left"===l||"right"===l||"justify"===l?(c=c.clone(),c.align=l,h.push(c),b=new a.TextNode("","textLineBlock",c.clone(),
null),p.addChild(b)):"formula"===l?(c=c.clone(),h.push(c),u=new a.TextNode("","formula",c.clone(),null),b.addChild(u),b=u):"subIndex"===l||"superIndex"===l?q?(c=c.clone(),h.push(c),u=new a.TextNode("",l,c.clone(),null),b.addChild(u),b=u):b.addChild(new a.TextNode("subIndex"===l?"_":"^","text",c.clone(),null)):"radical"===l?q&&(u=new a.TextNode("","radical",c.clone(),null),b.addChild(u),b=u,c=c.clone(),h.push(c),u=new a.TextNode("","index",c.clone(),null),b.addChild(u),b=u,l="index"):"index"===l?q&&
(h.pop(),c=h[h.length-1],u=new a.TextNode("","radicand",c.clone(),null),b.addChild(u),b=u,l="radicand"):"sum"===l||"integral"===l||"limit"===l||"prod"===l?q&&(u=new a.TextNode("",l,c.clone(),null),b.addChild(u),b=u,c=c.clone(),h.push(c),u=new a.TextNode("","from",c.clone(),null),b.addChild(u),b=u,l="from",m[m.length-1]=l):"from"===l?q&&(u=new a.TextNode("","to",c.clone(),null),b.addChild(u),b=u,l="to",m[m.length-1]=l):"to"===l?q&&(h.pop(),c=h[h.length-1],u=new a.TextNode("","what",c.clone(),null),
b.addChild(u),b=u,l="what",m[m.length-1]=l):"numerator"===l?q&&(u=new a.TextNode("","fraction",c.clone(),null),b.addChild(u),b=u,c=c.clone(),h.push(c),u=new a.TextNode("","numerator",c.clone(),null),b.addChild(u),b=u,l="numerator"):"denominator"===l&&(u=new a.TextNode("",l,c.clone(),null),b.addChild(u),b=u):"close"===d[n].type&&"}"===d[n].value&&void 0!==l&&("bold"===l||"italic"===l||"overline"===l||"underline"===l||"color_text"===l||"color"===l||"text_size_text"===l||"text_size"===l||"sansserif"===
l||"serif"===l||"monospace"===l?(h.pop(),c=h[h.length-1],m.pop(),l=m[m.length-1]):"color_parameter"===l?l="color_text":"text_size_parameter"===l?l="text_size_text":"center"===l||"left"===l||"right"===l||"justify"===l?(h.pop(),c=h[h.length-1],m.pop(),l=m[m.length-1],d[n+1]&&"command"===d[n+1].type&&"newline"===d[n+1].value?b=p:(b=new a.TextNode("","textLineBlock",c.clone(),null),p.addChild(b))):"formula"===b.nodeType?(q=!1,h.pop(),c=h[h.length-1],m.pop(),l=m[m.length-1],b=b.parent):"subIndex"===b.nodeType||
"superIndex"===b.nodeType?q&&(h.pop(),c=h[h.length-1],m.pop(),l=m[m.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(m.pop(),l=m[m.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(m.pop(),l=m[m.length-1],b=b.parent.parent):"numerator"===b.nodeType?(l="denominator",b=b.parent):"denominator"===b.nodeType&&(h.pop(),c=h[h.length-1],m.pop(),l=m[m.length-1],b=b.parent.parent));var z,A,G=null,J=[];p.children.forEach(function(a){for(var c=
0,b=a.children.length;c<b-1;c++)z=a.children[c],A=a.children[c+1],"text"===z.nodeType&&"text"===A.nodeType&&z.style.equals(A.style)?(null===G&&(G=z,u=z.clone(),G.changeNodeType("word"),G.value="___"+u.value,G.addChild(u)),u=A.clone(),G.addChild(u),J.push(A),G.value+=u.value):G=null});J.forEach(function(a){a.parent.removeChild(a)});p.normalize();p.adjustFontSize();return p};a.DescarTeXParser=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d=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)};d.prototype.clone=function(){return new d(Object.assign({},this))};d.prototype.set=function(a){Object.assign(this,a)};d.prototype.equals=function(a){var d=!0,g;for(g in this)this.hasOwnProperty(g)&&(d=d&&this[g]===a[g]);return d};d.prototype.toString=function(d){/arial|sansserif/i.test(this.family)?
f=a.sansserif_font:/times|serif/i.test(this.family)?f=d?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(f=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+f).trim()};a.TextStyle=d;return a}(descartesJS||{});
descartesJS=function(a){function f(a,b){for(var c=0,h=0;h<b;h++)c+=a[h];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((l[a].ascent+25)*b/l[a].unitsPerEm);c.descent=Math.ceil(Math.abs((l[a].descent-25)*b/l[a].unitsPerEm));c.h=c.ascent+c.descent;return c}if(a.loadLib)return a;
var g=!1,q="#000000",p=2,b=!1;(new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z")).svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";(new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z")).svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";(new Path2D("m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z")).svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
(new Path2D("m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z")).svgData=
"m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z";
var m=function(c,b,e,d){this.type="rtfNode";this.evaluator=d;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=c;this.style=e;this.changeNodeType(b);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};m.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;
break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=
this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};m.prototype.clone=function(){for(var a=new m(this.value,this.nodeType,this.style.clone()),b=0,e=this.children.length;b<e;b++)a.addChild(this.children[b].clone());return a};m.prototype.toStr=function(){for(var a=this.value,b=0,e=this.children.length;b<e;b++)a+=" "+this.children[b].toStr();return a};m.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,e=this.children.length;b<e;b++)a+=this.children[b].stringify()+(b==e-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};m.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};m.prototype.removeChild=function(a){var c=this.children.indexOf(a);-1!==c&&(a.parent=null,this.children.splice(c,1))};m.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};m.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};m.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,e=this.parent.children.length;b<e;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};m.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};m.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};m.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};m.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};m.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,e=a.length;b<e;b++)0===a[b].children.length&&a[b].addChild(new m("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(e=a.length;b<e;b++){var d=a[b];(null===d.prevSibling()||null!==d.prevSibling()&&"text"!==d.prevSibling().nodeType)&&d.parent.insertBefore(d,
new m("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&d.parent.insertAfter(d,new m("","text",d.parent.style))}return this};m.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,e=a.length;b<e;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};m.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))};m.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,h=this.children.length;c<h;c++)this.children[c].propagateStyle(a,b)};m.prototype.update=function(a,h,e,d,g,f,l,m){p=e;b=d;q=l;this.metrics.w=this.metrics.h=0;l=h;if(20<=m)for(e=0;e<this.children.length;e++)this.children[e].breakLines(m);e=0;for(d=this.children.length;e<d;e++){var c=this.children[e];
c.updateLine();c.metrics.offsetX=a;c.metrics.y=h;h+=parseInt(c.metrics.ascent+.5);c.metrics.offsetY=h;g=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);h+=g;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}h=l;f=f||"";f.match("right")?a-=this.metrics.w:f.match("_center")&&(a-=this.metrics.w/2);f.match("bottom")?h-=this.metrics.h:f.match("center_")&&(h-=this.metrics.h/2);f=this.children;e=0;for(d=f.length;e<d;e++)"left"===f[e].style.align?f[e].metrics.offsetX=
a:"right"===f[e].style.align?f[e].metrics.offsetX=a+this.metrics.w-f[e].metrics.w:"center"===f[e].style.align?f[e].metrics.offsetX=a+(this.metrics.w-f[e].metrics.w)/2:"justify"===f[e].style.align&&20<=m&&(g=e<d-1?f[e+1].value:null,f[e].metrics.offsetX=a,"wrap"===g&&f[e].justifyAux(m)),f[e].metrics.y=h,h+=parseInt(f[e].metrics.ascent+.5),f[e].metrics.offsetY=h,g=parseInt(f[e].metrics.descent+.5)+parseInt(1.5+.05*f[e].style.size),h+=g};m.prototype.breakLines=function(c){for(var b,e=0,d=!1,g=[],f=0,
l=this.children.length;f<l;f++)b=this.children[f],d?g.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(),e+=b.metrics.w,e>c&&"space"!==b.nodeType&&0<f&&(d=!0,g.push(b)));if(0<g.length)for(c=new m("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),f=0,l=g.length;f<l;f++)g[f].parent&&g[f].parent.removeChild(g[f]),c.addChild(g[f])};
m.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,g=this.children,f,l=0,m=g.length;l<m;l++){f=g[l];if("text"===f.nodeType){a.ctx.font=f.style.toString();var n=""!==f.value?f.value:a.in_editor?"\u200a":"";f.metrics=d(a.ctx.font);f.metrics.w=a.ctx.measureText(n).width;f.metrics.offsetX=e;Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},
y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===f.nodeType?(a.ctx.font=f.style.toString(),f.metrics=d(a.ctx.font),f.metrics.w=l===m-1?0:c?c:a.ctx.measureText(" ").width,f.metrics.offsetX=e,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===f.nodeType&&(f.updateLine(),f.metrics.offsetX_aux=e,Object.defineProperties(f.metrics,{offsetX:{get:function(){return b.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===f.nodeType&&(a.ctx.font=f.styleString,n=""!==f.value?f.value:a.in_editor?"\u200a":"",f.metrics=d(a.ctx.font),f.metrics.w=a.ctx.measureText(n).width,f.metrics.offsetX=e,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),f.clickCatcher||(f.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+f.metrics.w+"px;height:"+
f.metrics.h+"px;cursor:pointer;"}),f.clickCatcher.rtfNode=f,f.clickCatcher.action=new a.OpenURL(this.evaluator.parent,f.URL),f.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===f.nodeType&&(f.componentNumCtrl=this.evaluator.parent.getControlByCId(f.value),a.ctx.font=f.styleString,f.metrics=d(a.ctx.font),f.metrics.w=f.componentNumCtrl.w,f.metrics.h=f.componentNumCtrl.h,f.metrics.offsetX=e,Object.defineProperties(f.metrics,
{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));"componentSpace"===f.nodeType?(f.componentSpace=this.evaluator.parent.getSpaceByCId(f.value),a.ctx.font=f.styleString,f.metrics=d(a.ctx.font),f.metrics.w=f.componentSpace.w,f.metrics.h=f.componentSpace.h,f.metrics.offsetX=e,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===f.nodeType&&(f.updateFormula(),
f.metrics.marginX=f.metrics.marginY=f.metrics.paddingX=f.metrics.paddingY=0,f.metrics.offsetX_aux=e,Object.defineProperties(f.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),f.metrics.w+=2*f.metrics.paddingX,f.metrics.ascent+=f.metrics.paddingY,f.metrics.descent+=f.metrics.paddingY,f.metrics.h+=2*f.metrics.paddingY,e+=2*f.metrics.marginX);
this.metrics.w+=f.metrics.w+2*f.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,f.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,f.metrics.descent);e+=f.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};m.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 h=this.children,e,g=0,l={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},m=0,q=h.length;m<q;m++){e=h[m];if("text"===e.nodeType){a.ctx.font=e.style.toString(!0);var n=""!==e.value?e.value:a.in_editor?"\u200a":"";e.metrics=d(a.ctx.font);e.metrics.w=a.ctx.measureText(n).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){n=void 0===
e.decimals?p:e.evaluator.eval(e.decimals);var k=void 0===e.fixed?b:e.fixed,w=e.evaluator.eval(e.value);parseFloat(w).toString()===w.toString()&&(w=k?parseFloat(w).toFixed(n):a.removeNeedlessDecimals(parseFloat(w).toFixed(n)),w=(""+w).replace(".",e.decimal_symbol));e.evalValue=w;a.ctx.font=e.style.toString(!0);e.metrics=d(a.ctx.font);e.metrics.marginX=0;e.metrics.paddingX=0;e.metrics.w=a.ctx.measureText(w).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)n=e,n.updateFormula(),n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=g,n.metrics.prevChild=l,Object.defineProperties(n.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.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),n.metrics.w+=2*n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,n.metrics.tmp_ascent=n.metrics.h+(n.metrics.prevChild.metrics.ascent-n.metrics.prevChild.metrics.descent)/2,g+=2*n.metrics.marginX;else if("subIndex"===e.nodeType)n=e,n.updateFormula(),
n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=g,n.metrics.prevChild=l,Object.defineProperties(n.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}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),n.metrics.w+=n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,
n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,this.metrics.descent=n.metrics.ascent+(n.metrics.prevChild.metrics.descent-n.metrics.prevChild.metrics.ascent)/2+n.metrics.descent,g+=n.metrics.marginX;else if("fraction"===e.nodeType){k=e;k.updateFormula();n=k.children;w=n[0];n=n[1];k.metrics.marginX=parseInt(.5+.075*this.style.size);k.metrics.paddingX=0;k.metrics.paddingY=0;var x=Math.max(w.metrics.w,n.metrics.w)+2*k.metrics.paddingX;k.metrics.prevChild=l;k.metrics.offsetX_aux=
g;var z=parseInt(-l.metrics.descent+4*l.metrics.h/9);Object.defineProperties(k.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+z}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-z}}});Object.defineProperties(w.metrics,{parent:{value:k},maxWidth:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(n.metrics,{parent:{value:k},maxWidth:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});k.metrics.w=
x;k.metrics.ascent=w.metrics.h+z+2*k.metrics.paddingY;k.metrics.descent=n.metrics.h-z+2*k.metrics.paddingY;k.metrics.h=w.metrics.h+n.metrics.h+4*k.metrics.paddingY;g+=2*k.metrics.marginX}else if("radical"===e.nodeType){l=e;l.updateFormula();n=l.children;k=n[0];var A=n[1];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=g;Object.defineProperties(l.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}}});n=l.style.size;l.radicalSign={w:n,scaleX:n/722,scaleY:A.metrics.h/1E3};w=parseInt(k.metrics.w-2*l.radicalSign.w/3);Object.defineProperties(l.radicalSign,{parent:{value:l},displaceIndex:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return c.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(k.metrics,{parent:{value:l},displaceIndex:{value:w},fontSize:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:l},
displaceIndex:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});w=k.metrics.w<2*l.radicalSign.w/3?l.radicalSign.w:parseInt(k.metrics.w+l.radicalSign.w/3);l.metrics.w=w+2*l.metrics.paddingX+A.metrics.w;l.metrics.ascent=Math.max(A.metrics.ascent,k.metrics.h+2*n/5)+
l.metrics.paddingY;l.metrics.descent=A.metrics.descent+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;g+=2*l.metrics.marginX}else if("sum"===e.nodeType){k=e;k.updateFormula();n=k.children;w=n[0];x=n[1];var G=n[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();var J=d(a.ctx.font);l=parseInt(1.2*J.h);n=parseInt(.5+780*l/1E3);k.sigmaSign={w:n,h:l,scale:l/1E3};var E=Math.max(x.metrics.w,w.metrics.w,k.sigmaSign.w);k.sigmaSign.parent=k;Object.defineProperties(k.sigmaSign,{sumWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return c.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-x.metrics.descent-(l+J.h)/2-k.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:k},sumWidth:{value:E},newBaselineTo:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
l=w.metrics.ascent+J.descent+(l-J.h)/2+k.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:k},sumWidth:{value:E},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(G.metrics,{parent:{value:k},sumWidth:{value:E},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});k.metrics.w=E+G.metrics.w+3*k.metrics.paddingX;k.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+k.metrics.paddingY;k.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent)+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;
g+=2*k.metrics.marginX}else if("integral"===e.nodeType){k=e;k.updateFormula();n=k.children;w=n[0];x=n[1];G=n[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();J=d(a.ctx.font);E=parseInt(1.2*J.h);var F=parseInt(10.5+529*E/1E3);k.sign={w:F,h:E,scale:E/1E3};k.sign.parent=k;Object.defineProperties(k.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-(E+J.h)/2-x.metrics.descent+E/3;Object.defineProperties(x.metrics,{parent:{value:k},integralWidth:{value:F},
newBaselineTo:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});l=J.descent+w.metrics.ascent/2;Object.defineProperties(w.metrics,{parent:{value:k},integralWidth:{value:F},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});F=Math.max(parseInt(3*F/5)+x.metrics.w,parseInt(2*F/5+w.metrics.w))+k.metrics.paddingX;Object.defineProperties(G.metrics,{parent:{value:k},whatDisplace:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});k.metrics.w=F+G.metrics.w+2*k.metrics.paddingX;k.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+k.metrics.paddingY;k.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent,E-k.metrics.ascent)+k.metrics.paddingY;k.metrics.h=Math.max(k.metrics.ascent+k.metrics.descent,E);g+=2*k.metrics.marginX}else if("prod"===e.nodeType)k=e,k.updateFormula(),n=k.children,w=n[0],x=n[1],G=n[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(),J=d(a.ctx.font),l=parseInt(1.2*J.h),n=parseInt(.5+
876*l/1E3),k.piSign={w:n,h:l,scale:l/1E3},E=Math.max(x.metrics.w,w.metrics.w,k.piSign.w),k.piSign.parent=k,Object.defineProperties(k.piSign,{prodWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+J.descent-(this.h+J.h)/2}}}),n=J.descent-x.metrics.descent-(l+J.h)/2-k.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:k},prodWidth:{value:E},newBaselineTo:{value:n},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}}),l=w.metrics.ascent+J.descent+(l-J.h)/2+k.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:k},prodWidth:{value:E},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(G.metrics,{parent:{value:k},prodWidth:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return c.metrics.offsetY}}}),
k.metrics.w=E+G.metrics.w+3*k.metrics.paddingX,k.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+k.metrics.paddingY,k.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent)+k.metrics.paddingY,k.metrics.h=k.metrics.ascent+k.metrics.descent,g+=2*k.metrics.marginX;else if("limit"===e.nodeType){l=e;l.updateFormula();n=l.children;var D=n[0];k=n[1];n=n[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=
parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=g;Object.defineProperties(l.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();J=d(a.ctx.font);w=parseInt(.5+a.ctx.measureText("l\u00edm").width);x=parseInt(.5+a.ctx.measureText("\u2192").width);G=Math.max(w,D.metrics.w+x+k.metrics.w);
l.limitText={parent:l};Object.defineProperties(l.limitText,{limitWidth:{value:G},limitTextWidth:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});w=J.descent+Math.max(D.metrics.ascent,k.metrics.ascent,2*J.ascent/3)+l.metrics.paddingY;l.limitArrow={parent:l};Object.defineProperties(l.limitArrow,{newBaseline:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w}},y:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(D.metrics,{parent:{value:l},newBaseline:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(k.metrics,{parent:{value:l},arrowWidth:{value:x},newBaseline:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(n.metrics,{parent:{value:l},limitWidth:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
l.metrics.w=G+n.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(n.metrics.ascent,J.ascent)+l.metrics.paddingY;x=0;n=Math.max(D.metrics.descent,k.metrics.descent,n.metrics.descent);if(0!=D.metrics.h||0!=k.metrics.h)x=w,n=Math.max(D.metrics.descent,k.metrics.descent,n-x);l.metrics.descent=x+n+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;g+=2*l.metrics.marginX}else if("matrix"===e.nodeType){w=e;w.updateFormula();n=w.children;x=w.rows;G=w.columns;w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=parseInt(5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=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();J=d(a.ctx.font);E=[];F=[];l=0;for(var B=x*G;l<B;l++){var L=
parseInt(l/G);var I=l%G;E[L]=Math.max(E[L]||0,n[l].metrics.h);F[I]=Math.max(F[I]||0,n[l].metrics.w)}var M=(1+G)*w.metrics.paddingX;for(l=0;l<G;l++)M+=F[l];var O=(1+x)*w.metrics.paddingY;for(l=0;l<x;l++)O+=E[l];k=J.descent-J.h/2;l=0;for(B=x*G;l<B;l++)L=parseInt(l/G),I=l%G,n[l].metrics.offsetX_aux=f(F,I)+(F[I]-n[l].metrics.w)/2+I*w.metrics.paddingX,n[l].metrics.offsetY_aux=f(E,L)+(E[L]-n[l].metrics.h)/2+(1+L)*w.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:w},matrixH:{value:O},
dispY:{value: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+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.w=M;w.metrics.ascent=O/2-k;w.metrics.descent=O/2+k;w.metrics.h=w.metrics.ascent+w.metrics.descent;g+=2*w.metrics.marginX}else if("defparts"===e.nodeType){w=e;w.updateFormula();n=e.children;
x=e.parts;w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=g;Object.defineProperties(w.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();J=d(a.ctx.font);G=0;E=w.metrics.paddingY;k=J.descent-J.h/2;for(l=0;l<x;l++)n[l].metrics.offsetY_aux=E,G=Math.max(G,n[l].metrics.w),E+=n[l].metrics.h+w.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:w},dispY:{value: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}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.defpartsH=E;w.metrics.w=G+4*w.metrics.paddingX;w.metrics.ascent=E/2-k;w.metrics.descent=E/2+k;w.metrics.h=w.metrics.ascent+w.metrics.descent;g+=2*w.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.ascent+=e.metrics.paddingY,e.metrics.descent+=e.metrics.paddingY,e.metrics.h=e.metrics.ascent+e.metrics.descent,1==e.children.length&&"text"==e.children[0].nodeType&&""==e.children[0].value?(e.metrics.w=0,a.in_editor||(e.metrics.ascent=e.metrics.descent=e.metrics.h=0)):e.metrics.w+=2*e.metrics.paddingX;l=e;this.metrics.ascent=Math.max(this.metrics.ascent,e.metrics.tmp_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}};m.prototype.justifyAux=function(a){for(var c=0,b=0,d=0,g=this.children.length;d<g-1;d++)"space"===this.children[d].nodeType?c++:b+=this.children[d].metrics.w;this.updateLine((a-b)/c)};m.prototype.drawTextBlock=function(a){a.fillStyle=q;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);a.shadowColor="transparent"};m.prototype.drawTextLineBlock=function(a){for(var c=0,b=this.children.length;c<b;c++)g=!1,this.children[c].draw(a)};m.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:q;a.font=this.style.toString(g);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=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,c,b);a.strokeStyle=
d}a.fillText(this.value,c,b)}};m.prototype.drawWord=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};m.prototype.drawSpace=function(a){};m.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:q;a.font=this.style.toString(g);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")};m.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(g);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)};m.prototype.drawFormula=function(a){for(var c=0,b=this.children.length;c<b;c++)g=
!0,this.children[c].draw(a);this.drawBorder(a,"blue")};m.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();var 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")};m.prototype.drawNumDen=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);
this.drawBorder(a,"blue")};m.prototype.drawSuperIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};m.prototype.drawSubIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};m.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.save();a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,
this.radicalSign.scaleY);this.drawRadicalSign(a);a.restore();a.beginPath();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};m.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.sigmaSign.x,this.sigmaSign.y);a.scale(this.sigmaSign.scale,
this.sigmaSign.scale);if(this.style.border){var c=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineWidth=parseInt(a.lineWidth/this.sigmaSign.scale);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeStyle=c}this.drawSigmaSign(a);a.restore();c=0;for(var b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};m.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.sign.x,this.sign.y);a.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(a);a.restore();for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};m.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.piSign.x,this.piSign.y);
a.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(a);a.restore();for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};m.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:q;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&a.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};m.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-
this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?
(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};m.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/
2);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+
this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};m.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};m.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)};m.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)};m.prototype.drawRadicalSign=function(a){a.beginPath();
a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.stroke();a.fill()};m.prototype.drawSigmaSign=function(a){a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,
65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.stroke();a.fill()};m.prototype.drawIntegralSign=function(a){a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,
1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.stroke();a.fill()};m.prototype.drawProdSign=function(a){a.beginPath();a.moveTo(876.3561,999.59384);a.lineTo(876.3561,972.20771);a.lineTo(858.75073,972.20771);a.bezierCurveTo(794.19771,
972.20771,761.92121,931.12852,761.92121,847.99206);a.lineTo(761.92121,144.75542);a.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);a.lineTo(876.3561,1.7633057E-4);a.lineTo(1.184082E-5,1.7633057E-4);a.lineTo(1.184082E-5,27.386304);a.lineTo(16.627304,27.386304);a.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);a.lineTo(115.41298,865.59743);a.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);a.lineTo(1.184082E-5,972.20771);
a.lineTo(1.184082E-5,999.59384);a.lineTo(359.93198,999.59384);a.lineTo(359.93198,972.20771);a.lineTo(329.61162,972.20771);a.bezierCurveTo(265.0586,972.20771,243.54093,932.10659,243.54093,841.14553);a.lineTo(243.54093,64.553192);a.lineTo(633.79325,64.553192);a.lineTo(633.79325,841.14553);a.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);a.lineTo(516.42413,972.20771);a.lineTo(516.42413,999.59384);a.closePath();a.stroke();a.fill()};m.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([])};m.prototype.toRTF=function(){var a=[],b=[],e="";this.mergeTextNodes();for(var d=0,g=this.children.length;d<g;d++){var f=this.children[d];"textLineBlock"===f.nodeType&&(e+=f.toRTFAux(a,b)+(1<g&&d<g-1?"\\par":""))}f="{\\fonttbl";d=0;for(g=a.length;d<g;d++)f+="\\f"+d+"\\fcharset0 "+a[d]+";";
a="";if(0<b.length){a="{\\colortbl";d=0;for(g=b.length;d<g;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(f+"}")+a+e+"}"};m.prototype.toRTFAux=function(a,b){for(var c,d,g,f=null,h="",l,k,m,p,z,A=0,G=this.children.length;A<G;A++)l=k="",c=this.children[A],m=this.addToFontTable(c.style.family,a),p=c.style.size,z=this.addToColorTable(c.style.color,b),null===z&&0<b.length&&(z=this.addToColorTable(q,b)),z!==f&&(l+="\\cf"+z,f=z),m!==d&&(l+="\\f"+m,d=m),p!==g&&(l+="\\fs"+2*p,g=p),c.style.italic&&(l+="\\i",k="\\i0"+
k),c.style.bold&&(l+="\\b",k="\\b0"+k),c.style.underline&&(l+="\\ul",k="\\ulnone"+k),c.style.overline&&(l+="\\ol",k="\\olnone"+k),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==l?l+" "+c.value+k:""!==h&&"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=c):"formula"===c.nodeType?h+="{\\*\\mjaformula"+c.formulaToRTF(d,g,f,a,b)+"}":"componentSpace"===c.nodeType?h+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&
(h+="{\\*\\component\\NumCtrl "+c.value+"}");return h};m.prototype.formulaToRTF=function(a,b,e,d,g){for(var c,f="",h,l,m,p,r=0,v=this.children.length;r<v;r++)h=l="",c=this.children[r],m=this.addToFontTable(c.style.family,d),p=this.addToColorTable(c.style.color,g),null===p&&0<g.length&&(p=this.addToColorTable(q,g)),m!==a&&(h+="\\f"+m,a=m),p!==e&&(h+="\\cf"+p,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(e=p),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:"}"!==f.charAt(f.length-1)?" "+c.value:c.value,f+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,f+=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||"prod"===c.nodeType||"limit"===c.nodeType||"from"===c.nodeType||"to"===c.nodeType||"what"===c.nodeType||"element"===c.nodeType?f+="{\\"+c.nodeType+c.formulaToRTF(a,b,e,d,g)+"}":"numerator"===c.nodeType?f+="{\\num"+c.formulaToRTF(a,b,e,d,g)+"}":"denominator"===c.nodeType?f+="{\\den"+c.formulaToRTF(a,b,e,d,g)+"}":"superIndex"===c.nodeType?f+="{\\supix"+c.formulaToRTF(a,b,e,d,g)+"}":"subIndex"===c.nodeType?f+="{\\subix"+c.formulaToRTF(a,
b,e,d,g)+"}":"matrix"===c.nodeType?f+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,e,d,g)+"}":"defparts"===c.nodeType&&(f+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,e,d,g)+"}");return f};m.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};m.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};m.prototype.mergeTextNodes=function(){for(var a=[],b=null,e=0,d=this.children.length;e<d;e++)"text"===this.children[e].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[e].style)&&(this.children[e].value=b.value+this.children[e].value,a.push(b)):this.children[e].mergeTextNodes(),b=this.children[e];e=0;for(d=a.length;e<
d;e++)this.removeChild(a[e])};var l={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=String.fromCharCode,d,g,q,p,b,m,l,c,h,e,v,r=function(){};r.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];g="";p=q=0;m=a.charAt(0);l=!1;for(c="text";q<a.length;)b=m,m=a.charAt(q+1),l?"\\"===m||"{"===m||"}"===
m||" "===m||";"===m?(l=!1,g+=b," "===m?(q++,m=a.charAt(q+1),v=!0):v=!1,(h=g.match(/^'([0-9a-f]{2})/))?(e="","text"===c&&(e=d.pop().value),g=e+=f(parseInt(h[1],16))+g.substring(3)):(h=g.match(/^u[0-9]+/))?(e="","text"===c&&(e=d.pop().value),g=e+=f(h[0].substring(1))):("{"===g||"}"===g||"\\"==b?(d.push({type:"text",value:g+(v?" ":"")}),c="text"):(d.push({type:"controlWord",value:g}),c="controlWord"),g="")):"{"==b||"}"==b||"\\"==b?(l=!1,d.push({type:"text",value:b}),c="text"):g+=b:"\\"===b?(l=!0,""!==
g&&(d.push({type:"text",value:g}),c="text",g="")):"{"===b?(p++,""!==g&&(d.push({type:"text",value:g}),g=""),d.push({type:"openBlock",value:p}),c="openBlock"):"}"===b?(""!==g&&(d.push({type:"text",value:g}),g=""),d.push({type:"closeBlock",value:p}),c="closeBlock",p--):g+=b,q++;""!==g&&d.push({type:"text",value:g});return d};a.RTFTokenizer=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,d,g,q,p,b,m,l,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F,D,B,L,I,M,O,H,P=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};P.prototype.parse=function(C){d=this.tokenizer.tokenize(C);g={};p=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(q=d[0].value;"closeBlock"!==d[p].type&&d[p].value!==q;)g[d[p].value]=d[p+2].value.substring(0,d[p+2].value.length-1),p+=3;p++}b={};m=0;if("openBlock"===d[p].type&&"colortbl"===d[p+1].value){q=
d[p++].value;for(p++;"closeBlock"!==d[p].type&&d[p].value!==q;)l=parseInt(d[p++].value.substring(3)).toString(16),c=parseInt(d[p++].value.substring(5)).toString(16),h=parseInt(d[p++].value.substring(4)).toString(16),";"===d[p].value&&p++,b[m++]="#"+(2>l.length?"0"+l:l)+(2>c.length?"0"+c:c)+(2>h.length?"0"+h:h);p++}y=u=r=null;M=I=L=G=A=z=x=w=k=n=!1;J=[new a.TextStyle];E=J[0];D=F=-1;B=[];e=O=new a.TextNode("","textBlock",E,this.evaluator);v=new a.TextNode("","textLineBlock",E,this.evaluator);e.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;C=p;for(var N=d.length;C<N;C++){if("controlWord"==d[C].type)if(g[d[C].value])E.set({family:g[d[C].value]});else if(d[C].value.match(/^fs(\d+)/))E.set({size:parseInt(d[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==d[C].value)E.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==d[C].value)E.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==d[C].value)E.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==d[C].value)E.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==d[C].value)E.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==d[C].value)E.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==d[C].value)E.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==d[C].value)E.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(d[C].value.match(/^cf(\d+)/))E.set({color:b[parseInt(d[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=E.color);else if("par"==d[C].value){e=new a.TextNode("","textLineBlock",E.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(e);v=e}else if("mjaformula"==d[C].value)O.hasFormula=!0,D=F,n=!0,e=new a.TextNode("","formula",E.clone(),this.evaluator),v.addChild(e),v=e,B[B.length-1]=e;else if("fraction"==d[C].value||"radicand"==d[C].value||"radical"==d[C].value||"what"==d[C].value||"sum"==d[C].value||"integral"==
d[C].value||"limit"==d[C].value){var K=B[B.length-2].style.clone();e=new a.TextNode("",d[C].value,K,this.evaluator);B[B.length-2].addChild(e);B[B.length-1]=e}else"index"==d[C].value?(K=B[B.length-2].style.clone(),K.size=f(parseInt(K.size-.5*K.size),8),e=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-2].addChild(e),B[B.length-1]=e):"to"==d[C].value||"from"==d[C].value?(K=B[B.length-2].style.clone(),K.size=f(parseInt(K.size-.2*K.size),8),e=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-
2].addChild(e),B[B.length-1]=e):"num"==d[C].value||"den"==d[C].value?(K=B[B.length-2].style.clone(),K.size=f(Math.round(K.size-.1*K.size),8),"num"==d[C].value?e=new a.TextNode("","numerator",K,this.evaluator):"den"==d[C].value&&(e=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(e),B[B.length-1]=e):"subix"==d[C].value||"supix"==d[C].value?(K=B[B.length-2].style.clone(),K.size=f(Math.floor(K.size-.33*K.size),8),"subix"==d[C].value?e=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==d[C].value&&(e=new a.TextNode("","superIndex",K,this.evaluator)),e.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(e),B[B.length-1]=e):"defparts"==d[C].value||"matrix"==d[C].value||"element"==d[C].value?(K=B[B.length-2].style.clone(),e=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-2].addChild(e),B[B.length-1]=e,"defparts"==d[C].value?y=e:"matrix"==d[C].value&&(u=e,u.matrix_type=0)):"parts"==d[C].value?G=!0:"type"==d[C].value?x=!0:"rows"==d[C].value?z=!0:"columns"==
d[C].value?A=!0:"expr"==d[C].value?(O.stableWidth=!1,k=!0):"decimals"==d[C].value?w=!0:"fixed1"==d[C].value?r.fixed=!0:"fixed0"==d[C].value?r.fixed=!1:"component"!=d[C].value&&("NumCtrl"==d[C].value?L=!0:"Space"==d[C].value?I=!0:"hyperlink"==d[C].value&&(M=!0));if("text"==d[C].type)if(G)y.parts=parseInt(d[C].value),G=!1;else if(x)u.matrix_type=parseInt(d[C].value),x=!1;else if(z)u.rows=parseInt(d[C].value),z=!1;else if(A)u.columns=parseInt(d[C].value),A=!1;else if(w)r.decimals=this.evaluator.parser.parse(d[C].value+
""),w=!1;else if(M){H=d[C].value.split("|")[0];K=E.clone();e=new a.TextNode(H,"hyperlink",K,this.evaluator);e.URL=d[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(e);M=!1}else if(L)e=new a.TextNode(d[C].value,"componentNumCtrl",E.clone(),this.evaluator),v.addChild(e),L=!1;else if(I)e=new a.TextNode(d[C].value,"componentSpace",E.clone(),this.evaluator),v.addChild(e),I=!1;else if(k)K=B[B.length-2].style.clone(),H=this.evaluator.parser.parse(d[C].value),
e=new a.TextNode(H,"dynamicText",K,this.evaluator),B[B.length-2].addChild(e),r=B[B.length-1]=e,k=!1;else if(k||n)!k&&n&&(H=d[C].value,e=new a.TextNode(H,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(e));else{H=d[C].value;e=new a.TextNode(H,"text",E.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(e)}else if("openBlock"==d[C].type)F=d[C].value,E=E.clone(),J.push(E),B.push(null);else if("closeBlock"==
d[C].type)d[C].value==D&&(D=-1,n=!1,v=v.parent),J.pop(),E=J[J.length-1],B.pop();else if("("==d[C].type||")"==d[C].type)K=B[B.length-1].style.clone(),K.italic="",e=new a.TextNode(d[C].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(e);else if("+"==d[C].type||"-"==d[C].type||"*"==d[C].type||"="==d[C].type)e=new a.TextNode(d[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(e)}return O.normalize()};a.RTFParser=P;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m,l,c,h,e,v=function(b,c){this.parent=b;d=this.evaluator=this.parent.evaluator;g=d.parser;this.id="";this.type="2D";this.xExpr=g.parse("0");this.yExpr=g.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=g.parse("1");this.fixed=!1;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=
b.displaceRegionWest||0;Object.assign(this,c);this.initSpace()};v.prototype.initSpace=function(){var a=this;f=a.parent;d=a.evaluator;q=a.id;a.resizable||(a.displaceRegionNorth=f.displaceRegionNorth||0,a.displaceRegionSouth=f.displaceRegionSouth||0,a.displaceRegionEast=f.displaceRegionEast||0,a.displaceRegionWest=f.displaceRegionWest||0,l=parseInt(f.container.width),m=parseInt(f.container.height),void 0!=a.wExpr&&(a.w=parseInt(l-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(m-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=d.parser.parse((parseInt(l-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=d.parser.parse((parseInt(m-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=d.eval(a.xExpr)+a.displaceRegionWest,a.y=d.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&
(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(p=m-a.y,a.h>p&&(a.h=p)):(p=a.h+a.y,a.h=p>=m?m:p),0<=a.x?(b=l-a.x,a.w>b&&(a.w=b)):(b=a.w+a.x,a.w=b>=l?l:b));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=f.getImage(a.imageSrc));a.OxExpr&&(h=a.OxExpr,"%"===h[h.length-1]?a.Ox=a.w*parseFloat(h)/100:(c=parseFloat(h),c!=h&&(c=0),a.Ox=c));a.OyExpr&&(e=a.OyExpr,"%"===e[e.length-1]?a.Oy=a.h*parseFloat(e)/100:(c=parseFloat(e),c!=e&&(c=0),a.Oy=c));""!==a.id&&2!==f.version?
(d.setVariable(q+"._w",a.w),d.setVariable(q+"._h",a.h),d.setVariable(q+".escala",a.scale),d.setVariable(q+".Ox",a.Ox),d.setVariable(q+".Oy",a.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)):(c=d.getVariable("_w"),void 0===c&&(c=a.w),d.setVariable("_w",c),c=d.getVariable("_h"),void 0===c&&(c=a.h),d.setVariable("_h",c),c=d.getVariable("escala"),void 0===c&&(c=a.scale),d.setVariable("escala",
c),c=d.getVariable("Ox"),void 0===c&&(c=a.Ox),d.setVariable("Ox",c),c=d.getVariable("Oy"),void 0===c&&(c=a.Oy),d.setVariable("Oy",c),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&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;d.setFunction(q+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};v.prototype.addCtr=
function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+
this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var 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 p=f.parent.evaluator.parser,b=0,m=f.ctrs.length;b<m;b++)f.ctrs[b].expresion=p.parse("(0,"+(f.vSpace+23+35*b)+","+f.width+",35)"),f.ctrs[b].update();f.numCtr=m;b=new a.Button(f.parent,{region:"external",name:"english"==f.language?"about":"cr\u00e9ditos",font_size:p.parse("15"),expresion:p.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:p.parse("15"),action:"config",expresion:p.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:p.parse("15"),action:"init",expresion:p.parse("(0,"+(f.vSpace+23+35*m)+","+f.width/2+",25)")})).update();(new a.Button(f.parent,{region:"external",name:"english"==f.language?"clear":"limpiar",font_size:p.parse("15"),action:"clear",expresion:p.parse("("+f.width/
2+","+(f.vSpace+23+35*m)+","+f.width/2+",25)")})).update();p=new a.Button(f.parent,{region:"external",name:"english"==f.language?"close":"cerrar",font_size:p.parse("15"),expresion:p.parse("("+f.width/4+","+(f.vSpace+46+35*m)+","+f.width/2+",25)")});p.update();p.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,g=2*Math.PI,q=a.convertFont("Serif,BOLD+ITALIC,16"),p=a.convertFont("Monospaced,PLAIN,12"),b,m,l,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q,R=function(c,e){b=e=a.Space.call(this,c,e)||this;b.ratio=c.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio,height:b.h*b.ratio});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio,height:b.h*b.ratio});
b.canvas.style=b.backCanvas.style=(0<b.border_width?"border:"+b.border_width+"px solid "+b.border_color.getColor()+";":"")+(b.border_radius?"border-radius:"+b.border_radius+"px;":"");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:"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 d=b.id+".image";b.parent.images[d]=b.canvas;b.parent.images[d].ready=1;b.parent.images[d].complete=b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);d=b.id+".back";b.parent.images[d]=b.backCanvas;b.parent.images[d].ready=1;b.parent.images[d].complete=b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);d=""!==b.id&&2!==c.version?b.id+
".":"";b.OxStr=d+"Ox";b.OyStr=d+"Oy";b.scaleStr=d+"escala";b.wStr=d+"_w";b.hStr=d+"_h";b.mxStr=d+"mouse_x";b.myStr=d+"mouse_y";b.mpressedStr=d+"mouse_pressed";b.mclickedStr=d+"mouse_clicked";b.mclickIzqStr=d+"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};c.evaluator.setVariable(b.id+"._refresh_back_",1);return e};$jscomp.inherits(R,
a.Space);R.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")};R.prototype.update=function(a){b=this;m=b.evaluator;l=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),N=b.evaluator.eval(b.hModExpr),b.old_w!=C||b.old_h!=N)b.w=C,b.h=N,b.w_2=b.w/2,b.h_2=
b.h/2,m.setVariable(b.wStr,b.w),m.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 m.setVariable(b.wStr,b.w),m.setVariable(b.hStr,b.h);b.drawIfValue=0<m.eval(b.drawif);if(b.drawIfValue){h=b.x!==m.eval(b.xExpr)+b.displaceRegionWest;e=b.y!==m.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth;
b.spaceChange=a||h||e||b.drawBefore!==b.drawIfValue||b.Ox!==m.getVariable(b.OxStr)||b.Oy!==m.getVariable(b.OyStr)||b.scale!==m.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=h?m.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=e?m.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=m.getVariable(b.OxStr);b.Oy=m.getVariable(b.OyStr);b.scale=m.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));m.setVariable(b.scaleStr,b.scale);if(h||
e)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"};R.prototype.drawBackground=function(){b=this;m=b.evaluator;c=b.backCtx;c.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);c.fillStyle=b.backColor=b.background.getColor();
c.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===b.bg_display?c.drawImage(b.image,0,0):"stretch"===b.bg_display?c.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(c.fillStyle=c.createPattern(b.image,"repeat"),c.fillRect(0,0,b.w,b.h)):"imgcenter"===b.bg_display&&c.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));r=b.scale;u=0;for(y=0>b.w+b.h?0:b.w+b.h;r>y;)r/=10,u++;for(;r<y/10;)r*=10;c.lineWidth=1;
""!==b.net&&(c.strokeStyle=b.net.getColor(),b.drawMarks(c,r/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&""!==b.net&&""!==b.net10)c.strokeStyle=b.net10.getColor(),b.drawMarks(c,r,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");c.strokeStyle=b.axes.getColor();c.beginPath();"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(c.moveTo(0,f(b.h/2+b.Oy)+.5),c.lineTo(b.w,f(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(c.moveTo(f(b.w/
2+b.Ox)+.5,0),c.lineTo(f(b.w/2+b.Ox)+.5,b.h));c.lineWidth=1.2;c.stroke();c.lineWidth=1;b.drawMarks(c,r,4,a);b.drawMarks(c,r/2,2,a);b.drawMarks(c,r/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)c.fillStyle=""!==b.axes?b.axes.getColor():"#000",c.font=q,c.textAlign="right",c.textBaseline="alphabetic","no"!=b.x_axis&&c.fillText(b.x_axis,f(b.w)-2,f(b.h/2+b.Oy)+12),"no"!=b.y_axis&&c.fillText(b.y_axis,f(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(c.fillStyle=b.axes.getColor(),c.font=q,c.textAlign="start",c.textBaseline=
"bottom",r>(b.w+b.h)/2?b.drawNumbers(c,r/5,r<=b.scale?u+1:u):r>(b.w+b.h)/4?b.drawNumbers(c,r/2,r<=b.scale?u+1:u):b.drawNumbers(c,r,u));a=0;for(var e=this.backGraphics.length;a<e;a++)this.backGraphics[a].draw()};R.prototype.draw=function(){b=this;c=b.ctx;m.getVariable(b.id+"._refresh_back_")&&c.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,e=b.graphics.length;a<e;a++)v=b.graphics[a],""!==v.trace&&b.drawTrace&&v.drawTrace(),v.draw();a=0;for(e=b.graphicsCtr.length;a<e;a++)b.graphicsCtr[a].draw();
""!=b.text&&b.click&&"L"===b.whichBtn&&(c.save(),c.strokeStyle=c.fillStyle=b.text.getColor(),c.lineWidth=1,c.font=p,c.textAlign="center",c.textBaseline="alphabetic",D=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(parseInt(b.scale).toString().length+1),B=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(parseInt(b.scale).toString().length+1),L="("+D+","+B+")",I=f(c.measureText(L).width/2),M=b.getAbsoluteX(b.mouse_x),O=b.getAbsoluteY(b.mouse_y),H=f(M),P=f(O-10),H+I>b.w?H=b.w-I:0>H-I&&(H=I),P+1>
b.h?P=b.h:0>P-14&&(P=15),c.fillText(L,H,P),c.beginPath(),c.arc(M,O,2.5,0,g,!0),c.stroke(),c.restore())};R.prototype.drawMarks=function(a,b,c,e){n=this.w;k=this.h;E=G=0;J=n;F=k;z=f(n/2+this.Ox);A=f(k/2+this.Oy);0<=c&&(G=z-c,J=z+c,E=A-c,F=A+c);a.beginPath();if(!e||e&&!e.match("x"))for(c=-d(z/b);(w=z+d(c*b))<n;c++)a.moveTo(w+.5,E+.5),a.lineTo(w+.5,F+.5);if(!e||e&&!e.match("y"))for(c=-d(A/b);(x=A+d(c*b))<k;c++)a.moveTo(G+.5,x+.5),a.lineTo(J+.5,x+.5);a.stroke()};R.prototype.drawNumbers=function(a,b,c){n=
this.w;k=this.h;z=f(n/2+this.Ox);A=f(k/2+this.Oy);for(c=-d(z/b);(w=z+d(c*b))<n;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),w+1,A-2);for(c=-d(A/b);(x=A+d(c*b))<k;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),z+5,x+5)};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.click=0,f.evaluator.setVariable(f.mpressedStr,
0),f.evaluator.setVariable(f.mclickedStr,1),f.evaluator.setVariable(f.mclickIzqStr,1),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),f.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);"R"===f.whichBtn&&(window.removeEventListener("mousemove",
d),f.posZoom==f.posZoomNew&&a.showConfig&&(f.parent.externalSpace.show(),f.posZoom=!1,f.posZoomNew=!0));window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c);f.parent.deactivateGraphicControls();f.parent.update()}function e(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.evaluator.setVariable(f.mclickedStr,0);
f.evaluator.setVariable(f.mclickIzqStr,0);f.parent.update()}function d(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function g(b){b.preventDefault();b.stopPropagation();f.fixed||(f.posNext=a.getCursorPosition(b,f.container),K=f.posAnte.x-f.posNext.x,Q=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-K),f.evaluator.setVariable(f.OyStr,f.Oy-Q));e(b)}var f=
this;f.posZoom=f.posZoomNew=null;f.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",e);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(),e(a),window.addEventListener("touchmove",g),window.addEventListener("touchend",b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",e);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();f.parent.clearClick();f.click=1;f.parent.deactivateGraphicControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",
c),f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,window.addEventListener("mousemove",d))):"L"===f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),e(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){f.click=0;f.evaluator.setVariable(f.mpressedStr,
0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c)})};a.Space2D=R;return a}(descartesJS||{});
descartesJS=function(a){var f,d,g;function q(b,c){H=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));P=a.add3D(b,a.scalarProduct3D(H,-2));C=a.norm3D(P);return 0!==C?a.scalarProduct3D(P,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var p=Math.floor,b=Math.max,m=Math.cos,l=Math.sin,c,h,e,v,r,u,y,n,k,w,x,z,A,G,J,E,F=[],D,B,L,I,M,O,H,P,C,N,K,Q=function(b,c){e=c=a.Space.call(this,b,c)||this;e.backCanvas=a.newHTML("canvas",{id:e.id+"_background",width:e.w+"px",height:e.h+"px"});e.canvas=a.newHTML("canvas",
{id:e.id+"_canvas",width:e.w+"px",height:e.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+e.zIndex+";"});e.ctx=e.canvas.getContext("2d");e.ctx.imageSmoothingEnabled=!1;e.canvas.style=e.backCanvas.style=(0<e.border_width?"border:"+e.border_width+"px solid "+e.border_color.getColor()+";":"")+(e.border_radius?"border-radius:"+e.border_radius+"px;":"");var d=e.id+".image";e.parent.images[d]=e.canvas;e.parent.images[d].ready=1;e.parent.images[d].complete=!0;e.parent.images[d].canvas=!0;e.evaluator.setVariable(d,
d);e.graphicControlContainer=a.newHTML("div",{id:e.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+e.zIndex+";"});e.numericalControlContainer=a.newHTML("div",{id:e.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+e.zIndex+";"});e.container=a.newHTML("div",{id:e.id,class:"DescartesSpace3DContainer",style:"z-index:"+e.zIndex+";"});e.container.appendChild(e.backCanvas);e.container.appendChild(e.canvas);e.container.appendChild(e.graphicControlContainer);
e.container.appendChild(e.numericalControlContainer);b.container.insertBefore(e.container,b.loader);e.eye={x:0,y:0,z:0};e.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var g=e.lights.length;d<g;d++)e.lights[d]=a.normalize3D(e.lights[d]);e.light3={x:0,y:0,z:0};e.intensity=[.4,.5,.3,0];e.userIntensity=0;e.dim=1;e.tmpIntensity=[];e.OxStr=e.id+".Ox";e.OyStr=e.id+".Oy";e.scaleStr=e.id+".escala";e.wStr=e.id+"._w";e.hStr=e.id+"._h";e.obsStr=e.id+".observador";e.ojoXStr=
e.id+".Ojo.x";e.ojoYStr=e.id+".Ojo.y";e.ojoZStr=e.id+".Ojo.z";e.rotZStr=e.id+".rot.z";e.rotYStr=e.id+".rot.y";e.userIDimStr=e.id+".userIlum.dim";e.userIIStr=e.id+".userIlum.I";e.userIxStr=e.id+".userIlum.x";e.userIyStr=e.id+".userIlum.y";e.userIzStr=e.id+".userIlum.z";e.evaluator.setVariable(e.rotZStr,0);e.evaluator.setVariable(e.rotYStr,0);e.evaluator.setVariable(e.userIDimStr,e.dim);e.evaluator.setVariable(e.userIIStr,e.userIntensity);e.evaluator.setVariable(e.userIxStr,0);e.evaluator.setVariable(e.userIyStr,
0);e.evaluator.setVariable(e.userIzStr,0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},e);e.evaluator.setFunction(e.id+"._X3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(e);return K.projVert[0].x});e.evaluator.setFunction(e.id+"._Y3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(e);return K.projVert[0].y});e.resizable&&(e.wModExpr=b.evaluator.parser.parse(e.wModExpr),e.hModExpr=b.evaluator.parser.parse(e.hModExpr));
e.ratio=1;e.addEvents();return c};$jscomp.inherits(Q,a.Space);Q.prototype.init=function(a){e=this;e.initSpace();e.canvas&&(e.canvas.width=e.backCanvas.width=e.w,e.canvas.height=e.backCanvas.height=e.h,e.canvas.style.width=e.backCanvas.style.width=e.w+"px",e.canvas.style.height=e.backCanvas.style.height=e.h+"px");e.w_2=e.w/2;e.h_2=e.h/2;e.w_plus_h=e.w+e.h;e.oldMouse={x:0,y:0};e.S={x:e.h/1080*-20.6*(40/e.scale),y:0,z:0};e.Ojo={x:3*e.w_2,y:0,z:0};e.evaluator.setVariable(e.ojoXStr,e.Ojo.x);e.evaluator.setVariable(e.ojoYStr,
e.Ojo.y);e.evaluator.setVariable(e.ojoZStr,e.Ojo.z)};Q.prototype.update=function(a){e=this;c=e.evaluator;h=e.parent;c.setVariable(e.wStr,e.w);c.setVariable(e.hStr,e.h);e.drawIfValue=0<c.eval(e.drawif);if(e.drawIfValue){e.resizable&&(wModExpr=e.evaluator.eval(e.wModExpr),hModExpr=e.evaluator.eval(e.hModExpr),e.old_w!=wModExpr||e.old_h!=hModExpr)&&(e.w=wModExpr,e.h=hModExpr,e.w_2=e.w/2,e.h_2=e.h/2,c.setVariable(e.wStr,e.w),c.setVariable(e.hStr,e.h),e.old_w=e.w,e.old_h=e.h,e.canvas.width=e.backCanvas.width=
e.w*e.ratio,e.canvas.height=e.backCanvas.height=e.h*e.ratio,e.canvas.style.width=e.backCanvas.style.width=e.w+"px",e.canvas.style.height=e.backCanvas.style.height=e.h+"px",a=!0,e.S={x:e.h/1080*-20.6*(40/e.scale),y:0,z:0},e.Ojo={x:3*e.w_2,y:0,z:0},e.evaluator.setVariable(e.ojoXStr,e.Ojo.x),e.evaluator.setVariable(e.ojoYStr,e.Ojo.y),e.evaluator.setVariable(e.ojoZStr,e.Ojo.z));u=e.x!==c.eval(e.xExpr)+e.displaceRegionWest;y=e.y!==c.eval(e.yExpr)+h.plecaHeight+e.displaceRegionNorth;e.spaceChange=a||u||
y||e.drawBefore!==e.drawIfValue||e.Ox!==c.getVariable(e.OxStr)||e.Oy!==c.getVariable(e.OyStr)||e.Ojo.x!==c.getVariable(e.ojoXStr)||e.Ojo.y!==c.getVariable(e.ojoYStr)||e.Ojo.z!==c.getVariable(e.ojoZStr)||e.scale!==c.getVariable(e.scaleStr);e.x=u?c.eval(e.xExpr)+e.displaceRegionWest:e.x;e.y=y?c.eval(e.yExpr)+h.plecaHeight+e.displaceRegionNorth:e.y;e.Ojo.x=c.getVariable(e.ojoXStr);e.Ojo.y=c.getVariable(e.ojoYStr);e.Ojo.z=c.getVariable(e.ojoZStr);e.Ox=c.getVariable(e.OxStr);e.Oy=c.getVariable(e.OyStr);
e.scale=c.getVariable(e.scaleStr);e.drawBefore=e.drawIfValue;if(a||void 0==e.observer){a=0;for(var d=e.parent.controls.length;a<d;a++)e.parent.controls[a].id===e.obsStr&&(N=!0);e.observer=N?c.getVariable(e.obsStr)||2.5*e.w_plus_h:2.5*e.w_plus_h;e.observer=b(e.observer,.25*e.w_plus_h);c.setVariable(e.obsStr,e.observer)}1E-6>e.scale?(e.scale=1E-6,c.setVariable(e.scaleStr,1E-6)):1E6<e.scale&&(e.scale=1E6,c.setVariable(e.scaleStr,1E6));if(u||y)e.container.style.left=e.x+"px",e.container.style.top=e.y+
"px";e.container.style.display="block";e.dim=c.getVariable(e.userIDimStr);e.userIntensity=c.getVariable(e.userIIStr);e.light3={x:parseInt(c.getVariable(e.userIxStr)),y:parseInt(c.getVariable(e.userIyStr)),z:parseInt(c.getVariable(e.userIzStr))};e.updateCamera();e.draw()}else e.container.style.display="none"};Q.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};Q.prototype.rotateVertex=function(b){w=a.degToRad(e.evaluator.getVariable(e.rotZStr));x=m(w);z=l(w);f=b.x*
x-b.y*z;d=b.x*z+b.y*x;g=b.z;w=a.degToRad(e.evaluator.getVariable(e.rotYStr));x=m(w);z=l(w);return{x:g*z+f*x,y:d,z:g*x-f*z}};Q.prototype.project=function(a){e=this;this.evaluator.getVariable("URL.oldProj");var b=e.eye.x/(a.x-e.eye.x);return{x:e.getAbsoluteX(b*(e.eye.y-a.y)),y:e.getAbsoluteY(b*(e.eye.z-a.z)),z:e.eye.x-a.x}};Q.prototype.computeColor=function(b,c,e){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));I=a.subtract3D(this.eye,c.average);M=a.norm3D(I);O=a.scalarProduct3D(I,
1/M);this.lights[3]=a.subtract3D(this.light3,c.average);E=a.norm3D(this.lights[3]);for(var d=0,g=this.intensity.length-1;d<g;d++)F[d]=this.intensity[d]*this.dim;F[3]=this.userIntensity*this.userIntensity/E||0;D=e?this.dim/2:this.dim/4;B=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);d=0;for(g=this.lights.length;d<g;d++)e?(B=Math.max(0,a.dotProduct3D(q(this.lights[d],L),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[d],L)),D+=F[d]*B;D=Math.min(D,1);A=p(b.r*D);G=p(b.g*D);J=p(b.b*D);
return"rgba("+A+","+G+","+J+","+b.a+")"};Q.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,
"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];for(var c=a+1;c<b;c++)r=this.graphics[c],v.splitFace(r),r.splitFace(v);this.primitives=this.primitives.concat(v.primitives||[])}else for(a=
0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)r=this.graphics[c],r.split&&v.splitFace(r);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<
b;a++)this.graphicsCtr[a].draw()};Q.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);for(var e=[],d=[],g=0,f=a.length,h=.001,l,k;;){l=f;for(c=0;c<b;c++)if(!a[c].drawn){k=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(e,a[m],h)){k=!1;break}k&&(f--,d[g++]=a[c],a[c].drawn=!0)}if(0==f)break;else if(f==l){if(h*=10,.1<h){for(c=0;c<b;c++)a[c].drawn||(d[g++]=a[c],a[c].drawn=!0);break}}else h=.001}for(c=0;c<b;c++)d[c].draw(this.ctx,this)};
Q.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};Q.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);window.removeEventListener("touchmove",g,!1);window.removeEventListener("touchend",b,!1);a.preventDefault();f.parent.update()}function c(b){document.body.focus();f.click=0;f.evaluator.setVariable(f.id+
".mouse_pressed",0);b.preventDefault();"R"===f.whichBtn&&(window.removeEventListener("mousemove",d,!1),f.posZoom==f.posZoomNew&&a.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",g,!1);window.removeEventListener("mouseup",c,!1);f.parent.update()}function e(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.id+".mouse_x",f.mouse_x);f.evaluator.setVariable(f.id+".mouse_y",
f.mouse_y);f.parent.update()}function d(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=a.getCursorPosition(b,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function g(b){if(!f.fixed&&f.click){n=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;k=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/
4;if(n!==f.disp.x||k!==f.disp.y)f.alpha=a.degToRad(f.evaluator.getVariable(f.rotZStr)),f.beta=a.degToRad(-f.evaluator.getVariable(f.rotYStr)),f.alpha=a.radToDeg(f.alpha)-n,f.beta=a.radToDeg(f.beta)-k,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=n,f.disp.y=k,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);e(b);b.preventDefault()}}var f=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",
function(c){window.focus();document.activeElement.blur();f.click=1;f.evaluator.setVariable(f.id+".mouse_pressed",1);f.parent.deactivateGraphicControls();f.posAnte=a.getCursorPosition(c,f.container);f.oldMouse.x=f.getRelativeX(f.posAnte.x);f.oldMouse.y=f.getRelativeY(f.posAnte.y);e(c);window.addEventListener("touchmove",g);window.addEventListener("touchend",b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();f.click=1;f.parent.deactivateGraphicControls();
f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posObserver=a.getCursorPosition(b,f.container).x,f.posObserverNew=f.posObserver,f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,f.tempObserver=f.observer,window.addEventListener("mousemove",d))):"L"==f.whichBtn&&(f.evaluator.setVariable(f.id+".mouse_pressed",1),f.posAnte=a.getCursorPosition(b,f.container),f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y),
e(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=Q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,d,g,q,p,b,m=function(b,c){var d=a.Space.call(this,b,c)||this;f=d.parent.evaluator;void 0!=d._w_&&(b=f.parser.parse(d._w_),d._w_="number"!=b.type?b:void 0);void 0!=d._h_&&(b=f.parser.parse(d._h_),d._h_="number"!=b.type?b:void 0);d.isFirefox=/firefox/i.test(window.navigator.userAgent);d.file=d.file?d.file.trim():"";d.file.match(/^\[/)&&d.file.match(/\]$/)?d.file=f.parser.parse(d.file.substring(1,d.file.length-1)):d.file.match(/^'/)&&d.file.match(/'$/)?
d.file=f.parser.parse(d.file):d.file=f.parser.parse("'"+d.file+"'");d.oldFile=f.eval(d.file);d.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=d.oldFile&&d.MyIFrame.setAttribute("src",d.oldFile);d.container=a.newHTML("div",{id:d.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+
d.zIndex+";background-repeat:no-repeat;background-position:center;"});d.container.appendChild(d.MyIFrame);d.imageSrc&&(d.container.style.backgroundImage="url("+d.imageSrc+")");d.parent.container.insertBefore(d.container,d.parent.loader);d.MyIFrame.onload=function(b){var c=this;d.evaluator.setFunction(d.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});d.evaluator.setFunction(d.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
d.evaluator.setFunction(d.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});d.evaluator.setFunction(d.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var e=a.cacheFiles[b];else e=(e=document.getElementById(b))&&"descartes/embed"===e.type?e.textContent:a.openExternalFile(b),e=(e=(new DOMParser).parseFromString(e,"text/html").querySelector("ajs"))?e.innerHTML:"",a.cacheFiles[b]=e;c.contentWindow.postMessage({type:"change_config",filename:b,content:e},
"*")}return 0});d.ImReady=!d.isFirefox;d.isFirefox||(d.container.style.visibility="visible",d.container.style.opacity="1",d.container.style.zIndex=d.zIndex,d.container.style.display=d.drawIfValue?"block":"none");d.MyIFrame.style.visibility="visible";d.container.style.backgroundImage=""};d.update=d.iframeUpdate;d.evaluator.setVariable(d.id+"._scroll",0);return d};$jscomp.inherits(m,a.Space);m.prototype.init=function(){p=this;p.initSpace();p.MyIFrame&&Object.assign(p.MyIFrame.style,{width:p.w+"px",
height:p.h+"px"})};m.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;g=this.y!==f.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=d?f.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=g?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||g)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=m;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,p=d.images,b=d.audios,m=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,l=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;p["lib/DescartesCCLicense.png"]=a.getCCLImg();p["lib/DescartesCCLicense.png"].ready=1;var c,h;var e=0;for(c=f.length;e<c;e++)if("rtf"!==f[e].name){if(f[e].value.match(/'macro'|'makro'/g)){var v="";var r=d.lessonParser.split(f[e].value);var u=0;for(h=r.length;u<h;u++)"expresion"===babel[r[u][0]]&&(v=r[u][1]);if(v)var y=(y=document.getElementById(v))&&
"descartes/macro"==y.type?y.text:a.openExternalFile(v);if(y&&(r=y.match(m)))for(v=0,h=r.length;v<h;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(p[u]=new Image,p[u].addEventListener("load",function(){this.ready=1}),p[u].addEventListener("error",function(){this.errorload=1}),p[u].src=u)}if(r=f[e].value.match(m))for(v=0,h=r.length;v<h;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(p[u]=new Image,p[u].addEventListener("load",function(){this.ready=
1}),p[u].addEventListener("error",function(){this.errorload=1}),p[u].src=u);if(r=f[e].value.match(l))for(v=0,u=r.length;v<u;v++)d.initAudio(r[v])}for(var n in p)p.hasOwnProperty(n)&&d.images.length++;for(n in b)b.hasOwnProperty(n)&&d.audios.length++;var k=d.images.length+d.audios.length;0<k&&d.progress.setAttribute("max",k);var w,x=function(){w=0;for(var c in p)p.hasOwnProperty(c)&&(p[c].ready||p[c].errorload)&&w++;for(c in b)b.hasOwnProperty(c)&&(b[c].ready||b[c].errorload)&&w++;d.progress.setAttribute("value",
w);w!=k?d.timer=a.setTimeout(x,1):d.descartesApp.initBuildApp()};x()};d.prototype.initAudio=function(d){var f=this.audios;f[d]=new Audio(d);f[d].filename=d;var g=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):(f[d]=new Audio(this.filename.replace("mp3","ogg")),f[d].filename=this.filename.replace("mp3",
"ogg"),f[d].addEventListener("canplaythrough",g),f[d].addEventListener("load",g),f[d].addEventListener("error",b),f[d].load())};f[d].addEventListener("canplaythrough",g);f[d].addEventListener("load",g);f[d].addEventListener("error",b);a.hasTouchSupport?(f[d].load(),f[d].play(),a.setTimeout(function(){f[d].pause()},20),f[d].ready=1):f[d].load()};a.DescartesLoader=d;return a}(descartesJS||{});
descartesJS=function(a){function f(a){for(var b="[",d=0,e=a.length;d<e;d++)Array.isArray(a[d])?b+=f(a[d]):(g=a[d]||0,"string"==typeof g&&(g="'"+g+"'"),b+=g),d<e-1&&(b+=",");return b+"]"}function d(){q=window.innerWidth/this.width;p=window.innerHeight/this.height;a.cssScale=b=Math.min(q,p);this.container.style.transformOrigin="0 0";q<p?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+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 g,q,p,b,m=function(b){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=b;this.parentC=b.parentNode;this.width=parseFloat(b.getAttribute("width"));this.height=parseFloat(b.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=b.getElementsByTagName("param");a.ccLicense=!0;for(var c=
0,d=this.children.length;c<d;c++)"CreativeCommonsLicense"===this.children[c].name&&(a.ccLicense="no"!==this.children[c].value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.keyboard=new a.Keyboard(this);this.scaleToFit=function(){};this.init()};m.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.getURLParameters();this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);
this.licenseA=a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var b=this.children,c,f=0,e=0,g=a.ccLicense?90:0,m=0,p=b.length;m<p;m++)c=b[m],"rtf_height"==c.name&&(f=parseInt(c.value)+120||this.height),"Buttons"==babel[c.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(c.value),e=this.buttonsConfig.height),"image_loader"==c.name&&(this.imgLoader=c.value),"expand"==c.name&&(this.expand=c.value),"docBase"==c.name&&(this.docBase=c.value,c=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(c));this.arquimedes&&
(this.ratio=1,f&&(this.height=f+e+g));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=
this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style",
"width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.parentNode.style.width="100vw",this.container.parentNode.style.height="100vh",this.scaleToFit=d,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.width=window.innerWidth;this.height=window.innerHeight;this.container.width=this.width;this.container.height=
this.height;this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");if(this.spaces)for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].initSpace(),this.spaces[a].init(),this.spaces[a].update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()};m.prototype.initBuildApp=function(){a.showConfig=!0;for(var b=this.children,c,d=this.lessonParser,e=[],f=[],g=[],m=[],p=[],n=[],k=0,q=b.length;k<
q;k++)if(c=b[k],"editable"==babel[c.name])a.showConfig="false"==babel[c.value]?!1:!0;else if("language"==babel[c.name])this.language=c.value;else if("pleca"==c.name)c=d.parsePleca(c.value,this.width),this.container.insertBefore(c,this.loader),this.plecaHeight=c.imageHeight?c.imageHeight:c.offsetHeight;else if("Buttons"==babel[c.name])this.buttonsConfig=d.parseButtonsConfig(c.value);else if("decimal_symbol"==babel[c.name])this.decimal_symbol=c.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,
"g");else if("version"==babel[c.name])this.version=parseInt(c.value);else if("language"==babel[c.name])this.language=c.value;else if("rtf"==c.name){var x=(this.width-780)/2,z=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;m.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+c.value.replace(/'/g,"&squot;")+"'");m.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+x+","+(z-25)+"]' background='yes' text='"+
this.licenseA+"'");a.ccLicense&&m.push("space='descartesJS_stage' type='image' expresion='["+(x+15)+","+z+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==c.name.charAt(0)?(c.value.match(/'HTMLIFrame'/)&&this.nIframes++,e.push(c.value)):/^C_/.test(c.name)?f.push(c.value):/^A_/.test(c.name)?g.push(c.value):/^G_/.test(c.name)?(c.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&
(this.ratio=1),m.push(c.value)):/^S_/.test(c.name)?p.push(c.value):"Animation"==babel[c.name]&&n.push(c.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_stage' fondo='"+(a.TextController?"ffffffff":"blanco")+"' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+this.width+"' alto='"+this.height+"'"),this.stage.container.appendChild(this.stage.stageSpace.container),
this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));k=0;for(q=e.length;k<q;k++)b=d.parseSpace(e[k]),this.arquimedes&&this.stage.container.appendChild(b.container),this.spaces.push(b),this.zIndex++;k=0;for(q=m.length;k<q;k++)if(a.DEBUG.elemIndex=k,e=d.parseGraphic(m[k]))this.editableRegionVisible=this.editableRegionVisible||e.visible,e.space.addGraph(e);k=0;for(q=p.length;k<q;k++)(e=d.parse3DGraphic(p[k]))&&e.space.addGraph(e,!0);k=0;for(q=f.length;k<q;k++)this.controls.push(d.parseControl(f[k]));
k=0;for(q=g.length;k<q;k++)d.parseAuxiliar(g[k]);k=0;for(q=n.length;k<q;k++)this.animation=d.parseAnimation(n[k]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();k=0;for(q=this.controls.length;k<q;k++)this.controls[k].init();this.updateControls();this.updateSpaces(!0);var A=this;this.nIframes?a.setTimeout(function(){A.finishInit()},200*this.nIframes):this.finishInit()};m.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();
this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},
"*");this.externalSpace.init();try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(h){console.warn("CustomEvents not supported in this browser")}var c=this;this.evaluator.setFunction("openKB",function(a,b,d,f,g,l,m,k,p,q,z){c.keyboard.show(null,a,b,d,f,{x:g,y:l,w:m,h:k,fs:p+"px",value:q+"",type:"custom"},z)});this.readyApp=!0};m.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding=
"0px";var b=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-c)/2);window.resizeTo(b,c);a.onResize()};m.prototype.configRegions=function(){var b=this.evaluator.parser,c=this.buttonsConfig||{},d=this.container,e="15",f=100,g=100,m=100,p=100;2==this.version&&(e="14",f=63,g=50,m=44,p=53);var n=0,k=0,q=0,x=0,z=0,A=this.northSpace.controls,G=this.southSpace.controls,J=this.eastSpace.controls,E=this.westSpace.controls;if(0<c.rowsNorth||
0<A.length||c.about||c.config){0>=c.rowsNorth?(n=c.height,c.rowsNorth=1):n=c.height*c.rowsNorth;var F=this.northSpace.container;F.id="descartesJS_north";F.setAttribute("style","width:"+d.width+"px;height:"+n+"px;left:0;top:"+this.plecaHeight+"px;");d.insertBefore(F,this.loader);F=d.width;var D=0;c.about?(D=f,F-=D):f=0;c.config&&(F-=g);var B=Math.ceil(A.length/c.rowsNorth),L=F/B;var I=0;for(var M=A.length;I<M;I++)A[I].expresion=b.parse("("+(D+I%B*L)+","+c.height*Math.floor(I/B)+","+L+","+c.height+
")"),A[I].init();c.about&&(I=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(e),expresion:b.parse("(0, 0, "+f+", "+n+")")}),I.actionExec={execute:a.showAbout},I.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(e),action:"config",expresion:b.parse("("+(F+f)+", 0, "+g+", "+n+")")})).update()}if(0<c.rowsSouth||0<G.length||c.init||c.clear){0>=c.rowsSouth?(k=c.height,c.rowsSouth=1):k=c.height*c.rowsSouth;f=
d.width;D=0;c.init?(D=m,f-=D):m=0;c.clear&&(f-=p);F=this.southSpace.container;F.id="descartesJS_south";F.setAttribute("style","width:"+d.width+"px;height:"+k+"px;left:0;bottom:0;");d.insertBefore(F,this.loader);B=Math.ceil(G.length/c.rowsSouth);L=f/B;I=0;for(M=G.length;I<M;I++)G[I].expresion=b.parse("("+(D+I%B*L)+","+c.height*Math.floor(I/B)+","+L+","+c.height+")"),G[I].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(e),action:"init",
expresion:b.parse("(0, 0, "+m+", "+k+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(e),action:"clear",expresion:b.parse("("+(f+m)+", 0, "+p+", "+k+")")})).update()}if(0<J.length)for(I=d.height-n-k,x=c.widthEast,F=this.eastSpace.container,F.id="descartesJS_east",F.setAttribute("style","width:"+x+"px;height:"+I+"px;right:0;top:"+n+"px;"),d.insertBefore(F,this.loader),I=0,M=J.length;I<M;I++)J[I].expresion=b.parse("(0,"+c.height*
I+","+x+","+c.height+")"),J[I].init();if(0<E.length)for(I=d.height-n-k,z=c.widthWest,F=this.westSpace.container,F.id="descartesJS_west",F.setAttribute("style","width: "+z+"px;height:"+I+"px;left:0;top:"+n+"px;"),d.insertBefore(F,this.loader),I=0,M=E.length;I<M;I++)E[I].expresion=b.parse("(0,"+c.height*I+","+z+","+c.height+")"),E[I].init();if(this.editableRegionVisible)for(q=c.height,F=this.editableRegion.container,F.id="descartesJS_editableRegion",F.setAttribute("style","position:absolute;width:"+
d.width+"px;height:"+q+"px;left:0;top:"+(d.height-k-c.height)+"px;"),d.insertBefore(F,this.loader),b=this.editableRegion.textFields,d=d.width/b.length,c=a.getFieldFontSize(q),I=0,M=b.length;I<M;I++)"div"==b[I].type?(F.appendChild(b[I].container),b[I].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(d-4)+"px;height:"+q+"px;position:absolute;left:"+I*d+"px;top:0;"),E=b[I].container.firstChild,E.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+c+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+
q+"px;text-align:center;line-height:"+q+"px;"),J=E.offsetWidth,E.style.width=J+"px",E.firstChild.textContent=E.firstChild.textContent.substring(3,E.firstChild.textContent.length-3),b[I].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+(d-J)+"px;height:"+q+"px;position:absolute;left:"+J+"px;top:0;border:2px groove white;")):(F.appendChild(b[I]),b[I].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+d+"px;height:"+q+
"px;position:absolute;left:"+I*d+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=n;this.displaceRegionSouth=k+(q||0);this.displaceRegionEast=x;this.displaceRegionWest=z;I=0;for(M=this.spaces.length;I<M;I++)this.spaces[I].init()};m.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};m.prototype.clearClick=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};m.prototype.removeButtonClick=
function(){a.newBlobContent=null;for(var b=0,c=this.controls.length;b<c;b++)this.controls[b].buttonClick=!1};m.prototype.deactivateGraphicControls=function(){for(var a,b=0,d=this.controls.length;b<d;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};m.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};m.prototype.updateEvents=function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};m.prototype.updateControls=
function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};m.prototype.updateSpaces=function(a){for(var b=0,d=this.spaces.length;b<d;b++)this.spaces[b].update(a)};m.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()};m.prototype.play=function(){this.animation.play()};m.prototype.stop=function(){this.animation.stop()};m.prototype.reinitAnimation=function(){this.animation.reinit()};
m.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)};m.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};m.prototype.getAudio=function(b){var c=this.audios;if(b){if(!c[b]){b.lastIndexOf(".");
c[b]=new Audio(b);var d=function(a){this.ready=1};c[b].addEventListener("canplaythrough",d);var e=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(c[b]=new Audio(b.replace("mp3","ogg")),c[b].addEventListener("canplaythrough",d),c[b].addEventListener("load",d),c[b].addEventListener("error",e),c[b].load())};c[b].addEventListener("error",e);c[b].play();a.setTimeout(function(){c[b].pause()},
15)}return c[b]}return new Audio};m.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};m.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c,d=0,f=this.controls.length;d<f;d++)if(c=this.controls[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};m.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};m.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var c,d=0,f=this.spaces.length;d<f;d++)if(c=this.spaces[d],c[b]==a)return c;return{update:function(){},
w:0,h:0}};m.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,e=a.length;d<e;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]))}};m.prototype.getState=function(){var a="",b=this.evaluator.variables,d;for(d in b)if(b.hasOwnProperty(d)){var e=b[d];"string"==typeof e&&(e="'"+e+"'");void 0!=e&&"rnd"!=d&&"\u03c0"!=d&&"pi"!=d&&"e"!=
d&&"Infinity"!=d&&"-Infinity"!=d&&"object"!=typeof e&&(a=""!=a?a+"\n"+d+"="+e:d+"="+e)}e=this.evaluator.vectors;for(var g in e)e.hasOwnProperty(g)&&(a+="\n"+g+"="+f(e[g]));g=this.evaluator.matrices;for(var m in g)g.hasOwnProperty(m)&&(a+="\n"+m+"="+f(g[m]));return a};m.prototype.setState=function(a,b){a=a.split("\n");for(var c,d,f=0,g=a.length;f<g;f++)c=a[f].split("="),2<=c.length&&(d=eval(c[1]),-1!=c[1].indexOf("[[")?(this.evaluator.matrices[c[0]]=d,this.evaluator.matrices[c[0]].rows=d.length,this.evaluator.matrices[c[0]].cols=
d[0].length):-1!=c[1].indexOf("[")?(this.evaluator.vectors[c[0]]=d,this.evaluator.variables[c[0]+".long"]=d.length):this.evaluator.variables[c[0]]=d);b||this.update()};m.prototype.getEvaluation=function(){for(var a=correct=0,b="",d=0,e=this.controls.length;d<e;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};m.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()};m.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<b;a++)this.evaluator.eval(this.saveState[a]);this.update()};m.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=m;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 g="";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])g=" en la l\u00ednea "+(a.DEBUG.lineCount+1);f+=d+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+g+".";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 g(){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_symbol DJS_sansserif DJS_serif DJS_monospace DJS_math".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),g(),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 p=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){p[d.filename]?b=p[d.filename]:(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),p[d.filename]=b);var f=document.querySelector("base");f||(f=a.newHTML("base"),document.body.appendChild(f));f.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||{});
