/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2019-08-16
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var h=0;return function(){return h<a.length?{done:!1,value:a[h++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var h="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return h?h.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var h,e=[];!(h=a.next()).done;)e.push(h.value);return e};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var h=function(){};h.prototype=a;return new h};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},h={};try{return h.__proto__=a,h.a}catch(e){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,h){a.__proto__=h;if(a.__proto__!==h)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,h){a.prototype=$jscomp.objectCreate(h.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var e=$jscomp.setPrototypeOf;e(a,h)}else for(e in h)if("prototype"!=e)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(h,e);d&&Object.defineProperty(a,e,d)}else a[e]=h[e];a.superClass_=h.prototype};
$jscomp.checkStringArgs=function(a,h,e){if(null==a)throw new TypeError("The 'this' value for String.prototype."+e+" must not be null or undefined");if(h instanceof RegExp)throw new TypeError("First argument to String.prototype."+e+" must not be a regular expression");return a+""};$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,h,e){a!=Array.prototype&&a!=Object.prototype&&(a[h]=e.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,h,e,d){if(h){e=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var r=a[d];r in e||(e[r]={});e=e[r]}a=a[a.length-1];d=e[a];h=h(d);h!=d&&null!=h&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:h})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var e=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var d="";a;)if(a&1&&(d+=e),a>>>=1)e+=e;return d}},"es6","es3");$jscomp.owns=function(a,h){return Object.prototype.hasOwnProperty.call(a,h)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,h){for(var e=1;e<arguments.length;e++){var d=arguments[e];if(d)for(var r in d)$jscomp.owns(d,r)&&(a[r]=d[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,e,d){var h=this.length||0;0>e&&(e=Math.max(0,h+e));if(null==d||d>h)d=h;d=Number(d);0>d&&(d=Math.max(0,h+d));for(e=Number(e||0);e<d;e++)this[e]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,h,e){a instanceof String&&(a=String(a));for(var d=a.length,r=0;r<d;r++){var m=a[r];if(h.call(e,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,e){return $jscomp.findInternal(this,a,e).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var e=[],d=0;d<this.length;d++){var h=this[d];Array.isArray(h)&&0<a?(h=Array.prototype.flat.call(h,a-1),e.push.apply(e,h)):e.push(h)}return e}},"es9","es5");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="expand";a.fit=a.escalar="fit";a.code="code";a.doc="doc";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+
a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+
a.extraIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbola,DJS_extra,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbola,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbola,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";
a.convertFont=function(d){if(""==d)return"";h=d.split(",");e="";e+=a.getFontStyle(h[1])+" ";e+=h[2]+"px ";return e+=a.getFontName(h[0].split(" ")[0])};a.getFontName=function(e){e=e.toLowerCase();d=a.monospace_font;if("serif"===e||"times new roman"===e||"timesroman"===e||"times"===e)d=a.serif_font;else if("sansserif"===e||"arial"===e||"helvetica"===e)d=a.sansserif_font;return d};a.getFontStyle=function(a){return r[a.toLowerCase()]||""};a.getTextWidth=function(d,b){a.ctx.font=b;return Math.round(a.ctx.measureText(d).width)};
a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function h(){var a,c,b,d,f,n,g;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(l){l=l||0;l=0>l?0:parseInt(l);a=this.toString();-1!==a.indexOf("e")&&(d=a.split("e"),n="-"===d[0][0]?"-":"",f="-"===n?parseFloat(d[0].substring(1)).oToFixed(11):parseFloat(d[0]).oToFixed(11),g=parseInt(d[1]),c=f.indexOf("."),f=f.replace(".",""),0>c+g?(c=0>c?1:c,a=n+"0."+"0".repeat(Math.abs(c+g))+f):a=n+f+"0".repeat(g-f.length+1));c=a.indexOf(".");-1===c?0<l&&
(a+="."+"0".repeat(l)):(b=a.length-c-1,a=b>=l?11>=l?parseFloat(a).oToFixed(l):a.substring(0,c+l+1):a+"0".repeat(l-b));return a}}if(a.loadLib)return a;var e=2*Math.PI,d=360/e,r=e/360,m=Math.floor,b,k,f,g;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*d};a.degToRad=function(a){return a*r};a.drawLine=function(a,c,b,d,f,n,e){a.lineWidth=e||1;a.strokeStyle=n||"black";g=a.lineWidth%2*.5;a.beginPath();a.moveTo(m(c)+g,m(b)+g);a.lineTo(m(d)+g,m(f)+g);a.stroke()};a.getColor=function(a,c){if("string"===
typeof c)return c;b=a.eval(c);return"rgba("+m(255*b[0][0])+","+m(255*b[0][1])+","+m(255*b[0][2])+","+(1-b[0][3])+")"};a.getFeatures=function(){var c=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(c);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);c=a.newHTML("canvas");a.hasCanvas=c.getContext&&c.getContext("2d");a.hasCanvas&&(c.width=c.height=1,
a.ctx=a.hasCanvas,a._ratio=1.5);h()};var p,c;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(p=a.indexOf("."),-1!==p)){c=a.substring(p);if(0==parseFloat(c))return a.substring(0,p);for(var b=c.length-1;0<b;b--)if("0"!==c.charAt(b))return a.substring(0,p+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(){for(var a,c="background-image: linear-gradient(0deg, ",
b=0;100>b;b++)a=m(100-b-35),c+="rgba(0,0,0,"+a*a*192/1E4/255+") "+b+"%, ";return c+"rgba(0,0,0,0.1) 100%);"};a.getCursorPosition=function(c,b){k=c.touches?c.touches[0]:c;f=b.getBoundingClientRect();return k?{x:(k.pageX-window.pageXOffset-f.left)/a.cssScale,y:(k.pageY-window.pageYOffset-f.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var c=!1,b,d=[],f=0,n=0,g=a.length;n<g;n++)b=a.charAt(n),"'"===b&&(c=!c),c||";"!==b&&"\n"!==b||(d.push(a.substring(f,n).replace(/\n/g,
"\\n")),f=n+1);d.push(a.substring(f).replace(/\n/g,"\\n"));return d};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(c){var b=a.newHTML("textarea");b.innerHTML=c;return b.value};a.newHTML=function(a,c){a=document.createElement(a);for(var b in c)a.setAttribute(b,c[b]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=
window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,c){function b(){Date.now()-l>=c&&(a.call(),l=Date.now());d.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setInterval(a,c);var l=Date.now(),d={};d.value=requestAnimationFrame(b);return d};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,c){function b(){Date.now()-l>=c?a.call():d.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setTimeout(a,
c);var l=Date.now(),d={};d.value=requestAnimationFrame(b);return d};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var c="<html>\n<head>\n<style>\nbody{text-align:center;}\niframe{width:650px;height:73px;overflow:hidden;border:1px solid black;}\ndt{font-weight:bold;margin-top:10px;}\n</style>\n</head>\n<body>\n<iframe src='http://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='http://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='http://descartesjs.org' target='_blank'>DescartesJS.org</a></h2>\n<dl>\n<dt>Dise\u00f1o funcional:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Jos\u00e9 R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver\u00e1 Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz\u00e1lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est\u00e1 bajo la licencia\n<a href='https://joinup.ec.europa.eu/software/page/eupl/licence-eupl'>EUPL v.1.1</a>\n<br>\nEl software en JavaScript est\u00e1 bajo licencia\n<a href='http://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci\u00f3n y el c\u00f3digo fuente se encuentran en :\n<br>\n<a href='http://descartes.matem.unam.mx/'>http://descartes.matem.unam.mx/</a>\n</p>";
a.ccLicense&&(c+="<p>\nEste objeto, creado con Descartes, est\u00e1 licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>");c+="</body> </html>";var b=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
b.document.write(c);b.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(h){if(a.cacheFiles[h])return a.cacheFiles[h];var e=null,d=new XMLHttpRequest;d.open("GET",h,!1);try{d.send(null),e=200===d.status||304===d.status?d.responseText:d.responseText||"",e=404===d.status?"":e,e.match(String.fromCharCode(65533))&&(d.open("GET",h,!1),d.overrideMimeType("text/plain;charset=ISO-8859-1"),d.send(null),e=d.responseText)}catch(r){e=null}return e};a.addExternalFileContent=function(h,
e){a.cacheFiles[h]=e};return a}(descartesJS||{});
descartesJS=function(a){function h(a){x=a.indexOf("--radial--");-1!=x&&(a=a.substring(0,x));m=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};m[0]==m[m.length-1]&&"'"==m[0]&&(a.ignoreCaps=!0,m=m.substring(1,m.length-1),"`"==m[0]&&"\u00b4"==m[m.length-1]&&(a.ignoreAccents=!0,m=m.substring(1,m.length-1)));"`"==m[0]&&"\u00b4"==m[m.length-1]&&(a.ignoreAccents=!0,m=m.substring(1,m.length-1),m[0]==m[m.length-1]&&"'"==m[0]&&(a.ignoreCaps=!0,m=m.substring(1,m.length-1)));"*"===m.charAt(0)&&"*"!==
m.charAt(m.length-1)?m=m.substring(1)+"$":"*"!==m.charAt(0)&&"*"===m.charAt(m.length-1)?m="^"+m.substring(0,m.length-1):"*"!==m.charAt(0)&&"*"!==m.charAt(m.length-1)?m="^"+m+"$":"*"===m.charAt(0)&&"*"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1));a.regExp=m.replace(/\?/g,"[\\S\\s]{1}");return a}function e(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 d(a,b,d){b=parseFloat(b);g=a.expr[0];p=a.expr[1];c=d.eval(g.expr);q=d.eval(p.expr);l="("==g.type||"["==g.type;v=")"==p.type||"]"==p.type;return l&&b>c&&v&&b<=q?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,f,g,p,c,q,l,v,x;a.buildRegularExpressionsPatterns=function(a,c){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var l=0,n=a.length;l<n;l++){b=a[l].split("&");k=[];for(var d=0,f=b.length;d<f;d++)m=b[d],-1===m.indexOf(",")||"("!==
m.charAt(0)&&"["!==m.charAt(0)||")"!==m.charAt(m.length-1)&&"]"!==m.charAt(m.length-1)?k.push(h(m)):k.push(e(m,c));a[l]=k}return a};a.escorrecto=function(c,l,g,e){g=g||a.externalEvaluator;e=e||a.buildRegularExpressionsPatterns(c,g);l=r(l);c=0;for(var n=e.length;c<n;c++){b=e[c];f=!0;for(var k=0,h=b.length;k<h;k++)f=b[k].regExp?f&&!!l.match(new RegExp(r(b[k].regExp),"i")):f&&d(b[k],l,g);if(f)return 1}return 0};a.esCorrecto=function(c,l,g,e){g=g||a.externalEvaluator;e=e||a.buildRegularExpressionsPatterns(c,
g);c=0;for(var n=e.length;c<n;c++){b=e[c];f=!0;for(var k=0,h=b.length;k<h;k++)(m=b[k].regExp)?(b[k].ignoreAccents&&(l=r(l),m=r(m)),b[k].ignoreCaps&&(l=l.toLowerCase(),m=r(m).toLowerCase()),f=f&&!!l.match(m)):f=f=f&&d(b[k],l,g);if(f)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#'+(void 0===a?"24c":a)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a){return"data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="m19.5 5-7.5 12-7.5-12z" fill="#'+(void 0===a?"d00018":a)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+
btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' 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"><path d="M6.5 6.5h32v32h-32z" fill="#1e272e"/></svg>')};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e,d,r,m,b,k,f,g,p,c,q,l,v,x,u=function(c,b){this.r=this.g=this.b=0;this.a=1;this.evaluator=b;this.getColor=this.getColorStr;if(c){if(babel[c]&&("net"===babel[c]&&(c="rojo"),c=babel[c],this.r=a.toHex(c.substring(1,3)),this.g=a.toHex(c.substring(3,5)),this.b=a.toHex(c.substring(5,7)),this.colorStr=c),6===c.length&&(this.r=a.toHex(c.substring(0,2)),this.g=a.toHex(c.substring(2,4)),this.b=a.toHex(c.substring(4,6)),this.colorStr="#"+c),8===
c.length&&(this.r=a.toHex(c.substring(2,4)),this.g=a.toHex(c.substring(4,6)),this.b=a.toHex(c.substring(6,8)),this.a=1-a.toHex(c.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===c[0]){d=[];r=this.splitComa(c.substring(1,c.length-1));c=0;for(b=r.length;c<b;c++)k=r[c],m=parseInt(k,16),k!==m.toString(16)&&k!=="0"+m.toString(16)?("["===k.charAt(0)&&"]"===k.charAt(k.length-1)&&(k=k.substring(1,k.length-1)),d.push(this.evaluator.parser.parse(k))):d.push(this.evaluator.parser.parse((m/
255).toString()));this.rExpr=d[0];this.gExpr=d[1];this.bExpr=d[2];this.aExpr=d[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};u.prototype.splitComa=function(a){b=[];for(var l=p=g=f=0,n=a.length;l<n;l++)c=a.charAt(l),"("===c?f++:")"===c?f--:"["===c?g++:"]"===c?g--:","===c&&0===f&&0===g&&(b.push(a.substring(p,l)),p=l+1);b.push(a.substring(p));return b};u.prototype.getColorStr=function(){return this.colorStr};u.prototype.getColorExp=function(){e=
this.evaluator;this.r=h(255*e.eval(this.rExpr));this.g=h(255*e.eval(this.gExpr));this.b=h(255*e.eval(this.bExpr));this.a=1-e.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};u.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.toHex=function(a){return parseInt("0x"+a,16)};a.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");q=parseInt(a[0]).toString(16);l=parseInt(a[1]).toString(16);v=parseInt(a[2]).toString(16);x=(255-
parseInt(255*parseFloat(a[3]))).toString(16);1===q.length&&(q="0"+q);1===l.length&&(l="0"+l);1===v.length&&(v="0"+v);1===x.length&&(x="0"+x);return new u(x+q+l+v)};a.Color=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=document.head,e=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});h.appendChild(e);e=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||h.appendChild(e);e=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});h.appendChild(e);e=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});h.appendChild(e);
e=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});h.appendChild(e);(h=document.getElementById("StyleDescartesApps2"))&&h.remove();h=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(h,document.head.firstChild);h.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-apearance:none;apearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after,.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:white;border: 1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:white;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:white;}\n.DescartesCheckbox{position:absolute;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{background-color:lightgray;position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;background-color:#e0e4e8;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;}\n.DJS_Up{background-image:url('"+
a.getSvgArrowUp()+"')}\n.DJS_Up[active=false]{background-image:url('"+a.getSvgArrowUp("8888aa")+"')}\n.DJS_Down{background-image:url('"+a.getSvgArrowDown()+"')}\n.DJS_Down[active=false]{background-image:url('"+a.getSvgArrowDown("aa8888")+"')}\n.DJS_Gradient{position:absolute;"+a.createGradient()+"}\n"+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sin,e=Math.floor,d=Math.random,r=Math.round,m=Math.abs,b=String.fromCharCode,k,f,g,p,c,q,l,v,x,u,n=function(a){this.key=(void 0===a?0:a).toString()};n.prototype.getKey=function(a){k=[];for(var c=0;256>c;c++)k[c]=b(this.alfanum(e(m(7.5*(h(1*c-a)+h(1.4*c+a)+h(.6*c-a)+h(2.2*c+a))))));return k.join("")};n.prototype.encode=function(a){f=e(31*d());this.key=this.getKey(f);return b(this.alfanum(f))+this.encripta(a)};n.prototype.decode=function(a){f=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(f);return this.desencripta(a.substring(1))};n.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};n.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;q=Array(3*a.length);for(var c=0,b=a.length;c<b;c++)x=256*e(a[c]+128)+r(255*d())+65536*r(255*d()),u=e((x<<this.shift(c))/256),q[3*c]=this.alfanum(u%32),q[3*c+1]=this.alfanum(u/32%32),q[3*c+2]=this.alfanum(u/1024%32);return q};n.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};n.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;l=Array(a.length/3);for(var c=0,b=l.length;c<b;c++)u=this.numalfa(a[3*c])+32*this.numalfa(a[3*c+1])+1024*this.numalfa(a[3*c+2]),x=e(256*u>>this.shift(c)),v=e(x/256)%256-128,0>v&&(v+=256),l[c]=v;return l};n.prototype.alfanum=function(a){return(10>a?48:87)+e(a)};n.prototype.numalfa=function(a){return a-(58>a?48:87)};n.prototype.stringToBytes=
function(a){p=[];for(var c=0,b=a.length;c<b;c++)p.push(a.charCodeAt(c));return p};n.prototype.bytesToString=function(a){for(var c=0,l=a.length;c<l;c++)a[c]=b(a[c]);return a.join("")};n.prototype.shift=function(a){g=this.key.charCodeAt(a%this.key.length);p=this.numalfa(g);c=e(p/2%8);0==c&&(c=4);return c};n.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){this.parent=e;var h=e.evaluator,m=h.parser;e=new a.Auxiliary(e);var b=this;b.delay=d.delay?m.parse(d.delay):m.parse("60");b.loop=d.loop?d.loop:!1;b.auto=void 0==d.auto?!0:d.auto;b.controls=d.controls;b.init=e.splitInstructions(m,d.init);b.doExpr=e.splitInstructions(m,d.doExpr);d.whileExpr&&(b.whileExpr=m.parse(d.whileExpr));var k,f=b.doExpr.length;b.animExec=function(){for(k=0;k<f;k++)h.eval(b.doExpr[k]);b.parent.update();b.playing&&
(0<h.eval(b.whileExpr)||b.loop)?b.timer=a.setTimeout(b.animExec,h.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};h.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};h.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};h.prototype.reinit=function(){for(var a=0,d=this.init.length;a<
d;a++)this.parent.evaluator.eval(this.init[a])};a.Animation=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(a,d){this.parent=a;this.evaluator=this.parent.evaluator};h.prototype.execute=function(){};a.Action=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){e=a.Action.call(this,e,d)||this;e.parameter=(d||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return e};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){alert(this.parameter)};a.Message=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){e=a.Action.call(this,e,d)||this;var h=e.evaluator,m=h.parser;d=a.splitSeparator((d||"").replace(/&squot;/g,"'"));for(var b=[],k,f=0,g=d.length;f<g;f++)(k=m.parse(d[f],!0))&&b.push(k);g=b.length;e.execute=function(){for(f=0;f<g;f++)h.eval(b[f])};return e};$jscomp.inherits(h,a.Action);a.Calculate=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){var h=a.Action.call(this,e,d)||this;h.parser=e.evaluator.parser;h.evaluator=e.evaluator;h.parameter=d;h.target="_blank";return h};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var e=this.parameter;e.match(/^\[.*\]?/)&&(e=this.evaluator.eval(this.parser.parse(e.substring(1,e.length-1))));var d=e.indexOf("target");-1!=d&&(this.target=e.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),e=e.substring(0,
d-1));if("javascript"==e.substring(0,10)){e=new a.SimpleText(parent,e.substring(11).replace(/&squot;/g,"'"));try{eval(e.toString())}catch(r){}}else"http"!=e.substring(0,4)&&(d=window.__dirname||window.location.href,e=d.substring(0,d.lastIndexOf("/")+1)+e),window.open(e,this.target)};a.OpenURL=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){var h=a.Action.call(this,e,d)||this;h.parser=e.evaluator.parser;h.evaluator=e.evaluator;h.parameter=d.trim();h.target="_blank";return h};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var d=a.indexOf("target");-1!=d&&(this.target=a.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
d-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)&&(d=window.__dirname||window.location.href,a=d.substring(0,d.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+", top="+(window.screen.height-this.parent.height)/2+"location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=h;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){return a.Action.call(this,e,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'><script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'>\x3c/script>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,
"</ajs")+"</xmp>")};a.Config=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){return a.Action.call(this,e,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.init()};a.Init=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){return a.Action.call(this,e,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.clear()};a.Clear=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){return a.Action.call(this,e,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.play()};a.Animate=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){return a.Action.call(this,e,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,e=function(d,e){d=a.Action.call(this,d,e)||this;e=e||"";e.match(h)?d.filenameExpr=d.evaluator.parser.parse("'"+e.match(h)+"'"):(e.match(/^\[.*\]?/)&&(e=e.substring(1,e.length-1)),d.filenameExpr=d.evaluator.parser.parse(e));return d};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d=function(a,d){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,d)};d.prototype.firstRun=function(){};d.prototype.update=function(){};d.prototype.splitInstructions=function(d,m){e=[];m=m?a.splitSeparator(m):[""];for(var b=0,k=m.length;b<k;b++)a.DEBUG.lineCount=b,(h=d.parse(m[b],!0))&&e.push(h);return e};d.prototype.getPrivateVariables=function(a,d){e=[];d=d?d.split(/;|,/):
[""];for(var b=0,k=d.length;b<k;b++)(h=a.parse(d[b],!0))&&e.push(h);b=0;for(k=e.length;b<k;b++)e[b]="asign"===e[b].type?e[b].childs[0].value:"identifier"===e[b].type?e[b].value:"";return e};d.prototype.parseExpressions=function(d){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(d,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(d,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(d,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
d.parse(this.whileExpr)};a.Auxiliary=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){e=a.Auxiliary.call(this,e,d)||this;d=e.evaluator.parser;e.expresionString=e.expresion;e.expresion=d.parse(e.expresionString);e.expresion&&d.setVariable(e.id,e.expresion);e.editable&&(e.registerTextField(),e.parent.editableRegionVisible=!0);return e};$jscomp.inherits(h,a.Auxiliary);h.prototype.registerTextField=function(){var e=a.newHTML("div"),d=a.newHTML("label");d.appendChild(document.createTextNode("___"+this.id+"=___"));var h=a.newHTML("input");
h.value=this.expresionString;h.disabled=!this.editable;e.appendChild(d);e.appendChild(h);var m=this,b=m.evaluator.parser;h.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:e,type:"div"})};a.Variable=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){e=a.Auxiliary.call(this,e,d)||this;e.expresion=e.evaluator.parser.parse(e.expresion);e.update();return e};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m=function(b,d){d=a.Auxiliary.call(this,b,d)||this;h=b.evaluator;e=h.parser;d.size=d.size||e.parse("3");d.expresion=d.expresion.split(";");d.parseFile=e.parse(d.file);d.update();return d};$jscomp.inherits(m,a.Auxiliary);m.prototype.update=function(){var b=this.expresion;h=this.evaluator;e=h.parser;this.oldFile=this.file;if(d=h.eval(this.parseFile))this.file=d;if(this.file){r=(vectorElement=document.getElementById(this.file))&&"descartes/vectorFile"==
vectorElement.type?vectorElement.text:a.openExternalFile(this.file);if(null!=r){r=r.replace(/\r/g,"").split("\n");for(var k=[],f=0,g=r.length;f<g;f++)""!=r[f]&&k.push(r[f]);r=k}null==r||1==r.length&&""==r[0]?(r=[],this.size=e.parse("0")):(b=r,this.size=null);null===this.size&&(this.size=e.parse(b.length+""))}var p;k=[];f=0;for(g=b.length;f<g;f++)(p=e.parse(b[f],!0))&&"asign"!=p.type&&(p=e.parse(this.id+"["+f+"]="+b[f],!0)),k.push(p);b=Array(h.eval(this.size)).fill(0);b._size_=b.length;h.vectors[this.id]=
b;h.setVariable(this.id+".long",b._size_);f=0;for(g=k.length;f<g;f++)h.eval(k[f])};a.Vector=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b=function(b,f){f=a.Auxiliary.call(this,b,f)||this;h=b.evaluator;e=h.parser;f.rows=f.rows||e.parse("3");f.columns=f.columns||e.parse("3");f.expresion=f.splitInstructions(e,f.expresion);d=h.eval(f.rows);r=h.eval(f.columns);m=[];m.type="matrix";b=0;for(var g=r;b<g;b++)m[b]=Array(d).fill(0);h.matrices[f.id]=m;f.update();return f};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){h=this.evaluator;d=h.eval(this.rows);r=h.eval(this.columns);
h.setVariable(this.id+".filas",d);h.setVariable(this.id+".columnas",r);m=h.matrices[this.id];m.rows=d;m.cols=r;for(var a=0,b=this.expresion.length;a<b;a++)h.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){var h=a.Auxiliary.call(this,e,d)||this;var m=h.evaluator;e=m.parser;d=h.id.indexOf("(");h.name=h.id.substring(0,d);h.params=h.id.substring(d+1,h.id.indexOf(")"));h.domain=h.range?e.parse(h.range):e.parse("1");h.params=""===h.params?[]:h.params.split(",");h.numberOfParams=h.params.length;h.algorithm||(h.init="",h.doExpr="",h.whileExpr="");h.parseExpressions(e);h.expresion=e.parse(h.expresion);h.functionExec=function(){h.iterations=0;
if(h.numberOfParams<=arguments.length){for(var b=[],d=0,f=h.privateVars.length;d<f;d++)b.push(m.getVariable(h.privateVars[d])),m.setVariable(h.privateVars[d],0);var g=[];d=0;for(f=h.params.length;d<f;d++)g[d]=m.getVariable(h.params[d]),m.setVariable(h.params[d],arguments[d]);d=0;for(f=h.init.length;d<f;d++)m.eval(h.init[d]);do{d=0;for(f=h.doExpr.length;d<f;d++)m.eval(h.doExpr[d]);if(1E5<++h.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
h.name+" >>"),0}while(0<m.eval(h.whileExpr));var e=m.eval(h.expresion);a.rangeOK=m.eval(h.domain);d=0;for(f=h.params.length;d<f;d++)m.setVariable(h.params[d],g[d]);d=0;for(f=h.privateVars.length;d<f;d++)m.setVariable(h.privateVars[d],b[d]);return e}return 0};m.setFunction(h.name,h.functionExec);return h};$jscomp.inherits(h,a.Auxiliary);a.Function=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){var h=a.Auxiliary.call(this,e,d)||this;var m=h.evaluator;h.parseExpressions(m.parser);h.algorithmExec=function(){for(var a=h.iterations=0,d=h.init.length;a<d;a++)m.eval(h.init[a]);do{a=0;for(d=h.doExpr.length;a<d;a++)m.eval(h.doExpr[a]);if(1E5<++h.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+h.name+" >>"),0}while(0<m.eval(h.whileExpr))};return h};$jscomp.inherits(h,a.Auxiliary);
h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){e=a.Auxiliary.call(this,e,d)||this;d=e.evaluator;delete e.evaluate;e.condition=d.parser.parse(e.condition);e.lastEvaluation=!1;e.action=e.parent.lessonParser.parseAction(e);"onlyOnce"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==e.execution&&(e.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEvaluation?
(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return e};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.eventExec()};a.Event=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(e,d){var h=a.Auxiliary.call(this,e,d)||this;if(d=d.file){var m=document.getElementById(d);response=m&&"descartes/library"===m.type?m.text:a.openExternalFile(d)}if(response)for(response=a.convertHTMLEntities(response).replace(/\r/g,"").split("\n"),d=0,m=response.length;d<m;d++)""!==response[d].trim()&&e.lessonParser.parseAuxiliar(response[d]);return h};$jscomp.inherits(h,a.Auxiliary);a.Library=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=d.parse("1");this.abs_coord=c.type&&"text"===c.type?!0:!1;this.color=new a.Color("blue");2!==this.parent.version&&(this.color=new a.Color("20303a"),this.parent.arquimedes&&(this.color=new a.Color("black")));this.trace="";this.expresion=d.parse("(0,0)");this.family="";this.family_interval=d.parse("[0,1]");
this.family_steps=d.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=d.parse("2");Object.assign(this,c);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?
parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&
(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))};g.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(c){return c.id===a.spaceID})||this.parent.spaces[0]};g.prototype.getFamilyValues=function(){h=this.evaluator;e=h.eval(this.family_interval);this.familyInf=e[0][0];this.familySup=e[0][1];this.fSteps=Math.round(h.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};g.prototype.drawFamilyAux=function(a,
c,b){h=this.evaluator;this.getFamilyValues();d=h.getVariable(this.family);if(0<=this.fSteps)for(var l=0,f=this.fSteps;l<=f;l++)h.setVariable(this.family,this.familyInf+l*this.family_sep),0<h.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,b));h.setVariable("_Text_H_",0);h.setVariable(this.family,d)};g.prototype.draw=function(a,c){""!==this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,c))};g.prototype.drawTrace=
function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,c))};g.prototype.rotate=function(a,c,b){k=Math.cos(b);f=Math.sin(b);return{x:a*k-c*f,y:a*f+c*k}};g.prototype.dashStyle=function(){b=this.ctx;"dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([b.lineWidth,b.lineWidth])):"dash"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,3*b.lineWidth])):"dash_dot"===this.lineDash?(b.lineCap="butt",
b.setLineDash([4*b.lineWidth,2*b.lineWidth,b.lineWidth,2*b.lineWidth])):b.setLineDash([])};g.prototype.drawText=function(a,c,b,l,d,f,g,n,e,k,z){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=a.strokeStyle=d.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:b,y:l},c.update(a,b,l,e,k,g,z,d.getColor());else for("simpleText"===c.type&&(c=c.toString(e,k).split("\\n")),h=this.evaluator,a.fillStyle=d.getColor(),a.font=f,a.textAlign=g,a.textBaseline=n,m=1.2*this.fontSize||0,d=0,f=c.length;d<f;d++)r=
c[d],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(r,b,l+m*d)),a.fillText(r,b,l+m*d)};a.Graphic=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f=function(a,f){this.text=f=f.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";h="'";r=d=0;for(m=-1;d<f.length;)b=f.charAt(d),k=f.charAt(d-1),"["===b&&"\\"===k?(this.textElements.push(f.substring(r,d-1)+"["),this.textElementsMacros.push("'"+f.substring(r,d-1)+"['"),r=d+1):"]"===b&&"\\"===k?(this.textElements.push(f.substring(r,
d-1)+"]"),this.textElementsMacros.push("'"+f.substring(r,d-1)+"]'"),r=d+1):"["===b&&-1===m?(this.textElements.push(f.substring(r,d)),this.textElementsMacros.push("'"+f.substring(r,d)+"'"),r=d,m++):"["===b?m++:"]"===b&&0===m?(this.textElements.push(this.evaluator.parser.parse(f.substring(r,d+1))),this.textElementsMacros.push("["+f.substring(r,d+1)+"]"),r=d+1,m--):("]"==f.charAt(d)&&(m=0>m?m:m-1),h+=f.charAt(d)),d++;this.textElements.push(f.substring(r,d));this.textElementsMacros.push("'"+f.substring(r,
d)+"'")};f.prototype.toString=function(b,d){h="";for(var c=0,f=this.textElements.length;c<f;c++)"string"===typeof this.textElements[c]?h+=this.textElements[c]:(e=this.evaluator.eval(this.textElements[c])[0][0],""!==e&&("string"===typeof e?h+=e:Infinity==e?h+="Infinity":-Infinity==e?h+="-Infinity":isNaN(e)||"NaN"==e?h+="NaN":(e=parseFloat(e),e=d?e.toFixed(b):a.removeNeedlessDecimals(e.toFixed(b)),h+=e.toString().replace(".",this.parent.decimal_symbol))));return h};a.SimpleText=f;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H,A,I,C,M,N,O,F,D,K,L=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fillP=b.fillP||"";b.fillM=b.fillM||"";b.parseExpression();b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();q=new a.R2;l=new a.R2;v=new a.R2;n=new a.R2;x=new a.R2;b.cInd=0;return b};$jscomp.inherits(L,a.Graphic);L.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var c=this.expresion.childs[0],b=this.expresion.childs[1];"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"x"!=c.value||b.contains("x")?"identifier"!=b.type||"x"!=b.value||c.contains("x")||(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};L.prototype.update=function(){};L.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};L.prototype.drawFamilyAux=function(a,c,b){e=this.evaluator;this.getFamilyValues();tempParam=e.getVariable(this.family);if(0<=this.fSteps)for(var l=0,d=this.fSteps;l<=d;l++)e.setVariable(this.family,this.familyInf+l*this.family_sep),this.update(),
this.drawAux(a,c,b);e.setVariable(this.family,tempParam)};L.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};L.prototype.drawAux=function(P,R,Q){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;e=this.evaluator;d=e.parser;r=this.space;m=e.eval(this.width);P.strokeStyle=this.color.getColor();P.lineWidth=m;b=d.getVariable("x");k=d.getVariable("y");f=r.w+24;g=r.h+24;p=f/9;3>p&&(p=3);c=g/7;3>c&&(c=3);0==this.cInd?(h=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;q.set(0,0);l.set(0,0);v.set(0,0);D=.25;K=8;this.abs_coord||(D/=r.scale,K/=r.scale);P.beginPath();for(I=parseInt(c/2);I<g;I+=c)for(A=parseInt(p/2);A<f;A+=p){if(this.abs_coord){n.set(A,I);u=this.newt.findZero(n,D);if(null==u)continue;e.setVariable("x",u.x);e.setVariable("y",u.y);x.set(u.x,u.y)}else{n.set(r.getRelativeX(A),r.getRelativeY(I));u=this.newt.findZero(n,D);if(null==u)continue;e.setVariable("x",u.x);e.setVariable("y",u.y);x.set(r.getAbsoluteX(u.x),r.getAbsoluteY(u.y))}y=x.ix();w=x.iy();
if(-12<=y&&y<f+24&&-12<=w&&w<g+24){if(h[y+12+(w+12)*r.w]===this.cInd)continue;h[y+12+(w+12)*r.w]=this.cInd}a.rangeOK&&(P.moveTo(y,w),P.lineTo(y,w));q.x=u.x;q.y=u.y;l.x=u.x;l.y=u.y;z=this.newt.getUnitNormal();if(0!=z.x||0!=z.y)for(z.rotL90(),v.x=z.x,v.y=z.y,E=B=0,J=!1;2>E;)if(J&&(v.x=-z.x,v.y=-z.y,u.x=q.x,u.y=q.y,l.x=u.x,l.y=u.y,this.abs_coord?x.set(u.x,u.y):x.set(r.getAbsoluteX(u.x),r.getAbsoluteY(u.y)),y=x.ix(),w=x.iy(),J=!1,B=0),u.x+=K*v.x,u.y+=K*v.y,u=this.newt.findZero(u,D),null!=u){e.setVariable("x",
u.x);e.setVariable("y",u.y);v.x=u.x-l.x;v.y=u.y-l.y;v.normalize();if(0==v.x&&0==v.y)break;l.x=u.x;l.y=u.y;this.abs_coord?x.set(u.x,u.y):x.set(r.getAbsoluteX(u.x),r.getAbsoluteY(u.y));G=parseInt(x.ix());H=parseInt(x.iy());if(G!=y||H!=w)if(C=y,M=w,y=G,w=H,-12<=y&&y<f+24&&-12<=w&&w<g+24){B=0;N=h[y+12+(w+12)*r.w];h[y+12+(w+12)*r.w]=this.cInd;for(R=1;8>R;R++)O=C+Math.round((y-C)*R/8),F=M+Math.round((w-M)*R/8),0<=O&&O<f&&0<=F&&F<g&&(h[O+12+(F+12)*r.w]=this.cInd);a.rangeOK&&(P.moveTo(C,M),P.lineTo(y,w));
if(N===this.cInd)break}else J=!0,E++;else 4<++B&&(J=!0,E++)}}P.stroke()}};L.prototype.X=function(a,c,b){b||(c=this.space.w/2+this.space.Ox+this.space.scale*c);c<-a&&(c=-a);c>this.space.w+a&&(c=this.space.w+a);return c};L.prototype.Y=function(a,c,b){b||(c=this.space.h/2+this.space.Oy-this.space.scale*c);c<-a&&(c=-a);c>this.space.h+a&&(c=this.space.h+a);return c};L.prototype.XX=function(a,c,b){return Math.round(this.X(a,c,b))};L.prototype.YY=function(a,c,b){return Math.round(this.Y(a,c,b))};L.prototype.extrapolate=
function(c,b,l,d,n,f){for(var g=this.evaluator.getVariable(b),e=f/2,h=0,k,q,p,x,v,m;1E-15<Math.abs(e);){k=this.evaluator.getVariable(b);q=this.evaluator.getVariable(b)+e;this.evaluator.setVariable(b,q);p=!0;try{x=n,n=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(l,n),0<this.evaluator.eval(c)?(v=new a.R2(Math.min(x,n),Math.max(x,n)),m=0,m=0<f?this.Singularity(Math.abs(e),b,d,k,x,q,n,v):this.Singularity(Math.abs(e),b,d,q,n,k,x,v),0<m&&(p=!1)):p=!1}catch(Z){p=!1}p?h+=e:this.evaluator.setVariable(b,
k);e/=2}this.evaluator.setVariable(b,g);return new a.R2(h/Math.abs(f),n)};L.prototype.extrapolateOnSingularity=function(c,b,l,d,n,f){d=this.evaluator.getVariable(b);for(var g=f/2,e=0,h=n,k;1E-15<Math.abs(g);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)+g);k=!0;if(0<this.evaluator.eval(c))try{h=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(l,h),0>=this.evaluator.eval(c)&&(k=!1)}catch(X){k=!1}else k=!1;k?e+=g:this.evaluator.setVariable(b,this.evaluator.getVariable(b)-g);
g/=2}if(0==e)for(g=f/2,e=f,h=n;1E-15<Math.abs(g);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)-g);k=!0;if(0<this.evaluator.eval(c))try{h=this.evaluator.eval(this.funExpr)}catch(X){k=!1}else k=!1;k?e+=-g:this.evaluator.setVariable(b,this.evaluator.getVariable(b)+g);g/=2}this.evaluator.setVariable(b,d);return new a.R2(e/Math.abs(f),h)};L.prototype.Singularity=function(a,c,b,l,d,n,f,g){if(isNaN(f)||isNaN(d)||isNaN(g.y)||isNaN(g.x)||l>=n)return 2;var e=this.evaluator.getVariable(c),h=0;
try{if(1E-15>Math.abs(n-l)||1E-12>Math.abs(n-l)&&Math.abs(f-d)>Math.abs(a))return this.evaluator.setVariable(c,e),1;var k=(l+n)/2;this.evaluator.setVariable(c,k);var q=NaN;try{q=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(q))return 5;if(Math.abs(f-d)>a){this.evaluator.setVariable(c,l-1E-12);var p=this.evaluator.eval(this.funExpr);p=(d-p)/1E-12;this.evaluator.setVariable(c,n+1E-12);var x=(this.evaluator.eval(this.funExpr)-f)/1E-12;if((10>Math.abs(x)||10>Math.abs(p))&&(0<=x&&0<=p||
0>=x&&0>=p)&&4*Math.abs(x)<Math.abs((f-d)/(n-l)))return this.evaluator.setVariable(c,e),2}if(isNaN(g.x)||isNaN(g.y)||isNaN(q))return 2;if(!(g.x<=q&&q<=g.y)){this.evaluator.setVariable(c,k);g.x=Math.min(d,q);g.y=Math.max(d,q);var v=this.Singularity(a/2,c,b,l,d,k,q,g);this.evaluator.setVariable(c,n);g.x=Math.min(f,q);g.y=Math.max(f,q);var m=this.Singularity(a/2,c,b,k,q,n,f,g);h=Math.max(v,m)}}catch(Y){h=1}this.evaluator.setVariable(c,e);return h};L.prototype.drawAuxFun=function(c,l,d){b=this.evaluator.parser.getVariable("x");
k=this.evaluator.parser.getVariable("y");a.rangeOK=1;l="x";var n="y";this.of_y&&(l="y",n="x");var f=this.drawif,g=this.evaluator.eval(this.width),e=!1,h=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),q=this.of_y?h.ix():h.iy(),p=0,x=0,v=0,m=0,u=1/this.space.scale;h=u*(this.of_y?-this.space.h+h.y:-h.x);var y=0;this.abs_coord&&(h=0,u=1);for(var z,r,w,E,B,A,G,Q,M,I=this.of_y?this.space.h+2:this.space.w+2;v<=I;){z=!0;r=0;this.evaluator.setVariable(l,h);try{w=this.evaluator.eval(this.funExpr),
isNaN(w)||(this.evaluator.setVariable(n,w),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(e?(E=Math.min(y,w),B=Math.max(y,w),A=new a.R2(E,B),r=this.Singularity(u,l,0,h-u,y,h,w,A),0===r?(y<=w?(y=A.x,w=A.y):(w=A.x,y=A.y),G=parseInt(this.of_y?this.XX(g,y,this.abs_coord):this.YY(g,y,this.abs_coord)),p=this.abs_coord?Math.round(w):parseInt(this.of_y?this.XX(g,w,this.abs_coord):this.YY(g,w,this.abs_coord)),this.fillM&&p>q&&(c.lineWidth=1,c.strokeStyle=this.fillM.getColor(),c.beginPath(),this.of_y?(c.moveTo(q+
1,this.space.h-v+.5),c.lineTo(p,this.space.h-v+.5)):(c.moveTo(v+.5,q+1),c.lineTo(v+.5,p)),c.stroke()),this.fillP&&p<q&&(c.lineWidth=1,c.strokeStyle=this.fillP.getColor(),c.beginPath(),this.of_y?(c.moveTo(q-1,this.space.h-v+.5),c.lineTo(p,this.space.h-v+.5)):(c.moveTo(v+.5,q-1),c.lineTo(v+.5,p)),c.stroke()),c.lineWidth=g,c.strokeStyle=d.getColor(),c.beginPath(),this.of_y?(c.moveTo(G+.5,this.space.h-m),c.lineTo(p+.5,this.space.h-v)):(c.moveTo(m+.5,G),c.lineTo(v+.5,p)),c.stroke()):1===r?(this.evaluator.setVariable(l,
h-u),Q=this.extrapolate(f,l,n,0,y,u),p=this.of_y?this.XX(g,Q.y,this.abs_coord):this.YY(g,Q.y,this.abs_coord),c.lineWidth=g,c.strokeStyle=d.getColor(),c.beginPath(),this.of_y?(c.moveTo(x+.5,this.space.h-m),c.lineTo(p+.5,this.space.h-m+Math.round(Q.x))):(c.moveTo(m+.5,x),c.lineTo(m+Math.round(Q.x)+.5,p)),this.evaluator.setVariable(l,h),M=this.extrapolate(f,l,n,0,w,-u),x=this.of_y?this.XX(g,M.y,this.abs_coord):this.YY(g,M.y,this.abs_coord),p=this.of_y?this.XX(g,w,this.abs_coord):this.YY(g,w,this.abs_coord),
c.lineWidth=g,c.strokeStyle=d.getColor(),c.beginPath(),this.of_y?(c.moveTo(x+.5,this.space.h-v),c.lineTo(p+.5,this.space.h-v)):(c.moveTo(v+.5,x),c.lineTo(v+.5,p)),c.stroke()):2===r&&(p=this.of_y?this.XX(g,w,this.abs_coord):this.YY(g,w,this.abs_coord),c.lineWidth=g,c.strokeStyle=d.getColor(),c.beginPath(),this.of_y?(c.moveTo(x+.5,this.space.h-v),c.lineTo(p+.5,this.space.h-v)):(c.moveTo(v+.5,x),c.lineTo(v+.5,p)))):(M=this.extrapolateOnSingularity(f,l,n,0,w,-u),x=this.of_y?this.XX(g,M.y,this.abs_coord):
this.YY(g,M.y,this.abs_coord),p=this.of_y?this.XX(g,w,this.abs_coord):this.YY(g,w,this.abs_coord),c.lineWidth=g,c.strokeStyle=d.getColor(),c.beginPath(),this.of_y?(c.moveTo(x,this.space.h-(v+Math.round(M.x))+.5),c.lineTo(p,this.space.h-v+.5)):(c.moveTo(v+Math.round(M.x),x),c.lineTo(v,p)),c.stroke()),y=w):z=!1)}catch(aa){z=!1}e&&!z&&(this.evaluator.setVariable(l,h-u),this.evaluator.setVariable(n,y),Q=this.extrapolate(f,l,n,0,y,u),p=parseInt(this.of_y?this.XX(g,Q.y,this.abs_coord):this.YY(g,Q.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(c.lineWidth=g,c.strokeStyle=d.getColor(),c.beginPath(),this.of_y?(c.moveTo(x,this.space.h-(m+Math.round(Q.x))+.5),c.lineTo(p,this.space.h-(m+Math.round(Q.x))+.5)):(c.moveTo(m+Math.round(Q.x)+.5,x),c.lineTo(m+Math.round(Q.x)+.5,p)),c.stroke()),this.evaluator.setVariable(l,h));e=z;h+=u;x=p;m=v++}this.evaluator.parser.setVariable("x",b);this.evaluator.parser.setVariable("y",k)};L.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;
c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parseExpression(),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Equation=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e,d,r,m,b,k,f,g,p=function(c,b){b=a.Graphic.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(p,a.Graphic);
p.prototype.update=function(){e=this.evaluator;d=e.eval(this.parameter_interval);this.paraInf=d[0][0];this.paraSup=d[0][1];this.pSteps=e.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};p.prototype.drawAux=function(c,d,l){e=this.evaluator;r=this.space;m=h(e.eval(this.width));
c.lineWidth=0<m?m:1E-6;c.lineCap=c.lineJoin="round";c.strokeStyle=l.getColor();b=e.getVariable(this.parameter);c.beginPath();e.setVariable(this.parameter,this.paraInf);k=e.eval(this.expresion);this.exprX=h(this.abs_coord?k[0][0]:r.getAbsoluteX(k[0][0]));this.exprY=h(this.abs_coord?k[0][1]:r.getAbsoluteY(k[0][1]));this.rotateExp&&(f=a.degToRad(e.eval(this.rotateExp)),g=this.rotate(k[0][0],k[0][1],f),this.exprX=h(this.abs_coord?g.x:r.getAbsoluteX(g.x)),this.exprY=h(this.abs_coord?g.y:r.getAbsoluteY(g.y)));
c.moveTo(this.exprX+.5,this.exprY+.5);for(l=1;l<=this.pSteps;l++)e.setVariable(this.parameter,this.paraInf+l*this.paraSep),k=e.eval(this.expresion),this.rotateExp&&(g=this.rotate(k[0][0],k[0][1],f),k[0][0]=g.x,k[0][1]=g.y),this.exprX=h(this.abs_coord?k[0][0]:r.getAbsoluteX(k[0][0])),this.exprY=h(this.abs_coord?k[0][1]:r.getAbsoluteY(k[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=
d.getColor(),c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);e.setVariable(this.parameter,b)};p.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;c.oncontextmenu=function(){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Curve=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,e=Math.round,d,r,m,b,k,f,g,p,c,q,l=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(l,a.Graphic);l.prototype.update=function(){d=this.evaluator;m=d.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(d.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);g=d.eval(this.range);this.rangeInf=g[0][0];this.rangeMax=g[0][1]};l.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};l.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};l.prototype.drawAux=function(b,l){d=this.evaluator;r=this.space;c=p=Math.ceil(d.eval(this.size)-.4);b.fillStyle=l.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(q=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=q);l=d.getVariable("n");for(var g=this.rangeInf,n=this.rangeMax;g<=n;g++)d.setVariable("n",g),m=d.eval(this.expresion),this.exprX=m[0][0],this.exprY=m[0][1],k=e(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX)),f=e(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(k,f,p,0,h,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,d.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,k+c,f-c,this.color,this.font,"start","alphabetic",d.eval(this.decimals),this.fixed,!0));d.setVariable("n",l)};l.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};
a.Sequence=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,e=Math.round,d,r,m,b,k,f,g=function(b,c){c=a.Graphic.call(this,b,c)||this;c.size=c.size||b.evaluator.parser.parse("2");c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(g,a.Graphic);g.prototype.update=function(){d=this.evaluator;m=d.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(d.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};g.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};g.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};g.prototype.drawAux=function(a,c){r=this.space;a.fillStyle=c.getColor();k=e(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX));f=e(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY));a.beginPath();a.arc(k,f,e(this.evaluator.eval(this.size)),0,h,!0);a.fill();this.text.hasContent&&this.text.draw(a,c,k,f)};a.Point=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e=2*Math.PI,d,r,m,b,k,f,g,p,c,q,l,v,x,u=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(u,a.Graphic);u.prototype.update=function(){d=this.evaluator;m=d.eval(this.expresion);this.endPoints=[];for(var c=0,l=m.length;c<l;c++)this.endPoints[c]={x:m[c][0],y:m[c][1]};if(this.rotateExp)for(b=
a.degToRad(d.eval(this.rotateExp)),c=0,l=this.endPoints.length;c<l;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,b)};u.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};u.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};u.prototype.drawAux=function(a,b,m){d=this.evaluator;r=this.space;k=h(d.eval(this.width));a.lineWidth=0<k?k:1E-6;p=d.eval(this.size);0>p&&(p=0);a.fillStyle=b.getColor();a.strokeStyle=
m.getColor();a.lineCap="round";c=0==a.lineWidth%2?0:.5;this.abs_coord?(q=h(this.endPoints[0].x),l=h(this.endPoints[0].y),v=h(this.endPoints[1].x),x=h(this.endPoints[1].y)):(q=h(r.getAbsoluteX(this.endPoints[0].x)),l=h(r.getAbsoluteY(this.endPoints[0].y)),v=h(r.getAbsoluteX(this.endPoints[1].x)),x=h(r.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(q+c,l+c);a.lineTo(v+c,x+c);this.dashStyle();a.stroke();0<p&&(a.beginPath(),a.arc(q,l,p,0,e,!0),a.arc(v,x,p,0,e,!0),a.fill());a.setLineDash([]);
this.text.hasContent&&(f=parseInt((q+v)/2)-3,g=parseInt((l+x)/2)+3,this.text.draw(a,m,f,g))};a.Segment=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.round,d,r,m,b,k,f,g,p,c,q,l,v,x,u,n,y=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("5");b.size=b.size||c.evaluator.parser.parse("2");b.spear=b.spear||c.evaluator.parser.parse("8");b.arrow=b.arrow||new a.Color("ee0022");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(y,a.Graphic);y.prototype.update=function(){d=this.evaluator;r=d.eval(this.expresion);this.endPoints=[];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)};y.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};y.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};y.prototype.drawAux=function(m,y,r){d=this.evaluator;b=this.space;g=d.eval(this.width);
0>g&&(g=0);p=Math.ceil(g/2);c=b.scale;this.vect=new a.Vector2D(this.endPoints[1].x-this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);q=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);m.fillStyle=y.getColor();m.strokeStyle=r.getColor();m.lineWidth=2;this.abs_coord?(l=e(this.endPoints[0].x),v=e(this.endPoints[0].y),x=e(this.endPoints[1].x),u=e(this.endPoints[1].y)):(l=e(b.getAbsoluteX(this.endPoints[0].x)),v=e(b.getAbsoluteY(this.endPoints[0].y)),x=e(b.getAbsoluteX(this.endPoints[1].x)),
u=e(b.getAbsoluteY(this.endPoints[1].y)));n=d.eval(this.spear);0>n&&(n=0);m.save();m.translate(l,v,q);this.abs_coord?m.rotate(this.angle*(0<=this.vect.y?1:-1)):(q*=c,m.rotate(this.angle*(0<=this.vect.y?-1:1)));m.beginPath();m.moveTo(-p,h(-p));m.lineTo(h(q-n-g),h(-p));m.lineTo(h(q-2*n),h(-n-p));m.lineTo(h(q),0);m.lineTo(h(q-2*n),h(n+p));m.lineTo(h(q-n-g),h(p));m.lineTo(-p,h(p));m.closePath();m.stroke();m.fill();m.restore();this.text.hasContent&&(k=parseInt((l+x)/2)-3,f=parseInt((v+u)/2)+3,this.text.draw(m,
r,k,f))};a.Arrow=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e,d,r,m,b,k,f,g,p=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.endPoints=[];return b};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){e=this.evaluator;r=e.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(e.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=
this.rotate(this.endPoints[c].x,this.endPoints[c].y,m)};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};p.prototype.drawAux=function(a,q,l){e=this.evaluator;d=this.space;b=h(e.eval(this.width));a.lineWidth=0<b?b:1E-6;a.strokeStyle=l.getColor();a.lineCap=a.lineJoin="round";k=0<b?.5:0;f=h(this.abs_coord?this.endPoints[0].x:d.getAbsoluteX(this.endPoints[0].x));g=h(this.abs_coord?
this.endPoints[0].y:d.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(f+k,g+k);l=1;for(var c=this.endPoints.length;l<c;l++)f=h(this.abs_coord?this.endPoints[l].x:d.getAbsoluteX(this.endPoints[l].x)),g=h(this.abs_coord?this.endPoints[l].y:d.getAbsoluteY(this.endPoints[l].y)),a.lineTo(f+k,g+k);this.fill&&(a.fillStyle=q.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e=Math.min,d=Math.max,r=Math.abs,m,b,k,f,g,p,c,q,l,v,x,u,n=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.border_radius=b.border_radius||c.evaluator.parser.parse("0");b.endPoints=[];return b};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){m=this.evaluator;p=m.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.w=150;this.h=100;this.rotateExp&&(k=
this.rotate(p[0][0],p[0][1],a.degToRad(m.eval(this.rotateExp))),this.exprX=k.x,this.exprY=k.y);4<=p[0].length&&(this.w=p[0][2],this.h=p[0][3]);p[1]&&2==p[1].length&&(this.w=p[1][0],this.h=p[1][1]);this.w=d(0,this.w);this.h=d(0,this.h)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};n.prototype.drawAux=function(a,n,k,p){m=this.evaluator;b=this.space;f=h(m.eval(this.width));
a.lineWidth=0<f?f:1E-6;a.strokeStyle=k.getColor();a.lineCap="round";a.lineJoin="miter";g=0<f?.5:0;c=h(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+g;q=h(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+g;l=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;x=e(d(0,m.eval(this.border_radius)),.5*r(l),.5*r(v));u=this.abs_coord?1:-1;a.beginPath();0!==x?(a.moveTo(c+x,q),a.lineTo(c+l-x,q),a.quadraticCurveTo(c+l,q,c+l,q+u*x),a.lineTo(c+l,q+v-u*x),a.quadraticCurveTo(c+
l,q+v,c+l-x,q+v),a.lineTo(c+x,q+v),a.quadraticCurveTo(c,q+v,c,q+v-u*x),a.lineTo(c,q+u*x),a.quadraticCurveTo(c,q,c+x,q),a.lineTo(c+x,q)):(a.moveTo(c,q),a.lineTo(c+l,q),a.lineTo(c+l,q+v),a.lineTo(c,q+v),a.lineTo(c,q));this.fill&&(a.fillStyle=n.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,e=Math.min,d=Math.max,r=Math.acos,m=Math.sqrt,b=Math.PI,k=b/2,f=2*b,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H,A,I,C,M,N=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.center=b.center||c.evaluator.parser.parse("(0,0)");b.radius=b.radius||c.evaluator.parser.parse("1");b.init=b.init||"0";b.end=b.end||"90";b.init.match(/^_\(/)&&(b.initFlag=!0,b.init=b.init.substring(1));b.end.match(/^_\(/)&&
(b.endFlag=!0,b.end=b.end.substring(1));b.initExpr=c.evaluator.parser.parse(b.init);b.endExpr=c.evaluator.parser.parse(b.end);b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(N,a.Graphic);N.prototype.update=function(){g=this.evaluator;p=g.eval(this.center);this.exprX=p[0][0];this.exprY=p[0][1];c=0;this.rotateExp&&(c=a.degToRad(g.eval(this.rotateExp)),q=Math.cos(c),l=Math.sin(c),v=this.exprX*q-this.exprY*l,x=this.exprX*l+this.exprY*q,this.exprX=v,this.exprY=x);var h=g.eval(this.initExpr),
A=g.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(u=h[0][0],n=h[0][1],y=A[0][0],w=A[0][1],this.vectors?this.abs_coord&&(n=-n,w=-w):this.abs_coord?(u-=this.exprX,n=-n+this.exprY,y-=this.exprX,w=-w+this.exprY):(u-=this.exprX,n-=this.exprY,y-=this.exprX,w-=this.exprY),z=0==u?0>n?3*k:k:r(1*u/m(u*u+n*n)),B=0==y?0>w?3*k:k:r(1*y/m(y*y+w*w)),z+=c,B+=c,0<u&&0<n&&this.abs_coord&&(z=f-z),0<u&&0>n&&!this.abs_coord&&(z=f-z),0>u&&0>n&&!this.abs_coord&&
(z=f-z),0>u&&0<n&&this.abs_coord&&(z=f-z),0<y&&0<w&&this.abs_coord&&(B=f-B),0<y&&0>w&&!this.abs_coord&&(B=f-B),0>y&&0>w&&!this.abs_coord&&(B=f-B),0>y&&0<w&&this.abs_coord&&(B=f-B),this.initFlag?(E=z,z=B,B=E):(E=e(z,B),J=d(z,B),z=E,B=J,B-z>b&&this.abs_coord&&(z=J,B=E),B-z<=b&&!this.abs_coord&&(z=J,B=E)),this.iniAng=z,this.endAng=B,this.drawPoints=!0):(this.iniAng=a.degToRad(h)+c,this.endAng=a.degToRad(A)+c,this.drawAngle=!0)};N.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,
this.color)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(a,c,b){g=this.evaluator;G=this.space;I=g.eval(this.radius);0>I&&(I=0);M=h(g.eval(this.width));a.lineWidth=0<M?M:1E-6;a.lineCap="round";a.strokeStyle=b.getColor();this.drawAngle?(this.abs_coord?(H=h(this.exprX),A=h(this.exprY)):(H=h(G.getAbsoluteX(this.exprX)),A=h(G.getAbsoluteY(this.exprY)),I*=G.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>
this.endAng&&(C=this.iniAng,this.iniAng=this.endAng,this.endAng=C)):this.drawPoints&&(this.abs_coord?(H=h(this.exprX),A=h(this.exprY)):(H=h(G.getAbsoluteX(this.exprX)),A=h(G.getAbsoluteY(this.exprY)),I*=G.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=c.getColor(),a.beginPath(),a.moveTo(H,A),a.arc(H,A,I,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(H,A,I,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,
this.color,H,A)};a.Arc=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("0");d.align||(d.align="left");d.anchor||(d.anchor="top_left");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){h=this.evaluator;e=h.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(d=this.rotate(e[0][0],e[0][1],a.degToRad(h.eval(this.rotateExp))),this.exprX=d.x,this.exprY=
d.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 h=Math.round,e,d,r,m,b,k,f,g,p,c,q,l,v=function(c,b){b=a.Graphic.call(this,c,b)||this;b.file=b.file||"";b.inirot=b.inirot||c.evaluator.parser.parse("0");b.img=new Image;b.scaleX=b.scaleY=1;b.ratio=c.ratio;b.update();return b};$jscomp.inherits(v,a.Graphic);v.prototype.update=function(){e=this.evaluator;d=e.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(r=this.rotate(d[0][0],d[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=
r.x,this.exprY=r.y);4<=d[0].length&&(this.centered=!0,this.scaleX=d[0][2],this.scaleY=d[0][3]);d[1]&&2==d[1].length&&(this.centered=!0,this.scaleX=d[1][0],this.scaleY=d[1][1]);0==this.scaleX&&(this.scaleX=1E-5);0==this.scaleY&&(this.scaleY=1E-5);var c=this;if((m=e.eval(this.file))||""==m)this.img=this.parent.getImage(m),this.img.addEventListener("load",function(a){c.space.update(!0)})};v.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};v.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};
v.prototype.drawAux=function(d){e=this.evaluator;b=this.space;this.img&&this.img.ready&&this.img.complete&&(q=this.img.width,l=this.img.height,this.img.canvas&&(q=h(q/this.ratio),l=h(l/this.ratio)),k=this.centered?0:h(q/2),f=this.centered?0:h(l/2),g=h(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX)),p=h(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY)),c=a.degToRad(-e.eval(this.inirot)),d.save(),d.translate(g+k,p+f),d.rotate(c),this.opacity&&(d.globalAlpha=e.eval(this.opacity)),d.scale(this.scaleX,
this.scaleY),d.drawImage(this.img,-q/2,-l/2,q,l),d.restore())};a.Image=v;return a}(descartesJS||{});
descartesJS=function(a){function h(a,b,d){f=4*(b+d*a.width);return{r:a.data[f],g:a.data[f+1],b:a.data[f+2],a:a.data[f+3]}}if(a.loadLib)return a;var e,d,r,m,b,k,f,g,p=function(c,b){return a.Graphic.call(this,c,b)||this};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){e=this.evaluator.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1]};p.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};p.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};p.prototype.drawAux=function(a,e){e.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(d=parseInt(this.exprX),r=parseInt(this.exprY)):(d=parseInt(this.space.getAbsoluteX(this.exprX)),r=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>d||0>r||d>=this.space.w||r>=this.space.h)){m=[[d,r]];k=h(imageData,d,r);for(g=0;0<m.length;){g++;b=m.pop();d=b[0];r=b[1];var c=h(imageData,d,r);if(k.r===c.r&&k.g===c.g&&k.b===c.b&&k.a===c.a){c=imageData;var q=
e;f=4*(d+r*c.width);c.data[f+0]=q.r;c.data[f+1]=q.g;c.data[f+2]=q.b;c.data[f+3]=255*q.a;0<d&&m.push([d-1,r]);d<imageData.width-1&&m.push([d+1,r]);m.push([d,r-1]);m.push([d,r+1])}if(g>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=p;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var e=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),d=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,r,m=function(b,k){var f=a.Graphic.call(this,b,k)||this;f.hasExpresion=f.hasExpresion||!1;f.inirot=f.inirot||b.evaluator.parser.parse("0");f.inipos=f.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(f,k);f.hasExpresion=void 0!==f.expresion;f.graphics=[];b=b.lessonParser;var g=new a.Tokenizer;if(!f.hasExpresion)return f;
"'"!==f.expresion.charAt(0)&&(f.expresion="'"+f.expresion+"'");f.expresion=f.evaluator.parser.parse(f.expresion);k=f.evaluator.eval(f.expresion);if(k)var p=(p=document.getElementById(k))&&"descartes/macro"==p.type?p.text:a.openExternalFile(k);if(p){var c=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");p=[];k=0;for(var q=c.length;k<q;k++)if(c[k].trim()){var l=c[k].indexOf("=");if(-1!==l){l=b.split(c[k]);for(var m=0,x=l.length;m<x;m++)if(l[m]&&1<l.length&&("id"===h[l[m][0]]||"type"===h[l[m][0]])){p.push(l);
break}}}m=function(c,b){b=g.tokenize(b.replace(/&squot;/g,"'"));for(var d=0,l=b.length;d<l;d++)"identifier"!=b[d].type||a.reservedIds.match("-"+b[d].value+"-")||(b[d].value=f.name+"."+b[d].value);return(c.match(/^\\expr/)?"\\expr ":"\\decimals ")+g.flatTokens(b)};k=0;for(q=p.length;k<q;k++){var u=(x=p[k]||[],x[0])&&"id"===x[0][0];c=0;for(l=x.length;c<l;c++){var n=x[c][0].indexOf(".");-1===n||u?n=h[x[c][0]]:(n=h[x[c][0].substring(n+1)],x[c][0]=f.name+"."+x[c][0]);if(!("font"===n||"font_family"===n||
("fill"===n||"color"===n||"border"===n||"arrow"===n)&&"("!==x[c][1].charAt(0)||"file"===n&&x[c][1].match(d)||"id"!==n&&void 0!==h[x[c][1]])||"radius"===n)if("text"==n)if(x[c][1].match(/\{\\rtf1/))n=x[c][1],n=n.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,m),n=n.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,m),x[c][1]=n;else{var r=b.parseText(x[c][1]).textElementsMacros;for(var w=0,z=r.length;w<z;w++){n=g.tokenize(r[w].replace(/&squot;/g,"'"));for(var B=
0,E=n.length;B<E;B++)"identifier"!==n[B].type||a.reservedIds.match("-"+n[B].value+"-")||(n[B].value=f.name+"."+n[B].value);n=g.flatTokens(n).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");r[w]=n.substring(1,n.length-1)}x[c][1]=r.join("")}else{r=x[c][1].replace(/&squot;/g,"'").split(";");w=0;for(z=r.length;w<z;w++){n=g.tokenize(r[w].replace(/\\n/g,";"));B=0;for(E=n.length;B<E;B++)"identifier"!==n[B].type||a.reservedIds.match("-"+n[B].value+"-")||(n[B].value=f.name+"."+n[B].value);
r[w]=g.flatTokens(n)}x[c][1]=r.join(";")}}}k=0;for(q=p.length;k<q;k++)if(p[k][0]){m="";x=!1;c=0;for(l=p[k].length;c<l;c++)"type"===h[p[k][c][0]]&&e.match("-"+h[p[k][c][1]]+"-")&&(x=!0),m=m+p[k][c][0]+"='"+p[k][c][1]+"' ";p[k]=m+(x?" space='"+f.spaceID+"'":"");x?f.graphics.push(b.parseGraphic(p[k],f.abs_coord,f.background,f.inirot)):b.parseAuxiliar(p[k])}}return f};$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,d=this.graphics.length;b<d;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=m;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sqrt,e=Math.sin,d=Math.cos,r=Math.abs,m,b,k,f,g,p,c,q,l,v,x,u,n,y,w,z=function(a,c,b,d){this.x=a||0;this.y=c||0;this.z=b||0;this.w=d||0;this.adjustDec()};z.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var B=function(a,c,b,d,l,n,f,g,e,h,k,q,p,m,v,x){this.a00=a||0;this.a01=c||0;this.a02=b||0;this.a03=d||0;this.a10=l||0;this.a11=n||0;this.a12=f||0;this.a13=g||0;
this.a20=e||0;this.a21=h||0;this.a22=k||0;this.a23=q||0;this.a30=p||0;this.a31=m||0;this.a32=v||0;this.a33=x||0};B.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};B.prototype.multiplyVector4=function(a){return new z(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};B.prototype.translate=function(a){return new B(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};B.prototype.rotateX=function(a){b=e(a);k=d(a);q=this.a10;l=this.a11;v=this.a12;
x=this.a13;u=this.a20;n=this.a21;y=this.a22;w=this.a23;return new B(this.a00,this.a01,this.a02,this.a03,q*k+u*b,l*k+n*b,v*k+y*b,x*k+w*b,q*-b+u*k,l*-b+n*k,v*-b+y*k,x*-b+w*k,this.a30,this.a31,this.a32,this.a33)};B.prototype.rotateY=function(a){b=e(a);k=d(a);f=this.a00;g=this.a01;p=this.a02;c=this.a03;u=this.a20;n=this.a21;y=this.a22;w=this.a23;return new B(f*k+u*-b,g*k+n*-b,p*k+y*-b,c*k+w*-b,this.a10,this.a11,this.a12,this.a13,f*b+u*k,g*b+n*k,p*b+y*k,c*b+w*k,this.a30,this.a31,this.a32,this.a33)};B.prototype.rotateZ=
function(a){b=e(a);k=d(a);f=this.a00;g=this.a01;p=this.a02;c=this.a03;q=this.a10;l=this.a11;v=this.a12;x=this.a13;return new B(f*k+q*b,g*k+l*b,p*k+v*b,c*k+x*b,f*-b+q*k,g*-b+l*k,p*-b+v*k,c*-b+x*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return h(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(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=z;a.Matrix4x4=B;return a}(descartesJS||{});
descartesJS=function(a){function h(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function e(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);l=1;for(v=this.projVert.length;l<v;l++)a.lineTo(this.projVert[l].x,this.projVert[l].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 d(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";c=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.fontSize=Math.max(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,c)}function 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,d){return a.normalize3D(a.crossProduct3D(a.subtract3D(c,
b),a.subtract3D(c,d)))}if(a.loadLib)return a;var b=2*Math.PI,k=lineJoin="round",f,g,p,c,q,l,v,x,u,n,y,w,z,B=function(a,c){Object.assign(this,a);this.space=c;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=h:"face"===this.type?(this.normal=m(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=e):"text"===this.type?this.draw=d:"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]})};B.prototype.computeDepth=function(c){this.space=c;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};l=0;for(v=this.vertices.length;l<v;l++)this.spaceVertices[l]=c.rotateVertex(this.vertices[l]),this.average.x+=this.spaceVertices[l].x,this.average.y+=this.spaceVertices[l].y,this.average.z+=this.spaceVertices[l].z;this.average=a.scalarProduct3D(this.average,
1/v);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=m(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));l=0;for(v=this.vertices.length;l<v;l++)this.newSpaceVert[l]=this.spaceVertices[l],this.projVert[l]=this.newProjVert[l]=c.project(this.spaceVertices[l]);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;l=0;for(v=this.vertices.length;l<v;l++)x=a.norm3D(a.subtract3D(this.spaceVertices[l],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,x),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,x);l=0;for(v=this.vertices.length;l<v;l++)this.minx>this.projVert[l].x&&(this.minx=this.projVert[l].x),this.maxx<this.projVert[l].x&&(this.maxx=this.projVert[l].x),this.miny>this.projVert[l].y&&(this.miny=this.projVert[l].y),
this.maxy<this.projVert[l].y&&(this.maxy=this.projVert[l].y)};B.prototype.removeDoubles=function(){if("edge"!==this.type){q=[];l=0;for(v=this.vertices.length;l<v;l++)(1E-8<Math.abs(this.vertices[l].x-this.vertices[(l+1)%v].x)||1E-8<Math.abs(this.vertices[l].y-this.vertices[(l+1)%v].y)||1E-8<Math.abs(this.vertices[l].z-this.vertices[(l+1)%v].z)||1E-8<Math.abs(this.vertices[l].w-this.vertices[(l+1)%v].w))&&q.push(this.vertices[l]);0===q.length&&q.push(this.vertices[0]);this.vertices=q}};B.prototype.drawText=
function(c,b,d,l,n,e,h,k,q,m,v){f=this.evaluator;c.textNode=b;e=f.eval(this.offset_dist);h=-a.degToRad(f.eval(this.offset_angle));d+=e*Math.cos(h);l+=e*Math.sin(h);c.textNode.pos={x:d,y:l};b.hasContent&&(b.draw(c,n,d,l,!0),p=this.fromPoint?b.textNodes.metrics.w/2:0,g=this.fromPoint?b.textNodes.metrics.h/2:0,b.draw(c,n,d-p,l-g))};B.prototype.splitFace=function(c){if(this.intersects(c)){var b=i2=null,d=ix2=0,l,n;var f=this.vertices;var g=c.vertices;var e=0;for(n=g.length;e<n;e++){var h=this.intersection(g[e],
g[(e+1)%n]);if(null!==h)if(null===b){if(b=h,d=e,2===g.length){i2=b;break}}else if(!a.equals3DEpsilon(h,b,1E-8)){i2=h;ix2=e;break}}if(null!==b&&null!==i2){e=this.isInterior(b)||this.isInterior(i2);var k=l=null;if(!e&&3<=g.length)for(n=0,f=f.length;n<f;n++)if(h=c.intersection(this.vertices[n],this.vertices[(n+1)%f]),null!==h)if(null===l)l=h;else if(!a.equals3DEpsilon(h,l,1E-8)){k=h;break}if(e||null!==l&&null!==k&&c.isInterior(l)&&c.isInterior(k)){k=!0;f=h=null;if(2===g.length)a.equals3DEpsilon(b,g[0],
1E-8)||a.equals3DEpsilon(b,g[1],1E-8)?k=!1:(h=[],h[0]=g[0],h[1]=b,f=[],f[0]=b,f[1]=g[1]);else for(h=[],f=[],e=n=l=0;e<g.length;e++)e<d?h[l++]=g[e]:e==d?(h[l++]=g[e],h[l++]=b,f[n++]=b):e<ix2?f[n++]=g[e]:e==ix2?(f[n++]=g[e],f[n++]=i2,h[l++]=i2):h[l++]=g[e];if(k){b=[];b[0]=new B({vertices:h,type:"face",frontColor:c.frontColor,backColor:c.backColor,edges:c.edges,model:c.model},this.space);b[0].removeDoubles();b[0].normal=c.normal;b[1]=new B({vertices: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]};B.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};B.prototype.intersectsPlane=function(c){var b=this.vertices;var d=c.vertices;if(0<b.length){var l=a.dotProduct3D(d[0],c.normal);var n=a.dotProduct3D(b[0],c.normal);if(1E-8>Math.abs(l-n))return!0;for(var f=1,g=
b.length;f<g;f++)if(d=a.dotProduct3D(b[f],c.normal),1E-8>Math.abs(l-d)||d>l&&n<l||d<l&&n>l)return!0}return!1};B.prototype.intersection=function(c,b){var d=this.vertices;if(0<d.length){b=a.subtract3D(b,c);var l=a.dotProduct3D(b,this.normal);if(0!==l&&(d=a.dotProduct3D(a.subtract3D(d[0],c),this.normal)/l,-1E-8<d&&1.00000001>d))return a.add3D(c,a.scalarProduct3D(b,d))}return null};B.prototype.isInterior=function(c){var b=this.vertices;if(0<b.length)for(var d=0,l=a.subtract3D(b[0],c),n=0,f=b.length;n<
f;n++){var g=a.subtract3D(b[(n+1)%f],c),e=a.dotProduct3D(a.crossProduct3D(l,g),this.normal);if(1E-8>Math.abs(e)){if(0>a.dotProduct3D(l,g))break}else{if(0>d&&0<e||0<d&&0>e)return!1;l=g;d=e}}return!0};B.prototype.inFrontOf=function(a,c,b){if(this.minDistanceToEye>=c.maxDistanceToEye||this.maxx<=c.minx||this.minx>=c.maxx||this.maxy<=c.miny||this.miny>=c.maxy)return!1;for(w=0;3>w;w++)if(u=null,u=0===w?this.intersections(c):1===w?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=u&&0<u.length){for(z=
0;z<u.length;z++)a.push(u[z]);l=0;for(v=u.length;l<v;l++){n=u[l];y=this.space.rayFromEye(n.x,n.y);try{t=this.distanceToEyeAlong(y)-c.distanceToEyeAlong(y);if(t<=-b)return!0;if(t>=b)return!1}catch(H){}}}return!1};B.prototype.intersections=function(c){for(var b=[],d,l,n,f=new a.R2,g=this.newSpaceVert,e=c.newSpaceVert,h=this.newProjVert,k=c.newProjVert,q=0,p=g.length;q<p;q++){c=g[q];d=g[(q+1)%p];for(var m=0,v=e.length;m<v;m++)l=e[m],n=e[(m+1)%v],c!=l&&c!=n&&d!=l&&d!=n&&(l=f.intersection(h[q],h[(q+1)%
p],k[m],k[(m+1)%v]),null!=l&&b.push(l))}return b};B.prototype.distanceToEyeAlong=function(c){c=a.dotProduct3D(this.normal,c);if(1E-6<Math.abs(c))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/c;throw new Exception("Face is invisible");};B.prototype.verticesContainedIn=function(a){for(var c=[],b=this.newSpaceVert,d=this.newProjVert,l=0,n=b.length;l<n;l++)!a.isVertex(b[l])&&a.appearsToContain(d[l])&&c.push(d[l]);return c};B.prototype.appearsToContain=function(a){for(var c=
0,b,d=this.newProjVert,l=0,n=this.newSpaceVert.length;l<n;l++){b=(d[l].x-a.x)*(d[(l+1)%n].y-a.y)-(d[(l+1)%n].x-a.x)*(d[l].y-a.y);if(0!=c)if(1E-8>Math.abs(b)){if(1E-8<Math.abs(d[l].x-d[(l+1)%n].x))return Math.min(d[l].x,d[(l+1)%n].x)<=a.x+1E-8&&a.x<=Math.max(d[l].x,d[(l+1)%n].x)+1E-8;if(1E-8<Math.abs(d[l].y-d[(l+1)%n].y))return Math.min(d[l].y,d[(l+1)%n].y)<=a.y+1E-8&&a.y<=Math.max(d[l].y,d[(l+1)%n].y)+1E-8}else if(0<c&&0>b||0>c&&0<b)return!1;c=b}return!0};B.prototype.isVertex=function(c){for(var b=
this.newSpaceVert,d=0,l=b.length;d<l;d++)if(a.equals3DEpsilon(c,b[d],1E-8))return!0;return!1};a.Primitive3D=B;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var c=[],b=0,d,f=a.length,g=a.length-1;-1<g;g--)d=a.charAt(g),0==b?"="==d&&(b=1):1==b?" "!=d&&(b="<"===d||">"===d?0:2):2==b&&" "==d&&(c.unshift(a.substring(g+1,f)),f=g,b=0);c.unshift(a.substring(0,f));return c}if(a.loadLib)return a;var e={x:0,y:0,z:0},d,r,m,b,k,f=a.degToRad,g,p=function(c,b){this.parent=c;this.evaluator=c.evaluator;var d=c.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=d.parse("1");this.abs_coord=!1;this.family="";this.family_interval=d.parse("[0,1]");this.family_steps=d.parse("8");this.font="Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=d.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=d.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=d.parse("(0,0,0)");this.model="color";Object.assign(this,b);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=d.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style=
"Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=c.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=d.parse(this.inirot);this.endrot=d.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};p.prototype.getSpace=function(){for(var a=this.parent.spaces,b,d=0,
f=a.length;d<f;d++)if(b=a[d],b.id==this.spaceID)return b;return a[0]};p.prototype.getFamilyValues=function(){d=this.evaluator;r=d.eval(this.family_interval);this.familyInf=r[0][0];this.familySup=r[0][1];this.fSteps=Math.round(d.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};p.prototype.buildFamilyPrimitives=function(){d=this.evaluator;this.getFamilyValues();m=d.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)d.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,d.eval(this.drawif)&&this.buildPrimitives();d.setVariable(this.family,m)};p.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};p.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(f(b[0][0])),this.inirotM=
this.inirotM.rotateX(f(b[0][1])),this.inirotM=this.inirotM.rotateZ(f(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(f(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(f(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(f(b[0][2])));b=this.evaluator.eval(this.inipos);e={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(e);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(f(b[0][0])),this.endrotM=this.endrotM.rotateX(f(b[0][1])),this.endrotM=this.endrotM.rotateZ(f(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(f(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(f(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(f(b[0][2])));b=this.evaluator.eval(this.endpos);e={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(e)};p.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};p.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)};p.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],d=0,f=a.length;d<f;d++)""!==a[d].trim()&&(b=b.concat(h(a[d])));d=0;for(f=b.length;d<f;d++)b[d]=this.evaluator.parser.parse(b[d],!0);return b};p.prototype.splitFace=function(a){for(var c=0,b=this.primitives.length;c<b;c++)if(g=[],"face"===this.primitives[c].type){for(var d=0,f=a.primitives.length;d<f;d++)"face"===a.primitives[d].type?g=g.concat(this.primitives[c].splitFace(a.primitives[d])):g.push(a.primitives[d]);a.primitives=g}};a.Graphic3D=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();e=h.eval(this.expresion);d=e[0][0];r=e[0][1];m=e[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(d,r,m,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:h.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||h.parser.parse("10"),this.offset_angle=this.offset_angle||h.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(d,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:h.eval(this.decimals),fixed:this.fixed,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();k=f.getVariable("u");f.setVariable("u",this.Nu);g=f.eval(this.expresion);h=g[0][0];e=g[0][1];d=g[0][2];r=g[1][0];m=g[1][1];b=g[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
e,d,1)),this.transformVertex(new a.Vector4D(r,m,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:f.eval(this.width)},this.space));f.setVariable("u",k)};a.Segment3D=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p,c,q,l,v,x=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.expresion=b.parseExpression();return b};$jscomp.inherits(x,a.Graphic3D);x.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();r=h.getVariable("x");m=h.getVariable("y");b=h.getVariable("z");
e=h.getVariable("u");d=h.getVariable("v");h.setVariable("u",0);h.setVariable("v",0);k=parseInt(h.eval(this.Nu));f=parseInt(h.eval(this.Nv));g=[];for(c=0;c<=k;c++)for(h.setVariable("u",c/k),q=0;q<=f;q++){h.setVariable("v",q/f);l=0;for(v=this.expresion.length;l<v;l++)h.eval(this.expresion[l]);g.push(this.transformVertex(new a.Vector4D(h.getVariable("x"),h.getVariable("y"),h.getVariable("z"),1)))}var x=this.color.getColor(),n=this.backcolor.getColor(),y=this.edges?this.edges.getColor():"";for(c=0;c<
k;c++)for(q=0;q<f;q++)p=[],p.push(g[q+c*f+c]),p.push(g[q+1+c*f+c]),p.push(g[q+2+(c+1)*f+c]),p.push(g[q+1+(c+1)*f+c]),this.primitives.push(new a.Primitive3D({vertices:p,type:"face",frontColor:x,backColor:n,edges:y,model:this.model},this.space));h.setVariable("x",r);h.setVariable("y",m);h.setVariable("z",b);h.setVariable("u",e);h.setVariable("v",d)};a.Surface3D=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(g,a.Graphic3D);g.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();f=k.eval(this.expresion);for(var g=this.color.getColor(),c=0,q=f.length-1;c<q;c++)h=f[c][0],e=f[c][1],d=f[c][2],r=f[c+1][0],m=f[c+1][1],b=f[c+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
e,d,1)),this.transformVertex(new a.Vector4D(r,m,b,1))],type:"edge",frontColor:g,lineWidth:k.eval(this.width)},this.space))};a.Polygon3D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.expresion=d.parseExpression();return d};$jscomp.inherits(f,a.Graphic3D);f.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();r=k.getVariable("x");m=k.getVariable("y");b=k.getVariable("z");d=k.getVariable("u");k.setVariable("u",0);e=k.eval(this.Nu);h=[];for(var f=0;f<=e;f++){k.setVariable("u",f/e);for(var p=0,c=
this.expresion.length;p<c;p++)k.eval(this.expresion[p]);h.push(this.transformVertex(new a.Vector4D(k.getVariable("x"),k.getVariable("y"),k.getVariable("z"),1)))}f=0;for(p=h.length-1;f<p;f++)this.primitives.push(new a.Primitive3D({vertices:[h[f],h[f+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));this.fill&&2<h.length&&this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));k.setVariable("x",r);k.setVariable("y",b);k.setVariable("z",m);k.setVariable("u",d)};a.Curve3D=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p,c,q=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){p=this.evaluator;this.updateMVMatrix();c=p.eval(this.expresion);h=c[0][0];e=c[0][1];d=c[0][2];r=c[1][0];m=c[1][1];b=c[1][2];k=c[2][0];f=c[2][1];g=c[2][2];var l=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,e,d,1)),this.transformVertex(new a.Vector4D(k,
f,g,1)),this.transformVertex(new a.Vector4D(r,m,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:l,model:this.model},this.space))};a.Triangle3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r=function(d,b){return a.Graphic3D.call(this,d,b)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();d=e.eval(this.expresion);h=[];for(var m=d.length-1;0<=m;m--)h.push(this.transformVertex(new a.Vector4D(d[m][0],d[m][1],d[m][2],1)));m=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:h,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 h,e,d,r,m,b,k=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("2");d.length=d.length||b.evaluator.parser.parse("2");return d};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();h=b.eval(this.Nu);e=[this.transformVertex(new a.Vector4D(0,0,0,1))];d=b.eval(this.width)/2;r=b.eval(this.length)/2;m=2*Math.PI/h;for(var f=0;f<h;f++)e.push(this.transformVertex(new a.Vector4D(d*
Math.cos(m*f),r*Math.sin(m*f),0,1)));var g=this.color.getColor(),k=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";for(f=0;f<h;f++)this.primitives.push(new a.Primitive3D({vertices:[e[0],f+2<=h?e[f+2]:e[1],e[f+1]],type:"face",frontColor:g,backColor:k,edges:c,model:this.model},this.space))};a.Polireg3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){h=this.evaluator;e=h.eval(this.expresion);d=e[0][0];r=e[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(d,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:h.eval(this.decimals),fixed:this.fixed,displace:0,
isText:!0,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=m;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var e=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),d=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,r,m,b=0,k=function(f,g){var k=a.Graphic.call(this,f,g)||this;k.expresion=k.expresion||void 0;k.inirot=k.inirot||"(0,0,0)";k.inirotEuler=k.inirotEuler||!1;k.inipos=k.inipos||f.evaluator.parser.parse("(0,0,0)");k.endrot=k.endrot||
"(0,0,0)";k.endrotEuler=k.endrotEuler||!1;k.endpos=k.endpos||f.evaluator.parser.parse("(0,0,0)");k.name=k.name||"_descartes_empty_name_"+b++;Object.assign(k,g);k.inirot.match("Euler")&&(k.inirot=k.inirot.replace("Euler",""),k.inirotEuler=!0);k.endrot.match("Euler")&&(k.endrot=k.endrot.replace("Euler",""),k.endrotEuler=!0);k.inirot=k.evaluator.parser.parse(k.inirot);k.endrot=k.evaluator.parser.parse(k.endrot);k.inirotM=new a.Matrix4x4;k.inirotM_X=new a.Matrix4x4;k.inirotM_Y=new a.Matrix4x4;k.inirotM_Z=
new a.Matrix4x4;k.iniposM=new a.Matrix4x4;k.endrotM=new a.Matrix4x4;k.endrotM_X=new a.Matrix4x4;k.endrotM_Y=new a.Matrix4x4;k.endrotM_Z=new a.Matrix4x4;k.endposM=new a.Matrix4x4;k.graphics=[];f=f.lessonParser;var c=new a.Tokenizer;if(void 0==k.expresion)return k;"'"!==k.expresion.charAt(0)&&(k.expresion="'"+k.expresion+"'");k.expresion=k.evaluator.parser.parse(k.expresion);g=k.evaluator.eval(k.expresion);if(g)var q=(q=document.getElementById(g))&&"descartes/macro"==q.type?q.text:a.openExternalFile(g);
if(q){var l=a.convertHTMLEntities(q).replace(/\r/g,"").split("\n");q=[];g=0;for(var m=l.length;g<m;g++){var x=l[g].indexOf("=");if(-1!==x){x=f.split(l[g]);for(var u=0,n=x.length;u<n;u++)if(x[u]&&1<x.length&&("id"===h[x[u][0]]||"type"===h[x[u][0]])){q.push(x);break}}}g=0;for(m=q.length;g<m;g++){n=(u=q[g]||[],u[0])&&"id"===u[0][0];var r=!1;l=0;for(x=u.length;l<x;l++){var w=u[l][0].indexOf(".");-1===w||n?w=h[u[l][0]]:(w=h[u[l][0].substring(w+1)],u[l][0]=k.name+"."+u[l][0]);"type"===w&&"surface"===h[u[l][1]]&&
(r=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==u[l][1].charAt(0)||"file"===w&&u[l][1].match(d)||"id"!==w&&void 0!==h[u[l][1]]||r&&"expresion"===w)||"width"===w||"height"===w||"length"===w)if("text"==w)if(u[l][1].match(/\{\\rtf1/)){w=u[l][1];var z=k;var B=function(b,d){d=c.tokenize(d.replace(/&squot;/g,"'"));for(var l=0,f=d.length;l<f;l++)"identifier"!=d[l].type||a.reservedIds.match("-"+d[l].value+"-")||(d[l].value=z.name+"."+d[l].value);return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+c.flatTokens(d)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,B);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,B);u[l][1]=w}else{B=f.parseText(u[l][1]).textElementsMacros;for(var E=0,J=B.length;E<J;E++){w=c.tokenize(B[E].replace(/&squot;/g,"'"));for(var G=0,H=w.length;G<H;G++)"identifier"!==w[G].type||a.reservedIds.match("-"+w[G].value+"-")||(w[G].value=k.name+"."+w[G].value);w=c.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,
"[").replace(/\)\+'/g,"]");B[E]=w.substring(1,w.length-1)}u[l][1]=B.join("")}else{B=u[l][1].replace(/&squot;/g,"'").split(";");E=0;for(J=B.length;E<J;E++){w=c.tokenize(B[E].replace(/\\n/g,";"));G=0;for(H=w.length;G<H;G++)"identifier"!==w[G].type||a.reservedIds.match("-"+w[G].value+"-")||(w[G].value=k.name+"."+w[G].value);B[E]=c.flatTokens(w)}u[l][1]=B.join(";")}}}g=0;for(m=q.length;g<m;g++)if(q[g][0]){u="";n=!1;l=0;for(x=q[g].length;l<x;l++)"type"===h[q[g][l][0]]&&e.match("-"+h[q[g][l][1]]+"-")&&
(n=!0),u=u+q[g][l][0]+"='"+q[g][l][1]+"' ";q[g]=u+(n?" space='"+k.spaceID+"'":"");n?k.graphics.push(f.parse3DGraphic(q[g],k.abs_coord,k.background,k.inirot)):f.parseAuxiliar(q[g])}}g=0;for(m=k.graphics.length;g<m;g++)k.graphics[g].macroChildren=!0;return k};$jscomp.inherits(k,a.Graphic);k.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var b=0,d=this.fSteps;b<=d;b++)evaluator.setVariable(this.family,
this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};k.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var b=
this.graphics.length;a<b;a++)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(b=this.graphics.length;a<b;a++){r=this.graphics[a];
if(r.split||this.split)for(var d=a+1;d<b;d++)m=this.graphics[d],(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 h(a,c,b,d,l){e.call(this,a/u,a/u,a/u,d,l)}function e(a,c,b,d,l){a/=2;c/=2;b/=2;this.changeGeometry(a,c,b,d,l)||(this.vertices=[new n(a,b,c,1),new n(a,-b,c,1),new n(a,b,-c,1),new n(a,-b,-c,1),new n(-a,b,c,1),new n(-a,-b,c,1),new n(-a,b,-c,1),new n(-a,-b,-c,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,c,b,d,l))}function d(a,c,b,d,l){a/=2;if(!this.changeGeometry(a,c,b,d,l)){var f=2*Math.PI/3,g=2*a*Math.sqrt(2)/3,e=-a/
3,h=g*Math.cos(f)+0*Math.sin(f);f=-g*Math.sin(f)+0*Math.cos(f);this.vertices=[new n(0,0,a,1),new n(h,f,e,1),new n(h,-f,e,1),new n(g,0,e,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,c,b,d,l)}}function r(a,c,b,d,l){a/=2;this.changeGeometry(a,c,b,d,l)||(this.vertices=[new n(0,0,a,1),new n(a,0,0,1),new n(-a,0,0,1),new n(0,a,0,1),new n(0,-a,0,1),new n(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,c,b,d,l))}function m(c,
b,d,l,f){c/=Math.PI;if(!this.changeGeometry(c,b,d,l,f)){I=c/1.6180339887;C=1.6180339887*c;this.vertices=[new n(c,c,c,1),new n(c,c,-c,1),new n(c,-c,c,1),new n(c,-c,-c,1),new n(-c,c,c,1),new n(-c,c,-c,1),new n(-c,-c,c,1),new n(-c,-c,-c,1),new n(0,I,C,1),new n(0,I,-C,1),new n(0,-I,C,1),new n(0,-I,-C,1),new n(I,C,0,1),new n(I,-C,0,1),new n(-I,C,0,1),new n(-I,-C,0,1),new n(C,0,I,1),new n(C,0,-I,1),new n(-C,0,I,1),new n(-C,0,-I,1)];M=(new a.Matrix4x4).setIdentity().rotateY(-v/6);F=0;for(D=this.vertices.length;F<
D;F++)this.vertices[F]=M.multiplyVector4(this.vertices[F]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(c,b,d,l,f)}}function b(c,b,d,l,f){c/=3.8;if(!this.changeGeometry(c,b,d,l,f)){C=1.6180339887*c;this.vertices=[new n(0,c,C,1),new n(0,c,-C,1),new n(0,-c,C,1),new n(0,-c,-C,1),new n(c,C,0,1),new n(c,-C,0,1),new n(-c,C,0,1),new n(-c,-C,0,1),
new n(C,0,c,1),new n(C,0,-c,1),new n(-C,0,c,1),new n(-C,0,-c,1)];this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];M=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);F=0;for(D=this.vertices.length;F<D;F++)this.vertices[F]=M.multiplyVector4(this.vertices[F]);this.updateValues(c,b,d,l,f)}}function k(a,c,b,d,f){a/=2;this.isSphere?b=c=a:(c/=2,b/=2);if(!this.changeGeometry(a,
c,b,d,f)){this.vertices=[new n(0,0,c,1)];for(F=1;F<d;F++)for(G=F*v/d,K=0;K<f;K++)J=K*x/f,z=a*q(G)*l(J),B=b*q(G)*q(J),E=c*l(G),this.vertices.push(new n(z,B,E,1));this.vertices.push(new n(0,0,-c,1));this.faces=[];for(F=0;F<f;F++)this.faces.push([0,(F+1)%f+1,F%f+1]);for(F=1;F<d-1;F++)for(K=0;K<f;K++)this.faces.push([K+1+(F-1)*f,(K+1)%f+1+(F-1)*f,(K+1)%f+1+F*f,K+1+F*f]);for(F=0;F<f;F++)this.faces.push([this.vertices.length-1,this.vertices.length-1-f+F,this.vertices.length-1-f+(F+1)%f]);this.updateValues(a,
c,b,d,f)}}function f(a,c,b,d,f){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,d,f)){this.vertices=[];for(F=0;F<f;F++)for(K=0;K<d;K++)z=a*(f-F)/f*l(K*x/d),B=b*(f-F)/f*q(K*x/d),E=c-2*F*c/f,this.vertices.push(new n(z,B,E,1));this.vertices.push(new n(0,0,-c,1));this.faces=[];for(F=0;F<f-1;F++)for(K=0;K<d;K++)this.faces.push([K+F*d,(K+1)%d+F*d,(K+1)%d+(F+1)*d,K+(F+1)*d]);for(F=0;F<d;F++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+F,this.vertices.length-1-d+(F+1)%d]);this.updateValues(a,
c,b,d,f)}}function g(a,c,b,d,f){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,d,f)){this.vertices=[];for(F=0;F<f+1;F++)for(K=0;K<d;K++)z=a*l(K*x/d),B=b*q(K*x/d),E=c-2*F*c/f,this.vertices.push(new n(z,B,E,1));this.faces=[];for(F=0;F<f;F++)for(K=0;K<d;K++)this.faces.push([K+F*d,(K+1)%d+F*d,(K+1)%d+(F+1)*d,K+(F+1)*d]);this.updateValues(a,c,b,d,f)}}function p(a,c,b,d,f){a/=2;c/=2;b/=2;H=y.eval(this.R);A=y.eval(this.r);if(!this.changeGeometry(a,c,b,d,f)){this.vertices=[];for(F=0;F<f+1;F++)for(K=0;K<d;K++)z=
-(H+A*q(x*K/d))*q(x*F/f),B=(H+A*q(x*K/d))*l(x*F/f),E=A*l(x*K/d),this.vertices.push(new n(z,B,E,1));this.faces=[];for(F=0;F<f;F++)for(K=0;K<d;K++)this.faces.push([K+F*d,K+(F+1)*d,(K+1)%d+(F+1)*d,(K+1)%d+F*d]);this.updateValues(a,c,b,d,f)}}function c(){this.vertices=[];this.faces=[];F=0;for(D=this.fileData.length;F<D;F++)N=this.fileData[F],N.match(/^V\(/)?(O=N.substring(2,N.length-1).split(",").map(parseFloats),this.vertices.push(new n(O[0]||0,O[1]||0,O[2]||0,1))):N.match(/^F\(/)&&(O=N.substring(2,
N.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var q=Math.sin,l=Math.cos,v=Math.PI,x=2*v,u=Math.sqrt(3),n,y,w,z,B,E,J,G,H,A,I,C,M,N,O,F,D,K,L,P=function(l,q){q=a.Graphic3D.call(this,l,q)||this;q.width=q.width||l.evaluator.parser.parse("2");q.height=q.height||l.evaluator.parser.parse("2");q.length=q.length||l.evaluator.parser.parse("2");q.R=q.R||l.evaluator.parser.parse("2");q.r=q.r||l.evaluator.parser.parse("1");n=a.Vector4D;switch(q.subType){case "cube":q.buildGeometry=
h;break;case "box":q.buildGeometry=e;break;case "tetrahedron":q.buildGeometry=d;break;case "octahedron":q.buildGeometry=r;break;case "sphere":q.isSphere=!0;case "ellipsoid":q.buildGeometry=k;break;case "dodecahedron":q.buildGeometry=m;break;case "icosahedron":q.buildGeometry=b;break;case "cone":q.buildGeometry=f;break;case "cylinder":q.buildGeometry=g;break;case "torus":q.buildGeometry=p;break;case "mesh":q.fileData=a.openExternalFile(q.evaluator.eval(q.file)).split(/\r/),q.buildGeometry=c}return q};
$jscomp.inherits(P,a.Graphic3D);P.prototype.buildPrimitives=function(){y=this.evaluator;this.updateMVMatrix();this.buildGeometry(y.eval(this.width),y.eval(this.height),y.eval(this.length),y.eval(this.Nu),y.eval(this.Nv));var c=this.color.getColor(),b=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";F=0;for(D=this.faces.length;F<D;F++){w=[];K=0;for(L=this.faces[F].length;K<L;K++)w.push(this.transformVertex(this.vertices[this.faces[F][K]]));this.primitives.push(new a.Primitive3D({vertices:w,
type:"face",frontColor:c,backColor:b,edges:d,model:this.model},this.space))}};P.prototype.changeGeometry=function(a,c,b,d,l){return this.oldWidth===a&&this.oldHeight===c&&this.oldLength===b&&this.oldNu===d&&this.oldNv===l};P.prototype.updateValues=function(a,c,b,d,l){this.oldWidth=a;this.oldHeight=c;this.oldLength=b;this.oldNv=l;this.oldNu=d};a.OtherGeometry3D=P;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,e=Math.min,d=Math.PI,r=Math.cos,m=Math.sin,b=Math.abs,k=Math.round,f,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H,A=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c};A.prototype.set=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c;return this};A.prototype.copy=function(){return new A(this.x,this.y)};A.prototype.ix=function(){return k(h(e(this.x,32E3),-32E3))};A.prototype.iy=function(){return k(h(e(this.y,32E3),-32E3))};A.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};A.prototype.norm2=function(){return this.x*this.x+this.y*this.y};A.prototype.norm=function(){return Math.sqrt(this.norm2())};A.prototype.distance=function(a){g=this.copy();g.sub(a);return g.norm()};A.prototype.dot=function(a){return this.x*a.x+this.y*a.y};A.prototype.det=function(a){return this.x*a.y-this.y*a.x};A.prototype.mul=function(a){this.x*=a;this.y*=a};A.prototype.div=function(a){this.x/=a;this.y/=a};A.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};A.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};A.prototype.normalize=function(){f=this.norm();0!=f&&this.div(f)};A.prototype.rotR90=function(){f=this.x;this.x=this.y;this.y=-f};A.prototype.rotL90=function(){f=this.x;this.x=-this.y;this.y=f};A.prototype.rot=function(a){p=this.copy();l=r(a);v=m(a);this.x=p.x*l-p.y*v;this.y=p.x*v+p.y*l};A.prototype.rot2=function(a){this.rot(a*d/180)};A.prototype.intersection=function(a,d,l,f){x=d.x-a.x;u=l.x-f.x;n=l.x-a.x;y=d.y-a.y;w=l.y-f.y;z=l.y-a.y;H=x*
w-u*y;return 1E-6<b(H)?(c=(n*w-z*u)/H,q=(-n*y+z*x)/H,0<=c&&1>=c&&0<=q&&1>=q?new A(a.x+x*c,a.y+y*c):null):(d.x-l.x)*z!=(d.y-l.y)*n?null:a.x!=d.x?(B=e(a.x,d.x),E=h(a.x,d.x),B<=l.x&&l.x<=E?l:B<=f.x&&f.x<=E?f:null):l.x!=f.x?(J=e(l.x,f.x),G=h(l.x,f.x),J<=a.x&&a.x<=G?a:J<=d.x&&d.x<=G?d:null):a.y!=d.y?(B=e(a.y,d.y),E=h(a.y,d.y),B<=l.y&&l.y<=E?l:B<=f.y&&f.y<=E?f:null):l.y!=f.y?(J=e(l.y,f.y),G=h(l.y,f.y),J<=a.y&&a.y<=G?a:J<=d.y&&d.y<=G?d:null):a.x==l.x&&a.y==l.y?a:null};a.R2=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p=function(c,d){this.evaluator=c;this.constraint=d;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];b=
new a.R2(0,0);m=new a.R2(0,0);g=new a.R2(0,0)};p.prototype.getUnitNormal=function(){this.normal.normalize();return g.set(this.normal.x,this.normal.y)};p.prototype.gradient=function(a){h=this.evaluator;b.x=0;b.y=0;k=h.getVariable("x");f=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);h.setVariable("x",h.getVariable("x")+1E-6);e=h.eval(this.constraint);b.x=(e-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;h.setVariable("x",h.getVariable("x")-1E-6);h.setVariable("y",
h.getVariable("y")+1E-6);e=h.eval(this.constraint);b.y=(e-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;h.setVariable("x",k);h.setVariable("y",f);return b};p.prototype.findZero=function(a,b,l){h=this.evaluator;m.x=a.x;m.y=a.y;k=h.getVariable("x");f=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return m;h.setVariable("x",k);h.setVariable("y",f);for(var c=0;16>c;c++)if(d=m.x,r=m.y,this.normal=
this.gradient(m),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),m.x=d+this.normal.x,m.y=r+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=m.x-a.x,this.normal.y=m.y-a.y),m;return l?m:null};a.R2Newton=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(a,d){this.x=a;this.y=d};h.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};h.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};h.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};h.AXIS_X=new h(1,0);h.AXIS_Y=new h(0,1);a.Vector2D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.round,d,r,m,b,k,f,g,p,c,q,l,v,x,u=function(c,b){this.parent=c;this.evaluator=c.evaluator;var d=this.parser=c.evaluator.parser;this.id="GraphicControl"!==b.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==b.type?100:350;this.h="Video"!==b.type?23:120;"GraphicControl"!==b.type&&"Audio"!==b.type&&"Video"!==b.type?"TextArea"!==b.type?this.expresion=d.parse("(0,0,100,23)"):(this.expresion=d.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=d.parse("(0,0)");this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color=new a.Color(4>this.parent.version?"000000":"222222");this.colorInt=new a.Color("GraphicControl"!==b.type?"f0f8ff":"cc0022");this.font_size=4>this.parent.version?-1:d.parse("12");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=
d.parse("1");this.activeif=d.parse("1");this.valueExpr=d.parse("0");this.decimals=d.parse("2");this.min=d.parse("-Infinity");this.max=d.parse("Infinity");this.incr=d.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;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=e(b[0][0]);this.y=e(b[0][1]);4==b[0].length&&(this.w=e(b[0][2]),this.h=e(b[0][3]));this.actionExec=c.lessonParser.parseAction(this)};u.prototype.init=function(){};u.prototype.update=function(){};u.prototype.draw=function(){};u.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var c=0,b=a.length;c<b;c++){var d=a[c];if(d.id===this.spaceID)return d.addCtr(this),this.zIndex=d.zIndex,this.space=d,d.numericalControlContainer}else{if("external"===this.region)return this.parent.externalSpace.addCtr(this),
this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numericalControlContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);
this.zIndex=a[0].zIndex;return a[0].numericalControlContainer};u.prototype.addControlContainer=function(a){var c=this.getContainer();c.childNodes[0]?c.insertBefore(a,c.childNodes[0]):c.appendChild(a)};u.prototype.updatePositionAndSize=function(){m=b=k=f=!1;g=this.evaluator.eval(this.expresion);p=e(g[0][0]);m=e(this.x)!==p;this.x=p;p=e(g[0][1]);b=e(this.y)!==p;this.y=p;4===g[0].length&&(p=e(g[0][2]),k=e(this.w)!==p,this.w=p,p=e(g[0][3]),f=e(this.h)!==p,this.h=p);if(k||f||m||b)this.init(!0),this.draw()};
u.prototype.formatOutputValue=function(a){x=this.parent;c=a+"";q=this.evaluator.eval(this.decimals);l=c.indexOf(".");-1!=l&&(v=c.substring(l+1),v.length>q&&(c=parseFloat(c).toFixed(q)));this.fixed&&(2!==x.version||2===x.version&&!this.exponentialif)&&(c=parseFloat(a).toFixed(q));this.exponentialif&&0!=parseFloat(c)&&(c=this.fixed&&2!==x.version?parseFloat(c).toExponential(q):parseFloat(c).toExponential(),c=c.toUpperCase().replace("+",""));return c.replace(".",x.decimal_symbol)};u.prototype.updateAndExecAction=
function(){this.parent.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()};u.prototype.createGradient=function(a,c){this.linearGradient=this.ctx.createLinearGradient(0,0,0,c);d=c*c;for(a=0;a<c;a++)r=h(a-35*c/100),this.linearGradient.addColorStop(a/c,"rgba(0,0,0,"+r*r*192/d/255+")")};a.Control=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.abs,d=/[\w\.\-//]*(\.gif)/gi,r,m,b,k,f,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H,A,I,C,M,N,O,F,D,K,L=function(c,b){var d=a.Control.call(this,c,b)||this;d.imageSrc=b.imageSrc||"";d.image=b.image||new Image;d.imageOver=b.imageOver||new Image;d.imageDown=b.imageDown||new Image;d.flat=b.flat||!1;d.borderColor=b.borderColor||!1;d.text_align=b.text_align||"center_center";d.image_align=b.image_align||"center_center";d.font_family=a.getFontName(b.font_family||
"arial");d.ratio=c.ratio;-1===d.font_size&&(d.fontSizeNotSet=!0);d.borderColor&&(d.borderColor=new a.Color(d.borderColor));d.text_align=d.text_align.split("_");d.image_align=d.image_align.split("_");d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name+"'");d.classContainer=d.cssClass?" "+d.cssClass+" ":"";if(d.imageSrc.trim().match("^_STYLE_")){d.customStyle=!0;d.btnStyle=[];d.conStyle=[];d.conStyle.textBorder=3;c=d.imageSrc.trim().substring(8).split("|");
for(var l,f=0,n=c.length;f<n;f++)b=c[f],l=b.match(/rgb/g),b.match("class=")?d.classContainer=" "+b.substring(6):b.match("border=")?(d.btnStyle.push({type:"border-style",value:"solid"}),d.btnStyle.push({type:"border-width",value:b.substring(7).trim()+"px"})):b.match("borderRadius=")?(d.btnStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"}),d.conStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"})):b.match("borderColor=")?d.btnStyle.push({type:"border-color",value:(l?
"":"#")+b.substring(12).trim()}):b.match("overColor=")?d.conStyle.overColor=(l?"":"#")+b.substring(10).trim():b.match("downColor=")?d.conStyle.downColor=(l?"":"#")+b.substring(10).trim():b.match("font=")?d.conStyle.font=b.substring(5).trim().toLowerCase():b.match("inactiveColor=")?d.conStyle.inactiveColor=(l?"":"#")+b.substring(14).trim():b.match("inactiveColorBorder=")?d.conStyle.inactiveColorBorder=(l?"":"#")+b.substring(20).trim():b.match("shadowTextBlur=")?d.conStyle.shadowTextBlur=parseFloat(b.substring(15).trim()):
b.match("shadowTextOffsetX=")?d.conStyle.shadowTextOffsetX=parseFloat(b.substring(18).trim()):b.match("shadowTextOffsetY=")?d.conStyle.shadowTextOffsetY=parseFloat(b.substring(18).trim()):b.match("shadowTextColor=")?d.conStyle.shadowTextColor=(l?"":"#")+b.substring(16).trim():b.match("shadowBoxBlur=")?d.conStyle.shadowBoxBlur=parseFloat(b.substring(14).trim()):b.match("shadowBoxOffsetX=")?d.conStyle.shadowBoxOffsetX=parseFloat(b.substring(17).trim()):b.match("shadowBoxOffsetY=")?d.conStyle.shadowBoxOffsetY=
parseFloat(b.substring(17).trim()):b.match("shadowBoxColor=")?d.conStyle.shadowBoxColor=(l?"":"#")+b.substring(15).trim():b.match("shadowInsetBoxBlur=")?d.conStyle.shadowInsetBoxBlur=parseFloat(b.substring(19).trim()):b.match("shadowInsetBoxOffsetX=")?d.conStyle.shadowInsetBoxOffsetX=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxOffsetY=")?d.conStyle.shadowInsetBoxOffsetY=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxColor=")?d.conStyle.shadowInsetBoxColor=(l?"":"#")+b.substring(20).trim():
b.match("textBorder=")&&(d.conStyle.textBorder=parseFloat(b.substring(11).trim()));d.imageSrc="vacio.gif"}d.imageSrc.match("_COLORES_")&&(c=d.imageSrc.split("_"),d.colorInt=new a.Color(c[2]),d.color=new a.Color(c[3]),d.font_size=d.parser.parse(c[5]),d.imageSrc="");d.imageSrc.match(/^\[.*\]?/)?d.imageSrc=d.parser.parse(d.imageSrc.substring(1,d.imageSrc.length-1)):d.imageSrc=d.parser.parse("'"+d.imageSrc+"'");c=d.evaluator.eval(d.imageSrc).toString().trim();if(""!=c)if(b=c.substr(0,c.lastIndexOf(".")),
l=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))d.imageSrc=d.parser.parse("'vacio.gif'"),d.image.ready=1,3===d.parent.version&&(d.name=d.parser.parse("")),d.emptyImage={ready:!0},d.parser.parse("'vacio.gif'");else if(d.image=d.parent.getImage(c),b)try{d.imageOver=d.parent.getImage(b+"_over"+l),d.imageDown=d.parent.getImage(b+"_down"+l)}catch(T){}d.container=a.newHTML("div",{class:"DescartesButtonContainer"+d.classContainer,id:d.id,style:"width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+
d.y+"px;z-index:"+d.zIndex+";"});d.btn=a.newHTML("canvas",{width:d.w*d.ratio,height:d.h*d.ratio,style:"position:absolute;left:0;top:0;width:"+d.w+"px;height:"+d.h+"px;"});d.ctx=d.btn.getContext("2d");d.ctx.imageSmoothingEnabled=!1;d.container.appendChild(d.btn);d.addControlContainer(d.container);d.addEvents();d.init();return d};$jscomp.inherits(L,a.Control);L.prototype.init=function(c){r=this.evaluator;w=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;");w.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var d=0,l=this.btnStyle.length;d<l;d++)m.style[this.btnStyle[d].type]=this.btnStyle[d].value;if(this.conStyle){d=
0;for(l=this.conStyle.length;d<l;d++)w.style[this.conStyle[d].type]=this.conStyle[d].value;if(this.conStyle.shadowBoxColor){d=this.conStyle.shadowBoxOffsetX||0;l=this.conStyle.shadowBoxOffsetY||2;var f=this.conStyle.shadowBoxBlur||2;w.style.boxShadow=d+"px "+l+"px "+f+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(d=this.conStyle.shadowInsetBoxOffsetX||0,l=this.conStyle.shadowInsetBoxOffsetY||-2,f=this.conStyle.shadowInsetBoxBlur||1,m.style.boxShadow=d+"px "+l+"px "+f+
"px 1px "+this.conStyle.shadowInsetBoxColor+" inset");this.conStyle.shadowTextColor&&(b.shadowBlur=this.conStyle.shadowTextBlur||1,b.shadowOffsetX=this.conStyle.shadowTextOffsetX||0,b.shadowOffsetY=this.conStyle.shadowTextOffsetY||2,b.shadowColor=this.conStyle.shadowTextColor)}this.fontSizeNotSet&&(this.font_size=r.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=r.eval(this.font_size);this.createGradient(this.w,this.h);w.style.display=0<r.eval(this.drawif)?"block":"none";b.textAlign=
"center";b.textBaseline="middle";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.customStyle&&("serif"==this.conStyle.font?b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family:"monospace"==this.conStyle.font&&(b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+a.monospace_font));this.draw(c)};L.prototype.update=function(){r=this.evaluator;w=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?(w.style.display="block",this.draw(),w.style.cursor=m.style.cursor=this.activeIfValue?"pointer":"not-allowed",this.updatePositionAndSize()):(w.style.display="none",this.buttonClick=!1)};L.prototype.draw=function(e){w=this.container;r=this.evaluator;m=this.btn;b=this.ctx;g=r.eval(this.name);p=this.evaluator.eval(this.imageSrc).toString().trim();if(!e&&(z=this.over===this.oldOver,B=this.buttonClick===this.oldButtonClick,
E=this.activeIfValue===this.oldActiveIfValue,J=this.drawIfValue===this.oldDrawIfValue,G=g===this.oldName,H=p===this.oldImageSrc,A=this.colorInt.getColor()===this.oldBackColor,I=this.color.getColor()===this.oldTextColor,C=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=g,this.oldImageSrc=p,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),
this.oldImageReady=this.image.ready,z&&B&&E&&J&&G&&H&&A&&I&&C))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);f=this.fs_evaluated;w.setAttribute("data-name",g);p?(c="vacio.gif"===p?this.emptyImage:this.parent.getImage(p),M=p.substr(0,p.lastIndexOf(".")),N=p.substr(p.lastIndexOf(".")),O=M+"_over"+N,F=M+"_down"+N,D="vacio.gif"===p?this.emptyImage:this.parent.getImage(O),K="vacio.gif"===p?this.emptyImage:this.parent.getImage(F)):K=D=c=this.emptyImage;b.clearRect(0,0,this.w,this.h);q=l=
0;this.buttonClick&&(q=l=1);"center"==this.text_align[1]?n=h(this.w/2+q)-.5:"left"==this.text_align[1]?(v=b.measureText(g).width,n=v/2+5+q):"right"==this.text_align[1]&&(v=b.measureText(g).width,n=this.w-v/2+q-5);"center"==this.text_align[0]?y=h(this.h/2+l)-.5:"top"==this.text_align[0]?y=f/2+l+4:"bottom"==this.text_align[0]&&(y=this.h-f/2+l-3);c&&("center"==this.image_align[1]?x=parseInt((this.w-c.width)/2)+q:"left"==this.image_align[1]?x=q:"right"==this.image_align[1]&&(x=this.w-c.width+q),"center"==
this.image_align[0]?u=parseInt((this.h-c.height)/2)+l:"top"==this.image_align[0]?u=l:"bottom"==this.image_align[0]&&(u=this.h-c.height+l));if(c&&c.ready)if(c!==this.emptyImage&&c.complete)if(p.match(d))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+p+"')",this.btn.style.backgroundPosition=x+"px "+u+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])w.style.backgroundColor=this.colorInt.getColor();b.drawImage(c,x,u)}else this.emptyImage&&this.customStyle&&
(w.style.backgroundColor=this.colorInt.getColor());else w.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(D!==this.emptyImage&&this.over&&D.ready&&D.complete?O.match(d)?(this.btn.style.backgroundImage="url('"+O+"')",this.btn.style.backgroundPosition=
x+"px "+u+"px"):b.drawImage(D,x,u):this.customStyle&&this.conStyle.overColor&&this.over&&(w.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?K!==this.emptyImage&&this.buttonClick&&K.ready&&K.complete?F.match(d)?(this.btn.style.backgroundImage="url('"+F+"')",this.btn.style.backgroundPosition=x+"px "+u+"px"):b.drawImage(K,x,u):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(w.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!c&&(b.fillStyle="rgba(0,0,0,0.09)",
b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(b.lineWidth=this.conStyle.textBorder,b.strokeStyle=this.conStyle.shadowTextColor,b.strokeText(g,n,y));this.borderColor&&(b.lineWidth=parseInt(f/6),b.strokeStyle=this.borderColor.getColor(),b.strokeText(g,n,y));b.fillText(g,n,y);this.underlined&&(v=b.measureText(g).width,b.strokeStyle=this.color.getColor(),b.lineWidth=h(f/10)||2,b.lineCap="round",b.beginPath(),
b.moveTo(n-v/2+q,y+h(f/2)+h(f/5)-1.5),b.lineTo(n+v/2+q,y+h(f/2)+h(f/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?w.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=x;this._image_pos_y=u};L.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(e(this.colorInt.r-this.color.r)+e(this.colorInt.g-this.color.g)+e(this.colorInt.b-
this.color.b))/255)};L.prototype.buttonPressed=function(){this.updateAndExecAction()};L.prototype.addEvents=function(){function c(b,d,n){a.clearTimeout(f);l.buttonClick&&l.drawIfValue&&l.activeIfValue&&(d.call(l),b=n?b:100,f=a.setTimeout(function(){c(b,d,!1)},b))}function b(b){this.focus();b.preventDefault();b.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();l.whichBtn=a.whichBtn(b);"L"==l.whichBtn&&l.activeIfValue&&(l.buttonClick=!0,l.draw(),"calculate"==l.action&&
(l.evaluator.setVariable(l.id,l.evaluator.eval(l.valueExpr)),c(1E3,l.buttonPressed,!0)),l.btn.removeEventListener("touchend",d),l.btn.addEventListener("touchend",d),l.btn.removeEventListener("mouseup",d),l.btn.addEventListener("mouseup",d))}function d(c){a.newBlobContent=null;this.focus();c.preventDefault();c.stopPropagation();if(l.activeIfValue||l.buttonClick)l.buttonClick=!1,l.draw(),"calculate"!=l.action&&(l.evaluator.setVariable(l.id,l.evaluator.eval(l.valueExpr)),l.buttonPressed()),l.btn.removeEventListener("touchend",
d),l.btn.removeEventListener("mouseup",d);l.parent.update()}var l=this,f;l.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();l.over=!0;l.draw()});this.btn.addEventListener("mouseout",function(c){a.newBlobContent=null;c.preventDefault();c.stopPropagation();l.over=!1;l.buttonClick=!1;l.draw()});document.addEventListener("visibilitychange",
function(c){a.newBlobContent=null;l.buttonClick=!1})};a.Button=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p,c,q=function(b,d){b=a.Control.call(this,b,d)||this;b.tabindex=++b.parent.tabindex;"_._"==b.name&&(b.name="");b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name+"'");b.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:b.id});b.grad=a.newHTML("div",{class:"DJS_Gradient"});b.divUp=a.newHTML("div",{class:"DJS_Up"});b.divDown=a.newHTML("div",{class:"DJS_Down"});
b.field=a.newHTML("input",{type:"text",id:b.id+"_spinner",class:"DescartesSpinnerField",tabindex:b.tabindex});b.label=a.newHTML("label",{class:"DescartesSpinnerLabel"});b.container.appendChild(b.label);b.container.appendChild(b.field);b.container.appendChild(b.grad);b.container.appendChild(b.divUp);b.container.appendChild(b.divDown);b.addControlContainer(b.container);c=b.evaluator.parser.parse("1");b.originalIncr=b.incr;if(0>b.evaluator.eval(b.decimals)||0===b.evaluator.eval(b.incr))d=b.evaluator.eval(b.incr),
0<d?(b.incr=b.evaluator.parser.parse(parseInt(d).toString()),b.originalIncr=b.incr):b.incr=c;b.addEvents();b.init();return b};$jscomp.inherits(q,a.Control);q.prototype.init=function(){h=this.evaluator;var c=h.eval(this.name).toString();this.label.innerHTML=c;this.value=this.validateValue(h.eval(this.valueExpr));var b=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var d=2!==this.parent.version?"__":"_____",f=a.getTextWidth(b+"_",this.fieldFontSize+
"px "+a.sansserif_font),n=2+parseInt(this.h/2),g=parseInt(this.w/2-n/2);d=a.getTextWidth(c+d,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(g=this.w-n,f=0);g<d&&(g=d);""==c&&(g=0);this.w-g-n<f&&(g=this.w-n-f);0>g&&(g=0);c=this.w-(g+n);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.grad.setAttribute("style","left:0;top:0;left:"+g+"px;width:"+n+"px;height:"+this.h+"px;background-color:#f0f8ff");
d="width:"+n+"px;left:"+g+"px;";this.divUp.setAttribute("style",d+";height:"+(this.h/2+1)+"px;top:0;");this.divDown.setAttribute("style",d+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;");this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+(n+g)+"px;");this.field.value=b;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+g+"px;height:"+
this.h+"px;line-height:"+this.h+"px;");h.setVariable(this.id,this.value)};q.prototype.update=function(){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();0>h.eval(this.decimals)?(e=h.eval(this.incr),0<e?this.originalIncr=this.incr=h.parser.parse(parseInt(e).toString()):this.incr=c):this.incr=0!==h.eval(this.originalIncr)?this.originalIncr:c;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",
!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(d=this.field.value,r=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==r&&this.field.value!=d&&(this.value=this.validateValue(d),
this.field.value=this.formatOutputValue(this.value)),h.setVariable(this.id,this.value))};q.prototype.updateStyle=function(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"rgba(0,0,0,"+24/255+")":"";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=this.down?"rgba(0,0,0,"+24/255+")":""};q.prototype.validateValue=
function(a){h=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");m=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(m)&&(m=0);f=h.eval(this.min);g=h.eval(this.max);""===f&&(f=-Infinity);""===g&&(g=Infinity);m=Math.min(Math.max(m,f),g);this.discrete&&(b=h.eval(this.incr),m=0==b?0:b*Math.round(m/b));k=h.eval(this.decimals);0>=k&&(k=0);return m=parseFloat(parseFloat(m).toFixed(k))};
q.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};q.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};q.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())};q.prototype.addEvents=function(){function c(b,d,l){a.clearTimeout(h);if(g.up||
g.down)d.call(g),b=l?b:10,h=a.setTimeout(function(){c(b,d)},b)}function b(b){b.preventDefault();g.whichBtn=a.whichBtn(b);"L"==g.whichBtn&&g.activeIfValue&&(g.up=!0,c(e,g.increase,!0))}function d(b){b.preventDefault();g.whichBtn=a.whichBtn(b);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,c(e,g.decrease,!0))}function f(c){g.up=!1;a.clearTimeout(h);g.updateStyle()}function n(c){g.down=!1;a.clearTimeout(h);g.updateStyle()}p=a.hasTouchSupport;var g=this,e=p?500:200,h;g.divUp.oncontextmenu=g.divDown.oncontextmenu=
g.field.oncontextmenu=g.label.oncontextmenu=function(){return!1};this.label.addEventListener("touchstart",a.preventDefault);this.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("keydown",function(a){13==a.keyCode&&g.changeValue(g.field.value)});this.divUp.addEventListener("touchstart",b);this.divUp.addEventListener("mousedown",b);this.divDown.addEventListener("touchstart",d);this.divDown.addEventListener("mousedown",d);this.divUp.addEventListener("mouseout",function(c){g.up=
!1;a.clearTimeout(h);c.preventDefault();g.updateStyle()});this.divDown.addEventListener("mouseout",function(c){g.down=!1;a.clearTimeout(h);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",n);window.addEventListener("touchend",n);this.divDown.addEventListener("mouseup",n);window.addEventListener("mouseup",n);document.addEventListener("visibilitychange",
function(c){g.up=!1;g.down=!1;a.clearTimeout(h);g.updateStyle()});g.field.addEventListener("click",function(a){this.select();this.focus()})};a.Spinner=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(d,e){d=a.Control.call(this,d,e)||this;d.typeCtr="checkbox";d.pressed=e.pressed||!1;d.radio_group=(e.radio_group||"").trim();""!==d.radio_group&&(d.typeCtr="radio");d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name.trim()+"'");d.tabindex=++d.parent.tabindex;d.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer"});d.checkbox=a.newHTML("input",{type:d.typeCtr,
id:d.id+d.typeCtr,class:"DescartesCheckbox",tabindex:d.tabindex});""!==d.radio_group&&d.checkbox.setAttribute("name",d.radio_group);d.checkbox.internalID=d.id;d.label=a.newHTML("label",{class:"DescartesCheckboxLabel"});d.dummyLabel=a.newHTML("label",{"for":d.id+d.typeCtr});d.value=d.evaluator.eval(d.valueExpr);d.containerControl.appendChild(d.label);d.containerControl.appendChild(d.checkbox);d.containerControl.appendChild(d.dummyLabel);d.addControlContainer(d.containerControl);d.addEvents();d.init();
return d};$jscomp.inherits(e,a.Control);e.prototype.init=function(d){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();this.labelFontSize=a.getFieldFontSize(this.h);d=Math.max(this.w-this.h,0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+d+"px;");this.checkbox.setAttribute("style",
"width:"+this.h+"px;height:"+this.h+"px;left:"+d+"px;");this.checkbox.checked=0!=this.value;this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;");this.evaluator.setVariable(this.id,this.value);this.update()};e.prototype.update=function(){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;
this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==h.getVariable(this.id)?1:0;""===this.radio_group?this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=0!==this.value):(this.value=this.checkbox.checked?1:0,this.pressed&&(h.setVariable(this.radio_group,this.id),this.pressed=!1));h.setVariable(this.id,this.value)}this.updatePositionAndSize()};e.prototype.addEvents=
function(){var d=this;d.checkbox.oncontextmenu=d.label.oncontextmenu=d.dummyLabel.oncontextmenu=function(){return!1};d.label.addEventListener("touchstart",a.preventDefault);d.label.addEventListener("mousedown",a.preventDefault);d.dummyLabel.addEventListener("touchstart",a.preventDefault);d.dummyLabel.addEventListener("mousedown",a.preventDefault);d.checkbox.addEventListener("click",function(a){d.pressed=!0;d.updateAndExecAction()})};a.Checkbox=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k=function(b,d){b=a.Control.call(this,b,d)||this;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+"'");void 0===b.valueExprString&&(b.valueExprString=b.onlyText?"0":"");b.emptyString=!1;b.ok=0;b.tabindex=++b.parent.tabindex;b.regExpDecimalSymbol=new RegExp("\\"+b.parent.decimal_symbol,"g");b.answer&&(b.answer.match("krypto_")&&(b.answer=(new a.Krypto).decode(b.answer.substring(7))),
b.answerPattern=b.answer,b.answer=a.buildRegularExpressionsPatterns(b.answer,b.evaluator),b.onlyText?(d=b.answerPattern.indexOf("|"),b.firstAnswer=-1==d?b.answerPattern:b.answerPattern.substring(0,d)):b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(","))));b.onlyText&&(b.valueExprString.match(/^'/)&&b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&
a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});""==name.trim()&&(name="");b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer"});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("label",{class:"DescartesTextFieldLabel"});b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.addControlContainer(b.containerControl);
b.addEvents();b.init();return b};$jscomp.inherits(k,a.Control);k.prototype.init=function(b){h=this.evaluator;var d=h.eval(this.name).toString();this.label.innerHTML=d;b||(this.value=this.validateValue(h.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var f=a.getTextWidth(b+"_",this.fieldFontSize+"px "+a.sansserif_font),c=parseInt(this.w/2),e=a.getTextWidth(d,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(c=this.w,f=0);c<e&&(c=e);
""==d&&(c=0);this.w-c<f&&(c=this.w-f);0>c&&(c=0);d=this.w-c;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+c+"px;");this.field.value=b;this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;line-height:"+this.h+"px;");this.evaluate&&(this.ok=this.evaluateAnswer());
this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};k.prototype.update=function(){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(e=this.field.value,
d=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===d&&this.field.value!=e&&(this.value=this.validateValue(e),this.field.value=this.formatOutputValue(this.value)),h.setVariable(this.id,this.value));this.updatePositionAndSize()};k.prototype.validateValue=function(a){if(""===a||"''"==a)return"";h=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");r=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));
isNaN(r)&&(r=0);m=h.eval(this.min);b=h.eval(this.max);""===m&&(m=-Infinity);""===b&&(b=Infinity);r<m&&(r=m);r>b&&(r=b);this.discrete&&(a=h.eval(this.incr),r=0===a?0:a*Math.round(r/a));return r=parseFloat(parseFloat(r).toFixed(h.eval(this.decimals)))};k.prototype.formatOutputValue=function(b){return""===b?"":a.Control.prototype.formatOutputValue.call(this,b)};k.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),
this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};k.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};k.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};k.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=b.label.oncontextmenu=
function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){b.evaluator.eval(b.drawIf)&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()})};a.TextField=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.abs,e,d,r,m,b,k,f,g,p,c,q=function(c,b){function l(c){g.options=c.split(",");g.menuOptions=[];g.strValue=[];c=0;for(var b=g.options.length;c<b;c++){var l=g.customSplit(g.options[c]);1==l.length?(g.menuOptions.push(l[0]),g.strValue.push(c.toString())):2==l.length&&(g.menuOptions.push(l[0]),""==l[1]?g.strValue.push(c.toString()):g.strValue.push(l[1]))}c=0;for(b=g.menuOptions.length;c<b;c++)g.menuOptions[c].match(/^\[/)&&g.menuOptions[c].match(/\]$/)?
g.menuOptions[c]=e.parse(g.menuOptions[c].substring(1,g.menuOptions[c].length-1)):g.menuOptions[c]=e.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]=e.parse(g.strValue[c].substring(1,g.strValue[c].length-1)):g.strValue[c]=e.parse(g.strValue[c]);for(;g.select.firstChild;)g.select.remove();c=0;for(b=g.menuOptions.length;c<b;c++)l=a.newHTML("option"),l.innerHTML=d.eval(g.menuOptions[c]),g.select.appendChild(l);return 0}
c=a.Control.call(this,c,b)||this;c.options=b.options||"";e=c.parser;d=c.evaluator;c.ok=0;c.tabindex=++c.parent.tabindex;c.answer&&(c.answer.match("krypto_")&&(c.answer=(new a.Krypto).decode(c.answer.substring(7))),c.answer=parseInt(c.answer.split(",")[0].replace("[",""))||0);c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");var g=c;c.evaluator.setFunction(c.id+".setOptions",l);c.containerControl=a.newHTML("div",{class:"DescartesMenuContainer"});
c.label=a.newHTML("label",{class:"DescartesMenuLabel"});c.select=a.newHTML("select",{id:c.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:c.tabindex});c.field=a.newHTML("input",{type:"text",id:c.id+"_menuField",class:"DescartesMenuField",tabindex:c.tabindex});l(c.options);c.containerControl.appendChild(c.label);c.containerControl.appendChild(c.select);c.visible&&c.containerControl.appendChild(c.field);c.addControlContainer(c.containerControl);c.addEvents();c.init();return c};$jscomp.inherits(q,
a.Control);q.prototype.init=function(c){d=this.evaluator;var b=d.eval(this.name).toString();this.label.innerHTML=b;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var l=0,g=0;this.value=c?this.value:d.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var f=0,e=this.menuOptions.length;f<e;f++)c=a.getTextWidth(d.eval(this.menuOptions[f]).toString(),this.fieldFontSize+"px "+a.sansserif_font),c>l&&(l=c,g=f);l+=25;c=a.getTextWidth(this.formatOutputValue(d.eval(this.strValue[g])),
this.fieldFontSize+"px "+a.sansserif_font)+7;g=a.getTextWidth(b,this.fieldFontSize+"px "+a.sansserif_font)+10;""==b&&(g=0);this.visible||(c=0);for(b=this.w-c-g;b<l&&0<g;)g--,b++;for(;b<l&&0<c;)c--,b++;for(;g+b+c+1<this.w;)b++,c++;l=g;f=l+b;c=this.w-f;e=this.formatOutputValue(d.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+
this.fieldFontSize+"px;width:"+g+"px;height:"+this.h+"px;line-height:"+this.h+"px;");this.field.value=e;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+f+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+l+"px;");this.select.selectedIndex=this.indexValue;d.setVariable(this.id,parseFloat(e.replace(this.parent.decimal_symbol,".")));this.update()};q.prototype.update=
function(){d=this.evaluator;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){this.label.innerHTML=d.eval(this.name).toString();for(var a=0,c=this.menuOptions.length;a<c;a++)this.select.options[a].innerHTML=
d.eval(this.menuOptions[a]);this.value=d.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);d.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()};q.prototype.customSplit=function(a){k=!1;f="";g=0;for(p=-1;g<a.length;){c=a.charAt(g);if("["===c&&-1===p){if(k||""!=f)f+="\u00a6";
p++}else"["===c?p++:"]"===c&&0===p?(k=!0,p--):"]"==a.charAt(g)&&(p=0>p?p:p-1);f+=a.charAt(g);g++}return f.split("\u00a6")};q.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));r=-1;m=Infinity;for(var c=0,d=this.strValue.length;c<d;c++)b=h(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=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);this.select.addEventListener("change",function(a){c.value=c.evaluator.eval(c.strValue[this.selectedIndex]);c.field.value=c.formatOutputValue(c.value);c.evaluator.setVariable(c.id,c.field.value);c.changeValue();a.preventDefault()});this.field.addEventListener("keydown",function(a){13==
a.keyCode&&(c.indexValue=c.getIndex(c.field.value),c.value=c.evaluator.eval(c.strValue[c.indexValue]),c.field.value=c.formatOutputValue(c.indexValue),c.select.selectedIndex=c.indexValue,c.changeValue())});c.field.addEventListener("click",function(a){this.focus()})};a.Menu=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e,d,r,m,b,k,f,g,p,c,q,l,v,x,u,n,y,w,z=function(c,b){c=a.Control.call(this,c,b)||this;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});
c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("label",{class:"DescartesScrollbarLabel"});c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.addControlContainer(c.container);c.addEvents();c.init();return c};
$jscomp.inherits(z,a.Control);z.prototype.init=function(){e=this.evaluator;0==e.eval(this.decimals)?this.incr=1:this.incr=(e.eval(this.max)-e.eval(this.min))/100;this.value=this.validateValue(e.eval(this.valueExpr));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;e.setVariable(this.id,
this.value)};z.prototype.initScroll=function(c){d=this;e=d.evaluator;w=e.eval(d.name).toString();d.label.innerHTML=w;var b="v"===d.orientation?parseInt(19+5*(d.h-100)/100):d.h;d.fieldFontSize="v"===d.orientation?b-parseInt(d.h/20)-1:2!==d.parent.version?a.getFieldFontSize(b):10;c=a.getTextWidth(c+"_",d.fieldFontSize+"px "+a.sansserif_font);var l=d.parent.getSpaceById(d.spaceID).h;d.labelHeight=""==w?0:b;d.fieldHeight=""==d.visible?0:b;if("v"===d.orientation)d.canvasWidth=d.w,d.canvasHeight=d.h-d.labelHeight-
d.fieldHeight,18<=d.canvasHeight+d.y-l&&(d.canvasHeight=l),b=d.fieldHeight,c=b+d.canvasHeight,d.canvasX=0,d.canvasY=d.fieldHeight,d.labelWidth=d.w,d.labelY=c,d.upWidth=d.downW=d.w,d.upHeight=d.downH=15,d.upX=0,d.upY=d.fieldHeight,d.downX=0,d.downY=c-d.downH,d.fieldWidth=d.w,d.fieldX=0,d.scrollHandlerW=d.w,d.scrollHandlerH=parseInt((d.canvasHeight-d.upHeight-d.downH-d.labelHeight-d.fieldHeight)/10),d.scrollHandlerH=15>d.scrollHandlerH?15:d.scrollHandlerH,d.limInf=c-d.downH-d.scrollHandlerH,d.limSup=
b+d.downH;else{b=a.getTextWidth(w,d.fieldFontSize+"px "+a.sansserif_font)+10;d.labelWidth=b;d.fieldWidth=c;""==w&&(d.labelWidth=0);d.visible||(d.fieldWidth=0);for(c=d.w-d.fieldWidth-d.labelWidth;58>c&&0<d.labelWidth;)d.labelWidth--,c++;for(;58>c&&0<d.fieldWidth;)d.fieldWidth--,c++;b=d.labelWidth;l=b+c;d.fieldWidth=d.w-l;d.canvasWidth=c;d.canvasHeight=d.h;d.canvasX=d.labelWidth;d.canvasY=0;d.fieldX=d.canvasWidth+d.labelWidth;d.labelHeight=d.h;d.labelY=0;d.upWidth=d.downW=15;d.upHeight=d.downH=d.h;
d.upX=l-d.downW;d.upY=0;d.downX=d.labelWidth;d.downY=0;d.scrollHandlerW=parseInt((d.canvasWidth-d.upWidth-d.downW)/10);d.scrollHandlerW=15>d.scrollHandlerW?15:d.scrollHandlerW;d.scrollHandlerH=d.h;d.limInf=b+d.downW;d.limSup=b+d.canvasWidth-d.downW-d.scrollHandlerW}d.container.setAttribute("style","width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";");d.canvas.setAttribute("width",d.w+"px");d.canvas.setAttribute("height",d.h+"px");d.canvas.setAttribute("style","position:absolute;left:0;top:0;");
d.ctx=d.canvas.getContext("2d");d.ctx.imageSmoothingEnabled=!1;d.divUp.setAttribute("style","width:"+d.upWidth+"px;height:"+d.upHeight+"px;left:"+d.upX+"px;top:"+d.upY+"px;");d.divDown.setAttribute("style","width:"+d.downW+"px;height:"+d.downH+"px;left:"+d.downX+"px;top:"+d.downY+"px;");d.scrollHandler.setAttribute("style","width:"+d.scrollHandlerW+"px;height:"+d.scrollHandlerH+"px;left:"+("v"===d.orientation?0:d.limInf)+"px;top:"+("v"===d.orientation?d.limInf:0)+"px;");d.field.setAttribute("style",
"font-size:"+d.fieldFontSize+"px;width:"+d.fieldWidth+"px;height:"+d.fieldHeight+"px;left:"+d.fieldX+"px;top:0;");0===d.fieldHeight&&(d.field.style.display="none");d.label.setAttribute("style","font-size:"+d.fieldFontSize+"px;width:"+d.labelWidth+"px;height:"+d.labelHeight+"px;line-height:"+d.labelHeight+"px;left:0;top:"+d.labelY+"px;")};z.prototype.update=function(){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();0==e.eval(this.decimals)?this.incr=1:this.incr=(e.eval(this.max)-
e.eval(this.min))/100;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(e.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);
e.setVariable(this.id,this.value)};z.prototype.draw=function(){d=this;b=d.ctx;f=h(this.w);k=h(this.h);b.fillStyle="#e0e4e8";b.fillRect(0,0,f,k);b.strokeStyle="#7a8a99";b.fillStyle="#ccdcec";d.down&&b.fillRect(d.downX+.5,d.downY+.5,d.downW,d.downH-1);b.strokeRect(d.downX+.5,d.downY+.5,d.downW,d.downH-1);d.up&&b.fillRect(d.upX+.5,d.upY-.5,d.upWidth,d.upHeight+1);b.strokeRect(d.upX+.5,d.upY-.5,d.upWidth,d.upHeight+1);g=4;b.fillStyle="black";b.beginPath();"h"===d.orientation?(b.moveTo(d.downX+g,d.downH/
2),b.lineTo(d.downX+d.downW-g,g),b.lineTo(d.downX+d.downW-g,d.downH-g),b.moveTo(d.upX+d.upWidth-g,d.downH/2),b.lineTo(d.upX+g,g),b.lineTo(d.upX+g,d.downH-g),b.fill(),d.activeIfValue&&(p=h(d.pos),b.fillStyle="#ccdcec",b.fillRect(p+.5,0,h(d.scrollHandlerW),k),b.strokeStyle="#6382bf",b.strokeRect(p+.5,0,h(d.scrollHandlerW),k),c=h(d.scrollHandlerW/2),b.beginPath(),b.moveTo(p+c+.5-2,3),b.lineTo(p+c+.5-2,k-3),b.moveTo(p+c+.5,3),b.lineTo(p+c+.5,k-3),b.moveTo(p+c+.5+2,3),b.lineTo(p+c+.5+2,k-3),b.stroke())):
(b.moveTo(d.downX+d.downW/2,d.downY+d.downH-g),b.lineTo(d.downX+g,d.downY+g),b.lineTo(d.downX+d.downW-g,d.downY+g),b.moveTo(d.upX+d.upWidth/2,d.upY+g),b.lineTo(d.upX+g,d.upY+d.upHeight-g),b.lineTo(d.upX+d.upWidth-g,d.upY+d.upHeight-g),b.fill(),d.activeIfValue&&(p=h(d.pos),b.fillStyle="#ccdcec",b.fillRect(0,p+.5,f,h(d.scrollHandlerH)),b.strokeStyle="#6382bf",b.strokeRect(0,p+.5,f,h(d.scrollHandlerH)),c=h(d.scrollHandlerH/2),b.beginPath(),b.moveTo(3,p+c+.5-2),b.lineTo(f-3,p+c+.5-2),b.moveTo(3,p+c+.5),
b.lineTo(f-3,p+c+.5),b.moveTo(3,p+c+.5+2),b.lineTo(f-3,p+c+.5+2),b.stroke()));b.strokeRect(.5,.5,f-1,k-1);d.activeIfValue||(b.fillStyle="rgba(240,240,240,"+160/255+")",b.fillRect(0,0,f,k.h))};z.prototype.validateValue=function(a){e=this.evaluator;q=a.toString();q=parseFloat(q.replace(this.parent.decimal_symbol,"."));isNaN(q)&&(q=0);this.minimo=e.eval(this.min);q<this.minimo&&(this.value=null,q=this.minimo);this.maximo=e.eval(this.max);q>this.maximo&&(this.value=null,q=this.maximo);l=this.incr;q=0!=
l?q*l/l:0;this.fixed&&(q=parseFloat(parseFloat(q).toFixed(e.eval(this.decimals))));return q};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};z.prototype.increase10=function(){g=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+g):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+
g)};z.prototype.decrease10=function(){g=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-g):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-g)};z.prototype.changeValue=function(a){this.activeIfValue&&(v=this.validateValue(a),v!=this.value&&(this.value=v,this.field.value=this.formatOutputValue(v),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,
this.value),this.updateAndExecAction()))};z.prototype.changeValueForScrollMovement=function(){e=this.evaluator;x=this.limInf;u=this.limSup;n=e.eval(this.min);y=e.eval(this.max);l=this.incr;v=h((this.pos-x)*(y-n)/(u-x)/l)*l+n;v!=this.value&&(this.value=v,this.field.value=this.formatOutputValue(v),e.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};z.prototype.changeScrollPositionFromValue=function(){e=this.evaluator;x=this.limInf;u=this.limSup;
n=e.eval(this.min);y=e.eval(this.max);l=this.incr;this.pos=(this.value-n)*(u-x)/(y-n)+x;this.scrollHandler.style["h"==this.orientation?"left":"top"]=this.pos+"px"};z.prototype.addEvents=function(){function c(b,d,l,g){a.clearTimeout(x);(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-g)&&(d.call(p),b=l?b:30,x=a.setTimeout(function(){c(b,d,!1,g)},b))}function b(b){b.preventDefault();p.whichBtn=a.whichBtn(b);"L"==p.whichBtn&&p.activeIfValue&&(p.clickPos=a.getCursorPosition(b,p.container),p.canvasClick=
!0,"h"==p.orientation?p.clickPos.x<p.prePos?c(350,p.decrease10,!0,p.minimo):c(350,p.increase10,!0,p.maximo):p.clickPos.y<p.prePos?c(350,p.increase10,!0,p.maximo):c(350,p.decrease10,!0,p.minimo))}function d(c){p.canvasClick=!1;a.clearTimeout(x)}function l(c){1==p.canvasClick&&(p.clickPos=a.getCursorPosition(c,p.container),c.preventDefault())}function g(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",g,!1);window.removeEventListener("mousemove",e,!1);a.preventDefault()}function f(a){p.scrollClick=
!1;p.prePos=p.pos;window.removeEventListener("touchend",f,!1);window.removeEventListener("touchmove",e,!1);a.preventDefault()}function e(c){var b=a.getCursorPosition(c,p.container);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-b.x),p.pos<p.limInf&&(p.pos=p.limInf),p.pos>p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.scrollHandlerW+"px;height:"+p.h+"px;left:"+p.pos+"px;top:0;")):(p.pos=p.prePos-(p.initPos.y-b.y),p.pos>p.limInf&&(p.pos=p.limInf),p.pos<p.limSup&&(p.pos=
p.limSup),p.scrollHandler.setAttribute("style","width:"+p.w+"px;height:"+p.scrollHandlerH+"px;left:0;top:"+p.pos+"px;"));p.changeValueForScrollMovement();c.preventDefault()}function h(b){b.preventDefault();p.whichBtn=a.whichBtn(b);"L"==p.whichBtn&&p.activeIfValue&&(p.up=!0,c(350,p.increase,!0,p.maximo))}function n(b){b.preventDefault();p.whichBtn=a.whichBtn(b);"L"==p.whichBtn&&p.activeIfValue&&(p.down=!0,c(350,p.decrease,!0,p.minimo))}function k(c){p.down=!1;a.clearTimeout(x);c.preventDefault()}function q(c){p.up=
!1;a.clearTimeout(x);p.draw()}function m(c){p.down=!1;a.clearTimeout(x);p.draw()}var p=this,x;p.canvas.oncontextmenu=p.divUp.oncontextmenu=p.divDown.oncontextmenu=p.label.oncontextmenu=p.field.oncontextmenu=p.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});this.canvas.addEventListener("touchstart",b);this.canvas.addEventListener("mousedown",b);this.divDown.addEventListener("mouseout",k);window.addEventListener("touchend",
d);window.addEventListener("mouseup",d);this.canvas.addEventListener("touchmove",l);this.canvas.addEventListener("mousemove",l);this.scrollHandler.addEventListener("touchstart",function(c){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(c,p.container),window.addEventListener("touchend",f),window.addEventListener("touchmove",e),c.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(c){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(c,p.container),
window.addEventListener("mouseup",g),window.addEventListener("mousemove",e),c.preventDefault())});this.divUp.addEventListener("touchstart",h);this.divUp.addEventListener("mousedown",h);this.divDown.addEventListener("touchstart",n);this.divDown.addEventListener("mousedown",n);this.divUp.addEventListener("mouseout",function(c){p.up=!1;a.clearTimeout(x);c.preventDefault()});this.divDown.addEventListener("mouseout",k);window.addEventListener("touchend",q);window.addEventListener("mouseup",q);window.addEventListener("touchend",
m);window.addEventListener("mouseup",m)};a.Scrollbar=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d=function(d,e){var b=a.Control.call(this,d,e)||this;b.controls=e.controls||!0;b.file=e.file||"";b.oldDrawIf=0;d=b.evaluator.eval(b.expresion);4==d[0].length?(b.w=d[0][2],b.h=d[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(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(f){}return 0});b.audio.addEventListener("timeupdate",function(a){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime)});return b};$jscomp.inherits(d,a.Control);d.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};d.prototype.update=function(){h=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=h.eval(this.file),this.oldFile!==
this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(e=0<h.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",e!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=e;this.updatePositionAndSize()};a.Audio=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d=function(d,e){var b=a.Control.call(this,d,e)||this;b.controls=e.controls||!0;b.file=e.file||"";b.oldDrawIf=0;h=b.evaluator;d=h.eval(b.expresion);4==d[0].length?(b.w=d[0][2],b.h=d[0][3]):(b.w=null,b.h=null);d=b.file;e=d.lastIndexOf(".");-1!=e&&(d=b.file.substring(0,e));b.video=a.newHTML("video",{poster:d+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(e=a.newHTML("source",{src:d+".mp4",type:"video/mp4"}),b.video.appendChild(e));b.video.canPlayType("video/ogg")&&(e=a.newHTML("source",{src:d+".ogg",type:"video/ogg"}),b.video.appendChild(e),e=a.newHTML("source",{src:d+".ogv",type:"video/ogg"}),b.video.appendChild(e));b.video.canPlayType("video/webm")&&
(e=a.newHTML("source",{src:d+".webm",type:"video/webm"}),b.video.appendChild(e));b.addControlContainer(b.video);h.setFunction(b.id+".play",function(){try{b.video.play()}catch(k){}return 0});h.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(k){}return 0});h.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(k){}return 0});h.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(f){}return 0});b.video.addEventListener("timeupdate",
function(a){h.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(d,a.Control);d.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};d.prototype.update=function(){h=this.evaluator;(e=0<h.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",e!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=e;this.updatePositionAndSize()};a.Video=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r=function(d,b){var e=a.Control.call(this,d,b)||this;e.font_family=b.font_family||"Monospaced";e.style=b.style||",PLAIN,";e.font_size=b.font_size||12;typeof("number"!==e.font_size)&&(e.font_size=e.evaluator.eval(e.font_size));e.font=e.font_family+e.style+e.font_size;e.region="interior";e.tabindex=++e.parent.tabindex;if(e.answer){e.answer.match("krypto_")&&(e.answer=(new a.Krypto).decode(e.answer.substring(7)));var f=e.parent.lessonParser.parseText(e.answer)}e.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:e.id,spellcheck:"false"});e.textArea=a.newHTML("div",{class:"DescartesTextAreaContainer",contenteditable:"true"});e.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});e.showButton=a.newHTML("div",{class:"DJS_Gradient"});e.activeCover=a.newHTML("div");e.containerControl.appendChild(e.textArea);e.containerControl.appendChild(e.textAreaAnswer);e.containerControl.appendChild(e.showButton);e.containerControl.appendChild(e.activeCover);
e.addControlContainer(e.containerControl);e.showAnswer=!1;e.text=void 0==e.text||"simpleText"==e.text.type?e.rawText||"":e.text.hasFormula?e.rawText:e.text.toHTML();f&&"simpleText"!==f.type&&(e.answer=e.text.hasFormula?"":f.toHTML());e.evaluator.setVariable(e.id,e.text);var g,h,c;e.evaluator.setFunction(e.id+".insertAtCursor",function(a){(g=window.getSelection())&&g.getRangeAt&&g.rangeCount&&(c=document.createTextNode(a),h=g.getRangeAt(0),h.deleteContents(),h.insertNode(c),h.setStart(c,c.length),
h.setEnd(c,c.length),g.removeAllRanges(),g.addRange(h),e.textArea.focus());return 0});e.evaluator.setFunction(e.id+".update",function(){e.update()});e.addEvents();e.init();return e};$jscomp.inherits(r,a.Control);r.prototype.init=function(){e=this.answer?28:4;h=this.evaluator;var d=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var b=
"padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-e)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",b);this.textArea.innerHTML=d;this.textAreaAnswer.setAttribute("style",b+"display:"+(this.showAnswer?"block":"none")+";");this.textAreaAnswer.innerHTML="<span>"+this.answer+"</span>";this.showButton.setAttribute("style","width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:"+
(this.answer?"block":"none")+";");this.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+a.sansserif_font+';">S</span>';this.activeCover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;");this.update()};r.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);h.getVariable(this.id)!==this.oldValue&&(this.textArea.innerText=
(h.getVariable(this.id)||"").replace(/\\n/g,"\n"));d=this.textArea.innerText||"";d="\n"===d.charAt(d.length-1)?d.substring(0,d.length-1):d;d=d.replace(/\n/g,"\\n").replace(/\s/g," ");h.setVariable(this.id,d);this.oldFieldValue=d;this.oldValue=h.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};r.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=
this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();b.showAnswer=!b.showAnswer;b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});this.textArea.addEventListener("paste",function(a){a.preventDefault();
document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain"))});this.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()})};a.TextArea=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,e,d,r,m,b,k,f,g,p,c,q,l,v=function(b,l){var g=a.Control.call(this,b,l)||this;d=b.evaluator.parser;g.spaceID=l.spaceID||"";g.text=l.text||"";g.size=l.size||d.parse("4");g.font=l.font||"Monospaced,PLAIN,12";g.image=new Image;g.image.onload=function(){this.ready=1};g.imageSrc=l.imageSrc||"";g.font=a.convertFont(g.font);if(g.constraintExpr){g.constraint=d.parse(g.constraintExpr);"(expr)"==g.constraint.type&&(g.constraint=d.parse(g.constraintExpr.substring(1,
g.constraintExpr.length-1)));if("compOperator"==g.constraint.type){l=g.constraint.childs[0];var e=g.constraint.childs[1];"identifier"!=l.type||"y"!=l.value||e.contains("y")?"identifier"!=l.type||"x"!=l.value||e.contains("x")?g.newt=new a.R2Newton(g.evaluator,g.constraint):(g.constVar="y",g.noConstVar="x",g.evalConst=g.evalConstXoY,g.constraint=e):(g.constVar="x",g.noConstVar="y",g.evalConst=g.evalConstXoY,g.constraint=e)}else g.constraint=null;c=new a.R2(0,0)}g.container=g.getContainer();g.mouseCatcher=
a.newHTML("div",{class:"DescartesGraphicControl",id:g.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:rgba(0,0,0,0);z-index:"+g.zIndex+";"});g.ctx=g.space.ctx;g.container.appendChild(g.mouseCatcher);g.addEvents();g.xStr=g.id+".x";g.yStr=g.id+".y";g.activoStr=g.id+".activo";g.activeStr=g.id+".active";""!==g.space.id&&2!==b.version?(g.mxStr=g.space.id+".mouse_x",g.myStr=g.space.id+".mouse_y",g.mclickedStr=g.space.id+".mouse_clicked",g.mclicizquierdoStr=g.space.id+".clic_izquierdo"):
(g.mxStr="mouse_x",g.myStr="mouse_y",g.mclickedStr="mouse_clicked",g.mclicizquierdoStr="clic_izquierdo");g.init();return g};$jscomp.inherits(v,a.Control);v.prototype.init=function(){e=this.evaluator;q=a.hasTouchSupport;var c=e.eval(this.expresion);this.x=c[0][0];this.y=c[0][1];e.setVariable(this.xStr,this.x);e.setVariable(this.yStr,this.y);""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*e.eval(this.size),this.height=2*e.eval(this.size),this._w=q&&48>this.width?48:
this.width,this._h=q&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.imageSrc),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=
parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";e.setVariable(this.activoStr,0);e.setVariable(this.activeStr,0);this.setImage=!1;this.update()};v.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.x=e.getVariable(this.xStr);this.y=e.getVariable(this.yStr);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()};v.prototype.draw=function(){e=this.evaluator;this.drawIfValue&&(g=this.ctx,p=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&&g.drawImage(this.image,parseInt(r-b),parseInt(m-
k)),this.trace&&(p.save(),p.translate(r,m),p.scale(parseInt(b),parseInt(k)),p.beginPath(),p.arc(0,0,1,0,h),p.restore(),p.lineWidth=1,p.strokeStyle=this.trace.getColor(),p.stroke())):(b=parseInt(this.width/2),g.beginPath(),g.arc(r,m,b,0,h),g.fillStyle=this.colorInt.getColor(),g.fill(),g.lineWidth=1,g.strokeStyle=this.color.getColor(),g.stroke(),this.active&&(g.strokeStyle=this.colorInt.borderColor(),g.beginPath(),g.arc(r,m,b-2,0,h),g.stroke()),this.trace&&(p.strokeStyle=this.trace.getColor(),p.beginPath(),
p.arc(r,m,b,0,h),p.stroke())))};v.prototype.evalConst=function(){c.set(this.x,this.y);f=this.newt.findZero(c,1/this.space.scale,!0);this.x=f.x;this.y=f.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};v.prototype.evalConstXoY=function(){e=this.evaluator;l=e.getVariable(this.constVar);e.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=e.eval(this.constraint);e.setVariable(this.xStr,this.x);e.setVariable(this.yStr,this.y);e.setVariable(this.constVar,
l)};v.prototype.drawText=function(a,c){g=this.ctx;e=this.evaluator;"simpleText"==this.text.type?(g.fillStyle=this.color.getColor(),g.font=this.font,g.textBaseline="alphabetic",g.fillText(this.text.toString(e.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(c-1-this.height/2))):(g.fillStyle=this.color.getColor(),g.strokeStyle=this.color.getColor(),g.textBaseline="alphabetic",this.text.draw(g,parseInt(a+1+this.width/2),parseInt(c-1-this.height/2),this.decimals,this.fixed,"start",
!0,this.color.getColor()))};v.prototype.getContainer=function(){for(var a=this.parent.spaces,c,b=0,d=a.length;b<d;b++)if(c=a[b],c.id==this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};v.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,
0)};v.prototype.addEvents=function(){function c(c){document.body.focus();c.preventDefault();e.whichBtn=a.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&(e.parent.deactivateGraphicControls(),e.click=e.active=!0,e.evaluator.setVariable(e.activoStr,1),e.evaluator.setVariable(e.activeStr,1),e.evaluator.setVariable(e.mclickedStr,0),e.evaluator.setVariable(e.mclicizquierdoStr,0),e.posAnte=a.getCursorPosition(c,e.container),e.prePos={x:e.space.getAbsoluteX(e.x),y:e.space.getAbsoluteY(e.y)},e.evaluator.setVariable(e.mxStr,
e.space.getRelativeX(e.posAnte.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(e.posAnte.y)),e.parent.update(),window.addEventListener("touchend",b),window.addEventListener("touchmove",d),window.addEventListener("mouseup",b),window.addEventListener("mousemove",d))}function b(c){document.body.focus();c.preventDefault();c.stopPropagation();e.evaluator.setVariable(e.mclickedStr,1);e.evaluator.setVariable(e.mclicizquierdoStr,1);if(e.activeIfValue||e.active)e.click=!1,window.removeEventListener("mouseup",
b),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",b),window.removeEventListener("touchmove",d),l=a.getCursorPosition(c,e.container)||l,e.posX=e.prePos.x-(e.posAnte.x-l.x),e.posY=e.prePos.y-(e.posAnte.y-l.y),e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX)),e.evaluator.setVariable(e.yStr,e.space.getRelativeY(e.posY)),e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(l.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(l.y)),e.parent.updateControls(),
e.parent.update(),e.mouseCatcher.style.left=e.space.getAbsoluteX(e.x)-e._w/2+"px",e.mouseCatcher.style.top=e.space.getAbsoluteY(e.y)-e._h/2+"px";e.parent.deactivateGraphicControls();e.parent.updateControls()}function d(c){c.preventDefault();e.evaluator.setVariable(e.mclickedStr,0);e.evaluator.setVariable(e.mclicizquierdoStr,0);l=a.getCursorPosition(c,e.container);e.posX=e.prePos.x-(e.posAnte.x-l.x);e.posY=e.prePos.y-(e.posAnte.y-l.y);e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX));e.evaluator.setVariable(e.yStr,
e.space.getRelativeY(e.posY));e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(l.x));e.evaluator.setVariable(e.myStr,e.space.getRelativeY(l.y));80<Date.now()-g&&(e.parent.updateControls(),e.parent.update(),g=Date.now())}var g=0,l,e=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){e.over=!0});
this.mouseCatcher.addEventListener("mouseout",function(a){e.over=!1;e.click=!1})};a.GraphicControl=v;return a}(descartesJS||{});
descartesJS=function(a,h){var e,d,r,m,b,k,f,g,p,c;function q(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var l=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,v,x,u,n,y,w,z,B,E,J,G,H,A,I,C,M,N,O,F,D,K,L,P,R,Q,W,V,U,T,S=function(c){this.parent=c;this.parser=c.evaluator.parser;this.RTFparser=new a.RTFParser(c.evaluator)};S.prototype.parseButtonsConfig=function(a){var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var b=0,d=a.length;b<d;b++)switch(u=
a[b][0],n=a[b][1],x=h[u],x){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[x]=parseInt(n);break;case "about":case "config":case "init":case "clear":c[x]="true"===h[n];break;default:console.warn("Propiedad de botones no identificada: <"+u+"> valor: <"+n+">")}return c};S.prototype.parseSpace=function(c){y={};c=this.split(c);for(var b=0,d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=h[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Space",x){case "type":if("R2"===n||
"R3"===n)n=h[n];y[x]=n;break;case "id":a.DEBUG.idName=n;case "x_axis":case "y_axis":case "cID":case "file":case "info":y[x]=n;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":y[x]="true"===h[n];break;case "bg_display":case "render":y[x]=h[n];break;case "net":case "net10":case "axes":case "text":y[x]=""!=n?"false"===h[n]?"":new a.Color(n,this.parent.evaluator):"";break;case "O.x":y.OxExpr=n;break;case "O.y":y.OyExpr=n;break;case "image":y.imageSrc=
n;break;case "x":v=n;"%"===v[v.length-1]?(y.xPercentExpr=v.trim(),v=(this.parent.container.width*parseFloat(v)/100).toString()):v=n;y.xExpr=this.parser.parse(v);break;case "y":v=n;"%"===v[v.length-1]?(y.yPercentExpr=v.trim(),v=(this.parent.container.height*parseFloat(v)/100).toString()):v=n;y.yExpr=this.parser.parse(v);break;case "width":v=n.trim();y.wModExpr=v;"%"===v[v.length-1]?(y.wExpr=v,v=this.parent.container.width*parseFloat(v)/100):(v=parseFloat(n),v!=n&&(v=this.parent.container.width,y._w_=
n.trim()));y.w=v;break;case "height":v=n.trim();y.hModExpr=v;"%"===v[v.length-1]?(y.hExpr=v,v=this.parent.container.height*parseFloat(v)/100):(v=parseFloat(n),v!=n&&(v=this.parent.container.height,y._h_=n.trim()));y.h=v;break;case "drawif":""!=n&&(y.drawif=this.parser.parse(n));break;case "scale":v=parseFloat(n);isNaN(v)&&(v=48);y.scale=v;break;case "background":y.background=new a.Color(n,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+u+"> valor: <"+n+
">")}return new a["Space"+y.type](this.parent,y)};S.prototype.parseControl=function(c){w={type:"Numeric",gui:"Spinner"};c=this.split(c);for(var b=0,d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=h[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Control",x){case "type":v=h[n.trim()];"graphic"===v?v="GraphicControl":"text"===v&&(v="TextArea");w.type=q(v);break;case "gui":v=h[n];"textfield"===v&&(v="TextField");w[x]=q(v);break;case "id":a.DEBUG.idName=n;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "info":w[x]=
n;break;case "region":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":w[x]=h[n];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":w[x]="true"===h[n];break;case "color":case "colorInt":case "trace":w[x]=new a.Color(n,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==n&&(w[x]=this.parser.parse(n));break;
case "constraint":w.constraintExpr=n;break;case "image":w.imageSrc=n;break;case "space":w.spaceID=n;break;case "expresion":w.expresion=this.parser.parse(n.replace(")(",","));break;case "borderColor":w[x]="false"===h[n]?"":n;break;case "bold":"false"!=h[n]&&(w.bold="bold");break;case "italics":"false"!=h[n]&&(w.italics="italic");break;case "underlined":"false"!=h[n]&&(w.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)+"'"));w.valueExpr=this.parser.parse(e);w.valueExprString=e;break;case "incr":0!=n&&(w.incr=this.parser.parse(n));break;case "exponentialif":w.exponentialif=parseFloat(n);break;case "text":w.rawText=n;e=this.parseText(n);for(var g=0,l=e.length;g<l;g++)e[g]=this.parser.parse(e[g],!1);w.text=e;break;default:g=u.indexOf("."),e=h[u.substring(0,g)],g=h[u.substring(g+1)],"parameter"===e&&"font"===g?w.parameterFont=n:"Explanation"===e&&"font"===g?w.ExplanationFont=n:"tooltip"===e&&"font"===g?
w.tooltipFont=n:console.warn("Propiedad de control no identificada: <"+u+"> valor: <"+n+">")}return new a["Numeric"===w.type?w.gui:w.type](this.parent,w)};S.prototype.parseGraphic=function(c,b,d,e){z={rotateExp:e,parameter:"t"};c=this.split(c);e=0;for(var g=c.length;e<g;e++)if(u=c[e][0],n=c[e][1],x=h[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Graphic",""!=n)switch(x){case "type":a.DEBUG.idName=n;z[x]=q(h[n]);break;case "align":case "anchor":case "lineDash":z[x]=h[n];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":z[x]=
"true"===h[n];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":z[x]="false"===h[n]?"":new a.Color(n,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":z[x]=n;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":""!==n&&(z[x]=this.parser.parse(n));break;case "font_size":n=
n.trim();n.match(/^\[.*\]?/)&&(n=n.substring(1,n.length-1));""!==n&&(z[x]=this.parser.parse(n));break;case "space":z.spaceID=n;break;case "expresion":""!==n&&("Macro"!==z.type?(z.expresion=this.parser.parse(n),z.expresionString=n):z.expresion=n);break;case "text":z.text=n;break;case "file":var f=n.replace(/&squot;/g,"'");"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));f.match(l)&&(f="'"+f+"'");z.file=this.parser.parse(f);break;case "border":""!=n&&"false"!=h[n]&&(z.border=
new a.Color(n,this.parent.evaluator));break;default:if(void 0!=z.family&&u.substring(0,z.family.length+1)===z.family+".")switch(h[u.substring(z.family.length+1)]){case "interval":""!=n&&(z.family_interval=this.parser.parse(n));break;case "steps":""!=n&&(z.family_steps=this.parser.parse(n))}else if(void 0!=z.parameter&&u.match(z.parameter+"."))switch(z.parameter!==u.substring(0,u.indexOf(z.parameter)+z.parameter.length)&&(z.parameter=u.substring(0,u.indexOf(z.parameter)+z.parameter.length)),h[u.substring(z.parameter.length+
1)]){case "interval":""!=n&&(z.parameter_interval=this.parser.parse(n));break;case "steps":""!=n&&(z.parameter_steps=this.parser.parse(n))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+u+"> valor: <"+n+">")}b&&(z.abs_coord=b);d&&(z.background=d);return new a[z.type](this.parent,z)};S.prototype.parse3DGraphic=function(c,b,d,e){z={rotateExp:e,parameter:"t"};c=this.split(c);b=0;for(d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=h[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Graphic3D",
x){case "type":a.DEBUG.idName=n;v=h[n];switch(v){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":z.subType=v,v="OtherGeometry"}z[x]=q(v);break;case "model":case "lineDash":z[x]=h[n];break;case "fill":z[x]="false"===h[n]?"":new a.Color(n,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":z[x]="true"===
h[n];break;case "edges":"false"===h[n]?z[x]="":("true"===h[n]&&(n="808080"),z[x]=new a.Color(n,this.parent.evaluator));break;case "color":case "backcolor":z[x]=new a.Color(n,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":""!=n&&(z[x]=this.parser.parse(n));break;case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":z[x]=
n;break;case "space":z.spaceID=n;break;case "expresion":"Macro"!=z.type&&"Curve"!=z.type&&"Surface"!=z.type?(z.expresion=this.parser.parse(n),z.expresionString=n):z.expresion=n.replace(/\\n/g,";");break;case "text":z.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+"'");z.file=this.parser.parse(e);break;default:void 0!==z.family&&u.substring(0,z.family.length+1)===z.family+"."?"interval"===h[u.substring(z.family.length+
1)]?""!=n&&(z.family_interval=this.parser.parse(n)):""!=n&&(z.family_steps=this.parser.parse(n)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+u+"> valor: <"+n+">")}return new a[z.type+"3D"](this.parent,z)};S.prototype.parseAuxiliar=function(c){B={};c=this.split(c);for(var b=0,d=c.length;b<d;b++)c[b][1]=c[b][1].replace(/&squot;/g,"'");b=0;for(d=c.length;b<d;b++)switch(u=c[b][0],n=c[b][1],x=h[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Auxiliar",x){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=n;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":B[x]=n.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":B[x]="true"===h[n];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":B[x]=this.parser.parse(n);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":B[x]=
h[n];break;default:var e=u.indexOf("."),g=h[u.substring(0,e)];e=h[u.substring(e+1)];"parameter"===g&&"font"===e?B.parameterFont=n:console.warn("Propiedad del auxiliar no identificada: <"+u+"> valor: <"+n+">")}B.sequence?B.type="sequence":B.constant?B.type="constant":B.algorithm&&B.evaluate?B.type="algorithm":B.array&&!B.matrix&&")"!=B.id.charAt(B.id.length-1)?B.type="vector":B.matrix&&")"!=B.id.charAt(B.id.length-1)?B.type="matrix":B.event&&")"!=B.id.charAt(B.id.length-1)?B.type="event":"library"===
B.type?B.type="library":")"===B.id.charAt(B.id.length-1)?B.type="function":B.type="variable";a.DEBUG.typeName=B.type;switch(B.type){case "sequence":new a.Function(this.parent,B);break;case "constant":c=new a.Constant(this.parent,B);B.evaluate&&"always"===B.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,B));break;case "vector":c=new a.Vector(this.parent,B);B.evaluate&&"always"===B.evaluate&&this.parent.auxiliaries.push(c);break;
case "matrix":c=new a.Matrix(this.parent,B);B.evaluate&&"always"===B.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new a.Event(this.parent,B));break;case "library":new a.Library(this.parent,B);break;case "variable":new a.Variable(this.parent,B);break;default:new a.Function(this.parent,B)}};S.prototype.parseAction=function(c){E=c.action;J=c.parent;G=c.parameter;return E?new (a[q(E)])(J,G):{execute:function(){}}};S.prototype.parseAnimation=function(c){var b={};
c=this.split(c);for(var d=0,e=c.length;d<e;d++)switch(u=c[d][0],n=c[d][1],x=h[u],x){case "id":case "delay":case "init":case "doExpr":case "whileExpr":b[x]=n.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":b[x]="true"===h[n];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+u+">  <"+n+">")}return new a.Animation(this.parent,b)};S.prototype.parsePleca=function(l,h){l=this.split(l);d=e="";r=0;m="#536891";b="white";k=
"left";f="";g="SansSerif,BOLD,20";p="SansSerif,PLAIN,18";c=void 0;for(var q=0,x=l.length;q<x;q++)switch(u=l[q][0],n=l[q][1],u){case "title":e=n;break;case "subtitle":d=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":f=n;break;case "titlefont":g=""!=n?a.convertFont(n):a.convertFont(g);break;case "subtitlefont":p=
""!=n?a.convertFont(n):a.convertFont(p);break;default:console.warn("Propiedad de la pleca no identificada: <"+u+">  <"+n+">")}if(""===e&&""===d)return a.newHTML("div");O=p.substring(0,p.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=f&&(F=this.parent.getImage(f),D=F.height);c=a.newHTML("div",{id:"descartesPleca"});D?(c.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+h+"px;height:"+D+"px;background-color:"+m+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
F.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),c.appendChild(F)):c.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+h+"px;background:"+m+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");K=a.newHTML("div",{style:"padding:0;margin:0;font:"+g+";overflow:hidden;white-space:nowrap;"});K.innerHTML=e;L=a.newHTML("div");if(1===parseInt(r)){V=0;P=a.newHTML("div");P.innerHTML=d;document.body.appendChild(P);Q=O;do Q-=
V,P.setAttribute("style","padding:0;margin:0;font:"+p+";font-size:"+Q+"px;width:"+(h-30)+"px;line-height:"+Q+"px;"),R=P.offsetHeight,W=R/Q,V=1;while(1<W&&8<Q);document.body.removeChild(P);L.setAttribute("style","padding:0;margin:0;font:"+p+";font-size:"+Q+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else L.setAttribute("style","padding:0;margin:0;font:"+p+";line-height:1em;");L.innerHTML=d;c.appendChild(K);c.appendChild(L);c.imageHeight=D;return c};S.prototype.split=function(a){if("string"!==
typeof a)return[];H=[];a=(a||"").replace(/\\'/g,"\u2019");A=I=M=0;for(C=N=!1;A<a.length;)" "!==a.charAt(A)||C||A++," "===a.charAt(A)||C||(C=!0,M=A),"="!==a.charAt(A)||"'"!==a.charAt(A+1)||N||(N=!0,H[I]=[a.substring(M,A)],M=A+2,A+=2),N&&"'"===a.charAt(A)&&(C=N=!1,H[I].push(a.substring(M,A)),I++),"="!==a.charAt(A)||"'"===a.charAt(A+1)||N||(H[I]=[a.substring(M,A)],M=A+1,A++,U=a.substring(A).indexOf("="),-1===U?T=U=a.length:(U+=A,T=a.substring(A,U).lastIndexOf(" "),T=-1===T?a.length:T+A),H[I].push(a.substring(M,
T)),I++,C=!1,A=T),A++;return H};S.prototype.parseText=function(c){c=c||"";return c.match(/^\{\\rtf1/)?this.RTFparser.parse(c.substring(10)):new a.SimpleText(this.parent,c)};a.LessonParser=S;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(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,d=k(b);if(d===b&&1===d%2)return-Math.pow(-a,c)}return NaN}function e(a,c){x=[];x.type="matrix";x.rows=a;x.cols=c;n=0;for(y=c;n<y;n++)x[n]=Array(a).fill(0);return x}function d(a,c){l=a.rows;v=a.cols;x=e(l,v);var b;for(n=0;n<l;n++)for(u=0;u<v;u++){for(y=b=0;y<v;y++)b+=a[y][n]*c[u][y];x[u][n]=b}return x}function r(a,c,b){for(var d=e(b.length-1,b.length-1),g=0,l=d.length;g<
l;g++)for(var f=0;f<l;f++)d[g][f]=g<a?f<c?b[g][f]:b[g][f+1]:g<c?b[g+1][f]:b[g+1][f+1];return d}function m(a){if(1<a.cols){for(var c=0,b=1,d=0,e=a.cols;d<e;d++)c+=b*a[0][d]*m(r(0,d,a)),b=-b;return c}return a[0][0]}if(a.loadLib)return a;var b={},k=Math.floor,f,g,p,c,q,l,v,x,u,n,y,w=function(a,c){this.sep="";this.type=a;this.value=c;this.parent=null;this.childs=[]};w.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};w.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
w.prototype.replaceLastChild=function(a){p=this.childs.length-1;g=this.childs[p];g.parent=null;this.childs[p]=a;a.parent=this;return a};w.prototype.contains=function(a){if(this.value===a)return!0;for(var c=0,b=this.childs.length;c<b;c++)if(this.childs[c].contains(a))return!0;return!1};w.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",q=new w("compOperator","=="),q.addChild(this),q.addChild(new w("number","0")),c=this.getRoot(),c.setAllEvalFun(),
c):this};w.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,c=this.childs.length;a<c;a++)this.childs[a].setAllEvalFun()};w.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var c;this.evaluate=function(a,
b){c=a.variables[this.value];if("object"===typeof c&&void 0==c.length)return c.evaluate(a);void 0==c&&(b||a.matrices[this.value]?c=a.matrices[this.value]:a.vectors[this.value]&&(c=a.vectors[this.value]));return void 0!==c?c:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var g;this.evaluate=function(a){try{return g=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==g?g:0}catch(N){return 0}}}else if("identifier"===this.type&&
"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return g=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),this.childs[0].childs[1].evaluate(a)),void 0!==g?g:0}catch(N){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var q,p,w;this.evaluate=function(a){q=[];for(var c=0,d=this.childs[0].childs.length;c<d;c++)q[c]=this.childs[0].childs[c].evaluate(a);if("_Eval_"===this.value){f=0<q.length?q[0]:0;if("number"==
typeof f)return"NaN";f.match(",")&&parseFloat(f.replace(",","."))==f.replace(",",".")&&(f=f.replace(",","."));if(void 0==b[f]){p=f.match(/:=/g)?!0:!1;if(f.match(";")){var e=!1,g=[],l=0;c=0;for(d=f.length;c<d;c++){var h=f.charAt(c);"'"===h&&(e=!e);e||";"!==h||(g.push(f.substring(l,c)),l=c+1)}g.push(f.substring(l));f="("+g.join(")(")+")"}b[f]=a.parser.parse(f,p)}w=a.eval(b[f]);return void 0!=w?w:NaN}return a.functions[this.value].apply(a,q)}}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;l=b.rows;v=b.cols;x=e(l,v);for(n=0;n<l;n++)for(u=0;u<v;u++)x[u][n]=b[u][n]+c[u][n];return x}:"-"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==
c.type||"matrix"!==a.type)return c-a;l=c.rows;v=c.cols;x=e(l,v);for(n=0;n<l;n++)for(u=0;u<v;u++)x[u][n]=c[u][n]-a[u][n];return x}:"*"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==c.type||"matrix"!==a.type?c*a:d(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=e(a.length,a.length),g=m(a);if(0===g)a=
0;else{g=1/g;if(1<a.length)for(var l=0,f=a.length;l<f;l++){var h=g;for(var n=0;n<f;n++)b[n][l]=h*m(r(l,n,a)),h=-h;g=-g}else b[0][0]=g;a=b}c=0===a?e(c.rows,c.cols):d(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?h(c,a):1/h(c,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)===this.childs[1].evaluate(a))}:
"!="===this.value&&(this.evaluate=function(a){return+(this.childs[0].evaluate(a)!==this.childs[1].evaluate(a))});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<
this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2].evaluate(a)};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,c){return this.childs[0].evaluate(a,c)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var c=this.childs.length,b=[];if(1===c&&1===this.childs[0].childs.length&&"(expr)"===this.type)b=
this.childs[0].childs[0].evaluate(a);else for(var d=0;d<c;d++){var e=[];for(var g=0,l=this.childs[d].childs.length;g<l;g++)e.push(this.childs[d].childs[g].evaluate(a));b[d]=e}return b};else if("asign"===this.type){var y,A=this.childs[0],I=this.childs[1],C=A.childs[0]?A.childs[0].childs:null;this.evaluate=1===A.childs.length&&"square_bracket"===A.childs[0].type&&1===C.length?function(a){y=I.evaluate(a);a.setVector(A.value,C[0].evaluate(a),y);return y}:1===A.childs.length&&"square_bracket"===A.childs[0].type&&
2===C.length?function(a){y=I.evaluate(a);a.setMatrix(A.value,C[0].evaluate(a),C[1].evaluate(a),y);return y}:function(a){y=I.evaluate(a);return y.type?a.matrices[A.value]=y:"object"!==typeof a.variables[A.value]?a.variables[A.value]=y:0}}};a.Node=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g=/^\s+/,p=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,c=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,q=/^==|^!=|^<=|^<|^>=|^>|^#/,l=/^!|^~|^&&|^&|^\|\||^\|/,v=/^=|^:=/,x=/^[\?:]/,u=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,n=/^\[|^\]/,y=/^\(|^\)/,w=/^,/,z=/^;/,B=/\|/g,E=/\|\*/g,J=/\*\|/g,G,H=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
A=function(){};A.prototype.tokenize=function(A){function G(a,c,d){e.push({type:a,value:c});b=b.slice(d);r+=d;f=a}if(h=A){var H=A.indexOf("//");0<=H&&":"!==A[H-1]&&(A=A.substring(0,H));A=A.replace(/\\u(\S+) /g,function(a,c){return 39!==parseInt(c,16)?String.fromCharCode(parseInt(c,16)):a});A=A.replace(/&sup(.+);/g,"^ $1 ");A=A.replace(/&squot;/g,"'");A.match(/=\|\*/g)&&(A=A.replace(E,"'").replace(J,"'"));A.match(/=\|/g)&&(A=A.replace(B,"'"));H=A.trim();"|"==H.charAt(0)&&"|"==H.charAt(H.length-1)&&
(A=H.replace(B,"'"))}e=[];d=!1;r=0;b=A;for(f="";A&&r<A.length;)if(d=r,"'"==b[0]){for(k=1;"'"!=b[k];)if(k<b.length)k++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+h+"\u300b");return}m=b.substring(1,k);G("string",m,m.length+2)}else if(m=b.match(g))b=b.slice(m[0].length),r+=m[0].length;else if(m=b.match(u))m[0]=m[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),G("operator",m[0],m[0].length);else if(m=b.match(p))"number"===f&&
e.push({type:"operator",value:"*"}),G("identifier",m[0],m[0].length);else if(m=b.match(c))G("number",m[0],m[0].length);else if(m=b.match(q))H=m[0],"#"==H&&(H="!="),G("compOperator",H,m[0].length);else if(m=b.match(l))H=m[0],"||"==H?H="|":"&&"==H?H="&":"~"==H&&(H="!"),G("boolOperator",H,m[0].length);else if((m=b.match(v))&&!b.match(/^==/))G("asign",m[0],m[0].length);else if(m=b.match(x))G("conditional",m[0],m[0].length);else if(m=b.match(n))G("square_bracket",m[0],m[0].length);else if(m=b.match(y))"("==
m&&"number"===f&&e.push({type:"operator",value:"*"}),G("parentheses",m[0],m[0].length);else if(m=b.match(w))G("separator",m[0],m[0].length);else if(178===b.charCodeAt(0))e.push({type:"operator",value:"^"}),G("number",2,1);else if(179===b.charCodeAt(0))e.push({type:"operator",value:"^"}),G("number",3,1);else if(m=b.match(z))G("final_of_expression",m[0],m[0].length);else if(d==r){a.DEBUG.setError(a.DEBUG.EXPRESSION,h);return}return e};A.prototype.flatTokens=function(a,c){a=a||[];c=c||"";G="";for(var b=
0,d=a.length;b<d;b++)G="string"==a[b].type?G+"&squot;"+a[b].value+"&squot;":"identifier"!=a[b].type||a[b].value.match(H)?G+a[b].value:G+c+a[b].value;return G};a.Tokenizer=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function e(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-ceil-round-min-max-_Trace_-_Print_-_Num_-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var d=Date.now(),r,m,b,k,f,g,p,c,q,l,v,x,u=function(c){this.evaluator=c;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};u.prototype.setDefinition=function(a,c){this.definitions[a]=c};u.prototype.getDefinition=function(a){return this.definitions[a]};u.prototype.setVariable=function(a,c){this.variables[a]=c};u.prototype.getVariable=function(a,
c){c&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};u.prototype.setVector=function(a,c,b){this.vectors[a][c]=b};u.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};u.prototype.setMatrix=function(a,c,b,d){this.matrices[a][c][b]=d};u.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};u.prototype.setFunction=
function(a,c){this.functions[a]=c};u.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};u.prototype.parse=function(d,e){(b=this.tokenizer.tokenize(d))||(b=[]);k=null;e=!e||!1;r=c=p=g=0;for(m=b.length;r<m;r++){q=b[r];l=q.value;v=q.type;if("identifier"===v)if(r+1<m&&"parentheses"===b[r+1].type&&"("===b[r+1].value)this.getFunction(l);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(l):this.getMatrix(l);else{var n=l.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);n&&(this.variables[(n[1]||n[2]||n[3]||n[4]||n[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(l,!0)}"asign"===v&&e&&":="!=l&&(v="compOperator",l="==");if("asign"===v)if(f=new a.Node(v,l),null!=k)if("identifier"===k.type)k.parent&&k.parent.replaceLastChild(f),f.addChild(k),k=f,e=!0;else if("square_bracket"===k.type)f.addChild(k.parent),
k=f,e=!0;else{f.type="compOperator";f.value="==";for(e=!0;k.parent&&h(k.parent.value)>=h(f.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(f);f.addChild(k);k=f}else{console.info("Error1: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+l+", tipo: "+v+"}");break}else if("parentheses"===v&&"("===l||"square_bracket"===v&&"["===l)if(f=new a.Node(v,l),"("===l&&g++,"["===l&&p++,null===k)"("===l&&(new a.Node("(expr)","(expr)")).addChild(f),"["===l&&(new a.Node("[expr]","[expr]")).addChild(f),
k=f;else if("operator"===k.type||"boolOperator"===k.type||"compOperator"===k.type||"conditional"===k.type||"asign"===k.type)k.addChild(f),k=f;else if("sign"===k.type)k.addChild(f),k=f;else if("parentheses"===k.type&&"("===k.value)k.addChild(f),k=f;else if("square_bracket"===k.type&&"["===k.value)k.addChild(f),k=f;else if("parentheses"===k.type&&"()"===k.value)k.parent.addChild(f),k=f;else if("square_bracket"===k.type&&"[]"===k.value)k.parent.addChild(f),k=f;else if("identifier"===k.type)k.addChild(f),
k=f;else{console.info("Error2: en la expresi\u00f3n \u300a "+d+" \u300b, en el token ["+r+"] {valor: "+l+", tipo: "+v+"}");break}else if("parentheses"===v&&")"===l)if(g--,null===k)console.info("Error3: en la expresi\u00f3n \u300a "+d+" \u300b, en el token (valor:"+l+", tipo:"+v);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"===v&&"]"===l)if(p--,null===k)console.info("Error5: en la expresi\u00f3n \u300a "+
d+" \u300b, en el token (valor:"+l+", tipo:"+v);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: "+l+", tipo: "+v+"}");break}}else if("number"===v||"string"===v||"identifier"===v)if(f=new a.Node(v,l),null===k)k=f;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||"asign"===k.type)k.addChild(f),k=f;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,d);break}else if("operator"===v||"compOperator"===v||"boolOperator"===v)if(f=new a.Node(v,l),null===k)if("-"===l||"+"===l)f.type="sign",f.value="sign"+l,k=f;else if("!"===l)k=f;else{console.info("Error8: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+l+", tipo: "+v+"}");break}else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===
k.type||"asign"===k.type||"conditional"===k.type||"square_bracket"===k.type&&"["===k.value&&("-"===l||"+"===l||"!"===l)||"parentheses"===k.type&&"("===k.value&&("-"===l||"+"===l||"!"===l)){if("-"===l||"+"===l)f.type="sign",f.value="sign"+l;k.addChild(f);k=f}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||"asign"===k.type){for(;k.parent&&h(k.parent.value)>=h(f.value);)k=k.parent;
k.parent&&k.parent.replaceLastChild(f);f.addChild(k);k=f}else{console.info("Error9: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+l+", tipo: "+v+"}");break}else if("conditional"===v)if(f=new a.Node(v,l),null!=k)if("?"===f.value){for(c++;k.parent&&h(k.parent.value)>h(f.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(f);f.addChild(k);k=f}else{for(c--;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: "+l+", tipo: "+v+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+l+", tipo: "+v+"}");break}else if("separator"===v)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: "+l+", tipo: "+v+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+l+", tipo: "+v+"}");break}}0<
g&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,d);0>g&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,d);0<p&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,d);0>p&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,d);0!=c&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,d);(x=k?k.getRoot():null)&&x.setAllEvalFun();return x};u.prototype.registerDefaultValues=function(){var c=this;c.variables.rnd=Math.random;c.variables.pi=c.variables["\u03c0"]=a.returnValue(Math.PI);c.variables.e=a.returnValue(Math.E);c.variables.Infinity=
Infinity;c.variables["-Infinity"]=-Infinity;c.variables.isTouch=c.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;Object.defineProperties(c.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});c.functions.sqr=function(a){return a*a};c.functions.sqrt=c.functions["ra\u00edz"]=Math.sqrt;c.functions.exp=Math.exp;
c.functions.log=Math.log;c.functions.log10=function(a){return Math.log(a)/Math.log(10)};c.functions.abs=Math.abs;c.functions.ent=Math.floor;c.functions.sgn=function(a){return 0<a?1:0>a?-1:0};c.functions.ind=function(a){return a?1:0};c.functions.sin=c.functions.sen=Math.sin;c.functions.cos=Math.cos;c.functions.tan=Math.tan;c.functions.cot=function(a){return 1/Math.tan(a)};c.functions.sec=function(a){return 1/Math.cos(a)};c.functions.csc=function(a){return 1/Math.sin(a)};c.functions.sinh=c.functions.senh=
function(a){return(Math.exp(a)-Math.exp(-a))/2};c.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};c.functions.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};c.functions.coth=function(a){return 1/c.functions.tanh(a)};c.functions.sech=function(a){return 1/c.functions.cosh(a)};c.functions.csch=function(a){return 1/c.functions.sinh(a)};c.functions.asin=c.functions.asen=Math.asin;c.functions.acos=Math.acos;c.functions.atan=Math.atan;c.functions.atan2=Math.atan2;
c.functions.floor=Math.floor;c.functions.ceil=Math.ceil;c.functions.round=Math.round;c.functions.min=Math.min;c.functions.max=Math.max;c.functions._Trace_=c.functions._Print_=function(){console.info.apply(console,arguments);return 0};c.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};c.functions._Stop_Audios_=function(){c.evaluator.parent.stopAudios()};c.functions.esCorrecto=function(b,d,e){return a.esCorrecto(b,d,c.evaluator,
e)};c.functions.escorrecto=function(b,d,e){return a.escorrecto(b,d,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 d=a.indexOf(c);0<=d;)a=
a.substring(0,d)+b+a.substring(d+c.length),d=a.indexOf(c);return a};c.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};c.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};c.functions.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 d=c.matrices[b];if(d){for(var e="<"+b+">\\n",g=c.getVariable(b+".columnas_usadas")||d.cols||0,l=c.getVariable(b+".filas_usadas")||d.rows||0,f,h=0;h<g;h++){for(var k=0;k<l;k++)f=d[h][k],void 0!==f&&("string"==typeof f?f="'"+f+"'":"number"==typeof f&&(f=a.removeNeedlessDecimals(f.toFixed(6))),
e+=f+(k<l-1?" \u00a6 ":""));e=e.replace(/(\u00A6 )$/g,"")+"\\n"}return e+"</"+b+">"}return""};c.functions._StrToMatrix_=function(a,b){var d=[],g=!1,l=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,h=a.length;f<h;f++)a[f].match("<"+b+">")?(l=!0,g=a[f].trim().split("<"+b+">"),2==g.length&&""!=g[1]&&d.push(g[1].split(String.fromCharCode("166")).map(e)),g=!0):(a[f].match("</"+b+">")&&(g=a[f].trim().split("</"+b+">"),2==g.length&&""!=g[0]&&d.push(g[0].split(String.fromCharCode("166")).map(e)),
g=!1,f=a.length),g&&d.push(a[f].split(String.fromCharCode("166")).map(e)));c.matrices[b]=d;c.matrices[b].rows=d&&d[0]&&d[0].length?d[0].length:0;c.matrices[b].cols=d&&d.length?d.length:0;c.setVariable(b+".filas",c.matrices[b].rows);c.setVariable(b+".columnas",c.matrices[b].cols)}return l?"OK":"ERROR"};c.functions._GetVector_=function(a,b){return c.functions._StrToVector_(c.functions._Load_(a),b)};c.functions._VectorToStr_=function(a){var b=c.vectors[a];if(b){for(var d="<"+a+">\\n",e=c.getVariable(a+
".long_usada")||b._size_||0,g,l=0;l<e;l++)g=b[l],void 0!==g?("number"==typeof g&&(g=parseFloat(g)),d+=g+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};c.functions._StrToVector_=function(a,b){var d=[],g=!1,l=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,h=a.length;f<h;f++)a[f].match("<"+b+">")?g=l=!0:(a[f].match("</"+b+">")&&(g=!1,f=a.length),g&&d.push(e(a[f])));d._size_=d.length;c.vectors[b]=d;c.setVariable(b+".long",d.length);c.setVariable(b+".long_usada",d.length)}return l?
"OK":"ERROR"};c.functions._ExecStr_=function(a){return c.functions._ExecBlock_(a,"")};c.functions._ExecBlock_=function(a,b){var d=[],e=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,l=a.length;g<l;g++)a[g].match("<"+b+">")?(e=a[g].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&(d=d.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[g].match("</"+b+">")?(e=a[g].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&(d=d.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(d=d.concat(a[g].split(String.fromCharCode("166"))));
g=0;for(l=d.length;g<l;g++)e=d[g].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"}),g,l=null;a.newBlobContent=null;c.functions._Save_=function(e,f){c.evaluator.parent.removeButtonClick();1500<Date.now()-d&&(d=Date.now(),document.body.appendChild(b),l=f.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,
"\\"),g=new Blob(["\ufeff",l],{type:"text/plain;charset=utf-8"}),b.setAttribute("href",window.URL.createObjectURL(g)),b.setAttribute("download",e),l!=a.newBlobContent&&(b.click(),a.newBlobContent=l),document.body.removeChild(b));return 0};var f,h,k=a.newHTML("input",{type:"file"});k.addEventListener("change",function(b){f=b.target.files;h=new FileReader;h.onload=function(b){a.addExternalFileContent(f[0].name,b.target.result);c.setVariable("DJS.fileName",f[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<f.length&&h.readAsText(f[0])});c.functions._Open_=function(a){c.evaluator.parent.removeButtonClick();1500<Date.now()-d&&(c._callback=a,k.click(),d=Date.now());return 0};c.functions._AnchoDeCadena_=c.functions._strWidth_=function(c,b,d,e){return a.getTextWidth(c,a.convertFont(b+","+d+","+e))};c.functions._Rojo_=c.functions._Red_=function(c){return(new a.Color(c)).r/
255};c.functions._Verde_=c.functions._Green_=function(c){return(new a.Color(c)).g/255};c.functions._Azul_=c.functions._Blue_=function(c){return(new a.Color(c)).b/255};c.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=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};e.prototype.setDefinition=function(a,e){this.definitions[a]=e};e.prototype.getDefinition=function(a){return this.definitions[a]};e.prototype.setVariable=function(a,e){this.variables[a]=e};e.prototype.getVariable=
function(a){return this.variables[a]};e.prototype.setVector=function(a,e,m){e=0>e?0:h(e);this.vectors[a][e]=m};e.prototype.getVector=function(a,e){e=0>e?0:h(e);return this.vectors[a][e]};e.prototype.setMatrix=function(a,e,m,b){e=0>e?0:h(e);m=0>m?0:h(m);void 0==this.matrices[a][e]&&(this.matrices[a][e]=[]);this.matrices[a][e][m]=b};e.prototype.getMatrix=function(a,e,m){e=0>e?0:h(e);m=0>m?0:h(m);return this.matrices[a][e][m]};e.prototype.setFunction=function(a,e){this.functions[a]=e};e.prototype.getFunction=
function(a){return this.functions[a]};e.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new e;a.Evaluator=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p,c,q,l,v,x,u=function(c,b){this.parent=c;this.evaluator=c.evaluator;this.decimals=c.decimals;this.fixed=c.fixed;this.align=c.align||"left";this.anchor=c.anchor||"a_top_left";this.decimal_symbol=c.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==b;this.textStr=(b||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;b.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=b,this.textNodes=(new a.RTFParser(c.evaluator)).parse(b.substring(10))):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null))};u.prototype.draw=function(a,c,b,d,e){this["rtfNode"===this.type?"drawRTF":"drawText"](a,c,b,d,e)};u.prototype.drawText=function(c,g,l,f,k){h=
this.evaluator.eval(this.decimals);e=this.evaluator.eval(this.parent.width);d=this.evaluator.eval(this.parent.font_size);r=g.getColor?g.getColor():g;m=this.textToString(this.text,h,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=m.indexOf("[")&&(m=this.textToString(this.parseSimpleText(m),h,this.fixed));if(this.oldTextStr!==m||this.oldWidth!==e||this.oldSize!==d||this.oldColor!==
r||this.oldPosX!==l||this.oldPoxY!==f)b=new a.TextStyle({size:d,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}),this.textNodes=this.descarTeXParser.parse(m,this.evaluator,b),this.textNodes.update(l,f,h,this.fixed,this.align,this.anchor,r,e);k||this.textNodes.draw(c);this.oldTextStr=m;this.oldWidth=e;this.oldSize=d;this.oldColor=r;this.oldPosX=l;this.oldPoxY=f};u.prototype.drawRTF=function(a,c,b,d,
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,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,c,this.evaluator.eval(this.parent.width));e||this.textNodes.draw(a)};u.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");k=[];f="'";p=g=0;c=-1;for(v=a.length;g<v;)q=a.charAt(g),l=a.charAt(g-
1),"["===q&&"\\"===l?(k.push(a.substring(p,g-1)+"["),p=g+1):"]"===q&&"\\"===l?(k.push(a.substring(p,g-1)+"]"),p=g+1):"["===q&&-1===c?(k.push(a.substring(p,g)),p=g,c++):"["===q?c++:"]"===q&&0===c?(k.push(this.evaluator.parser.parse(a.substring(p,g+1))),p=g+1,c--):("]"==a.charAt(g)&&(c=0>c?c:c-1),f+=a.charAt(g)),g++;k.push(a.substring(p,g));return k};u.prototype.textToString=function(c,b,d){f="";if("rtfNode"!==c.type)for(var e=0,g=c.length;e<g;e++)"string"===typeof c[e]?f+=c[e]:(x=this.evaluator.eval(c[e])[0][0],
""!==x&&("string"===typeof x?f+=x:Infinity===x?f+="Infinity":-Infinity===x?f+="-Infinity":isNaN(x)||"NaN"===x?f+="NaN":(x=parseFloat(x),x=d?x.toFixed(b):a.removeNeedlessDecimals(x.toFixed(b)),f+=x.toString().replace(".",this.decimal_symbol))));return f};a.TextObject=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(){};e.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var d=[],e=null,b=0,k=a.length;a.charAt(0);var f=!1,g=!1,p=0;h="";for(var c=0;c<k;c++){var q=a.charAt(c);var l=a.charAt(c+1);"\\"===q&&"$"===l&&(g=!0);"{"===q?p++:"}"===q&&(p--,g&&0===p&&(g=!1));g?"_"===q?"{"===l?h+="\\subindex":(h+="\\subindex{"+l+"}",c++):"^"===q?"{"===l?h+="\\superindex":(h+="\\superindex{"+l+"}",c++):h+=q:h+=q}a=h;l=a.charAt(0);for(k=a.length;b<
k;)q=l,l=a.charAt(b+1),f&&("{"===q||"["===q||"\\"===q||" "===q?(f=!1," "===q&&(e={type:"ignore"},d.push(e))):e.value+=q),f||"\\"!==q?f||"{"!==q&&"["!==q?f||"}"!==q&&"]"!==q?f||(e&&"text"===e.type?e.value+=q:e&&"ignore"===e.type?(d.pop(),e=d[d.length-1]):(e={type:"text",value:q},d.push(e))):(e={type:"close",value:q},d.push(e)):(e={type:"open",value:q},d.push(e)):(f=!0,e={type:"command",value:""},d.push(e)),b++;return d};a.DescarTeXTokenizer=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(){this.tokenizer=new a.DescarTeXTokenizer};h.prototype.parse=function(e,d,h){e=this.tokenizer.tokenize(e);var m=new a.TextNode("","textBlock",h,null),b=new a.TextNode("","textLineBlock",h.clone(),null);m.addChild(b);for(var k=[],f=void 0,g=h,p=[h],c,q,l,v,x=!1,u=0,n=e.length;u<n;u++)if("text"===e[u].type)if("color_parameter"===f)q=new a.Color(e[u].value,d);else if("text_size_parameter"===f)l=parseFloat(e[u].value);else if("textLineBlock"===
b.nodeType){c=e[u].value.split(" ");for(var r=0,w=c.length;r<w;r++)""!==c[r]&&b.addChild(new a.TextNode(c[r],"text",g.clone(),null)),r+1<w&&b.addChild(new a.TextNode(" ","space",g.clone(),null))}else b.addChild(new a.TextNode(e[u].value,"text",g.clone(),null));else if("command"===e[u].type&&"curlyBracketOpen"===e[u].value)b.addChild(new a.TextNode("{","text",g.clone(),null));else if("command"===e[u].type&&"curlyBracketClose"===e[u].value)b.addChild(new a.TextNode("}","text",g.clone(),null));else if("command"===
e[u].type&&"squareBracketOpen"===e[u].value)b.addChild(new a.TextNode("[","text",g.clone(),null));else if("command"===e[u].type&&"squareBracketClose"===e[u].value)b.addChild(new a.TextNode("]","text",g.clone(),null));else if("command"===e[u].type&&"newline"===e[u].value)0===b.children.length&&b.addChild(new a.TextNode("","text",g.clone(),null)),b=new a.TextNode("","textLineBlock",h.clone(),null),m.addChild(b);else if("command"===e[u].type&&"b"===e[u].value)f="bold",k.push(f);else if("command"===e[u].type&&
"i"===e[u].value)f="italic",k.push(f);else if("command"===e[u].type&&"color"===e[u].value)f="color",k.push(f);else if("command"===e[u].type&&"ts"===e[u].value)f="text_size",k.push(f);else if("command"===e[u].type&&"sansserif"===e[u].value.toLowerCase())f="sansserif",k.push(f);else if("command"===e[u].type&&"serif"===e[u].value.toLowerCase())f="serif",k.push(f);else if("command"===e[u].type&&"monospace"===e[u].value.toLowerCase())f="monospace",k.push(f);else if("command"===e[u].type&&"c"===e[u].value)f=
"center",k.push(f);else if("command"===e[u].type&&"l"===e[u].value)f="left",k.push(f);else if("command"===e[u].type&&"r"===e[u].value)f="right",k.push(f);else if("command"===e[u].type&&"j"===e[u].value)f="justify",k.push(f);else if("command"===e[u].type&&"$"===e[u].value)f="formula",k.push(f),x=!0;else if("command"===e[u].type&&"sum"===e[u].value)f="sum",k.push(f);else if("command"===e[u].type&&"int"===e[u].value)f="integral",k.push(f);else if("command"===e[u].type&&"lim"===e[u].value)f="limit",k.push(f);
else if("command"===e[u].type&&"sqrt"===e[u].value)f="radical",k.push(f);else if("command"===e[u].type&&"subindex"===e[u].value)f="subIndex",k.push(f);else if("command"===e[u].type&&"superindex"===e[u].value)f="superIndex",k.push(f);else if("command"===e[u].type&&"frac"===e[u].value)f="numerator",k.push(f);else if("open"===e[u].type&&"{"===e[u].value&&void 0!==f)"bold"===f||"italic"===f?(g=g.clone(),g[f]=!0,p.push(g)):"sansserif"===f?(g=g.clone(),g.family="sansserif",p.push(g)):"serif"===f?(g=g.clone(),
g.family="serif",p.push(g)):"monospace"===f?(g=g.clone(),g.family="monospaced",p.push(g)):"text_size"===f?f="text_size_parameter":"text_size_text"===f?(g=g.clone(),g.size=l,p.push(g)):"color"===f?f="color_parameter":"color_text"===f?(g=g.clone(),g.color=q,p.push(g)):"center"===f||"left"===f||"right"===f||"justify"===f?(g=g.clone(),g.align=f,p.push(g),b=new a.TextNode("","textLineBlock",g.clone(),null),m.addChild(b)):"formula"===f?(g=g.clone(),g.italic=!0,p.push(g),v=new a.TextNode("","formula",g.clone(),
null),b.addChild(v),b=v):"subIndex"===f||"superIndex"===f?x?(g=g.clone(),p.push(g),v=new a.TextNode("",f,g.clone(),null),b.addChild(v),b=v):b.addChild(new a.TextNode("subIndex"===f?"_":"^","text",g.clone(),null)):"radical"===f?x&&(v=new a.TextNode("","radical",g.clone(),null),b.addChild(v),b=v,g=g.clone(),p.push(g),v=new a.TextNode("","index",g.clone(),null),b.addChild(v),b=v,f="index"):"index"===f?x&&(p.pop(),g=p[p.length-1],v=new a.TextNode("","radicand",g.clone(),null),b.addChild(v),b=v,f="radicand"):
"sum"===f||"integral"===f||"limit"===f?x&&(v=new a.TextNode("",f,g.clone(),null),b.addChild(v),b=v,g=g.clone(),p.push(g),v=new a.TextNode("","from",g.clone(),null),b.addChild(v),b=v,f="from"):"from"===f?x&&(v=new a.TextNode("","to",g.clone(),null),b.addChild(v),b=v,f="to"):"to"===f?x&&(p.pop(),g=p[p.length-1],v=new a.TextNode("","what",g.clone(),null),b.addChild(v),b=v,f="what"):"numerator"===f?x&&(v=new a.TextNode("","fraction",g.clone(),null),b.addChild(v),b=v,g=g.clone(),p.push(g),v=new a.TextNode("",
"numerator",g.clone(),null),b.addChild(v),b=v,f="numerator"):"denominator"===f&&(v=new a.TextNode("",f,g.clone(),null),b.addChild(v),b=v);else if("close"===e[u].type&&"}"===e[u].value&&void 0!==f){if("bold"===f||"italic"===f||"color_text"===f||"color"===f||"text_size_text"===f||"text_size"===f||"sansserif"===f||"serif"===f||"monospace"===f)p.pop(),g=p[p.length-1],k.pop(),f=k[k.length-1];else if("color_parameter"===f){f="color_text";continue}else if("text_size_parameter"===f){f="text_size_text";continue}else if("center"===
f||"left"===f||"right"===f||"justify"===f)p.pop(),g=p[p.length-1],k.pop(),f=k[k.length-1],e[u+1]&&"command"===e[u+1].type&&"newline"===e[u+1].value?b=m:(b=new a.TextNode("","textLineBlock",g.clone(),null),m.addChild(b));"formula"===b.nodeType?(x=!1,p.pop(),g=p[p.length-1],k.pop(),f=k[k.length-1],b=b.parent):"subIndex"===b.nodeType||"superIndex"===b.nodeType?x&&(p.pop(),g=p[p.length-1],k.pop(),f=k[k.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(k.pop(),f=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(),f=k[k.length-1],b=b.parent.parent):"numerator"===b.nodeType?(f="denominator",b=b.parent):"denominator"===b.nodeType&&(p.pop(),g=p[p.length-1],k.pop(),f=k[k.length-1],b=b.parent.parent)}var z,B,E=null,J=[];m.children.forEach(function(a){for(var c=0,b=a.children.length;c<b-1;c++)z=a.children[c],B=a.children[c+1],"text"===z.nodeType&&"text"===B.nodeType&&z.style.equals(B.style)?(null===E&&(E=
z,v=z.clone(),E.changeNodeType("word"),E.value="___"+v.value,E.addChild(v)),v=B.clone(),E.addChild(v),J.push(B),E.value+=v.value):E=null});J.forEach(function(a){a.parent.removeChild(a)});m.normalize();m.adjustFontSize();return m};a.DescarTeXParser=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=[a.sansserif_font,a.serif_font,a.monospace_font],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,b;for(b in this)this.hasOwnProperty(b)&&(d=d&&this[b]===a[b]);return d};
d.prototype.toString=function(){/arial|sansserif/i.test(this.family)?h=e[0]:/times|serif/i.test(this.family)?h=e[1]:/courier|monospaced/i.test(this.family)&&(h=e[2]);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+h).trim()};a.TextStyle=d;return a}(descartesJS||{});
descartesJS=function(a){function h(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function e(a){var c={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return c;var b=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";c.ascent=Math.ceil((p[a].ascent+25)*b/p[a].unitsPerEm);c.descent=Math.ceil(Math.abs((p[a].descent-25)*b/p[a].unitsPerEm));c.h=c.ascent+c.descent;return c}if(a.loadLib)return a;
var d="#000000",r=2,m=!1,b=new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z");b.svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";var k=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");k.svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";var f=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");f.svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
var g=function(a,b,d,e){this.type="rtfNode";this.evaluator=e;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=a;this.style=d;this.changeNodeType(b);this.drawBorder=function(){}};g.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;break;case "formula":this.draw=
this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=this.drawIntegral;break;case "sum":this.draw=
this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;
break;case "componentSpace":this.draw=this.drawComponentSpace}};g.prototype.clone=function(){for(var a=new g(this.value,this.nodeType,this.style.clone()),b=0,d=this.children.length;b<d;b++)a.addChild(this.children[b].clone());return a};g.prototype.toStr=function(){for(var a=this.value,b=0,d=this.children.length;b<d;b++)a+=" "+this.children[b].toStr();return a};g.prototype.stringify=function(){var a="{"+('"NT":"'+this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,d=this.children.length;b<
d;b++)a+=this.children[b].stringify()+(b==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};g.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};g.prototype.removeChild=function(a){var c=this.children.indexOf(a);-1!==c&&(a.parent=null,this.children.splice(c,1))};g.prototype.getFirstTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[0];return a};g.prototype.getLastTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[a.children.length-1];return a};g.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,d=this.parent.children.length;b<d;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};g.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];return null};g.prototype.queryAll=function(a){var c=[];"string"===typeof a&&
(a=new RegExp(a));for(var b=0,d=this.children.length;b<d;b++)c=c.concat(this.children[b].queryAll(a));this.nodeType.match(a)&&c.push(this);return c};g.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};g.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};g.prototype.normalize=function(){for(var a=this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),
b=0,d=a.length;b<d;b++)0===a[b].children.length&&a[b].addChild(new g("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(d=a.length;b<d;b++){var e=a[b];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,new g("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&
e.parent.insertAfter(e,new g("","text",e.parent.style))}return this};g.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,d=a.length;b<d;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};g.prototype.adjustFontSize=function(a){var c=this.style.size;"formula"===this.nodeType&&(a=!0);for(var b=0,d=this.children.length;b<d;b++)"text"===this.children[b].nodeType&&a?(this.children[b].style.size=c,this.children[b].styleString=this.children[b].style.toString()):"index"===
this.children[b].nodeType?(this.children[b].style.size=Math.max(parseInt(c-.5*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):"to"===this.children[b].nodeType||"from"===this.children[b].nodeType?(this.children[b].style.size=Math.max(parseInt(c-.2*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):"numerator"===this.children[b].nodeType||"denominator"===this.children[b].nodeType?(this.children[b].style.size=
Math.max(parseInt(c-.1*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):"subIndex"===this.children[b].nodeType||"superIndex"===this.children[b].nodeType?(this.children[b].style.size=Math.max(parseInt(c-.33*c),8),this.children[b].styleString=this.children[b].style.toString(),this.children[b].adjustFontSize(!0)):(a&&(this.children[b].style.size=c,this.children[b].styleString=this.children[b].style.toString()),this.children[b].adjustFontSize(a))};
g.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};g.prototype.update=function(a,b,e,g,f,h,k,p){r=e;m=g;d=k;this.metrics.w=this.metrics.h=0;k=b;if(20<=p)for(e=0;e<this.children.length;e++)this.children[e].breakLines(p);e=0;for(g=this.children.length;e<g;e++){var c=this.children[e];c.updateLine();c.metrics.offsetX=a;c.metrics.y=b;b+=parseInt(c.metrics.ascent+.5);c.metrics.offsetY=
b;f=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);b+=f;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}b=k;h=h||"";h.match("right")?a-=this.metrics.w:h.match("_center")&&(a-=this.metrics.w/2);h.match("bottom")?b-=this.metrics.h:h.match("center_")&&(b-=this.metrics.h/2);h=this.children;e=0;for(g=h.length;e<g;e++)"left"===h[e].style.align?h[e].metrics.offsetX=a:"right"===h[e].style.align?h[e].metrics.offsetX=a+this.metrics.w-h[e].metrics.w:"center"===
h[e].style.align?h[e].metrics.offsetX=a+(this.metrics.w-h[e].metrics.w)/2:"justify"===h[e].style.align&&20<=p&&(f=e<g-1?h[e+1].value:null,h[e].metrics.offsetX=a,"wrap"===f&&h[e].justifyAux(p)),h[e].metrics.y=b,b+=parseInt(h[e].metrics.ascent+.5),h[e].metrics.offsetY=b,f=parseInt(h[e].metrics.descent+.5)+parseInt(1.5+.05*h[e].style.size),b+=f};g.prototype.breakLines=function(c){for(var b,d=0,e=!1,f=[],h=0,k=this.children.length;h<k;h++)b=this.children[h],e?f.push(b):("text"===b.nodeType||"space"===
b.nodeType?(a.ctx.font=b.style.toString(),b.metrics.w=a.ctx.measureText(b.value).width):"word"===b.nodeType?b.updateLine():"formula"===b.nodeType&&b.updateFormula(),d+=b.metrics.w,d>c&&"space"!==b.nodeType&&0<h&&(e=!0,f.push(b)));if(0<f.length)for(c=new g("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),h=0,k=f.length;h<k;h++)f[h].parent&&f[h].parent.removeChild(f[h]),c.addChild(f[h])};g.prototype.updateLine=function(c){var b=this;if("textLineBlock"===this.nodeType||
"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var d=this.metrics.descent=0,g=this.children,f,h=0,k=g.length;h<k;h++){f=g[h];if("text"===f.nodeType){a.ctx.font=f.style.toString();var p=""!==f.value?f.value:"\u200a";f.metrics=e(a.ctx.font);f.metrics.w=a.ctx.measureText(p).width;f.metrics.offsetX=d;Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===f.nodeType?(a.ctx.font=
f.style.toString(),f.metrics=e(a.ctx.font),f.metrics.w=h===k-1?0:c?c:a.ctx.measureText(" ").width,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===f.nodeType&&(f.updateLine(),f.metrics.offsetX_aux=d,Object.defineProperties(f.metrics,{offsetX:{get:function(){return b.metrics.offsetX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===
f.nodeType&&(a.ctx.font=f.styleString,p=""!==f.value?f.value:"\u200a",f.metrics=e(a.ctx.font),f.metrics.w=a.ctx.measureText(p).width,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),f.clickCatcher||(f.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+f.metrics.w+"px;height:"+f.metrics.h+"px;cursor:pointer;"}),f.clickCatcher.rtfNode=f,f.clickCatcher.action=new a.OpenURL(this.evaluator.parent,
f.URL),f.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===f.nodeType&&(f.componentNumCtrl=this.evaluator.parent.getControlByCId(f.value),a.ctx.font=f.styleString,f.metrics=e(a.ctx.font),f.metrics.w=f.componentNumCtrl.w,f.metrics.h=f.componentNumCtrl.h,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));
"componentSpace"===f.nodeType?(f.componentSpace=this.evaluator.parent.getSpaceByCId(f.value),a.ctx.font=f.styleString,f.metrics=e(a.ctx.font),f.metrics.w=f.componentSpace.w,f.metrics.h=f.componentSpace.h,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===f.nodeType&&(f.updateFormula(),f.metrics.offsetX_aux=d,Object.defineProperties(f.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),f.metrics.w+=2*f.metrics.paddingX,f.metrics.ascent+=f.metrics.paddingY,f.metrics.descent+=f.metrics.paddingY,f.metrics.h+=2*f.metrics.paddingY,d+=2*f.metrics.marginX);this.metrics.w+=f.metrics.w+2*f.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,f.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,
f.metrics.descent);d+=f.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};g.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var b=this.children,d,g=0,f={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,p=b.length;k<p;k++){d=b[k];if("text"===d.nodeType){a.ctx.font=d.style.toString();var y=""!==d.value?d.value:
"\u200a";d.metrics=e(a.ctx.font);d.metrics.w=a.ctx.measureText(y).width;d.metrics.offsetX=g;Object.defineProperties(d.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});g+=c.metrics.marginX}else if("dynamicText"===d.nodeType){y=void 0===d.decimals?r:d.evaluator.eval(d.decimals);var w=void 0===d.fixed?m:d.fixed,z=d.evaluator.eval(d.value);parseFloat(z).toString()===z.toString()&&(z=w?parseFloat(z).toFixed(y):a.removeNeedlessDecimals(parseFloat(z).toFixed(y)),
z=(""+z).replace(".",d.decimal_symbol));d.evalValue=z;a.ctx.font=d.style.toString();d.metrics=e(a.ctx.font);d.metrics.marginX=parseInt(1.5+.075*this.style.size);d.metrics.paddingX=parseInt(1.5+.075*this.style.size);d.metrics.w=a.ctx.measureText(z).width+2*d.metrics.paddingX;d.metrics.offsetX_aux=g;Object.defineProperties(d.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+this.marginX}},
offsetY:{get:function(){return c.metrics.offsetY}}});g+=2*d.metrics.marginX}if("superIndex"===d.nodeType)y=d,y.updateFormula(),y.metrics.marginX=0*parseInt(1.5+.075*this.style.size),y.metrics.paddingX=0*parseInt(1.5+.075*this.style.size),y.metrics.paddingY=parseInt(1.5+.05*this.style.size),y.metrics.offsetX_aux=g,y.metrics.prevChild=f,Object.defineProperties(y.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY-this.descent+this.prevChild.metrics.descent-parseInt(2*this.prevChild.metrics.h/7)}}}),y.metrics.w+=2*y.metrics.paddingX,y.metrics.ascent+=y.metrics.paddingY,y.metrics.descent+=y.metrics.paddingY,y.metrics.h+=2*y.metrics.paddingY,this.metrics.ascent=y.metrics.descent-y.metrics.prevChild.metrics.descent+parseInt(2*y.metrics.prevChild.metrics.h/7)+y.metrics.ascent,g+=2*y.metrics.marginX;else if("subIndex"===
d.nodeType){var B=d;B.updateFormula();B.metrics.marginX=parseInt(1.5+.09375*this.style.size);B.metrics.paddingX=0*parseInt(1.5+.01875*this.style.size);B.metrics.paddingY=parseInt(1.5+.05*this.style.size);B.metrics.offsetX_aux=g;B.metrics.prevChild=f;Object.defineProperties(B.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+0*this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+
this.ascent+B.metrics.prevChild.metrics.descent-parseInt(4*B.metrics.prevChild.metrics.h/7)}}});B.metrics.w+=B.metrics.paddingX;B.metrics.ascent+=B.metrics.paddingY;B.metrics.descent+=B.metrics.paddingY;B.metrics.h+=2*B.metrics.paddingY;this.metrics.descent=B.metrics.ascent+B.metrics.prevChild.metrics.descent-parseInt(4*B.metrics.prevChild.metrics.h/7)+B.metrics.descent;g+=B.metrics.marginX}else if("fraction"===d.nodeType){w=d;w.updateFormula();y=w.children;z=y[0];y=y[1];w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=0*parseInt(1.5+.075*this.style.size);w.metrics.paddingY=0*parseInt(1.5+.05*this.style.size);var E=Math.max(z.metrics.w,y.metrics.w)+2*w.metrics.paddingX;w.metrics.prevChild=f;w.metrics.offsetX_aux=g;var J=parseInt(-f.metrics.descent+4*f.metrics.h/9);Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+J}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY-J}}});Object.defineProperties(z.metrics,{parent:{value:w},maxWidth:{value:E},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(y.metrics,{parent:{value:w},maxWidth:{value:E},x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});w.metrics.w=E;w.metrics.ascent=z.metrics.h+J+2*w.metrics.paddingY;w.metrics.descent=y.metrics.h-J+2*w.metrics.paddingY;w.metrics.h=z.metrics.h+y.metrics.h+4*w.metrics.paddingY;g+=2*w.metrics.marginX}else if("radical"===d.nodeType){f=d;f.updateFormula();y=f.children;
w=y[0];var G=y[1];f.metrics.marginX=parseInt(1.5+.075*this.style.size);f.metrics.paddingX=parseInt(1.5+.075*this.style.size);f.metrics.paddingY=parseInt(1.5+.05*this.style.size);f.metrics.offsetX_aux=g;Object.defineProperties(f.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}}});y=f.style.size;f.radicalSign={w:y,
scaleX:y/722,scaleY:G.metrics.h/1E3};z=parseInt(w.metrics.w-2*f.radicalSign.w/3);Object.defineProperties(f.radicalSign,{parent:{value:f},displaceIndex:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},y:{get:function(){return c.metrics.offsetY-G.metrics.ascent}}});Object.defineProperties(w.metrics,{parent:{value:f},displaceIndex:{value:z},fontSize:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(G.metrics,{parent:{value:f},displaceIndex:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,
0)}},offsetY:{get:function(){return c.metrics.offsetY}}});z=w.metrics.w<2*f.radicalSign.w/3?f.radicalSign.w:parseInt(w.metrics.w+f.radicalSign.w/3);f.metrics.w=z+2*f.metrics.paddingX+G.metrics.w;f.metrics.ascent=Math.max(G.metrics.ascent,w.metrics.h+2*y/5)+f.metrics.paddingY;f.metrics.descent=G.metrics.descent+f.metrics.paddingY;f.metrics.h=f.metrics.ascent+f.metrics.descent;g+=2*f.metrics.marginX}else if("sum"===d.nodeType){w=d;w.updateFormula();y=w.children;z=y[0];E=y[1];var H=y[2];w.metrics.marginX=
parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=g;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=d.style.toString();var A=e(a.ctx.font);f=parseInt(1.2*A.h);
y=parseInt(.5+780*f/1E3);w.sigmaSign={w:y,h:f,scale:f/1E3};var I=Math.max(E.metrics.w,z.metrics.w,w.sigmaSign.w);w.sigmaSign.parent=w;Object.defineProperties(w.sigmaSign,{sumWidth:{value:I},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+A.descent-(this.h+A.h)/2}}});y=A.descent-E.metrics.descent-(f+A.h)/2-w.metrics.paddingY;Object.defineProperties(E.metrics,{parent:{value:w},sumWidth:{value:I},
newBaselineTo:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});f=z.metrics.ascent+A.descent+(f-A.h)/2+w.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:w},sumWidth:{value:I},newBaselineFrom:{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+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(H.metrics,{parent:{value:w},sumWidth:{value:I},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
w.metrics.w=I+H.metrics.w+3*w.metrics.paddingX;w.metrics.ascent=Math.max(H.metrics.ascent,-y+E.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(H.metrics.descent,f+z.metrics.descent)+w.metrics.paddingY;w.metrics.h=w.metrics.ascent+w.metrics.descent;g+=2*w.metrics.marginX}else if("integral"===d.nodeType){w=d;w.updateFormula();y=w.children;z=y[0];E=y[1];H=y[2];w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+
.05*this.style.size);w.metrics.offsetX_aux=g;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=d.style.toString();A=e(a.ctx.font);I=parseInt(1.2*A.h);var C=parseInt(10.5+529*I/1E3);w.sign={w:C,h:I,scale:I/1E3};w.sign.parent=w;Object.defineProperties(w.sign,{x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+A.descent-(this.h+A.h)/2}}});y=A.descent-(I+A.h)/2-E.metrics.descent+I/3;Object.defineProperties(E.metrics,{parent:{value:w},integralWidth:{value:C},newBaselineTo:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
f=A.descent+z.metrics.ascent/2;Object.defineProperties(z.metrics,{parent:{value:w},integralWidth:{value:C},newBaselineFrom:{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+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});C=Math.max(parseInt(4*C/5)+E.metrics.w,parseInt(2*C/5+z.metrics.w))+w.metrics.paddingX;Object.defineProperties(H.metrics,
{parent:{value:w},whatDisplace:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});w.metrics.w=C+H.metrics.w+2*w.metrics.paddingX;w.metrics.ascent=Math.max(H.metrics.ascent,-y+E.metrics.ascent)+w.metrics.paddingY;w.metrics.descent=Math.max(H.metrics.descent,f+z.metrics.descent,I-w.metrics.ascent)+w.metrics.paddingY;
w.metrics.h=Math.max(w.metrics.ascent+w.metrics.descent,I);g+=2*w.metrics.marginX}else if("limit"===d.nodeType){f=d;f.updateFormula();y=f.children;var M=y[0];w=y[1];y=y[2];f.metrics.marginX=parseInt(1.5+.075*this.style.size);f.metrics.paddingX=parseInt(1.5+.075*this.style.size);f.metrics.paddingY=parseInt(1.5+.05*this.style.size);f.metrics.offsetX_aux=g;Object.defineProperties(f.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=d.style.toString();A=e(a.ctx.font);E=parseInt(.5+a.ctx.measureText("l\u00edm").width);z=parseInt(.5+a.ctx.measureText("\u2192").width);limitWidth=Math.max(E,M.metrics.w+z+w.metrics.w);f.limitText={parent:f};Object.defineProperties(f.limitText,{limitWidth:{value:limitWidth},limitTextWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-
this.limitTextWidth)/2}}});E=A.descent+Math.max(M.metrics.ascent,w.metrics.ascent,2*A.ascent/3)+f.metrics.paddingY;f.limitArrow={parent:f};Object.defineProperties(f.limitArrow,{newBaseline:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+M.metrics.w}},y:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(M.metrics,{parent:{value:f},newBaseline:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(w.metrics,{parent:{value:f},arrowWidth:{value:z},newBaseline:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+M.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(y.metrics,{parent:{value:f},limitWidth:{value:limitWidth},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});f.metrics.w=limitWidth+y.metrics.w+3*f.metrics.paddingX;f.metrics.ascent=Math.max(y.metrics.ascent,A.ascent)+f.metrics.paddingY;f.metrics.descent=E+Math.max(M.metrics.descent,
w.metrics.descent)+f.metrics.paddingY;f.metrics.h=f.metrics.ascent+f.metrics.descent;g+=2*f.metrics.marginX}else if("matrix"===d.nodeType){z=d;z.updateFormula();y=z.children;E=z.rows;H=z.columns;z.metrics.marginX=parseInt(1.5+.075*this.style.size);z.metrics.paddingX=parseInt(1.5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=g;Object.defineProperties(z.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=d.style.toString();A=e(a.ctx.font);I=[];C=[];f=0;for(var N=E*H;f<N;f++){var O=parseInt(f/H);var F=f%H;I[O]=Math.max(I[O]||0,y[f].metrics.h);C[F]=Math.max(C[F]||0,y[f].metrics.w)}var D=(1+H)*z.metrics.paddingX;for(f=0;f<H;f++)D+=C[f];var K=(1+E)*z.metrics.paddingY;for(f=0;f<E;f++)K+=I[f];w=A.descent-A.h/2;f=0;for(N=E*H;f<N;f++)O=parseInt(f/H),F=f%H,y[f].metrics.offsetX_aux=h(C,F)+(C[F]-
y[f].metrics.w)/2+F*z.metrics.paddingX,y[f].metrics.offsetY_aux=h(I,O)+(I[O]-y[f].metrics.h)/2+(1+O)*z.metrics.paddingY,Object.defineProperties(y[f].metrics,{parent:{value:z},matrixH:{value:K},dispY:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});
z.metrics.w=D;z.metrics.ascent=K/2-w;z.metrics.descent=K/2+w;z.metrics.h=z.metrics.ascent+z.metrics.descent;g+=2*z.metrics.marginX}else if("defparts"===d.nodeType){z=d;z.updateFormula();y=d.children;E=d.parts;z.metrics.marginX=parseInt(1.5+.075*this.style.size);z.metrics.paddingX=parseInt(1.5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=g;Object.defineProperties(z.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=d.style.toString();A=e(a.ctx.font);H=0;I=z.metrics.paddingY;w=A.descent-A.h/2;for(f=0;f<E;f++)y[f].metrics.offsetY_aux=I,H=Math.max(H,y[f].metrics.w),I+=y[f].metrics.h+z.metrics.paddingY,Object.defineProperties(y[f].metrics,{parent:{value:z},dispY:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.defpartsH=I;z.metrics.w=H+4*z.metrics.paddingX;z.metrics.ascent=I/2-w;z.metrics.descent=I/2+w;z.metrics.h=z.metrics.ascent+z.metrics.descent;g+=2*z.metrics.marginX}else if("numerator"===d.nodeType||"denominator"===d.nodeType||"index"===d.nodeType||"radicand"===d.nodeType||"from"===
d.nodeType||"to"===d.nodeType||"what"===d.nodeType||"element"===d.nodeType)d.updateFormula(),d.metrics.paddingX=parseInt(1.5+.075*this.style.size),d.metrics.paddingY=parseInt(1.5+.05*this.style.size),d.metrics.w+=2*d.metrics.paddingX,d.metrics.ascent+=d.metrics.paddingY,d.metrics.descent+=d.metrics.paddingY,d.metrics.h=d.metrics.ascent+d.metrics.descent;f=d;this.metrics.ascent=Math.max(this.metrics.ascent,d.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,d.metrics.descent);this.metrics.w+=
d.metrics.w+2*d.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;g+=d.metrics.w}};g.prototype.justifyAux=function(a){for(var c=0,b=0,d=0,e=this.children.length;d<e-1;d++)"space"===this.children[d].nodeType?c++:b+=this.children[d].metrics.w;this.updateLine((a-b)/c)};g.prototype.drawTextBlock=function(a){a.fillStyle=d;for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};g.prototype.drawTextLineBlock=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};
g.prototype.drawText=function(a){if(""!==this.value){var c=this.metrics.x,b=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;a.font=this.style.toString();a.beginPath();this.style.overline&&(a.rect(c,b-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(c,b+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());
if(this.style.border){var e=a.strokeStyle;a.lineWidth=1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,c,b);a.strokeStyle=e}a.fillText(this.value,c,b)}};g.prototype.drawWord=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a)};g.prototype.drawSpace=function(a){};g.prototype.drawDynamicText=function(a){var c=this.metrics.x+this.metrics.paddingX,b=this.metrics.y;a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:d;a.font=this.style.toString();a.beginPath();this.style.overline&&(a.rect(c,b-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(c,b+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,c,b);this.drawBorder(a,"blue")};g.prototype.drawHyperlink=function(a){var c=this.metrics.x,b=this.metrics.y;
this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling));this.clickCatcher.style.left=c+"px";this.clickCatcher.style.top=b-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(c,b-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString();a.beginPath();
a.rect(c,b+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,c,b)};g.prototype.drawFormula=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;a.beginPath();var c=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-
parseInt(c/2),this.metrics.w,c);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};g.prototype.drawNumDen=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSuperIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSubIndex=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,
"blue")};g.prototype.drawRadical=function(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;c.translate(this.radicalSign.x,this.radicalSign.y);c.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);a.isMsEdge?this.drawRadicalSign(c):c.fill(b);c.restore();c.beginPath();c.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var e=0,f=this.children.length;e<
f;e++)this.children[e].draw(c);this.drawBorder(c,"blue")};g.prototype.drawSum=function(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;c.translate(this.sigmaSign.x,this.sigmaSign.y);c.scale(this.sigmaSign.scale,this.sigmaSign.scale);a.isMsEdge?this.drawSigmaSign(c):c.fill(k);c.restore();for(var b=0,e=this.children.length;b<e;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};g.prototype.drawIntegral=function(c){c.save();
c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;c.translate(this.sign.x,this.sign.y);c.scale(this.sign.scale,this.sign.scale);a.isMsEdge?this.drawIntegralSign(c):c.fill(f);c.restore();for(var b=0,e=this.children.length;b<e;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};g.prototype.drawLimit=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?
this.style.color.getColor():this.style.color:d;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};g.prototype.drawMatrix=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;a.beginPath();a.moveTo(this.metrics.x+
b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent);a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent);a.lineTo(this.metrics.x+b,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent);a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent);a.lineTo(this.metrics.x+
this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h);a.lineTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawDefparts=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);b=parseInt(1.5+this.style.size/25);c=b/2;a.lineWidth=b;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:d;a.beginPath();
b=3*this.metrics.marginX;var e=b/2;a.moveTo(this.metrics.x+c+b,this.metrics.y+c-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent,this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent,this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h/
2,this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2,this.metrics.x+c,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2,this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2,this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+c+e,this.metrics.y+c-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+c+e,this.metrics.y-c-this.metrics.ascent+this.metrics.h,this.metrics.x+c+e,this.metrics.y-c-this.metrics.ascent+this.metrics.h,this.metrics.x+c+b,this.metrics.y-c-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawGenericBlock=function(a){for(var c=0,b=this.children.length;c<b;c++)this.children[c].draw(a);this.drawBorder(a,"blue")};g.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+
this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};g.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&
this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};g.prototype.drawRadicalSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();
a.fill();a.stroke()};g.prototype.drawSigmaSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.fill();a.stroke()};g.prototype.drawIntegralSign=
function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,
41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.fill();a.stroke()};g.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};g.prototype.toRTF=function(){var a=[],b=[],d=
"";this.mergeTextNodes();for(var e=0,f=this.children.length;e<f;e++){var g=this.children[e];"textLineBlock"===g.nodeType&&(d+=g.toRTFAux(a,b)+(1<f&&e<f-1?"\\par":""))}g="{\\fonttbl";e=0;for(f=a.length;e<f;e++)g+="\\f"+e+"\\fcharset0 "+a[e]+";";a="";if(0<b.length){a="{\\colortbl";e=0;for(f=b.length;e<f;e++)a+=b[e];a+="}"}return"{\\rtf1\\uc0"+(g+"}")+a+d+"}"};g.prototype.toRTFAux=function(a,b){for(var c,e,f,g=null,h="",k,p,m,q,r,J=0,G=this.children.length;J<G;J++)k=p="",c=this.children[J],m=this.addToFontTable(c.style.family,
a),q=c.style.size,r=this.addToColorTable(c.style.color,b),null===r&&0<b.length&&(r=this.addToColorTable(d,b)),r!==g&&(k+="\\cf"+r,g=r),m!==e&&(k+="\\f"+m,e=m),q!==f&&(k+="\\fs"+2*q,f=q),c.style.italic&&(k+="\\i",p="\\i0"+p),c.style.bold&&(k+="\\b",p="\\b0"+p),c.style.underline&&(k+="\\ul",p="\\ulnone"+p),c.style.overline&&(k+="\\ol",p="\\olnone"+p),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==k?k+" "+c.value+p:""!==h&&
"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=c):"formula"===c.nodeType?h+="{\\*\\mjaformula"+c.formulaToRTF(e,f,g,a,b)+"}":"componentSpace"===c.nodeType?h+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(h+="{\\*\\component\\NumCtrl "+c.value+"}");return h};g.prototype.formulaToRTF=function(a,b,e,f,g){for(var c,h="",l,k,p,m,q=0,r=this.children.length;q<r;q++)l=k="",c=this.children[q],p=this.addToFontTable(c.style.family,f),m=this.addToColorTable(c.style.color,g),null===
m&&0<g.length&&(m=this.addToColorTable(d,g)),p!==a&&(l+="\\f"+p,a=p),m!==e&&(l+="\\cf"+m,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(e=m),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=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==l?l+" "+c.value+k:"}"!==h.charAt(h.length-
1)?" "+c.value:c.value,h+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,h+=l+"{\\expr "+c.value+"\\decimals "+(c.decimals||2)+"\\fixed"+(c.fixed?1:0)+"}"+k):"fraction"===c.nodeType||"radical"===c.nodeType||"index"===c.nodeType||"radicand"===c.nodeType||"sum"===c.nodeType||"integral"===c.nodeType||"limit"===c.nodeType||"from"===c.nodeType||"to"===c.nodeType||"what"===c.nodeType||"element"===c.nodeType?h+="{\\"+c.nodeType+c.formulaToRTF(a,b,e,f,g)+"}":"numerator"===c.nodeType?
h+="{\\num"+c.formulaToRTF(a,b,e,f,g)+"}":"denominator"===c.nodeType?h+="{\\den"+c.formulaToRTF(a,b,e,f,g)+"}":"superIndex"===c.nodeType?h+="{\\supix"+c.formulaToRTF(a,b,e,f,g)+"}":"subIndex"===c.nodeType?h+="{\\subix"+c.formulaToRTF(a,b,e,f,g)+"}":"matrix"===c.nodeType?h+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,e,f,g)+"}":"defparts"===c.nodeType&&(h+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,e,f,g)+"}");return h};g.prototype.addToFontTable=function(a,
b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};g.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};g.prototype.mergeTextNodes=function(){for(var a=[],b=null,d=0,e=this.children.length;d<e;d++)"text"===
this.children[d].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[d].style)&&(this.children[d].value=b.value+this.children[d].value,a.push(b)):this.children[d].mergeTextNodes(),b=this.children[d];d=0;for(e=a.length;d<e;d++)this.removeChild(a[d])};var p={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,
xHeight:1082,unitsPerEm:2048}};a.TextNode=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=String.fromCharCode,e,d,r,m,b,k,f,g,p,c,q,l=function(){};l.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];e=[];d="";m=r=0;k=a.charAt(0);f=!1;for(g="text";r<a.length;)b=k,k=a.charAt(r+1),f?"\\"===k||"{"===k||"}"===
k||" "===k||";"===k?(f=!1,d+=b," "===k?(r++,k=a.charAt(r+1),q=!0):q=!1,(p=d.match(/^'([0-9a-f]{2})/))?(c="","text"===g&&(c=e.pop().value),d=c+=h(parseInt(p[1],16))+d.substring(3)):(p=d.match(/^u[0-9]+/))?(c="","text"===g&&(c=e.pop().value),d=c+=h(p[0].substring(1))):("{"===d||"}"===d||"\\"==b?(e.push({type:"text",value:d+(q?" ":"")}),g="text"):(e.push({type:"controlWord",value:d}),g="controlWord"),d="")):"{"==b||"}"==b||"\\"==b?(f=!1,e.push({type:"text",value:b}),g="text"):d+=b:"\\"===b?(f=!0,""!==
d&&(e.push({type:"text",value:d}),g="text",d="")):"{"===b?(m++,""!==d&&(e.push({type:"text",value:d}),d=""),e.push({type:"openBlock",value:m}),g="openBlock"):"}"===b?(""!==d&&(e.push({type:"text",value:d}),d=""),e.push({type:"closeBlock",value:m}),g="closeBlock",m--):d+=b,r++;""!==d&&e.push({type:"text",value:d});return e};a.RTFTokenizer=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,e,d,r,m,b,k,f,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H,A,I,C,M,N,O,F=function(c){this.evaluator=c;this.tokenizer=new a.RTFTokenizer};F.prototype.parse=function(D){e=this.tokenizer.tokenize(D);d={};m=2;if("openBlock"===e[0].type&&"fonttbl"===e[1].value){for(r=e[0].value;"closeBlock"!==e[m].type&&e[m].value!==r;)d[e[m].value]=e[m+2].value.substring(0,e[m+2].value.length-1),m+=3;m++}b={};k=0;if("openBlock"===e[m].type&&"colortbl"===e[m+1].value){r=
e[m++].value;for(m++;"closeBlock"!==e[m].type&&e[m].value!==r;)f=parseInt(e[m++].value.substring(3)).toString(16),g=parseInt(e[m++].value.substring(5)).toString(16),p=parseInt(e[m++].value.substring(4)).toString(16),";"===e[m].value&&m++,b[k++]="#"+(2>f.length?"0"+f:f)+(2>g.length?"0"+g:g)+(2>p.length?"0"+p:p);m++}x=v=l=null;M=C=I=B=z=w=y=n=u=!1;E=[new a.TextStyle];J=E[0];H=G=-1;A=[];c=N=new a.TextNode("","textBlock",J,this.evaluator);q=new a.TextNode("","textLineBlock",J,this.evaluator);c.addChild(q);
N.stableWidth=!0;N.hasFormula=!1;D=m;for(var F=e.length;D<F;D++){if("controlWord"==e[D].type)if(d[e[D].value])J.set({family:d[e[D].value]});else if(e[D].value.match(/^fs(\d+)/))J.set({size:parseInt(e[D].value.match(/^fs(\d+)/)[1]/2)});else if("b"==e[D].value)J.set({bold:!0}),0<A.length&&A[A.length-1].style.set({bold:!0});else if("b0"==e[D].value)J.set({bold:!1}),0<A.length&&A[A.length-1].style.set({bold:!1});else if("i"==e[D].value)J.set({italic:!0}),0<A.length&&A[A.length-1].style.set({italic:!0});
else if("i0"==e[D].value)J.set({italic:!1}),0<A.length&&A[A.length-1].style.set({italic:!1});else if("ul"==e[D].value)J.set({underline:!0}),0<A.length&&A[A.length-1].style.set({underline:!0});else if("ulnone"==e[D].value)J.set({underline:!1}),0<A.length&&A[A.length-1].style.set({underline:!1});else if("ol"==e[D].value)J.set({overline:!0}),0<A.length&&A[A.length-1].style.set({overline:!0});else if("olnone"==e[D].value)J.set({overline:!1}),0<A.length&&A[A.length-1].style.set({overline:!1});else if(e[D].value.match(/^cf(\d+)/))J.set({color:b[parseInt(e[D].value.substring(2))]}),
0<A.length&&(A[A.length-1].style.color=J.color);else if("par"==e[D].value){c=new a.TextNode("","textLineBlock",J.clone(),this.evaluator);if("textBlock"!=q.nodeType)for(q=q.parent;"textBlock"!=q.nodeType;)q=q.parent;q.addChild(c);q=c}else if("mjaformula"==e[D].value)N.hasFormula=!0,H=G,u=!0,c=new a.TextNode("","formula",J.clone(),this.evaluator),q.addChild(c),q=c,A[A.length-1]=c;else if("fraction"==e[D].value||"radicand"==e[D].value||"radical"==e[D].value||"what"==e[D].value||"sum"==e[D].value||"integral"==
e[D].value||"limit"==e[D].value){var L=A[A.length-2].style.clone();c=new a.TextNode("",e[D].value,L,this.evaluator);A[A.length-2].addChild(c);A[A.length-1]=c}else"index"==e[D].value?(L=A[A.length-2].style.clone(),L.size=h(parseInt(L.size-.5*L.size),8),c=new a.TextNode("",e[D].value,L,this.evaluator),A[A.length-2].addChild(c),A[A.length-1]=c):"to"==e[D].value||"from"==e[D].value?(L=A[A.length-2].style.clone(),L.size=h(parseInt(L.size-.2*L.size),8),c=new a.TextNode("",e[D].value,L,this.evaluator),A[A.length-
2].addChild(c),A[A.length-1]=c):"num"==e[D].value||"den"==e[D].value?(L=A[A.length-2].style.clone(),L.size=h(Math.round(L.size-.1*L.size),8),"num"==e[D].value?c=new a.TextNode("","numerator",L,this.evaluator):"den"==e[D].value&&(c=new a.TextNode("","denominator",L,this.evaluator)),A[A.length-2].addChild(c),A[A.length-1]=c):"subix"==e[D].value||"supix"==e[D].value?(L=A[A.length-2].style.clone(),L.size=h(Math.floor(L.size-.33*L.size),8),"subix"==e[D].value?c=new a.TextNode("","subIndex",L,this.evaluator):
"supix"==e[D].value&&(c=new a.TextNode("","superIndex",L,this.evaluator)),c.originalStyle=A[A.length-2].style.clone(),A[A.length-2].addChild(c),A[A.length-1]=c):"defparts"==e[D].value||"matrix"==e[D].value||"element"==e[D].value?(L=A[A.length-2].style.clone(),c=new a.TextNode("",e[D].value,L,this.evaluator),A[A.length-2].addChild(c),A[A.length-1]=c,"defparts"==e[D].value?x=c:"matrix"==e[D].value&&(v=c)):"parts"==e[D].value?B=!0:"rows"==e[D].value?w=!0:"columns"==e[D].value?z=!0:"expr"==e[D].value?
(N.stableWidth=!1,n=!0):"decimals"==e[D].value?y=!0:"fixed1"==e[D].value?l.fixed=!0:"fixed0"==e[D].value?l.fixed=!1:"component"!=e[D].value&&("NumCtrl"==e[D].value?I=!0:"Space"==e[D].value?C=!0:"hyperlink"==e[D].value&&(M=!0));if("text"==e[D].type)if(B)x.parts=parseInt(e[D].value),B=!1;else if(w)v.rows=parseInt(e[D].value),w=!1;else if(z)v.columns=parseInt(e[D].value),z=!1;else if(y)l.decimals=this.evaluator.parser.parse(e[D].value+""),y=!1;else if(M){O=e[D].value.split("|")[0];L=J.clone();c=new a.TextNode(O,
"hyperlink",L,this.evaluator);c.URL=e[D].value.split("|")[1];if("textLineBlock"!=q.nodeType)for(q=q.parent;"textLineBlock"!=q.nodeType;)q=q.parent;q.addChild(c);M=!1}else if(I)c=new a.TextNode(e[D].value,"componentNumCtrl",J.clone(),this.evaluator),q.addChild(c),I=!1;else if(C)c=new a.TextNode(e[D].value,"componentSpace",J.clone(),this.evaluator),q.addChild(c),C=!1;else if(n)L=A[A.length-2].style.clone(),O=this.evaluator.parser.parse(e[D].value),c=new a.TextNode(O,"dynamicText",L,this.evaluator),
A[A.length-2].addChild(c),l=A[A.length-1]=c,n=!1;else if(n||u)!n&&u&&(O=e[D].value,c=new a.TextNode(O,"text",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(c));else{O=e[D].value;c=new a.TextNode(O,"text",J.clone(),this.evaluator);if("textLineBlock"!=q.nodeType)for(q=q.parent;"textLineBlock"!=q.nodeType;)q=q.parent;q.addChild(c)}else if("openBlock"==e[D].type)G=e[D].value,J=J.clone(),E.push(J),A.push(null);else if("closeBlock"==e[D].type)e[D].value==H&&(H=-1,u=!1,q=q.parent),E.pop(),
J=E[E.length-1],A.pop();else if("("==e[D].type||")"==e[D].type)L=A[A.length-1].style.clone(),L.italic="",c=new a.TextNode(e[D].type,"mathSymbol",L,this.evaluator),A[A.length-1].addChild(c);else if("+"==e[D].type||"-"==e[D].type||"*"==e[D].type||"="==e[D].type)c=new a.TextNode(e[D].type,"mathSymbol",A[A.length-1].style.clone(),this.evaluator),A[A.length-1].addChild(c)}return N.normalize()};a.RTFParser=F;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k,f,g,p,c,q=function(c,b){this.parent=c;e=this.evaluator=this.parent.evaluator;d=e.parser;this.id="";this.type="2D";this.xExpr=d.parse("0");this.yExpr=d.parse("0");this.w=parseInt(c.container.width);this.h=parseInt(c.container.height);this.drawif=d.parse("1");this.fixed=2===c.version;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=
new a.Color("ffffff");this.net=2!=c.version?new a.Color("c0c0c0"):"";this.net10=2!=c.version?new a.Color("808080"):"";this.axes=2!=c.version?new a.Color("808080"):"";this.text=new a.Color("ffafaf");this.numbers=!1;this.y_axis=this.x_axis=2!=c.version?"":" ";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=c.zIndex;this.plecaHeight=c.plecaHeight||0;this.displaceRegionNorth=c.displaceRegionNorth||
0;this.displaceRegionWest=c.displaceRegionWest||0;Object.assign(this,b);this.initSpace()};q.prototype.initSpace=function(){h=this.parent;e=this.evaluator;r=this.id;this.resizable||(this.displaceRegionNorth=h.displaceRegionNorth||0,this.displaceRegionSouth=h.displaceRegionSouth||0,this.displaceRegionEast=h.displaceRegionEast||0,this.displaceRegionWest=h.displaceRegionWest||0,f=parseInt(h.container.width),k=parseInt(h.container.height),void 0!=this.wExpr&&(this.w=parseInt(f-this.displaceRegionWest-
this.displaceRegionEast)*parseFloat(this.wExpr)/100),void 0!=this.hExpr&&(this.h=parseInt(k-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.hExpr)/100),void 0!=this.xPercentExpr&&(this.xExpr=e.parser.parse((parseInt(f-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.xPercentExpr)/100).toString())),void 0!=this.yPercentExpr&&(this.yExpr=e.parser.parse((parseInt(k-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.yPercentExpr)/100).toString())),this.x=
e.eval(this.xExpr)+this.displaceRegionWest,this.y=e.eval(this.yExpr)+this.plecaHeight+this.displaceRegionNorth,this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px"),0<=this.y?(m=k-this.y,this.h>m&&(this.h=m)):(m=this.h+this.y,this.h=m>=k?k:m),0<=this.x?(b=f-this.x,this.w>b&&(this.w=b)):(b=this.w+this.x,this.w=b>=f?f:b));""==this.imageSrc&&/vacio.gif$/i.test(this.imageSrc.trim())||(this.image=h.getImage(this.imageSrc));this.OxExpr&&(p=this.OxExpr,"%"===p[p.length-
1]?this.Ox=this.w*parseFloat(p)/100:(g=parseFloat(p),g!=p&&(g=0),this.Ox=g));this.OyExpr&&(c=this.OyExpr,"%"===c[c.length-1]?this.Oy=this.h*parseFloat(c)/100:(g=parseFloat(c),g!=c&&(g=0),this.Oy=g));""!==this.id&&2!==h.version?(e.setVariable(r+"._w",this.w),e.setVariable(r+"._h",this.h),e.setVariable(r+".escala",this.scale),e.setVariable(r+".Ox",this.Ox),e.setVariable(r+".Oy",this.Oy),e.setVariable(r+".mouse_x",0),e.setVariable(r+".mouse_y",0),e.setVariable(r+".mouse_pressed",0),e.setVariable(r+".mouse_clicked",
0),e.setVariable(r+".clic_izquierdo",0)):(g=e.getVariable("_w"),void 0===g&&(g=this.w),e.setVariable("_w",g),g=e.getVariable("_h"),void 0===g&&(g=this.h),e.setVariable("_h",g),g=e.getVariable("escala"),void 0===g&&(g=this.scale),e.setVariable("escala",g),g=e.getVariable("Ox"),void 0===g&&(g=this.Ox),e.setVariable("Ox",g),g=e.getVariable("Oy"),void 0===g&&(g=this.Oy),e.setVariable("Oy",g),e.setVariable("mouse_x",0),e.setVariable("mouse_y",0),e.setVariable("mouse_pressed",0),e.setVariable("mouse_clicked",
0),e.setVariable("clic_izquierdo",0),2==h.version&&""===this.x_axis&&""===this.y_axis&&(this.axes=""));this.w_2=this.w/2;this.h_2=this.h/2};q.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};q.prototype.addGraph=function(a,c){"2D"===this.type&&c||"3D"===this.type&&!c||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};q.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,
0)};q.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};q.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};q.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};q.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e=function(d){h=this;h.parent=d;h.width=228;h.vSpace=25;h.container=a.newHTML("div",{style:"box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:"+(h.width+27)+"px;height:460px;"});h.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(h.width+27)+"px;height:"+h.vSpace+
"px;line-height:"+h.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});h.movable.innerHTML="Descartes";h.container.appendChild(h.movable);h.ctrs=[]};e.prototype.init=function(){function d(b){h.newPos=a.getCursorPosition(b,document.body);h.container.style.left=h.initialPosition.x+(h.newPos.x-h.oldPos.x)*a.cssScale+"px";h.container.style.top=h.initialPosition.y+(h.newPos.y-h.oldPos.y)*a.cssScale+"px"}function e(a){a.preventDefault();document.body.removeEventListener("mousemove",
d);document.body.removeEventListener("mouseup",e)}h=this;document.body.appendChild(this.container);for(var m=h.parent.evaluator.parser,b=0,k=h.ctrs.length;b<k;b++)h.ctrs[b].expresion=m.parse("(0,"+(h.vSpace+23+35*b)+","+h.width+",35)"),h.ctrs[b].update();h.numCtr=k;b=new a.Button(h.parent,{region:"external",name:"english"==h.language?"about":"cr\u00e9ditos",font_size:m.parse("15"),expresion:m.parse("(0,"+h.vSpace+","+h.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(h.parent,
{region:"external",name:"config",font_size:m.parse("15"),action:"config",expresion:m.parse("("+h.width/2+","+h.vSpace+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"init":"inicio",font_size:m.parse("15"),action:"init",expresion:m.parse("(0,"+(h.vSpace+23+35*k)+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"clear":"limpiar",font_size:m.parse("15"),action:"clear",expresion:m.parse("("+h.width/
2+","+(h.vSpace+23+35*k)+","+h.width/2+",25)")})).update();m=new a.Button(h.parent,{region:"external",name:"english"==h.language?"close":"cerrar",font_size:m.parse("15"),expresion:m.parse("("+h.width/4+","+(h.vSpace+46+35*k)+","+h.width/2+",25)")});m.update();m.btn.addEventListener("click",function(a){h.hide()});h.setPositionAndSize();h.movable.addEventListener("mousedown",function(b){b.preventDefault();h.oldPos=a.getCursorPosition(b,document.body);h.initialPosition={x:h.container.offsetLeft,y:h.container.offsetTop};
document.body.addEventListener("mousemove",d);document.body.addEventListener("mouseup",e)});h.hide()};e.prototype.addCtr=function(a){this.ctrs.push(a)};e.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};e.prototype.hide=function(){this.container.style.display="none"};e.prototype.setPositionAndSize=function(){h=this;var a=h.vSpace+46+35*h.numCtr+25+10;h.container.style.left=Math.max(parseInt(window.innerWidth-h.width)/2,0)+"px";h.container.style.top="5px";h.container.style.height=
window.innerHeight<h.vSpace+75?h.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,e=Math.round,d=2*Math.PI,r=a.convertFont("SansSerif,PLAIN,12"),m=a.convertFont("Monospaced,PLAIN,12"),b,k,f,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H,A,I,C,M,N,O,F,D,K,L,P,R,Q=function(c,d){b=d=a.Space.call(this,c,d)||this;b.ratio=c.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio});b.canvas.style.zIndex=b.zIndex;b.canvas.style.width=
b.backCanvas.style.width=b.w+"px";b.canvas.style.height=b.backCanvas.style.height=b.h+"px";b.ctx=b.canvas.getContext("2d");b.backCtx=b.backCanvas.getContext("2d");b.ctx.imageSmoothingEnabled=b.backCtx.imageSmoothingEnabled=!1;b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.numericalControlContainer=a.newHTML("div",{id:b.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.container=
a.newHTML("div",{id:b.id,class:"DescartesSpace2DContainer",style:"left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";"});b.parent.arquimedes&&"#f0f8fa"===b.background.getColor()&&(b.container.style.boxShadow="0 0 5px 0 #b8c4c8");b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numericalControlContainer);c.container.insertBefore(b.container,c.loader);var e=b.id+".image";b.parent.images[e]=b.canvas;b.parent.images[e].ready=
1;b.parent.images[e].complete=b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=b.id+".back";b.parent.images[e]=b.backCanvas;b.parent.images[e].ready=1;b.parent.images[e].complete=b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=""!==b.id&&2!==c.version?b.id+".":"";b.OxStr=e+"Ox";b.OyStr=e+"Oy";b.scaleStr=e+"escala";b.wStr=e+"_w";b.hStr=e+"_h";b.mxStr=e+"mouse_x";b.myStr=e+"mouse_y";b.mpressedStr=e+"mouse_pressed";b.mclickedStr=e+"mouse_clicked";b.mclickIzqStr=e+"clic_izquierdo";
b.click=0;b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};return d};$jscomp.inherits(Q,a.Space);Q.prototype.init=function(){b=this;this.initSpace();b.canvas&&(b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=
b.backCanvas.style.height=b.h+"px")};Q.prototype.update=function(a){b=this;k=b.evaluator;f=b.parent;if(b.resizable){if(K=b.evaluator.eval(b.wModExpr),L=b.evaluator.eval(b.hModExpr),b.old_w!=K||b.old_h!=L)b.w=K,b.h=L,b.w_2=b.w/2,b.h_2=b.h/2,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){p=b.x!==k.eval(b.xExpr)+b.displaceRegionWest;c=b.y!==k.eval(b.yExpr)+f.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||p||c||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=p?k.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=c?k.eval(b.yExpr)+f.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(p||c)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.drawTrace=!b.spaceChange&&(!b.fixed&&!b.click||b.fixed);b.spaceChange&&(b.backCtx.setTransform(b.ratio,0,0,b.ratio,0,0),b.drawBackground());b.ctx.setTransform(b.ratio,0,0,b.ratio,0,0);b.draw()}else b.container.style.display=
"none"};Q.prototype.drawBackground=function(){b=this;k=b.evaluator;g=b.backCtx;g.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);g.fillStyle=b.backColor=b.background.getColor();g.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===b.bg_display?g.drawImage(b.image,0,0):"stretch"===b.bg_display?g.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(g.fillStyle=g.createPattern(b.image,"repeat"),g.fillRect(0,0,b.w,b.h)):
"imgcenter"===b.bg_display&&g.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));l=b.scale;v=0;for(x=0>b.w+b.h?0:b.w+b.h;l>x;)l/=10,v++;for(;l<x/10;)l*=10;g.lineWidth=1;""!==b.net&&(g.strokeStyle=b.net.getColor(),b.drawMarks(g,l/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&""!==b.net&&""!==b.net10)g.strokeStyle=b.net10.getColor(),b.drawMarks(g,l,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");g.strokeStyle=b.axes.getColor();g.beginPath();
"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(g.moveTo(0,h(b.h/2+b.Oy)+.5),g.lineTo(b.w,h(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(g.moveTo(h(b.w/2+b.Ox)+.5,0),g.lineTo(h(b.w/2+b.Ox)+.5,b.h));g.lineWidth=1.2;g.stroke();g.lineWidth=1;b.drawMarks(g,l,4,a);b.drawMarks(g,l/2,2,a);b.drawMarks(g,l/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)g.fillStyle=""!==b.axes?b.axes.getColor():"#000",g.font=r,g.textAlign="right",g.textBaseline="alphabetic","no"!=b.x_axis&&g.fillText(b.x_axis,
h(b.w)-2,h(b.h/2+b.Oy)+12),"no"!=b.y_axis&&g.fillText(b.y_axis,h(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(g.fillStyle=b.axes.getColor(),g.font=r,g.textAlign="start",g.textBaseline="bottom",l>(b.w+b.h)/2?b.drawNumbers(g,l/5,l<=b.scale?v+1:v):l>(b.w+b.h)/4?b.drawNumbers(g,l/2,l<=b.scale?v+1:v):b.drawNumbers(g,l,v));a=0;for(var c=this.backGraphics.length;a<c;a++)this.backGraphics[a].draw()};Q.prototype.draw=function(){b=this;g=b.ctx;g.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,c=b.graphics.length;a<
c;a++)q=b.graphics[a],""!==q.trace&&b.drawTrace&&q.drawTrace(),q.draw();a=0;for(c=b.graphicsCtr.length;a<c;a++)b.graphicsCtr[a].draw();""!=b.text&&b.click&&"L"===b.whichBtn&&(g.save(),g.strokeStyle=g.fillStyle=b.text.getColor(),g.lineWidth=1,g.font=m,g.textAlign="center",g.textBaseline="alphabetic",A=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(b.scale.toString().length),I=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(b.scale.toString().length),C="("+A+","+I+")",M=h(g.measureText(C).width/
2),N=b.getAbsoluteX(b.mouse_x),O=b.getAbsoluteY(b.mouse_y),F=h(N),D=h(O-10),F+M>b.w?F=b.w-M:0>F-M&&(F=M),D+1>b.h?D=b.h:0>D-14&&(D=15),g.fillText(C,F,D),g.beginPath(),g.arc(N,O,2.5,0,d,!0),g.stroke(),g.restore())};Q.prototype.drawMarks=function(a,c,b,d){u=this.w;n=this.h;G=E=0;J=u;H=n;z=h(u/2+this.Ox);B=h(n/2+this.Oy);0<=b&&(E=z-b,J=z+b,G=B-b,H=B+b);a.beginPath();if(!d||d&&!d.match("x"))for(b=-e(z/c);(y=z+e(b*c))<u;b++)a.moveTo(y+.5,G+.5),a.lineTo(y+.5,H+.5);if(!d||d&&!d.match("y"))for(b=-e(B/c);(w=
B+e(b*c))<n;b++)a.moveTo(E+.5,w+.5),a.lineTo(J+.5,w+.5);a.stroke()};Q.prototype.drawNumbers=function(a,c,b){u=this.w;n=this.h;z=h(u/2+this.Ox);B=h(n/2+this.Oy);for(b=-e(z/c);(y=z+e(b*c))<u;b++)a.fillText(parseFloat((b*c/this.scale).toFixed(4)),y+1,B-2);for(b=-e(B/c);(w=B+e(b*c))<n;b++)0!==parseFloat(-b*c/this.scale)&&a.fillText(parseFloat((-b*c/this.scale).toFixed(4)),z+5,w+5)};Q.prototype.addEvents=function(){function c(a){window.focus();document.activeElement.blur();if(g.evaluator.variables[g.id+
".DESCARTESJS_no_fixed"]||!g.fixed||g.sensitive_to_mouse_movements)g.click=0,g.evaluator.setVariable(g.mpressedStr,0),g.evaluator.setVariable(g.mclickedStr,1),g.evaluator.setVariable(g.mclickIzqStr,1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",c),a.stopPropagation(),a.preventDefault(),g.parent.update()}function b(c){document.activeElement.blur();window.focus();c.stopPropagation();c.preventDefault();g.click=0;g.evaluator.setVariable(g.mpressedStr,0);g.evaluator.setVariable(g.mclickedStr,
1);g.evaluator.setVariable(g.mclickIzqStr,1);"R"===g.whichBtn&&(window.removeEventListener("mousemove",e),g.posZoom==g.posZoomNew&&a.showConfig&&(g.parent.externalSpace.show(),g.posZoom=!1,g.posZoomNew=!0));window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",b);g.parent.deactivateGraphicControls();g.parent.update()}function d(c){g.posAnte=a.getCursorPosition(c,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.mxStr,
g.mouse_x);g.evaluator.setVariable(g.myStr,g.mouse_y);g.evaluator.setVariable(g.mclickedStr,0);g.evaluator.setVariable(g.mclickIzqStr,0);g.parent.update()}function e(c){c.preventDefault();g.posZoomNew=a.getCursorPosition(c,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.parent.update()}function f(c){c.preventDefault();c.stopPropagation();g.fixed||(g.posNext=a.getCursorPosition(c,g.container),P=g.posAnte.x-g.posNext.x,R=g.posAnte.y-g.posNext.y,
g.evaluator.setVariable(g.OxStr,g.Ox-P),g.evaluator.setVariable(g.OyStr,g.Oy-R));d(c)}var g=this;g.posZoom=g.posZoomNew=null;g.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(g.evaluator.variables[g.id+".DESCARTESJS_no_fixed"]||!g.fixed||g.sensitive_to_mouse_movements)g.parent.clearClick(),g.click=1,g.evaluator.setVariable(g.mpressedStr,
1),g.evaluator.setVariable(g.mclickedStr,0),g.evaluator.setVariable(g.mclickIzqStr,0),g.parent.deactivateGraphicControls(),d(a),window.addEventListener("touchmove",f),window.addEventListener("touchend",c),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",d);this.canvas.addEventListener("mousedown",function(c){window.focus();document.activeElement.blur();c.stopPropagation();c.preventDefault();g.parent.clearClick();g.click=1;g.parent.deactivateGraphicControls();
g.whichBtn=a.whichBtn(c);"R"===g.whichBtn?(window.addEventListener("mouseup",b),g.posZoom=a.getCursorPosition(c,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,window.addEventListener("mousemove",e))):"L"===g.whichBtn&&(g.evaluator.setVariable(g.mpressedStr,1),g.evaluator.setVariable(g.mclickedStr,0),g.evaluator.setVariable(g.mclickIzqStr,0),d(c),window.addEventListener("mousemove",f),window.addEventListener("mouseup",b))});document.addEventListener("visibilitychange",function(a){b(a)})};
a.Space2D=Q;return a}(descartesJS||{});
descartesJS=function(a){var h,e,d;function r(c,b){F=a.subtract3D(c,a.scalarProduct3D(b,a.dotProduct3D(c,b)));D=a.add3D(c,a.scalarProduct3D(F,-2));K=a.norm3D(D);return 0!==K?a.scalarProduct3D(D,1/K):a.scalarProduct3D(c,-1)}if(a.loadLib)return a;var m=Math.floor,b=Math.max,k=Math.cos,f=Math.sin,g,p,c,q,l,v,x,u,n,y,w,z,B,E,J,G,H=[],A,I,C,M,N,O,F,D,K,L,P,R=function(b,d){c=d=a.Space.call(this,b,d)||this;c.backCanvas=a.newHTML("canvas",{id:c.id+"_background",width:c.w+"px",height:c.h+"px"});c.canvas=a.newHTML("canvas",
{id:c.id+"_canvas",width:c.w+"px",height:c.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+c.zIndex+";"});c.ctx=c.canvas.getContext("2d");c.ctx.imageSmoothingEnabled=!1;var e=c.id+".image";c.parent.images[e]=c.canvas;c.parent.images[e].ready=1;c.parent.images[e].complete=!0;c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);c.graphicControlContainer=a.newHTML("div",{id:c.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+c.zIndex+";"});c.numericalControlContainer=
a.newHTML("div",{id:c.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+c.zIndex+";"});c.container=a.newHTML("div",{id:c.id,class:"DescartesSpace3DContainer",style:"left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"});c.container.appendChild(c.backCanvas);c.container.appendChild(c.canvas);c.container.appendChild(c.graphicControlContainer);c.container.appendChild(c.numericalControlContainer);b.container.insertBefore(c.container,b.loader);c.eye={x:0,y:0,z:0};c.lights=[{x:50,
y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];e=0;for(var g=c.lights.length;e<g;e++)c.lights[e]=a.normalize3D(c.lights[e]);c.light3={x:0,y:0,z:0};c.intensity=[.4,.5,.3,0];c.userIntensity=0;c.dim=1;c.tmpIntensity=[];c.OxStr=c.id+".Ox";c.OyStr=c.id+".Oy";c.scaleStr=c.id+".escala";c.wStr=c.id+"._w";c.hStr=c.id+"._h";c.obsStr=c.id+".observador";c.ojoXStr=c.id+".Ojo.x";c.ojoYStr=c.id+".Ojo.y";c.ojoZStr=c.id+".Ojo.z";c.rotZStr=c.id+".rot.z";c.rotYStr=c.id+".rot.y";c.userIDimStr=c.id+".userIlum.dim";
c.userIIStr=c.id+".userIlum.I";c.userIxStr=c.id+".userIlum.x";c.userIyStr=c.id+".userIlum.y";c.userIzStr=c.id+".userIlum.z";c.evaluator.setVariable(c.rotZStr,0);c.evaluator.setVariable(c.rotYStr,0);c.evaluator.setVariable(c.userIDimStr,c.dim);c.evaluator.setVariable(c.userIIStr,c.userIntensity);c.evaluator.setVariable(c.userIxStr,0);c.evaluator.setVariable(c.userIyStr,0);c.evaluator.setVariable(c.userIzStr,0);P=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},c);c.evaluator.setFunction(c.id+
"._X3D2D_",function(a,b,d){P.vertices[0].x=a;P.vertices[0].y=b;P.vertices[0].z=d;P.computeDepth(c);return P.projVert[0].x});c.evaluator.setFunction(c.id+"._Y3D2D_",function(a,b,d){P.vertices[0].x=a;P.vertices[0].y=b;P.vertices[0].z=d;P.computeDepth(c);return P.projVert[0].y});c.resizable&&(c.wModExpr=b.evaluator.parser.parse(c.wModExpr),c.hModExpr=b.evaluator.parser.parse(c.hModExpr));c.ratio=1;c.addEvents();return d};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){c=this;c.initSpace();c.canvas&&
(c.canvas.width=c.backCanvas.width=c.w,c.canvas.height=c.backCanvas.height=c.h,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px");c.w_2=c.w/2;c.h_2=c.h/2;c.w_plus_h=c.w+c.h;c.oldMouse={x:0,y:0};c.S={x:c.h/1080*-20.6*(40/c.scale),y:0,z:0};c.Ojo={x:3*c.w_2,y:0,z:0};c.evaluator.setVariable(c.ojoXStr,c.Ojo.x);c.evaluator.setVariable(c.ojoYStr,c.Ojo.y);c.evaluator.setVariable(c.ojoZStr,c.Ojo.z)};R.prototype.update=function(a){c=this;g=c.evaluator;
p=c.parent;g.setVariable(c.wStr,c.w);g.setVariable(c.hStr,c.h);c.drawIfValue=0<g.eval(c.drawif);if(c.drawIfValue){c.resizable&&(wModExpr=c.evaluator.eval(c.wModExpr),hModExpr=c.evaluator.eval(c.hModExpr),c.old_w!=wModExpr||c.old_h!=hModExpr)&&(c.w=wModExpr,c.h=hModExpr,c.w_2=c.w/2,c.h_2=c.h/2,g.setVariable(c.wStr,c.w),g.setVariable(c.hStr,c.h),c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=c.backCanvas.height=c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=
c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px",a=!0,c.S={x:c.h/1080*-20.6*(40/c.scale),y:0,z:0},c.Ojo={x:3*c.w_2,y:0,z:0},c.evaluator.setVariable(c.ojoXStr,c.Ojo.x),c.evaluator.setVariable(c.ojoYStr,c.Ojo.y),c.evaluator.setVariable(c.ojoZStr,c.Ojo.z));v=c.x!==g.eval(c.xExpr)+c.displaceRegionWest;x=c.y!==g.eval(c.yExpr)+p.plecaHeight+c.displaceRegionNorth;c.spaceChange=a||v||x||c.drawBefore!==c.drawIfValue||c.Ox!==g.getVariable(c.OxStr)||c.Oy!==g.getVariable(c.OyStr)||c.Ojo.x!==
g.getVariable(c.ojoXStr)||c.Ojo.y!==g.getVariable(c.ojoYStr)||c.Ojo.z!==g.getVariable(c.ojoZStr)||c.scale!==g.getVariable(c.scaleStr);c.x=v?g.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=x?g.eval(c.yExpr)+p.plecaHeight+c.displaceRegionNorth:c.y;c.Ojo.x=g.getVariable(c.ojoXStr);c.Ojo.y=g.getVariable(c.ojoYStr);c.Ojo.z=g.getVariable(c.ojoZStr);c.Ox=g.getVariable(c.OxStr);c.Oy=g.getVariable(c.OyStr);c.scale=g.getVariable(c.scaleStr);c.drawBefore=c.drawIfValue;if(a||void 0==c.observer){a=0;for(var d=c.parent.controls.length;a<
d;a++)c.parent.controls[a].id===c.obsStr&&(L=!0);c.observer=L?g.getVariable(c.obsStr)||2.5*c.w_plus_h:2.5*c.w_plus_h;c.observer=b(c.observer,.25*c.w_plus_h);g.setVariable(c.obsStr,c.observer)}1E-6>c.scale?(c.scale=1E-6,g.setVariable(c.scaleStr,1E-6)):1E6<c.scale&&(c.scale=1E6,g.setVariable(c.scaleStr,1E6));if(v||x)c.container.style.left=c.x+"px",c.container.style.top=c.y+"px";c.container.style.display="block";c.dim=g.getVariable(c.userIDimStr);c.userIntensity=g.getVariable(c.userIIStr);c.light3={x:parseInt(g.getVariable(c.userIxStr)),
y:parseInt(g.getVariable(c.userIyStr)),z:parseInt(g.getVariable(c.userIzStr))};c.updateCamera();c.draw()}else c.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};R.prototype.rotateVertex=function(b){y=a.degToRad(c.evaluator.getVariable(c.rotZStr));w=k(y);z=f(y);h=b.x*w-b.y*z;e=b.x*z+b.y*w;d=b.z;y=a.degToRad(c.evaluator.getVariable(c.rotYStr));w=k(y);z=f(y);return{x:d*z+h*w,y:e,z:d*w-h*z}};R.prototype.project=function(a){c=this;this.evaluator.getVariable("URL.oldProj");
var b=c.eye.x/(a.x-c.eye.x);return{x:c.getAbsoluteX(b*(c.eye.y-a.y)),y:c.getAbsoluteY(b*(c.eye.z-a.z)),z:c.eye.x-a.x}};R.prototype.computeColor=function(c,b,d){c.match("rgba")?c=a.RGBAToHexColor(c):c.match("#")&&(c=new a.Color(c.substring(1)));M=a.subtract3D(this.eye,b.average);N=a.norm3D(M);O=a.scalarProduct3D(M,1/N);this.lights[3]=a.subtract3D(this.light3,b.average);G=a.norm3D(this.lights[3]);for(var e=0,g=this.intensity.length-1;e<g;e++)H[e]=this.intensity[e]*this.dim;H[3]=this.userIntensity*this.userIntensity/
G||0;A=d?this.dim/2:this.dim/4;I=0;C=0>b.direction?b.normal:a.scalarProduct3D(b.normal,-1);e=0;for(g=this.lights.length;e<g;e++)d?(I=Math.max(0,a.dotProduct3D(r(this.lights[e],C),O)),I*=I*I):I=Math.max(0,a.dotProduct3D(this.lights[e],C)),A+=H[e]*I;A=Math.min(A,1);B=m(c.r*A);E=m(c.g*A);J=m(c.b*A);return"rgba("+B+","+E+","+J+","+c.a+")"};R.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,
this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=
0,c=this.graphics.length;a<c;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,c=this.graphics.length;a<c;a++){q=this.graphics[a];for(var b=a+1;b<c;b++)l=this.graphics[b],q.splitFace(l),l.splitFace(q);this.primitives=this.primitives.concat(q.primitives||[])}else for(a=0,c=this.graphics.length;a<c;a++){q=this.graphics[a];if(q.split)for(b=a+1;b<c;b++)l=this.graphics[b],l.split&&q.splitFace(l);this.primitives=this.primitives.concat(q.primitives||[])}}a=0;for(c=this.primitives.length;a<
c;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,c){return c.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(a=0,c=this.primitives.length;a<c;a++)this.primitives[a].draw(this.ctx,this);a=0;for(c=this.graphicsCtr.length;a<c;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var c=a.length,b=0;b<c;b++)a[b].drawn=!1,a[b].draw(this.ctx,this);for(var d=[],e=[],g=0,f=a.length,h=.001,k,l;;){k=f;for(b=0;b<
c;b++)if(!a[b].drawn){l=!0;for(var p=0;p<c;p++)if(p!=b&&!a[p].drawn&&a[b].inFrontOf(d,a[p],h)){l=!1;break}l&&(f--,e[g++]=a[b],a[b].drawn=!0)}if(0==f)break;else if(f==k){if(h*=10,.1<h){for(b=0;b<c;b++)a[b].drawn||(e[g++]=a[b],a[b].drawn=!0);break}}else h=.001}for(b=0;b<c;b++)e[b].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,c){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-c)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function c(a){window.focus();
document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);window.removeEventListener("touchmove",g,!1);window.removeEventListener("touchend",c,!1);a.preventDefault();f.parent.update()}function b(c){document.body.focus();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);c.preventDefault();"R"===f.whichBtn&&(window.removeEventListener("mousemove",e,!1),f.posZoom==f.posZoomNew&&a.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",
g,!1);window.removeEventListener("mouseup",b,!1);f.parent.update()}function d(c){f.posAnte=a.getCursorPosition(c,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.id+".mouse_x",f.mouse_x);f.evaluator.setVariable(f.id+".mouse_y",f.mouse_y);f.parent.update()}function e(c){c.preventDefault();f.posZoomNew=a.getCursorPosition(c,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=
a.getCursorPosition(c,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function g(c){if(!f.fixed&&f.click){u=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;n=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(u!==f.disp.x||n!==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)-u,f.beta=a.radToDeg(f.beta)-n,f.evaluator.setVariable(f.rotZStr,
f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=u,f.disp.y=n,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);d(c);c.preventDefault()}}var f=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(b){window.focus();document.activeElement.blur();f.click=1;f.evaluator.setVariable(f.id+".mouse_pressed",1);f.parent.deactivateGraphicControls();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("touchmove",g);window.addEventListener("touchend",c);b.preventDefault()});this.canvas.addEventListener("mousedown",function(c){document.body.focus();f.click=1;f.parent.deactivateGraphicControls();f.whichBtn=a.whichBtn(c);"R"===f.whichBtn?(window.addEventListener("mouseup",b),f.posObserver=a.getCursorPosition(c,f.container).x,f.posObserverNew=f.posObserver,f.posZoom=a.getCursorPosition(c,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(c,f.container),f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y),d(c),window.addEventListener("mousemove",g),window.addEventListener("mouseup",b));c.preventDefault()});this.disp={x:0,y:0}};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,e,d,r,m,b,k=function(b,d){var e=a.Space.call(this,b,d)||this;h=e.parent.evaluator;void 0!=e._w_&&(b=h.parser.parse(e._w_),e._w_="number"!=b.type?b:void 0);void 0!=e._h_&&(b=h.parser.parse(e._h_),e._h_="number"!=b.type?b:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";e.file.match(/^\[/)&&e.file.match(/\]$/)?e.file=h.parser.parse(e.file.substring(1,e.file.length-1)):e.file.match(/^'/)&&e.file.match(/'$/)?
e.file=h.parser.parse(e.file):e.file=h.parser.parse("'"+e.file+"'");e.oldFile=h.eval(e.file);e.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=a.newHTML("div",{id:e.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+
e.zIndex+";background-repeat:no-repeat;background-position:center;"});e.container.appendChild(e.MyIFrame);e.imageSrc&&(e.container.style.backgroundImage="url("+e.imageSrc+")");e.parent.container.insertBefore(e.container,e.parent.loader);e.MyIFrame.onload=function(c){var b=this;e.evaluator.setFunction(e.id+".set",function(a,c){b.contentWindow.postMessage({type:"set",name:a,value:c},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){b.contentWindow.postMessage({type:"update"},"*");return 0});
e.evaluator.setFunction(e.id+".exec",function(a,c){b.contentWindow.postMessage({type:"exec",name:a,value:c},"*");return 0});e.evaluator.setFunction(e.id+".changeConf",function(c){if(c){if(a.cacheFiles[c])var d=a.cacheFiles[c];else d=(d=document.getElementById(c))&&"descartes/embed"===d.type?d.textContent:a.openExternalFile(c),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",a.cacheFiles[c]=d;b.contentWindow.postMessage({type:"change_config",filename:c,content:d},
"*")}return 0});e.ImReady=!e.isFirefox;e.isFirefox||(e.container.style.visibility="visible",e.container.style.opacity="1",e.container.style.zIndex=e.zIndex,e.container.style.display=e.drawIfValue?"block":"none");e.MyIFrame.style.visibility="visible";e.container.style.backgroundImage=""};e.update=e.iframeUpdate;e.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(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){h=this.evaluator;this.drawIfValue=0<h.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);e=this.x!==h.eval(this.xExpr)+this.displaceRegionWest;d=this.y!==h.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=e?h.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=d?h.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=h.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=a+"px",this.w=a));void 0!=this._h_&&(a=h.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(e||d)this.container.style.left=this.x+"px",this.container.style.top=
this.y+"px";r=h.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=h.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 h=1,e=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;")):(h=d.width<d.height?d.width/1144:d.height/1092,h=2.5<h?2.5:h,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*h+"px;"),this.progress.setAttribute("style","visibility:visible; left:"+(d.width-726*h)/2+"px; top:"+(33.5*d.height/100+940*h/2)+"px; width:"+726*h+"px; height:"+14*h+"px;"));d.loader.appendChild(this.imgLoader);d.loader.appendChild(this.progress);d.firstRun=!1;this.initPreloader()};
e.prototype.initPreloader=function(){var d=this,e=d.children,h=d.images,b=d.audios,k=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,f=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;h["lib/DescartesCCLicense.png"]=a.getCCLImg();h["lib/DescartesCCLicense.png"].addEventListener("load",function(){this.ready=1});h["lib/DescartesCCLicense.png"].addEventListener("error",function(){this.errorload=1});var g,p;var c=0;for(g=e.length;c<g;c++)if("rtf"!==e[c].name){if(e[c].value.match(/'macro'|'makro'/g)){var q="";var l=
d.lessonParser.split(e[c].value);var v=0;for(p=l.length;v<p;v++)"expresion"===babel[l[v][0]]&&(q=l[v][1]);if(q)var x=(x=document.getElementById(q))&&"descartes/macro"==x.type?x.text:a.openExternalFile(q);if(x&&(l=x.match(k)))for(q=0,p=l.length;q<p;q++)v=l[q],v.toLowerCase().match(/vacio.gif$/)||""==v.substring(0,v.length-4)||(h[v]=new Image,h[v].addEventListener("load",function(){this.ready=1}),h[v].addEventListener("error",function(){this.errorload=1}),h[v].src=v)}if(l=e[c].value.match(k))for(q=
0,p=l.length;q<p;q++)v=l[q],v.toLowerCase().match(/vacio.gif$/)||""==v.substring(0,v.length-4)||(h[v]=new Image,h[v].addEventListener("load",function(){this.ready=1}),h[v].addEventListener("error",function(){this.errorload=1}),h[v].src=v);if(l=e[c].value.match(f))for(q=0,v=l.length;q<v;q++)d.initAudio(l[q])}for(var u in h)h.hasOwnProperty(u)&&d.images.length++;for(u in b)b.hasOwnProperty(u)&&d.audios.length++;var n=d.images.length+d.audios.length;0<n&&d.progress.setAttribute("max",n);var y,w=function(){y=
0;for(var c in h)h.hasOwnProperty(c)&&(h[c].ready||h[c].errorload)&&y++;for(c in b)b.hasOwnProperty(c)&&(b[c].ready||b[c].errorload)&&y++;d.progress.setAttribute("value",y);y!=n?d.timer=a.setTimeout(w,1):d.descartesApp.initBuildApp()};w()};e.prototype.initAudio=function(d){var e=this.audios;e[d]=new Audio(d);e[d].filename=d;var h=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?
(console.warn("El archivo '"+d+"' no puede ser reproducido"),this.errorload=1):(e[d]=new Audio(this.filename.replace("mp3","ogg")),e[d].filename=this.filename.replace("mp3","ogg"),e[d].addEventListener("canplaythrough",h),e[d].addEventListener("load",h),e[d].addEventListener("error",b),e[d].load())};e[d].addEventListener("canplaythrough",h);e[d].addEventListener("load",h);e[d].addEventListener("error",b);a.hasTouchSupport?(e[d].load(),e[d].play(),a.setTimeout(function(){e[d].pause()},20),e[d].ready=
1):e[d].load()};a.DescartesLoader=e;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var b="[",e=0,c=a.length;e<c;e++)Array.isArray(a[e])?b+=h(a[e]):(d=a[e]||0,"string"==typeof d&&(d="'"+d+"'"),b+=d),e<c-1&&(b+=",");return b+"]"}function e(){r=window.innerWidth/this.width;m=window.innerHeight/this.height;a.cssScale=b=Math.min(r,m);this.container.style.transformOrigin="0 0";r<m?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+b+")"):(this.container.style.left="50%",this.container.style.transform=
"translate3d(0px, 0px, 0px) scale("+b+") translate(-50%, 0)")}if(a.loadLib)return a;var d,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 d=
0,e=this.children.length;d<e;d++)"CreativeCommonsLicense"===this.children[d].name&&(a.ccLicense="no"!==this.children[d].value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.getURLParameters();this.init()};k.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);this.licenseA=
a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var b=this.children,d,h=0,c=0,k=a.ccLicense?90:0,l=0,m=b.length;l<m;l++)d=b[l],"rtf_height"==d.name&&(h=parseInt(d.value)+120||this.height),"Buttons"==babel[d.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(d.value),c=this.buttonsConfig.height),"image_loader"==d.name&&(this.imgLoader=d.value),"expand"==d.name&&(this.expand=d.value),"docBase"==d.name&&(this.docBase=d.value,d=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(d));"cover"==this.expand&&
(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,h&&(this.height=h+c+k));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),
textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=
this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.parentNode.style.width="100vw",this.container.parentNode.style.height="100vh",this.scaleToFit=e,this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",
new a.DescartesLoader(this)):this.initBuildApp()};k.prototype.initBuildApp=function(){a.showConfig=!0;for(var b=this.children,d,e=this.lessonParser,c=[],h=[],k=[],m=[],r=[],u=[],n=0,y=b.length;n<y;n++)if(d=b[n],"editable"==babel[d.name])a.showConfig="false"==babel[d.value]?!1:!0;else if("language"==babel[d.name])this.language=d.value;else if("pleca"==d.name)d=e.parsePleca(d.value,this.width),this.container.insertBefore(d,this.loader),this.plecaHeight=d.imageHeight?d.imageHeight:d.offsetHeight;else if("Buttons"==
babel[d.name])this.buttonsConfig=e.parseButtonsConfig(d.value);else if("decimal_symbol"==babel[d.name])this.decimal_symbol=d.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[d.name])this.version=parseInt(d.value);else if("language"==babel[d.name])this.language=d.value;else if("rtf"==d.name){var w=(this.width-780)/2,z=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;m.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+
d.value.replace(/'/g,"&squot;")+"'");m.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+w+","+(z-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&m.push("space='descartesJS_stage' type='image' expresion='["+(w+15)+","+z+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==d.name.charAt(0)?(d.value.match(/'HTMLIFrame'/)&&this.nIframes++,c.push(d.value)):/^C_/.test(d.name)?h.push(d.value):/^A_/.test(d.name)?k.push(d.value):/^G_/.test(d.name)?
(d.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),m.push(d.value)):/^S_/.test(d.name)?r.push(d.value):"Animation"==babel[d.name]&&u.push(d.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_stage' fondo='"+(a.TextController?"ffffffff":"blanco")+"' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+
this.width+"' alto='"+this.height+"'"),this.stage.container.appendChild(this.stage.stageSpace.container),this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));n=0;for(y=c.length;n<y;n++)b=e.parseSpace(c[n]),this.arquimedes&&this.stage.container.appendChild(b.container),this.spaces.push(b),this.zIndex++;n=0;for(y=m.length;n<y;n++)if(a.DEBUG.elemIndex=n,c=e.parseGraphic(m[n]))this.editableRegionVisible=this.editableRegionVisible||c.visible,c.space.addGraph(c);n=0;
for(y=r.length;n<y;n++)(c=e.parse3DGraphic(r[n]))&&c.space.addGraph(c,!0);n=0;for(y=h.length;n<y;n++)this.controls.push(e.parseControl(h[n]));n=0;for(y=k.length;n<y;n++)e.parseAuxiliar(k[n]);n=0;for(y=u.length;n<y;n++)this.animation=e.parseAnimation(u[n]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();n=0;for(y=this.controls.length;n<y;n++)this.controls[n].init();this.updateControls();this.updateSpaces(!0);var B=this;this.nIframes?a.setTimeout(function(){B.finishInit()},200*
this.nIframes):this.finishInit()};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(g){console.warn("CustomEvents not supported in this browser")}this.readyApp=!0};k.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var b=parseInt(this.width)+
30,d=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-d)/2);window.resizeTo(b,d);a.onResize()};k.prototype.configRegions=function(){var b=this.evaluator.parser,d=this.buttonsConfig||{},e=this.container,c="15",h=100,k=100,m=100,r=100;2==this.version&&(c="14",h=63,k=50,m=44,r=53);var u=0,n=0,y=0,w=0,z=this.northSpace.controls,B=this.southSpace.controls,E=this.eastSpace.controls,J=this.westSpace.controls;if(0<d.rowsNorth||0<z.length||d.about||d.config){0>=
d.rowsNorth?(u=d.height,d.rowsNorth=1):u=d.height*d.rowsNorth;var G=this.northSpace.container;G.id="descartesJS_north";G.setAttribute("style","width:"+e.width+"px;height:"+u+"px;left:0;top:"+this.plecaHeight+"px;");e.insertBefore(G,this.loader);G=e.width;var H=0;d.about?(H=h,G-=H):h=0;d.config&&(G-=k);var A=Math.ceil(z.length/d.rowsNorth),I=G/A;var C=0;for(var M=z.length;C<M;C++)z[C].expresion=b.parse("("+(H+C%A*I)+","+d.height*Math.floor(C/A)+","+I+","+d.height+")"),z[C].drawif=b.parse("1"),z[C].init();
d.about&&(C=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(c),expresion:b.parse("(0, 0, "+h+", "+u+")")}),C.actionExec={execute:a.showAbout},C.update());d.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(c),action:"config",expresion:b.parse("("+(G+h)+", 0, "+k+", "+u+")")})).update()}if(0<d.rowsSouth||0<B.length||d.init||d.clear){0>=d.rowsSouth?(n=d.height,d.rowsSouth=1):n=d.height*d.rowsSouth;h=e.width;H=0;d.init?
(H=m,h-=H):m=0;d.clear&&(h-=r);G=this.southSpace.container;G.id="descartesJS_south";G.setAttribute("style","width:"+e.width+"px;height:"+n+"px;left:0;bottom:0;");e.insertBefore(G,this.loader);A=Math.ceil(B.length/d.rowsSouth);I=h/A;C=0;for(M=B.length;C<M;C++)B[C].expresion=b.parse("("+(H+C%A*I)+","+d.height*Math.floor(C/A)+","+I+","+d.height+")"),B[C].drawif=b.parse("1"),B[C].init();d.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(c),action:"init",
expresion:b.parse("(0, 0, "+m+", "+n+")")})).update();d.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(c),action:"clear",expresion:b.parse("("+(h+m)+", 0, "+r+", "+n+")")})).update()}if(0<E.length)for(C=e.height-u-n,y=d.widthEast,G=this.eastSpace.container,G.id="descartesJS_east",G.setAttribute("style","width:"+y+"px;height:"+C+"px;right:0;top:"+u+"px;"),e.insertBefore(G,this.loader),C=0,M=E.length;C<M;C++)E[C].expresion=b.parse("(0,"+d.height*
C+","+y+","+d.height+")"),E[C].drawif=b.parse("1"),E[C].init();if(0<J.length)for(C=e.height-u-n,w=d.widthWest,G=this.westSpace.container,G.id="descartesJS_west",G.setAttribute("style","width: "+w+"px;height:"+C+"px;left:0;top:"+u+"px;"),e.insertBefore(G,this.loader),C=0,M=J.length;C<M;C++)J[C].expresion=b.parse("(0,"+d.height*C+","+w+","+d.height+")"),J[C].drawif=b.parse("1"),J[C].init();if(this.editableRegionVisible)for(b=d.height,G=this.editableRegion.container,G.id="descartesJS_editableRegion",
G.setAttribute("style","width:"+e.width+"px;height:"+b+"px;left:0;top:"+(e.height-n-d.height)+"px;"),e.insertBefore(G,this.loader),d=this.editableRegion.textFields,e=e.width/d.length,J=a.getFieldFontSize(b),C=0,M=d.length;C<M;C++)"div"==d[C].type?(G.appendChild(d[C].container),d[C].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+b+"px;position:absolute;left:"+C*e+"px;top:0;"),E=d[C].container.firstChild,E.setAttribute("style","font-family:"+a.sansserif_font+
";font-size:"+J+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+b+"px;text-align:center;line-height:"+b+"px;"),c=E.offsetWidth,E.style.width=c+"px",E.firstChild.textContent=E.firstChild.textContent.substring(3,E.firstChild.textContent.length-3),d[C].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+J+"px;width:"+(e-c)+"px;height:"+b+"px;position:absolute;left:"+c+"px;top:0;border:2px groove white;")):(G.appendChild(d[C]),d[C].setAttribute("style",
"font-family:"+a.monospace_font+";font-size:"+J+"px;width:"+e+"px;height:"+b+"px;position:absolute;left:"+C*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=u;this.displaceRegionSouth=n;this.displaceRegionEast=y;this.displaceRegionWest=w;C=0;for(M=this.spaces.length;C<M;C++)this.spaces[C].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,d=this.controls.length;b<d;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 d=this.audios;if(b){if(!d[b]){b.lastIndexOf(".");d[b]=new Audio(b);var e=function(a){this.ready=1};d[b].addEventListener("canplaythrough",e);var c=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(d[b]=new Audio(b.replace("mp3","ogg")),d[b].addEventListener("canplaythrough",e),d[b].addEventListener("load",e),d[b].addEventListener("error",c),d[b].load())};d[b].addEventListener("error",
c);d[b].play();a.setTimeout(function(){d[b].pause()},15)}return d[b]}return new Audio};k.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};k.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var d,c=0,e=this.controls.length;c<e;c++)if(d=this.controls[c],d[b]==a)return d;return{update:function(){},w:0,h:0}};k.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};k.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var d,c=0,e=this.spaces.length;c<e;c++)if(d=
this.spaces[c],d[b]==a)return d;return{update:function(){},w:0,h:0}};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,c=a.length;d<c;d++)b=a[d].split("="),2==b.length&&(+b[1]==+b[1]&&(b[1]=parseFloat(b[1])),this.evaluator.setVariable("URL."+b[0],b[1]))}};k.prototype.getState=function(){var a="",b=this.evaluator.variables,d;for(d in b)if(b.hasOwnProperty(d)){var c=b[d];"string"==typeof c&&(c=
"'"+c+"'");void 0!=c&&"rnd"!=d&&"\u03c0"!=d&&"pi"!=d&&"e"!=d&&"Infinity"!=d&&"-Infinity"!=d&&"object"!=typeof c&&(a=""!=a?a+"\n"+d+"="+c:d+"="+c)}c=this.evaluator.vectors;for(var e in c)c.hasOwnProperty(e)&&(a+="\n"+e+"="+h(c[e]));e=this.evaluator.matrices;for(var k in e)e.hasOwnProperty(k)&&(a+="\n"+k+"="+h(e[k]));return a};k.prototype.setState=function(a,b){a=a.split("\n");for(var d,c,e=0,f=a.length;e<f;e++)d=a[e].split("="),2<=d.length&&(c=eval(d[1]),-1!=d[1].indexOf("[[")?(this.evaluator.matrices[d[0]]=
c,this.evaluator.matrices[d[0]].rows=c.length,this.evaluator.matrices[d[0]].cols=c[0].length):-1!=d[1].indexOf("[")?(this.evaluator.vectors[d[0]]=c,this.evaluator.variables[d[0]+".long"]=c.length):this.evaluator.variables[d[0]]=c);b||this.update()};k.prototype.getEvaluation=function(){for(var a=correct=0,b="",d=0,c=this.controls.length;d<c;d++)"textfield"==this.controls[d].gui&&this.controls[d].evaluate&&(a++,correct+=this.controls[d].ok,this.controls[d].value=""==this.controls[d].value?"''":this.controls[d].value,
b+=" \\n "+this.controls[d].id+"="+this.controls[d].value+"|"+this.controls[d].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};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(h,e){h="Error: "+h+" en\u300a "+e+" \u300b";var d="";switch(a.DEBUG.objectName){case "Auxiliar":e="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])d=" en la l\u00ednea "+(a.DEBUG.lineCount+1);h+=e+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+d+".";break;case "Graphic":h+="En el gr\u00e1fico #"+(a.DEBUG.elemIndex+1)+" de tipo \u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(h)}};return a}(descartesJS||{});
descartesJS=function(a){function h(){e().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function e(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(a.getAttribute("code"))})}function d(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function r(b){b=a.newHTML("div");var e='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbola DJS_extra DJS_sansserif DJS_serif DJS_monospace".split(" ").forEach(function(a){e+='<div style="font-family:'+a+';"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>'});b.innerHTML=e+"</div>";document.body.appendChild(b);a.getFeatures();a.hasCanvas?(window.scrollTo(0,10),d(),h(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";b.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();a.onResize=
function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var m=Object.create(null);a.onMessage=function(b){if(0<a.apps.length){var d=b.data;if(d)if("set"===d.type)"string"==typeof d.value||"number"==typeof d.value?a.apps[0].evaluator.setVariable(d.name,d.value):d.value&&void 0!=d.value.rows?a.apps[0].evaluator.matrices[d.name]=d.value:a.apps[0].evaluator.vectors[d.name]=d.value;else if("update"===d.type)a.apps[0].update();else if("exec"===d.type)(b=a.apps[0].evaluator.getFunction(d.name))&&b.apply(a.apps[0].evaluator,
d.value.toString().split(","));else if("isResizeNeeded"===d.type)b.source.postMessage({type:"doResize"},"*");else if("doResize"===d.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===d.type){m[d.filename]?b=m[d.filename]:(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),m[d.filename]=b);var e=document.querySelector("base");e||(e=a.newHTML("base"),document.body.appendChild(e));e.setAttribute("href",d.filename);a.apps[0].children=b;a.apps[0].init()}}};void 0==
a.loadLib&&(a.loadLib=!0,window.addEventListener("load",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||{});
