/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2023-06-26
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var g=0;return function(){return g<a.length?{done:!1,value:a[g++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var g="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return g?g.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var g,d=[];!(g=a.next()).done;)d.push(g.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 g=function(){};g.prototype=a;return new g};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},g={};try{return g.__proto__=a,g.a}catch(d){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,g){a.__proto__=g;if(a.__proto__!==g)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,g){a.prototype=$jscomp.objectCreate(g.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var d=$jscomp.setPrototypeOf;d(a,g)}else for(d in g)if("prototype"!=d)if(Object.defineProperties){var f=Object.getOwnPropertyDescriptor(g,d);f&&Object.defineProperty(a,d,f)}else a[d]=g[d];a.superClass_=g.prototype};
$jscomp.checkStringArgs=function(a,g,d){if(null==a)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(g 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,g,d){a!=Array.prototype&&a!=Object.prototype&&(a[g]=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,g,d,f){if(g){d=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var r=a[f];r in d||(d[r]={});d=d[r]}a=a[a.length-1];f=d[a];g=g(f);g!=f&&null!=g&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:g})}};
$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 f="";a;)if(a&1&&(f+=d),a>>>=1)d+=d;return f}},"es6","es3");$jscomp.owns=function(a,g){return Object.prototype.hasOwnProperty.call(a,g)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,g){for(var d=1;d<arguments.length;d++){var f=arguments[d];if(f)for(var r in f)$jscomp.owns(f,r)&&(a[r]=f[r])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,d,f){var g=this.length||0;0>d&&(d=Math.max(0,g+d));if(null==f||f>g)f=g;f=Number(f);0>f&&(f=Math.max(0,g+f));for(d=Number(d||0);d<f;d++)this[d]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,g,d){a instanceof String&&(a=String(a));for(var f=a.length,r=0;r<f;r++){var m=a[r];if(g.call(d,m,r,a))return{i:r,v:m}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var d=[],f=0;f<this.length;f++){var g=this[f];Array.isArray(g)&&0<a?(g=Array.prototype.flat.call(g,a-1),d.push.apply(d,g)):d.push(g)}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 g,d,f,r={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(f){if(""==f)return"";g=f.split(",");d="";d+=a.getFontStyle(g[1])+" ";d+=g[2]+"px ";return d+=a.getFontName(g[0].split(" ")[0])};a.getFontName=function(d){d=d.toLowerCase();f=a.monospace_font;if("serif"===d||"times new roman"===d||"timesroman"===d||"times"===d)f=a.serif_font;else if("sansserif"===d||"arial"===d||"helvetica"===d)f=a.sansserif_font;return f};
a.getFontStyle=function(a){return r[a.toLowerCase()]||""};a.getTextWidth=function(f,b){a.ctx.font=b;return Math.round(a.ctx.measureText(f).width)};a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function g(){var a,c,b,e,h,p,f;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"),p="-"===e[0][0]?"-":"",h="-"===p?parseFloat(e[0].substring(1)).oToFixed(11):parseFloat(e[0]).oToFixed(11),f=parseInt(e[1]),c=h.indexOf("."),h=h.replace(".",""),0>c+f?(c=0>c?1:c,a=p+"0."+"0".repeat(Math.abs(c+f))+h):a=p+h+"0".repeat(f-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,f=360/d,r=d/360,m=Math.floor,b,k,l,c;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*f};a.degToRad=function(a){return a*r};a.drawLine=function(a,b,e,h,f,p,d){a.lineWidth=d||1;a.strokeStyle=p||"black";c=a.lineWidth%2*.5;a.beginPath();a.moveTo(m(b)+c,m(e)+c);a.lineTo(m(h)+c,m(f)+c);a.stroke()};a.getColor=function(a,c){if("string"===
typeof c)return c;b=a.eval(c);return"rgba("+m(255*b[0][0])+","+m(255*b[0][1])+","+m(255*b[0][2])+","+(1-b[0][3])+")"};a.getFeatures=function(){var c=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(c);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);c=a.newHTML("canvas");a.hasCanvas=c.getContext&&c.getContext("2d");a.hasCanvas&&(c.width=c.height=1,
a.ctx=a.hasCanvas,a._ratio=2);g()};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=m(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){k=c.touches?c.touches[0]:c;l=b.getBoundingClientRect();return k?{x:(k.pageX-window.pageXOffset-l.left)/a.cssScale,y:(k.pageY-window.pageYOffset-l.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var c=!1,b,e=[],h=0,p=0,f=a.length;p<f;p++)b=a.charAt(p),"'"===
b&&(c=!c),c||";"!==b&&"\n"!==b||(e.push(a.substring(h,p).replace(/\n/g,"\\n")),h=p+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(g){if(a.cacheFiles[g])return a.cacheFiles[g];var d=null,f=new XMLHttpRequest;f.open("GET",g,!1);try{f.send(null),d=200===f.status||304===f.status?f.responseText:f.responseText||"",d=404===f.status?"":d,d.match(String.fromCharCode(65533))&&(f.open("GET",g,!1),f.overrideMimeType("text/plain;charset=ISO-8859-1"),f.send(null),d=f.responseText)}catch(r){d=null}return d};a.addExternalFileContent=function(g,
d){a.cacheFiles[g]=d};return a}(descartesJS||{});
descartesJS=function(a){function g(a){z=a.indexOf("--radial--");-1!=z&&(a=a.substring(0,z));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");m=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};m[0]==m[m.length-1]&&"'"==m[0]&&(a.ignoreCaps=!0,m=m.substring(1,m.length-1),"`"==m[0]&&"\u00b4"==m[m.length-1]&&(a.ignoreAccents=!0,m=m.substring(1,m.length-1)));"`"==m[0]&&"\u00b4"==m[m.length-1]&&(a.ignoreAccents=!0,m=m.substring(1,m.length-1),m[0]==m[m.length-1]&&"'"==m[0]&&(a.ignoreCaps=!0,m=m.substring(1,
m.length-1)));"*"===m.charAt(0)&&"*"!==m.charAt(m.length-1)?m=m.substring(1)+"$":"*"!==m.charAt(0)&&"*"===m.charAt(m.length-1)?m="^"+m.substring(0,m.length-1):"*"!==m.charAt(0)&&"*"!==m.charAt(m.length-1)?m="^"+m+"$":"*"===m.charAt(0)&&"*"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1));a.regExp=m.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,c){m=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=m.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),
expr:c.parser.parse(a.expr[0].substring(1))};a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),expr:c.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function f(a,b,f){b=parseFloat(b);c=a.expr[0];h=a.expr[1];e=f.eval(c.expr);w=f.eval(h.expr);q="("==c.type||"["==c.type;u=")"==h.type||"]"==h.type;return q&&b>e&&u&&b<=w?1:0}function r(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,
"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var m,b,k,l,c,h,e,w,q,u,z;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 e=0,h=a.length;e<h;e++){b=a[e].split("&");k=[];for(var p=0,f=b.length;p<
f;p++)m=b[p],-1===m.indexOf(",")||"("!==m.charAt(0)&&"["!==m.charAt(0)||")"!==m.charAt(m.length-1)&&"]"!==m.charAt(m.length-1)?k.push(g(m)):k.push(d(m,c));a[e]=k}return a};a.escorrecto=function(c,e,h,d){h=h||a.externalEvaluator;d=d||a.buildRegularExpressionsPatterns(c,h);e=r(e);c=0;for(var p=d.length;c<p;c++){b=d[c];l=!0;for(var k=0,q=b.length;k<q;k++)l=b[k].regExp?l&&!!e.match(new RegExp(r(b[k].regExp),"i")):l&&f(b[k],e,h);if(l)return 1}return 0};a.esCorrecto=function(c,e,h,d){h=h||a.externalEvaluator;
d=d||a.buildRegularExpressionsPatterns(c,h);e+="";c=0;for(var p=d.length;c<p;c++){b=d[c];l=!0;for(var k=0,q=b.length;k<q;k++)(m=b[k].regExp)?(b[k].ignoreAccents&&(e=r(e),m=r(m)),b[k].ignoreCaps&&(e=e.toLowerCase(),m=r(m).toLowerCase()),l=l&&!!e.match(m)):l=l=l&&f(b[k],e,h);if(l)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,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 g=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,d=Math.floor,f,r,m,b,k,l,c,h,e,w,q,u,z,n,p,x,v,y,A=function(c,e){this.r=this.g=this.b=0;this.a=1;this.evaluator=e;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 h=4;h<c.length;h++)""!=c[h]&&(e=c[h].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(e[1]),color:"#"+e[2]}));this.getColor=this.getLinearGradient}else if(c.match(/^Pattern/))this.img_src=c.substring(8,c.length-1),this.img_src.match(g)&&(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]){r=[];m=this.splitComa(c.substring(1,
c.length-1));c=0;for(e=m.length;c<e;c++)l=m[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)),r.push(this.evaluator.parser.parse(l))):r.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=r[0];this.gExpr=r[1];this.bExpr=r[2];this.aExpr=r[3];this.getColor=this.getColorExp}};A.prototype.splitComa=function(a){k=[];for(var b=e=h=c=0,p=a.length;b<p;b++)w=a.charAt(b),"("===w?c++:")"===w?c--:"["===w?h++:
"]"===w?h--:","===w&&0===c&&0===h&&(k.push(a.substring(e,b)),e=b+1);k.push(a.substring(e));return k};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){f=this.evaluator;this.r=d(255*f.eval(this.rExpr));this.g=d(255*f.eval(this.gExpr));this.b=d(255*f.eval(this.bExpr));this.a=1-f.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){x=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++)p=this.evaluator.eval(this.stops[c].percentage),p=0>p?0:1<p?1:p,x.addColorStop(p,this.stops[c].color);return x};A.prototype.getPattern=function(){y=this.evaluator.parent;if(v=y.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(v,"repeat")}catch(D){}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(",");q=parseInt(a[0]).toString(16);u=parseInt(a[1]).toString(16);z=parseInt(a[2]).toString(16);n=(255-parseInt(255*parseFloat(a[3]))).toString(16);1===q.length&&(q="0"+q);1===u.length&&(u="0"+u);1===z.length&&(z="0"+z);1===n.length&&(n="0"+n);return new A(n+q+u+z)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d){var f=this;this.parent=d;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",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.newLine=a.newHTML("div",{style:"position:absolute; background-color:white; margin:0; font-family:DJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",function(){f.insert("\n")});this.container.appendChild(this.newLine);
this.display.addEventListener("keydown",function(a){f.keypressed=!0;if(27===a.keyCode)f.close();else if(13===a.keyCode)f.onEnter()});this.key_pressed=!1;var g;this.delete_pressed=!1;var m;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(g)};var b=a.target.textContent.trim().toLowerCase();g=setTimeout(function(){f.key_pressed=
!0;f.showAditionalKeys(b)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(m)},m=setInterval(function(){f.delete_pressed=!0;f.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=f.keyContainer&&a.target!=f.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)f.display.selectionStart=f.display.selectionEnd=Math.max(0,f.display.selectionStart-1);else if("k_right"==a.target.id)f.display.selectionStart=f.display.selectionEnd=
Math.min(f.display.value.length,f.display.selectionStart+1);else if("k_delete"==a.target.id)f.delete_pressed||f.delete(),clearTimeout(m),f.delete_pressed=!1;else if("k_\u221a"==a.target.id)f.insert("\u221a(");else if("k_space"==a.target.id)f.insert(" ");else if("k_esc"==a.target.id)f.close();else if("k_shift"==a.target.id){a=f.keyContainer.querySelectorAll("div");var b=f.aditionalKeys.querySelectorAll("div");f.shift=!f.shift;f.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)f["setLayout_"+f.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)f["setLayout_"+
f.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)f.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(g),f.key_pressed||(f.insert(a.target.textContent.trim()),f.aditionalKeys.style.display="none"),f.key_pressed=!1;else if("k_return"==a.target.id)f.onEnter();else a=a.target.textContent.trim(),f.insert(a),f.aditionalKeys.style.display="none";f.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!=f.keyContainer&&a.target!=f.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),f.insert(a)),f.key_pressed=!1,f.aditionalKeys.style.display="none");b=!1;f.display.focus()})};g.prototype.insert=function(a){this.display.setRangeText(a);
this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd};g.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};g.prototype.addKey=function(a,f,g){return"<div "+(f?"id='"+f+"'":"")+" "+(g?"style='"+g+"'":"")+">"+a+"</div>"};g.prototype.addKeys=function(a){var f=this,d="";a.forEach(function(a){d="object"===typeof a?d+f.addKey(a.val,
a.id,a.style):d+f.addKey(a)});return d};g.prototype.showAditionalKeys=function(a){var f=[];"."==a?f=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?f=["-","\u00d7","\u00f7","^"]:"a"==a?f=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?f=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?f=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?f=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(f=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.aditionalKeys.innerHTML=this.addKeys(f);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"};g.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"};g.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"};g.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"};g.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"};g.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"};g.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};g.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"};g.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"};
g.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"};g.prototype.showCustomKB=
function(a){var f=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||f.length);for(var d=[],g,b,k=0;k<f.length;k++){g={val:f[k].textContent};if(b=f[k].getAttribute("id"))g.id=b;if(b=f[k].getAttribute("size"))g.style="width:"+(40*parseInt(b)+5*(parseInt(b)-1))+"px;transform:none !important;";d.push(g)}this.keyContainer.innerHTML=this.addKeys(d);this.keyContainer.style.width=5+45*a+"px"};g.prototype.setLayout=function(a){this.layout_mode=a;var f=document.getElementById("kb_"+a);f?this.showCustomKB(f):
"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()};g.prototype.show=function(a,f,g,m,b,k,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(k);this.setLayout(f);this.keyContainer.style.left=g+"px";this.keyContainer.style.top=m+"px";this.aditionalKeys.style.display="none"};g.prototype.close=function(){this.container.style.display="none"};g.prototype.setDisplay=function(d){if("custom"==d.type){var f=d.x;var g=d.y;var m=d.w;var b=d.h;var k=d.fs}else g=this.container.getBoundingClientRect(),b=d.getBoundingClientRect(),f=b.left/a.cssScale-g.left/a.cssScale,g=b.top/a.cssScale-g.top/a.cssScale,m=b.width/a.cssScale,b=
b.height/a.cssScale,k=d.style.fontSize;"textarea"==d.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+f+"px;top:"+g+"px;width:"+m+"px;height:"+b+"px;font-size:"+k+";line-height:1.2em;padding:5px;font:"+d.style.font+";"),this.newLine.style.left=f+m-42+"px",this.newLine.style.top=g+b-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+f+"px;top:"+g+"px;width:"+m+"px;height:"+b+"px;font-size:"+k+";line-height:"+b+"px;white-space:nowrap;"),this.newLine.style.display=
"none");this.display.value=d.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};g.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var f=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{f&&(a=this.parent.evaluator.eval(f))}catch(b){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),f=this.var_id.indexOf("["),-1==f)this.parent.evaluator.setVariable(this.var_id,
a);else{var g=this.var_id.indexOf(","),m=this.var_id.substring(0,f);-1==g?this.parent.evaluator.setVector(m,parseInt(this.var_id.substring(f+1)),a):this.parent.evaluator.setMatrix(m,parseInt(this.var_id.substring(f+1)),parseInt(this.var_id.substring(g+1)),a)}this.parent.update();this.close()};a.Keyboard=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=document.head,d=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});g.appendChild(d);d=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||g.appendChild(d);d=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});g.appendChild(d);d=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});g.appendChild(d);
d=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});g.appendChild(d);(g=document.getElementById("StyleDescartesApps2"))&&g.remove();g=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(g,document.head.firstChild);g.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.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;resize:none;}\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, .new_line_btn{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, .new_line_btn:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active, .new_line_btn: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; resize: none;}\n.custom_keyboard{display:none;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(a.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sin,d=Math.floor,f=Math.random,r=Math.round,m=Math.abs,b=String.fromCharCode,k,l,c,h,e,w,q,u,z,n,p=function(a){this.key=(void 0===a?0:a).toString()};p.prototype.getKey=function(a){k=[];for(var c=0;256>c;c++)k[c]=b(this.alfanum(d(m(7.5*(g(1*c-a)+g(1.4*c+a)+g(.6*c-a)+g(2.2*c+a))))));return k.join("")};p.prototype.encode=function(a){l=d(31*f());this.key=this.getKey(l);return b(this.alfanum(l))+this.encripta(a)};p.prototype.decode=function(a){l=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(l);return this.desencripta(a.substring(1))};p.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};p.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;w=Array(3*a.length);for(var c=0,b=a.length;c<b;c++)z=256*d(a[c]+128)+r(255*f())+65536*r(255*f()),n=d((z<<this.shift(c))/256),w[3*c]=this.alfanum(n%32),w[3*c+1]=this.alfanum(n/32%32),w[3*c+2]=this.alfanum(n/1024%32);return w};p.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};p.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;q=Array(a.length/3);for(var c=0,b=q.length;c<b;c++)n=this.numalfa(a[3*c])+32*this.numalfa(a[3*c+1])+1024*this.numalfa(a[3*c+2]),z=d(256*n>>this.shift(c)),u=d(z/256)%256-128,0>u&&(u+=256),q[c]=u;return q};p.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};p.prototype.numalfa=function(a){return a-(58>a?48:87)};p.prototype.stringToBytes=
function(a){h=[];for(var c=0,b=a.length;c<b;c++)h.push(a.charCodeAt(c));return h};p.prototype.bytesToString=function(a){for(var c=0,e=a.length;c<e;c++)a[c]=b(a[c]);return a.join("")};p.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};p.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){this.parent=d;var g=d.evaluator,m=g.parser;d=new a.Auxiliary(d);var b=this;b.delay=f.delay?m.parse(f.delay):m.parse("60");b.loop=f.loop?f.loop:!1;b.auto=void 0==f.auto?!0:f.auto;b.controls=f.controls;b.init=d.splitInstructions(m,f.init);b.doExpr=d.splitInstructions(m,f.doExpr);f.whileExpr&&(b.whileExpr=m.parse(f.whileExpr));var k,l=b.doExpr.length;b.animExec=function(){for(k=0;k<l;k++)g.eval(b.doExpr[k]);b.parent.update();b.playing&&
(0<g.eval(b.whileExpr)||b.loop)?b.timer=a.setTimeout(b.animExec,g.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};g.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};g.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};g.prototype.reinit=function(){for(var a=0,f=this.init.length;a<
f;a++)this.parent.evaluator.eval(this.init[a])};a.Animation=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator};g.prototype.execute=function(){};a.Action=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){d=a.Action.call(this,d,f)||this;d.parameter=(f||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return d};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){alert(this.parameter)};a.Message=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){d=a.Action.call(this,d,f)||this;var g=d.evaluator,m=g.parser;f=a.splitSeparator((f||"").replace(/&squot;/g,"'"));for(var b=[],k,l=0,c=f.length;l<c;l++)(k=m.parse(f[l],!0))&&b.push(k);c=b.length;d.execute=function(){for(l=0;l<c;l++)g.eval(b[l])};return d};$jscomp.inherits(g,a.Action);a.Calculate=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){var g=a.Action.call(this,d,f)||this;g.parent=d;g.parser=d.evaluator.parser;g.evaluator=d.evaluator;g.parameter=f;g.target="_blank";return g};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){var d=this.parameter;d.match(/^\[.*\]?/)&&(d=this.evaluator.eval(this.parser.parse(d.substring(1,d.length-1))));var f=d.indexOf("target");-1!=f&&(this.target=d.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),
d=d.substring(0,f-1));if("javascript"==d.substring(0,10)){d=new a.SimpleText(this.parent,d.substring(11).replace(/&squot;/g,"'"));try{eval(d.toString())}catch(r){}}else"http"!=d.substring(0,4)&&(f=window.__dirname||window.location.href,d=f.substring(0,f.lastIndexOf("/")+1)+d),window.open(d,this.target)};a.OpenURL=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){var g=a.Action.call(this,d,f)||this;g.parser=d.evaluator.parser;g.evaluator=d.evaluator;g.parameter=f.trim();g.target="_blank";return g};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var f=a.indexOf("target");-1!=f&&(this.target=a.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
f-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(r){}}else"http"!=a.substring(0,4)&&(f=window.__dirname||window.location.href,a=f.substring(0,f.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+", top="+(window.screen.height-this.parent.height)/2+"location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=g;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){return a.Action.call(this,d,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'><script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'>\x3c/script>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,
"</ajs")+"</xmp>")};a.Config=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){return a.Action.call(this,d,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.init()};a.Init=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){return a.Action.call(this,d,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.clear()};a.Clear=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){return a.Action.call(this,d,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.play()};a.Animate=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){return a.Action.call(this,d,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,d=function(f,d){f=a.Action.call(this,f,d)||this;d=d||"";d.match(g)?f.filenameExpr=f.evaluator.parser.parse("'"+d.match(g)+"'"):(d.match(/^\[.*\]?/)&&(d=d.substring(1,d.length-1)),f.filenameExpr=f.evaluator.parser.parse(d));return f};$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 g,d,f=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,f)};f.prototype.firstRun=function(){};f.prototype.update=function(){};f.prototype.splitInstructions=function(f,m){d=[];m=m?a.splitSeparator(m):[""];for(var b=0,k=m.length;b<k;b++)a.DEBUG.lineCount=b,(g=f.parse(m[b],!0))&&d.push(g);return d};f.prototype.getPrivateVariables=function(a,f){d=[];f=f?f.split(/;|,/):
[""];for(var b=0,k=f.length;b<k;b++)(g=a.parse(f[b],!0))&&d.push(g);b=0;for(k=d.length;b<k;b++)d[b]="assign"===d[b].type?d[b].childs[0].value:"identifier"===d[b].type?d[b].value:"";return d};f.prototype.parseExpressions=function(f){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(f,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(f,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(f,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
f.parse(this.whileExpr)};a.Auxiliary=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){d=a.Auxiliary.call(this,d,f)||this;f=d.evaluator.parser;d.expresionString=d.expresion;d.expresion=f.parse(d.expresionString);d.expresion&&f.setVariable(d.id,d.expresion);d.editable&&(d.registerTextField(),d.parent.editableRegionVisible=!0);return d};$jscomp.inherits(g,a.Auxiliary);g.prototype.registerTextField=function(){var d=a.newHTML("div"),f=a.newHTML("label");f.appendChild(document.createTextNode("___"+this.id+"=___"));var g=a.newHTML("input");
g.value=this.expresionString;g.disabled=!this.editable;d.appendChild(f);d.appendChild(g);var m=this,b=m.evaluator.parser;g.onkeydown=function(a){13==a.keyCode&&(m.expresion=b.parse(this.value),b.setVariable(m.id,m.expresion),m.parent.update())};this.parent.editableRegion.textFields.push({container:d,type:"div"})};a.Variable=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){d=a.Auxiliary.call(this,d,f)||this;d.expresion=d.evaluator.parser.parse(d.expresion);d.update();return d};$jscomp.inherits(g,a.Auxiliary);g.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m=function(b,f){f=a.Auxiliary.call(this,b,f)||this;g=b.evaluator;d=g.parser;f.size=f.size||d.parse("3");f.expresion=f.expresion.split(";");f.parseFile=d.parse(f.file);f.update();return f};$jscomp.inherits(m,a.Auxiliary);m.prototype.update=function(){var b=this.expresion,k;g=this.evaluator;d=g.parser;this.oldFile=this.file;if(f=g.eval(this.parseFile))this.file=f;if(this.file){r=(k=document.getElementById(this.file))&&"descartes/vectorFile"==
k.type?k.text:a.openExternalFile(this.file);if(null!=r){r=r.replace(/\r/g,"").split("\n");k=[];for(var l=0,c=r.length;l<c;l++)""!=r[l]&&k.push(r[l]);r=k}null==r||1==r.length&&""==r[0]?(r=[],this.size=d.parse("0")):(b=r,this.size=null);null===this.size&&(this.size=d.parse(b.length+""))}var h;k=[];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)),k.push(h);b=parseInt(Math.abs(g.eval(this.size)));b=Array(b).fill(0);b._size_=b.length;g.vectors[this.id]=
b;g.setVariable(this.id+".long",b._size_);l=0;for(c=k.length;l<c;l++)g.eval(k[l])};a.Vector=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b=function(b,l){l=a.Auxiliary.call(this,b,l)||this;g=b.evaluator;d=g.parser;l.rows=l.rows||d.parse("3");l.columns=l.columns||d.parse("3");l.expresion=l.splitInstructions(d,l.expresion);f=g.eval(l.rows);r=g.eval(l.columns);m=[];m.type="matrix";b=0;for(var c=r;b<c;b++)m[b]=Array(f).fill(0);g.matrices[l.id]=m;l.update();return l};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){g=this.evaluator;f=g.eval(this.rows);r=g.eval(this.columns);
g.setVariable(this.id+".filas",f);g.setVariable(this.id+".columnas",r);m=g.matrices[this.id];m.rows=f;m.cols=r;for(var a=0,b=this.expresion.length;a<b;a++)g.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){var g=a.Auxiliary.call(this,d,f)||this;var m=g.evaluator;d=m.parser;f=g.id.indexOf("(");g.name=g.id.substring(0,f);g.params=g.id.substring(f+1,g.id.indexOf(")"));g.domain=g.range?d.parse(g.range):d.parse("1");g.params=""===g.params?[]:g.params.split(",");g.numberOfParams=g.params.length;g.algorithm||(g.init="",g.doExpr="",g.whileExpr="");g.parseExpressions(d);g.expresion=d.parse(g.expresion);var b;g.functionExec=function(){g.iterations=
0;if(g.numberOfParams<=arguments.length){for(var f=[],d=0,c=g.privateVars.length;d<c;d++)f.push(m.getVariable(g.privateVars[d])),m.setVariable(g.privateVars[d],0);var h=[];d=0;for(c=g.params.length;d<c;d++)h[d]=m.getVariable(g.params[d]),m.setVariable(g.params[d],arguments[d]);d=0;for(c=g.init.length;d<c;d++)m.eval(g.init[d]);do{d=0;for(c=g.doExpr.length;d<c;d++)m.eval(g.doExpr[d]);b=m.getVariable("_NUM_MAX_ITE_ALG_")||1E5;if(++g.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+
b+" repeticiones en la funci\u00f3n << "+g.name+" >>"),0}while(0<m.eval(g.whileExpr));var e=m.eval(g.expresion);a.rangeOK=m.eval(g.domain);d=0;for(c=g.params.length;d<c;d++)m.setVariable(g.params[d],h[d]);d=0;for(c=g.privateVars.length;d<c;d++)m.setVariable(g.privateVars[d],f[d]);return e}return 0};m.setFunction(g.name,g.functionExec);return g};$jscomp.inherits(g,a.Auxiliary);a.Function=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){var g=a.Auxiliary.call(this,d,f)||this;var m=g.evaluator;g.parseExpressions(m.parser);var b;g.algorithmExec=function(){for(var a=g.iterations=0,f=g.init.length;a<f;a++)m.eval(g.init[a]);do{a=0;for(f=g.doExpr.length;a<f;a++)m.eval(g.doExpr[a]);b=m.getVariable("_NUM_MAX_ITE_ALG_")||1E5;if(++g.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+b+" repeticiones en el algoritmo << "+g.name+" >>"),0}while(0<m.eval(g.whileExpr))};
g.update();return g};$jscomp.inherits(g,a.Auxiliary);g.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){d=a.Auxiliary.call(this,d,f)||this;f=d.evaluator;delete d.evaluate;d.condition=f.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(g,a.Auxiliary);g.prototype.update=function(){this.eventExec()};a.Event=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(d,f){var g=a.Auxiliary.call(this,d,f)||this;if(f=f.file){var m=document.getElementById(f);m=m&&"descartes/library"===m.type?m.text:a.openExternalFile(f)}if(m){m=a.convertHTMLEntities(m).replace(/\r/g,"").split("\n");f=0;for(var b=m.length;f<b;f++)""!==m[f].trim()&&d.lessonParser.parseAuxiliar(m[f])}return g};$jscomp.inherits(g,a.Auxiliary);a.Library=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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(){g=this.evaluator;d=g.eval(this.family_interval);this.familyInf=d[0][0];this.familySup=d[0][1];this.fSteps=Math.round(g.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};c.prototype.drawFamilyAux=function(a,c,b){g=this.evaluator;this.getFamilyValues();f=g.getVariable(this.family);if(0<=this.fSteps)for(var e=
0,h=this.fSteps;e<=h;e++)g.setVariable(this.family,this.familyInf+e*this.family_sep),0<g.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,b));g.setVariable("_Text_H_",0);g.setVariable(this.family,f)};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){k=Math.cos(b);l=Math.sin(b);return{x:a*k-c*l,y:a*l+c*k}};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,f,d,k,l,p,x,v,y){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=a.strokeStyle=d.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:b,y:f},c.update(a,b,f,x,v,l,y,d.getColor());else for("simpleText"===c.type&&(c=c.toString(x,v).split("\\n")),g=this.evaluator,a.fillStyle=d.getColor(),a.font=k,a.textAlign=l,a.textBaseline=p,m=1.2*this.fontSize||0,d=0,k=c.length;d<k;d++)r=c[d],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(r,
b,f+m*d)),a.fillText(r,b,f+m*d)};a.Graphic=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l=function(a,h){this.text=h=h.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";g="'";r=f=0;for(m=-1;f<h.length;)b=h.charAt(f),k=h.charAt(f-1),"["===b&&"\\"===k?(this.textElements.push(h.substring(r,f-1)+"["),this.textElementsMacros.push("'"+h.substring(r,f-1)+"['"),r=f+1):"]"===b&&"\\"===k?(this.textElements.push(h.substring(r,
f-1)+"]"),this.textElementsMacros.push("'"+h.substring(r,f-1)+"]'"),r=f+1):"["===b&&-1===m?(this.textElements.push(h.substring(r,f)),this.textElementsMacros.push("'"+h.substring(r,f)+"'"),r=f,m++):"["===b?m++:"]"===b&&0===m?(this.textElements.push(this.evaluator.parser.parse(h.substring(r,f+1))),this.textElementsMacros.push("["+h.substring(r,f+1)+"]"),r=f+1,m--):("]"==h.charAt(f)&&(m=0>m?m:m-1),g+=h.charAt(f)),f++;this.textElements.push(h.substring(r,f));this.textElementsMacros.push("'"+h.substring(r,
f)+"'")};l.prototype.toString=function(c,b){g="";for(var e=0,h=this.textElements.length;e<h;e++)"string"===typeof this.textElements[e]?g+=this.textElements[e]:(d=this.evaluator.eval(this.textElements[e])[0][0],""!==d&&("string"===typeof d?g+=d:Infinity==d?g+="Infinity":-Infinity==d?g+="-Infinity":isNaN(d)||"NaN"==d?g+="NaN":(d=parseFloat(d),d=b?d.toFixed(c):a.removeNeedlessDecimals(d.toFixed(c)),g+=d.toString().replace(".",this.parent.decimal_symbol))));return g};a.SimpleText=l;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F,G,B,L,I,M,P,H,N,C,R,K=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();q=new a.R2;u=new a.R2;z=new a.R2;x=new a.R2;n=new a.R2;b.cInd=0;return b};$jscomp.inherits(K,a.Graphic);K.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)};K.prototype.update=function(){};K.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};K.prototype.drawFamilyAux=function(a,c,b){f=this.evaluator;this.getFamilyValues();d=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),this.update(),this.drawAux(a,
c,b);f.setVariable(this.family,d)};K.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};K.prototype.drawAux=function(d,O,S){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;f=this.evaluator;r=f.parser;m=this.space;b=f.eval(this.width);d.strokeStyle=this.color.getColor();d.lineWidth=b;k=r.getVariable("x");l=r.getVariable("y");c=m.w+24;h=m.h+24;e=c/9;3>e&&(e=3);w=h/7;3>w&&(w=3);0==this.cInd?(g=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;q.set(0,0);u.set(0,
0);z.set(0,0);C=.25;R=8;this.abs_coord||(C/=m.scale,R/=m.scale);d.beginPath();for(L=parseInt(w/2);L<h;L+=w)for(B=parseInt(e/2);B<c;B+=e){if(this.abs_coord){x.set(B,L);p=this.newt.findZero(x,C);if(null==p)continue;f.setVariable("x",p.x);f.setVariable("y",p.y);n.set(p.x,p.y)}else{x.set(m.getRelativeX(B),m.getRelativeY(L));p=this.newt.findZero(x,C);if(null==p)continue;f.setVariable("x",p.x);f.setVariable("y",p.y);n.set(m.getAbsoluteX(p.x),m.getAbsoluteY(p.y))}v=n.ix();y=n.iy();if(-12<=v&&v<c+24&&-12<=
y&&y<h+24){if(g[v+12+(y+12)*m.w]===this.cInd)continue;g[v+12+(y+12)*m.w]=this.cInd}a.rangeOK&&(d.moveTo(v,y),d.lineTo(v,y));q.x=p.x;q.y=p.y;u.x=p.x;u.y=p.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),z.x=A.x,z.y=A.y,J=D=0,E=!1;2>J;)if(E&&(z.x=-A.x,z.y=-A.y,p.x=q.x,p.y=q.y,u.x=p.x,u.y=p.y,this.abs_coord?n.set(p.x,p.y):n.set(m.getAbsoluteX(p.x),m.getAbsoluteY(p.y)),v=n.ix(),y=n.iy(),E=!1,D=0),p.x+=R*z.x,p.y+=R*z.y,p=this.newt.findZero(p,C),null!=p){f.setVariable("x",p.x);f.setVariable("y",
p.y);z.x=p.x-u.x;z.y=p.y-u.y;z.normalize();if(0==z.x&&0==z.y)break;u.x=p.x;u.y=p.y;this.abs_coord?n.set(p.x,p.y):n.set(m.getAbsoluteX(p.x),m.getAbsoluteY(p.y));F=parseInt(n.ix());G=parseInt(n.iy());if(F!=v||G!=y)if(I=v,M=y,v=F,y=G,-12<=v&&v<c+24&&-12<=y&&y<h+24){D=0;P=g[v+12+(y+12)*m.w];g[v+12+(y+12)*m.w]=this.cInd;for(O=1;8>O;O++)H=I+Math.round((v-I)*O/8),N=M+Math.round((y-M)*O/8),0<=H&&H<c&&0<=N&&N<h&&(g[H+12+(N+12)*m.w]=this.cInd);a.rangeOK&&(d.moveTo(I,M),d.lineTo(v,y));if(P===this.cInd)break}else E=
!0,J++;else 4<++D&&(E=!0,J++)}}d.stroke()}};K.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};K.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};K.prototype.XX=function(a,c,b){return Math.round(this.X(a,c,b))};K.prototype.YY=function(a,c,b){return Math.round(this.Y(a,c,b))};K.prototype.extrapolate=function(c,b,
e,h,p,f){for(var d=this.evaluator.getVariable(b),g=f/2,q=0,k,l,n,u,m,w;1E-15<Math.abs(g);){k=this.evaluator.getVariable(b);l=this.evaluator.getVariable(b)+g;this.evaluator.setVariable(b,l);n=!0;try{u=p,p=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(e,p),0<this.evaluator.eval(c)?(m=new a.R2(Math.min(u,p),Math.max(u,p)),w=0,w=0<f?this.Singularity(Math.abs(g),b,h,k,u,l,p,m):this.Singularity(Math.abs(g),b,h,l,p,k,u,m),0<w&&(n=!1)):n=!1}catch(Z){n=!1}n?q+=g:this.evaluator.setVariable(b,
k);g/=2}this.evaluator.setVariable(b,d);return new a.R2(q/Math.abs(f),p)};K.prototype.extrapolateOnSingularity=function(c,b,e,h,p,f){h=this.evaluator.getVariable(b);for(var d=f/2,g=0,q=p,k;1E-15<Math.abs(d);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)+d);k=!0;if(0<this.evaluator.eval(c))try{q=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(e,q),0>=this.evaluator.eval(c)&&(k=!1)}catch(W){k=!1}else k=!1;k?g+=d:this.evaluator.setVariable(b,this.evaluator.getVariable(b)-d);
d/=2}if(0==g)for(d=f/2,g=f,q=p;1E-15<Math.abs(d);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)-d);k=!0;if(0<this.evaluator.eval(c))try{q=this.evaluator.eval(this.funExpr)}catch(W){k=!1}else k=!1;k?g+=-d:this.evaluator.setVariable(b,this.evaluator.getVariable(b)+d);d/=2}this.evaluator.setVariable(b,h);return new a.R2(g/Math.abs(f),q)};K.prototype.Singularity=function(a,c,b,e,h,p,f,d){if(isNaN(f)||isNaN(h)||isNaN(d.y)||isNaN(d.x)||e>=p)return 2;var g=this.evaluator.getVariable(c),q=0;
try{if(1E-15>Math.abs(p-e)||1E-12>Math.abs(p-e)&&Math.abs(f-h)>Math.abs(a))return this.evaluator.setVariable(c,g),1;var k=(e+p)/2;this.evaluator.setVariable(c,k);var l=NaN;try{l=this.evaluator.eval(this.funExpr)}catch(X){return 2}if(isNaN(l))return 5;if(Math.abs(f-h)>a){this.evaluator.setVariable(c,e-1E-12);var n=this.evaluator.eval(this.funExpr);n=(h-n)/1E-12;this.evaluator.setVariable(c,p+1E-12);var u=(this.evaluator.eval(this.funExpr)-f)/1E-12;if((10>Math.abs(u)||10>Math.abs(n))&&(0<=u&&0<=n||
0>=u&&0>=n)&&4*Math.abs(u)<Math.abs((f-h)/(p-e)))return this.evaluator.setVariable(c,g),2}if(isNaN(d.x)||isNaN(d.y)||isNaN(l))return 2;if(!(d.x<=l&&l<=d.y)){this.evaluator.setVariable(c,k);d.x=Math.min(h,l);d.y=Math.max(h,l);var m=this.Singularity(a/2,c,b,e,h,k,l,d);this.evaluator.setVariable(c,p);d.x=Math.min(f,l);d.y=Math.max(f,l);var w=this.Singularity(a/2,c,b,k,l,p,f,d);q=Math.max(m,w)}}catch(X){q=1}this.evaluator.setVariable(c,g);return q};K.prototype.discontLR=function(a,c,b,e){var h=c+b,p=
h+b,f=c-b;b=f-b;this.evaluator.setVariable("x",c);c=this.evaluator.eval(a);if(isNaN(c)||!isFinite(c)||Math.abs(c)>e)return!0;this.evaluator.setVariable("x",h);h=this.evaluator.eval(a);if(isNaN(h)||!isFinite(h)||Math.abs(h)>e)return!0;this.evaluator.setVariable("x",p);p=this.evaluator.eval(a);if(isNaN(p)||!isFinite(p)||Math.abs(p)>e)return!0;this.evaluator.setVariable("x",f);f=this.evaluator.eval(a);if(isNaN(f)||!isFinite(f)||Math.abs(f)>e)return!0;this.evaluator.setVariable("x",b);a=this.evaluator.eval(a);
if(isNaN(a)||!isFinite(a)||Math.abs(a)>e)return!0;e=3*c-4*h+p;a=3*c-4*f+a;return.8<Math.abs((e*e-a*a)/(e*e+a*a+1E-4))?!0:!1};K.prototype.drawAuxFun1=function(c,b,e){k=this.evaluator.parser.getVariable("x");l=this.evaluator.parser.getVariable("y");a.rangeOK=1;if(this.evaluator.eval(this.drawif)){b="x";this.of_y&&(b="y");c.beginPath();c.lineWidth=this.evaluator.eval(this.width);c.strokeStyle=e.getColor();for(var h=-1;h<=this.space.w;h+=1){e=this.space.getRelativeX(h);this.evaluator.setVariable(b,e);
var p=this.evaluator.eval(this.funExpr);var f=this.space.getAbsoluteX(e);p=this.space.getAbsoluteY(p);this.discontLR(this.funExpr,e,.001,100)?c.moveTo(f,p):c.lineTo(f,p)}c.stroke();this.evaluator.parser.setVariable("x",k);this.evaluator.parser.setVariable("y",l)}};K.prototype.drawAuxFun=function(c,b,e){k=this.evaluator.parser.getVariable("x");l=this.evaluator.parser.getVariable("y");a.rangeOK=1;b="x";var h="y";this.of_y&&(b="y",h="x");var p=this.drawif,f=this.evaluator.eval(this.width),d=!1,g=new a.R2(this.space.w/
2+this.space.Ox,this.space.h/2+this.space.Oy),q=this.of_y?g.ix():g.iy(),n=0,u=0,m=0,w=0,r=1/this.space.scale;g=r*(this.of_y?-this.space.h+g.y:-g.x);var D=0;this.abs_coord&&(g=0,r=1);for(var x,z,y,v,F,A,B,I,G,E=this.of_y?this.space.h+2:this.space.w+2;m<=E;){x=!0;z=0;this.evaluator.setVariable(b,g);try{y=this.evaluator.eval(this.funExpr),isNaN(y)||(this.evaluator.setVariable(h,y),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(d?(v=Math.min(D,y),F=Math.max(D,y),A=new a.R2(v,F),z=this.Singularity(r,b,
0,g-r,D,g,y,A),0===z?(D<=y?(D=A.x,y=A.y):(y=A.x,D=A.y),B=parseInt(this.of_y?this.XX(f,D,this.abs_coord):this.YY(f,D,this.abs_coord)),n=this.abs_coord?Math.round(y):parseInt(this.of_y?this.XX(f,y,this.abs_coord):this.YY(f,y,this.abs_coord)),this.fillM&&n>q&&(c.lineWidth=1,c.strokeStyle=this.fillM.getColor(),c.beginPath(),this.of_y?(c.moveTo(q+1,this.space.h-m+.5),c.lineTo(n,this.space.h-m+.5)):(c.moveTo(m+.5,q+1),c.lineTo(m+.5,n)),c.stroke()),this.fillP&&n<q&&(c.lineWidth=1,c.strokeStyle=this.fillP.getColor(),
c.beginPath(),this.of_y?(c.moveTo(q-1,this.space.h-m+.5),c.lineTo(n,this.space.h-m+.5)):(c.moveTo(m+.5,q-1),c.lineTo(m+.5,n)),c.stroke()),c.lineWidth=f,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(B+.5,this.space.h-w),c.lineTo(n+.5,this.space.h-m)):(c.moveTo(w+.5,B),c.lineTo(m+.5,n)),c.stroke()):1===z?(this.evaluator.setVariable(b,g-r),I=this.extrapolate(p,b,h,0,D,r),n=this.of_y?this.XX(f,I.y,this.abs_coord):this.YY(f,I.y,this.abs_coord),c.lineWidth=f,c.strokeStyle=e.getColor(),c.beginPath(),
this.of_y?(c.moveTo(u+.5,this.space.h-w),c.lineTo(n+.5,this.space.h-w+Math.round(I.x))):(c.moveTo(w+.5,u),c.lineTo(w+Math.round(I.x)+.5,n)),this.evaluator.setVariable(b,g),G=this.extrapolate(p,b,h,0,y,-r),u=this.of_y?this.XX(f,G.y,this.abs_coord):this.YY(f,G.y,this.abs_coord),n=this.of_y?this.XX(f,y,this.abs_coord):this.YY(f,y,this.abs_coord),c.lineWidth=f,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(u+.5,this.space.h-m),c.lineTo(n+.5,this.space.h-m)):(c.moveTo(m+.5,u),c.lineTo(m+
.5,n)),c.stroke()):2===z&&(n=this.of_y?this.XX(f,y,this.abs_coord):this.YY(f,y,this.abs_coord),c.lineWidth=f,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(u+.5,this.space.h-m),c.lineTo(n+.5,this.space.h-m)):(c.moveTo(m+.5,u),c.lineTo(m+.5,n)))):(G=this.extrapolateOnSingularity(p,b,h,0,y,-r),u=this.of_y?this.XX(f,G.y,this.abs_coord):this.YY(f,G.y,this.abs_coord),n=this.of_y?this.XX(f,y,this.abs_coord):this.YY(f,y,this.abs_coord),c.lineWidth=f,c.strokeStyle=e.getColor(),c.beginPath(),
this.of_y?(c.moveTo(u,this.space.h-(m+Math.round(G.x))+.5),c.lineTo(n,this.space.h-m+.5)):(c.moveTo(m+Math.round(G.x),u),c.lineTo(m,n)),c.stroke()),D=y):x=!1)}catch(aa){x=!1}d&&!x&&(this.evaluator.setVariable(b,g-r),this.evaluator.setVariable(h,D),I=this.extrapolate(p,b,h,0,D,r),n=parseInt(this.of_y?this.XX(f,I.y,this.abs_coord):this.YY(f,I.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(c.lineWidth=f,c.strokeStyle=e.getColor(),c.beginPath(),this.of_y?(c.moveTo(u,this.space.h-(w+
Math.round(I.x))+.5),c.lineTo(n,this.space.h-(w+Math.round(I.x))+.5)):(c.moveTo(w+Math.round(I.x)+.5,u),c.lineTo(w+Math.round(I.x)+.5,n)),c.stroke()),this.evaluator.setVariable(b,g));d=x;g+=r;u=n;w=m++}this.evaluator.parser.setVariable("x",k);this.evaluator.parser.setVariable("y",l)};K.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=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,d,f,r,m,b,k,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;f=d.eval(this.parameter_interval);this.paraInf=f[0][0];this.paraSup=f[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,f){d=this.evaluator;r=this.space;c.lineWidth=Math.max(1E-6,g(d.eval(this.width)));
c.lineCap=c.lineJoin="round";c.strokeStyle=f.getColor();m=d.getVariable(this.parameter);c.beginPath();d.setVariable(this.parameter,this.paraInf);b=d.eval(this.expresion);this.exprX=g(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0]));this.exprY=g(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1]));this.rotateExp&&(k=a.degToRad(d.eval(this.rotateExp)),l=this.rotate(b[0][0],b[0][1],k),this.exprX=g(this.abs_coord?l.x:r.getAbsoluteX(l.x)),this.exprY=g(this.abs_coord?l.y:r.getAbsoluteY(l.y)));c.moveTo(this.exprX+
.5,this.exprY+.5);for(f=1;f<=this.pSteps;f++)d.setVariable(this.parameter,this.paraInf+f*this.paraSep),b=d.eval(this.expresion),this.rotateExp&&(l=this.rotate(b[0][0],b[0][1],k),b[0][0]=l.x,b[0][1]=l.y),this.exprX=g(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0])),this.exprY=g(this.abs_coord?b[0][1]:r.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,m)};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 g=2*Math.PI,d=Math.round,f,r,m,b,k,l,c,h,e,w,q=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(q,a.Graphic);q.prototype.update=function(){f=this.evaluator;m=f.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.rotateExp&&
(b=this.rotate(m[0][0],m[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);c=f.eval(this.range);this.rangeInf=c[0][0];this.rangeMax=c[0][1]};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(c,b){f=this.evaluator;r=this.space;e=h=Math.ceil(f.eval(this.size)-.4);c.fillStyle=b.getColor();c.beginPath();this.rangeInf>
this.rangeMax&&(w=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=w);b=f.getVariable("n");for(var q=this.rangeInf,p=this.rangeMax;q<=p;q++)f.setVariable("n",q),m=f.eval(this.expresion),this.exprX=m[0][0],this.exprY=m[0][1],k=d(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX)),l=d(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY)),c.beginPath(),c.arc(k,l,h,0,g,!0),c.fill();c.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,c,this.text,k+e,l-e,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",b)};q.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=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,d=Math.round,f,r,m,b,k,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(){f=this.evaluator;m=f.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.rotateExp&&(b=this.rotate(m[0][0],m[0][1],a.degToRad(f.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){r=this.space;a.fillStyle=b.getColor();k=d(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX));l=d(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY));c=d(this.evaluator.eval(this.size));0<c&&(a.beginPath(),a.arc(k,l,c,0,g),a.fill());this.text.hasContent&&this.text.draw(a,b,k,l)};a.Point=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,d=2*Math.PI,f,r,m,b,k,l,c,h,e,w,q=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(q,a.Graphic);q.prototype.update=function(){f=this.evaluator;m=f.eval(this.expresion);this.endPoints=[];for(var c=0,e=m.length;c<e;c++)this.endPoints[c]={x:m[c][0],y:m[c][1]};if(this.rotateExp)for(b=a.degToRad(f.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)};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};q.prototype.drawAux=function(a,b,q){f=this.evaluator;r=this.space;a.lineWidth=Math.max(1E-6,g(f.eval(this.width)));k=f.eval(this.size);a.fillStyle=b.getColor();a.strokeStyle=q.getColor();a.lineCap="round";l=
0==a.lineWidth%2?0:.5;this.abs_coord?(c=g(this.endPoints[0].x),h=g(this.endPoints[0].y),e=g(this.endPoints[1].x),w=g(this.endPoints[1].y)):(c=g(r.getAbsoluteX(this.endPoints[0].x)),h=g(r.getAbsoluteY(this.endPoints[0].y)),e=g(r.getAbsoluteX(this.endPoints[1].x)),w=g(r.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(c+l,h+l);a.lineTo(e+l,w+l);this.dashStyle();a.stroke();0<k&&(a.beginPath(),a.arc(c,h,k,0,d),a.arc(e,w,k,0,d),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
q,parseInt((c+e)/2)-3,parseInt((h+w)/2)+3)};a.Segment=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,d=Math.round,f,r,m,b,k,l,c,h,e,w,q,u,z,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(){f=this.evaluator;r=f.eval(this.expresion);
for(var c=0,b=r.length;c<b;c++)this.endPoints[c]={x:r[c][0],y:r[c][1]};if(this.rotateExp)for(m=a.degToRad(f.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,m)};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,m){f=this.evaluator;b=this.space;k=Math.max(0,
f.eval(this.width));l=Math.ceil(k/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=m.getColor();a.lineWidth=2;this.abs_coord?(e=d(this.endPoints[0].x),w=d(this.endPoints[0].y),q=d(this.endPoints[1].x),u=d(this.endPoints[1].y)):(e=d(b.getAbsoluteX(this.endPoints[0].x)),w=d(b.getAbsoluteY(this.endPoints[0].y)),q=d(b.getAbsoluteX(this.endPoints[1].x)),
u=d(b.getAbsoluteY(this.endPoints[1].y)));z=Math.max(0,f.eval(this.spear));a.save();a.translate(e,w);this.abs_coord?a.rotate(this.angle):(h*=c,a.rotate(-this.angle));a.beginPath();a.moveTo(-l,g(-l));a.lineTo(g(h-z-k),g(-l));a.lineTo(g(h-2*z),g(-z-l));a.lineTo(g(h),0);a.lineTo(g(h-2*z),g(z+l));a.lineTo(g(h-z-k),g(l));a.lineTo(-l,g(l));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,m,parseInt((e+q)/2)-3,parseInt((w+u)/2)+3)};a.Arrow=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,d,f,r,m,b,k,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;r=d.eval(this.expresion);for(var c=0,b=r.length;c<b;c++)this.endPoints[c]={x:r[c][0],y:r[c][1]};if(this.rotateExp)for(m=a.degToRad(d.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,
this.endPoints[c].y,m)};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;f=this.space;a.lineWidth=Math.max(1E-6,g(d.eval(this.width)));a.strokeStyle=e.getColor();a.lineCap=a.lineJoin="round";b=g(this.abs_coord?this.endPoints[0].x:f.getAbsoluteX(this.endPoints[0].x));k=g(this.abs_coord?this.endPoints[0].y:f.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(b+0,k+0);e=1;for(var c=this.endPoints.length;e<c;e++)b=g(this.abs_coord?this.endPoints[e].x:f.getAbsoluteX(this.endPoints[e].x)),k=g(this.abs_coord?this.endPoints[e].y:f.getAbsoluteY(this.endPoints[e].y)),a.lineTo(b+0,k+0);this.fill&&(a.fillStyle=h.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,d=Math.min,f=Math.max,r=Math.abs,m,b,k,l,c,h,e,w,q,u,z=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(z,a.Graphic);z.prototype.update=function(){m=this.evaluator;l=m.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.w=150;this.h=100;this.rotateExp&&(k=this.rotate(l[0][0],
l[0][1],a.degToRad(m.eval(this.rotateExp))),this.exprX=k.x,this.exprY=k.y);4<=l[0].length&&(this.w=l[0][2],this.h=l[0][3]);l[1]&&2==l[1].length&&(this.w=l[1][0],this.h=l[1][1]);this.w=f(0,this.w);this.h=f(0,this.h)};z.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};z.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};z.prototype.drawAux=function(a,p,k,l){m=this.evaluator;b=this.space;a.lineWidth=Math.max(1E-6,g(m.eval(this.width)));
a.strokeStyle=k.getColor();a.lineCap="round";a.lineJoin="miter";c=g(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+0;h=g(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+0;e=this.abs_coord?this.w:this.w*b.scale;w=this.abs_coord?this.h:-this.h*b.scale;q=d(f(0,m.eval(this.border_radius)),.5*r(e),.5*r(w));u=this.abs_coord?1:-1;a.beginPath();0!==q?(a.moveTo(c+q,h),a.lineTo(c+e-q,h),a.quadraticCurveTo(c+e,h,c+e,h+u*q),a.lineTo(c+e,h+w-u*q),a.quadraticCurveTo(c+e,h+w,c+e-q,h+w),a.lineTo(c+q,
h+w),a.quadraticCurveTo(c,h+w,c,h+w-u*q),a.lineTo(c,h+u*q),a.quadraticCurveTo(c,h,c+q,h),a.lineTo(c+q,h)):(a.moveTo(c,h),a.lineTo(c+e,h),a.lineTo(c+e,h+w),a.lineTo(c,h+w),a.lineTo(c,h));this.fill&&(a.fillStyle=p.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,d=Math.min,f=Math.max,r=Math.acos,m=Math.sqrt,b=Math.PI,k=b/2,l=2*b,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F,G,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)),w=Math.cos(e),q=Math.sin(e),u=this.exprX*w-this.exprY*q,z=this.exprX*q+this.exprY*w,this.exprX=u,this.exprY=z);var g=c.eval(this.initExpr),
F=c.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(n=g[0][0],p=g[0][1],x=F[0][0],v=F[0][1],this.vectors?this.abs_coord&&(p=-p,v=-v):(n-=this.exprX,p=-p+this.exprY,x-=this.exprX,v=-v+this.exprY,this.abs_coord||(p=-p,v=-v)),y=0==n?0>p?3*k:k:r(1*n/m(n*n+p*p)),A=0==x?0>v?3*k:k:r(1*x/m(x*x+v*v)),y+=e,A+=e,0<n&&0<p&&this.abs_coord&&(y=l-y),0<n&&0>p&&!this.abs_coord&&(y=l-y),0>n&&0>p&&!this.abs_coord&&(y=l-y),0>n&&0<p&&this.abs_coord&&
(y=l-y),0<x&&0<v&&this.abs_coord&&(A=l-A),0<x&&0>v&&!this.abs_coord&&(A=l-A),0>x&&0>v&&!this.abs_coord&&(A=l-A),0>x&&0<v&&this.abs_coord&&(A=l-A),this.initFlag?(D=y,y=A,A=D):(D=d(y,A),J=f(y,A),y=D,A=J,A-y>b&&this.abs_coord&&(y=J,A=D),A-y<=b&&!this.abs_coord&&(y=J,A=D)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(g)+e,this.endAng=a.degToRad(F)+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,e){c=this.evaluator;E=this.space;B=Math.max(0,c.eval(this.radius));a.lineWidth=Math.max(1E-6,g(c.eval(this.width)));a.lineCap="round";a.strokeStyle=e.getColor();this.abs_coord?(F=g(this.exprX),G=g(this.exprY)):(F=g(E.getAbsoluteX(this.exprX)),G=g(E.getAbsoluteY(this.exprY)),B*=E.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(L=this.iniAng,this.iniAng=
this.endAng,this.endAng=L);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(F,G),a.arc(F,G,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(F,G,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,F,G)};a.Arc=I;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b=function(b,f){f=a.Graphic.call(this,b,f)||this;f.width=f.width||b.evaluator.parser.parse("0");f.align||(f.align="left");f.anchor||(f.anchor="top_left");f.shadowColor=f.shadowColor?f.shadowColor.getColor():"transparent";f.text=new a.TextObject(f,f.text);return f};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){g=this.evaluator;d=g.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(f=this.rotate(d[0][0],
d[0][1],a.degToRad(g.eval(this.rotateExp))),this.exprX=f.x,this.exprY=f.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?(r=parseInt(this.exprX),m=parseInt(this.exprY)):(r=parseInt(this.space.getAbsoluteX(this.exprX)),m=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,r,m)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,d,f,r,m,b,k,l,c,h,e,w,q=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(q,a.Graphic);q.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&&(f=this.rotate(c,b,a.degToRad(d.eval(this.rotateExp))),this.exprX=f.x,this.exprY=f.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((r=d.eval(this.file))||""==r)this.img=this.parent.getImage(r),this.img.addEventListener("load",function(a){e.space.update(!0)})};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};
q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};q.prototype.drawAux=function(f){d=this.evaluator;m=this.space;this.img&&this.img.ready&&this.img.complete&&(this.clip?(e=d.eval(this.clip[2]),w=d.eval(this.clip[3])):(e=this.img.width,w=this.img.height,this.img.canvas&&(e=g(e/this.ratio),w=g(w/this.ratio))),b=this.centered?0:g(e/2),k=this.centered?0:g(w/2),l=g(this.abs_coord?this.exprX:m.getAbsoluteX(this.exprX)),c=g(this.abs_coord?this.exprY:m.getAbsoluteY(this.exprY)),h=
a.degToRad(-d.eval(this.inirot)),f.save(),f.translate(l+b,c+k),f.rotate(h),this.opacity&&(f.globalAlpha=d.eval(this.opacity)),f.scale(this.scaleX,this.scaleY),this.clip?this.img.canvas?f.drawImage(this.img,d.eval(this.clip[0])*this.ratio,d.eval(this.clip[1])*this.ratio,e*this.ratio,w*this.ratio,-e/2,-w/2,e,w):f.drawImage(this.img,d.eval(this.clip[0]),d.eval(this.clip[1]),e,w,-e/2,-w/2,e,w):f.drawImage(this.img,-e/2,-w/2,e,w),f.restore())};a.Image=q;return a}(descartesJS||{});
descartesJS=function(a){function g(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,f,r,m,b,k,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?(f=parseInt(this.exprX),r=parseInt(this.exprY)):(f=parseInt(this.space.getAbsoluteX(this.exprX)),r=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>f||0>r||f>=this.space.w||r>=this.space.h)){m=[[f,r]];k=g(imageData,f,r);for(c=0;0<m.length;){c++;b=m.pop();f=b[0];r=b[1];var e=g(imageData,f,r);if(k.r===e.r&&k.g===e.g&&k.b===e.b&&k.a===e.a){e=imageData;var d=
h;l=4*(f+r*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<f&&m.push([f-1,r]);f<imageData.width-1&&m.push([f+1,r]);m.push([f,r-1]);m.push([f,r+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,g){if(a.loadLib)return a;var d=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,m=function(b,k){var l=a.Graphic.call(this,b,k)||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,k);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);k=l.evaluator.eval(l.expresion);if(k)var h=(h=document.getElementById(k))&&"descartes/macro"==h.type?h.text:a.openExternalFile(k);if(h){var e=a.convertHTMLEntities(h).replace(/\r/g,"").split("\n");h=[];k=0;for(var m=e.length;k<m;k++)if(e[k].trim()){var q=e[k].indexOf("=");if(-1!==q){q=b.split(e[k]);for(var u=0,r=q.length;u<r;u++)if(q[u]&&1<q.length&&("id"===
g[q[u][0]]||"type"===g[q[u][0]])){h.push(q);break}}}u=function(b,e){e=c.tokenize(e.replace(/&squot;/g,"'"));for(var h=0,p=e.length;h<p;h++)if("identifier"==e[h].type&&!a.reservedIds.match("-"+e[h].value+"-")||"R"===e[h].value||"G"===e[h].value||"B"===e[h].value)e[h].value=l.name+"."+e[h].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+c.flatTokens(e)};k=0;for(m=h.length;k<m;k++){var n=(r=h[k]||[],r[0])&&"id"===r[0][0];e=0;for(q=r.length;e<q;e++){var p=r[e][0].indexOf(".");-1===p||n?p=g[r[e][0]]:
(p=g[r[e][0].substring(p+1)],r[e][0]=l.name+"."+r[e][0]);if(!("font"===p||"font_family"===p||("fill"===p||"color"===p||"border"===p||"arrow"===p)&&"("!==r[e][1].charAt(0)||"file"===p&&r[e][1].match(f)||"id"!==p&&void 0!==g[r[e][1]])||"radius"===p)if("text"==p)if(r[e][1].match(/\{\\rtf1/))p=r[e][1],p=p.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),p=p.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),r[e][1]=p;else{var x=b.parseText(r[e][1]).textElementsMacros;
for(var v=0,y=x.length;v<y;v++){p=c.tokenize(x[v].replace(/&squot;/g,"'"));for(var A=0,D=p.length;A<D;A++)if("identifier"===p[A].type&&!a.reservedIds.match("-"+p[A].value+"-")||"R"===p[A].value||"G"===p[A].value||"B"===p[A].value)p[A].value=l.name+"."+p[A].value;p=c.flatTokens(p).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");x[v]=p.substring(1,p.length-1)}r[e][1]=x.join("")}else{x=r[e][1].replace(/&squot;/g,"'").split(";");v=0;for(y=x.length;v<y;v++){p=c.tokenize(x[v].replace(/\\n/g,
";"));A=0;for(D=p.length;A<D;A++)if("identifier"===p[A].type&&!a.reservedIds.match("-"+p[A].value+"-")||"R"===p[A].value||"G"===p[A].value||"B"===p[A].value)p[A].value=l.name+"."+p[A].value;x[v]=c.flatTokens(p)}r[e][1]=x.join(";")}}}k=0;for(m=h.length;k<m;k++)if(h[k][0]){u="";r=!1;e=0;for(q=h[k].length;e<q;e++)"type"===g[h[k][e][0]]&&d.match("-"+g[h[k][e][1]]+"-")&&(r=!0),u=u+h[k][e][0]+"='"+h[k][e][1]+"' ";h[k]=u+(r?" space='"+l.spaceID+"'":"");r?l.graphics.push(b.parseGraphic(h[k],l.abs_coord,l.background,
l.inirot)):b.parseAuxiliar(h[k])}}return l};$jscomp.inherits(m,a.Graphic);m.prototype.update=function(){r=this.evaluator.eval(this.inipos);this.iniPosX=r[0][0];this.iniPosY=r[0][1]};m.prototype.drawAux=function(a){for(var b=0,f=this.graphics.length;b<f;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=m;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sqrt,d=Math.sin,f=Math.cos,r=Math.abs,m,b,k,l,c,h,e,w,q,u,z,n,p,x,v,y=function(a,c,b,e){this.x=a||0;this.y=c||0;this.z=b||0;this.w=e||0;this.adjustDec()};y.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,c,b,e,h,p,f,d,g,q,k,l,n,m,u,w){this.a00=a||0;this.a01=c||0;this.a02=b||0;this.a03=e||0;this.a10=h||0;this.a11=p||0;this.a12=f||0;this.a13=d||0;
this.a20=g||0;this.a21=q||0;this.a22=k||0;this.a23=l||0;this.a30=n||0;this.a31=m||0;this.a32=u||0;this.a33=w||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 y(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};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);k=f(a);w=this.a10;q=this.a11;u=this.a12;
z=this.a13;n=this.a20;p=this.a21;x=this.a22;v=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,w*k+n*b,q*k+p*b,u*k+x*b,z*k+v*b,w*-b+n*k,q*-b+p*k,u*-b+x*k,z*-b+v*k,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){b=d(a);k=f(a);l=this.a00;c=this.a01;h=this.a02;e=this.a03;n=this.a20;p=this.a21;x=this.a22;v=this.a23;return new A(l*k+n*-b,c*k+p*-b,h*k+x*-b,e*k+v*-b,this.a10,this.a11,this.a12,this.a13,l*b+n*k,c*b+p*k,h*b+x*k,e*b+v*k,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){b=d(a);k=f(a);l=this.a00;c=this.a01;h=this.a02;e=this.a03;w=this.a10;q=this.a11;u=this.a12;z=this.a13;return new A(l*k+w*b,c*k+q*b,h*k+u*b,e*k+z*b,l*-b+w*k,c*-b+q*k,h*-b+u*k,e*-b+z*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return g(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(c){m=a.norm3D(c);if(0===m)return{x:0,y:0,z:0};if(1===m)return{x:c.x,y:c.y,z:c.z};m=1/m;return{x:c.x*m,y:c.y*m,z:c.z*m}};a.dotProduct3D=function(a,c){return a.x*
c.x+a.y*c.y+a.z*c.z};a.crossProduct3D=function(a,c){return{x:a.y*c.z-a.z*c.y,y:a.z*c.x-a.x*c.z,z:a.x*c.y-a.y*c.x}};a.scalarProduct3D=function(a,c){return{x:a.x*c,y:a.y*c,z:a.z*c}};a.subtract3D=function(a,c){return{x:a.x-c.x,y:a.y-c.y,z:a.z-c.z}};a.add3D=function(a,c){return{x:a.x+c.x,y:a.y+c.y,z:a.z+c.z}};a.equals3DEpsilon=function(a,c,b){return r(a.x-c.x)<=b&&r(a.y-c.y)<=b&&r(a.z-c.z)<=b};a.Vector4D=y;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function g(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function d(a,c){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);q=1;for(u=this.projVert.length;q<u;q++)a.lineTo(this.projVert[q].x,this.projVert[q].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=c.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function f(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";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 r(a){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function m(c,b,e){return a.normalize3D(a.crossProduct3D(a.subtract3D(c,
b),a.subtract3D(c,e)))}if(a.loadLib)return a;var b=2*Math.PI,k=lineJoin="round",l,c,h,e,w,q,u,z,n,p,x,v,y,A=function(a,c){Object.assign(this,a);this.space=c;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=g:"face"===this.type?(this.normal=m(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=d):"text"===this.type?this.draw=f:"edge"===this.type&&(this.draw=r);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};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};q=0;for(u=this.vertices.length;q<u;q++)this.spaceVertices[q]=c.rotateVertex(this.vertices[q]),this.average.x+=this.spaceVertices[q].x,this.average.y+=this.spaceVertices[q].y,this.average.z+=this.spaceVertices[q].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=m(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));q=0;for(u=this.vertices.length;q<u;q++)this.newSpaceVert[q]=this.spaceVertices[q],this.projVert[q]=this.newProjVert[q]=c.project(this.spaceVertices[q]);2<this.vertices.length&&(this.direction=m(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;q=0;for(u=this.vertices.length;q<u;q++)z=a.norm3D(a.subtract3D(this.spaceVertices[q],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,z),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,z);q=0;for(u=this.vertices.length;q<u;q++)this.minx>this.projVert[q].x&&(this.minx=this.projVert[q].x),this.maxx<this.projVert[q].x&&(this.maxx=this.projVert[q].x),this.miny>this.projVert[q].y&&(this.miny=this.projVert[q].y),
this.maxy<this.projVert[q].y&&(this.maxy=this.projVert[q].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){w=[];q=0;for(u=this.vertices.length;q<u;q++)(1E-8<Math.abs(this.vertices[q].x-this.vertices[(q+1)%u].x)||1E-8<Math.abs(this.vertices[q].y-this.vertices[(q+1)%u].y)||1E-8<Math.abs(this.vertices[q].z-this.vertices[(q+1)%u].z)||1E-8<Math.abs(this.vertices[q].w-this.vertices[(q+1)%u].w))&&w.push(this.vertices[q]);0===w.length&&w.push(this.vertices[0]);this.vertices=w}};A.prototype.drawText=
function(b,e,p,f,d,g,q,k,n,m,u){l=this.evaluator;b.textNode=e;g=l.eval(this.offset_dist);q=-a.degToRad(l.eval(this.offset_angle));p+=g*Math.cos(q);f+=g*Math.sin(q);b.textNode.pos={x:p,y:f};e.hasContent&&(e.draw(b,d,p,f,!0),h=this.fromPoint?e.textNodes.metrics.w/2:0,c=this.fromPoint?e.textNodes.metrics.h/2:0,e.draw(b,d,p-h,f-c))};A.prototype.splitFace=function(c){if(this.intersects(c)){var b=i2=null,e=ix2=0,h,p;var f=this.vertices;var d=c.vertices;var g=0;for(p=d.length;g<p;g++){var q=this.intersection(d[g],
d[(g+1)%p]);if(null!==q)if(null===b){if(b=q,e=g,2===d.length){i2=b;break}}else if(!a.equals3DEpsilon(q,b,1E-8)){i2=q;ix2=g;break}}if(null!==b&&null!==i2){g=this.isInterior(b)||this.isInterior(i2);var k=h=null;if(!g&&3<=d.length)for(p=0,f=f.length;p<f;p++)if(q=c.intersection(this.vertices[p],this.vertices[(p+1)%f]),null!==q)if(null===h)h=q;else if(!a.equals3DEpsilon(q,h,1E-8)){k=q;break}if(g||null!==h&&null!==k&&c.isInterior(h)&&c.isInterior(k)){k=!0;f=q=null;if(2===d.length)a.equals3DEpsilon(b,d[0],
1E-8)||a.equals3DEpsilon(b,d[1],1E-8)?k=!1:(q=[],q[0]=d[0],q[1]=b,f=[],f[0]=b,f[1]=d[1]);else for(q=[],f=[],g=p=h=0;g<d.length;g++)g<e?q[h++]=d[g]:g==e?(q[h++]=d[g],q[h++]=b,f[p++]=b):g<ix2?f[p++]=d[g]:g==ix2?(f[p++]=d[g],f[p++]=i2,q[h++]=i2):q[h++]=d[g];if(k){b=[];b[0]=new A({vertices:q,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:f,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 e=c.vertices;if(0<b.length){var h=a.dotProduct3D(e[0],c.normal);var p=a.dotProduct3D(b[0],c.normal);if(1E-8>Math.abs(h-p))return!0;for(var f=1,d=
b.length;f<d;f++)if(e=a.dotProduct3D(b[f],c.normal),1E-8>Math.abs(h-e)||e>h&&p<h||e<h&&p>h)return!0}return!1};A.prototype.intersection=function(c,b){var e=this.vertices;if(0<e.length){b=a.subtract3D(b,c);var h=a.dotProduct3D(b,this.normal);if(0!==h&&(e=a.dotProduct3D(a.subtract3D(e[0],c),this.normal)/h,-1E-8<e&&1.00000001>e))return a.add3D(c,a.scalarProduct3D(b,e))}return null};A.prototype.isInterior=function(c){var b=this.vertices;if(0<b.length)for(var e=0,h=a.subtract3D(b[0],c),p=0,f=b.length;p<
f;p++){var d=a.subtract3D(b[(p+1)%f],c),g=a.dotProduct3D(a.crossProduct3D(h,d),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(h,d))break}else{if(0>e&&0<g||0<e&&0>g)return!1;h=d;e=g}}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(v=0;3>v;v++)if(n=null,n=0===v?this.intersections(c):1===v?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=n&&0<n.length){for(y=
0;y<n.length;y++)a.push(n[y]);q=0;for(u=n.length;q<u;q++){p=n[q];x=this.space.rayFromEye(p.x,p.y);try{t=this.distanceToEyeAlong(x)-c.distanceToEyeAlong(x);if(t<=-b)return!0;if(t>=b)return!1}catch(F){}}}return!1};A.prototype.intersections=function(c){for(var b=[],e,h,p,f=new a.R2,d=this.newSpaceVert,g=c.newSpaceVert,q=this.newProjVert,k=c.newProjVert,l=0,n=d.length;l<n;l++){c=d[l];e=d[(l+1)%n];for(var m=0,u=g.length;m<u;m++)h=g[m],p=g[(m+1)%u],c!=h&&c!=p&&e!=h&&e!=p&&(h=f.intersection(q[l],q[(l+1)%
n],k[m],k[(m+1)%u]),null!=h&&b.push(h))}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,e=this.newProjVert,h=0,p=b.length;h<p;h++)!a.isVertex(b[h])&&a.appearsToContain(e[h])&&c.push(e[h]);return c};A.prototype.appearsToContain=function(a){for(var c=
0,b,e=this.newProjVert,h=0,p=this.newSpaceVert.length;h<p;h++){b=(e[h].x-a.x)*(e[(h+1)%p].y-a.y)-(e[(h+1)%p].x-a.x)*(e[h].y-a.y);if(0!=c)if(1E-8>Math.abs(b)){if(1E-8<Math.abs(e[h].x-e[(h+1)%p].x))return Math.min(e[h].x,e[(h+1)%p].x)<=a.x+1E-8&&a.x<=Math.max(e[h].x,e[(h+1)%p].x)+1E-8;if(1E-8<Math.abs(e[h].y-e[(h+1)%p].y))return Math.min(e[h].y,e[(h+1)%p].y)<=a.y+1E-8&&a.y<=Math.max(e[h].y,e[(h+1)%p].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,e=0,h=b.length;e<h;e++)if(a.equals3DEpsilon(c,b[e],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var c=[],b=0,e,h=a.length,f=a.length-1;-1<f;f--)e=a.charAt(f),0==b?"="==e&&(b=1):1==b?" "!=e&&(b="<"===e||">"===e?0:2):2==b&&" "==e&&(c.unshift(a.substring(f+1,h)),h=f,b=0);c.unshift(a.substring(0,h));return c}if(a.loadLib)return a;var d={x:0,y:0,z:0},f,r,m,b,k,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(){f=this.evaluator;r=f.eval(this.family_interval);this.familyInf=r[0][0];this.familySup=r[0][1];this.fSteps=Math.round(f.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};h.prototype.buildFamilyPrimitives=function(){f=this.evaluator;this.getFamilyValues();m=f.getVariable(this.family);if(0<=this.fSteps)for(var a=0,c=this.fSteps;a<=c;a++)f.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,f.eval(this.drawif)&&this.buildPrimitives();f.setVariable(this.family,m)};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?k=
this.inirotM.multiplyVector4(a):(k=this.inirotM_X.multiplyVector4(a),k=this.inirotM_Y.multiplyVector4(k),k=this.inirotM_Z.multiplyVector4(k));k=this.iniposM.multiplyVector4(k);this.endrotEuler?k=this.endrotM.multiplyVector4(k):(k=this.endrotM_X.multiplyVector4(k),k=this.endrotM_Y.multiplyVector4(k),k=this.endrotM_Z.multiplyVector4(k));k=this.endposM.multiplyVector4(k);this.macroChildren&&(k=this.applyMacroTransform(k));k.adjustDec();return k};h.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
k=this.macro_inirotM.multiplyVector4(a):(k=this.macro_inirotM_X.multiplyVector4(a),k=this.macro_inirotM_Y.multiplyVector4(k),k=this.macro_inirotM_Z.multiplyVector4(k));k=this.macro_iniposM.multiplyVector4(k);this.macro_endrotEuler?k=this.macro_endrotM.multiplyVector4(k):(k=this.macro_endrotM_X.multiplyVector4(k),k=this.macro_endrotM_Y.multiplyVector4(k),k=this.macro_endrotM_Z.multiplyVector4(k));return k=this.macro_endposM.multiplyVector4(k)};h.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
c=[],b=0,h=a.length;b<h;b++)""!==a[b].trim()&&(c=c.concat(g(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,f=a.primitives.length;h<f;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 g,d,f,r,m,b=function(b,f){return a.Graphic3D.call(this,b,f)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();d=g.eval(this.expresion);f=d[0][0];r=d[0][1];m=d[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,r,m,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:g.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||g.parser.parse("10"),this.offset_angle=this.offset_angle||g.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,r,m,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:g.eval(this.decimals),fixed:this.fixed,evaluator:g,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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();k=l.getVariable("u");l.setVariable("u",this.Nu);c=l.eval(this.expresion);g=c[0][0];d=c[0][1];f=c[0][2];r=c[1][0];m=c[1][1];b=c[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
d,f,1)),this.transformVertex(new a.Vector4D(r,m,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:l.eval(this.width)},this.space));l.setVariable("u",k)};a.Segment3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l,c,h,e,w,q,u,z=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(z,a.Graphic3D);z.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();r=g.getVariable("x");m=g.getVariable("y");b=g.getVariable("z");
d=g.getVariable("u");f=g.getVariable("v");g.setVariable("u",0);g.setVariable("v",0);k=parseInt(g.eval(this.Nu));l=parseInt(g.eval(this.Nv));c=[];for(e=0;e<=k;e++)for(g.setVariable("u",e/k),w=0;w<=l;w++){g.setVariable("v",w/l);q=0;for(u=this.expresion.length;q<u;q++)g.eval(this.expresion[q]);c.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}var n=this.color.getColor(),p=this.backcolor.getColor(),x=this.edges?this.edges.getColor():"";for(e=0;e<
k;e++)for(w=0;w<l;w++)h=[],h.push(c[w+e*l+e]),h.push(c[w+1+e*l+e]),h.push(c[w+2+(e+1)*l+e]),h.push(c[w+1+(e+1)*l+e]),this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:n,backColor:p,edges:x,model:this.model},this.space));g.setVariable("x",r);g.setVariable("y",m);g.setVariable("z",b);g.setVariable("u",d);g.setVariable("v",f)};a.Surface3D=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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(){k=this.evaluator;this.updateMVMatrix();l=k.eval(this.expresion);for(var c=this.color.getColor(),e=0,w=l.length-1;e<w;e++)g=l[e][0],d=l[e][1],f=l[e][2],r=l[e+1][0],m=l[e+1][1],b=l[e+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
d,f,1)),this.transformVertex(new a.Vector4D(r,m,b,1))],type:"edge",frontColor:c,lineWidth:k.eval(this.width)},this.space))};a.Polygon3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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(){k=this.evaluator;this.updateMVMatrix();r=k.getVariable("x");m=k.getVariable("y");b=k.getVariable("z");f=k.getVariable("u");k.setVariable("u",0);d=k.eval(this.Nu);g=[];for(var c=0;c<=d;c++){k.setVariable("u",c/d);for(var h=0,e=
this.expresion.length;h<e;h++)k.eval(this.expresion[h]);g.push(this.transformVertex(new a.Vector4D(k.getVariable("x"),k.getVariable("y"),k.getVariable("z"),1)))}c=0;for(h=g.length-1;c<h;c++)this.primitives.push(new a.Primitive3D({vertices:[g[c],g[c+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));this.fill&&2<g.length&&this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));k.setVariable("x",r);k.setVariable("y",b);k.setVariable("z",m);k.setVariable("u",f)};a.Curve3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l,c,h,e,w=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(w,a.Graphic3D);w.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();e=h.eval(this.expresion);g=e[0][0];d=e[0][1];f=e[0][2];r=e[1][0];m=e[1][1];b=e[1][2];k=e[2][0];l=e[2][1];c=e[2][2];var q=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,d,f,1)),this.transformVertex(new a.Vector4D(k,
l,c,1)),this.transformVertex(new a.Vector4D(r,m,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:q,model:this.model},this.space))};a.Triangle3D=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r=function(f,b){return a.Graphic3D.call(this,f,b)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){d=this.evaluator;this.updateMVMatrix();f=d.eval(this.expresion);g=[];for(var m=f.length-1;0<=m;m--)g.push(this.transformVertex(new a.Vector4D(f[m][0],f[m][1],f[m][2],1)));m=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:m,model:this.model},this.space))};a.Face3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k=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(k,a.Graphic3D);k.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();g=b.eval(this.Nu);d=[this.transformVertex(new a.Vector4D(0,0,0,1))];f=b.eval(this.width)/2;r=b.eval(this.length)/2;m=2*Math.PI/g;for(var k=0;k<g;k++)d.push(this.transformVertex(new a.Vector4D(f*
Math.cos(m*k),r*Math.sin(m*k),0,1)));var c=this.color.getColor(),h=this.backcolor.getColor(),e=this.edges?this.edges.getColor():"";for(k=0;k<g;k++)this.primitives.push(new a.Primitive3D({vertices:[d[0],k+2<=g?d[k+2]:d[1],d[k+1]],type:"face",frontColor:c,backColor:h,edges:e,model:this.model},this.space))};a.Polireg3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m=function(b,f){b=a.Graphic3D.call(this,b,f)||this;b.shadowColor=b.shadowColor?b.shadowColor.getColor():"transparent";return b};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){g=this.evaluator;d=g.eval(this.expresion);f=d[0][0];r=d[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(f,r,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:g.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:g,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=m;return a}(descartesJS||{});
descartesJS=function(a,g){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-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,m,b=0,k=function(k,c){var h=a.Graphic.call(this,k,c)||this;h.expresion=h.expresion||void 0;h.inirot=h.inirot||"(0,0,0)";h.inirotEuler=h.inirotEuler||!1;h.inipos=h.inipos||k.evaluator.parser.parse("(0,0,0)");h.endrot=
h.endrot||"(0,0,0)";h.endrotEuler=h.endrotEuler||!1;h.endpos=h.endpos||k.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=[];k=k.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 l=(l=document.getElementById(c))&&"descartes/macro"==l.type?l.text:a.openExternalFile(c);
if(l){var q=a.convertHTMLEntities(l).replace(/\r/g,"").split("\n");l=[];c=0;for(var m=q.length;c<m;c++){var r=q[c].indexOf("=");if(-1!==r){r=k.split(q[c]);for(var n=0,p=r.length;n<p;n++)if(r[n]&&1<r.length&&("id"===g[r[n][0]]||"type"===g[r[n][0]])){l.push(r);break}}}c=0;for(m=l.length;c<m;c++){p=(n=l[c]||[],n[0])&&"id"===n[0][0];var x=!1;q=0;for(r=n.length;q<r;q++){var v=n[q][0].indexOf(".");-1===v||p?v=g[n[q][0]]:(v=g[n[q][0].substring(v+1)],n[q][0]=h.name+"."+n[q][0]);"type"===v&&"surface"===g[n[q][1]]&&
(x=!0);if(!("font"===v||"font_family"===v||("fill"===v||"color"===v||"backcolor"===v||"arrow"===v)&&"("!==n[q][1].charAt(0)||"file"===v&&n[q][1].match(f)||"id"!==v&&void 0!==g[n[q][1]]||x&&"expresion"===v)||"width"===v||"height"===v||"length"===v)if("text"==v)if(n[q][1].match(/\{\\rtf1/)){v=n[q][1];var y=h;var A=function(c,b){b=e.tokenize(b.replace(/&squot;/g,"'"));for(var h=0,p=b.length;h<p;h++)if("identifier"==b[h].type&&!a.reservedIds.match("-"+b[h].value+"-")||"R"===b[h].value||"G"===b[h].value||
"B"===b[h].value)b[h].value=y.name+"."+b[h].value;return(c.match(/^\\expr/)?"\\expr ":"\\decimals ")+e.flatTokens(b)};v=v.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,A);v=v.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,A);n[q][1]=v}else{A=k.parseText(n[q][1]).textElementsMacros;for(var D=0,J=A.length;D<J;D++){v=e.tokenize(A[D].replace(/&squot;/g,"'"));for(var E=0,F=v.length;E<F;E++)if("identifier"===v[E].type&&!a.reservedIds.match("-"+v[E].value+
"-")||"R"===v[E].value||"G"===v[E].value||"B"===v[E].value)v[E].value=h.name+"."+v[E].value;v=e.flatTokens(v).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");A[D]=v.substring(1,v.length-1)}n[q][1]=A.join("")}else{A=n[q][1].replace(/&squot;/g,"'").split(";");D=0;for(J=A.length;D<J;D++){v=e.tokenize(A[D].replace(/\\n/g,";"));E=0;for(F=v.length;E<F;E++)if("identifier"===v[E].type&&!a.reservedIds.match("-"+v[E].value+"-")||"R"===v[E].value||"G"===v[E].value||"B"===v[E].value)v[E].value=
h.name+"."+v[E].value;A[D]=e.flatTokens(v)}n[q][1]=A.join(";")}}}c=0;for(m=l.length;c<m;c++)if(l[c][0]){n="";p=!1;q=0;for(r=l[c].length;q<r;q++)"type"===g[l[c][q][0]]&&d.match("-"+g[l[c][q][1]]+"-")&&(p=!0),n=n+l[c][q][0]+"='"+l[c][q][1]+"' ";l[c]=n+(p?" space='"+h.spaceID+"'":"");p?h.graphics.push(k.parse3DGraphic(l[c],h.abs_coord,h.background,h.inirot)):k.parseAuxiliar(l[c])}}c=0;for(m=h.graphics.length;c<m;c++)h.graphics[c].macroChildren=!0;return h};$jscomp.inherits(k,a.Graphic);k.prototype.buildFamilyPrimitives=
function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var 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)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};
k.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var c=this.graphics.length;a<c;a++)r=this.graphics[a],r.macro_inirotEuler=this.inirotEuler,r.macro_inirotM=this.inirotM,r.macro_inirotM_X=this.inirotM_X,r.macro_inirotM_Y=this.inirotM_Y,r.macro_inirotM_Z=this.inirotM_Z,r.macro_iniposM=this.iniposM,r.macro_endrotEuler=this.endrotEuler,r.macro_endrotM=this.endrotM,r.macro_endrotM_X=this.endrotM_X,
r.macro_endrotM_Y=this.endrotM_Y,r.macro_endrotM_Z=this.endrotM_Z,r.macro_endposM=this.endposM,r.update();a=0;for(c=this.graphics.length;a<c;a++){r=this.graphics[a];if(r.split||this.split)for(var b=a+1;b<c;b++)m=this.graphics[b],(m.split||this.split)&&r.splitFace(m);this.primitives=this.primitives.concat(r.primitives||[])}};k.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),
this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);
tmpExpr=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));
tmpExpr=this.evaluator.eval(this.endpos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};k.prototype.drawAux=function(a){};a.Macro3D=k;return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,c,b,e,h){d.call(this,a/n,a/n,a/n,e,h)}function d(a,c,b,e,h){a/=2;c/=2;b/=2;this.changeGeometry(a,c,b,e,h)||(this.vertices=[new p(a,b,c,1),new p(a,-b,c,1),new p(a,b,-c,1),new p(a,-b,-c,1),new p(-a,b,c,1),new p(-a,-b,c,1),new p(-a,b,-c,1),new p(-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 f(a,c,b,e,h){a/=2;if(!this.changeGeometry(a,c,b,e,h)){var f=2*Math.PI/3,d=2*a*Math.sqrt(2)/3,g=-a/
3,k=d*Math.cos(f)+0*Math.sin(f);f=-d*Math.sin(f)+0*Math.cos(f);this.vertices=[new p(0,0,a,1),new p(k,f,g,1),new p(k,-f,g,1),new p(d,0,g,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,c,b,e,h)}}function r(a,c,b,e,h){a/=2;this.changeGeometry(a,c,b,e,h)||(this.vertices=[new p(0,0,a,1),new p(a,0,0,1),new p(-a,0,0,1),new p(0,a,0,1),new p(0,-a,0,1),new p(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 m(c,
b,e,h,f){c/=Math.PI;if(!this.changeGeometry(c,b,e,h,f)){B=c/1.6180339887;L=1.6180339887*c;this.vertices=[new p(c,c,c,1),new p(c,c,-c,1),new p(c,-c,c,1),new p(c,-c,-c,1),new p(-c,c,c,1),new p(-c,c,-c,1),new p(-c,-c,c,1),new p(-c,-c,-c,1),new p(0,B,L,1),new p(0,B,-L,1),new p(0,-B,L,1),new p(0,-B,-L,1),new p(B,L,0,1),new p(B,-L,0,1),new p(-B,L,0,1),new p(-B,-L,0,1),new p(L,0,B,1),new p(L,0,-B,1),new p(-L,0,B,1),new p(-L,0,-B,1)];I=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(N=this.vertices.length;H<
N;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,f)}}function b(c,b,e,h,f){c/=3.8;if(!this.changeGeometry(c,b,e,h,f)){L=1.6180339887*c;this.vertices=[new p(0,c,L,1),new p(0,c,-L,1),new p(0,-c,L,1),new p(0,-c,-L,1),new p(c,L,0,1),new p(c,-L,0,1),new p(-c,L,0,1),new p(-c,-L,0,1),
new p(L,0,c,1),new p(L,0,-c,1),new p(-L,0,c,1),new p(-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(N=this.vertices.length;H<N;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.updateValues(c,b,e,h,f)}}function k(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 p(0,0,c,1)];for(H=1;H<e;H++)for(E=H*u/e,C=0;C<h;C++)J=C*z/h,y=a*w(E)*q(J),A=b*w(E)*w(J),D=c*q(E),this.vertices.push(new p(y,A,D,1));this.vertices.push(new p(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++)y=a*(h-H)/h*q(C*z/e),A=b*(h-H)/h*w(C*z/e),D=c-2*H*c/h,this.vertices.push(new p(y,A,D,1));this.vertices.push(new p(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++)y=a*q(C*z/e),A=b*w(C*z/e),D=c-2*H*c/h,this.vertices.push(new p(y,A,D,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=x.eval(this.R);G=x.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++)y=
-(F+G*w(z*C/e))*w(z*H/h),A=(F+G*w(z*C/e))*q(z*H/h),D=G*q(z*C/e),this.vertices.push(new p(y,A,D,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(N=this.fileData.length;H<N;H++)M=this.fileData[H],M.match(/^V\(/)?(P=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new p(P[0]||0,P[1]||0,P[2]||0,1))):M.match(/^F\(/)&&(P=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(P.reverse()))}if(a.loadLib)return a;var w=Math.sin,q=Math.cos,u=Math.PI,z=2*u,n=Math.sqrt(3),p,x,v,y,A,D,J,E,F,G,B,L,I,M,P,H,N,C,R,K=function(q,n){n=a.Graphic3D.call(this,q,n)||this;n.width=n.width||q.evaluator.parser.parse("2");n.height=n.height||q.evaluator.parser.parse("2");n.length=n.length||q.evaluator.parser.parse("2");n.R=n.R||q.evaluator.parser.parse("2");n.r=n.r||q.evaluator.parser.parse("1");p=a.Vector4D;switch(n.subType){case "cube":n.buildGeometry=
g;break;case "box":n.buildGeometry=d;break;case "tetrahedron":n.buildGeometry=f;break;case "octahedron":n.buildGeometry=r;break;case "sphere":n.isSphere=!0;case "ellipsoid":n.buildGeometry=k;break;case "dodecahedron":n.buildGeometry=m;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(){x=this.evaluator;this.updateMVMatrix();this.buildGeometry(x.eval(this.width),x.eval(this.height),x.eval(this.length),x.eval(this.Nu),x.eval(this.Nv));var c=this.color.getColor(),b=this.backcolor.getColor(),e=this.edges?this.edges.getColor():"";H=0;for(N=this.faces.length;H<N;H++){v=[];C=0;for(R=this.faces[H].length;C<R;C++)v.push(this.transformVertex(this.vertices[this.faces[H][C]]));this.primitives.push(new a.Primitive3D({vertices:v,
type:"face",frontColor:c,backColor:b,edges:e,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,c,b,e,h){return this.oldWidth===a&&this.oldHeight===c&&this.oldLength===b&&this.oldNu===e&&this.oldNv===h};K.prototype.updateValues=function(a,c,b,e,h){this.oldWidth=a;this.oldHeight=c;this.oldLength=b;this.oldNv=h;this.oldNu=e};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,d=Math.min,f=Math.PI,r=Math.cos,m=Math.sin,b=Math.abs,k=Math.round,l,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F,G=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c};G.prototype.set=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c;return this};G.prototype.copy=function(){return new G(this.x,this.y)};G.prototype.ix=function(){return k(g(d(this.x,32E3),-32E3))};G.prototype.iy=function(){return k(g(d(this.y,32E3),-32E3))};G.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};G.prototype.norm2=function(){return this.x*this.x+this.y*this.y};G.prototype.norm=function(){return Math.sqrt(this.norm2())};G.prototype.distance=function(a){c=this.copy();c.sub(a);return c.norm()};G.prototype.dot=function(a){return this.x*a.x+this.y*a.y};G.prototype.det=function(a){return this.x*a.y-this.y*a.x};G.prototype.mul=function(a){this.x*=a;this.y*=a};G.prototype.div=function(a){this.x/=a;this.y/=a};G.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};G.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};G.prototype.normalize=function(){l=this.norm();0!=l&&this.div(l)};G.prototype.rotR90=function(){l=this.x;this.x=this.y;this.y=-l};G.prototype.rotL90=function(){l=this.x;this.x=-this.y;this.y=l};G.prototype.rot=function(a){h=this.copy();q=r(a);u=m(a);this.x=h.x*q-h.y*u;this.y=h.x*u+h.y*q};G.prototype.rot2=function(a){this.rot(a*f/180)};G.prototype.intersection=function(a,c,h,f){z=c.x-a.x;n=h.x-f.x;p=h.x-a.x;x=c.y-a.y;v=h.y-f.y;y=h.y-a.y;F=z*
v-n*x;return 1E-6<b(F)?(e=(p*v-y*n)/F,w=(-p*x+y*z)/F,0<=e&&1>=e&&0<=w&&1>=w?new G(a.x+z*e,a.y+x*e):null):(c.x-h.x)*y!=(c.y-h.y)*p?null:a.x!=c.x?(A=d(a.x,c.x),D=g(a.x,c.x),A<=h.x&&h.x<=D?h:A<=f.x&&f.x<=D?f:null):h.x!=f.x?(J=d(h.x,f.x),E=g(h.x,f.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),D=g(a.y,c.y),A<=h.y&&h.y<=D?h:A<=f.y&&f.y<=D?f:null):h.y!=f.y?(J=d(h.y,f.y),E=g(h.y,f.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=G;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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);m=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){g=this.evaluator;b.x=0;b.y=0;k=g.getVariable("x");l=g.getVariable("y");g.setVariable("x",a.x);g.setVariable("y",a.y);this.f0=g.eval(this.constraint);g.setVariable("x",g.getVariable("x")+1E-6);d=g.eval(this.constraint);b.x=(d-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;g.setVariable("x",g.getVariable("x")-1E-6);g.setVariable("y",
g.getVariable("y")+1E-6);d=g.eval(this.constraint);b.y=(d-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;g.setVariable("x",k);g.setVariable("y",l);return b};h.prototype.findZero=function(a,c,b){g=this.evaluator;m.x=a.x;m.y=a.y;k=g.getVariable("x");l=g.getVariable("y");g.setVariable("x",a.x);g.setVariable("y",a.y);this.f0=g.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return m;g.setVariable("x",k);g.setVariable("y",l);for(var h=0;16>h;h++)if(f=m.x,r=m.y,this.normal=
this.gradient(m),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),m.x=f+this.normal.x,m.y=r+this.normal.y,this.normal.norm()<c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=m.x-a.x,this.normal.y=m.y-a.y),m;return b?m:null};a.R2Newton=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(a,f){this.x=a;this.y=f};g.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};g.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};g.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};g.AXIS_X=new g(1,0);g.AXIS_Y=new g(0,1);a.Vector2D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,d=Math.round,f,r,m,b,k,l,c,h,e,w,q,u,z,n=function(c,b){this.parent=c;this.evaluator=c.evaluator;var h=this.parser=c.evaluator.parser;this.id="GraphicControl"!==b.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==b.type?100:350;this.h="Video"!==b.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==b.type&&"Audio"!==b.type&&"Video"!==b.type?"TextArea"!==b.type?this.expresion=h.parse("(0,0,100,23)"):
(this.expresion=h.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=h.parse("(0,0)");this.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=h.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=h.parse("1");this.activeif=h.parse("1");this.valueExpr=h.parse("0");this.decimals=h.parse("2");this.min=h.parse("-Infinity");this.max=h.parse("Infinity");this.incr=h.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,b);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==this.name||
"_nada_"==this.name||"_void_"==this.name?"":this.name;b=this.evaluator.eval(this.expresion);this.x=d(b[0][0]);this.y=d(b[0][1]);4==b[0].length&&(this.w=d(b[0][2]),this.h=d(b[0][3]));this.actionExec=c.lessonParser.parseAction(this)};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 h=a[c];if(h.id===this.spaceID)return h.addCtr(this),
this.zIndex=h.zIndex,this.space=h,h.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(){m=b=k=l=!1;c=this.evaluator.eval(this.expresion);h=d(c[0][0]);m=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]),k=d(this.w)!==
h,this.w=h,h=d(c[0][3]),l=d(this.h)!==h,this.h=h);if(k||l||m||b)this.init(!0,!0),this.draw()};n.prototype.formatOutputValue=function(a){z=this.parent;e=a+"";w=this.evaluator.eval(this.decimals);q=e.indexOf(".");-1!=q&&(u=e.substring(q+1),u.length>w&&(e=parseFloat(e).toFixed(w)));this.fixed&&(2!==z.version||2===z.version&&!this.exponentialif)&&(e=parseFloat(a).toFixed(w));this.exponentialif&&0!=parseFloat(e)&&(e=this.fixed&&2!==z.version?parseFloat(e).toExponential(w):parseFloat(e).toExponential(),
e=e.toUpperCase().replace("+",""));return e.replace(".",z.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);f=c*c;for(a=0;a<c;a++)r=g(a-35*c/100),this.linearGradient.addColorStop(a/c,"rgba(0,0,0,"+
r*r*192/f/255+")")};a.Control=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,d=Math.abs,f=/[\w\.\-//]*(\.gif)/gi,r,m,b,k,l,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F,G,B,L,I,M,P,H,N,C,R,K,Q,O,S=function(c,b){var h=a.Control.call(this,c,b)||this;h.imageSrc=b.imageSrc||"";h.image=b.image||new Image;h.imageOver=b.imageOver||new Image;h.imageDown=b.imageDown||new Image;h.flat=b.flat||!1;h.borderColor=b.borderColor||!1;h.text_align=b.text_align||"center_center";h.image_align=b.image_align||"center_center";h.font_family=a.getFontName(b.font_family||
"arial");h.ratio=c.ratio;-1===h.font_size&&(h.fontSizeNotSet=!0);h.borderColor&&(h.borderColor=new a.Color(h.borderColor));h.text_align=h.text_align.split("_");h.image_align=h.image_align.split("_");h.old_name=h.name;h.name.match(/^\[.*\]?/)?h.name=h.parser.parse(h.name.substring(1,h.name.length-1)):h.name=h.parser.parse("'"+h.name+"'");h.classContainer=h.cssClass?" "+h.cssClass+" ":"";h.extra_style=h.imageSrc.trim().match("^_STYLE_")?h.imageSrc.trim().substring(8):h.extra_style||"";h.imageSrc.trim().match("^_STYLE_")&&
(h.imageSrc="vacio.gif");if(h.extra_style){h.customStyle=!0;h.btnStyle=[];h.conStyle=[];h.conStyle.textBorder=3;c=h.extra_style.split("|");for(var e,f=0,p=c.length;f<p;f++)b=c[f],e=b.match(/rgb/g),b.match("class=")?h.classContainer=" "+b.substring(6):b.match("border=")?(h.btnStyle.push({type:"border-style",value:"solid"}),h.btnStyle.push({type:"border-width",value:b.substring(7).trim()+"px"})):b.match("borderRadius=")?(h.btnStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"}),h.conStyle.push({type:"border-radius",
value:b.substring(13).trim()+"px"})):b.match("borderColor=")?h.btnStyle.push({type:"border-color",value:(e?"":"#")+b.substring(12).trim()}):b.match("overColor=")?h.conStyle.overColor=(e?"":"#")+b.substring(10).trim():b.match("downColor=")?h.conStyle.downColor=(e?"":"#")+b.substring(10).trim():b.match("font=")?h.conStyle.font=b.substring(5).trim().toLowerCase():b.match("inactiveColor=")?h.conStyle.inactiveColor=(e?"":"#")+b.substring(14).trim():b.match("inactiveColorBorder=")?h.conStyle.inactiveColorBorder=
(e?"":"#")+b.substring(20).trim():b.match("shadowTextBlur=")?h.conStyle.shadowTextBlur=parseFloat(b.substring(15).trim()):b.match("shadowTextOffsetX=")?h.conStyle.shadowTextOffsetX=parseFloat(b.substring(18).trim()):b.match("shadowTextOffsetY=")?h.conStyle.shadowTextOffsetY=parseFloat(b.substring(18).trim()):b.match("shadowTextColor=")?h.conStyle.shadowTextColor=(e?"":"#")+b.substring(16).trim():b.match("shadowBoxBlur=")?h.conStyle.shadowBoxBlur=parseFloat(b.substring(14).trim()):b.match("shadowBoxOffsetX=")?
h.conStyle.shadowBoxOffsetX=parseFloat(b.substring(17).trim()):b.match("shadowBoxOffsetY=")?h.conStyle.shadowBoxOffsetY=parseFloat(b.substring(17).trim()):b.match("shadowBoxColor=")?h.conStyle.shadowBoxColor=(e?"":"#")+b.substring(15).trim():b.match("shadowInsetBoxBlur=")?h.conStyle.shadowInsetBoxBlur=parseFloat(b.substring(19).trim()):b.match("shadowInsetBoxOffsetX=")?h.conStyle.shadowInsetBoxOffsetX=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxOffsetY=")?h.conStyle.shadowInsetBoxOffsetY=
parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxColor=")?h.conStyle.shadowInsetBoxColor=(e?"":"#")+b.substring(20).trim():b.match("textBorder=")?h.conStyle.textBorder=parseFloat(b.substring(11).trim()):b.match("flat=")?h.flat=1==parseInt(b.substring(5).trim()):b.match("imgSizeW=")?h.imgSizeW=parseFloat(b.substring(9))||0:b.match("imgSizeH=")&&(h.imgSizeH=parseFloat(b.substring(9))||0)}h.imageSrc.match("_COLORES_")&&(c=h.imageSrc.split("_"),h.colorInt=new a.Color(c[2]),h.color=new a.Color(c[3]),
h.font_size=h.parser.parse(c[5]),h.imageSrc="");h.imageSrc.match(/^\[.*\]?/)?h.imageSrc=h.parser.parse(h.imageSrc.substring(1,h.imageSrc.length-1)):h.imageSrc=h.parser.parse("'"+h.imageSrc+"'");c=h.evaluator.eval(h.imageSrc).toString().trim();if(""!=c)if(b=c.substr(0,c.lastIndexOf(".")),e=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))h.imageSrc=h.parser.parse("'vacio.gif'"),h.image.ready=1,3===h.parent.version&&(h.name=h.parser.parse("")),h.emptyImage={ready:!0},h.parser.parse("'vacio.gif'");
else if(h.image=h.parent.getImage(c),b)try{h.imageOver=h.parent.getImage(b+"_over"+e),h.imageDown=h.parent.getImage(b+"_down"+e)}catch(Y){}h.container=a.newHTML("div",{class:"DescartesButtonContainer"+h.classContainer,id:h.id,style:"width:"+h.w+"px;height:"+h.h+"px;left:"+h.x+"px;top:"+h.y+"px;z-index:"+h.zIndex+";"});h.btn=a.newHTML("canvas",{width:h.w*h.ratio,height:h.h*h.ratio,style:"position:absolute;left:0;top:0;width:"+h.w+"px;height:"+h.h+"px;"});h.ctx=h.btn.getContext("2d");h.ctx.imageSmoothingEnabled=
!1;h.tooltip&&(h.btn.title=h.tooltip);h.container.appendChild(h.btn);h.addControlContainer(h.container);h.addEvents();h.init();return h};$jscomp.inherits(S,a.Control);S.prototype.init=function(c){r=this.evaluator;D=this.container;m=this.btn;b=this.ctx;k=r.eval(this.expresion);this.x=k[0][0];this.y=k[0][1];4==k[0].length&&(this.w=parseInt(k[0][2]),this.h=parseInt(k[0][3]));m.width=this.w*this.ratio;m.height=this.h*this.ratio;m.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+
this.h+"px;box-sizing:border-box;");D.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 h=0,e=this.btnStyle.length;h<e;h++)m.style[this.btnStyle[h].type]=this.btnStyle[h].value;if(this.conStyle){h=0;for(e=this.conStyle.length;h<e;h++)D.style[this.conStyle[h].type]=this.conStyle[h].value;if(this.conStyle.shadowBoxColor){h=this.conStyle.shadowBoxOffsetX||0;e=this.conStyle.shadowBoxOffsetY||
2;var f=this.conStyle.shadowBoxBlur||2;D.style.boxShadow=h+"px "+e+"px "+f+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(h=this.conStyle.shadowInsetBoxOffsetX||0,e=this.conStyle.shadowInsetBoxOffsetY||-2,f=this.conStyle.shadowInsetBoxBlur||1,m.style.boxShadow=h+"px "+e+"px "+f+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.fontSizeNotSet&&(this.font_size=r.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=r.eval(this.font_size);this.createGradient(this.w,
this.h);D.style.display=0<r.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)};S.prototype.update=function(){r=this.evaluator;D=
this.container;m=this.btn;this.activeIfValue=0<r.eval(this.activeif);this.drawIfValue=0<r.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(D.style.display="block",this.draw(),D.style.cursor=m.style.cursor=this.activeIfValue?"pointer":"not-allowed",D.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(D.style.display="none",this.buttonClick=!1)};S.prototype.draw=function(d){D=this.container;r=this.evaluator;m=this.btn;b=this.ctx;c=r.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&&(J=this.over===this.oldOver,E=this.buttonClick===this.oldButtonClick,F=this.activeIfValue===this.oldActiveIfValue,G=this.drawIfValue===this.oldDrawIfValue,B=c===this.oldName,L=h===this.oldImageSrc,I=this.colorInt.getColor()===this.oldBackColor,M=this.color.getColor()===this.oldTextColor,P=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,J&&E&&F&&G&&B&&L&&I&&M&&P))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);l=this.fs_evaluated;D.setAttribute("data-name",c);h?(e="vacio.gif"===h?this.emptyImage:this.parent.getImage(h),H=h.substr(0,h.lastIndexOf(".")),N=h.substr(h.lastIndexOf(".")),C=H+"_over"+
N,R=H+"_down"+N,K="vacio.gif"===h?this.emptyImage:this.parent.getImage(C),Q="vacio.gif"===h?this.emptyImage:this.parent.getImage(R)):Q=K=e=this.emptyImage;b.clearRect(0,0,this.w,this.h);w=q=0;this.buttonClick&&(w=q=1);this.text_object.draw(b,this.color.getColor(),0,0,!0);u=this.text_object.textNodes.metrics.w;z=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?y=g(this.w/2+w)-.5:"left"==this.text_align[1]?y=u/2+5+w:"right"==this.text_align[1]&&(y=this.w-u/2+w-5);"center"==this.text_align[0]?
A=g(this.h/2+q)-.5:"top"==this.text_align[0]?A=z/2+q+4:"bottom"==this.text_align[0]&&(A=this.h-z/2+q-3);if(e){if(n=this.imgSizeW?this.imgSizeW:e.width,p=this.imgSizeH?this.imgSizeH:e.height,"center"==this.image_align[1]?x=parseInt((this.w-n)/2)+w:"left"==this.image_align[1]?x=w:"right"==this.image_align[1]&&(x=this.w-n+w),"center"==this.image_align[0]?v=parseInt((this.h-p)/2)+q:"top"==this.image_align[0]?v=q:"bottom"==this.image_align[0]&&(v=this.h-p+q),e&&e.ready)if(e!==this.emptyImage&&e.complete)if(h.match(f))this.btn.style.backgroundRepeat=
"no-repeat",this.btn.style.backgroundImage="url('"+h+"')",this.btn.style.backgroundPosition=x+"px "+v+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])O=this.colorInt.getColor(),!O||"CanvasGradient"!==O.constructor.name&&"CanvasPattern"!==O.constructor.name?D.style.backgroundColor=O:(b.fillStyle=O,b.fillRect(0,0,this.w,this.h));b.drawImage(e,0,0,e.width,e.height,x,v,n,p)}else this.emptyImage&&this.customStyle&&(O=this.colorInt.getColor(),!O||"CanvasGradient"!==O.constructor.name&&
"CanvasPattern"!==O.constructor.name?D.style.backgroundColor=O:(b.fillStyle=O,b.fillRect(0,0,this.w,this.h)))}else O=this.colorInt.getColor(),!O||"CanvasGradient"!==O.constructor.name&&"CanvasPattern"!==O.constructor.name?(D.style.backgroundColor=O,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=
O,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(K!==this.emptyImage&&this.over&&K.ready&&K.complete?C.match(f)?(this.btn.style.backgroundImage="url('"+C+"')",this.btn.style.backgroundPosition=x+"px "+v+"px"):b.drawImage(K,x,v):this.customStyle&&this.conStyle.overColor&&this.over&&(D.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?Q!==this.emptyImage&&this.buttonClick&&Q.ready&&Q.complete?R.match(f)?(this.btn.style.backgroundImage="url('"+R+"')",this.btn.style.backgroundPosition=
x+"px "+v+"px"):b.drawImage(Q,x,v):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(D.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(),y,A);this.underlined&&(b.strokeStyle=this.color.getColor(),b.lineWidth=g(l/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(y-u/2+w,A+g(l/2)+g(l/5)-1.5),b.lineTo(y+u/2+w,A+g(l/2)+g(l/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?D.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=x;this._image_pos_y=v};S.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)};S.prototype.buttonPressed=function(){this.updateAndExecAction()};S.prototype.addEvents=function(){function c(b,h,p){a.clearTimeout(f);e.buttonClick&&e.drawIfValue&&e.activeIfValue&&(h.call(e),b=p?b:100,f=a.setTimeout(function(){c(b,h,!1)},b))}function b(b){this.focus();b.preventDefault();b.stopPropagation();document.activeElement!=
document.body&&document.activeElement.blur();e.whichBtn=a.whichBtn(b);"L"==e.whichBtn&&e.activeIfValue&&(e.buttonClick=!0,e.draw(),"calculate"==e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),c(1E3,e.buttonPressed,!0)),e.btn.removeEventListener("touchend",h),e.btn.addEventListener("touchend",h),e.btn.removeEventListener("mouseup",h),e.btn.addEventListener("mouseup",h))}function h(c){a.newBlobContent=null;this.focus();c.preventDefault();c.stopPropagation();if(e.activeIfValue||
e.buttonClick)e.buttonClick=!1,e.draw(),"calculate"!=e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),e.buttonPressed()),e.btn.removeEventListener("touchend",h),e.btn.removeEventListener("mouseup",h);e.parent.update()}var e=this,f;e.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();e.over=
!0;e.draw()});this.btn.addEventListener("mouseout",function(c){a.newBlobContent=null;c.preventDefault();c.stopPropagation();e.over=!1;e.buttonClick=!1;e.draw()});document.addEventListener("visibilitychange",function(c){a.newBlobContent=null;e.buttonClick=!1})};a.Button=S;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l,c,h,e,w,q,u,z=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(x){console.log(x)}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(z,a.Control);z.prototype.init=function(c,b){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var h=this.label.textContent;b||(this.value=this.validateValue(g.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var e=2!==this.parent.version?"__":"_____",f=a.getTextWidth(b+
"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){c=parseInt(this.h);var d=parseInt(this.w/2-c);e=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(d=this.w-2*c,f=0);d<e&&(d=e);""==h&&(d=0);this.w-d-c<f&&(d=this.w-c-f);0>d&&(d=0);h=this.w-(d+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:"+(d+c):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+c+"px;height:"+c+"px;left:"+(d+("h_right"===this.btn_pos?h:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+h+"px;height:"+this.h+"px;left:"+(c+d+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;");
this.cover.setAttribute("style","width:"+h+"px;height:"+this.h+"px;left:"+(c+d+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;")}else c=2+parseInt(this.h/2),d=parseInt(this.w/2-c/2),e=a.getTextWidth(h+e,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(d=this.w-c,f=0),d<e&&(d=e),""==h&&(d=0),this.w-d-c<f&&(d=this.w-c-f),0>d&&(d=0),h=this.w-(d+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;"),e="width:"+c+"px;left:"+(d+("v_right"===this.btn_pos?h:0))+"px;",this.divUp.setAttribute("style",e+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",e+";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:"+h+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?
c:0)+d)+"px;"),this.cover.setAttribute("style","width:"+h+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?c:0)+d)+"px;");this.field.value=b;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=d*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&
this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);g.setVariable(this.id,this.value)};z.prototype.update=function(){g=this.evaluator;0>g.eval(this.decimals)?(d=g.eval(this.incr),0<d?this.originalIncr=this.incr=g.parser.parse(parseInt(d).toString()):
this.incr=e):this.incr=0!==g.eval(this.originalIncr)?this.originalIncr:e;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(w=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==w&&(this.divDown.style["background-image"]="url("+w+")",this.old_image_dec_src=w));this.image_inc&&(q=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==q&&(this.divUp.style["background-image"]="url("+q+")",this.image_inc_src=q));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,r=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),
this.value==r&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(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)};z.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"};z.prototype.validateValue=function(a){g=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");m=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(m)&&(m=0);
l=g.eval(this.min);c=g.eval(this.max);""===l&&(l=-Infinity);""===c&&(c=Infinity);m=Math.min(Math.max(m,l),c);this.discrete&&(b=g.eval(this.incr),m=0==b?0:this.initial_value+b*Math.round((m-this.initial_value)/b));k=g.eval(this.decimals);0>=k&&(k=0);return m=parseFloat(parseFloat(m).toFixed(k))};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};
z.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())};z.prototype.addEvents=function(){function c(b,h,e){a.clearTimeout(q);if(g.up||g.down)h.call(g),b=e?b:10,q=a.setTimeout(function(){c(b,h)},b)}function b(b){b.preventDefault();g.whichBtn=a.whichBtn(b);"L"==g.whichBtn&&g.activeIfValue&&(g.up=!0,c(k,g.increase,!0))}function e(b){b.preventDefault();
g.whichBtn=a.whichBtn(b);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,c(k,g.decrease,!0))}function f(c){g.up=!1;a.clearTimeout(q);g.updateStyle()}function d(c){g.down=!1;a.clearTimeout(q);g.updateStyle()}h=a.hasTouchSupport;var g=this,k=h?500:200,q;g.divUp.oncontextmenu=g.divDown.oncontextmenu=g.field.oncontextmenu=g.label.oncontextmenu=g.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&&g.changeValue(g.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){g.up=!1;a.clearTimeout(q);c.preventDefault();g.updateStyle()});this.divDown.addEventListener("mouseout",function(c){g.down=!1;a.clearTimeout(q);c.preventDefault();g.updateStyle()});this.divUp.addEventListener("touchend",
f);window.addEventListener("touchend",f);this.divUp.addEventListener("mouseup",f);window.addEventListener("mouseup",f);this.divDown.addEventListener("touchend",d);window.addEventListener("touchend",d);this.divDown.addEventListener("mouseup",d);window.addEventListener("mouseup",d);document.addEventListener("visibilitychange",function(c){g.up=!1;g.down=!1;a.clearTimeout(q);g.updateStyle()});this.field.addEventListener("blur",function(a){g.drawIfValue&&g.changeValue(g.field.value,!0)});g.field.addEventListener("click",
function(a){this.focus()});g.cover.addEventListener("click",function(a){a=g.evaluator.eval(g.kbexp);g.activeIfValue&&g.parent.keyboard.show(g,g.kblayout,a[0][0]||0,a[0][1]||0,g.id,g.field,g.onlyText)})};a.Spinner=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f=function(f,d){var b=a.Control.call(this,f,d)||this;b.label_color=b.label_color||new a.Color("e0e4e8",f.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",f.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=f.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(f,a.Control);f.prototype.init=function(f){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();this.labelFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):a.getFieldFontSize(this.h);f=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");"right"==this.position?(this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+f+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+f+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+f+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";")):(this.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:"+f+"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=f*this.ratio;this.label.height=
this.h*this.ratio;this.update()};f.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==g.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),g.setVariable(this.id,this.value);else{this.value=g.getVariable(this.id);g.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var f=-1;if(this.pressed){for(var b=a.length-1;0<=b;b--)g.setVariable(a[b].internalID,0),a[b].checked=!1;g.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;g.setVariable(this.radio_group,this.id);this.pressed=0}else{for(b=a.length-1;0<=b;b--)f=0!=g.getVariable(a[b].internalID)?b:f,g.setVariable(a[b].internalID,
0),a[b].checked=!1;0<=f&&(g.setVariable(a[f].internalID,1),a[f].checked=!0,g.setVariable(this.radio_group,a[f].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(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)};f.prototype.addEvents=function(){var f=this;f.checkbox.oncontextmenu=f.label.oncontextmenu=f.dummyLabel.oncontextmenu=function(){return!1};f.label.addEventListener("touchstart",a.preventDefault);f.label.addEventListener("mousedown",a.preventDefault);f.dummyLabel.addEventListener("mousedown",a.preventDefault);f.checkbox.addEventListener("click",function(a){f.pressed=!0;f.updateAndExecAction()})};a.Checkbox=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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 h=b.answerPattern.indexOf("|");b.firstAnswer=-1==h?b.answerPattern:b.answerPattern.substring(0,h)}else b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(",")));b.onlyText&&(b.valueExprString.match(/^'/)&&
b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:b.id});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.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){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var b=this.label.textContent;c||
(this.value=this.validateValue(g.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},
this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var e=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),f=parseInt(this.w/2),d=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(f=this.w,e=0);f<d&&(f=d);""==b&&(f=0);this.w-f<e&&(f=this.w-e);0>f&&(f=0);b=this.w-f;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:"+f+"px; font-family:"+("Serif"==this.font_family?a.serif_font:"Monospaced"==this.font_family?a.monospace_font:a.sansserif_font)+";");this.field.value=c;this.cover.setAttribute("style",";width:"+b+"px;height:"+this.h+"px;left:"+f+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+f+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+
";");this.label.width=f*this.ratio;this.label.height=this.h*this.ratio;this.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(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.parent.animation.playing&&
document.activeElement==this.field||(d=this.field.value,f=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===f&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,
0,this.label.width,this.label.height);!(k=this.label_color.getColor())||"CanvasGradient"!==k.constructor.name&&"CanvasPattern"!==k.constructor.name||(this.label_ctx.fillStyle=k,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"";g=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");r=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(r)&&(r=0);m=g.eval(this.min);b=g.eval(this.max);""===m&&(m=-Infinity);""===b&&(b=Infinity);r<m&&(r=m);r>b&&(r=
b);this.discrete&&(a=g.eval(this.incr),r=0===a?0:a*Math.round(r/a));return r=parseFloat(parseFloat(r).toFixed(g.eval(this.decimals)))};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 g=Math.abs,d,f,r,m,b,k,l,c,h,e,w,q=function(c,b){function h(c){g.options=c.split(",");g.menuOptions=[];g.strValue=[];c=0;for(var b=g.options.length;c<b;c++){var e=g.customSplit(g.options[c]);1==e.length?(g.menuOptions.push(e[0]),g.strValue.push(c.toString())):2==e.length&&(g.menuOptions.push(e[0]),""==e[1]?g.strValue.push(c.toString()):g.strValue.push(e[1]))}c=0;for(b=g.menuOptions.length;c<b;c++)g.menuOptions[c].match(/^\[/)&&g.menuOptions[c].match(/\]$/)?g.menuOptions[c]=
d.parse(g.menuOptions[c].substring(1,g.menuOptions[c].length-1)):g.menuOptions[c]=d.parse("'"+g.menuOptions[c]+"'");c=0;for(b=g.strValue.length;c<b;c++)g.strValue[c].match(/^\[/)&&g.strValue[c].match(/\]$/)?g.strValue[c]=d.parse(g.strValue[c].substring(1,g.strValue[c].length-1)):g.strValue[c]=d.parse(g.strValue[c]);g.select.innerHTML="";c=0;for(b=g.menuOptions.length;c<b;c++)e=a.newHTML("option"),e.innerHTML=f.eval(g.menuOptions[c]),g.select.appendChild(e);return 0}var e=a.Control.call(this,c,b)||
this;e.label_color=e.label_color||new a.Color("e0e4e8",c.evaluator);e.label_text_color=e.label_text_color||new a.Color("000000",c.evaluator);e.options=b.options||"";d=e.parser;f=e.evaluator;e.ok=0;e.tabindex=++e.parent.tabindex;e.answer&&(e.answer.match("krypto_")&&(e.answer=(new a.Krypto).decode(e.answer.substring(7))),e.answer=parseInt(e.answer.split(",")[0].replace("[",""))||0);e.name_str=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+"'");var g=e;e.evaluator.setFunction(e.id+".setOptions",h);e.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:e.id});e.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});e.label_ctx=e.label.getContext("2d");e.ratio=c.ratio;e.select=a.newHTML("select",{id:e.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:e.tabindex});e.field=a.newHTML("input",{type:"text",id:e.id+"_menuField",class:"DescartesMenuField",tabindex:e.tabindex});h(e.options);e.containerControl.appendChild(e.label);
e.containerControl.appendChild(e.select);e.visible&&e.containerControl.appendChild(e.field);e.cover=a.newHTML("div",{class:"TextfieldCover"});e.keyboard&&e.visible&&e.containerControl.appendChild(e.cover);e.addControlContainer(e.containerControl);e.addEvents();e.init();return e};$jscomp.inherits(q,a.Control);q.prototype.init=function(c){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();var b=this.label.textContent;this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var e=0,h=0;this.value=c?this.value:f.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var d=0,g=this.menuOptions.length;d<g;d++)c=a.getTextWidth(f.eval(this.menuOptions[d]).toString(),this.fieldFontSize+"px "+a.sansserif_font),c>e&&(e=c,h=d);e+=25;c=a.getTextWidth(this.formatOutputValue(f.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;g=this.formatOutputValue(f.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+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=g;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;f.setVariable(this.id,parseFloat(g.replace(this.parent.decimal_symbol,".")));this.update()};
q.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,c=this.menuOptions.length;a<c;a++)this.select.options[a].innerHTML=f.eval(this.menuOptions[a]);
this.value=f.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);f.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.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);!(w=this.label_color.getColor())||"CanvasGradient"!==w.constructor.name&&"CanvasPattern"!==w.constructor.name||(this.label_ctx.fillStyle=w,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)};q.prototype.customSplit=function(a){k=!1;l="";c=0;for(h=-1;c<a.length;){e=a.charAt(c);if("["===e&&-1===h){if(k||""!=l)l+="\u00a6";h++}else"["===e?h++:"]"===e&&0===h?(k=!0,h--):"]"==a.charAt(c)&&(h=0>h?h:h-1);l+=a.charAt(c);c++}return l.split("\u00a6")};q.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,
"."));r=-1;m=Infinity;for(var c=0,e=this.strValue.length;c<e;c++)b=g(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=m&&(m=b,r=c);return r};q.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};q.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=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,d,f,r,m,b,k,l,c,h,e,w,q,u,z,n,p,x,v,y=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(y,a.Control);y.prototype.init=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.value=this.validateValue(d.eval(this.valueExpr));r=
this.formatOutputValue(this.value);m=this.evaluator.eval(this.expresion);this.x=m[0][0];this.y=m[0][1];4==m[0].length&&(this.w=m[0][2],this.h=m[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(r);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};y.prototype.initScroll=function(c){f=this;d=f.evaluator;f.label.innerHTML=d.eval(f.name).toString();x=this.label.textContent;var b="v"===f.orientation?parseInt(19+5*(f.h-100)/100):f.h;f.fieldFontSize=
0<d.eval(f.font_size)?d.eval(f.font_size):"v"===f.orientation?b-parseInt(f.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},f.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);c=a.getTextWidth(c+"_",f.fieldFontSize+"px "+a.sansserif_font);var e=f.parent.getSpaceById(f.spaceID).h;f.labelHeight=""==x?0:b;f.fieldHeight=""==f.visible?0:b;if("v"===f.orientation)f.canvasWidth=f.w,f.canvasHeight=f.h-f.labelHeight-f.fieldHeight,18<=f.canvasHeight+f.y-e&&(f.canvasHeight=e),b=f.fieldHeight,c=b+f.canvasHeight,f.canvasX=0,f.canvasY=f.fieldHeight,f.labelWidth=f.w,f.labelY=c,f.upWidth=f.downW=f.w,f.upHeight=f.downH=f.w,f.upX=0,f.upY=f.fieldHeight,f.downX=0,f.downY=c-f.downH,
f.fieldWidth=f.w,f.fieldX=0,f.scrollHandlerW=f.w,f.scrollHandlerH=parseInt((f.canvasHeight-f.upHeight-f.downH-f.labelHeight-f.fieldHeight)/10),f.scrollHandlerH=f.canvasHeight-f.upHeight-f.downH-f.labelHeight-f.fieldHeight>2*f.w?f.w:f.scrollHandlerH,f.scrollHandlerH=15>f.scrollHandlerH?15:f.scrollHandlerH,f.limInf=c-f.downH-f.scrollHandlerH,f.limSup=b+f.downH;else{b=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);f.labelWidth=b;f.fieldWidth=c;""==x&&(f.labelWidth=0);f.visible||(f.fieldWidth=
0);for(c=f.w-f.fieldWidth-f.labelWidth;58>c&&0<f.labelWidth;)f.labelWidth--,c++;for(;58>c&&0<f.fieldWidth;)f.fieldWidth--,c++;b=f.labelWidth;e=b+c;f.fieldWidth=f.w-e;f.canvasWidth=c;f.canvasHeight=f.h;f.canvasX=f.labelWidth;f.canvasY=0;f.fieldX=f.canvasWidth+f.labelWidth;f.labelHeight=f.h;f.labelY=0;f.upWidth=f.downW=f.h;f.upHeight=f.downH=f.h;f.upX=e-f.downW;f.upY=0;f.downX=f.labelWidth;f.downY=0;f.scrollHandlerW=parseInt((f.canvasWidth-f.upWidth-f.downW)/10);f.scrollHandlerW=f.canvasWidth-f.upWidth-
f.downW>2*f.h?f.h:f.scrollHandlerW;f.scrollHandlerW=15>f.scrollHandlerW?15:f.scrollHandlerW;f.scrollHandlerH=f.h;f.limInf=b+f.downW;f.limSup=b+f.canvasWidth-f.downW-f.scrollHandlerW}f.container.setAttribute("style","width:"+f.w+"px;height:"+f.h+"px;left:"+f.x+"px;top:"+f.y+"px;z-index:"+f.zIndex+";");f.canvas.setAttribute("width",f.w+"px");f.canvas.setAttribute("height",f.h+"px");f.canvas.setAttribute("style","position:absolute;left:0;top:0;");f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=
!1;f.divUp.setAttribute("style","width:"+f.upWidth+"px;height:"+f.upHeight+"px;left:"+f.upX+"px;top:"+f.upY+"px;");f.divDown.setAttribute("style","width:"+f.downW+"px;height:"+f.downH+"px;left:"+f.downX+"px;top:"+f.downY+"px;");f.scrollHandler.setAttribute("style","width:"+f.scrollHandlerW+"px;height:"+f.scrollHandlerH+"px;left:"+("v"===f.orientation?0:f.limInf)+"px;top:"+("v"===f.orientation?f.limInf:0)+"px;");f.field.setAttribute("style","font-size:"+f.fieldFontSize+"px;width:"+f.fieldWidth+"px;height:"+
f.fieldHeight+"px;left:"+f.fieldX+"px;top:0;");f.cover.setAttribute("style","width:"+f.fieldWidth+"px;height:"+f.fieldHeight+"px;left:"+f.fieldX+"px;top:0;");0===f.fieldHeight&&(f.field.style.display="none");f.label.setAttribute("style","font-size:"+f.fieldFontSize+"px;width:"+f.labelWidth+"px;height:"+f.labelHeight+"px;line-height:"+f.labelHeight+"px;left:0;top:"+f.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=f.labelWidth*
this.ratio;this.label.height=f.labelHeight*this.ratio};y.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);!(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)};y.prototype.draw=function(){f=this;b=f.ctx;l=g(this.w);k=g(this.h);b.fillStyle=this.color.getColor();b.fillRect(0,0,l,k);b.fillStyle="black";b.beginPath();"h"===f.orientation?(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(parseInt(f.labelWidth)+.5,.5,l-1-parseInt(f.labelWidth),k-1),b.lineWidth=Math.ceil(12*f.upWidth/100)||1,b.strokeStyle=f.colorInt.getColor(),b.moveTo(f.downX+62.215*f.upWidth/100,20*f.downH/100),b.lineTo(f.downX+
32.449*f.upWidth/100,f.downH/2),b.lineTo(f.downX+62.215*f.upWidth/100,80*f.downH/100),b.moveTo(f.upX+32.449*f.upWidth/100,20*f.downH/100),b.lineTo(f.upX+62.215*f.upWidth/100,f.downH/2),b.lineTo(f.upX+32.449*f.upWidth/100,80*f.downH/100),b.stroke(),h=g(f.pos),c=Math.ceil(k/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(h+.5,c,g(f.scrollHandlerW),k-2*c)):(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(.5,.5,l-1,k-parseInt(f.labelHeight)-.5),b.lineWidth=Math.ceil(12*f.upWidth/100)||
1,b.strokeStyle=f.colorInt.getColor(),b.moveTo(20*f.upWidth/100,f.h-f.labelHeight-70*f.downH/100),b.lineTo(50*f.upWidth/100,f.h-f.labelHeight-40.237*f.downH/100),b.lineTo(80*f.upWidth/100,f.h-f.labelHeight-70*f.downH/100),b.moveTo(20*f.upWidth/100,70*f.downH/100),b.lineTo(50*f.upWidth/100,40.237*f.downH/100),b.lineTo(80*f.upWidth/100,70*f.downH/100),b.stroke(),h=g(f.pos),c=Math.ceil(l/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(c,h+.5,l-2*c,g(f.scrollHandlerH)));f.activeIfValue||(b.fillStyle=
"rgba(255,255,255,0.5)",b.fillRect(0,0,b.canvas.width,b.canvas.height))};y.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);w=this.incr;e=0!=w?e*w/w:0;this.fixed&&(e=parseFloat(parseFloat(e).toFixed(d.eval(this.decimals))));return e};y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+
this.incr)};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};y.prototype.increase10=function(){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)};y.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)};y.prototype.changeValue=function(a){this.activeIfValue&&(q=this.validateValue(a),q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};y.prototype.changeValueForScrollMovement=function(){d=this.evaluator;u=this.limInf;z=
this.limSup;n=d.eval(this.min);p=d.eval(this.max);w=this.incr;q=g((this.pos-u)*(p-n)/(z-u)/w)*w+n;q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};y.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;u=this.limInf;z=this.limSup;n=d.eval(this.min);p=d.eval(this.max);w=this.incr;this.pos=(this.value-n)*(z-u)/(p-n)+u;this.scrollHandler.style["h"==this.orientation?
"left":"top"]=this.pos+"px"};y.prototype.addEvents=function(){function c(b,e,h,f){a.clearTimeout(r);(m.up||m.down||m.canvasClick)&&1E-7<Math.abs(m.value-f)&&(e.call(m),b=h?b:30,r=a.setTimeout(function(){c(b,e,!1,f)},b))}function b(b){b.preventDefault();m.whichBtn=a.whichBtn(b);"L"==m.whichBtn&&m.activeIfValue&&(m.clickPos=a.getCursorPosition(b,m.container),m.canvasClick=!0,"h"==m.orientation?m.clickPos.x<m.prePos?c(350,m.decrease10,!0,m.minimo):c(350,m.increase10,!0,m.maximo):m.clickPos.y<m.prePos?
c(350,m.increase10,!0,m.maximo):c(350,m.decrease10,!0,m.minimo))}function e(c){m.canvasClick=!1;a.clearTimeout(r)}function h(c){1==m.canvasClick&&(m.clickPos=a.getCursorPosition(c,m.container),c.preventDefault())}function f(a){m.scrollClick=!1;m.prePos=m.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",g,!1);a.preventDefault()}function d(a){m.scrollClick=!1;m.prePos=m.pos;window.removeEventListener("touchend",d,!1);window.removeEventListener("touchmove",g,!1);
a.preventDefault()}function g(c){var b=a.getCursorPosition(c,m.container);"h"==m.orientation?(m.pos=m.prePos-(m.initPos.x-b.x),m.pos<m.limInf&&(m.pos=m.limInf),m.pos>m.limSup&&(m.pos=m.limSup),m.scrollHandler.setAttribute("style","width:"+m.scrollHandlerW+"px;height:"+m.h+"px;left:"+m.pos+"px;top:0;")):(m.pos=m.prePos-(m.initPos.y-b.y),m.pos>m.limInf&&(m.pos=m.limInf),m.pos<m.limSup&&(m.pos=m.limSup),m.scrollHandler.setAttribute("style","width:"+m.w+"px;height:"+m.scrollHandlerH+"px;left:0;top:"+
m.pos+"px;"));m.changeValueForScrollMovement();c.preventDefault()}function p(b){b.preventDefault();m.whichBtn=a.whichBtn(b);"L"==m.whichBtn&&m.activeIfValue&&(m.up=!0,c(350,m.increase,!0,m.maximo))}function k(b){b.preventDefault();m.whichBtn=a.whichBtn(b);"L"==m.whichBtn&&m.activeIfValue&&(m.down=!0,c(350,m.decrease,!0,m.minimo))}function q(c){m.down=!1;a.clearTimeout(r);c.preventDefault()}function l(c){m.up=!1;a.clearTimeout(r);m.draw()}function n(c){m.down=!1;a.clearTimeout(r);m.draw()}var m=this,
r;m.canvas.oncontextmenu=m.divUp.oncontextmenu=m.divDown.oncontextmenu=m.label.oncontextmenu=m.field.oncontextmenu=m.scrollHandler.oncontextmenu=m.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&m.changeValue(m.field.value)});this.field.addEventListener("blur",function(a){m.drawIfValue&&m.changeValue(m.field.value,!0)});this.canvas.addEventListener("touchstart",b);this.canvas.addEventListener("mousedown",b);this.divDown.addEventListener("mouseout",
q);window.addEventListener("touchend",e);window.addEventListener("mouseup",e);this.canvas.addEventListener("touchmove",h);this.canvas.addEventListener("mousemove",h);this.scrollHandler.addEventListener("touchstart",function(c){m.activeIfValue&&(m.scrollClick=!0,m.initPos=a.getCursorPosition(c,m.container),window.addEventListener("touchend",d),window.addEventListener("touchmove",g),c.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(c){m.activeIfValue&&(m.scrollClick=!0,
m.initPos=a.getCursorPosition(c,m.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",g),c.preventDefault())});this.divUp.addEventListener("touchstart",p);this.divUp.addEventListener("mousedown",p);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(c){m.up=!1;a.clearTimeout(r);c.preventDefault()});this.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",l);
window.addEventListener("mouseup",l);window.addEventListener("touchend",n);window.addEventListener("mouseup",n);m.cover.addEventListener("click",function(a){a=m.evaluator.eval(m.kbexp);m.activeIfValue&&m.parent.keyboard.show(m,m.kblayout,a[0][0]||0,a[0][1]||0,m.id,m.field,m.onlyText)})};a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f=function(f,d){var b=a.Control.call(this,f,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;f=b.evaluator.eval(b.expresion);4==f[0].length?(b.w=f[0][2],b.h=f[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(k){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(k){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(k){}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(f,a.Control);f.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};
f.prototype.update=function(){g=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=g.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(d=0<g.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=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f=function(f,d){var b=a.Control.call(this,f,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;g=b.evaluator;f=g.eval(b.expresion);4==f[0].length?(b.w=f[0][2],b.h=f[0][3]):(b.w=null,b.h=null);f=b.file;d=f.lastIndexOf(".");-1!=d&&(f=b.file.substring(0,d));b.video=a.newHTML("video",{poster:f+".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:f+".mp4",type:"video/mp4"}),b.video.appendChild(d));b.video.canPlayType("video/ogg")&&(d=a.newHTML("source",{src:f+".ogg",type:"video/ogg"}),b.video.appendChild(d),d=a.newHTML("source",{src:f+".ogv",type:"video/ogg"}),b.video.appendChild(d));b.video.canPlayType("video/webm")&&
(d=a.newHTML("source",{src:f+".webm",type:"video/webm"}),b.video.appendChild(d));b.addControlContainer(b.video);g.setFunction(b.id+".play",function(){try{b.video.play()}catch(k){}return 0});g.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(k){}return 0});g.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(k){}return 0});g.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(l){}return 0});b.video.addEventListener("timeupdate",
function(a){g.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(f,a.Control);f.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};f.prototype.update=function(){g=this.evaluator;(d=0<g.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=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r=function(f,b){var d=a.Control.call(this,f,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 g=d.parent.lessonParser.parseText(d.answer)}d.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:d.id,spellcheck:"false"});d.textArea=a.newHTML("textarea",{class:"DescartesTextAreaContainer",spellcheck:"false"});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.cover=a.newHTML("div",{class:"TextfieldCover"});d.keyboard&&d.containerControl.appendChild(d.cover);d.addControlContainer(d.containerControl);d.showAnswer=!1;d.text=d.rawText||"";g&&"simpleText"!==g.type&&(d.answer=d.text.hasFormula?"":g.toHTML());d.evaluator.setVariable(d.id,d.text);var c;d.evaluator.setFunction(d.id+".insertAtCursor",function(a){c=d.textArea.selectionStart+a.length;d.textArea.value=d.textArea.value.substring(0,d.textArea.selectionStart)+a+d.textArea.value.substring(d.textArea.selectionEnd);
d.textArea.selectionStart=d.textArea.selectionEnd=c;d.textArea.focus();return 0});d.evaluator.setFunction(d.id+".update",function(){d.update()});d.addEvents();d.init();return d};$jscomp.inherits(r,a.Control);r.prototype.init=function(){d=this.answer?28:4;g=this.evaluator;var f=this.text.replace(/\\n/g,"\n");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.value=f;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.cover.setAttribute("style",";position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:0px;top:0px;");this.update()};r.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);
this.drawIfValue=0<g.eval(this.drawif);g.getVariable(this.id)!==this.oldValue&&(this.textArea.value=(g.getVariable(this.id)||"").replace(/\\n/g,"\n"));f=this.textArea.value||"";f="\n"===f.charAt(f.length-1)?f.substring(0,f.length-1):f;f=f.replace(/\n/g,"\\n").replace(/\s/g," ");g.setVariable(this.id,f);this.oldFieldValue=f;this.oldValue=g.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};
r.prototype.changeValue=function(a){this.textArea.value=a;this.update()};r.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=this;b.cover.oncontextmenu=function(){return!1};b.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"});b.showButton.addEventListener("mouseup",a);b.showButton.addEventListener("mouseout",
a);b.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});b.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});b.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});b.cover.addEventListener("pointerdown",function(a){a=b.evaluator.eval(b.kbexp);console.log(a);b.activeIfValue&&
b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.textArea,!0)})};a.TextArea=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,d,f,r,m,b,k,l,c,h,e,w,q,u=function(c,b){var h=a.Control.call(this,c,b)||this;f=c.evaluator.parser;h.spaceID=b.spaceID||"";h.text=b.text||"";h.size=b.size||f.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=f.parse(h.constraintExpr);"(expr)"==h.constraint.type&&(h.constraint=f.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;w=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=w&&48>this.width?48:this.width,this._h=w&&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);r=this.space.getAbsoluteX(this.x);m=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(r-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(m-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,
r=parseInt(this.space.getAbsoluteX(this.x))+.5,m=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(r,m),this.image.ready?(b=this.image.width/2,k=this.image.height/2,this.image.complete&&!this.setImage&&c.drawImage(this.image,parseInt(r-b),parseInt(m-k)),this.trace&&(h.save(),h.translate(r,m),h.scale(parseInt(b),parseInt(k)),h.beginPath(),h.arc(0,0,1,0,g),h.restore(),h.lineWidth=1,h.strokeStyle=this.trace.getColor(),h.stroke())):(b=parseInt(this.width/2),c.beginPath(),c.arc(r,
m,b,0,g),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(r,m,b-2,0,g),c.stroke()),this.trace&&(h.strokeStyle=this.trace.getColor(),h.beginPath(),h.arc(r,m,b,0,g),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;q=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,q)};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,h=a.length;b<h;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",h),window.addEventListener("mouseup",
b),window.addEventListener("mousemove",h))}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",h),window.removeEventListener("touchend",b),window.removeEventListener("touchmove",h),f=a.getCursorPosition(c,d.container)||f,d.posX=d.prePos.x-(d.posAnte.x-f.x),d.posY=d.prePos.y-
(d.posAnte.y-f.y),d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX)),d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY)),d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(f.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(f.y)),d.parent.updateControls(),d.parent.update(),d.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 h(c){c.preventDefault();d.evaluator.setVariable(d.mclickedStr,0);d.evaluator.setVariable(d.mclicizquierdoStr,0);f=a.getCursorPosition(c,d.container);d.posX=d.prePos.x-(d.posAnte.x-f.x);d.posY=d.prePos.y-(d.posAnte.y-f.y);d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX));d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY));d.evaluator.setVariable(d.mxStr,
d.space.getRelativeX(f.x));d.evaluator.setVariable(d.myStr,d.space.getRelativeY(f.y));80<Date.now()-e&&(d.parent.updateControls(),d.parent.update(),e=Date.now())}var e=0,f,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,g){var d,f,r,m,b,k,l,c,h,e;function w(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var q,u,z,n,p,x,v,y,A,D,J,E,F,G,B,L,I,M,P,H,N,C,R,K,Q,O,S,V,U,T=function(c){this.parent=c;this.parser=c.evaluator.parser;this.RTFparser=new a.RTFParser(c.evaluator)};T.prototype.parseButtonsConfig=function(a){var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var b=0,h=a.length;b<h;b++)switch(z=a[b][0],n=a[b][1],u=g[z],u){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[u]=
parseInt(n);break;case "about":case "config":case "init":case "clear":c[u]="true"===g[n];break;default:console.warn("Propiedad de botones no identificada: <"+z+"> valor: <"+n+">")}return c};T.prototype.parseSpace=function(c){p={};c=this.split(c);for(var b=0,h=c.length;b<h;b++)switch(z=c[b][0],n=c[b][1],u=g[z],a.DEBUG.paramName=z,a.DEBUG.objectName="Space",u){case "type":if("R2"===n||"R3"===n)n=g[n];p[u]=n;break;case "id":a.DEBUG.idName=n;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":p[u]=
n;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":p[u]="true"===g[n];break;case "bg_display":case "render":p[u]=g[n];break;case "border_color":case "net":case "net10":case "axes":case "text":p[u]=""!=n?"false"===g[n]?"":new a.Color(n,this.parent.evaluator):"";break;case "O.x":p.OxExpr=n;break;case "O.y":p.OyExpr=n;break;case "image":p.imageSrc=n;break;case "x":q=n;"%"===q[q.length-1]?(p.xPercentExpr=q.trim(),q=(this.parent.container.width*
parseFloat(q)/100).toString()):q=n;p.xExpr=this.parser.parse(q);break;case "y":q=n;"%"===q[q.length-1]?(p.yPercentExpr=q.trim(),q=(this.parent.container.height*parseFloat(q)/100).toString()):q=n;p.yExpr=this.parser.parse(q);break;case "width":q=n.trim();p.wModExpr=q;"%"===q[q.length-1]?(p.wExpr=q,q=this.parent.container.width*parseFloat(q)/100):(q=parseFloat(n),q!=n&&(q=this.parent.container.width,p._w_=n.trim()));p.w=q;break;case "height":q=n.trim();p.hModExpr=q;"%"===q[q.length-1]?(p.hExpr=q,q=
this.parent.container.height*parseFloat(q)/100):(q=parseFloat(n),q!=n&&(q=this.parent.container.height,p._h_=n.trim()));p.h=q;break;case "drawif":""!=n&&(p.drawif=this.parser.parse(n));break;case "scale":q=parseFloat(n);isNaN(q)&&(q=48);p.scale=q;break;case "background":p.background=new a.Color(n,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+z+"> valor: <"+n+">")}return new a["Space"+p.type](this.parent,p)};T.prototype.parseControl=function(c){x={type:"Numeric",
gui:"Spinner"};c=this.split(c);for(var b=0,h=c.length;b<h;b++)switch(z=c[b][0],n=c[b][1],u=g[z],a.DEBUG.paramName=z,a.DEBUG.objectName="Control",u){case "type":q=g[n.trim()];"graphic"===q?q="GraphicControl":"text"===q&&(q="TextArea");x.type=w(q);break;case "gui":q=g[n];"textfield"===q&&(q="TextField");x[u]=w(q);break;case "id":a.DEBUG.idName=n;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":case "info":x[u]=
n;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":x[u]=g[n];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":x[u]="true"===g[n];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":x[u]=new a.Color(n,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
n&&(x[u]=this.parser.parse(n));break;case "constraint":x.constraintExpr=n;break;case "image":x.imageSrc=n;break;case "image_dec":x.image_dec_src=n;break;case "image_inc":x.image_inc_src=n;break;case "space":x.spaceID=n;break;case "expresion":x.expresion=this.parser.parse(n.replace(")(",","));case "kbexp":x.kbexp=this.parser.parse(n.replace(")(",","));break;case "borderColor":x[u]="false"===g[n]?"":n;break;case "bold":"false"!=g[n]&&(x.bold="bold");break;case "italics":"false"!=g[n]&&(x.italics="italic");
break;case "underlined":"false"!=g[n]&&(x.underlined=!0);break;case "value":var e=n.replace(/&squot;/g,"'");e.match(/^\|/)&&(e="'"+e.substring(1),e.match(/\|$/)&&(e=e.substring(0,e.length-1)+"'"));x.valueExpr=this.parser.parse(e);x.valueExprString=e;break;case "incr":0!=n&&(x.incr=this.parser.parse(n));break;case "exponentialif":x.exponentialif=parseFloat(n);break;case "text":x.rawText=n;e=this.parseText(n);for(var d=0,f=e.length;d<f;d++)e[d]=this.parser.parse(e[d],!1);x.text=e;break;default:d=z.indexOf("."),
e=g[z.substring(0,d)],d=g[z.substring(d+1)],"parameter"===e&&"font"===d?x.parameterFont=n:"Explanation"===e&&"font"===d?x.ExplanationFont=n:"tooltip"===e&&"font"===d?x.tooltipFont=n:console.warn("Propiedad de control no identificada: <"+z+"> valor: <"+n+">")}return new a["Numeric"===x.type?x.gui:x.type](this.parent,x)};T.prototype.parseGraphic=function(c,b,h,e){v={rotateExp:e,parameter:"t"};c=this.split(c);e=0;for(var d=c.length;e<d;e++)if(z=c[e][0],n=c[e][1],u=g[z],a.DEBUG.paramName=z,a.DEBUG.objectName=
"Graphic",""!=n)switch(u){case "type":a.DEBUG.idName=n;v[u]=w(g[n]);break;case "align":case "anchor":case "lineDash":v[u]=g[n];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":v[u]="true"===g[n];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":v[u]="false"===g[n]?"":new a.Color(n,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":v[u]=
n;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==n&&(v[u]=this.parser.parse(n));break;case "font_size":n=n.trim();n.match(/^\[.*\]?/)&&(n=n.substring(1,n.length-1));""!==n&&(v[u]=this.parser.parse(n));break;case "space":v.spaceID=n;break;case "expresion":""!==n&&("Macro"!==v.type?(v.expresion=this.parser.parse(n),v.expresionString=n):v.expresion=n);break;
case "text":v.text=n;break;case "file":var f=n.replace(/&squot;/g,"'").trim();"["===f.charAt(0)&&"]"===f.charAt(f.length-1)?f=f.substring(1,f.length-1):"'"!=f.charAt(0)&&(f="'"+f+"'");v.file=this.parser.parse(f);break;case "border":""!=n&&"false"!=g[n]&&(v.border=new a.Color(n,this.parent.evaluator));break;default:if(void 0!=v.family&&z.substring(0,v.family.length+1)===v.family+".")switch(g[z.substring(v.family.length+1)]){case "interval":""!=n&&(v.family_interval=this.parser.parse(n));break;case "steps":""!=
n&&(v.family_steps=this.parser.parse(n))}else if(void 0!=v.parameter&&z.match(v.parameter+"."))switch(v.parameter!==z.substring(0,z.indexOf(v.parameter)+v.parameter.length)&&(v.parameter=z.substring(0,z.indexOf(v.parameter)+v.parameter.length)),g[z.substring(v.parameter.length+1)]){case "interval":""!=n&&(v.parameter_interval=this.parser.parse(n));break;case "steps":""!=n&&(v.parameter_steps=this.parser.parse(n))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+z+"> valor: <"+n+">")}b&&
(v.abs_coord=b);h&&(v.background=h);return new a[v.type](this.parent,v)};T.prototype.parse3DGraphic=function(c,b,h,e){v={rotateExp:e,parameter:"t"};c=this.split(c);b=0;for(h=c.length;b<h;b++)switch(z=c[b][0],n=c[b][1],u=g[z],a.DEBUG.paramName=z,a.DEBUG.objectName="Graphic3D",u){case "type":a.DEBUG.idName=n;q=g[n];switch(q){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":v.subType=
q,q="OtherGeometry"}v[u]=w(q);break;case "model":case "align":case "anchor":case "lineDash":v[u]=g[n];break;case "shadowColor":case "fill":v[u]="false"===g[n]?"":new a.Color(n,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":v[u]="true"===g[n];break;case "edges":"false"===g[n]?v[u]="":("true"===g[n]&&(n="808080"),v[u]=new a.Color(n,this.parent.evaluator));break;case "border":""!=n&&"false"!=g[n]&&(v.border=new a.Color(n,this.parent.evaluator));
break;case "color":case "backcolor":v[u]=new a.Color(n,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":""!=n&&(v[u]=this.parser.parse(n));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":v[u]=
n;break;case "space":v.spaceID=n;break;case "expresion":"Macro"!=v.type&&"Curve"!=v.type&&"Surface"!=v.type?(v.expresion=this.parser.parse(n),v.expresionString=n):v.expresion=n.replace(/\\n/g,";");break;case "text":v.text=n;break;case "file":e=n.replace(/&squot;/g,"'");"["===e.charAt(0)&&"]"===e.charAt(e.length-1)&&(e=e.substring(1,e.length-1));e.match(/./)&&(e="'"+e+"'");v.file=this.parser.parse(e);break;default:void 0!==v.family&&z.substring(0,v.family.length+1)===v.family+"."?"interval"===g[z.substring(v.family.length+
1)]?""!=n&&(v.family_interval=this.parser.parse(n)):""!=n&&(v.family_steps=this.parser.parse(n)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+z+"> valor: <"+n+">")}return new a[v.type+"3D"](this.parent,v)};T.prototype.parseAuxiliar=function(c){y={};c=this.split(c);for(var b=0,h=c.length;b<h;b++)c[b][1]=c[b][1].replace(/&squot;/g,"'");b=0;for(h=c.length;b<h;b++)switch(z=c[b][0],n=c[b][1],u=g[z],a.DEBUG.paramName=z,a.DEBUG.objectName="Auxiliar",u){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=n;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":y[u]=n.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":y[u]="true"===g[n];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":y[u]=this.parser.parse(n);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":y[u]=
g[n];break;default:var e=z.indexOf("."),d=g[z.substring(0,e)];e=g[z.substring(e+1)];"parameter"===d&&"font"===e?y.parameterFont=n:console.warn("Propiedad del auxiliar no identificada: <"+z+"> valor: <"+n+">")}y.sequence?y.type="sequence":y.constant?y.type="constant":y.algorithm&&y.evaluate?y.type="algorithm":y.array&&!y.matrix&&")"!=y.id.charAt(y.id.length-1)?y.type="vector":y.matrix&&")"!=y.id.charAt(y.id.length-1)?y.type="matrix":y.event&&")"!=y.id.charAt(y.id.length-1)?y.type="event":"library"===
y.type?y.type="library":")"===y.id.charAt(y.id.length-1)?y.type="function":y.type="variable";a.DEBUG.typeName=y.type;switch(y.type){case "sequence":new a.Function(this.parent,y);break;case "constant":c=new a.Constant(this.parent,y);y.evaluate&&"always"===y.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,y));break;case "vector":c=new a.Vector(this.parent,y);y.evaluate&&"always"===y.evaluate&&this.parent.auxiliaries.push(c);break;
case "matrix":c=new a.Matrix(this.parent,y);y.evaluate&&"always"===y.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new a.Event(this.parent,y));break;case "library":new a.Library(this.parent,y);break;case "variable":new a.Variable(this.parent,y);break;default:new a.Function(this.parent,y)}};T.prototype.parseAction=function(c){A=c.action;D=c.parent;J=c.parameter;return A?new (a[w(A)])(D,J):{execute:function(){}}};T.prototype.parseAnimation=function(c){var b={};
c=this.split(c);for(var h=0,e=c.length;h<e;h++)switch(z=c[h][0],n=c[h][1],u=g[z],u){case "id":case "delay":case "init":case "doExpr":case "whileExpr":b[u]=n.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":b[u]="true"===g[n];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+z+">  <"+n+">")}return new a.Animation(this.parent,b)};T.prototype.parsePleca=function(g,q){g=this.split(g);f=d="";r=0;m="#536891";b="white";k=
"left";l="";c="SansSerif,BOLD,20";h="SansSerif,PLAIN,18";e=void 0;for(var p=0,u=g.length;p<u;p++)switch(z=g[p][0],n=g[p][1],z){case "title":d=n;break;case "subtitle":f=n;break;case "subtitlines":r=n;break;case "bgcolor":""!=n&&(m=(new a.Color(n,this.parent.evaluator)).getColor());break;case "fgcolor":""!=n&&(b=(new a.Color(n,this.parent.evaluator)).getColor());break;case "align":""!=n&&(k=n);break;case "titleimage":l=n;break;case "titlefont":c=""!=n?a.convertFont(n):a.convertFont(c);break;case "subtitlefont":h=
""!=n?a.convertFont(n):a.convertFont(h);break;default:console.warn("Propiedad de la pleca no identificada: <"+z+">  <"+n+">")}if(""===d&&""===f)return a.newHTML("div");M=h.substring(0,h.indexOf("px"));M=M.substring(M.lastIndexOf(" "));""!=l&&(P=this.parent.getImage(l),H=P.height);e=a.newHTML("div",{id:"descartesPleca"});H?(e.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+q+"px;height:"+H+"px;background-color:"+m+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
P.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),e.appendChild(P)):e.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+q+"px;background:"+m+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");N=a.newHTML("div",{style:"padding:0;margin:0;font:"+c+";overflow:hidden;white-space:nowrap;"});N.innerHTML=d;C=a.newHTML("div");if(1===parseInt(r)){S=0;R=a.newHTML("div");R.innerHTML=f;document.body.appendChild(R);Q=M;do Q-=
S,R.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+Q+"px;width:"+(q-30)+"px;line-height:"+Q+"px;"),K=R.offsetHeight,O=K/Q,S=1;while(1<O&&8<Q);document.body.removeChild(R);C.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+Q+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else C.setAttribute("style","padding:0;margin:0;font:"+h+";line-height:1em;");C.innerHTML=f;e.appendChild(N);e.appendChild(C);e.imageHeight=H;return e};T.prototype.split=function(a){if("string"!==
typeof a)return[];E=[];a=(a||"").replace(/\\'/g,"\u2019");F=G=L=0;for(B=I=!1;F<a.length;)" "!==a.charAt(F)||B||F++," "===a.charAt(F)||B||(B=!0,L=F),"="!==a.charAt(F)||"'"!==a.charAt(F+1)||I||(I=!0,E[G]=[a.substring(L,F)],L=F+2,F+=2),I&&"'"===a.charAt(F)&&(B=I=!1,E[G].push(a.substring(L,F)),G++),"="!==a.charAt(F)||"'"===a.charAt(F+1)||I||(E[G]=[a.substring(L,F)],L=F+1,F++,V=a.substring(F).indexOf("="),-1===V?U=V=a.length:(V+=F,U=a.substring(F,V).lastIndexOf(" "),U=-1===U?a.length:U+F),E[G].push(a.substring(L,
U)),G++,B=!1,F=U),F++;return E};T.prototype.parseText=function(c){c=c||"";return c.match(/^\{\\rtf1/)?this.RTFparser.parse(c.substring(10)):new a.SimpleText(this.parent,c)};a.LessonParser=T;return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,c){if(0==c)return 1;if(0>c)return NaN;if(0<=a||k(c)===c)return Math.pow(a,c);if(0>a){var b=1/c,h=k(b);if(h===b&&1===h%2)return-Math.pow(-a,c)}return NaN}function d(a,c){z=[];z.type="matrix";z.rows=a;z.cols=c;p=0;for(x=c;p<x;p++)z[p]=Array(a).fill(0);return z}function f(a,c){q=a.rows;u=a.cols;z=d(q,u);var b;for(p=0;p<q;p++)for(n=0;n<u;n++){for(x=b=0;x<u;x++)b+=a[x][p]*c[n][x];z[n][p]=b}return z}function r(a,c,b){for(var h=d(b.length-1,b.length-1),e=0,f=h.length;e<
f;e++)for(var g=0;g<f;g++)h[e][g]=e<a?g<c?b[e][g]:b[e][g+1]:e<c?b[e+1][g]:b[e+1][g+1];return h}function m(a){if(1<a.cols){for(var c=0,b=1,h=0,e=a.cols;h<e;h++)c+=b*a[0][h]*m(r(0,h,a)),b=-b;return c}return a[0][0]}if(a.loadLib)return a;var b={},k=Math.floor,l,c,h,e,w,q,u,z,n,p,x,v=function(a,c){this.sep="";this.type=a;this.value=c;this.parent=null;this.childs=[]};v.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};v.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
v.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};v.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};v.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",w=new v("compOperator","=="),w.addChild(this),w.addChild(new v("number","0")),e=this.getRoot(),e.setAllEvalFun(),
e):this};v.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};v.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,c=this.childs.length;a<c;a++)this.childs[a].setAllEvalFun()};v.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 h;this.evaluate=function(a){try{return h=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==h?h: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 h=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==h?h:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var e,w,x;this.evaluate=function(a){e=[];for(var c=0,h=this.childs[0].childs.length;c<h;c++)e[c]=this.childs[0].childs[c].evaluate(a);if("_Eval_"===this.value){l=0<e.length?e[0]:0;if("number"==typeof l)return"NaN";l.match(",")&&parseFloat(l.replace(",","."))==l.replace(",",".")&&(l=l.replace(",","."));if(void 0==b[l]){w=l.match(/:=/g)?!0:!1;if(l.match(";")){var d=
!1,f=[],g=0;c=0;for(h=l.length;c<h;c++){var q=l.charAt(c);"'"===q&&(d=!d);d||";"!==q||(f.push(l.substring(g,c)),g=c+1)}f.push(l.substring(g));l="("+f.join(")(")+")"}b[l]=a.parser.parse(l,w)}x=a.eval(b[l]);return void 0!=x?x:NaN}return a.functions[this.value].apply(a,e)}}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;q=b.rows;u=b.cols;z=d(q,u);for(p=0;p<q;p++)for(n=0;n<u;n++)z[n][p]=b[n][p]+c[n][p];return z}:"-"===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;q=c.rows;u=c.cols;z=d(q,u);for(p=0;p<q;p++)for(n=0;n<u;n++)z[n][p]=c[n][p]-a[n][p];return z}:"*"===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:f(c,a)}:"/"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==c.type||"matrix"!==a.type)return c/a;var b=d(a.length,a.length),h=m(a);if(0===h)a=0;else{h=1/h;if(1<a.length)for(var e=0,g=a.length;e<g;e++){var q=h;for(var p=0;p<g;p++)b[p][e]=q*m(r(e,p,a)),q=-q;h=-h}else b[0][0]=h;a=b}c=0===a?d(c.rows,c.cols):f(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-k(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?g(c,a):1/g(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 h=0;h<c;h++){var e=[];for(var d=0,f=this.childs[h].childs.length;d<f;d++)e.push(this.childs[h].childs[d].evaluate(a));b[h]=e}return b};else if("assign"===this.type){var v,G=this.childs[0],B=this.childs[1],L=G.childs[0]?G.childs[0].childs:null;this.evaluate=1===G.childs.length&&"square_bracket"===G.childs[0].type&&1===L.length?function(a){v=B.evaluate(a);a.setVector(G.value,L[0].evaluate(a),v);return v}:1===G.childs.length&&"square_bracket"===G.childs[0].type&&2===L.length?function(a){v=
B.evaluate(a);a.setMatrix(G.value,L[0].evaluate(a),L[1].evaluate(a),v);return v}:function(a){v=B.evaluate(a);return v.type?a.matrices[G.value]=v:"object"!==typeof a.variables[G.value]?a.variables[G.value]=v:0}}};a.Node=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,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]+/,w=/^==|^!=|^<=|^<|^>=|^>|^#/,q=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,z=/^[\?:]/,n=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,p=/^\[|^\]/,x=/^\(|^\)/,v=/^,/,y=/^;/,A=/\|/g,D=/\|\*/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/,
G=function(){};G.prototype.tokenize=function(F){function B(a,c,h){d.push({type:a,value:c});b=b.slice(h);r+=h;l=a}if(g=F){var G=F.indexOf("//");0<=G&&":"!==F[G-1]&&(F=F.substring(0,G));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(D,"'").replace(J,"'"));F.match(/=\|/g)&&(F=F.replace(A,"'"));G=F.trim();"|"==G.charAt(0)&&"|"==G.charAt(G.length-1)&&
(F=G.replace(A,"'"))}d=[];f=!1;r=0;b=F;for(l="";F&&r<F.length;)if(f=r,"'"==b[0]){for(k=1;"'"!=b[k];)if(k<b.length)k++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+g+"\u300b");return}m=b.substring(1,k);B("string",m,m.length+2)}else if(m=b.match(c))b=b.slice(m[0].length),r+=m[0].length;else if(m=b.match(n))m[0]=m[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),B("operator",m[0],m[0].length);else if(m=b.match(h))"number"===l&&
d.push({type:"operator",value:"*"}),B("identifier",m[0],m[0].length);else if(m=b.match(e))B("number",m[0],m[0].length);else if(m=b.match(w))G=m[0],"#"==G&&(G="!="),B("compOperator",G,m[0].length);else if(m=b.match(q))G=m[0],"||"==G?G="|":"&&"==G?G="&":"~"==G&&(G="!"),B("boolOperator",G,m[0].length);else if((m=b.match(u))&&!b.match(/^==/))B("assign",m[0],m[0].length);else if(m=b.match(z))B("conditional",m[0],m[0].length);else if(m=b.match(p))B("square_bracket",m[0],m[0].length);else if(m=b.match(x))"("==
m&&"number"===l&&d.push({type:"operator",value:"*"}),B("parentheses",m[0],m[0].length);else if(m=b.match(v))B("separator",m[0],m[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(m=b.match(y))B("final_of_expression",m[0],m[0].length);else if(f==r){a.DEBUG.setError(a.DEBUG.EXPRESSION,g);return}return d};G.prototype.flatTokens=function(a,c){a=a||[];c=c||"";E="";for(var b=
0,h=a.length;b<h;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=G;return a}(descartesJS||{});
descartesJS=function(a){function g(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function 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 f=Date.now(),r,m,b,k,l,c,h,e,w,q,u,z,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){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,h){this.matrices[a][c][b]=h};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(d,f){(b=this.tokenizer.tokenize(d))||(b=[]);k=null;f=!f||!1;r=e=h=c=0;for(m=b.length;r<m;r++){w=b[r];q=w.value;u=w.type;if("identifier"===u)if(r+1<m&&"parentheses"===b[r+1].type&&"("===b[r+1].value)this.getFunction(q);else if(r+1<m&&"square_bracket"===b[r+1].type&&"["===b[r+1].value)b[r+3]&&"square_bracket"===b[r+3].type&&"]"===b[r+3].value?this.getVector(q):this.getMatrix(q);else{var p=q.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);
p&&(this.variables[(p[1]||p[2]||p[3]||p[4]||p[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(q,!0)}"assign"===u&&f&&":="!=q&&(u="compOperator",q="==");if("assign"===u)if(l=new a.Node(u,q),null!=k)if("identifier"===k.type)k.parent&&k.parent.replaceLastChild(l),l.addChild(k),k=l,f=!0;else if("square_bracket"===k.type)l.addChild(k.parent),k=l,f=!0;else{l.type="compOperator";l.value="==";for(f=!0;k.parent&&g(k.parent.value)>=g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);
k=l}else{console.info("Error1: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===q||"square_bracket"===u&&"["===q)if(l=new a.Node(u,q),"("===q&&c++,"["===q&&h++,null===k)"("===q&&(new a.Node("(expr)","(expr)")).addChild(l),"["===q&&(new a.Node("[expr]","[expr]")).addChild(l),k=l;else if("operator"===k.type||"boolOperator"===k.type||"compOperator"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(l),k=l;else if("sign"===
k.type)k.addChild(l),k=l;else if("parentheses"===k.type&&"("===k.value)k.addChild(l),k=l;else if("square_bracket"===k.type&&"["===k.value)k.addChild(l),k=l;else if("parentheses"===k.type&&"()"===k.value)k.parent.addChild(l),k=l;else if("square_bracket"===k.type&&"[]"===k.value)k.parent.addChild(l),k=l;else if("identifier"===k.type)k.addChild(l),k=l;else{console.info("Error2: en la expresi\u00f3n \u300a "+d+" \u300b, en el token ["+r+"] {valor: "+q+", tipo: "+u+"}");break}else if("parentheses"===u&&
")"===q)if(c--,null===k)console.info("Error3: en la expresi\u00f3n \u300a "+d+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;k&&k.parent&&("("!=k.value||"("==k.value&&"parentheses"!=k.type);)k=k.parent;if(k&&"("===k.value)k.value="()";else break}else if("square_bracket"===u&&"]"===q)if(h--,null===k)console.info("Error5: en la expresi\u00f3n \u300a "+d+" \u300b, en el token (valor:"+q+", tipo:"+u);else{for(;k&&k.parent&&("["!=k.value||"["==k.value&&"square_bracket"!=k.type);)k=k.parent;if(k&&
"["===k.value)k.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(l=new a.Node(u,q),null===k)k=l;else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"parentheses"===k.type&&"("===k.value||"square_bracket"===k.type&&"["===k.value||"sign"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(l),k=l;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
d);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(l=new a.Node(u,q),null===k)if("-"===q||"+"===q)l.type="sign",l.value="sign"+q,k=l;else if("!"===q)k=l;else{console.info("Error8: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"assign"===k.type||"conditional"===k.type||"square_bracket"===k.type&&"["===k.value&&("-"===q||"+"===q||"!"===q)||"parentheses"===
k.type&&"("===k.value&&("-"===q||"+"===q||"!"===q)){if("-"===q||"+"===q)l.type="sign",l.value="sign"+q;k.addChild(l);k=l}else if("number"===k.type||"parentheses"===k.type&&"()"===k.value||"square_bracket"===k.type&&"[]"===k.value||"string"===k.type||"identifier"===k.type||"conditional"===k.type||"assign"===k.type){for(;k.parent&&g(k.parent.value)>=g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{console.info("Error9: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+
q+", tipo: "+u+"}");break}else if("conditional"===u)if(l=new a.Node(u,q),null!=k)if("?"===l.value){for(e++;k.parent&&g(k.parent.value)>g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{for(e--;k&&k.parent&&("?"!=k.value||"?"==k.value&&"conditional"!=k.type);)k=k.parent;if(k&&"?"===k.value)k.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else if("separator"===u)if(null!=k)for(;k.parent&&"("!=k.value&&"["!=k.value;)k=k.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+q+", tipo: "+u+"}");break}}0<c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,d);0>c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,d);0<h&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
d);0>h&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,d);0!=e&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,d);(z=k?k.getRoot():null)&&z.setAllEvalFun();return z};n.prototype.registerDefaultValues=function(){var c=this;c.variables._NUM_MAX_ITE_ALG_=1E5;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,h,e){return a.esCorrecto(b,h,c.evaluator,e)};c.functions.escorrecto=function(b,h,e){return a.escorrecto(b,h,c.evaluator,e)};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 h=a.indexOf(c);0<=h;)a=a.substring(0,h)+b+a.substring(h+c.length),h=a.indexOf(c,h+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 h=c.matrices[b];if(h){for(var e="<"+b+">\\n",d=c.getVariable(b+".columnas_usadas")||h.cols||0,f=c.getVariable(b+".filas_usadas")||h.rows||0,g,q=0;q<d;q++){for(var l=
0;l<f;l++)g=h[q][l],void 0!==g&&("string"==typeof g?g="'"+g+"'":"number"==typeof g&&(g=a.removeNeedlessDecimals(g.toFixed(6))),e+=g+(l<f-1?" \u00a6 ":""));e=e.replace(/(\u00A6 )$/g,"")+"\\n"}return e+"</"+b+">"}return""};c.functions._StrToMatrix_=function(a,b){var h=[],e=!1,f=!1;h.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,q=a.length;g<q;g++)a[g].match("<"+b+">")?(f=!0,e=a[g].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&h.push(e[1].split(String.fromCharCode("166")).map(d)),
e=!0):(a[g].match("</"+b+">")&&(e=a[g].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&h.push(e[0].split(String.fromCharCode("166")).map(d)),e=!1,g=a.length),e&&h.push(a[g].split(String.fromCharCode("166")).map(d)));c.matrices[b]=h;c.matrices[b].rows=h&&h[0]&&h[0].length?h[0].length:0;c.matrices[b].cols=h&&h.length?h.length:0;c.setVariable(b+".filas",c.matrices[b].rows);c.setVariable(b+".columnas",c.matrices[b].cols)}return f?"OK":"ERROR"};c.functions._GetVector_=function(a,b){return c.functions._StrToVector_(c.functions._Load_(a),
b)};c.functions._VectorToStr_=function(a){var b=c.vectors[a];if(b){for(var h="<"+a+">\\n",e=c.getVariable(a+".long_usada")||b._size_||0,d,f=0;f<e;f++)d=b[f],void 0!==d?("number"==typeof d&&(d=parseFloat(d)),h+=d+"\\n"):h+="0\\n";return h+"</"+a+">"}return""};c.functions._StrToVector_=function(a,b){var h=[],e=!1,f=!1;h.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,q=a.length;g<q;g++)a[g].match("<"+b+">")?e=f=!0:(a[g].match("</"+b+">")&&(e=!1,g=a.length),e&&h.push(d(a[g])));
h._size_=h.length;c.vectors[b]=h;c.setVariable(b+".long",h.length);c.setVariable(b+".long_usada",h.length)}return f?"OK":"ERROR"};c.functions._ExecStr_=function(a){return c.functions._ExecBlock_(a,"")};c.functions._ExecBlock_=function(a,b){var h=[],e=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var d=0,f=a.length;d<f;d++)a[d].match("<"+b+">")?(e=a[d].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&(h=h.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[d].match("</"+b+">")?(e=a[d].trim().split("</"+
b+">"),2==e.length&&""!=e[0]&&(h=h.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(h=h.concat(a[d].split(String.fromCharCode("166"))));d=0;for(f=h.length;d<f;d++)e=h[d].split("="),e[0]=e[0].trim(),2==e.length&&""!=e[0]&&(isNaN(parseFloat(e[1]))?c.setVariable(e[0],e[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):c.setVariable(e[0],parseFloat(e[1])))}return 0};var b=a.newHTML("a",{target:"_blank"}),h,e=null;a.newBlobContent=null;c.functions._Save_=function(d,g){c.evaluator.parent.removeButtonClick();
1500<Date.now()-f&&(f=Date.now(),document.body.appendChild(b),e=g.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),h=new Blob(["\ufeff",e],{type:"text/plain;charset=utf-8"}),b.setAttribute("href",window.URL.createObjectURL(h)),b.setAttribute("download",d),e!=a.newBlobContent&&(b.click(),a.newBlobContent=e),document.body.removeChild(b));return 0};var g=a.newHTML("a",{target:"_blank"});c.functions._SaveSpace_=function(b,h){c.evaluator.parent.removeButtonClick();1500<
Date.now()-f&&(f=Date.now(),document.body.appendChild(g),e=h,g.setAttribute("href",e),g.setAttribute("download",b),e!=a.newBlobContent&&(g.click(),a.newBlobContent=e),document.body.removeChild(g));return 0};var q,l,k=a.newHTML("input",{type:"file"});k.addEventListener("change",function(b){q=b.target.files;l=new FileReader;l.onload=function(b){a.addExternalFileContent(q[0].name,b.target.result);c.setVariable("DJS.fileName",q[0].name);c.setVariable("DJS.fileContent",b.target.result);c.getFunction(c._callback)&&
(c.getFunction(c._callback).apply(c.evaluator,[]),c.evaluator.parent.update());k.value=""};0<q.length&&l.readAsText(q[0])});c.functions._Open_=function(a){c.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(c._callback=a,k.click(),f=Date.now());return 0};c.functions._AnchoDeCadena_=c.functions._strWidth_=function(c,b,h,e){return a.getTextWidth(c,a.convertFont(b+","+h+","+e))};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 g=Math.floor,d=function(d){this.parent=d;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,d){this.definitions[a]=d};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,d){this.variables[a]=d};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(a,d,m){d=0>d?0:g(d);this.vectors[a][d]=m};d.prototype.getVector=function(a,d){d=0>d?0:g(d);return this.vectors[a][d]};d.prototype.setMatrix=function(a,d,m,b){d=0>d?0:g(d);m=0>m?0:g(m);void 0==this.matrices[a][d]&&(this.matrices[a][d]=[]);this.matrices[a][d][m]=b};d.prototype.getMatrix=function(a,d,m){d=0>d?0:g(d);m=0>m?0:g(m);return this.matrices[a][d][m]};d.prototype.setFunction=function(a,d){this.functions[a]=d};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new d;a.Evaluator=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l,c,h,e,w,q,u,z,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,h,e,q,l){g=this.evaluator.eval(this.decimals);d=this.evaluator.eval(this.parent.width);
f=this.evaluator.eval(this.parent.font_size);r=h.getColor?h.getColor():h;m=this.textToString(this.text,g,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=m.indexOf("[")&&(m=this.textToString(this.parseSimpleText(m),g,this.fixed));if(this.oldTextStr!==m||this.oldWidth!==d||this.oldSize!==f||this.oldColor!==r||this.oldPosX!==e||this.oldPoxY!==q)b=new a.TextStyle({size:f,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:r,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(m,this.evaluator,b),this.textNodes.update(e,q,g,this.fixed,this.align,this.anchor,r,d);l||this.textNodes.draw(c);this.oldTextStr=m;this.oldWidth=
d;this.oldSize=f;this.oldColor=r;this.oldPosX=e;this.oldPoxY=q};n.prototype.drawRTF=function(a,c,b,h,e){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,h,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,c,this.evaluator.eval(this.parent.width));e||this.textNodes.draw(a)};n.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");k=[];l="'";h=c=0;e=-1;for(u=a.length;c<u;)w=a.charAt(c),q=a.charAt(c-1),"["===w&&"\\"===q?(k.push(a.substring(h,c-1)+"["),h=c+1):"]"===w&&"\\"===q?(k.push(a.substring(h,c-1)+"]"),h=c+1):"["===w&&-1===e?(k.push(a.substring(h,c)),h=c,e++):"["===w?e++:"]"===w&&0===e?(k.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++;k.push(a.substring(h,c));return k};n.prototype.textToString=function(c,b,h){l="";if("rtfNode"!==
c.type)for(var e=0,d=c.length;e<d;e++)"string"===typeof c[e]?l+=c[e]:(z=this.evaluator.eval(c[e])[0][0],""!==z&&("string"===typeof z?l+=z:Infinity===z?l+="Infinity":-Infinity===z?l+="-Infinity":isNaN(z)||"NaN"===z?l+="NaN":(z=parseFloat(z),z=h?z.toFixed(b):a.removeNeedlessDecimals(z.toFixed(b)),l+=z.toString().replace(".",this.decimal_symbol))));return l};a.TextObject=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d=function(){};d.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var d=[],f=null,b=0,k=a.length;a.charAt(0);var l=!1,c=!1,h=0;g="";for(var e=0;e<k;e++){var w=a.charAt(e);var q=a.charAt(e+1);"\\"===w&&"$"===q&&(c=!0);"{"===w?h++:"}"===w&&(h--,c&&0===h&&(c=!1));c?"_"===w?"{"===q?g+="\\subindex":(g+="\\subindex{"+q+"}",e++):"^"===w?"{"===q?g+="\\superindex":(g+="\\superindex{"+q+"}",e++):g+=w:g+=w}a=g;q=a.charAt(0);for(k=a.length;b<
k;)w=q,q=a.charAt(b+1),l&&("{"===w||"["===w||"\\"===w||" "===w?(l=!1," "===w&&(f={type:"ignore"},d.push(f))):f.value+=w),l||"\\"!==w?l||"{"!==w&&"["!==w?l||"}"!==w&&"]"!==w?l||(f&&"text"===f.type?f.value+=w:f&&"ignore"===f.type?(d.pop(),f=d[d.length-1]):(f={type:"text",value:w},d.push(f))):(f={type:"close",value:w},d.push(f)):(f={type:"open",value:w},d.push(f)):(l=!0,f={type:"command",value:""},d.push(f)),b++;return d};a.DescarTeXTokenizer=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(){this.tokenizer=new a.DescarTeXTokenizer};g.prototype.parse=function(d,f,g){d=this.tokenizer.tokenize(d);var m=new a.TextNode("","textBlock",g,null),b=new a.TextNode("","textLineBlock",g.clone(),null);m.addChild(b);for(var k=[],l=void 0,c=g,h=[g],e,w,q,u,r=!1,n=0,p=d.length;n<p;n++)if("text"===d[n].type)if("color_parameter"===l)w=new a.Color(d[n].value,f);else if("text_size_parameter"===l)q=parseFloat(d[n].value);else if("textLineBlock"===
b.nodeType){e=d[n].value.split(" ");for(var x=0,v=e.length;x<v;x++)""!==e[x]&&b.addChild(new a.TextNode(e[x],"text",c.clone(),null)),x+1<v&&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",g.clone(),null),m.addChild(b)):"command"===d[n].type&&"b"===d[n].value?(l="bold",k.push(l)):"command"===d[n].type&&"i"===d[n].value?(l="italic",
k.push(l)):"command"===d[n].type&&"o"===d[n].value?(l="overline",k.push(l)):"command"===d[n].type&&"u"===d[n].value?(l="underline",k.push(l)):"command"===d[n].type&&"color"===d[n].value?(l="color",k.push(l)):"command"===d[n].type&&"ts"===d[n].value?(l="text_size",k.push(l)):"command"===d[n].type&&"sansserif"===d[n].value.toLowerCase()?(l="sansserif",k.push(l)):"command"===d[n].type&&"serif"===d[n].value.toLowerCase()?(l="serif",k.push(l)):"command"===d[n].type&&"monospace"===d[n].value.toLowerCase()?
(l="monospace",k.push(l)):"command"===d[n].type&&"c"===d[n].value?(l="center",k.push(l)):"command"===d[n].type&&"l"===d[n].value?(l="left",k.push(l)):"command"===d[n].type&&"r"===d[n].value?(l="right",k.push(l)):"command"===d[n].type&&"j"===d[n].value?(l="justify",k.push(l)):"command"===d[n].type&&"$"===d[n].value?(l="formula",k.push(l),r=!0):"command"===d[n].type&&"sum"===d[n].value?(l="sum",k.push(l)):"command"===d[n].type&&"prod"===d[n].value?(l="prod",k.push(l)):"command"===d[n].type&&"int"===
d[n].value?(l="integral",k.push(l)):"command"===d[n].type&&"lim"===d[n].value?(l="limit",k.push(l)):"command"===d[n].type&&"sqrt"===d[n].value?(l="radical",k.push(l)):"command"===d[n].type&&"subindex"===d[n].value?(l="subIndex",k.push(l)):"command"===d[n].type&&"superindex"===d[n].value?(l="superIndex",k.push(l)):"command"===d[n].type&&"frac"===d[n].value?(l="numerator",k.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=q,h.push(c)):"color"===l?l="color_parameter":"color_text"===l?(c=c.clone(),c.color=w,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),m.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?r?(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?r&&(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?r&&
(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?r&&(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",k[k.length-1]=l):"from"===l?r&&(u=new a.TextNode("","to",c.clone(),null),b.addChild(u),b=u,l="to",k[k.length-1]=l):"to"===l?r&&(h.pop(),c=h[h.length-1],u=new a.TextNode("","what",c.clone(),null),
b.addChild(u),b=u,l="what",k[k.length-1]=l):"numerator"===l?r&&(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],k.pop(),l=k[k.length-1]):"color_parameter"===l?l="color_text":"text_size_parameter"===l?l="text_size_text":"center"===l||"left"===l||"right"===l||"justify"===l?(h.pop(),c=h[h.length-1],k.pop(),l=k[k.length-1],d[n+1]&&"command"===d[n+1].type&&"newline"===d[n+1].value?b=m:(b=new a.TextNode("","textLineBlock",c.clone(),null),m.addChild(b))):"formula"===b.nodeType?(r=!1,h.pop(),c=h[h.length-1],k.pop(),l=k[k.length-1],b=b.parent):"subIndex"===b.nodeType||
"superIndex"===b.nodeType?r&&(h.pop(),c=h[h.length-1],k.pop(),l=k[k.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(k.pop(),l=k[k.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(k.pop(),l=k[k.length-1],b=b.parent.parent):"numerator"===b.nodeType?(l="denominator",b=b.parent):"denominator"===b.nodeType&&(h.pop(),c=h[h.length-1],k.pop(),l=k[k.length-1],b=b.parent.parent));var y,A,D=null,J=[];m.children.forEach(function(a){for(var c=
0,b=a.children.length;c<b-1;c++)y=a.children[c],A=a.children[c+1],"text"===y.nodeType&&"text"===A.nodeType&&y.style.equals(A.style)?(null===D&&(D=y,u=y.clone(),D.changeNodeType("word"),D.value="___"+u.value,D.addChild(u)),u=A.clone(),D.addChild(u),J.push(A),D.value+=u.value):D=null});J.forEach(function(a){a.parent.removeChild(a)});m.normalize();m.adjustFontSize();return m};a.DescarTeXParser=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,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,f;for(f in this)this.hasOwnProperty(f)&&(d=d&&this[f]===a[f]);return d};d.prototype.toString=function(d){/arial|sansserif/i.test(this.family)?
g=a.sansserif_font:/times|serif/i.test(this.family)?g=d?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(g=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+g).trim()};a.TextStyle=d;return a}(descartesJS||{});
descartesJS=function(a){function g(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 f=!1,r="#000000",m=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 k=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(){}};k.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;
break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=
this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};k.prototype.clone=function(){for(var a=new k(this.value,this.nodeType,this.style.clone()),b=0,e=this.children.length;b<e;b++)a.addChild(this.children[b].clone());return a};k.prototype.toStr=function(){for(var a=this.value,b=0,e=this.children.length;b<e;b++)a+=" "+this.children[b].toStr();return a};k.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+"}"};k.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};k.prototype.removeChild=function(a){var c=this.children.indexOf(a);-1!==c&&(a.parent=null,this.children.splice(c,1))};k.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};k.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};k.prototype.nextSibling=function(){if(this.parent)for(var a=null,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};k.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};k.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};k.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};k.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};k.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 k("","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 k("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&d.parent.insertAfter(d,new k("","text",d.parent.style))}return this};k.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])};k.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))};k.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)};k.prototype.update=function(a,h,e,d,f,g,l,k){m=e;b=d;r=l;this.metrics.w=this.metrics.h=0;l=h;if(20<=k)for(e=0;e<this.children.length;e++)this.children[e].breakLines(k);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;f=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);h+=f;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}h=l;g=g||"";g.match("right")?a-=this.metrics.w:g.match("_center")&&(a-=this.metrics.w/2);g.match("bottom")?h-=this.metrics.h:g.match("center_")&&(h-=this.metrics.h/2);g=this.children;e=0;for(d=g.length;e<d;e++)"left"===g[e].style.align?g[e].metrics.offsetX=
a:"right"===g[e].style.align?g[e].metrics.offsetX=a+this.metrics.w-g[e].metrics.w:"center"===g[e].style.align?g[e].metrics.offsetX=a+(this.metrics.w-g[e].metrics.w)/2:"justify"===g[e].style.align&&20<=k&&(f=e<d-1?g[e+1].value:null,g[e].metrics.offsetX=a,"wrap"===f&&g[e].justifyAux(k)),g[e].metrics.y=h,h+=parseInt(g[e].metrics.ascent+.5),g[e].metrics.offsetY=h,f=parseInt(g[e].metrics.descent+.5)+parseInt(1.5+.05*g[e].style.size),h+=f};k.prototype.breakLines=function(c){for(var b,e=0,d=!1,f=[],g=0,
l=this.children.length;g<l;g++)b=this.children[g],d?f.push(b):("text"===b.nodeType||"space"===b.nodeType?(a.ctx.font=b.style.toString(),b.metrics.w=a.ctx.measureText(b.value).width):"word"===b.nodeType?b.updateLine():"formula"===b.nodeType&&b.updateFormula(),e+=b.metrics.w,e>c&&"space"!==b.nodeType&&0<g&&(d=!0,f.push(b)));if(0<f.length)for(c=new k("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),g=0,l=f.length;g<l;g++)f[g].parent&&f[g].parent.removeChild(f[g]),c.addChild(f[g])};
k.prototype.updateLine=function(c){var b=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var e=this.metrics.descent=0,f=this.children,g,l=0,k=f.length;l<k;l++){g=f[l];if("text"===g.nodeType){a.ctx.font=g.style.toString();var m=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=d(a.ctx.font);g.metrics.w=a.ctx.measureText(m).width;g.metrics.offsetX=e;Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},
y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===g.nodeType?(a.ctx.font=g.style.toString(),g.metrics=d(a.ctx.font),g.metrics.w=l===k-1?0:c?c:a.ctx.measureText(" ").width,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===g.nodeType&&(g.updateLine(),g.metrics.offsetX_aux=e,Object.defineProperties(g.metrics,{offsetX:{get:function(){return b.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===g.nodeType&&(a.ctx.font=g.styleString,m=""!==g.value?g.value:a.in_editor?"\u200a":"",g.metrics=d(a.ctx.font),g.metrics.w=a.ctx.measureText(m).width,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),g.clickCatcher||(g.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+g.metrics.w+"px;height:"+
g.metrics.h+"px;cursor:pointer;"}),g.clickCatcher.rtfNode=g,g.clickCatcher.action=new a.OpenURL(this.evaluator.parent,g.URL),g.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===g.nodeType&&(g.componentNumCtrl=this.evaluator.parent.getControlByCId(g.value),a.ctx.font=g.styleString,g.metrics=d(a.ctx.font),g.metrics.w=g.componentNumCtrl.w,g.metrics.h=g.componentNumCtrl.h,g.metrics.offsetX=e,Object.defineProperties(g.metrics,
{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));"componentSpace"===g.nodeType?(g.componentSpace=this.evaluator.parent.getSpaceByCId(g.value),a.ctx.font=g.styleString,g.metrics=d(a.ctx.font),g.metrics.w=g.componentSpace.w,g.metrics.h=g.componentSpace.h,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===g.nodeType&&(g.updateFormula(),
g.metrics.marginX=g.metrics.marginY=g.metrics.paddingX=g.metrics.paddingY=0,g.metrics.offsetX_aux=e,Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),g.metrics.w+=2*g.metrics.paddingX,g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h+=2*g.metrics.paddingY,e+=2*g.metrics.marginX);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);e+=g.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};k.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,f=0,l={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},k=0,r=h.length;k<r;k++){e=h[k];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=f;Object.defineProperties(e.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});f+=c.metrics.marginX}else if("dynamicText"===e.nodeType){n=void 0===
e.decimals?m:e.evaluator.eval(e.decimals);var p=void 0===e.fixed?b:e.fixed,x=e.evaluator.eval(e.value);parseFloat(x).toString()===x.toString()&&(x=p?parseFloat(x).toFixed(n):a.removeNeedlessDecimals(parseFloat(x).toFixed(n)),x=(""+x).replace(".",e.decimal_symbol));e.evalValue=x;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(x).width+2*e.metrics.paddingX;e.metrics.offsetX_aux=f;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}}});f+=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=f,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,f+=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=f,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,f+=n.metrics.marginX;else if("fraction"===e.nodeType){p=e;p.updateFormula();n=p.children;x=n[0];n=n[1];p.metrics.marginX=parseInt(.5+.075*this.style.size);p.metrics.paddingX=0;p.metrics.paddingY=0;var v=Math.max(x.metrics.w,n.metrics.w)+2*p.metrics.paddingX;p.metrics.prevChild=l;p.metrics.offsetX_aux=
f;var y=parseInt(-l.metrics.descent+4*l.metrics.h/9);Object.defineProperties(p.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+y}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-y}}});Object.defineProperties(x.metrics,{parent:{value:p},maxWidth:{value:v},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:p},maxWidth:{value:v},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}}});p.metrics.w=
v;p.metrics.ascent=x.metrics.h+y+2*p.metrics.paddingY;p.metrics.descent=n.metrics.h-y+2*p.metrics.paddingY;p.metrics.h=x.metrics.h+n.metrics.h+4*p.metrics.paddingY;f+=2*p.metrics.marginX}else if("radical"===e.nodeType){l=e;l.updateFormula();n=l.children;p=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=f;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};x=parseInt(p.metrics.w-2*l.radicalSign.w/3);Object.defineProperties(l.radicalSign,{parent:{value:l},displaceIndex:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return c.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(p.metrics,{parent:{value:l},displaceIndex:{value:x},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:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});x=p.metrics.w<2*l.radicalSign.w/3?l.radicalSign.w:parseInt(p.metrics.w+l.radicalSign.w/3);l.metrics.w=x+2*l.metrics.paddingX+A.metrics.w;l.metrics.ascent=Math.max(A.metrics.ascent,p.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;f+=2*l.metrics.marginX}else if("sum"===e.nodeType){p=e;p.updateFormula();n=p.children;x=n[0];v=n[1];var D=n[2];p.metrics.marginX=parseInt(1.5+.075*this.style.size);p.metrics.paddingX=parseInt(1.5+.075*this.style.size);p.metrics.paddingY=parseInt(1.5+.05*this.style.size);p.metrics.offsetX_aux=f;Object.defineProperties(p.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);p.sigmaSign={w:n,h:l,scale:l/1E3};var E=Math.max(v.metrics.w,x.metrics.w,p.sigmaSign.w);p.sigmaSign.parent=p;Object.defineProperties(p.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-v.metrics.descent-(l+J.h)/2-p.metrics.paddingY;Object.defineProperties(v.metrics,{parent:{value:p},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=x.metrics.ascent+J.descent+(l-J.h)/2+p.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:p},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(D.metrics,{parent:{value:p},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}}});p.metrics.w=E+D.metrics.w+3*p.metrics.paddingX;p.metrics.ascent=Math.max(D.metrics.ascent,-n+v.metrics.ascent)+p.metrics.paddingY;p.metrics.descent=Math.max(D.metrics.descent,l+x.metrics.descent)+p.metrics.paddingY;p.metrics.h=p.metrics.ascent+p.metrics.descent;
f+=2*p.metrics.marginX}else if("integral"===e.nodeType){p=e;p.updateFormula();n=p.children;x=n[0];v=n[1];D=n[2];p.metrics.marginX=parseInt(1.5+.075*this.style.size);p.metrics.paddingX=parseInt(1.5+.075*this.style.size);p.metrics.paddingY=parseInt(1.5+.05*this.style.size);p.metrics.offsetX_aux=f;Object.defineProperties(p.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);p.sign={w:F,h:E,scale:E/1E3};p.sign.parent=p;Object.defineProperties(p.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-v.metrics.descent+E/3;Object.defineProperties(v.metrics,{parent:{value:p},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+x.metrics.ascent/2;Object.defineProperties(x.metrics,{parent:{value:p},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)+v.metrics.w,parseInt(2*F/5+x.metrics.w))+p.metrics.paddingX;Object.defineProperties(D.metrics,{parent:{value:p},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}}});p.metrics.w=F+D.metrics.w+2*p.metrics.paddingX;p.metrics.ascent=Math.max(D.metrics.ascent,-n+v.metrics.ascent)+p.metrics.paddingY;p.metrics.descent=Math.max(D.metrics.descent,l+x.metrics.descent,E-p.metrics.ascent)+p.metrics.paddingY;p.metrics.h=Math.max(p.metrics.ascent+p.metrics.descent,E);f+=2*p.metrics.marginX}else if("prod"===e.nodeType)p=e,p.updateFormula(),n=p.children,x=n[0],v=n[1],D=n[2],p.metrics.marginX=parseInt(1.5+
.075*this.style.size),p.metrics.paddingX=parseInt(1.5+.075*this.style.size),p.metrics.paddingY=parseInt(1.5+.05*this.style.size),p.metrics.offsetX_aux=f,Object.defineProperties(p.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),p.piSign={w:n,h:l,scale:l/1E3},E=Math.max(v.metrics.w,x.metrics.w,p.piSign.w),p.piSign.parent=p,Object.defineProperties(p.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-v.metrics.descent-(l+J.h)/2-p.metrics.paddingY,Object.defineProperties(v.metrics,{parent:{value:p},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=x.metrics.ascent+J.descent+(l-J.h)/2+p.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:p},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(D.metrics,{parent:{value:p},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}}}),
p.metrics.w=E+D.metrics.w+3*p.metrics.paddingX,p.metrics.ascent=Math.max(D.metrics.ascent,-n+v.metrics.ascent)+p.metrics.paddingY,p.metrics.descent=Math.max(D.metrics.descent,l+x.metrics.descent)+p.metrics.paddingY,p.metrics.h=p.metrics.ascent+p.metrics.descent,f+=2*p.metrics.marginX;else if("limit"===e.nodeType){l=e;l.updateFormula();n=l.children;var G=n[0];p=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=f;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);x=parseInt(.5+a.ctx.measureText("l\u00edm").width);v=parseInt(.5+a.ctx.measureText("\u2192").width);D=Math.max(x,G.metrics.w+v+p.metrics.w);
l.limitText={parent:l};Object.defineProperties(l.limitText,{limitWidth:{value:D},limitTextWidth:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});x=J.descent+Math.max(G.metrics.ascent,p.metrics.ascent,2*J.ascent/3)+l.metrics.paddingY;l.limitArrow={parent:l};Object.defineProperties(l.limitArrow,{newBaseline:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+G.metrics.w}},y:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(G.metrics,{parent:{value:l},newBaseline:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(p.metrics,{parent:{value:l},arrowWidth:{value:v},newBaseline:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+G.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(n.metrics,{parent:{value:l},limitWidth:{value:D},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=D+n.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(n.metrics.ascent,J.ascent)+l.metrics.paddingY;v=0;n=Math.max(G.metrics.descent,p.metrics.descent,n.metrics.descent);if(0!=G.metrics.h||0!=p.metrics.h)v=x,n=Math.max(G.metrics.descent,p.metrics.descent,n-v);l.metrics.descent=v+n+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;f+=2*l.metrics.marginX}else if("matrix"===e.nodeType){x=e;x.updateFormula();n=x.children;v=x.rows;D=x.columns;x.metrics.marginX=parseInt(1.5+
.075*this.style.size);x.metrics.paddingX=parseInt(5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=f;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=e.style.toString();J=d(a.ctx.font);E=[];F=[];l=0;for(var B=v*D;l<B;l++){var L=
parseInt(l/D);var I=l%D;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+D)*x.metrics.paddingX;for(l=0;l<D;l++)M+=F[l];var P=(1+v)*x.metrics.paddingY;for(l=0;l<v;l++)P+=E[l];p=J.descent-J.h/2;l=0;for(B=v*D;l<B;l++)L=parseInt(l/D),I=l%D,n[l].metrics.offsetX_aux=g(F,I)+(F[I]-n[l].metrics.w)/2+I*x.metrics.paddingX,n[l].metrics.offsetY_aux=g(E,L)+(E[L]-n[l].metrics.h)/2+(1+L)*x.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:x},matrixH:{value:P},
dispY:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.w=M;x.metrics.ascent=P/2-p;x.metrics.descent=P/2+p;x.metrics.h=x.metrics.ascent+x.metrics.descent;f+=2*x.metrics.marginX}else if("defparts"===e.nodeType){x=e;x.updateFormula();n=e.children;
v=e.parts;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=f;Object.defineProperties(x.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=
e.style.toString();J=d(a.ctx.font);D=0;E=x.metrics.paddingY;p=J.descent-J.h/2;for(l=0;l<v;l++)n[l].metrics.offsetY_aux=E,D=Math.max(D,n[l].metrics.w),E+=n[l].metrics.h+x.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:x},dispY:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=E;x.metrics.w=D+4*x.metrics.paddingX;x.metrics.ascent=E/2-p;x.metrics.descent=E/2+p;x.metrics.h=x.metrics.ascent+x.metrics.descent;f+=2*x.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;f+=e.metrics.w}};k.prototype.justifyAux=function(a){for(var c=0,b=0,d=0,f=this.children.length;d<f-1;d++)"space"===this.children[d].nodeType?c++:b+=this.children[d].metrics.w;this.updateLine((a-b)/c)};k.prototype.drawTextBlock=function(a){a.fillStyle=r;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);a.shadowColor="transparent"};k.prototype.drawTextLineBlock=function(a){for(var c=0,b=this.children.length;c<b;c++)f=!1,this.children[c].draw(a)};k.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:r;a.font=this.style.toString(f);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)}};k.prototype.drawWord=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};k.prototype.drawSpace=function(a){};k.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:r;a.font=this.style.toString(f);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")};k.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(f);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)};k.prototype.drawFormula=function(a){for(var c=0,b=this.children.length;c<b;c++)f=
!0,this.children[c].draw(a);this.drawBorder(a,"blue")};k.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();var 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")};k.prototype.drawNumDen=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);
this.drawBorder(a,"blue")};k.prototype.drawSuperIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSubIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};k.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.save();a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,
this.radicalSign.scaleY);this.drawRadicalSign(a);a.restore();a.beginPath();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.sigmaSign.x,this.sigmaSign.y);a.scale(this.sigmaSign.scale,
this.sigmaSign.scale);if(this.style.border){var 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")};k.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.sign.x,this.sign.y);a.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(a);a.restore();for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};k.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.piSign.x,this.piSign.y);
a.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&a.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};k.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-
this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var 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")};k.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();c=3*this.metrics.marginX;var 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")};k.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&
this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};k.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};k.prototype.drawRadicalSign=function(a){a.beginPath();
a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.stroke();a.fill()};k.prototype.drawSigmaSign=function(a){a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,
65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.stroke();a.fill()};k.prototype.drawIntegralSign=function(a){a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,
1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.stroke();a.fill()};k.prototype.drawProdSign=function(a){a.beginPath();a.moveTo(876.3561,999.59384);a.lineTo(876.3561,972.20771);a.lineTo(858.75073,972.20771);a.bezierCurveTo(794.19771,
972.20771,761.92121,931.12852,761.92121,847.99206);a.lineTo(761.92121,144.75542);a.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);a.lineTo(876.3561,1.7633057E-4);a.lineTo(1.184082E-5,1.7633057E-4);a.lineTo(1.184082E-5,27.386304);a.lineTo(16.627304,27.386304);a.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);a.lineTo(115.41298,865.59743);a.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);a.lineTo(1.184082E-5,972.20771);
a.lineTo(1.184082E-5,999.59384);a.lineTo(359.93198,999.59384);a.lineTo(359.93198,972.20771);a.lineTo(329.61162,972.20771);a.bezierCurveTo(265.0586,972.20771,243.54093,932.10659,243.54093,841.14553);a.lineTo(243.54093,64.553192);a.lineTo(633.79325,64.553192);a.lineTo(633.79325,841.14553);a.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);a.lineTo(516.42413,972.20771);a.lineTo(516.42413,999.59384);a.closePath();a.stroke();a.fill()};k.prototype.drawBorderSpecial=function(a,
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([])};k.prototype.toRTF=function(){var a=[],b=[],e="";this.mergeTextNodes();for(var d=0,f=this.children.length;d<f;d++){var g=this.children[d];"textLineBlock"===g.nodeType&&(e+=g.toRTFAux(a,b)+(1<f&&d<f-1?"\\par":""))}g="{\\fonttbl";d=0;for(f=a.length;d<f;d++)g+="\\f"+d+"\\fcharset0 "+a[d]+";";
a="";if(0<b.length){a="{\\colortbl";d=0;for(f=b.length;d<f;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(g+"}")+a+e+"}"};k.prototype.toRTFAux=function(a,b){for(var c,d,f,h=null,g="",l,k,m,v,y,A=0,D=this.children.length;A<D;A++)l=k="",c=this.children[A],m=this.addToFontTable(c.style.family,a),v=c.style.size,y=this.addToColorTable(c.style.color,b),null===y&&0<b.length&&(y=this.addToColorTable(r,b)),y!==h&&(l+="\\cf"+y,h=y),m!==d&&(l+="\\f"+m,d=m),v!==f&&(l+="\\fs"+2*v,f=v),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:""!==g&&"}"!==g.charAt(g.length-1)?" "+c.value:c.value,g+=c):"formula"===c.nodeType?g+="{\\*\\mjaformula"+c.formulaToRTF(d,f,h,a,b)+"}":"componentSpace"===c.nodeType?g+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&
(g+="{\\*\\component\\NumCtrl "+c.value+"}");return g};k.prototype.formulaToRTF=function(a,b,e,d,f){for(var c,h="",g,l,k,m,q=0,w=this.children.length;q<w;q++)g=l="",c=this.children[q],k=this.addToFontTable(c.style.family,d),m=this.addToColorTable(c.style.color,f),null===m&&0<f.length&&(m=this.addToColorTable(r,f)),k!==a&&(g+="\\f"+k,a=k),m!==e&&(g+="\\cf"+m,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(e=m),c.style.italic&&(g+="\\i",l="\\i0"+l),c.style.bold&&(g+="\\b",l="\\b0"+l),c.style.underline&&
(g+="\\ul",l="\\ulnone"+l),c.style.overline&&(g+="\\ol",l="\\olnone"+l),"text"===c.nodeType&&""!==c.value?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==g?g+" "+c.value+l:"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,h+=g+"{\\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?h+="{\\"+c.nodeType+c.formulaToRTF(a,b,e,d,f)+"}":"numerator"===c.nodeType?h+="{\\num"+c.formulaToRTF(a,b,e,d,f)+"}":"denominator"===c.nodeType?h+="{\\den"+c.formulaToRTF(a,b,e,d,f)+"}":"superIndex"===c.nodeType?h+="{\\supix"+c.formulaToRTF(a,b,e,d,f)+"}":"subIndex"===c.nodeType?h+="{\\subix"+c.formulaToRTF(a,
b,e,d,f)+"}":"matrix"===c.nodeType?h+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,e,d,f)+"}":"defparts"===c.nodeType&&(h+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,e,d,f)+"}");return h};k.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};k.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};k.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=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=String.fromCharCode,d,f,r,m,b,k,l,c,h,e,w,q=function(){};q.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];f="";m=r=0;k=a.charAt(0);l=!1;for(c="text";r<a.length;)b=k,k=a.charAt(r+1),l?"\\"===k||"{"===k||"}"===
k||" "===k||";"===k?(l=!1,f+=b," "===k?(r++,k=a.charAt(r+1),w=!0):w=!1,(h=f.match(/^'([0-9a-f]{2})/))?(e="","text"===c&&(e=d.pop().value),f=e+=g(parseInt(h[1],16))+f.substring(3)):(h=f.match(/^u[0-9]+/))?(e="","text"===c&&(e=d.pop().value),f=e+=g(h[0].substring(1))):("{"===f||"}"===f||"\\"==b?(d.push({type:"text",value:f+(w?" ":"")}),c="text"):(d.push({type:"controlWord",value:f}),c="controlWord"),f="")):"{"==b||"}"==b||"\\"==b?(l=!1,d.push({type:"text",value:b}),c="text"):f+=b:"\\"===b?(l=!0,""!==
f&&(d.push({type:"text",value:f}),c="text",f="")):"{"===b?(m++,""!==f&&(d.push({type:"text",value:f}),f=""),d.push({type:"openBlock",value:m}),c="openBlock"):"}"===b?(""!==f&&(d.push({type:"text",value:f}),f=""),d.push({type:"closeBlock",value:m}),c="closeBlock",m--):f+=b,r++;""!==f&&d.push({type:"text",value:f});return d};a.RTFTokenizer=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,d,f,r,m,b,k,l,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F,G,B,L,I,M,P,H,N=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};N.prototype.parse=function(C){d=this.tokenizer.tokenize(C);f={};m=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(r=d[0].value;"closeBlock"!==d[m].type&&d[m].value!==r;)f[d[m].value]=d[m+2].value.substring(0,d[m+2].value.length-1),m+=3;m++}b={};k=0;if("openBlock"===d[m].type&&"colortbl"===d[m+1].value){r=
d[m++].value;for(m++;"closeBlock"!==d[m].type&&d[m].value!==r;)l=parseInt(d[m++].value.substring(3)).toString(16),c=parseInt(d[m++].value.substring(5)).toString(16),h=parseInt(d[m++].value.substring(4)).toString(16),";"===d[m].value&&m++,b[k++]="#"+(2>l.length?"0"+l:l)+(2>c.length?"0"+c:c)+(2>h.length?"0"+h:h);m++}z=u=q=null;M=I=L=D=A=y=v=x=p=n=!1;J=[new a.TextStyle];E=J[0];G=F=-1;B=[];e=P=new a.TextNode("","textBlock",E,this.evaluator);w=new a.TextNode("","textLineBlock",E,this.evaluator);e.addChild(w);
P.stableWidth=!0;P.hasFormula=!1;C=m;for(var N=d.length;C<N;C++){if("controlWord"==d[C].type)if(f[d[C].value])E.set({family:f[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"!=w.nodeType)for(w=w.parent;"textBlock"!=w.nodeType;)w=w.parent;w.addChild(e);w=e}else if("mjaformula"==d[C].value)P.hasFormula=!0,G=F,n=!0,e=new a.TextNode("","formula",E.clone(),this.evaluator),w.addChild(e),w=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=g(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=g(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=g(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=g(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?z=e:"matrix"==d[C].value&&(u=e,u.matrix_type=0)):"parts"==d[C].value?D=!0:"type"==d[C].value?v=!0:"rows"==d[C].value?y=!0:"columns"==
d[C].value?A=!0:"expr"==d[C].value?(P.stableWidth=!1,p=!0):"decimals"==d[C].value?x=!0:"fixed1"==d[C].value?q.fixed=!0:"fixed0"==d[C].value?q.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(D)z.parts=parseInt(d[C].value),D=!1;else if(v)u.matrix_type=parseInt(d[C].value),v=!1;else if(y)u.rows=parseInt(d[C].value),y=!1;else if(A)u.columns=parseInt(d[C].value),A=!1;else if(x)q.decimals=this.evaluator.parser.parse(d[C].value+
""),x=!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"!=w.nodeType)for(w=w.parent;"textLineBlock"!=w.nodeType;)w=w.parent;w.addChild(e);M=!1}else if(L)e=new a.TextNode(d[C].value,"componentNumCtrl",E.clone(),this.evaluator),w.addChild(e),L=!1;else if(I)e=new a.TextNode(d[C].value,"componentSpace",E.clone(),this.evaluator),w.addChild(e),I=!1;else if(p)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),q=B[B.length-1]=e,p=!1;else if(p||n)!p&&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"!=w.nodeType)for(w=w.parent;"textLineBlock"!=w.nodeType;)w=w.parent;w.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==G&&(G=-1,n=!1,w=w.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 P.normalize()};a.RTFParser=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k,l,c,h,e,w=function(b,c){this.parent=b;d=this.evaluator=this.parent.evaluator;f=d.parser;this.id="";this.type="2D";this.xExpr=f.parse("0");this.yExpr=f.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=f.parse("1");this.fixed=!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()};w.prototype.initSpace=function(){var a=this;g=a.parent;d=a.evaluator;r=a.id;a.resizable||(a.displaceRegionNorth=g.displaceRegionNorth||0,a.displaceRegionSouth=g.displaceRegionSouth||0,a.displaceRegionEast=g.displaceRegionEast||0,a.displaceRegionWest=g.displaceRegionWest||0,l=parseInt(g.container.width),k=parseInt(g.container.height),void 0!=a.wExpr&&(a.w=parseInt(l-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(k-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=d.parser.parse((parseInt(l-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=d.parser.parse((parseInt(k-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?(m=k-a.y,a.h>m&&(a.h=m)):(m=a.h+a.y,a.h=m>=k?k:m),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=g.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!==g.version?
(d.setVariable(r+"._w",a.w),d.setVariable(r+"._h",a.h),d.setVariable(r+".escala",a.scale),d.setVariable(r+".Ox",d.getVariable(r+".Ox")||a.Ox),d.setVariable(r+".Oy",d.getVariable(r+".Oy")||a.Oy),d.setVariable(r+".mouse_x",0),d.setVariable(r+".mouse_y",0),d.setVariable(r+".mouse_pressed",0),d.setVariable(r+".mouse_clicked",0),d.setVariable(r+".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==g.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;d.setFunction(r+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};
w.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};w.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))};w.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};w.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};w.prototype.getRelativeY=
function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};w.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};w.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d=function(d){g=this;g.parent=d;g.width=228;g.vSpace=25;g.container=a.newHTML("div",{style:"box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:"+(g.width+27)+"px;height:460px;"});g.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(g.width+27)+"px;height:"+g.vSpace+
"px;line-height:"+g.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});g.movable.innerHTML="Descartes";g.container.appendChild(g.movable);g.ctrs=[]};d.prototype.init=function(){function d(b){g.newPos=a.getCursorPosition(b,document.body);g.container.style.left=g.initialPosition.x+(g.newPos.x-g.oldPos.x)*a.cssScale+"px";g.container.style.top=g.initialPosition.y+(g.newPos.y-g.oldPos.y)*a.cssScale+"px"}function r(a){a.preventDefault();document.body.removeEventListener("mousemove",
d);document.body.removeEventListener("mouseup",r)}g=this;document.body.appendChild(this.container);for(var m=g.parent.evaluator.parser,b=0,k=g.ctrs.length;b<k;b++)g.ctrs[b].expresion=m.parse("(0,"+(g.vSpace+23+35*b)+","+g.width+",35)"),g.ctrs[b].update();g.numCtr=k;b=new a.Button(g.parent,{region:"external",name:"english"==g.language?"about":"cr\u00e9ditos",font_size:m.parse("15"),expresion:m.parse("(0,"+g.vSpace+","+g.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(g.parent,
{region:"external",name:"config",font_size:m.parse("15"),action:"config",expresion:m.parse("("+g.width/2+","+g.vSpace+","+g.width/2+",25)")})).update();(new a.Button(g.parent,{region:"external",name:"english"==g.language?"init":"inicio",font_size:m.parse("15"),action:"init",expresion:m.parse("(0,"+(g.vSpace+23+35*k)+","+g.width/2+",25)")})).update();(new a.Button(g.parent,{region:"external",name:"english"==g.language?"clear":"limpiar",font_size:m.parse("15"),action:"clear",expresion:m.parse("("+g.width/
2+","+(g.vSpace+23+35*k)+","+g.width/2+",25)")})).update();m=new a.Button(g.parent,{region:"external",name:"english"==g.language?"close":"cerrar",font_size:m.parse("15"),expresion:m.parse("("+g.width/4+","+(g.vSpace+46+35*k)+","+g.width/2+",25)")});m.update();m.btn.addEventListener("click",function(a){g.hide()});g.setPositionAndSize();g.movable.addEventListener("mousedown",function(b){b.preventDefault();g.oldPos=a.getCursorPosition(b,document.body);g.initialPosition={x:g.container.offsetLeft,y:g.container.offsetTop};
document.body.addEventListener("mousemove",d);document.body.addEventListener("mouseup",r)});g.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(){g=this;var a=g.vSpace+46+35*g.numCtr+25+10;g.container.style.left=Math.max(parseInt(window.innerWidth-g.width)/2,0)+"px";g.container.style.top="5px";g.container.style.height=
window.innerHeight<g.vSpace+75?g.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,d=Math.round,f=2*Math.PI,r=a.convertFont("Serif,BOLD+ITALIC,16"),m=a.convertFont("Monospaced,PLAIN,12"),b,k,l,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F,G,B,L,I,M,P,H,N,C,R,K,Q,O=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});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*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(O,a.Space);O.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")};O.prototype.update=function(a){b=this;k=b.evaluator;l=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),R=b.evaluator.eval(b.hModExpr),b.old_w!=C||b.old_h!=R)b.w=C,b.h=R,b.w_2=b.w/2,b.h_2=b.h/2,k.setVariable(b.wStr,b.w),k.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 k.setVariable(b.wStr,b.w),k.setVariable(b.hStr,b.h);b.drawIfValue=0<k.eval(b.drawif);if(b.drawIfValue){h=b.x!==k.eval(b.xExpr)+b.displaceRegionWest;e=b.y!==k.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||h||e||b.drawBefore!==b.drawIfValue||b.Ox!==k.getVariable(b.OxStr)||b.Oy!==k.getVariable(b.OyStr)||
b.scale!==k.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=h?k.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=e?k.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=k.getVariable(b.OxStr);b.Oy=k.getVariable(b.OyStr);b.scale=k.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));k.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"};O.prototype.drawBackground=function(){b=this;k=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));q=b.scale;u=0;for(z=0>b.w+b.h?0:b.w+b.h;q>z;)q/=10,u++;for(;q<z/10;)q*=10;c.lineWidth=1;""!==b.net&&(c.strokeStyle=b.net.getColor(),b.drawMarks(c,q/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,q,-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,g(b.h/2+b.Oy)+.5),c.lineTo(b.w,g(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(c.moveTo(g(b.w/2+b.Ox)+.5,0),c.lineTo(g(b.w/2+b.Ox)+.5,b.h));c.lineWidth=1.2;c.stroke();c.lineWidth=1;b.drawMarks(c,q,4,a);b.drawMarks(c,
q/2,2,a);b.drawMarks(c,q/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)c.fillStyle=""!==b.axes?b.axes.getColor():"#000",c.font=r,c.textAlign="right",c.textBaseline="alphabetic","no"!=b.x_axis&&c.fillText(b.x_axis,g(b.w)-2,g(b.h/2+b.Oy)+12),"no"!=b.y_axis&&c.fillText(b.y_axis,g(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(c.fillStyle=b.axes.getColor(),c.font=r,c.textAlign="start",c.textBaseline="bottom",q>(b.w+b.h)/2?b.drawNumbers(c,q/5,q<=b.scale?u+1:u):q>(b.w+b.h)/4?b.drawNumbers(c,q/2,q<=b.scale?u+1:u):
b.drawNumbers(c,q,u));a=0;for(var e=this.backGraphics.length;a<e;a++)this.backGraphics[a].draw()};O.prototype.draw=function(){b=this;c=b.ctx;k.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++)w=b.graphics[a],""!==w.trace&&b.drawTrace&&w.drawTrace(),w.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=m,c.textAlign="center",c.textBaseline="alphabetic",G=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="("+G+","+B+")",I=g(c.measureText(L).width/2),M=b.getAbsoluteX(b.mouse_x),P=b.getAbsoluteY(b.mouse_y),H=g(M),N=g(P-10),H+I>b.w?H=b.w-I:0>H-I&&(H=I),N+1>b.h?N=b.h:0>N-14&&(N=15),c.fillText(L,H,N),c.beginPath(),c.arc(M,P,2.5,0,f,!0),c.stroke(),c.restore())};O.prototype.drawMarks=
function(a,b,c,e){n=this.w;p=this.h;E=D=0;J=n;F=p;y=g(n/2+this.Ox);A=g(p/2+this.Oy);0<=c&&(D=y-c,J=y+c,E=A-c,F=A+c);a.beginPath();if(!e||e&&!e.match("x"))for(c=-d(y/b);(x=y+d(c*b))<n;c++)a.moveTo(x+.5,E+.5),a.lineTo(x+.5,F+.5);if(!e||e&&!e.match("y"))for(c=-d(A/b);(v=A+d(c*b))<p;c++)a.moveTo(D+.5,v+.5),a.lineTo(J+.5,v+.5);a.stroke()};O.prototype.drawNumbers=function(a,b,c){n=this.w;p=this.h;y=g(n/2+this.Ox);A=g(p/2+this.Oy);for(c=-d(y/b);(x=y+d(c*b))<n;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),
x+1,A-2);for(c=-d(A/b);(v=A+d(c*b))<p;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),y+5,v+5)};O.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.click=0,h.evaluator.setVariable(h.mpressedStr,0),h.evaluator.setVariable(h.mclickedStr,1),h.evaluator.setVariable(h.mclickIzqStr,1),window.removeEventListener("touchmove",f),
window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),h.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();h.click=0;h.evaluator.setVariable(h.mpressedStr,0);h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclickIzqStr,1);"R"===h.whichBtn&&(window.removeEventListener("mousemove",d),h.posZoom==h.posZoomNew&&a.showConfig&&(h.parent.externalSpace.show(),h.posZoom=!1,h.posZoomNew=!0));window.removeEventListener("mousemove",
f);window.removeEventListener("mouseup",c);h.parent.deactivateGraphicControls();h.parent.update()}function e(b){h.posAnte=a.getCursorPosition(b,h.container);h.mouse_x=h.getRelativeX(h.posAnte.x);h.mouse_y=h.getRelativeY(h.posAnte.y);h.evaluator.setVariable(h.mxStr,h.mouse_x);h.evaluator.setVariable(h.myStr,h.mouse_y);h.evaluator.setVariable(h.mclickedStr,0);h.evaluator.setVariable(h.mclickIzqStr,0);h.parent.update()}function d(b){b.preventDefault();h.posZoomNew=a.getCursorPosition(b,h.container).y;
h.evaluator.setVariable(h.scaleStr,h.tempScale+h.tempScale/45*((h.posZoom-h.posZoomNew)/10));h.parent.update()}function f(b){b.preventDefault();b.stopPropagation();h.fixed||(h.posNext=a.getCursorPosition(b,h.container),K=h.posAnte.x-h.posNext.x,Q=h.posAnte.y-h.posNext.y,h.evaluator.setVariable(h.OxStr,h.Ox-K),h.evaluator.setVariable(h.OyStr,h.Oy-Q));e(b)}var h=this;h.posZoom=h.posZoomNew=null;h.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",
e);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.parent.clearClick(),h.click=1,h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,0),h.parent.deactivateGraphicControls(),e(a),window.addEventListener("touchmove",f),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();h.parent.clearClick();h.click=1;h.parent.deactivateGraphicControls();h.whichBtn=a.whichBtn(b);"R"===h.whichBtn?(window.addEventListener("mouseup",c),h.posZoom=a.getCursorPosition(b,h.container).y,h.posZoomNew=h.posZoom,h.fixed||(h.tempScale=h.scale,window.addEventListener("mousemove",
d))):"L"===h.whichBtn&&(h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,0),e(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){h.click=0;h.evaluator.setVariable(h.mpressedStr,0);h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclickIzqStr,1);window.removeEventListener("mousemove",
f);window.removeEventListener("mouseup",c)})};a.Space2D=O;return a}(descartesJS||{});
descartesJS=function(a){var g,d,f;function r(b,c){H=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));N=a.add3D(b,a.scalarProduct3D(H,-2));C=a.norm3D(N);return 0!==C?a.scalarProduct3D(N,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var m=Math.floor,b=Math.max,k=Math.cos,l=Math.sin,c,h,e,w,q,u,z,n,p,x,v,y,A,D,J,E,F=[],G,B,L,I,M,P,H,N,C,R,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 h=e.lights.length;d<h;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;z=e.y!==c.eval(e.yExpr)+h.plecaHeight+e.displaceRegionNorth;e.spaceChange=a||u||
z||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=z?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&&(R=!0);e.observer=R?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||z)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){x=a.degToRad(e.evaluator.getVariable(e.rotZStr));v=k(x);y=l(x);g=b.x*
v-b.y*y;d=b.x*y+b.y*v;f=b.z;x=a.degToRad(e.evaluator.getVariable(e.rotYStr));v=k(x);y=l(x);return{x:f*y+g*v,y:d,z:f*v-g*y}};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){"object"!=typeof b&&(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);P=a.scalarProduct3D(I,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);E=a.norm3D(this.lights[3]);for(var d=0,h=this.intensity.length-1;d<h;d++)F[d]=this.intensity[d]*this.dim;F[3]=this.userIntensity*this.userIntensity/E||0;G=e?this.dim/2:this.dim/4;B=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);d=0;for(h=this.lights.length;d<h;d++)e?(B=Math.max(0,a.dotProduct3D(r(this.lights[d],L),P)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[d],L)),G+=F[d]*B;G=Math.min(G,
1);A=m(b.r*G);D=m(b.g*G);J=m(b.b*G);return"rgba("+A+","+D+","+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++){w=this.graphics[a];for(var c=a+1;c<b;c++)q=this.graphics[c],w.splitFace(q),q.splitFace(w);this.primitives=
this.primitives.concat(w.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){w=this.graphics[a];if(w.split)for(c=a+1;c<b;c++)q=this.graphics[c],q.split&&w.splitFace(q);this.primitives=this.primitives.concat(w.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,
this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};Q.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);for(var d=[],e=[],h=0,f=a.length,g=.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(d,a[m],g)){k=!1;break}k&&(f--,e[h++]=a[c],a[c].drawn=!0)}if(0==f)break;else if(f==l){if(g*=10,.1<g){for(c=0;c<b;c++)a[c].drawn||(e[h++]=a[c],a[c].drawn=!0);break}}else g=.001}for(c=
0;c<b;c++)e[c].draw(this.ctx,this)};Q.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};Q.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);window.removeEventListener("touchmove",h,!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",e,!1),f.posZoom==f.posZoomNew&&a.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",h,!1);window.removeEventListener("mouseup",c,!1);f.parent.update()}function d(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.id+".mouse_x",f.mouse_x);
f.evaluator.setVariable(f.id+".mouse_y",f.mouse_y);f.parent.update()}function e(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=a.getCursorPosition(b,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function h(b){if(!f.fixed&&f.click){n=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;p=
(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(n!==f.disp.x||p!==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)-p,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=n,f.disp.y=p,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);d(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);d(c);window.addEventListener("touchmove",h);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",e))):"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),d(b),window.addEventListener("mousemove",h),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=Q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,d,f,r,m,b,k=function(b,c){var d=a.Space.call(this,b,c)||this;g=d.parent.evaluator;void 0!=d._w_&&(b=g.parser.parse(d._w_),d._w_="number"!=b.type?b:void 0);void 0!=d._h_&&(b=g.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=g.parser.parse(d.file.substring(1,d.file.length-1)):d.file.match(/^'/)&&d.file.match(/'$/)?
d.file=g.parser.parse(d.file):d.file=g.parser.parse("'"+d.file+"'");d.oldFile=g.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 d=a.cacheFiles[b];else d=(d=document.getElementById(b))&&"descartes/embed"===d.type?d.textContent:a.openExternalFile(b),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",a.cacheFiles[b]=d;c.contentWindow.postMessage({type:"change_config",filename:b,content:d},
"*")}return 0});d.evaluator.setFunction(d.id+".changeContent",function(a){a&&(a=(a=(new DOMParser).parseFromString(a.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?a.innerHTML:"",c.contentWindow.postMessage({type:"change_content",content:a},"*"))});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(k,a.Space);k.prototype.init=function(){m=this;m.initSpace();m.MyIFrame&&Object.assign(m.MyIFrame.style,{width:m.w+"px",height:m.h+"px"})};k.prototype.iframeUpdate=function(a){g=this.evaluator;this.drawIfValue=0<g.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=
this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);d=this.x!==g.eval(this.xExpr)+this.displaceRegionWest;f=this.y!==g.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=d?g.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=f?g.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=g.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=
a+"px",this.w=a));void 0!=this._h_&&(a=g.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(d||f)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";r=g.eval(this.file);r!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?
this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),this.MyIFrame.style.visibility="hidden",this.oldFile=r,this.MyIFrame.contentWindow.location.replace(r));b=g.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=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=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;")):(g=d.width<d.height?d.width/1144:d.height/1092,g=2.5<g?2.5:g,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*g+"px;"),this.progress.setAttribute("style","visibility:visible; left:"+(d.width-726*g)/2+"px; top:"+(33.5*d.height/100+940*g/2)+"px; width:"+726*g+"px; height:"+14*g+"px;"));d.loader.appendChild(this.imgLoader);d.loader.appendChild(this.progress);d.firstRun=!1;this.initPreloader()};
d.prototype.initPreloader=function(){var d=this,g=d.children,m=d.images,b=d.audios,k=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,l=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;m["lib/DescartesCCLicense.png"]=a.getCCLImg();m["lib/DescartesCCLicense.png"].ready=1;var c,h;var e=0;for(c=g.length;e<c;e++)if("rtf"!==g[e].name){if(g[e].value.match(/'macro'|'makro'/g)){var w="";var q=d.lessonParser.split(g[e].value);var u=0;for(h=q.length;u<h;u++)"expresion"===babel[q[u][0]]&&(w=q[u][1]);if(w)var z=(z=document.getElementById(w))&&
"descartes/macro"==z.type?z.text:a.openExternalFile(w);if(z&&(q=z.match(k)))for(w=0,h=q.length;w<h;w++)u=q[w],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(m[u]=new Image,m[u].addEventListener("load",function(){this.ready=1}),m[u].addEventListener("error",function(){this.errorload=1}),m[u].src=u)}if(q=g[e].value.match(k))for(w=0,h=q.length;w<h;w++)u=q[w],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(m[u]=new Image,m[u].addEventListener("load",function(){this.ready=
1}),m[u].addEventListener("error",function(){this.errorload=1}),m[u].src=u);if(q=g[e].value.match(l))for(w=0,u=q.length;w<u;w++)d.initAudio(q[w])}for(var n in m)m.hasOwnProperty(n)&&d.images.length++;for(n in b)b.hasOwnProperty(n)&&d.audios.length++;var p=d.images.length+d.audios.length;0<p&&d.progress.setAttribute("max",p);var x,v=function(){x=0;for(var c in m)m.hasOwnProperty(c)&&(m[c].ready||m[c].errorload)&&x++;for(c in b)b.hasOwnProperty(c)&&(b[c].ready||b[c].errorload)&&x++;d.progress.setAttribute("value",
x);x!=p?d.timer=a.setTimeout(v,1):d.descartesApp.initBuildApp()};v()};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 g(a){for(var b="[",d=0,e=a.length;d<e;d++)Array.isArray(a[d])?b+=g(a[d]):(f=a[d]||0,"string"==typeof f&&(f="'"+f+"'"),b+=f),d<e-1&&(b+=",");return b+"]"}function d(){r=window.innerWidth/this.width;m=window.innerHeight/this.height;a.cssScale=b=Math.min(r,m);this.container.style.transformOrigin="0 0";this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";r<m?(this.container.style.left="0",this.container.style.top=
"50%",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+b+") translate(0, -50%)"):(this.container.style.left="50%",this.container.style.top="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+b+") translate(-50%, 0)")}if(a.loadLib)return a;var f,r,m,b,k=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()};k.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",this.height);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|https://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var b=this.children,c,f=0,e=0,g=a.ccLicense?90:0,k=0,m=b.length;k<m;k++)c=b[k],"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.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()};k.prototype.initBuildApp=function(){a.showConfig=!0;for(var b=this.children,c,d=this.lessonParser,e=[],f=[],g=[],k=[],m=[],n=[],p=0,r=b.length;p<r;p++)if(c=b[p],"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 v=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+c.value.replace(/'/g,"&squot;")+"'");k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+v+","+(y-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&k.push("space='descartesJS_stage' type='image' expresion='["+
(v+15)+","+y+"]' 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),k.push(c.value)):/^S_/.test(c.name)?m.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));
p=0;for(r=e.length;p<r;p++)b=d.parseSpace(e[p]),this.arquimedes&&this.stage.container.appendChild(b.container),this.spaces.push(b),this.zIndex++;p=0;for(r=k.length;p<r;p++)if(a.DEBUG.elemIndex=p,e=d.parseGraphic(k[p]))this.editableRegionVisible=this.editableRegionVisible||e.visible,e.space.addGraph(e);p=0;for(r=m.length;p<r;p++)(e=d.parse3DGraphic(m[p]))&&e.space.addGraph(e,!0);p=0;for(r=f.length;p<r;p++)this.controls.push(d.parseControl(f[p]));p=0;for(r=g.length;p<r;p++)d.parseAuxiliar(g[p]);p=0;
for(r=n.length;p<r;p++)this.animation=d.parseAnimation(n[p]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();p=0;for(r=this.controls.length;p<r;p++)this.controls[p].init();this.updateControls();this.updateSpaces(!0);var A=this;this.nIframes?a.setTimeout(function(){A.finishInit()},200*this.nIframes):this.finishInit()};k.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==
window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var 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,k,m,r,v,y){c.keyboard.show(null,a,b,d,f,{x:g,y:l,w:k,h:m,fs:r+"px",value:v+"",type:"custom",tagName:"textfield"},y)});this.readyApp=!0};k.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var 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()};k.prototype.configRegions=function(){var b=this.evaluator.parser,c=this.buttonsConfig||{},d=this.container,e="15",f=100,g=100,k=100,m=100;2==this.version&&(e="14",f=63,g=50,k=44,m=53);var n=0,p=0,r=0,v=0,y=0,A=this.northSpace.controls,D=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 G=0;c.about?(G=f,F-=G):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("("+(G+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<D.length||c.init||c.clear){0>=c.rowsSouth?(p=c.height,c.rowsSouth=1):p=c.height*c.rowsSouth;f=d.width;G=0;c.init?(G=k,f-=G):k=0;c.clear&&(f-=
m);F=this.southSpace.container;F.id="descartesJS_south";F.setAttribute("style","width:"+d.width+"px;height:"+p+"px;left:0;bottom:0;");d.insertBefore(F,this.loader);B=Math.ceil(D.length/c.rowsSouth);L=f/B;I=0;for(M=D.length;I<M;I++)D[I].expresion=b.parse("("+(G+I%B*L)+","+c.height*Math.floor(I/B)+","+L+","+c.height+")"),D[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, "+k+", "+p+")")})).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+k)+", 0, "+m+", "+p+")")})).update()}if(0<J.length)for(I=d.height-n-p,v=c.widthEast,F=this.eastSpace.container,F.id="descartesJS_east",F.setAttribute("style","width:"+v+"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+","+v+","+c.height+")"),J[I].init();if(0<E.length)for(I=
d.height-n-p,y=c.widthWest,F=this.westSpace.container,F.id="descartesJS_west",F.setAttribute("style","width: "+y+"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+","+y+","+c.height+")"),E[I].init();if(this.editableRegionVisible)for(r=c.height,F=this.editableRegion.container,F.id="descartesJS_editableRegion",F.setAttribute("style","position:absolute;width:"+d.width+"px;height:"+r+"px;left:0;top:"+(d.height-p-c.height)+
"px;"),d.insertBefore(F,this.loader),b=this.editableRegion.textFields,d=d.width/b.length,c=a.getFieldFontSize(r),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:"+r+"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:"+
r+"px;text-align:center;line-height:"+r+"px;"),J=E.offsetWidth,E.style.width=J+"px",E.firstChild.textContent=E.firstChild.textContent.substring(3,E.firstChild.textContent.length-3),b[I].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+(d-J)+"px;height:"+r+"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:"+r+
"px;position:absolute;left:"+I*d+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=n;this.displaceRegionSouth=p+(r||0);this.displaceRegionEast=v;this.displaceRegionWest=y;I=0;for(M=this.spaces.length;I<M;I++)this.spaces[I].init()};k.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};k.prototype.clearClick=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};k.prototype.removeButtonClick=
function(){a.newBlobContent=null;for(var b=0,c=this.controls.length;b<c;b++)this.controls[b].buttonClick=!1};k.prototype.deactivateGraphicControls=function(){for(var a,b=0,d=this.controls.length;b<d;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};k.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};k.prototype.updateEvents=function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};k.prototype.updateControls=
function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};k.prototype.updateSpaces=function(a){for(var b=0,d=this.spaces.length;b<d;b++)this.spaces[b].update(a)};k.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};k.prototype.play=function(){this.animation.play()};k.prototype.stop=function(){this.animation.stop()};k.prototype.reinitAnimation=function(){this.animation.reinit()};
k.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&this.audios[a].pause&&(this.audios[a].pause(),this.audios[a].currentTime=0)};k.prototype.getImage=function(a){var b=this.images;return a?(b[a]||(b[a]=new Image,b[a].addEventListener("load",function(){this.ready=1}),b[a].addEventListener("error",function(){this.ready=0;this.errorload=1}),b[a].src=a),b[a]):new Image};k.prototype.getAudio=function(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};k.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};k.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c,d=0,f=this.controls.length;d<f;d++)if(c=this.controls[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};k.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var c,d=0,f=this.spaces.length;d<f;d++)if(c=this.spaces[d],c[b]==a)return c;return{update:function(){},
w:0,h:0}};k.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b){a=decodeURIComponent(a.substring(b+1)).split("&");for(var 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]))}};k.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 f in e)e.hasOwnProperty(f)&&(a+="\n"+f+"="+g(e[f]));f=this.evaluator.matrices;for(var k in f)f.hasOwnProperty(k)&&(a+="\n"+k+"="+g(f[k]));return a};k.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()};k.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};k.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()};k.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<b;a++)this.evaluator.eval(this.saveState[a]);this.update()};k.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=
a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);a.backCanvas&&(a.backCanvas=a.backCtx=null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&delete this.images[a]};a.DescartesApp=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(g,d){g="Error: "+g+" en\u300a "+d+" \u300b";var f="";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])f=" en la l\u00ednea "+(a.DEBUG.lineCount+1);g+=d+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+f+".";break;case "Graphic":g+="En el gr\u00e1fico #"+(a.DEBUG.elemIndex+1)+" de tipo \u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(g)}};return a}(descartesJS||{});
descartesJS=function(a){function g(){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 f(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function r(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),f(),g(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";b.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();a.onResize=
function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var m=Object.create(null);a.onMessage=function(b){if(0<a.apps.length){var d=b.data;if(d)if("set"===d.type)"string"==typeof d.value||"number"==typeof d.value?a.apps[0].evaluator.setVariable(d.name,d.value):d.value&&void 0!=d.value.rows?a.apps[0].evaluator.matrices[d.name]=d.value:a.apps[0].evaluator.vectors[d.name]=d.value;else if("update"===d.type)a.apps[0].update();else if("exec"===d.type)(b=a.apps[0].evaluator.getFunction(d.name))&&b.apply(a.apps[0].evaluator,
d.value.toString().split(","));else if("isResizeNeeded"===d.type)b.source.postMessage({type:"doResize"},"*");else if("doResize"===d.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===d.type){m[d.filename]?b=m[d.filename]:(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),m[d.filename]=b);var 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()}else"change_content"===
d.type&&(new_applets=a.newHTML("div"),new_applets.innerHTML=d.content,new_applets=new_applets.getElementsByTagName("param"),a.apps[0].children=new_applets,a.apps[0].init())}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",r),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(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||{});
